@fluentui/react-radio 9.1.8 → 9.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.json +97 -1
  2. package/CHANGELOG.md +31 -2
  3. package/dist/index.d.ts +13 -25
  4. package/lib/components/Radio/useRadio.js +11 -14
  5. package/lib/components/Radio/useRadio.js.map +1 -1
  6. package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -1
  7. package/lib/contexts/RadioGroupContext.js +11 -3
  8. package/lib/contexts/RadioGroupContext.js.map +1 -1
  9. package/lib/contexts/useRadioGroupContextValues.js +6 -3
  10. package/lib/contexts/useRadioGroupContextValues.js.map +1 -1
  11. package/lib/index.js +1 -3
  12. package/lib/index.js.map +1 -1
  13. package/lib-commonjs/components/Radio/useRadio.js +4 -8
  14. package/lib-commonjs/components/Radio/useRadio.js.map +1 -1
  15. package/lib-commonjs/contexts/RadioGroupContext.js +6 -3
  16. package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -1
  17. package/lib-commonjs/contexts/useRadioGroupContextValues.js +15 -3
  18. package/lib-commonjs/contexts/useRadioGroupContextValues.js.map +1 -1
  19. package/lib-commonjs/index.js +1 -3
  20. package/lib-commonjs/index.js.map +1 -1
  21. package/package.json +5 -6
  22. package/lib/RadioGroupField.js +0 -2
  23. package/lib/RadioGroupField.js.map +0 -1
  24. package/lib/components/RadioGroupField/RadioGroupField.js +0 -7
  25. package/lib/components/RadioGroupField/RadioGroupField.js.map +0 -1
  26. package/lib/components/RadioGroupField/index.js +0 -2
  27. package/lib/components/RadioGroupField/index.js.map +0 -1
  28. package/lib-commonjs/RadioGroupField.js +0 -9
  29. package/lib-commonjs/RadioGroupField.js.map +0 -1
  30. package/lib-commonjs/components/RadioGroupField/RadioGroupField.js +0 -20
  31. package/lib-commonjs/components/RadioGroupField/RadioGroupField.js.map +0 -1
  32. package/lib-commonjs/components/RadioGroupField/index.js +0 -9
  33. package/lib-commonjs/components/RadioGroupField/index.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,103 @@
2
2
  "name": "@fluentui/react-radio",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 06 Apr 2023 23:59:50 GMT",
