-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #491 from tianenpang/refactor/radio
refactor(react-radio): integration with react-aria radio
- Loading branch information
Showing
30 changed files
with
1,018 additions
and
905 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
40 changes: 40 additions & 0 deletions
40
apps/docs/content/components/radio/controlled-vs-uncontrolled.ts
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,40 @@ | ||
const App = `import React from 'react' | ||
import { Radio, Grid } from "@nextui-org/react"; | ||
export default function App() { | ||
const [checked, setChecked] = React.useState('B'); | ||
return ( | ||
<Grid.Container gap={2}> | ||
<Grid> | ||
<Radio.Group label="Options (controlled)" defaultValue="A"> | ||
<Radio value="A">Option A</Radio> | ||
<Radio value="B">Option B</Radio> | ||
<Radio value="C">Option C</Radio> | ||
<Radio value="D">Option D</Radio> | ||
</Radio.Group> | ||
</Grid> | ||
<Grid> | ||
<Radio.Group | ||
label="Options (uncontrolled)" | ||
color="secondary" | ||
value={checked} | ||
onChange={setChecked} | ||
> | ||
<Radio value="A">Option A</Radio> | ||
<Radio value="B">Option B</Radio> | ||
<Radio value="C">Option C</Radio> | ||
<Radio value="D">Option D</Radio> | ||
</Radio.Group> | ||
</Grid> | ||
</Grid.Container> | ||
); | ||
}`; | ||
|
||
const react = { | ||
'/App.js': App | ||
}; | ||
|
||
export default { | ||
...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
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
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
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,31 @@ | ||
const App = `import React from 'react' | ||
import { Radio, Text, Spacer } from "@nextui-org/react"; | ||
export default function App() { | ||
const [checked, setChecked] = React.useState(''); | ||
return ( | ||
<> | ||
<Radio.Group | ||
label="Options" | ||
value={checked} | ||
onChange={setChecked} | ||
> | ||
<Radio value="A">Option A</Radio> | ||
<Radio value="B">Option B</Radio> | ||
<Radio value="C">Option C</Radio> | ||
<Radio value="D">Option D</Radio> | ||
</Radio.Group> | ||
<Spacer y={1} /> | ||
<Text>You've checked: {checked}</Text> | ||
</> | ||
); | ||
}`; | ||
|
||
const react = { | ||
'/App.js': App | ||
}; | ||
|
||
export default { | ||
...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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
import default_radio from "./default"; | ||
import disabled from "./disabled"; | ||
import size from "./size"; | ||
import color from "./color"; | ||
import textColor from "./textColor"; | ||
import squared from "./squared"; | ||
import description from "./description"; | ||
import row from "./row"; | ||
import default_radio from './default'; | ||
import disabled from './disabled'; | ||
import size from './size'; | ||
import color from './color'; | ||
import labelColor from './labelColor'; | ||
import squared from './squared'; | ||
import description from './description'; | ||
import row from './row'; | ||
import noAnimation from './noAnimation'; | ||
import controlledVsUncontrolled from './controlled-vs-uncontrolled'; | ||
import events from './events'; | ||
|
||
export default { | ||
default_radio, | ||
disabled, | ||
size, | ||
color, | ||
textColor, | ||
labelColor, | ||
squared, | ||
description, | ||
row, | ||
noAnimation, | ||
controlledVsUncontrolled, | ||
events | ||
}; |
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,31 @@ | ||
const App = `import { Radio } from "@nextui-org/react"; | ||
export default function App() { | ||
return ( | ||
<Radio.Group label="Label colors" defaultValue="primary" isRow> | ||
<Radio value="primary" color="primary" labelColor="primary"> | ||
primary | ||
</Radio> | ||
<Radio value="secondary" color="secondary" labelColor="secondary"> | ||
secondary | ||
</Radio> | ||
<Radio value="success" color="success" labelColor="success"> | ||
success | ||
</Radio> | ||
<Radio value="warning" color="warning" labelColor="warning"> | ||
warning | ||
</Radio> | ||
<Radio value="error" color="error" labelColor="error"> | ||
error | ||
</Radio> | ||
</Radio.Group> | ||
); | ||
}`; | ||
|
||
const react = { | ||
'/App.js': App | ||
}; | ||
|
||
export default { | ||
...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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const App = `import { Radio } from "@nextui-org/react"; | ||
export default function App() { | ||
return ( | ||
<Radio.Group label="Options" defaultValue="1"> | ||
<Radio value="1" disableAnimation={true}>Option 1</Radio> | ||
<Radio value="2" disableAnimation={true}>Option 2</Radio> | ||
<Radio value="3" disableAnimation={true}>Option 3</Radio> | ||
<Radio value="4" disableAnimation={true}>Option 4</Radio> | ||
</Radio.Group> | ||
); | ||
}`; | ||
|
||
const react = { | ||
'/App.js': App | ||
}; | ||
|
||
export default { | ||
...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
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
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.