@fluentui/react-radio 0.0.0-nightly-20230502-0418.1 → 0.0.0-nightly-20230503-0419.1

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 (40) hide show
  1. package/CHANGELOG.json +19 -19
  2. package/CHANGELOG.md +12 -12
  3. package/dist/index.d.ts +219 -0
  4. package/lib/Radio.js +2 -0
  5. package/lib/Radio.js.map +1 -0
  6. package/lib/RadioGroup.js +2 -0
  7. package/lib/RadioGroup.js.map +1 -0
  8. package/lib/components/Radio/Radio.js +16 -0
  9. package/lib/components/Radio/Radio.js.map +1 -0
  10. package/lib/components/Radio/Radio.types.js +2 -0
  11. package/lib/components/Radio/Radio.types.js.map +1 -0
  12. package/lib/components/Radio/index.js +6 -0
  13. package/lib/components/Radio/index.js.map +1 -0
  14. package/lib/components/Radio/renderRadio.js +13 -0
  15. package/lib/components/Radio/renderRadio.js.map +1 -0
  16. package/lib/components/Radio/useRadio.js +87 -0
  17. package/lib/components/Radio/useRadio.js.map +1 -0
  18. package/lib/components/Radio/useRadioStyles.styles.js +72 -0
  19. package/lib/components/Radio/useRadioStyles.styles.js.map +1 -0
  20. package/lib/components/RadioGroup/RadioGroup.js +18 -0
  21. package/lib/components/RadioGroup/RadioGroup.js.map +1 -0
  22. package/lib/components/RadioGroup/RadioGroup.types.js +2 -0
  23. package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -0
  24. package/lib/components/RadioGroup/index.js +6 -0
  25. package/lib/components/RadioGroup/index.js.map +1 -0
  26. package/lib/components/RadioGroup/renderRadioGroup.js +16 -0
  27. package/lib/components/RadioGroup/renderRadioGroup.js.map +1 -0
  28. package/lib/components/RadioGroup/useRadioGroup.js +52 -0
  29. package/lib/components/RadioGroup/useRadioGroup.js.map +1 -0
  30. package/lib/components/RadioGroup/useRadioGroupStyles.styles.js +23 -0
  31. package/lib/components/RadioGroup/useRadioGroupStyles.styles.js.map +1 -0
  32. package/lib/contexts/RadioGroupContext.js +17 -0
  33. package/lib/contexts/RadioGroupContext.js.map +1 -0
  34. package/lib/contexts/index.js +3 -0
  35. package/lib/contexts/index.js.map +1 -0
  36. package/lib/contexts/useRadioGroupContextValues.js +25 -0
  37. package/lib/contexts/useRadioGroupContextValues.js.map +1 -0
  38. package/lib/index.js +4 -0
  39. package/lib/index.js.map +1 -0
  40. package/package.json +9 -9
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-radio",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 02 May 2023 04:24:32 GMT",
6
- "tag": "@fluentui/react-radio_v0.0.0-nightly-20230502-0418.1",
7
- "version": "0.0.0-nightly-20230502-0418.1",
5
+ "date": "Wed, 03 May 2023 04:25:42 GMT",
6
+ "tag": "@fluentui/react-radio_v0.0.0-nightly-20230503-0419.1",
7
+ "version": "0.0.0-nightly-20230503-0419.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,50 +16,50 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-radio",
19
- "comment": "Bump @fluentui/react-field to v0.0.0-nightly-20230502-0418.1",
20
- "commit": "bc9c2da8914b65acc704e187bb87f580f29789a3"
19
+ "comment": "Bump @fluentui/react-field to v0.0.0-nightly-20230503-0419.1",
20
+ "commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
21
21
  },
22
22
  {
23
23
  "author": "beachball",
24
24
  "package": "@fluentui/react-radio",
25
- "comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230502-0418.1",
26
- "commit": "bc9c2da8914b65acc704e187bb87f580f29789a3"
25
+ "comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230503-0419.1",
26
+ "commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
27
27
  },
28
28
  {
29
29
  "author": "beachball",
30
30
  "package": "@fluentui/react-radio",
31
- "comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230502-0418.1",
32
- "commit": "bc9c2da8914b65acc704e187bb87f580f29789a3"
31
+ "comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230503-0419.1",
32
+ "commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
33
33
  },
34
34
  {
35
35
  "author": "beachball",
36
36
  "package": "@fluentui/react-radio",
37
- "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230502-0418.1",
38
- "commit": "bc9c2da8914b65acc704e187bb87f580f29789a3"
37
+ "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230503-0419.1",
38
+ "commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
39
39
  },
40
40
  {
41
41
  "author": "beachball",
42
42
  "package": "@fluentui/react-radio",
43
- "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230502-0418.1",
44
- "commit": "bc9c2da8914b65acc704e187bb87f580f29789a3"
43
+ "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230503-0419.1",
44
+ "commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
45
45
  },
46
46
  {
47
47
  "author": "beachball",
48
48
  "package": "@fluentui/react-radio",
49
- "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230502-0418.1",
50
- "commit": "bc9c2da8914b65acc704e187bb87f580f29789a3"
49
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230503-0419.1",
50
+ "commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
51
51
  },
52
52
  {
53
53
  "author": "beachball",
54
54
  "package": "@fluentui/react-radio",
55
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230502-0418.1",
56
- "commit": "bc9c2da8914b65acc704e187bb87f580f29789a3"
55
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230503-0419.1",
56
+ "commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
57
57
  },
58
58
  {
59
59
  "author": "beachball",
60
60
  "package": "@fluentui/react-radio",
61
- "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230502-0418.1",
62
- "commit": "bc9c2da8914b65acc704e187bb87f580f29789a3"
61
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230503-0419.1",
62
+ "commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
63
63
  }
64
64
  ]
65
65
  }
package/CHANGELOG.md CHANGED
@@ -1,25 +1,25 @@
1
1
  # Change Log - @fluentui/react-radio
2
2
 
3
- This log was last generated on Tue, 02 May 2023 04:24:32 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 03 May 2023 04:25:42 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20230502-0418.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v0.0.0-nightly-20230502-0418.1)
7
+ ## [0.0.0-nightly-20230503-0419.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v0.0.0-nightly-20230503-0419.1)
8
8
 
9
- Tue, 02 May 2023 04:24:32 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.1.11..@fluentui/react-radio_v0.0.0-nightly-20230502-0418.1)
9
+ Wed, 03 May 2023 04:25:42 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.1.11..@fluentui/react-radio_v0.0.0-nightly-20230503-0419.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-field to v0.0.0-nightly-20230502-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/bc9c2da8914b65acc704e187bb87f580f29789a3) by beachball)
16
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230502-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/bc9c2da8914b65acc704e187bb87f580f29789a3) by beachball)
17
- - Bump @fluentui/react-label to v0.0.0-nightly-20230502-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/bc9c2da8914b65acc704e187bb87f580f29789a3) by beachball)
18
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230502-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/bc9c2da8914b65acc704e187bb87f580f29789a3) by beachball)
19
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20230502-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/bc9c2da8914b65acc704e187bb87f580f29789a3) by beachball)
20
- - Bump @fluentui/react-theme to v0.0.0-nightly-20230502-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/bc9c2da8914b65acc704e187bb87f580f29789a3) by beachball)
21
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20230502-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/bc9c2da8914b65acc704e187bb87f580f29789a3) by beachball)
22
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230502-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/bc9c2da8914b65acc704e187bb87f580f29789a3) by beachball)
15
+ - Bump @fluentui/react-field to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
16
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
17
+ - Bump @fluentui/react-label to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
18
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
19
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
20
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
21
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
22
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
23
23
 