5
+ "date": "Mon, 17 Apr 2023 17:50:05 GMT",
6
+ "tag": "@fluentui/react-radio_v9.1.10",
7
+ "version": "9.1.10",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "behowell@microsoft.com",
12
+ "package": "@fluentui/react-radio",
13
+ "commit": "36f98c3a49334e4ea9b22774691560d11010f2e7",
14
+ "comment": "chore: Update react-field dependency version"
15
+ },
16
+ {
17
+ "author": "behowell@microsoft.com",
18
+ "package": "@fluentui/react-radio",
19
+ "commit": "273116e8efaf4230474a0f214e9adbb5f556e5de",
20
+ "comment": "chore: Remove deprecated RadioGroupField_unstable shim component"
21
+ },
22
+ {
23
+ "author": "behowell@microsoft.com",
24
+ "package": "@fluentui/react-radio",
25
+ "commit": "ae31ec4170f8e86ffa0e94166602a88ca226186d",
26
+ "comment": "chore: Remove the use of ContextSelector in RadioGroupContext"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-radio",
31
+ "comment": "Bump @fluentui/react-field to v9.1.0",
32
+ "commit": "35d247e0b6a8c2b22e69942afbabe18043e59585"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-radio",
37
+ "comment": "Bump @fluentui/react-label to v9.1.9",
38
+ "commit": "35d247e0b6a8c2b22e69942afbabe18043e59585"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-radio",
43
+ "comment": "Bump @fluentui/react-tabster to v9.6.5",
44
+ "commit": "35d247e0b6a8c2b22e69942afbabe18043e59585"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-radio",
49
+ "comment": "Bump @fluentui/react-utilities to v9.8.0",
50
+ "commit": "35d247e0b6a8c2b22e69942afbabe18043e59585"
51
+ }
52
+ ]
53
+ }
54
+ },
55
+ {
56
+ "date": "Wed, 12 Apr 2023 09:31:44 GMT",
57
+ "tag": "@fluentui/react-radio_v9.1.9",
58
+ "version": "9.1.9",
59
+ "comments": {
60
+ "patch": [
61
+ {
62
+ "author": "behowell@microsoft.com",
63
+ "package": "@fluentui/react-radio",
64
+ "commit": "865a699268e85c55ba9f26c2b4a109161e48576c",
65
+ "comment": "fix: Have RadioGroup forward aria-describedby to each of the Radio items inside"
66
+ },
67
+ {
68
+ "author": "beachball",
69
+ "package": "@fluentui/react-radio",
70
+ "comment": "Bump @fluentui/react-context-selector to v9.1.17",
71
+ "commit": "45cb6089b0f5f464ae0dd9e9cba7e199a9d67cd8"
72
+ },
73
+ {
74
+ "author": "beachball",
75
+ "package": "@fluentui/react-radio",
76
+ "comment": "Bump @fluentui/react-field to v9.0.0-beta.2",
77
+ "commit": "45cb6089b0f5f464ae0dd9e9cba7e199a9d67cd8"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "@fluentui/react-radio",
82
+ "comment": "Bump @fluentui/react-label to v9.1.8",
83
+ "commit": "45cb6089b0f5f464ae0dd9e9cba7e199a9d67cd8"
84
+ },
85
+ {
86
+ "author": "beachball",
87
+ "package": "@fluentui/react-radio",
88
+ "comment": "Bump @fluentui/react-tabster to v9.6.4",
89
+ "commit": "45cb6089b0f5f464ae0dd9e9cba7e199a9d67cd8"
90
+ },
91
+ {
92
+ "author": "beachball",
93
+ "package": "@fluentui/react-radio",
94
+ "comment": "Bump @fluentui/react-utilities to v9.7.4",
95
+ "commit": "45cb6089b0f5f464ae0dd9e9cba7e199a9d67cd8"
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "date": "Fri, 07 Apr 2023 00:01:40 GMT",
6
102
  "tag": "@fluentui/react-radio_v9.1.8",
7
103
  "version": "9.1.8",
8
104
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,41 @@
1
1
  # Change Log - @fluentui/react-radio
2
2
 
3
- This log was last generated on Thu, 06 Apr 2023 23:59:50 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 17 Apr 2023 17:50:05 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.1.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.1.10)
8
+
9
+ Mon, 17 Apr 2023 17:50:05 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.1.9..@fluentui/react-radio_v9.1.10)
11
+
12
+ ### Patches
13
+
14
+ - chore: Update react-field dependency version ([PR #27493](https://github.com/microsoft/fluentui/pull/27493) by behowell@microsoft.com)
15
+ - chore: Remove deprecated RadioGroupField_unstable shim component ([PR #27492](https://github.com/microsoft/fluentui/pull/27492) by behowell@microsoft.com)
16
+ - chore: Remove the use of ContextSelector in RadioGroupContext ([PR #27476](https://github.com/microsoft/fluentui/pull/27476) by behowell@microsoft.com)
17
+ - Bump @fluentui/react-field to v9.1.0 ([PR #27564](https://github.com/microsoft/fluentui/pull/27564) by beachball)
18
+ - Bump @fluentui/react-label to v9.1.9 ([PR #27564](https://github.com/microsoft/fluentui/pull/27564) by beachball)
19
+ - Bump @fluentui/react-tabster to v9.6.5 ([PR #27564](https://github.com/microsoft/fluentui/pull/27564) by beachball)
20
+ - Bump @fluentui/react-utilities to v9.8.0 ([PR #27564](https://github.com/microsoft/fluentui/pull/27564) by beachball)
21
+
22
+ ## [9.1.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.1.9)
23
+
24
+ Wed, 12 Apr 2023 09:31:44 GMT
25
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.1.8..@fluentui/react-radio_v9.1.9)
26
+
27
+ ### Patches
28
+
29
+ - fix: Have RadioGroup forward aria-describedby to each of the Radio items inside ([PR #27456](https://github.com/microsoft/fluentui/pull/27456) by behowell@microsoft.com)
30
+ - Bump @fluentui/react-context-selector to v9.1.17 ([PR #27274](https://github.com/microsoft/fluentui/pull/27274) by beachball)
31
+ - Bump @fluentui/react-field to v9.0.0-beta.2 ([PR #27274](https://github.com/microsoft/fluentui/pull/27274) by beachball)
32
+ - Bump @fluentui/react-label to v9.1.8 ([PR #27274](https://github.com/microsoft/fluentui/pull/27274) by beachball)
33
+ - Bump @fluentui/react-tabster to v9.6.4 ([PR #27274](https://github.com/microsoft/fluentui/pull/27274) by beachball)
34
+ - Bump @fluentui/react-utilities to v9.7.4 ([PR #27274](https://github.com/microsoft/fluentui/pull/27274) by beachball)
35
+
7
36
  ## [9.1.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.1.8)
8
37
 
9
- Thu, 06 Apr 2023 23:59:50 GMT
38
+ Fri, 07 Apr 2023 00:01:40 GMT
10
39
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.1.7..@fluentui/react-radio_v9.1.8)
11
40
 
12
41
  ### Patches
package/dist/index.d.ts CHANGED
@@ -2,13 +2,8 @@
2
2
 
3
3
  import type { ComponentProps } from '@fluentui/react-utilities';
4
4
  import type { ComponentState } from '@fluentui/react-utilities';
5
- import { ContextSelector } from '@fluentui/react-context-selector';
6
- import { DeprecatedFieldProps } from '@fluentui/react-field';
7
- import { FC } from 'react';
8
5
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
9
6
  import { Label } from '@fluentui/react-label';
10
- import { Provider } from 'react';
11
- import { ProviderProps } from 'react';
12
7
  import * as React_2 from 'react';
13
8
  import type { Slot } from '@fluentui/react-utilities';
14
9
  import type { SlotClassNames } from '@fluentui/react-utilities';
@@ -27,28 +22,12 @@ export declare const RadioGroup: ForwardRefComponent<RadioGroupProps>;
27
22
 
28
23
  export declare const radioGroupClassNames: SlotClassNames<RadioGroupSlots>;
29
24
 
30
- export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;
25
+ export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required' | 'aria-describedby'>;
31
26
 
32
27
  export declare type RadioGroupContextValues = {
33
28
  radioGroup: RadioGroupContextValue;
34
29
  };
35
30
 
36
- /** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */
37
- export declare const RadioGroupField_unstable: ForwardRefComponent<RadioGroupFieldProps_unstable>;
38
-
39
- /** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */
40
- export declare const radioGroupFieldClassNames: {
41
- control: string;
42
- root: string;
43
- label: string;
44
- validationMessage: string;
45
- validationMessageIcon: string;
46
- hint: string;
47
- };
48
-
49
- /** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */
50
- export declare type RadioGroupFieldProps_unstable = DeprecatedFieldProps<RadioGroupProps>;
51
-
52
31
  /**
53
32
  * Data for the onChange event for RadioGroup.
54
33
  */
@@ -98,7 +77,7 @@ export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlot
98
77
  required?: boolean;
99
78
  };
100
79
 
101
- export declare const RadioGroupProvider: Provider<RadioGroupContextValue> & FC<ProviderProps<RadioGroupContextValue>>;
80
+ export declare const RadioGroupProvider: React_2.Provider<RadioGroupContextValue | undefined>;
102
81
 
103
82
  export declare type RadioGroupSlots = {
104
83
  /**
@@ -110,7 +89,7 @@ export declare type RadioGroupSlots = {
110
89
  /**
111
90
  * State used in rendering RadioGroup
112
91
  */
113
- export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>;
92
+ export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;
114
93
 
115
94
  /**
116
95
  * Data for the onChange event for Radio.
@@ -214,7 +193,16 @@ export declare const useRadio_unstable: (props: RadioProps, ref: React_2.Ref<HTM
214
193
  */
215
194
  export declare const useRadioGroup_unstable: (props: RadioGroupProps, ref: React_2.Ref<HTMLDivElement>) => RadioGroupState;
216
195
 
217
- export declare const useRadioGroupContext_unstable: <T>(selector: ContextSelector<RadioGroupContextValue, T>) => T;
196
+ /**
197
+ * @deprecated Use useRadioGroupContextValue_unstable instead.
198
+ * RadioGroupContext is no longer a selector context, and no longer benefits from having a selector.
199
+ */
200
+ export declare const useRadioGroupContext_unstable: <T>(selector: (ctx: RadioGroupContextValue) => T) => T;
201
+
202
+ /**
203
+ * Get the value of the RadioGroupContext.
204
+ */
205
+ export declare const useRadioGroupContextValue_unstable: () => RadioGroupContextValue;
218
206
 
219
207
  export declare const useRadioGroupContextValues: (state: RadioGroupState) => RadioGroupContextValues;
220
208
 
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { CircleFilled } from '@fluentui/react-icons';
3
3
  import { Label } from '@fluentui/react-label';
4
4
  import { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';
5
- import { useRadioGroupContext_unstable } from '../../contexts/RadioGroupContext';
5
+ import { useRadioGroupContextValue_unstable } from '../../contexts/RadioGroupContext';
6
6
  import { useFocusWithin } from '@fluentui/react-tabster';
7
7
  /**
8
8
  * Create the state required to render Radio.
@@ -14,19 +14,15 @@ import { useFocusWithin } from '@fluentui/react-tabster';
14
14
  * @param ref - reference to `<input>` element of Radio
15
15
  */
16
16
  export const useRadio_unstable = (props, ref) => {
17
- const nameGroup = useRadioGroupContext_unstable(ctx => ctx.name);
18
- const value = useRadioGroupContext_unstable(ctx => ctx.value);
19
- const defaultValue = useRadioGroupContext_unstable(ctx => ctx.defaultValue);
20
- const disabledGroup = useRadioGroupContext_unstable(ctx => ctx.disabled);
21
- const layout = useRadioGroupContext_unstable(ctx => ctx.layout);
22
- const requiredGroup = useRadioGroupContext_unstable(ctx => ctx.required);
17
+ const group = useRadioGroupContextValue_unstable();
23
18
  const {
24
- name = nameGroup,
25
- checked = value !== undefined ? value === props.value : undefined,
26
- defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,
27
- labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after',
28
- disabled = disabledGroup,
29
- required = requiredGroup,
19
+ name = group.name,
20
+ checked = group.value !== undefined ? group.value === props.value : undefined,
21
+ defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined,
22
+ labelPosition = group.layout === 'horizontal-stacked' ? 'below' : 'after',
23
+ disabled = group.disabled,
24
+ required = group.required,
25
+ 'aria-describedby': ariaDescribedBy = group['aria-describedby'],
30
26
  onChange
31
27
  } = props;
32
28
  const nativeProps = getPartitionedNativeProps({
@@ -52,6 +48,7 @@ export const useRadio_unstable = (props, ref) => {
52
48
  defaultChecked,
53
49
  disabled,
54
50
  required,
51
+ 'aria-describedby': ariaDescribedBy,
55
52
  ...nativeProps.primary
56
53
  }
57
54
  });
@@ -63,7 +60,7 @@ export const useRadio_unstable = (props, ref) => {
63
60
  const label = resolveShorthand(props.label, {
64
61
  defaultProps: {
65
62
  htmlFor: input.id,
66
- disabled
63
+ disabled: input.disabled
67
64
  }
68
65
  });
69
66
  const indicator = resolveShorthand(props.indicator, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","CircleFilled","Label","getPartitionedNativeProps","mergeCallbacks","resolveShorthand","useId","useRadioGroupContext_unstable","useFocusWithin","useRadio_unstable","props","ref","nameGroup","ctx","name","value","defaultValue","disabledGroup","disabled","layout","requiredGroup","required","checked","undefined","defaultChecked","labelPosition","onChange","nativeProps","primarySlotTagName","excludedPropNames","root","defaultProps","input","type","id","primary","ev","currentTarget","label","htmlFor","indicator","children","createElement","components"],"sources":["../../../src/components/Radio/useRadio.tsx"],"sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useRadioGroupContext_unstable } from '../../contexts/RadioGroupContext';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport type { RadioProps, RadioState } from './Radio.types';\n\n/**\n * Create the state required to render Radio.\n *\n * The returned state can be modified with hooks such as useRadioStyles_unstable,\n * before being passed to renderRadio_unstable.\n *\n * @param props - props from this instance of Radio\n * @param ref - reference to `<input>` element of Radio\n */\nexport const useRadio_unstable = (props: RadioProps, ref: React.Ref<HTMLInputElement>): RadioState => {\n const nameGroup = useRadioGroupContext_unstable(ctx => ctx.name);\n const value = useRadioGroupContext_unstable(ctx => ctx.value);\n const defaultValue = useRadioGroupContext_unstable(ctx => ctx.defaultValue);\n const disabledGroup = useRadioGroupContext_unstable(ctx => ctx.disabled);\n const layout = useRadioGroupContext_unstable(ctx => ctx.layout);\n const requiredGroup = useRadioGroupContext_unstable(ctx => ctx.required);\n\n const {\n name = nameGroup,\n checked = value !== undefined ? value === props.value : undefined,\n defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,\n labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after',\n disabled = disabledGroup,\n required = requiredGroup,\n onChange,\n } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n ref: useFocusWithin<HTMLSpanElement>(),\n ...nativeProps.root,\n },\n });\n\n const input = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref,\n type: 'radio',\n id: useId('radio-', nativeProps.primary.id),\n name,\n checked,\n defaultChecked,\n disabled,\n required,\n ...nativeProps.primary,\n },\n });\n\n input.onChange = mergeCallbacks(input.onChange, ev => onChange?.(ev, { value: ev.currentTarget.value }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled,\n },\n });\n\n const indicator = resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n });\n\n return {\n labelPosition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PM,KAAA,EAAOpC,KAAA;MACPsC,SAAA,EAAW;IACb;IACAV,IAAA;IACAE,KAAA;IACAM,KAAA;IACAE;EACF;AACF"}
1
+ {"version":3,"names":["React","CircleFilled","Label","getPartitionedNativeProps","mergeCallbacks","resolveShorthand","useId","useRadioGroupContextValue_unstable","useFocusWithin","useRadio_unstable","props","ref","group","name","checked","value","undefined","defaultChecked","defaultValue","labelPosition","layout","disabled","required","ariaDescribedBy","onChange","nativeProps","primarySlotTagName","excludedPropNames","root","defaultProps","input","type","id","primary","ev","currentTarget","label","htmlFor","indicator","children","createElement","components"],"sources":["../../../src/components/Radio/useRadio.tsx"],"sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useRadioGroupContextValue_unstable } from '../../contexts/RadioGroupContext';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport type { RadioProps, RadioState } from './Radio.types';\n\n/**\n * Create the state required to render Radio.\n *\n * The returned state can be modified with hooks such as useRadioStyles_unstable,\n * before being passed to renderRadio_unstable.\n *\n * @param props - props from this instance of Radio\n * @param ref - reference to `<input>` element of Radio\n */\nexport const useRadio_unstable = (props: RadioProps, ref: React.Ref<HTMLInputElement>): RadioState => {\n const group = useRadioGroupContextValue_unstable();\n\n const {\n name = group.name,\n checked = group.value !== undefined ? group.value === props.value : undefined,\n defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined,\n labelPosition = group.layout === 'horizontal-stacked' ? 'below' : 'after',\n disabled = group.disabled,\n required = group.required,\n 'aria-describedby': ariaDescribedBy = group['aria-describedby'],\n onChange,\n } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n ref: useFocusWithin<HTMLSpanElement>(),\n ...nativeProps.root,\n },\n });\n\n const input = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref,\n type: 'radio',\n id: useId('radio-', nativeProps.primary.id),\n name,\n checked,\n defaultChecked,\n disabled,\n required,\n 'aria-describedby': ariaDescribedBy,\n ...nativeProps.primary,\n },\n });\n\n input.onChange = mergeCallbacks(input.onChange, ev => onChange?.(ev, { value: ev.currentTarget.value }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled: input.disabled,\n },\n });\n\n const indicator = resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n });\n\n return {\n labelPosition,\n components: {\n root: 'span',\n input: 'input',\n label: Label,\n indicator: 'div',\n },\n root,\n input,\n label,\n indicator,\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,YAAY,QAAQ;AAC7B,SAASC,KAAK,QAAQ;AACtB,SAASC,yBAAyB,EAAEC,cAAc,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ;AACnF,SAASC,kCAAkC,QAAQ;AACnD,SAASC,cAAc,QAAQ;AAG/B;;;;;;;;;AASA,OAAO,MAAMC,iBAAA,GAAoBA,CAACC,KAAA,EAAmBC,GAAA,KAAiD;EACpG,MAAMC,KAAA,GAAQL,kCAAA;EAEd,MAAM;IACJM,IAAA,GAAOD,KAAA,CAAMC,IAAI;IACjBC,OAAA,GAAUF,KAAA,CAAMG,KAAK,KAAKC,SAAA,GAAYJ,KAAA,CAAMG,KAAK,KAAKL,KAAA,CAAMK,KAAK,GAAGC,SAAS;IAC7EC,cAAA,GAAiBL,KAAA,CAAMM,YAAY,KAAKF,SAAA,GAAYJ,KAAA,CAAMM,YAAY,KAAKR,KAAA,CAAMK,KAAK,GAAGC,SAAS;IAClGG,aAAA,GAAgBP,KAAA,CAAMQ,MAAM,KAAK,uBAAuB,UAAU,OAAO;IACzEC,QAAA,GAAWT,KAAA,C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E;IAClDhB,QAAA,EAAU,IAAI;IACdO,YAAA,EAAc;MACZ,eAAe,IAAI;MACnBU,QAAA,eAAUvC,KAAA,CAAAwC,aAAA,CAACvC,YAAA;IACb;EACF;EAEA,OAAO;IACLkB,aAAA;IACAsB,UAAA,EAAY;MACVb,IAAA,EAAM;MACNE,KAAA,EAAO;MACPM,KAAA,EAAOlC,KAAA;MACPoC,SAAA,EAAW;IACb;IACAV,IAAA;IACAE,KAAA;IACAM,KAAA;IACAE;EACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"names":["React"],"sources":["../../../src/components/RadioGroup/RadioGroup.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type RadioGroupSlots = {\n /**\n * The radio group root.\n */\n root: NonNullable<Slot<'div'>>;\n};\n\nexport type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {\n /**\n * The name of this radio group. This name is applied to all Radio items inside this group.\n *\n * If no name is provided, one will be generated so that all of the Radio items have the same name.\n */\n name?: string;\n\n /**\n * The selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n value?: string;\n\n /**\n * The default selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n defaultValue?: string;\n\n /**\n * Callback when the selected Radio item changes.\n */\n onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;\n\n /**\n * How the radio items are laid out in the group.\n *\n * @default vertical\n */\n layout?: 'vertical' | 'horizontal' | 'horizontal-stacked';\n\n /**\n * Disable all Radio items in this group.\n */\n disabled?: boolean;\n\n /**\n * Require a selection in this group. Adds the `required` prop to all child Radio items.\n */\n required?: boolean;\n};\n\n/**\n * Data for the onChange event for RadioGroup.\n */\nexport type RadioGroupOnChangeData = {\n /**\n * The value of the newly selected Radio item.\n */\n value: string;\n};\n\n/**\n * State used in rendering RadioGroup\n */\nexport type RadioGroupState = ComponentState<RadioGroupSlots> &\n Required<Pick<RadioGroupProps, 'layout'>> &\n Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>;\n\nexport type RadioGroupContextValue = Pick<\n RadioGroupProps,\n 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'\n>;\n\nexport type RadioGroupContextValues = {\n radioGroup: RadioGroupContextValue;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
1
+ {"version":3,"names":["React"],"sources":["../../../src/components/RadioGroup/RadioGroup.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type RadioGroupSlots = {\n /**\n * The radio group root.\n */\n root: NonNullable<Slot<'div'>>;\n};\n\nexport type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {\n /**\n * The name of this radio group. This name is applied to all Radio items inside this group.\n *\n * If no name is provided, one will be generated so that all of the Radio items have the same name.\n */\n name?: string;\n\n /**\n * The selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n value?: string;\n\n /**\n * The default selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n defaultValue?: string;\n\n /**\n * Callback when the selected Radio item changes.\n */\n onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;\n\n /**\n * How the radio items are laid out in the group.\n *\n * @default vertical\n */\n layout?: 'vertical' | 'horizontal' | 'horizontal-stacked';\n\n /**\n * Disable all Radio items in this group.\n */\n disabled?: boolean;\n\n /**\n * Require a selection in this group. Adds the `required` prop to all child Radio items.\n */\n required?: boolean;\n};\n\n/**\n * Data for the onChange event for RadioGroup.\n */\nexport type RadioGroupOnChangeData = {\n /**\n * The value of the newly selected Radio item.\n */\n value: string;\n};\n\n/**\n * State used in rendering RadioGroup\n */\nexport type RadioGroupState = ComponentState<RadioGroupSlots> &\n Required<Pick<RadioGroupProps, 'layout'>> &\n Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;\n\nexport type RadioGroupContextValue = Pick<\n RadioGroupProps,\n 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required' | 'aria-describedby'\n>;\n\nexport type RadioGroupContextValues = {\n radioGroup: RadioGroupContextValue;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
@@ -1,9 +1,17 @@
1
- import { createContext, useContextSelector } from '@fluentui/react-context-selector';
1
+ import * as React from 'react';
2
2
  /**
3
3
  * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
4
4
  */
5
- export const RadioGroupContext = /*#__PURE__*/createContext(undefined);
5
+ export const RadioGroupContext = /*#__PURE__*/React.createContext(undefined);
6
6
  const radioGroupContextDefaultValue = {};
7
7
  export const RadioGroupProvider = RadioGroupContext.Provider;
8
- export const useRadioGroupContext_unstable = selector => useContextSelector(RadioGroupContext, (ctx = radioGroupContextDefaultValue) => selector(ctx));
8
+ /**
9
+ * Get the value of the RadioGroupContext.
10
+ */
11
+ export const useRadioGroupContextValue_unstable = () => React.useContext(RadioGroupContext) || radioGroupContextDefaultValue;
12
+ /**
13
+ * @deprecated Use useRadioGroupContextValue_unstable instead.
14
+ * RadioGroupContext is no longer a selector context, and no longer benefits from having a selector.
15
+ */
16
+ export const useRadioGroupContext_unstable = selector => selector(useRadioGroupContextValue_unstable());
9
17
  //# sourceMappingURL=RadioGroupContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContextSelector","RadioGroupContext","undefined","radioGroupContextDefaultValue","RadioGroupProvider","Provider","useRadioGroupContext_unstable","selector","ctx"],"sources":["../../src/contexts/RadioGroupContext.ts"],"sourcesContent":["import { createContext, useContextSelector, ContextSelector } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { RadioGroupContextValue } from '../RadioGroup';\n\n/**\n * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.\n */\nexport const RadioGroupContext: Context<RadioGroupContextValue> = createContext<RadioGroupContextValue | undefined>(\n undefined,\n) as Context<RadioGroupContextValue>;\n\nconst radioGroupContextDefaultValue: RadioGroupContextValue = {};\n\nexport const RadioGroupProvider = RadioGroupContext.Provider;\n\nexport const useRadioGroupContext_unstable = <T>(selector: ContextSelector<RadioGroupContextValue, T>): T =>\n useContextSelector(RadioGroupContext, (ctx = radioGroupContextDefaultValue) => selector(ctx));\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAyB;AAInE;;;AAGA,OAAO,MAAMC,iBAAA,gBAAqDF,aAAA,CAChEG,SAAA;AAGF,MAAMC,6BAAA,GAAwD,CAAC;AAE/D,OAAO,MAAMC,kBAAA,GAAqBH,iBAAA,CAAkBI,QAAQ;AAE5D,OAAO,MAAMC,6BAAA,GAAoCC,QAAA,IAC/CP,kBAAA,CAAmBC,iBAAA,EAAmB,CAACO,GAAA,GAAML,6BAA6B,KAAKI,QAAA,CAASC,GAAA"}
1
+ {"version":3,"names":["React","RadioGroupContext","createContext","undefined","radioGroupContextDefaultValue","RadioGroupProvider","Provider","useRadioGroupContextValue_unstable","useContext","useRadioGroupContext_unstable","selector"],"sources":["../../src/contexts/RadioGroupContext.ts"],"sourcesContent":["import * as React from 'react';\n\nimport type { RadioGroupContextValue } from '../RadioGroup';\n\n/**\n * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.\n */\nexport const RadioGroupContext = React.createContext<RadioGroupContextValue | undefined>(undefined);\n\nconst radioGroupContextDefaultValue: RadioGroupContextValue = {};\n\nexport const RadioGroupProvider = RadioGroupContext.Provider;\n\n/**\n * Get the value of the RadioGroupContext.\n */\nexport const useRadioGroupContextValue_unstable = () =>\n React.useContext(RadioGroupContext) || radioGroupContextDefaultValue;\n\n/**\n * @deprecated Use useRadioGroupContextValue_unstable instead.\n * RadioGroupContext is no longer a selector context, and no longer benefits from having a selector.\n */\nexport const useRadioGroupContext_unstable = <T>(selector: (ctx: RadioGroupContextValue) => T): T =>\n selector(useRadioGroupContextValue_unstable());\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAIvB;;;AAGA,OAAO,MAAMC,iBAAA,gBAAoBD,KAAA,CAAME,aAAa,CAAqCC,SAAA;AAEzF,MAAMC,6BAAA,GAAwD,CAAC;AAE/D,OAAO,MAAMC,kBAAA,GAAqBJ,iBAAA,CAAkBK,QAAQ;AAE5D;;;AAGA,OAAO,MAAMC,kCAAA,GAAqCA,CAAA,KAChDP,KAAA,CAAMQ,UAAU,CAACP,iBAAA,KAAsBG,6BAAA;AAEzC;;;;AAIA,OAAO,MAAMK,6BAAA,GAAoCC,QAAA,IAC/CA,QAAA,CAASH,kCAAA"}
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  export const useRadioGroupContextValues = state => {
2
3
  const {
3
4
  name,
@@ -7,14 +8,16 @@ export const useRadioGroupContextValues = state => {
7
8
  layout,
8
9
  required
9
10
  } = state;
10
- const radioGroup = {
11
+ const ariaDescribedBy = state.root['aria-describedby'];
12
+ const radioGroup = React.useMemo(() => ({
11
13
  name,
12
14
  value,
13
15
  defaultValue,
14
16
  disabled,
15
17
  layout,
16
- required
17
- };
18
+ required,
19
+ 'aria-describedby': ariaDescribedBy
20
+ }), [name, value, defaultValue, disabled, layout, required, ariaDescribedBy]);
18
21
  return {
19
22
  radioGroup
20
23
  };
@@ -1 +1 @@
1
- {"version":3,"names":["useRadioGroupContextValues","state","name","value","defaultValue","disabled","layout","required","radioGroup"],"sources":["../../src/contexts/useRadioGroupContextValues.ts"],"sourcesContent":["import type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupState } from '../RadioGroup';\n\nexport const useRadioGroupContextValues = (state: RadioGroupState): RadioGroupContextValues => {\n const { name, value, defaultValue, disabled, layout, required } = state;\n\n const radioGroup: RadioGroupContextValue = {\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required,\n };\n\n return { radioGroup };\n};\n"],"mappings":"AAEA,OAAO,MAAMA,0BAAA,GAA8BC,KAAA,IAAoD;EAC7F,MAAM;IAAEC,IAAA;IAAMC,KAAA;IAAOC,YAAA;IAAcC,QAAA;IAAUC,MAAA;IAAQC;EAAQ,CAAE,GAAGN,KAAA;EAElE,MAAMO,UAAA,GAAqC;IACzCN,IAAA;IACAC,KAAA;IACAC,YAAA;IACAC,QAAA;IACAC,MAAA;IACAC;EACF;EAEA,OAAO;IAAEC;EAAW;AACtB"}
1
+ {"version":3,"names":["React","useRadioGroupContextValues","state","name","value","defaultValue","disabled","layout","required","ariaDescribedBy","root","radioGroup","useMemo"],"sources":["../../src/contexts/useRadioGroupContextValues.ts"],"sourcesContent":["import * as React from 'react';\n\nimport type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupState } from '../RadioGroup';\n\nexport const useRadioGroupContextValues = (state: RadioGroupState): RadioGroupContextValues => {\n const { name, value, defaultValue, disabled, layout, required } = state;\n const ariaDescribedBy = state.root['aria-describedby'];\n\n const radioGroup = React.useMemo<RadioGroupContextValue>(\n () => ({\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required,\n 'aria-describedby': ariaDescribedBy,\n }),\n [name, value, defaultValue, disabled, layout, required, ariaDescribedBy],\n );\n\n return { radioGroup };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAIvB,OAAO,MAAMC,0BAAA,GAA8BC,KAAA,IAAoD;EAC7F,MAAM;IAAEC,IAAA;IAAMC,KAAA;IAAOC,YAAA;IAAcC,QAAA;IAAUC,MAAA;IAAQC;EAAQ,CAAE,GAAGN,KAAA;EAClE,MAAMO,eAAA,GAAkBP,KAAA,CAAMQ,IAAI,CAAC,mBAAmB;EAEtD,MAAMC,UAAA,GAAaX,KAAA,CAAMY,OAAO,CAC9B,OAAO;IACLT,IAAA;IACAC,KAAA;IACAC,YAAA;IACAC,QAAA;IACAC,MAAA;IACAC,QAAA;IACA,oBAAoBC;EACtB,IACA,CAACN,IAAA,EAAMC,KAAA,EAAOC,YAAA,EAAcC,QAAA,EAAUC,MAAA,EAAQC,QAAA,EAAUC,eAAA,CAAgB;EAG1E,OAAO;IAAEE;EAAW;AACtB"}
package/lib/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  export { RadioGroup, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable } from './RadioGroup';
2
2
  export { Radio, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';
3
- export { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable } from './contexts/index';
4
- // eslint-disable-next-line deprecation/deprecation
5
- export { RadioGroupField as RadioGroupField_unstable, radioGroupFieldClassNames } from './RadioGroupField';
3
+ export { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable, useRadioGroupContextValue_unstable } from './contexts/index';
6
4
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["RadioGroup","radioGroupClassNames","renderRadioGroup_unstable","useRadioGroupStyles_unstable","useRadioGroup_unstable","Radio","radioClassNames","renderRadio_unstable","useRadioStyles_unstable","useRadio_unstable","RadioGroupProvider","useRadioGroupContextValues","useRadioGroupContext_unstable","RadioGroupField","RadioGroupField_unstable","radioGroupFieldClassNames"],"sources":["../src/index.ts"],"sourcesContent":["export {\n RadioGroup,\n radioGroupClassNames,\n renderRadioGroup_unstable,\n useRadioGroupStyles_unstable,\n useRadioGroup_unstable,\n} from './RadioGroup';\nexport type {\n RadioGroupContextValue,\n RadioGroupContextValues,\n RadioGroupOnChangeData,\n RadioGroupProps,\n RadioGroupSlots,\n RadioGroupState,\n} from './RadioGroup';\nexport { Radio, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';\nexport type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';\nexport { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable } from './contexts/index';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { RadioGroupField as RadioGroupField_unstable, radioGroupFieldClassNames } from './RadioGroupField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { RadioGroupFieldProps as RadioGroupFieldProps_unstable } from './RadioGroupField';\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB;AASP,SAASC,KAAK,EAAEC,eAAe,EAAEC,oBAAoB,EAAEC,uBAAuB,EAAEC,iBAAiB,QAAQ;AAEzG,SAASC,kBAAkB,EAAEC,0BAA0B,EAAEC,6BAA6B,QAAQ;AAE9F;AACA,SAASC,eAAA,IAAmBC,wBAAwB,EAAEC,yBAAyB,QAAQ"}
1
+ {"version":3,"names":["RadioGroup","radioGroupClassNames","renderRadioGroup_unstable","useRadioGroupStyles_unstable","useRadioGroup_unstable","Radio","radioClassNames","renderRadio_unstable","useRadioStyles_unstable","useRadio_unstable","RadioGroupProvider","useRadioGroupContextValues","useRadioGroupContext_unstable","useRadioGroupContextValue_unstable"],"sources":["../src/index.ts"],"sourcesContent":["export {\n RadioGroup,\n radioGroupClassNames,\n renderRadioGroup_unstable,\n useRadioGroupStyles_unstable,\n useRadioGroup_unstable,\n} from './RadioGroup';\nexport type {\n RadioGroupContextValue,\n RadioGroupContextValues,\n RadioGroupOnChangeData,\n RadioGroupProps,\n RadioGroupSlots,\n RadioGroupState,\n} from './RadioGroup';\nexport { Radio, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';\nexport type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';\nexport {\n RadioGroupProvider,\n useRadioGroupContextValues,\n useRadioGroupContext_unstable, // eslint-disable-line deprecation/deprecation\n useRadioGroupContextValue_unstable,\n} from './contexts/index';\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB;AASP,SAASC,KAAK,EAAEC,eAAe,EAAEC,oBAAoB,EAAEC,uBAAuB,EAAEC,iBAAiB,QAAQ;AAEzG,SACEC,kBAAkB,EAClBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,kCAAkC,QAC7B"}
@@ -14,13 +14,8 @@ const _reactUtilities = require("@fluentui/react-utilities");
14
14
  const _radioGroupContext = require("../../contexts/RadioGroupContext");
15
15
  const _reactTabster = require("@fluentui/react-tabster");
16
16
  const useRadio_unstable = (props, ref)=>{
17
- const nameGroup = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.name);
18
- const value = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.value);
19
- const defaultValue = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.defaultValue);
20
- const disabledGroup = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.disabled);
21
- const layout = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.layout);
22
- const requiredGroup = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.required);
23
- const { name =nameGroup , checked =value !== undefined ? value === props.value : undefined , defaultChecked =defaultValue !== undefined ? defaultValue === props.value : undefined , labelPosition =layout === 'horizontal-stacked' ? 'below' : 'after' , disabled =disabledGroup , required =requiredGroup , onChange } = props;
17
+ const group = (0, _radioGroupContext.useRadioGroupContextValue_unstable)();
18
+ const { name =group.name , checked =group.value !== undefined ? group.value === props.value : undefined , defaultChecked =group.defaultValue !== undefined ? group.defaultValue === props.value : undefined , labelPosition =group.layout === 'horizontal-stacked' ? 'below' : 'after' , disabled =group.disabled , required =group.required , 'aria-describedby': ariaDescribedBy = group['aria-describedby'] , onChange } = props;
24
19
  const nativeProps = (0, _reactUtilities.getPartitionedNativeProps)({
25
20
  props,
26
21
  primarySlotTagName: 'input',
@@ -48,6 +43,7 @@ const useRadio_unstable = (props, ref)=>{
48
43
  defaultChecked,
49
44
  disabled,
50
45
  required,
46
+ 'aria-describedby': ariaDescribedBy,
51
47
  ...nativeProps.primary
52
48
  }
53
49
  });
@@ -59,7 +55,7 @@ const useRadio_unstable = (props, ref)=>{
59
55
  const label = (0, _reactUtilities.resolveShorthand)(props.label, {
60
56
  defaultProps: {
61
57
  htmlFor: input.id,
62
- disabled
58
+ disabled: input.disabled
63
59
  }
64
60
  });
65
61
  const indicator = (0, _reactUtilities.resolveShorthand)(props.indicator, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Radio/useRadio.js"],"sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useRadioGroupContext_unstable } from '../../contexts/RadioGroupContext';\nimport { useFocusWithin } from '@fluentui/react-tabster';\n/**\n * Create the state required to render Radio.\n *\n * The returned state can be modified with hooks such as useRadioStyles_unstable,\n * before being passed to renderRadio_unstable.\n *\n * @param props - props from this instance of Radio\n * @param ref - reference to `<input>` element of Radio\n */\nexport const useRadio_unstable = (props, ref) => {\n const nameGroup = useRadioGroupContext_unstable(ctx => ctx.name);\n const value = useRadioGroupContext_unstable(ctx => ctx.value);\n const defaultValue = useRadioGroupContext_unstable(ctx => ctx.defaultValue);\n const disabledGroup = useRadioGroupContext_unstable(ctx => ctx.disabled);\n const layout = useRadioGroupContext_unstable(ctx => ctx.layout);\n const requiredGroup = useRadioGroupContext_unstable(ctx => ctx.required);\n const {\n name = nameGroup,\n checked = value !== undefined ? value === props.value : undefined,\n defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,\n labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after',\n disabled = disabledGroup,\n required = requiredGroup,\n onChange\n } = props;\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange']\n });\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n ref: useFocusWithin(),\n ...nativeProps.root\n }\n });\n const input = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref,\n type: 'radio',\n id: useId('radio-', nativeProps.primary.id),\n name,\n checked,\n defaultChecked,\n disabled,\n required,\n ...nativeProps.primary\n }\n });\n input.onChange = mergeCallbacks(input.onChange, ev => {\n return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {\n value: ev.currentTarget.value\n });\n });\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled\n }\n });\n const indicator = resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: /*#__PURE__*/React.createElement(CircleFilled, null)\n }\n });\n return {\n labelPosition,\n components: {\n root: 'span',\n input: 'input',\n label: Label,\n indicator: 'div'\n },\n root,\n input,\n label,\n indicator\n };\n};\n//# sourceMappingURL=useRadio.js.map"],"names":["useRadio_unstable","props","ref","nameGroup","useRadioGroupContext_unstable","ctx","name","value","defaultValue","disabledGroup","disabled","layout","requiredGroup","required","checked","undefined","defaultChecked","labelPosition","onChange","nativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","root","resolveShorthand","defaultProps","useFocusWithin","input","type","id","useId","primary","mergeCallbacks","ev","currentTarget","label","htmlFor","indicator","children","React","createElement","CircleFilled","components","Label"],"mappings":";;;;+BAeaA;;aAAAA;;;6DAfU;4BACM;4BACP;gCAC6D;mCACrC;8BACf;AAUxB,MAAMA,oBAAoB,CAACC,OAAOC,MAAQ;IAC/C,MAAMC,YAAYC,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIC,IAAI;IAC/D,MAAMC,QAAQH,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIE,KAAK;IAC5D,MAAMC,eAAeJ,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIG,YAAY;IAC1E,MAAMC,gBAAgBL,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIK,QAAQ;IACvE,MAAMC,SAASP,IAAAA,gDAA6B,EAACC,CA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ZW,SAAST,MAAME,EAAE;YACjBnB;QACF;IACF;IACA,MAAM2B,YAAYb,IAAAA,gCAAgB,EAACvB,MAAMoC,SAAS,EAAE;QAClDxB,UAAU,IAAI;QACdY,cAAc;YACZ,eAAe,IAAI;YACnBa,UAAU,WAAW,GAAEC,OAAMC,aAAa,CAACC,wBAAY,EAAE,IAAI;QAC/D;IACF;IACA,OAAO;QACLxB;QACAyB,YAAY;YACVnB,MAAM;YACNI,OAAO;YACPQ,OAAOQ,iBAAK;YACZN,WAAW;QACb;QACAd;QACAI;QACAQ;QACAE;IACF;AACF,GACA,oCAAoC"}
1
+ {"version":3,"sources":["../../../lib/components/Radio/useRadio.js"],"sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useRadioGroupContextValue_unstable } from '../../contexts/RadioGroupContext';\nimport { useFocusWithin } from '@fluentui/react-tabster';\n/**\n * Create the state required to render Radio.\n *\n * The returned state can be modified with hooks such as useRadioStyles_unstable,\n * before being passed to renderRadio_unstable.\n *\n * @param props - props from this instance of Radio\n * @param ref - reference to `<input>` element of Radio\n */\nexport const useRadio_unstable = (props, ref) => {\n const group = useRadioGroupContextValue_unstable();\n const {\n name = group.name,\n checked = group.value !== undefined ? group.value === props.value : undefined,\n defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined,\n labelPosition = group.layout === 'horizontal-stacked' ? 'below' : 'after',\n disabled = group.disabled,\n required = group.required,\n 'aria-describedby': ariaDescribedBy = group['aria-describedby'],\n onChange\n } = props;\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange']\n });\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n ref: useFocusWithin(),\n ...nativeProps.root\n }\n });\n const input = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref,\n type: 'radio',\n id: useId('radio-', nativeProps.primary.id),\n name,\n checked,\n defaultChecked,\n disabled,\n required,\n 'aria-describedby': ariaDescribedBy,\n ...nativeProps.primary\n }\n });\n input.onChange = mergeCallbacks(input.onChange, ev => {\n return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {\n value: ev.currentTarget.value\n });\n });\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled: input.disabled\n }\n });\n const indicator = resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: /*#__PURE__*/React.createElement(CircleFilled, null)\n }\n });\n return {\n labelPosition,\n components: {\n root: 'span',\n input: 'input',\n label: Label,\n indicator: 'div'\n },\n root,\n input,\n label,\n indicator\n };\n};\n//# sourceMappingURL=useRadio.js.map"],"names":["useRadio_unstable","props","ref","group","useRadioGroupContextValue_unstable","name","checked","value","undefined","defaultChecked","defaultValue","labelPosition","layout","disabled","required","ariaDescribedBy","onChange","nativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","root","resolveShorthand","defaultProps","useFocusWithin","input","type","id","useId","primary","mergeCallbacks","ev","currentTarget","label","htmlFor","indicator","children","React","createElement","CircleFilled","components","Label"],"mappings":";;;;+BAeaA;;aAAAA;;;6DAfU;4BACM;4BACP;gCAC6D;mCAChC;8BACpB;AAUxB,MAAMA,oBAAoB,CAACC,OAAOC,MAAQ;IAC/C,MAAMC,QAAQC,IAAAA,qDAAkC;IAChD,MAAM,EACJC,MAAOF,MAAME,IAAI,CAAA,EACjBC,SAAUH,MAAMI,KAAK,KAAKC,YAAYL,MAAMI,KAAK,KAAKN,MAAMM,KAAK,GAAGC,SAAS,CAAA,EAC7EC,gBAAiBN,MAAMO,YAAY,KAAKF,YAAYL,MAAMO,YAAY,KAAKT,MAAMM,KAAK,GAAGC,SAAS,CAAA,EAClGG,eAAgBR,MAAMS,MAAM,KAAK,uBAAuB,UAAU,OAAO,CAAA,EACzEC,UAAWV,M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IACF;IACA,OAAO;QACL5B;QACA6B,YAAY;YACVnB,MAAM;YACNI,OAAO;YACPQ,OAAOQ,iBAAK;YACZN,WAAW;QACb;QACAd;QACAI;QACAQ;QACAE;IACF;AACF,GACA,oCAAoC"}
@@ -11,12 +11,15 @@ function _export(target, all) {
11
11
  _export(exports, {
12
12
  RadioGroupContext: ()=>RadioGroupContext,
13
13
  RadioGroupProvider: ()=>RadioGroupProvider,
14
+ useRadioGroupContextValue_unstable: ()=>useRadioGroupContextValue_unstable,
14
15
  useRadioGroupContext_unstable: ()=>useRadioGroupContext_unstable
15
16
  });
16
- const _reactContextSelector = require("@fluentui/react-context-selector");
17
- const RadioGroupContext = /*#__PURE__*/ (0, _reactContextSelector.createContext)(undefined);
17
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
18
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
19
+ const RadioGroupContext = /*#__PURE__*/ _react.createContext(undefined);
18
20
  const radioGroupContextDefaultValue = {};
19
21
  const RadioGroupProvider = RadioGroupContext.Provider;
20
- const useRadioGroupContext_unstable = (selector)=>(0, _reactContextSelector.useContextSelector)(RadioGroupContext, (ctx = radioGroupContextDefaultValue)=>selector(ctx)); //# sourceMappingURL=RadioGroupContext.js.map
22
+ const useRadioGroupContextValue_unstable = ()=>_react.useContext(RadioGroupContext) || radioGroupContextDefaultValue;
23
+ const useRadioGroupContext_unstable = (selector)=>selector(useRadioGroupContextValue_unstable()); //# sourceMappingURL=RadioGroupContext.js.map
21
24
 
22
25
  //# sourceMappingURL=RadioGroupContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/contexts/RadioGroupContext.js"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\n/**\n * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.\n */\nexport const RadioGroupContext = /*#__PURE__*/createContext(undefined);\nconst radioGroupContextDefaultValue = {};\nexport const RadioGroupProvider = RadioGroupContext.Provider;\nexport const useRadioGroupContext_unstable = selector => useContextSelector(RadioGroupContext, (ctx = radioGroupContextDefaultValue) => selector(ctx));\n//# sourceMappingURL=RadioGroupContext.js.map"],"names":["RadioGroupContext","RadioGroupProvider","useRadioGroupContext_unstable","createContext","undefined","radioGroupContextDefaultValue","Provider","selector","useContextSelector","ctx"],"mappings":";;;;;;;;;;;IAIaA,iBAAiB,MAAjBA;IAEAC,kBAAkB,MAAlBA;IACAC,6BAA6B,MAA7BA;;sCAPqC;AAI3C,MAAMF,oBAAoB,WAAW,GAAEG,IAAAA,mCAAa,EAACC;AAC5D,MAAMC,gCAAgC,CAAC;AAChC,MAAMJ,qBAAqBD,kBAAkBM,QAAQ;AACrD,MAAMJ,gCAAgCK,CAAAA,WAAYC,IAAAA,wCAAkB,EAACR,mBAAmB,CAACS,MAAMJ,6BAA6B,GAAKE,SAASE,OACjJ,6CAA6C"}
1
+ {"version":3,"sources":["../../lib/contexts/RadioGroupContext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.\n */\nexport const RadioGroupContext = /*#__PURE__*/React.createContext(undefined);\nconst radioGroupContextDefaultValue = {};\nexport const RadioGroupProvider = RadioGroupContext.Provider;\n/**\n * Get the value of the RadioGroupContext.\n */\nexport const useRadioGroupContextValue_unstable = () => React.useContext(RadioGroupContext) || radioGroupContextDefaultValue;\n/**\n * @deprecated Use useRadioGroupContextValue_unstable instead.\n * RadioGroupContext is no longer a selector context, and no longer benefits from having a selector.\n */\nexport const useRadioGroupContext_unstable = selector => selector(useRadioGroupContextValue_unstable());\n//# sourceMappingURL=RadioGroupContext.js.map"],"names":["RadioGroupContext","RadioGroupProvider","useRadioGroupContextValue_unstable","useRadioGroupContext_unstable","React","createContext","undefined","radioGroupContextDefaultValue","Provider","useContext","selector"],"mappings":";;;;;;;;;;;IAIaA,iBAAiB,MAAjBA;IAEAC,kBAAkB,MAAlBA;IAIAC,kCAAkC,MAAlCA;IAKAC,6BAA6B,MAA7BA;;;6DAfU;AAIhB,MAAMH,oBAAoB,WAAW,GAAEI,OAAMC,aAAa,CAACC;AAClE,MAAMC,gCAAgC,CAAC;AAChC,MAAMN,qBAAqBD,kBAAkBQ,QAAQ;AAIrD,MAAMN,qCAAqC,IAAME,OAAMK,UAAU,CAACT,sBAAsBO;AAKxF,MAAMJ,gCAAgCO,CAAAA,WAAYA,SAASR,uCAClE,6CAA6C"}
@@ -6,16 +6,28 @@ Object.defineProperty(exports, "useRadioGroupContextValues", {
6
6
  enumerable: true,
7
7
  get: ()=>useRadioGroupContextValues
8
8
  });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
9
11
  const useRadioGroupContextValues = (state)=>{
10
12
  const { name , value , defaultValue , disabled , layout , required } = state;
11
- const radioGroup = {
13
+ const ariaDescribedBy = state.root['aria-describedby'];
14
+ const radioGroup = _react.useMemo(()=>({
15
+ name,
16
+ value,
17
+ defaultValue,
18
+ disabled,
19
+ layout,
20
+ required,
21
+ 'aria-describedby': ariaDescribedBy
22
+ }), [
12
23
  name,
13
24
  value,
14
25
  defaultValue,
15
26
  disabled,
16
27
  layout,
17
- required
18
- };
28
+ required,
29
+ ariaDescribedBy
30
+ ]);
19
31
  return {
20
32
  radioGroup
21
33
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/contexts/useRadioGroupContextValues.js"],"sourcesContent":["export const useRadioGroupContextValues = state => {\n const {\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required\n } = state;\n const radioGroup = {\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required\n };\n return {\n radioGroup\n };\n};\n//# sourceMappingURL=useRadioGroupContextValues.js.map"],"names":["useRadioGroupContextValues","state","name","value","defaultValue","disabled","layout","required","radioGroup"],"mappings":";;;;+BAAaA;;aAAAA;;AAAN,MAAMA,6BAA6BC,CAAAA,QAAS;IACjD,MAAM,EACJC,KAAI,EACJC,MAAK,EACLC,aAAY,EACZC,SAAQ,EACRC,OAAM,EACNC,SAAQ,EACT,GAAGN;IACJ,MAAMO,aAAa;QACjBN;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IACA,OAAO;QACLC;IACF;AACF,GACA,sDAAsD"}
1
+ {"version":3,"sources":["../../lib/contexts/useRadioGroupContextValues.js"],"sourcesContent":["import * as React from 'react';\nexport const useRadioGroupContextValues = state => {\n const {\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required\n } = state;\n const ariaDescribedBy = state.root['aria-describedby'];\n const radioGroup = React.useMemo(() => ({\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required,\n 'aria-describedby': ariaDescribedBy\n }), [name, value, defaultValue, disabled, layout, required, ariaDescribedBy]);\n return {\n radioGroup\n };\n};\n//# sourceMappingURL=useRadioGroupContextValues.js.map"],"names":["useRadioGroupContextValues","state","name","value","defaultValue","disabled","layout","required","ariaDescribedBy","root","radioGroup","React","useMemo"],"mappings":";;;;+BACaA;;aAAAA;;;6DADU;AAChB,MAAMA,6BAA6BC,CAAAA,QAAS;IACjD,MAAM,EACJC,KAAI,EACJC,MAAK,EACLC,aAAY,EACZC,SAAQ,EACRC,OAAM,EACNC,SAAQ,EACT,GAAGN;IACJ,MAAMO,kBAAkBP,MAAMQ,IAAI,CAAC,mBAAmB;IACtD,MAAMC,aAAaC,OAAMC,OAAO,CAAC,IAAO,CAAA;YACtCV;YACAC;YACAC;YACAC;YACAC;YACAC;YACA,oBAAoBC;QACtB,CAAA,GAAI;QAACN;QAAMC;QAAOC;QAAcC;QAAUC;QAAQC;QAAUC;KAAgB;IAC5E,OAAO;QACLE;IACF;AACF,GACA,sDAAsD"}
@@ -22,13 +22,11 @@ _export(exports, {
22
22
  RadioGroupProvider: ()=>_index.RadioGroupProvider,
23
23
  useRadioGroupContextValues: ()=>_index.useRadioGroupContextValues,
24
24
  useRadioGroupContext_unstable: ()=>_index.useRadioGroupContext_unstable,
25
- RadioGroupField_unstable: ()=>_radioGroupField.RadioGroupField,
26
- radioGroupFieldClassNames: ()=>_radioGroupField.radioGroupFieldClassNames
25
+ useRadioGroupContextValue_unstable: ()=>_index.useRadioGroupContextValue_unstable
27
26
  });
28
27
  const _radioGroup = require("./RadioGroup");
29
28
  const _radio = require("./Radio");
30
29
  const _index = require("./contexts/index");
31
- const _radioGroupField = require("./RadioGroupField");
32
30
  //# sourceMappingURL=index.js.map
33
31
 
34
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { RadioGroup, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable } from './RadioGroup';\nexport { Radio, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';\nexport { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable } from './contexts/index';\n// eslint-disable-next-line deprecation/deprecation\nexport { RadioGroupField as RadioGroupField_unstable, radioGroupFieldClassNames } from './RadioGroupField';\n//# sourceMappingURL=index.js.map"],"names":["RadioGroup","radioGroupClassNames","renderRadioGroup_unstable","useRadioGroupStyles_unstable","useRadioGroup_unstable","Radio","radioClassNames","renderRadio_unstable","useRadioStyles_unstable","useRadio_unstable","RadioGroupProvider","useRadioGroupContextValues","useRadioGroupContext_unstable","RadioGroupField_unstable","RadioGroupField","radioGroupFieldClassNames"],"mappings":";;;;;;;;;;;IAASA,UAAU,MAAVA,sBAAU;IAAEC,oBAAoB,MAApBA,gCAAoB;IAAEC,yBAAyB,MAAzBA,qCAAyB;IAAEC,4BAA4B,MAA5BA,wCAA4B;IAAEC,sBAAsB,MAAtBA,kCAAsB;IACjHC,KAAK,MAALA,YAAK;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,oBAAoB,MAApBA,2BAAoB;IAAEC,uBAAuB,MAAvBA,8BAAuB;IAAEC,iBAAiB,MAAjBA,wBAAiB;IACxFC,kBAAkB,MAAlBA,yBAAkB;IAAEC,0BAA0B,MAA1BA,iCAA0B;IAAEC,6BAA6B,MAA7BA,oCAA6B;IAE1DC,wBAAwB,MAA3CC,gCAAe;IAA8BC,yBAAyB,MAAzBA,0CAAyB;;4BAJmD;uBACzB;uBACX;iCAEP;CACvF,iCAAiC"}
1
+ {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { RadioGroup, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable } from './RadioGroup';\nexport { Radio, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';\nexport { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable, useRadioGroupContextValue_unstable } from './contexts/index';\n//# sourceMappingURL=index.js.map"],"names":["RadioGroup","radioGroupClassNames","renderRadioGroup_unstable","useRadioGroupStyles_unstable","useRadioGroup_unstable","Radio","radioClassNames","renderRadio_unstable","useRadioStyles_unstable","useRadio_unstable","RadioGroupProvider","useRadioGroupContextValues","useRadioGroupContext_unstable","useRadioGroupContextValue_unstable"],"mappings":";;;;;;;;;;;IAASA,UAAU,MAAVA,sBAAU;IAAEC,oBAAoB,MAApBA,gCAAoB;IAAEC,yBAAyB,MAAzBA,qCAAyB;IAAEC,4BAA4B,MAA5BA,wCAA4B;IAAEC,sBAAsB,MAAtBA,kCAAsB;IACjHC,KAAK,MAALA,YAAK;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,oBAAoB,MAApBA,2BAAoB;IAAEC,uBAAuB,MAAvBA,8BAAuB;IAAEC,iBAAiB,MAAjBA,wBAAiB;IACxFC,kBAAkB,MAAlBA,yBAAkB;IAAEC,0BAA0B,MAA1BA,iCAA0B;IAAEC,6BAA6B,MAA7BA,oCAA6B;IAAEC,kCAAkC,MAAlCA,yCAAkC;;4BAFQ;uBACzB;uBACyB;CAClI,iCAAiC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-radio",
3
- "version": "9.1.8",
3
+ "version": "9.1.10",
4
4
  "description": "Fluent UI Radio component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -32,14 +32,13 @@
32
32
  "@fluentui/scripts-tasks": "*"
33
33
  },
34
34
  "dependencies": {
35
- "@fluentui/react-context-selector": "^9.1.16",
36
- "@fluentui/react-field": "9.0.0-beta.1",
35
+ "@fluentui/react-field": "^9.1.0",
37
36
  "@fluentui/react-icons": "^2.0.196",
38
- "@fluentui/react-label": "^9.1.7",
37
+ "@fluentui/react-label": "^9.1.9",
39
38
  "@fluentui/react-shared-contexts": "^9.3.3",
40
- "@fluentui/react-tabster": "^9.6.3",
39
+ "@fluentui/react-tabster": "^9.6.5",
41
40
  "@fluentui/react-theme": "^9.1.7",
42
- "@fluentui/react-utilities": "^9.7.3",
41
+ "@fluentui/react-utilities": "^9.8.0",
43
42
  "@griffel/react": "^1.5.2",
44
43
  "@swc/helpers": "^0.4.14"
45
44
  },
@@ -1,2 +0,0 @@
1
- export * from './components/RadioGroupField/index';
2
- //# sourceMappingURL=RadioGroupField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../src/RadioGroupField.ts"],"sourcesContent":["export * from './components/RadioGroupField/index';\n"],"mappings":"AAAA,cAAc"}
@@ -1,7 +0,0 @@
1
- /* eslint-disable deprecation/deprecation */import { getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';
2
- import { RadioGroup, radioGroupClassNames } from '../../RadioGroup';
3
- /** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */
4
- export const radioGroupFieldClassNames = /*#__PURE__*/getDeprecatedFieldClassNames(radioGroupClassNames.root);
5
- /** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */
6
- export const RadioGroupField = /*#__PURE__*/makeDeprecatedField(RadioGroup);
7
- //# sourceMappingURL=RadioGroupField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getDeprecatedFieldClassNames","makeDeprecatedField","RadioGroup","radioGroupClassNames","radioGroupFieldClassNames","root","RadioGroupField"],"sources":["../../../src/components/RadioGroupField/RadioGroupField.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport { DeprecatedFieldProps, getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { RadioGroup, radioGroupClassNames, RadioGroupProps } from '../../RadioGroup';\n\n/** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */\nexport type RadioGroupFieldProps = DeprecatedFieldProps<RadioGroupProps>;\n/** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */\nexport const radioGroupFieldClassNames = getDeprecatedFieldClassNames(radioGroupClassNames.root);\n/** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */\nexport const RadioGroupField: ForwardRefComponent<RadioGroupFieldProps> = makeDeprecatedField(RadioGroup);\n"],"mappings":"AAAA,4CACA,SAA+BA,4BAA4B,EAAEC,mBAAmB,QAAQ;AAExF,SAASC,UAAU,EAAEC,oBAAoB,QAAyB;AAIlE;AACA,OAAO,MAAMC,yBAAA,gBAA4BJ,4BAAA,CAA6BG,oBAAA,CAAqBE,IAAI;AAC/F;AACA,OAAO,MAAMC,eAAA,gBAA6DL,mBAAA,CAAoBC,UAAA"}
@@ -1,2 +0,0 @@
1
- export * from './RadioGroupField';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../../src/components/RadioGroupField/index.ts"],"sourcesContent":["export * from './RadioGroupField';\n"],"mappings":"AAAA,cAAc"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./components/RadioGroupField/index"), exports);
7
- //# sourceMappingURL=RadioGroupField.js.map
8
-
9
- //# sourceMappingURL=RadioGroupField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../lib/RadioGroupField.js"],"sourcesContent":["export * from './components/RadioGroupField/index';\n//# sourceMappingURL=RadioGroupField.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,2CAA2C"}
@@ -1,20 +0,0 @@
1
- /* eslint-disable deprecation/deprecation */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- radioGroupFieldClassNames: ()=>radioGroupFieldClassNames,
13
- RadioGroupField: ()=>RadioGroupField
14
- });
15
- const _reactField = require("@fluentui/react-field");
16
- const _radioGroup = require("../../RadioGroup");
17
- const radioGroupFieldClassNames = /*#__PURE__*/ (0, _reactField.getDeprecatedFieldClassNames)(_radioGroup.radioGroupClassNames.root);
18
- const RadioGroupField = /*#__PURE__*/ (0, _reactField.makeDeprecatedField)(_radioGroup.RadioGroup); //# sourceMappingURL=RadioGroupField.js.map
19
-
20
- //# sourceMappingURL=RadioGroupField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/components/RadioGroupField/RadioGroupField.js"],"sourcesContent":["/* eslint-disable deprecation/deprecation */import { getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport { RadioGroup, radioGroupClassNames } from '../../RadioGroup';\n/** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */\nexport const radioGroupFieldClassNames = /*#__PURE__*/getDeprecatedFieldClassNames(radioGroupClassNames.root);\n/** @deprecated Use Field with RadioGroup: `<Field><RadioGroup /></Field>` */\nexport const RadioGroupField = /*#__PURE__*/makeDeprecatedField(RadioGroup);\n//# sourceMappingURL=RadioGroupField.js.map"],"names":["radioGroupFieldClassNames","RadioGroupField","getDeprecatedFieldClassNames","radioGroupClassNames","root","makeDeprecatedField","RadioGroup"],"mappings":"AAAA,0CAA0C;;;;;;;;;;;IAG7BA,yBAAyB,MAAzBA;IAEAC,eAAe,MAAfA;;4BALiG;4BAC7D;AAE1C,MAAMD,4BAA4B,WAAW,GAAEE,IAAAA,wCAA4B,EAACC,gCAAoB,CAACC,IAAI;AAErG,MAAMH,kBAAkB,WAAW,GAAEI,IAAAA,+BAAmB,EAACC,sBAAU,GAC1E,2CAA2C"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./RadioGroupField"), exports);
7
- //# sourceMappingURL=index.js.map
8
-
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/components/RadioGroupField/index.js"],"sourcesContent":["export * from './RadioGroupField';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,iCAAiC"}