diff --git a/packages/react-components/react-radio/stories/Radio/RadioDefault.stories.tsx b/packages/react-components/react-radio/stories/Radio/RadioDefault.stories.tsx deleted file mode 100644 index a5c810a7802be..0000000000000 --- a/packages/react-components/react-radio/stories/Radio/RadioDefault.stories.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import * as React from 'react'; -import type { RadioProps } from '@fluentui/react-components'; -import { makeStyles, Radio, tokens, useId } from '@fluentui/react-components'; - -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); - -export const Default = (props: Partial) => { - const radioName = useId('radio'); - const styles = useStyles(); - const labelId = useId('label'); - return ( -
- -
- - - - -
-
- ); -}; diff --git a/packages/react-components/react-radio/stories/Radio/RadioDescription.md b/packages/react-components/react-radio/stories/Radio/RadioDescription.md deleted file mode 100644 index 550b604eccef4..0000000000000 --- a/packages/react-components/react-radio/stories/Radio/RadioDescription.md +++ /dev/null @@ -1,3 +0,0 @@ -Radio is a single item in a RadioGroup. It is strongly recommended to use them inside a RadioGroup or RadioGroupField. However, they can also be used on their own: any Radio items with the same name will be treated as part of the same group. - -See documentation for RadioGroup for more examples. diff --git a/packages/react-components/react-radio/stories/Radio/index.stories.tsx b/packages/react-components/react-radio/stories/Radio/index.stories.tsx deleted file mode 100644 index 6ab1e5d4cebe2..0000000000000 --- a/packages/react-components/react-radio/stories/Radio/index.stories.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Radio } from '@fluentui/react-components'; -import descriptionMd from './RadioDescription.md'; - -export { Default } from './RadioDefault.stories'; - -export default { - title: 'Components/Radio', - component: Radio, - parameters: { - docs: { - description: { - component: descriptionMd, - }, - }, - }, -}; diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupControlledValue.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupControlledValue.stories.tsx index cd96ccf287601..d91d037f4266f 100644 --- a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupControlledValue.stories.tsx +++ b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupControlledValue.stories.tsx @@ -1,30 +1,26 @@ import * as React from 'react'; -import { Label, makeStyles, Radio, RadioGroup, tokens, useId } from '@fluentui/react-components'; -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); +import { Field, Radio, RadioGroup, Button } from '@fluentui/react-components'; export const ControlledValue = () => { const [value, setValue] = React.useState('banana'); - const styles = useStyles(); - const labelId = useId('label'); return ( -
- - setValue(data.value)} aria-labelledby={labelId}> - - - - - -
Current value: {value}
-
+ <> + + setValue(data.value)}> + + + + + + + + ); }; + ControlledValue.parameters = { docs: { description: { diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDefault.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDefault.stories.tsx index 901089b803af5..85a962b32c24c 100644 --- a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDefault.stories.tsx +++ b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDefault.stories.tsx @@ -1,26 +1,15 @@ import * as React from 'react'; -import type { RadioGroupProps } from '@fluentui/react-components'; -import { Label, makeStyles, Radio, RadioGroup, tokens, useId } from '@fluentui/react-components'; -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); +import type { RadioGroupProps } from '@fluentui/react-components'; +import { Field, Radio, RadioGroup } from '@fluentui/react-components'; -export const Default = (props: Partial) => { - const styles = useStyles(); - const labelId = useId('label'); - return ( -
- - - - - - - -
- ); -}; +export const Default = (props: Partial) => ( + + + + + + + + +); diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDefaultValue.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDefaultValue.stories.tsx new file mode 100644 index 0000000000000..3357d9f3d1317 --- /dev/null +++ b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDefaultValue.stories.tsx @@ -0,0 +1,25 @@ +import * as React from 'react'; + +import { Field, Radio, RadioGroup } from '@fluentui/react-components'; + +export const DefaultValue = () => ( + + + + + + + + +); + +DefaultValue.parameters = { + docs: { + description: { + story: + 'The initially selected item can be set by setting the `defaultValue` of RadioGroup. ' + + 'Alternatively, one Radio item can have `defaultChecked` set. ' + + 'Both methods have the same effect, but only one should be used in a given RadioGroup.', + }, + }, +}; diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDisabled.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDisabled.stories.tsx index 035b555869c94..4a696ece340d5 100644 --- a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDisabled.stories.tsx +++ b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDisabled.stories.tsx @@ -1,28 +1,18 @@ import * as React from 'react'; -import { Label, makeStyles, Radio, RadioGroup, tokens, useId } from '@fluentui/react-components'; -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); +import { Field, Radio, RadioGroup } from '@fluentui/react-components'; + +export const Disabled = () => ( + + + + + + + + +); -export const Disabled = () => { - const styles = useStyles(); - const labelId = useId('label'); - return ( -
- - - - - - - -
- ); -}; Disabled.parameters = { docs: { description: { diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDisabledItem.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDisabledItem.stories.tsx index 3bafffc046b38..39bd401a9b247 100644 --- a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDisabledItem.stories.tsx +++ b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupDisabledItem.stories.tsx @@ -1,28 +1,18 @@ import * as React from 'react'; -import { Label, makeStyles, Radio, RadioGroup, tokens, useId } from '@fluentui/react-components'; -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); +import { Field, Radio, RadioGroup } from '@fluentui/react-components'; + +export const DisabledItem = () => ( + + + + + + + + +); -export const DisabledItem = () => { - const styles = useStyles(); - const labelId = useId('label'); - return ( -
- - - - - - - -
- ); -}; DisabledItem.parameters = { docs: { description: { diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupHorizontal.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupHorizontal.stories.tsx index 8e3159b9d5e4e..18d137f127fdd 100644 --- a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupHorizontal.stories.tsx +++ b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupHorizontal.stories.tsx @@ -1,28 +1,18 @@ import * as React from 'react'; -import { Label, makeStyles, Radio, RadioGroup, tokens, useId } from '@fluentui/react-components'; -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); +import { Field, Radio, RadioGroup } from '@fluentui/react-components'; + +export const Horizontal = () => ( + + + + + + + + +); -export const Horizontal = () => { - const styles = useStyles(); - const labelId = useId('label'); - return ( -
- - - - - - - -
- ); -}; Horizontal.storyName = 'Layout: horizontal'; Horizontal.parameters = { docs: { diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupHorizontalStacked.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupHorizontalStacked.stories.tsx index 5c0a671e506d7..660fef2723675 100644 --- a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupHorizontalStacked.stories.tsx +++ b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupHorizontalStacked.stories.tsx @@ -1,29 +1,18 @@ import * as React from 'react'; -import { Label, makeStyles, Radio, RadioGroup, tokens, useId } from '@fluentui/react-components'; -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); +import { Field, Radio, RadioGroup } from '@fluentui/react-components'; -export const HorizontalStacked = () => { - const styles = useStyles(); - const labelId = useId('label'); +export const HorizontalStacked = () => ( + + + + + + + + +); - return ( -
- - - - - - - -
- ); -}; HorizontalStacked.storyName = 'Layout: horizontal-stacked'; HorizontalStacked.parameters = { docs: { diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupLabelSubtext.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupLabelSubtext.stories.tsx index 4c617e48a2db2..633b70d1c5697 100644 --- a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupLabelSubtext.stories.tsx +++ b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupLabelSubtext.stories.tsx @@ -1,44 +1,34 @@ import * as React from 'react'; -import { Label, makeStyles, Radio, RadioGroup, Text, tokens, useId } from '@fluentui/react-components'; -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); +import { Field, Radio, RadioGroup, Text } from '@fluentui/react-components'; + +export const LabelSubtext = () => ( + + + + Banana +
+ This is an example subtext of the first option + + } + /> + + Pear +
+ This is some more example subtext + + } + /> +
+
+); -export const LabelSubtext = () => { - const styles = useStyles(); - const labelId = useId('label'); - return ( -
- - - - Banana -
- This is an example subtext of the first option - - } - /> - - Pear -
- This is some more example subtext - - } - /> -
-
- ); -}; LabelSubtext.parameters = { docs: { description: { diff --git a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupLabeled.stories.tsx b/packages/react-components/react-radio/stories/RadioGroup/RadioGroupLabeled.stories.tsx deleted file mode 100644 index f00948cae5e66..0000000000000 --- a/packages/react-components/react-radio/stories/RadioGroup/RadioGroupLabeled.stories.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import * as React from 'react'; -import { Label, makeStyles, Radio, RadioGroup, tokens, useId } from '@fluentui/react-components'; - -const useStyles = makeStyles({ - field: { - display: 'grid', - gridRowGap: tokens.spacingVerticalS, - }, -}); - -export const Labeled = () => { - const styles = useStyles(); - const labelId = useId('label-'); - return ( -
- - - - - - - -
- ); -}; -Labeled.parameters = { - docs: { - description: { - story: - 'Use the `aria-labelledby` property on RadioGroup to associate a label with the group.
' + - '**Note**: The `