Skip to content

feat: ResizeBar initial commit #579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions examples/react/ResizeBar/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
@license

Copyright IBM Corp. 2025

This source code is licensed under the Apache-2.0 license found in the
LICENSE file in the root directory of this source tree.
-->

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@carbon-labs/react-resize-bar stackblitz</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions examples/react/ResizeBar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "carbon-labs-react-resize-bar-example",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@carbon/react": "^1.78.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@carbon-labs/react-resize-bar": "latest",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.1",
"sass": "~1.83.0",
"typescript": "^5.2.2",
"vite": "^5.0.8"
}
}
17 changes: 17 additions & 0 deletions examples/react/ResizeBar/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import { ResizeBar } from '@carbon-labs/react-resize-bar/es/index';

function App() {
return <ResizeBar />;
}

export default App;
9 changes: 9 additions & 0 deletions examples/react/ResizeBar/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

@use '@carbon/react';
@use '@carbon-labs/react-resize-bar/scss/resize-bar';
19 changes: 19 additions & 0 deletions examples/react/ResizeBar/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';
import './index.scss';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
10 changes: 10 additions & 0 deletions examples/react/ResizeBar/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

/// <reference types="vite/client" />
25 changes: 25 additions & 0 deletions examples/react/ResizeBar/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions examples/react/ResizeBar/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
16 changes: 16 additions & 0 deletions examples/react/ResizeBar/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
34 changes: 34 additions & 0 deletions packages/react/src/components/ResizeBar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<p align="center">
<a href="https://www.carbondesignsystem.com">
<img alt="Carbon Design System" src="https://user-images.githubusercontent.com/3901764/57545698-ce5f2380-7320-11e9-8682-903df232d7b0.png" width="100%" />
</a>
</p>
<h1 align="center">
Carbon Labs
</h1>

> A community-driven incubation space enabling rapid prototyping, development,
> and deployment of Carbon-based components.

## Getting started

Install `@carbon-labs/ResizeBar` to use this package.

### Storybook

You can view the current state of the
[component](https://labs.carbondesignsystem.com/react/).

## 📝 License

Licensed under the
[Apache 2.0 License](https://github.com/carbon-design-system/carbon-labs/blob/main/LICENSE).

## <picture><source height="20" width="20" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-dark.svg"><source height="20" width="20" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"><img height="20" width="20" alt="IBM Telemetry" src="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"></picture> IBM Telemetry

This package uses IBM Telemetry to collect de-identified and anonymized metrics
data. By installing this package as a dependency you are agreeing to telemetry
collection. To opt out, see
[Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
For more information on the data being collected, please see the
[IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { ArgTypes, Canvas, Meta } from '@storybook/blocks';
import * as ResizeBarStories from './ResizeBar.stories';

<Meta isTemplate />

# ResizeBar

- **Initiative owner(s):** Nandan Devadula
- **Status:** Draft
- **Target library:** TBD
- **Target library maintainer(s) / PR Reviewer(s):** N/A
- **Support channel:** `#carbon-labs`

{/* <!-- START doctoc generated TOC please keep comment here to allow auto update --> */}
{/* <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> */}

> 💡 Check our
> [Stackblitz](https://stackblitz.com/github/carbon-design-system/carbon-labs/tree/main/examples/react/ResizeBar)
> example implementation.

[![Edit carbon-labs](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/carbon-design-system/carbon-labs/tree/main/examples/react/ResizeBar)

## Table of Contents

- [Overview](#overview)
- [Getting started](#getting-started)

{/* <!-- END doctoc generated TOC please keep comment here to allow auto update --> */}

## Overview

`ResizeBar` is an atomic component extracted from `SplitPanel` and made into an independent component. which can be reused where ever there is a resizing requirement in the ui.

<Canvas of={ResizeBarStories.TwoPanelsVertical} />

## Getting started

Here's a quick example to get you started.

```bash
yarn add @carbon/react
yarn add @carbon-labs/react-resize-bar
```

### JS (via import)

```javascript
import { ResizeBar } from '@carbon-labs/react-resize-bar/es/index';

function App() {
return <ResizeBar />;
}

export default App;
```

### SCSS

In your styles file import

```
@use '@carbon/react';
@use '@carbon-labs/react-resize-bar/scss/resize-bar';
```
Loading
Loading