-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fixIssue14455
- Loading branch information
Showing
21 changed files
with
499 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
## Incremental migration | ||
|
||
We have recently released a new version, v11, of our component library and a | ||
common question we receive is if users can adopt v11 incrementally and the | ||
answer is yes! If the burden of migrating to v11 is too big to take on all at | ||
once, but there are features of our latest release you want to take advantage | ||
of, it is likely that you can pull in just the parts you are wanting to use | ||
while keeping the rest of your Carbon usage the same. | ||
|
||
This example illustrates how v11 and v10 work together. | ||
|
||
## Getting Started | ||
|
||
First, run `yarn build` in the root of the `carbon` repository. | ||
|
||
```sh | ||
yarn install && yarn build | ||
``` | ||
|
||
Now, all you need to do is `cd` into the directory and run: | ||
|
||
```sh | ||
yarn install | ||
# or | ||
npm install | ||
|
||
|
||
yarn dev | ||
# or | ||
npm run dev | ||
``` | ||
|
||
This example only takes a little bit of time to start, once it's up and running, | ||
it's very fast. | ||
|
||
Open [http://localhost:5173](http://localhost:5173) with your browser to see the | ||
result. | ||
|
||
## Sass | ||
|
||
First and foremost, if you want to use v11 styles in any capacity, you'll have | ||
to migrate to use `dart-sass`. `node-sass` has been deprecated and we migrated | ||
to `dart-sass` in v11. For more information about migrating, visit our docs | ||
[here](https://github.com/carbon-design-system/carbon/blob/main/docs/migration/v11.md#changing-from-node-sass-to-sass). | ||
|
||
## V10 and V11 | ||
|
||
This example is mainly v10, but it takes advantage of the new Stack component | ||
from v11 and uses v11's StructuredList component 🎉. StructuredList had a major | ||
accessibilty revamp in v11 that you might want to use and this examples shows | ||
you how. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite App</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.jsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "incremental-migration-vite", | ||
"private": true, | ||
"version": "0.1.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@carbon/icons-react": "^10.49.0", | ||
"@carbon/react": "^1.34.0", | ||
"carbon-components": "^10.57.0", | ||
"carbon-components-react": "^7.57.0", | ||
"carbon-icons": "^7.0.7", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-react": "4.0.0", | ||
"sass": "^1.51.0", | ||
"vite": "^4.3.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
import React from 'react'; | ||
import { | ||
Button, | ||
Content, | ||
Header, | ||
SkipToContent, | ||
HeaderName, | ||
Toggle, | ||
NumberInput, | ||
RadioButtonGroup, | ||
RadioButton, | ||
Search, | ||
Select, | ||
SelectItem, | ||
TextInput, | ||
TextArea, | ||
} from 'carbon-components-react'; | ||
import { | ||
StructuredListBody, | ||
StructuredListWrapper, | ||
StructuredListHead, | ||
StructuredListRow, | ||
StructuredListCell, | ||
Stack, | ||
} from '@carbon/react'; | ||
import Head from 'next/head'; | ||
import styles from './scss/App.module.css'; | ||
|
||
export default function App() { | ||
const numberInputProps = { | ||
className: 'some-class', | ||
id: 'number-input-1', | ||
label: 'Number Input', | ||
min: 0, | ||
max: 100, | ||
value: 50, | ||
step: 10, | ||
}; | ||
|
||
const toggleProps = { | ||
className: 'some-class', | ||
}; | ||
|
||
const radioProps = { | ||
className: 'some-class', | ||
}; | ||
|
||
const searchProps = { | ||
className: 'some-class', | ||
}; | ||
|
||
const selectProps = { | ||
className: 'some-class', | ||
}; | ||
|
||
const TextInputProps = { | ||
className: 'some-class', | ||
id: 'test2', | ||
labelText: 'Text Input label', | ||
placeholder: 'Placeholder text', | ||
}; | ||
|
||
const textareaProps = { | ||
labelText: 'Text Area label', | ||
className: 'some-class', | ||
placeholder: 'Placeholder text', | ||
id: 'test5', | ||
cols: 50, | ||
rows: 4, | ||
}; | ||
|
||
const buttonEvents = { | ||
className: 'some-class', | ||
}; | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<Head> | ||
<title>Create Next App</title> | ||
<meta name="description" content="Generated by create next app" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
|
||
<Header aria-label="IBM Platform Name"> | ||
<SkipToContent /> | ||
<HeaderName href="#" prefix="IBM"> | ||
[Platform] | ||
</HeaderName> | ||
</Header> | ||
<Content> | ||
<Stack gap={6}> | ||
<NumberInput {...numberInputProps} /> | ||
<Toggle {...toggleProps} id="toggle-1" /> | ||
<RadioButtonGroup | ||
onChange={() => {}} | ||
name="radio-button-group" | ||
defaultSelected="default-selected"> | ||
<RadioButton | ||
value="standard" | ||
id="radio-1" | ||
labelText="Standard Radio Button" | ||
{...radioProps} | ||
/> | ||
<RadioButton | ||
value="default-selected" | ||
labelText="Default Selected Radio Button" | ||
id="radio-2" | ||
{...radioProps} | ||
/> | ||
<RadioButton | ||
value="blue" | ||
labelText="Standard Radio Button" | ||
id="radio-3" | ||
{...radioProps} | ||
/> | ||
<RadioButton | ||
value="disabled" | ||
labelText="Disabled Radio Button" | ||
id="radio-4" | ||
disabled | ||
{...radioProps} | ||
/> | ||
</RadioButtonGroup> | ||
<StructuredListWrapper> | ||
<StructuredListHead> | ||
<StructuredListRow head> | ||
<StructuredListCell head>ColumnA</StructuredListCell> | ||
<StructuredListCell head>ColumnB</StructuredListCell> | ||
<StructuredListCell head>ColumnC</StructuredListCell> | ||
</StructuredListRow> | ||
</StructuredListHead> | ||
<StructuredListBody> | ||
<StructuredListRow> | ||
<StructuredListCell noWrap>Row 1</StructuredListCell> | ||
<StructuredListCell>Row 1</StructuredListCell> | ||
<StructuredListCell> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc | ||
dui magna, finibus id tortor sed, aliquet bibendum augue. | ||
Aenean posuere sem vel euismod dignissim. Nulla ut cursus | ||
dolor. Pellentesque vulputate nisl a porttitor interdum. | ||
</StructuredListCell> | ||
</StructuredListRow> | ||
<StructuredListRow> | ||
<StructuredListCell noWrap>Row 2</StructuredListCell> | ||
<StructuredListCell>Row 2</StructuredListCell> | ||
<StructuredListCell> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc | ||
dui magna, finibus id tortor sed, aliquet bibendum augue. | ||
Aenean posuere sem vel euismod dignissim. Nulla ut cursus | ||
dolor. Pellentesque vulputate nisl a porttitor interdum. | ||
</StructuredListCell> | ||
</StructuredListRow> | ||
</StructuredListBody> | ||
</StructuredListWrapper> | ||
<Search | ||
{...searchProps} | ||
id="search-1" | ||
labelText="Search" | ||
placeholder="Search" | ||
/> | ||
<Select | ||
{...selectProps} | ||
id="select-1" | ||
defaultValue="placeholder-item"> | ||
<SelectItem | ||
disabled | ||
hidden | ||
value="placeholder-item" | ||
text="Choose an option" | ||
/> | ||
<SelectItem value="option-1" text="Option 1" /> | ||
<SelectItem value="option-2" text="Option 2" /> | ||
<SelectItem value="option-3" text="Option 3" /> | ||
</Select> | ||
<TextInput {...TextInputProps} /> | ||
<TextArea {...textareaProps} /> | ||
<div className={styles.someClass}> | ||
<Button type="submit" {...buttonEvents}> | ||
Submit | ||
</Button> | ||
</div> | ||
</Stack> | ||
</Content> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@use '@carbon/react' with ( | ||
$font-path: '@ibm/plex' | ||
); | ||
|
||
@use '@carbon/react/scss/components/structured-list'; | ||
@use '@carbon/react/scss/components/stack'; | ||
@import 'carbon-components/scss/globals/scss/styles'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import './index.scss'; | ||
|
||
import React from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import App from './App'; | ||
|
||
const domNode = document.getElementById('root'); | ||
const root = createRoot(domNode); | ||
root.render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode> | ||
); |
14 changes: 14 additions & 0 deletions
14
examples/incremental-migration-vite/src/scss/App.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.container { | ||
padding: 0 2rem; | ||
} | ||
|
||
.someClass { | ||
padding-top: 1rem; | ||
} | ||
|
||
@media (max-width: 600px) { | ||
.grid { | ||
width: 100%; | ||
flex-direction: column; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.