24
24
  ## [9.1.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.1.11)
25
25
 
@@ -0,0 +1,219 @@
1
+ /// <reference types="react" />
2
+
3
+ import type { ComponentProps } from '@fluentui/react-utilities';
4
+ import type { ComponentState } from '@fluentui/react-utilities';
5
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
6
+ import { Label } from '@fluentui/react-label';
7
+ import * as React_2 from 'react';
8
+ import type { Slot } from '@fluentui/react-utilities';
9
+ import type { SlotClassNames } from '@fluentui/react-utilities';
10
+
11
+ /**
12
+ * Radio component is a wrapper for a radio button with a label.
13
+ */
14
+ export declare const Radio: ForwardRefComponent<RadioProps>;
15
+
16
+ export declare const radioClassNames: SlotClassNames<RadioSlots>;
17
+
18
+ /**
19
+ * A RadioGroup component presents a set of options where only one option can be selected.
20
+ */
21
+ export declare const RadioGroup: ForwardRefComponent<RadioGroupProps>;
22
+
23
+ export declare const radioGroupClassNames: SlotClassNames<RadioGroupSlots>;
24
+
25
+ export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required' | 'aria-describedby'>;
26
+
27
+ export declare type RadioGroupContextValues = {
28
+ radioGroup: RadioGroupContextValue;
29
+ };
30
+
31
+ /**
32
+ * Data for the onChange event for RadioGroup.
33
+ */
34
+ export declare type RadioGroupOnChangeData = {
35
+ /**
36
+ * The value of the newly selected Radio item.
37
+ */
38
+ value: string;
39
+ };
40
+
41
+ export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {
42
+ /**
43
+ * The name of this radio group. This name is applied to all Radio items inside this group.
44
+ *
45
+ * If no name is provided, one will be generated so that all of the Radio items have the same name.
46
+ */
47
+ name?: string;
48
+ /**
49
+ * The selected Radio item in this group.
50
+ *
51
+ * This should be the `value` prop of one of the Radio items inside this group.
52
+ */
53
+ value?: string;
54
+ /**
55
+ * The default selected Radio item in this group.
56
+ *
57
+ * This should be the `value` prop of one of the Radio items inside this group.
58
+ */
59
+ defaultValue?: string;
60
+ /**
61
+ * Callback when the selected Radio item changes.
62
+ */
63
+ onChange?: (ev: React_2.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;
64
+ /**
65
+ * How the radio items are laid out in the group.
66
+ *
67
+ * @default vertical
68
+ */
69
+ layout?: 'vertical' | 'horizontal' | 'horizontal-stacked';
70
+ /**
71
+ * Disable all Radio items in this group.
72
+ */
73
+ disabled?: boolean;
74
+ /**
75
+ * Require a selection in this group. Adds the `required` prop to all child Radio items.
76
+ */
77
+ required?: boolean;
78
+ };
79
+
80
+ export declare const RadioGroupProvider: React_2.Provider<RadioGroupContextValue | undefined>;
81
+
82
+ export declare type RadioGroupSlots = {
83
+ /**
84
+ * The radio group root.
85
+ */
86
+ root: NonNullable<Slot<'div'>>;
87
+ };
88
+
89
+ /**
90
+ * State used in rendering RadioGroup
91
+ */
92
+ export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;
93
+
94
+ /**
95
+ * Data for the onChange event for Radio.
96
+ */
97
+ export declare type RadioOnChangeData = {
98
+ /**
99
+ * The value prop of this Radio item.
100
+ */
101
+ value: string;
102
+ };
103
+
104
+ /**
105
+ * Radio Props
106
+ */
107
+ export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & {
108
+ /**
109
+ * The value of the RadioGroup when this Radio item is selected.
110
+ */
111
+ value?: string;
112
+ /**
113
+ * The position of the label relative to the radio indicator.
114
+ *
115
+ * This defaults to `after` unless the Radio is inside a RadioGroup with `layout="horizontalStacked"`,
116
+ * in which case it defaults to `below`.
117
+ *
118
+ * @defaultvalue after
119
+ */
120
+ labelPosition?: 'after' | 'below';
121
+ /**
122
+ * Disable this Radio item.
123
+ */
124
+ disabled?: boolean;
125
+ /**
126
+ * Callback when this Radio is selected in its group.
127
+ *
128
+ * **Note:** `onChange` is NOT called when this Radio is deselected.
129
+ * Use RadioGroup's `onChange` event to determine when the selection in the group changes.
130
+ */
131
+ onChange?: (ev: React_2.ChangeEvent<HTMLInputElement>, data: RadioOnChangeData) => void;
132
+ };
133
+
134
+ export declare type RadioSlots = {
135
+ /**
136
+ * The root element of the Radio.
137
+ *
138
+ * The root slot receives the `className` and `style` specified directly on the `<Radio>`.
139
+ * All other native props will be applied to the primary slot: `input`
140
+ */
141
+ root: NonNullable<Slot<'span'>>;
142
+ /**
143
+ * The Radio's label.
144
+ */
145
+ label: Slot<typeof Label>;
146
+ /**
147
+ * Hidden input that handles the radio's functionality.
148
+ *
149
+ * This is the PRIMARY slot: all native properties specified directly on `<Radio>` will be applied to this slot,
150
+ * except `className` and `style`, which remain on the root slot.
151
+ */
152
+ input: NonNullable<Slot<'input'>>;
153
+ /**
154
+ * A circle outline, with a filled circle icon inside when the Radio is checked.
155
+ */
156
+ indicator: NonNullable<Slot<'div'>>;
157
+ };
158
+
159
+ /**
160
+ * State used in rendering Radio
161
+ */
162
+ export declare type RadioState = ComponentState<RadioSlots> & Required<Pick<RadioProps, 'labelPosition'>>;
163
+
164
+ /**
165
+ * Render the final JSX of Radio
166
+ */
167
+ export declare const renderRadio_unstable: (state: RadioState) => JSX.Element;
168
+
169
+ /**
170
+ * Render the final JSX of RadioGroup
171
+ */
172
+ export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element;
173
+
174
+ /**
175
+ * Create the state required to render Radio.
176
+ *
177
+ * The returned state can be modified with hooks such as useRadioStyles_unstable,
178
+ * before being passed to renderRadio_unstable.
179
+ *
180
+ * @param props - props from this instance of Radio
181
+ * @param ref - reference to `<input>` element of Radio
182
+ */
183
+ export declare const useRadio_unstable: (props: RadioProps, ref: React_2.Ref<HTMLInputElement>) => RadioState;
184
+
185
+ /**
186
+ * Create the state required to render RadioGroup.
187
+ *
188
+ * The returned state can be modified with hooks such as useRadioGroupStyles_unstable,
189
+ * before being passed to renderRadioGroup_unstable.
190
+ *
191
+ * @param props - props from this instance of RadioGroup
192
+ * @param ref - reference to root HTMLElement of RadioGroup
193
+ */
194
+ export declare const useRadioGroup_unstable: (props: RadioGroupProps, ref: React_2.Ref<HTMLDivElement>) => RadioGroupState;
195
+
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;
206
+
207
+ export declare const useRadioGroupContextValues: (state: RadioGroupState) => RadioGroupContextValues;
208
+
209
+ /**
210
+ * Apply styling to the RadioGroup slots based on the state
211
+ */
212
+ export declare const useRadioGroupStyles_unstable: (state: RadioGroupState) => void;
213
+
214
+ /**
215
+ * Apply styling to the Radio slots based on the state
216
+ */
217
+ export declare const useRadioStyles_unstable: (state: RadioState) => void;
218
+
219
+ export { }
package/lib/Radio.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Radio/index';
2
+ //# sourceMappingURL=Radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../src/Radio.ts"],"sourcesContent":["export * from './components/Radio/index';\n"],"mappings":"AAAA,cAAc"}
@@ -0,0 +1,2 @@
1
+ export * from './components/RadioGroup/index';
2
+ //# sourceMappingURL=RadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../src/RadioGroup.ts"],"sourcesContent":["export * from './components/RadioGroup/index';\n"],"mappings":"AAAA,cAAc"}
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { renderRadio_unstable } from './renderRadio';
3
+ import { useRadio_unstable } from './useRadio';
4
+ import { useRadioStyles_unstable } from './useRadioStyles.styles';
5
+ import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
6
+ /**
7
+ * Radio component is a wrapper for a radio button with a label.
8
+ */
9
+ export const Radio = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = useRadio_unstable(props, ref);
11
+ useRadioStyles_unstable(state);
12
+ useCustomStyleHook_unstable('useRadioStyles_unstable')(state);
13
+ return renderRadio_unstable(state);
14
+ });
15
+ Radio.displayName = 'Radio';
16
+ //# sourceMappingURL=Radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","renderRadio_unstable","useRadio_unstable","useRadioStyles_unstable","useCustomStyleHook_unstable","Radio","forwardRef","props","ref","state","displayName"],"sources":["../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { RadioProps } from './Radio.types';\nimport { renderRadio_unstable } from './renderRadio';\nimport { useRadio_unstable } from './useRadio';\nimport { useRadioStyles_unstable } from './useRadioStyles.styles';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Radio component is a wrapper for a radio button with a label.\n */\nexport const Radio: ForwardRefComponent<RadioProps> = React.forwardRef((props, ref) => {\n const state = useRadio_unstable(props, ref);\n\n useRadioStyles_unstable(state);\n\n useCustomStyleHook_unstable('useRadioStyles_unstable')(state);\n\n return renderRadio_unstable(state);\n});\n\nRadio.displayName = 'Radio';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAGvB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,2BAA2B,QAAQ;AAE5C;;;AAGA,OAAO,MAAMC,KAAA,gBAAyCL,KAAA,CAAMM,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACrF,MAAMC,KAAA,GAAQP,iBAAA,CAAkBK,KAAA,EAAOC,GAAA;EAEvCL,uBAAA,CAAwBM,KAAA;EAExBL,2BAAA,CAA4B,2BAA2BK,KAAA;EAEvD,OAAOR,oBAAA,CAAqBQ,KAAA;AAC9B;AAEAJ,KAAA,CAAMK,WAAW,GAAG"}
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ //# sourceMappingURL=Radio.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React"],"sources":["../../../src/components/Radio/Radio.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type RadioSlots = {\n /**\n * The root element of the Radio.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Radio>`.\n * All other native props will be applied to the primary slot: `input`\n */\n root: NonNullable<Slot<'span'>>;\n\n /**\n * The Radio's label.\n */\n label: Slot<typeof Label>;\n\n /**\n * Hidden input that handles the radio's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on `<Radio>` will be applied to this slot,\n * except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * A circle outline, with a filled circle icon inside when the Radio is checked.\n */\n indicator: NonNullable<Slot<'div'>>;\n};\n\n/**\n * Radio Props\n */\nexport type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & {\n /**\n * The value of the RadioGroup when this Radio item is selected.\n */\n value?: string;\n\n /**\n * The position of the label relative to the radio indicator.\n *\n * This defaults to `after` unless the Radio is inside a RadioGroup with `layout=\"horizontalStacked\"`,\n * in which case it defaults to `below`.\n *\n * @defaultvalue after\n */\n labelPosition?: 'after' | 'below';\n\n /**\n * Disable this Radio item.\n */\n disabled?: boolean;\n\n /**\n * Callback when this Radio is selected in its group.\n *\n * **Note:** `onChange` is NOT called when this Radio is deselected.\n * Use RadioGroup's `onChange` event to determine when the selection in the group changes.\n */\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: RadioOnChangeData) => void;\n};\n\n/**\n * Data for the onChange event for Radio.\n */\nexport type RadioOnChangeData = {\n /**\n * The value prop of this Radio item.\n */\n value: string;\n};\n\n/**\n * State used in rendering Radio\n */\nexport type RadioState = ComponentState<RadioSlots> & Required<Pick<RadioProps, 'labelPosition'>>;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
@@ -0,0 +1,6 @@
1
+ export * from './Radio';
2
+ export * from './Radio.types';
3
+ export * from './renderRadio';
4
+ export * from './useRadio';
5
+ export * from './useRadioStyles.styles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/components/Radio/index.ts"],"sourcesContent":["export * from './Radio';\nexport * from './Radio.types';\nexport * from './renderRadio';\nexport * from './useRadio';\nexport * from './useRadioStyles.styles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
@@ -0,0 +1,13 @@
1
+ /** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
2
+ import { getSlotsNext } from '@fluentui/react-utilities';
3
+ /**
4
+ * Render the final JSX of Radio
5
+ */
6
+ export const renderRadio_unstable = state => {
7
+ const {
8
+ slots,
9
+ slotProps
10
+ } = getSlotsNext(state);
11
+ return /*#__PURE__*/createElement(slots.root, slotProps.root, /*#__PURE__*/createElement(slots.input, slotProps.input), /*#__PURE__*/createElement(slots.indicator, slotProps.indicator), slots.label && /*#__PURE__*/createElement(slots.label, slotProps.label));
12
+ };
13
+ //# sourceMappingURL=renderRadio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createElement","getSlotsNext","renderRadio_unstable","state","slots","slotProps","root","input","indicator","label"],"sources":["../../../src/components/Radio/renderRadio.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { RadioSlots, RadioState } from './Radio.types';\n\n/**\n * Render the final JSX of Radio\n */\nexport const renderRadio_unstable = (state: RadioState) => {\n const { slots, slotProps } = getSlotsNext<RadioSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n <slots.indicator {...slotProps.indicator} />\n {slots.label && <slots.label {...slotProps.label} />}\n </slots.root>\n );\n};\n"],"mappings":"AAAA,2BACA,yBAEA,SAASA,aAAa,QAAQ;AAE9B,SAASC,YAAY,QAAQ;AAG7B;;;AAGA,OAAO,MAAMC,oBAAA,GAAwBC,KAAA,IAAsB;EACzD,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGJ,YAAA,CAAyBE,KAAA;EAEtD,oBACEH,aAdJ,CAcKI,KAAA,CAAME,IAAI,EAAKD,SAAA,CAAUC,IAAI,eAC5BN,aAfN,CAeOI,KAAA,CAAMG,KAAK,EAAKF,SAAA,CAAUE,KAAK,gBAChCP,aAhBN,CAgBOI,KAAA,CAAMI,SAAS,EAAKH,SAAA,CAAUG,SAAS,GACvCJ,KAAA,CAAMK,KAAK,iBAAIT,aAjBtB,CAiBuBI,KAAA,CAAMK,KAAK,EAAKJ,SAAA,CAAUI,KAAK;AAGtD"}
@@ -0,0 +1,87 @@
1
+ import * as React from 'react';
2
+ import { CircleFilled } from '@fluentui/react-icons';
3
+ import { Label } from '@fluentui/react-label';
4
+ import { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';
5
+ import { useRadioGroupContextValue_unstable } from '../../contexts/RadioGroupContext';
6
+ import { useFocusWithin } from '@fluentui/react-tabster';
7
+ /**
8
+ * Create the state required to render Radio.
9
+ *
10
+ * The returned state can be modified with hooks such as useRadioStyles_unstable,
11
+ * before being passed to renderRadio_unstable.
12
+ *
13
+ * @param props - props from this instance of Radio
14
+ * @param ref - reference to `<input>` element of Radio
15
+ */
16
+ export const useRadio_unstable = (props, ref) => {
17
+ const group = useRadioGroupContextValue_unstable();
18
+ const {
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'],
26
+ onChange
27
+ } = props;
28
+ const nativeProps = getPartitionedNativeProps({
29
+ props,
30
+ primarySlotTagName: 'input',
31
+ excludedPropNames: ['checked', 'defaultChecked', 'onChange']
32
+ });
33
+ const root = resolveShorthand(props.root, {
34
+ required: true,
35
+ defaultProps: {
36
+ ref: useFocusWithin(),
37
+ ...nativeProps.root
38
+ }
39
+ });
40
+ const input = resolveShorthand(props.input, {
41
+ required: true,
42
+ defaultProps: {
43
+ ref,
44
+ type: 'radio',
45
+ id: useId('radio-', nativeProps.primary.id),
46
+ name,
47
+ checked,
48
+ defaultChecked,
49
+ disabled,
50
+ required,
51
+ 'aria-describedby': ariaDescribedBy,
52
+ ...nativeProps.primary
53
+ }
54
+ });
55
+ input.onChange = mergeCallbacks(input.onChange, ev => {
56
+ return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
57
+ value: ev.currentTarget.value
58
+ });
59
+ });
60
+ const label = resolveShorthand(props.label, {
61
+ defaultProps: {
62
+ htmlFor: input.id,
63
+ disabled: input.disabled
64
+ }
65
+ });
66
+ const indicator = resolveShorthand(props.indicator, {
67
+ required: true,
68
+ defaultProps: {
69
+ 'aria-hidden': true,
70
+ children: /*#__PURE__*/React.createElement(CircleFilled, null)
71
+ }
72
+ });
73
+ return {
74
+ labelPosition,
75
+ components: {
76
+ root: 'span',
77
+ input: 'input',
78
+ label: Label,
79
+ indicator: 'div'
80
+ },
81
+ root,
82
+ input,
83
+ label,
84
+ indicator
85
+ };
86
+ };
87
+ //# sourceMappingURL=useRadio.js.map
@@ -0,0 +1 @@
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,CAAMS,QAAQ;IACzBC,QAAA,GAAWV,KAAA,CAAMU,QAAQ;IACzB,oBAAoBC,eAAA,GAAkBX,KAAK,CAAC,mBAAmB;IAC/DY;EAAQ,CACT,GAAGd,KAAA;EAEJ,MAAMe,WAAA,GAActB,yBAAA,CAA0B;IAC5CO,KAAA;IACAgB,kBAAA,EAAoB;IACpBC,iBAAA,EAAmB,CAAC,WAAW,kBAAkB;EACnD;EAEA,MAAMC,IAAA,GAAOvB,gBAAA,CAAiBK,KAAA,CAAMkB,IAAI,EAAE;IACxCN,QAAA,EAAU,IAAI;IACdO,YAAA,EAAc;MACZlB,GAAA,EAAKH,cAAA;MACL,GAAGiB,WAAA,CAAYG;IACjB;EACF;EAEA,MAAME,KAAA,GAAQzB,gBAAA,CAAiBK,KAAA,CAAMoB,KAAK,EAAE;IAC1CR,QAAA,EAAU,IAAI;IACdO,YAAA,EAAc;MACZlB,GAAA;MACAoB,IAAA,EAAM;MACNC,EAAA,EAAI1B,KAAA,CAAM,UAAUmB,WAAA,CAAYQ,OAAO,CAACD,EAAE;MAC1CnB,IAAA;MACAC,OAAA;MACAG,cAAA;MACAI,QAAA;MACAC,QAAA;MACA,oBAAoBC,eAAA;MACpB,GAAGE,WAAA,CAAYQ;IACjB;EACF;EAEAH,KAAA,CAAMN,QAAQ,GAAGpB,cAAA,CAAe0B,KAAA,CAAMN,QAAQ,EAAEU,EAAA;IAAM,OAAAV,QAAA,aAAAA,QAAA,uBAAAA,QAAA,CAAWU,EAAA,EAAI;MAAEnB,KAAA,EAAOmB,EAAA,CAAGC,aAAa,CAACpB;IAAM;;EAErG,MAAMqB,KAAA,GAAQ/B,gBAAA,CAAiBK,KAAA,CAAM0B,KAAK,EAAE;IAC1CP,YAAA,EAAc;MACZQ,OAAA,EAASP,KAAA,CAAME,EAAE;MACjBX,QAAA,EAAUS,KAAA,CAAMT;IAClB;EACF;EAEA,MAAMiB,SAAA,GAAYjC,gBAAA,CAAiBK,KAAA,CAAM4B,SAAS,EAAE;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"}
@@ -0,0 +1,72 @@
1
+ import { createFocusOutlineStyle } from '@fluentui/react-tabster';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';
4
+ export const radioClassNames = {
5
+ root: 'fui-Radio',
6
+ indicator: 'fui-Radio__indicator',
7
+ input: 'fui-Radio__input',
8
+ label: 'fui-Radio__label'
9
+ };
10
+ // The indicator size is used by the indicator and label styles
11
+ const indicatorSize = '16px';
12
+ const useRootBaseClassName = /*#__PURE__*/__resetStyles("r18vxbm9", "r1631i6s", [".r18vxbm9{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".r18vxbm9:focus{outline-style:none;}", ".r18vxbm9:focus-visible{outline-style:none;}", ".r18vxbm9[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r18vxbm9[data-fui-focus-within]:focus-within::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;left:-2px;right:-2px;}", ".r1631i6s{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".r1631i6s:focus{outline-style:none;}", ".r1631i6s:focus-visible{outline-style:none;}", ".r1631i6s[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".r1631i6s[data-fui-focus-within]:focus-within::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-width:2px;border-left-width:2px;border-bottom-width:2px;border-right-width:2px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;right:-2px;left:-2px;}"]);
13
+ const useRootStyles = /*#__PURE__*/__styles({
14
+ vertical: {
15
+ Beiy3e4: "f1vx9l62",
16
+ Bt984gj: "f122n59"
17
+ }
18
+ }, {
19
+ d: [".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}"]
20
+ });
21
+ const useInputBaseClassName = /*#__PURE__*/__resetStyles("r9gx1vl", "r1uk1i2c", [".r9gx1vl{position:absolute;left:0;top:0;width:calc(16px + 2 * var(--spacingHorizontalS));height:100%;box-sizing:border-box;margin:0;opacity:0;}", ".r9gx1vl:enabled{cursor:pointer;}", ".r9gx1vl:enabled~.fui-Radio__label{cursor:pointer;}", ".r9gx1vl:not(:checked)~.fui-Radio__indicator>*{opacity:0;}", ".r9gx1vl:enabled:not(:checked)~.fui-Radio__label{color:var(--colorNeutralForeground3);}", ".r9gx1vl:enabled:not(:checked)~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessible);}", ".r9gx1vl:enabled:not(:checked):hover~.fui-Radio__label{color:var(--colorNeutralForeground2);}", ".r9gx1vl:enabled:not(:checked):hover~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r9gx1vl:enabled:not(:checked):hover:active~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r9gx1vl:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r9gx1vl:enabled:checked~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r9gx1vl:enabled:checked~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStroke);color:var(--colorCompoundBrandForeground1);}", ".r9gx1vl:enabled:checked:hover~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokeHover);color:var(--colorCompoundBrandForeground1Hover);}", ".r9gx1vl:enabled:checked:hover:active~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokePressed);color:var(--colorCompoundBrandForeground1Pressed);}", ".r9gx1vl:disabled~.fui-Radio__label{color:var(--colorNeutralForegroundDisabled);cursor:default;}", ".r9gx1vl:disabled~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeDisabled);color:var(--colorNeutralForegroundDisabled);}", ".r1uk1i2c{position:absolute;right:0;top:0;width:calc(16px + 2 * var(--spacingHorizontalS));height:100%;box-sizing:border-box;margin:0;opacity:0;}", ".r1uk1i2c:enabled{cursor:pointer;}", ".r1uk1i2c:enabled~.fui-Radio__label{cursor:pointer;}", ".r1uk1i2c:not(:checked)~.fui-Radio__indicator>*{opacity:0;}", ".r1uk1i2c:enabled:not(:checked)~.fui-Radio__label{color:var(--colorNeutralForeground3);}", ".r1uk1i2c:enabled:not(:checked)~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessible);}", ".r1uk1i2c:enabled:not(:checked):hover~.fui-Radio__label{color:var(--colorNeutralForeground2);}", ".r1uk1i2c:enabled:not(:checked):hover~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r1uk1i2c:enabled:not(:checked):hover:active~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r1uk1i2c:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r1uk1i2c:enabled:checked~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r1uk1i2c:enabled:checked~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStroke);color:var(--colorCompoundBrandForeground1);}", ".r1uk1i2c:enabled:checked:hover~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokeHover);color:var(--colorCompoundBrandForeground1Hover);}", ".r1uk1i2c:enabled:checked:hover:active~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokePressed);color:var(--colorCompoundBrandForeground1Pressed);}", ".r1uk1i2c:disabled~.fui-Radio__label{color:var(--colorNeutralForegroundDisabled);cursor:default;}", ".r1uk1i2c:disabled~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeDisabled);color:var(--colorNeutralForegroundDisabled);}"]);
22
+ const useInputStyles = /*#__PURE__*/__styles({
23
+ below: {
24
+ a9b677: "fly5x3f",
25
+ Bqenvij: "f1je6zif"
26
+ }
27
+ }, {
28
+ d: [".fly5x3f{width:100%;}", ".f1je6zif{height:calc(16px + 2 * var(--spacingVerticalS));}"]
29
+ });
30
+ const useIndicatorBaseClassName = /*#__PURE__*/__resetStyles("rid4516", null, [".rid4516{width:16px;height:16px;font-size:12px;box-sizing:border-box;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;overflow:hidden;border:var(--strokeWidthThin) solid;border-radius:var(--borderRadiusCircular);margin:var(--spacingVerticalS) var(--spacingHorizontalS);fill:currentColor;pointer-events:none;}"]);
31
+ // Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
32
+ const useLabelStyles = /*#__PURE__*/__styles({
33
+ base: {
34
+ qb2dma: "f7nlbp4",
35
+ z8tnut: "f1kwiid1",
36
+ z189sj: ["f1vdfbxk", "f1f5gg8d"],
37
+ Byoj8tv: "f5b47ha",
38
+ uwmqm3: ["f1f5gg8d", "f1vdfbxk"]
39
+ },
40
+ after: {
41
+ uwmqm3: ["fruq291", "f7x41pl"],
42
+ B6of3ja: "fjzwpt6",
43
+ jrapky: "fh6j2fo"
44
+ },
45
+ below: {
46
+ z8tnut: "f1ywm7hm",
47
+ fsow6f: "f17mccla"
48
+ }
49
+ }, {
50
+ d: [".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".f1kwiid1{padding-top:var(--spacingVerticalS);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f5b47ha{padding-bottom:var(--spacingVerticalS);}", ".fruq291{padding-left:var(--spacingHorizontalXS);}", ".f7x41pl{padding-right:var(--spacingHorizontalXS);}", ".fjzwpt6{margin-top:calc((16px - var(--lineHeightBase300)) / 2);}", ".fh6j2fo{margin-bottom:calc((16px - var(--lineHeightBase300)) / 2);}", ".f1ywm7hm{padding-top:var(--spacingVerticalXS);}", ".f17mccla{text-align:center;}"]
51
+ });
52
+ /**
53
+ * Apply styling to the Radio slots based on the state
54
+ */
55
+ export const useRadioStyles_unstable = state => {
56
+ const {
57
+ labelPosition
58
+ } = state;
59
+ const rootBaseClassName = useRootBaseClassName();
60
+ const rootStyles = useRootStyles();
61
+ state.root.className = mergeClasses(radioClassNames.root, rootBaseClassName, labelPosition === 'below' && rootStyles.vertical, state.root.className);
62
+ const inputBaseClassName = useInputBaseClassName();
63
+ const inputStyles = useInputStyles();
64
+ state.input.className = mergeClasses(radioClassNames.input, inputBaseClassName, labelPosition === 'below' && inputStyles.below, state.input.className);
65
+ const indicatorBaseClassName = useIndicatorBaseClassName();
66
+ state.indicator.className = mergeClasses(radioClassNames.indicator, indicatorBaseClassName, state.indicator.className);
67
+ const labelStyles = useLabelStyles();
68
+ if (state.label) {
69
+ state.label.className = mergeClasses(radioClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
70
+ }
71
+ };
72
+ //# sourceMappingURL=useRadioStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFocusOutlineStyle","tokens","__resetStyles","__styles","mergeClasses","shorthands","radioClassNames","root","indicator","input","label","indicatorSize","useRootBaseClassName","useRootStyles","vertical","Beiy3e4","Bt984gj","d","useInputBaseClassName","useInputStyles","below","a9b677","Bqenvij","useIndicatorBaseClassName","useLabelStyles","base","qb2dma","z8tnut","z189sj","Byoj8tv","uwmqm3","after","B6of3ja","jrapky","fsow6f","useRadioStyles_unstable","state","labelPosition","rootBaseClassName","rootStyles","className","inputBaseClassName","inputStyles","indicatorBaseClassName","labelStyles"],"sources":["../../../src/components/Radio/useRadioStyles.styles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { RadioSlots, RadioState } from './Radio.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const radioClassNames: SlotClassNames<RadioSlots> = {\n root: 'fui-Radio',\n indicator: 'fui-Radio__indicator',\n input: 'fui-Radio__input',\n label: 'fui-Radio__label',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSize = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n display: 'inline-flex',\n position: 'relative',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n alignItems: 'center',\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n position: 'absolute',\n left: 0,\n top: 0,\n width: `calc(${indicatorSize} + 2 * ${tokens.spacingHorizontalS})`,\n height: '100%',\n boxSizing: 'border-box',\n margin: 0,\n opacity: 0,\n\n ':enabled': {\n cursor: 'pointer',\n [`& ~ .${radioClassNames.label}`]: {\n cursor: 'pointer',\n },\n },\n\n // When unchecked, hide the circle icon (child of the indicator)\n [`:not(:checked) ~ .${radioClassNames.indicator} > *`]: {\n opacity: '0',\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked)': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStroke,\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokeHover,\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokePressed,\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n // Colors for the disabled state\n ':disabled': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'default',\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n below: {\n width: '100%',\n height: `calc(${indicatorSize} + 2 * ${tokens.spacingVerticalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n width: indicatorSize,\n height: indicatorSize,\n fontSize: '12px',\n boxSizing: 'border-box',\n flexShrink: 0,\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n\n border: tokens.strokeWidthThin + ' solid',\n borderRadius: tokens.borderRadiusCircular,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n\n // Use a (negative) margin to account for the difference between the indicator's height and the label's line height.\n // This prevents the label from expanding the height of the Radio, but preserves line height if the label wraps.\n marginTop: `calc((${indicatorSize} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSize} - ${tokens.lineHeightBase300}) / 2)`,\n },\n\n below: {\n paddingTop: tokens.spacingVerticalXS,\n textAlign: 'center',\n },\n});\n\n/**\n * Apply styling to the Radio slots based on the state\n */\nexport const useRadioStyles_unstable = (state: RadioState) => {\n const { labelPosition } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n radioClassNames.root,\n rootBaseClassName,\n labelPosition === 'below' && rootStyles.vertical,\n state.root.className,\n );\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n radioClassNames.input,\n inputBaseClassName,\n labelPosition === 'below' && inputStyles.below,\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n state.indicator.className = mergeClasses(\n radioClassNames.indicator,\n indicatorBaseClassName,\n state.indicator.className,\n );\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n radioClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n};\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,MAAM,QAAQ;AACvB,SAAAC,aAAA,EAAAC,QAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ;AAItE,OAAO,MAAMC,eAAA,GAA8C;EACzDC,IAAA,EAAM;EACNC,SAAA,EAAW;EACXC,KAAA,EAAO;EACPC,KAAA,EAAO;AACT;AAEA;AACA,MAAMC,aAAA,GAAgB;AAEtB,MAAMC,oBAAA,gBAAuBV,aAAA,guEAI7B;AAEA,MAAMW,aAAA,gBAAgBV,QAAA;EAAAW,QAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAKtB;AAEA,MAAMC,qBAAA,gBAAwBhB,aAAA,46GAsF9B;AAEA,MAAMiB,cAAA,gBAAiBhB,QAAA;EAAAiB,KAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAL,CAAA;AAAA,EAKvB;AAEA,MAAMM,yBAAA,gBAA4BrB,aAAA,4lBAiBlC;AAEA;AACA,MAAMsB,cAAA,gBAAiBrB,QAAA;EAAAsB,IAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,KAAA;IAAAD,MAAA;IAAAE,OAAA;IAAAC,MAAA;EAAA;EAAAb,KAAA;IAAAO,MAAA;IAAAO,MAAA;EAAA;AAAA;EAAAjB,CAAA;AAAA,EAmBvB;AAEA;;;AAGA,OAAO,MAAMkB,uBAAA,GAA2BC,KAAA,IAAsB;EAC5D,MAAM;IAAEC;EAAa,CAAE,GAAGD,KAAA;EAE1B,MAAME,iBAAA,GAAoB1B,oBAAA;EAC1B,MAAM2B,UAAA,GAAa1B,aAAA;EACnBuB,KAAA,CAAM7B,IAAI,CAACiC,SAAS,GAAGpC,YAAA,CACrBE,eAAA,CAAgBC,IAAI,EACpB+B,iBAAA,EACAD,aAAA,KAAkB,WAAWE,UAAA,CAAWzB,QAAQ,EAChDsB,KAAA,CAAM7B,IAAI,CAACiC,SAAS;EAGtB,MAAMC,kBAAA,GAAqBvB,qBAAA;EAC3B,MAAMwB,WAAA,GAAcvB,cAAA;EACpBiB,KAAA,CAAM3B,KAAK,CAAC+B,SAAS,GAAGpC,YAAA,CACtBE,eAAA,CAAgBG,KAAK,EACrBgC,kBAAA,EACAJ,aAAA,KAAkB,WAAWK,WAAA,CAAYtB,KAAK,EAC9CgB,KAAA,CAAM3B,KAAK,CAAC+B,SAAS;EAGvB,MAAMG,sBAAA,GAAyBpB,yBAAA;EAC/Ba,KAAA,CAAM5B,SAAS,CAACgC,SAAS,GAAGpC,YAAA,CAC1BE,eAAA,CAAgBE,SAAS,EACzBmC,sBAAA,EACAP,KAAA,CAAM5B,SAAS,CAACgC,SAAS;EAG3B,MAAMI,WAAA,GAAcpB,cAAA;EACpB,IAAIY,KAAA,CAAM1B,KAAK,EAAE;IACf0B,KAAA,CAAM1B,KAAK,CAAC8B,SAAS,GAAGpC,YAAA,CACtBE,eAAA,CAAgBI,KAAK,EACrBkC,WAAA,CAAYnB,IAAI,EAChBmB,WAAW,CAACP,aAAA,CAAc,EAC1BD,KAAA,CAAM1B,KAAK,CAAC8B,SAAS;EAEzB;AACF"}
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import { renderRadioGroup_unstable } from './renderRadioGroup';
3
+ import { useRadioGroup_unstable } from './useRadioGroup';
4
+ import { useRadioGroupStyles_unstable } from './useRadioGroupStyles.styles';
5
+ import { useRadioGroupContextValues } from '../../contexts/useRadioGroupContextValues';
6
+ import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
7
+ /**
8
+ * A RadioGroup component presents a set of options where only one option can be selected.
9
+ */
10
+ export const RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
11
+ const state = useRadioGroup_unstable(props, ref);
12
+ const contextValues = useRadioGroupContextValues(state);
13
+ useRadioGroupStyles_unstable(state);
14
+ useCustomStyleHook_unstable('useRadioGroupStyles_unstable')(state);
15
+ return renderRadioGroup_unstable(state, contextValues);
16
+ });
17
+ RadioGroup.displayName = 'RadioGroup';
18
+ //# sourceMappingURL=RadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","renderRadioGroup_unstable","useRadioGroup_unstable","useRadioGroupStyles_unstable","useRadioGroupContextValues","useCustomStyleHook_unstable","RadioGroup","forwardRef","props","ref","state","contextValues","displayName"],"sources":["../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { RadioGroupProps } from './RadioGroup.types';\nimport { renderRadioGroup_unstable } from './renderRadioGroup';\nimport { useRadioGroup_unstable } from './useRadioGroup';\nimport { useRadioGroupStyles_unstable } from './useRadioGroupStyles.styles';\nimport { useRadioGroupContextValues } from '../../contexts/useRadioGroupContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * A RadioGroup component presents a set of options where only one option can be selected.\n */\nexport const RadioGroup: ForwardRefComponent<RadioGroupProps> = React.forwardRef((props, ref) => {\n const state = useRadioGroup_unstable(props, ref);\n const contextValues = useRadioGroupContextValues(state);\n\n useRadioGroupStyles_unstable(state);\n\n useCustomStyleHook_unstable('useRadioGroupStyles_unstable')(state);\n\n return renderRadioGroup_unstable(state, contextValues);\n});\n\nRadioGroup.displayName = 'RadioGroup';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAGvB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,2BAA2B,QAAQ;AAE5C;;;AAGA,OAAO,MAAMC,UAAA,gBAAmDN,KAAA,CAAMO,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EAC/F,MAAMC,KAAA,GAAQR,sBAAA,CAAuBM,KAAA,EAAOC,GAAA;EAC5C,MAAME,aAAA,GAAgBP,0BAAA,CAA2BM,KAAA;EAEjDP,4BAAA,CAA6BO,KAAA;EAE7BL,2BAAA,CAA4B,gCAAgCK,KAAA;EAE5D,OAAOT,yBAAA,CAA0BS,KAAA,EAAOC,aAAA;AAC1C;AAEAL,UAAA,CAAWM,WAAW,GAAG"}
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ //# sourceMappingURL=RadioGroup.types.js.map
@@ -0,0 +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 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"}
@@ -0,0 +1,6 @@
1
+ export * from './RadioGroup';
2
+ export * from './RadioGroup.types';
3
+ export * from './renderRadioGroup';
4
+ export * from './useRadioGroup';
5
+ export * from './useRadioGroupStyles.styles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/components/RadioGroup/index.ts"],"sourcesContent":["export * from './RadioGroup';\nexport * from './RadioGroup.types';\nexport * from './renderRadioGroup';\nexport * from './useRadioGroup';\nexport * from './useRadioGroupStyles.styles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
@@ -0,0 +1,16 @@
1
+ /** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
2
+ import { getSlotsNext } from '@fluentui/react-utilities';
3
+ import { RadioGroupContext } from '../../contexts/RadioGroupContext';
4
+ /**
5
+ * Render the final JSX of RadioGroup
6
+ */
7
+ export const renderRadioGroup_unstable = (state, contextValues) => {
8
+ const {
9
+ slots,
10
+ slotProps
11
+ } = getSlotsNext(state);
12
+ return /*#__PURE__*/createElement(RadioGroupContext.Provider, {
13
+ value: contextValues.radioGroup
14
+ }, /*#__PURE__*/createElement(slots.root, slotProps.root));
15
+ };
16
+ //# sourceMappingURL=renderRadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createElement","getSlotsNext","RadioGroupContext","renderRadioGroup_unstable","state","contextValues","slots","slotProps","Provider","value","radioGroup","root"],"sources":["../../../src/components/RadioGroup/renderRadioGroup.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\nimport { RadioGroupContextValues, RadioGroupSlots, RadioGroupState } from './RadioGroup.types';\n\n/**\n * Render the final JSX of RadioGroup\n */\nexport const renderRadioGroup_unstable = (state: RadioGroupState, contextValues: RadioGroupContextValues) => {\n const { slots, slotProps } = getSlotsNext<RadioGroupSlots>(state);\n\n return (\n <RadioGroupContext.Provider value={contextValues.radioGroup}>\n <slots.root {...slotProps.root} />\n </RadioGroupContext.Provider>\n );\n};\n"],"mappings":"AAAA,2BACA,yBAEA,SAASA,aAAa,QAAQ;AAE9B,SAASC,YAAY,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ;AAGlC;;;AAGA,OAAO,MAAMC,yBAAA,GAA4BA,CAACC,KAAA,EAAwBC,aAAA,KAA2C;EAC3G,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGN,YAAA,CAA8BG,KAAA;EAE3D,oBACEJ,aAfJ,CAeKE,iBAAA,CAAkBM,QAAQ;IAACC,KAAA,EAAOJ,aAAA,CAAcK;kBAC/CV,aAhBN,CAgBOM,KAAA,CAAMK,IAAI,EAAKJ,SAAA,CAAUI,IAAI;AAGpC"}
@@ -0,0 +1,52 @@
1
+ import * as React from 'react';
2
+ import { useFieldControlProps_unstable } from '@fluentui/react-field';
3
+ import { getNativeElementProps, isHTMLElement, useEventCallback, useId } from '@fluentui/react-utilities';
4
+ /**
5
+ * Create the state required to render RadioGroup.
6
+ *
7
+ * The returned state can be modified with hooks such as useRadioGroupStyles_unstable,
8
+ * before being passed to renderRadioGroup_unstable.
9
+ *
10
+ * @param props - props from this instance of RadioGroup
11
+ * @param ref - reference to root HTMLElement of RadioGroup
12
+ */
13
+ export const useRadioGroup_unstable = (props, ref) => {
14
+ // Merge props from surrounding <Field>, if any
15
+ props = useFieldControlProps_unstable(props);
16
+ const generatedName = useId('radiogroup-');
17
+ const {
18
+ name = generatedName,
19
+ value,
20
+ defaultValue,
21
+ disabled,
22
+ layout = 'vertical',
23
+ onChange,
24
+ required
25
+ } = props;
26
+ return {
27
+ layout,
28
+ name,
29
+ value,
30
+ defaultValue,
31
+ disabled,
32
+ required,
33
+ components: {
34
+ root: 'div'
35
+ },
36
+ root: {
37
+ ref,
38
+ role: 'radiogroup',
39
+ ...getNativeElementProps('div', props, /*excludedPropNames:*/['onChange', 'name']),
40
+ onChange: useEventCallback(ev => {
41
+ if (onChange && isHTMLElement(ev.target, {
42
+ constructorName: 'HTMLInputElement'
43
+ }) && ev.target.type === 'radio') {
44
+ onChange(ev, {
45
+ value: ev.target.value
46
+ });
47
+ }
48
+ })
49
+ }
50
+ };
51
+ };
52
+ //# sourceMappingURL=useRadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useFieldControlProps_unstable","getNativeElementProps","isHTMLElement","useEventCallback","useId","useRadioGroup_unstable","props","ref","generatedName","name","value","defaultValue","disabled","layout","onChange","required","components","root","role","ev","target","constructorName","type"],"sources":["../../../src/components/RadioGroup/useRadioGroup.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { getNativeElementProps, isHTMLElement, useEventCallback, useId } from '@fluentui/react-utilities';\nimport { RadioGroupProps, RadioGroupState } from './RadioGroup.types';\n\n/**\n * Create the state required to render RadioGroup.\n *\n * The returned state can be modified with hooks such as useRadioGroupStyles_unstable,\n * before being passed to renderRadioGroup_unstable.\n *\n * @param props - props from this instance of RadioGroup\n * @param ref - reference to root HTMLElement of RadioGroup\n */\nexport const useRadioGroup_unstable = (props: RadioGroupProps, ref: React.Ref<HTMLDivElement>): RadioGroupState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props);\n\n const generatedName = useId('radiogroup-');\n\n const { name = generatedName, value, defaultValue, disabled, layout = 'vertical', onChange, required } = props;\n\n return {\n layout,\n name,\n value,\n defaultValue,\n disabled,\n required,\n components: {\n root: 'div',\n },\n root: {\n ref,\n role: 'radiogroup',\n ...getNativeElementProps('div', props, /*excludedPropNames:*/ ['onChange', 'name']),\n onChange: useEventCallback(ev => {\n if (\n onChange &&\n isHTMLElement(ev.target, { constructorName: 'HTMLInputElement' }) &&\n ev.target.type === 'radio'\n ) {\n onChange(ev, { value: ev.target.value });\n }\n }),\n },\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ;AAG9E;;;;;;;;;AASA,OAAO,MAAMC,sBAAA,GAAyBA,CAACC,KAAA,EAAwBC,GAAA,KAAoD;EACjH;EACAD,KAAA,GAAQN,6BAAA,CAA8BM,KAAA;EAEtC,MAAME,aAAA,GAAgBJ,KAAA,CAAM;EAE5B,MAAM;IAAEK,IAAA,GAAOD,aAAA;IAAeE,KAAA;IAAOC,YAAA;IAAcC,QAAA;IAAUC,MAAA,GAAS;IAAYC,QAAA;IAAUC;EAAQ,CAAE,GAAGT,KAAA;EAEzG,OAAO;IACLO,MAAA;IACAJ,IAAA;IACAC,KAAA;IACAC,YAAA;IACAC,QAAA;IACAG,QAAA;IACAC,UAAA,EAAY;MACVC,IAAA,EAAM;IACR;IACAA,IAAA,EAAM;MACJV,GAAA;MACAW,IAAA,EAAM;MACN,GAAGjB,qBAAA,CAAsB,OAAOK,KAAA,EAAO,sBAAuB,CAAC,YAAY,OAAO,CAAC;MACnFQ,QAAA,EAAUX,gBAAA,CAAiBgB,EAAA,IAAM;QAC/B,IACEL,QAAA,IACAZ,aAAA,CAAciB,EAAA,CAAGC,MAAM,EAAE;UAAEC,eAAA,EAAiB;QAAmB,MAC/DF,EAAA,CAAGC,MAAM,CAACE,IAAI,KAAK,SACnB;UACAR,QAAA,CAASK,EAAA,EAAI;YAAET,KAAA,EAAOS,EAAA,CAAGC,MAAM,CAACV;UAAM;QACxC;MACF;IACF;EACF;AACF"}
@@ -0,0 +1,23 @@
1
+ import { __styles, mergeClasses } from '@griffel/react';
2
+ export const radioGroupClassNames = {
3
+ root: 'fui-RadioGroup'
4
+ };
5
+ const useStyles = /*#__PURE__*/__styles({
6
+ root: {
7
+ mc9l5x: "f22iagw",
8
+ Bt984gj: "f6jr5hl"
9
+ },
10
+ vertical: {
11
+ Beiy3e4: "f1vx9l62"
12
+ }
13
+ }, {
14
+ d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f6jr5hl{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"]
15
+ });
16
+ /**
17
+ * Apply styling to the RadioGroup slots based on the state
18
+ */
19
+ export const useRadioGroupStyles_unstable = state => {
20
+ const styles = useStyles();
21
+ state.root.className = mergeClasses(radioGroupClassNames.root, styles.root, state.layout === 'vertical' && styles.vertical, state.root.className);
22
+ };
23
+ //# sourceMappingURL=useRadioGroupStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__styles","mergeClasses","radioGroupClassNames","root","useStyles","mc9l5x","Bt984gj","vertical","Beiy3e4","d","useRadioGroupStyles_unstable","state","styles","className","layout"],"sources":["../../../src/components/RadioGroup/useRadioGroupStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { RadioGroupSlots, RadioGroupState } from './RadioGroup.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const radioGroupClassNames: SlotClassNames<RadioGroupSlots> = {\n root: 'fui-RadioGroup',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n\n vertical: {\n flexDirection: 'column',\n },\n});\n\n/**\n * Apply styling to the RadioGroup slots based on the state\n */\nexport const useRadioGroupStyles_unstable = (state: RadioGroupState) => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n radioGroupClassNames.root,\n styles.root,\n state.layout === 'vertical' && styles.vertical,\n state.root.className,\n );\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ;AAIzC,OAAO,MAAMC,oBAAA,GAAwD;EACnEC,IAAA,EAAM;AACR;AAEA,MAAMC,SAAA,gBAAYJ,QAAA;EAAAG,IAAA;IAAAE,MAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EASlB;AAEA;;;AAGA,OAAO,MAAMC,4BAAA,GAAgCC,KAAA,IAA2B;EACtE,MAAMC,MAAA,GAASR,SAAA;EACfO,KAAA,CAAMR,IAAI,CAACU,SAAS,GAAGZ,YAAA,CACrBC,oBAAA,CAAqBC,IAAI,EACzBS,MAAA,CAAOT,IAAI,EACXQ,KAAA,CAAMG,MAAM,KAAK,cAAcF,MAAA,CAAOL,QAAQ,EAC9CI,KAAA,CAAMR,IAAI,CAACU,SAAS;AAExB"}
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
4
+ */
5
+ export const RadioGroupContext = /*#__PURE__*/React.createContext(undefined);
6
+ const radioGroupContextDefaultValue = {};
7
+ export const RadioGroupProvider = RadioGroupContext.Provider;
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());
17
+ //# sourceMappingURL=RadioGroupContext.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,3 @@
1
+ export * from './RadioGroupContext';
2
+ export * from './useRadioGroupContextValues';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/contexts/index.ts"],"sourcesContent":["export * from './RadioGroupContext';\nexport * from './useRadioGroupContextValues';\n"],"mappings":"AAAA,cAAc;AACd,cAAc"}
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ export const useRadioGroupContextValues = state => {
3
+ const {
4
+ name,
5
+ value,
6
+ defaultValue,
7
+ disabled,
8
+ layout,
9
+ required
10
+ } = state;
11
+ const ariaDescribedBy = state.root['aria-describedby'];
12
+ const radioGroup = React.useMemo(() => ({
13
+ name,
14
+ value,
15
+ defaultValue,
16
+ disabled,
17
+ layout,
18
+ required,
19
+ 'aria-describedby': ariaDescribedBy
20
+ }), [name, value, defaultValue, disabled, layout, required, ariaDescribedBy]);
21
+ return {
22
+ radioGroup
23
+ };
24
+ };
25
+ //# sourceMappingURL=useRadioGroupContextValues.js.map
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,4 @@
1
+ export { RadioGroup, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable } from './RadioGroup';
2
+ export { Radio, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';
3
+ export { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable, useRadioGroupContextValue_unstable } from './contexts/index';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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","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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-radio",
3
- "version": "0.0.0-nightly-20230502-0418.1",
3
+ "version": "0.0.0-nightly-20230503-0419.1",
4
4
  "description": "Fluent UI Radio component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -27,19 +27,19 @@
27
27
  "devDependencies": {
28
28
  "@fluentui/eslint-plugin": "*",
29
29
  "@fluentui/react-conformance": "*",
30
- "@fluentui/react-conformance-griffel": "0.0.0-nightly-20230502-0418.1",
30
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20230503-0419.1",
31
31
  "@fluentui/scripts-api-extractor": "*",
32
32
  "@fluentui/scripts-tasks": "*"
33
33
  },
34
34
  "dependencies": {
35
- "@fluentui/react-field": "0.0.0-nightly-20230502-0418.1",
35
+ "@fluentui/react-field": "0.0.0-nightly-20230503-0419.1",
36
36
  "@fluentui/react-icons": "^2.0.196",
37
- "@fluentui/react-jsx-runtime": "0.0.0-nightly-20230502-0418.1",
38
- "@fluentui/react-label": "0.0.0-nightly-20230502-0418.1",
39
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20230502-0418.1",
40
- "@fluentui/react-tabster": "0.0.0-nightly-20230502-0418.1",
41
- "@fluentui/react-theme": "0.0.0-nightly-20230502-0418.1",
42
- "@fluentui/react-utilities": "0.0.0-nightly-20230502-0418.1",
37
+ "@fluentui/react-jsx-runtime": "0.0.0-nightly-20230503-0419.1",
38
+ "@fluentui/react-label": "0.0.0-nightly-20230503-0419.1",
39
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20230503-0419.1",
40
+ "@fluentui/react-tabster": "0.0.0-nightly-20230503-0419.1",
41
+ "@fluentui/react-theme": "0.0.0-nightly-20230503-0419.1",
42
+ "@fluentui/react-utilities": "0.0.0-nightly-20230503-0419.1",
43
43
  "@griffel/react": "^1.5.2",
44
44
  "@swc/helpers": "^0.4.14"
45
45
  },