@fluentui/react-radio 0.0.0-nightly-20230529-0417.1 → 0.0.0-nightly-20230530-0415.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.
- package/CHANGELOG.json +19 -19
- package/CHANGELOG.md +12 -12
- package/lib/Radio.js +1 -0
- package/lib/Radio.js.map +1 -1
- package/lib/RadioGroup.js +1 -0
- package/lib/RadioGroup.js.map +1 -1
- package/lib/components/Radio/Radio.js +6 -6
- package/lib/components/Radio/Radio.js.map +1 -1
- package/lib/components/Radio/Radio.types.js +1 -0
- package/lib/components/Radio/Radio.types.js.map +1 -1
- package/lib/components/Radio/index.js +1 -0
- package/lib/components/Radio/index.js.map +1 -1
- package/lib/components/Radio/renderRadio.js +5 -8
- package/lib/components/Radio/renderRadio.js.map +1 -1
- package/lib/components/Radio/useRadio.js +65 -70
- package/lib/components/Radio/useRadio.js.map +1 -1
- package/lib/components/Radio/useRadioStyles.styles.js.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.js +7 -7
- package/lib/components/RadioGroup/RadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.types.js +1 -0
- package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -1
- package/lib/components/RadioGroup/index.js +1 -0
- package/lib/components/RadioGroup/index.js.map +1 -1
- package/lib/components/RadioGroup/renderRadioGroup.js +7 -10
- package/lib/components/RadioGroup/renderRadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/useRadioGroup.js +33 -38
- package/lib/components/RadioGroup/useRadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/useRadioGroupStyles.styles.js.map +1 -1
- package/lib/contexts/RadioGroupContext.js +4 -6
- package/lib/contexts/RadioGroupContext.js.map +1 -1
- package/lib/contexts/index.js +1 -0
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/useRadioGroupContextValues.js +24 -22
- package/lib/contexts/useRadioGroupContextValues.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Radio.js.map +1 -1
- package/lib-commonjs/RadioGroup.js.map +1 -1
- package/lib-commonjs/components/Radio/Radio.js.map +1 -1
- package/lib-commonjs/components/Radio/Radio.types.js.map +1 -1
- package/lib-commonjs/components/Radio/index.js.map +1 -1
- package/lib-commonjs/components/Radio/renderRadio.js.map +1 -1
- package/lib-commonjs/components/Radio/useRadio.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/RadioGroup.types.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/index.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/renderRadioGroup.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/useRadioGroup.js.map +1 -1
- package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/useRadioGroupContextValues.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- 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": "
|
6
|
-
"tag": "@fluentui/react-radio_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Tue, 30 May 2023 04:21:01 GMT",
|
6
|
+
"tag": "@fluentui/react-radio_v0.0.0-nightly-20230530-0415.1",
|
7
|
+
"version": "0.0.0-nightly-20230530-0415.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-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/react-field to v0.0.0-nightly-20230530-0415.1",
|
20
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
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-
|
26
|
-
"commit": "
|
25
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230530-0415.1",
|
26
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
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-
|
32
|
-
"commit": "
|
31
|
+
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230530-0415.1",
|
32
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
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-
|
38
|
-
"commit": "
|
37
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230530-0415.1",
|
38
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
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-
|
44
|
-
"commit": "
|
43
|
+
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230530-0415.1",
|
44
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
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-
|
50
|
-
"commit": "
|
49
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230530-0415.1",
|
50
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
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-
|
56
|
-
"commit": "
|
55
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230530-0415.1",
|
56
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
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-
|
62
|
-
"commit": "
|
61
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230530-0415.1",
|
62
|
+
"commit": "808fbe4052231d4cccf478348a770df18232f4f9"
|
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
|
3
|
+
This log was last generated on Tue, 30 May 2023 04:21:01 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230530-0415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v0.0.0-nightly-20230530-0415.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.1.16..@fluentui/react-radio_v0.0.0-nightly-
|
9
|
+
Tue, 30 May 2023 04:21:01 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.1.16..@fluentui/react-radio_v0.0.0-nightly-20230530-0415.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-
|
16
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-label to v0.0.0-nightly-
|
18
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
19
|
-
- Bump @fluentui/react-tabster to v0.0.0-nightly-
|
20
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
21
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
22
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/react-field to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
17
|
+
- Bump @fluentui/react-label to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
18
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
19
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
20
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
21
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
22
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230530-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/808fbe4052231d4cccf478348a770df18232f4f9) by beachball)
|
23
23
|
|
24
24
|
## [9.1.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.1.16)
|
25
25
|
|
package/lib/Radio.js
CHANGED
package/lib/Radio.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/Radio.ts"],"sourcesContent":["export * from './components/Radio/index';\n"],"names":[],"mappings":"AAAA,cAAc,2BAA2B"}
|
package/lib/RadioGroup.js
CHANGED
package/lib/RadioGroup.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/RadioGroup.ts"],"sourcesContent":["export * from './components/RadioGroup/index';\n"],"names":[],"mappings":"AAAA,cAAc,gCAAgC"}
|
@@ -5,12 +5,12 @@ import { useRadioStyles_unstable } from './useRadioStyles.styles';
|
|
5
5
|
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
6
6
|
/**
|
7
7
|
* Radio component is a wrapper for a radio button with a label.
|
8
|
-
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
return renderRadio_unstable(state);
|
8
|
+
*/ export const Radio = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
9
|
+
const state = useRadio_unstable(props, ref);
|
10
|
+
useRadioStyles_unstable(state);
|
11
|
+
useCustomStyleHook_unstable('useRadioStyles_unstable')(state);
|
12
|
+
return renderRadio_unstable(state);
|
14
13
|
});
|
15
14
|
Radio.displayName = 'Radio';
|
15
|
+
|
16
16
|
//# sourceMappingURL=Radio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["React","renderRadio_unstable","useRadio_unstable","useRadioStyles_unstable","useCustomStyleHook_unstable","Radio","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,sBAAyCL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACrF,MAAMC,QAAQP,kBAAkBK,OAAOC;IAEvCL,wBAAwBM;IAExBL,4BAA4B,2BAA2BK;IAEvD,OAAOR,qBAAqBQ;AAC9B,GAAG;AAEHJ,MAAMK,WAAW,GAAG"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":[],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,aAAa;AAC3B,cAAc,0BAA0B"}
|
@@ -1,13 +1,10 @@
|
|
1
|
-
/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
|
1
|
+
/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
|
2
2
|
import { getSlotsNext } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* Render the final JSX of Radio
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
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));
|
5
|
+
*/ export const renderRadio_unstable = (state)=>{
|
6
|
+
const { slots , slotProps } = getSlotsNext(state);
|
7
|
+
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
8
|
};
|
9
|
+
|
13
10
|
//# sourceMappingURL=renderRadio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["createElement","getSlotsNext","renderRadio_unstable","state","slots","slotProps","root","input","indicator","label"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,QAAsB;IACzD,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAAyBE;IAEtD,qBACE,AAdJ,cAcKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,gBAC5B,AAfN,cAeOF,MAAMG,KAAK,EAAKF,UAAUE,KAAK,iBAChC,AAhBN,cAgBOH,MAAMI,SAAS,EAAKH,UAAUG,SAAS,GACvCJ,MAAMK,KAAK,kBAAI,AAjBtB,cAiBuBL,MAAMK,KAAK,EAAKJ,UAAUI,KAAK;AAGtD,EAAE"}
|
@@ -12,76 +12,71 @@ import { useFocusWithin } from '@fluentui/react-tabster';
|
|
12
12
|
*
|
13
13
|
* @param props - props from this instance of Radio
|
14
14
|
* @param ref - reference to `<input>` element of Radio
|
15
|
-
*/
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
15
|
+
*/ export const useRadio_unstable = (props, ref)=>{
|
16
|
+
const group = useRadioGroupContextValue_unstable();
|
17
|
+
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;
|
18
|
+
const nativeProps = getPartitionedNativeProps({
|
19
|
+
props,
|
20
|
+
primarySlotTagName: 'input',
|
21
|
+
excludedPropNames: [
|
22
|
+
'checked',
|
23
|
+
'defaultChecked',
|
24
|
+
'onChange'
|
25
|
+
]
|
58
26
|
});
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
}
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
27
|
+
const root = resolveShorthand(props.root, {
|
28
|
+
required: true,
|
29
|
+
defaultProps: {
|
30
|
+
ref: useFocusWithin(),
|
31
|
+
...nativeProps.root
|
32
|
+
}
|
33
|
+
});
|
34
|
+
const input = resolveShorthand(props.input, {
|
35
|
+
required: true,
|
36
|
+
defaultProps: {
|
37
|
+
ref,
|
38
|
+
type: 'radio',
|
39
|
+
id: useId('radio-', nativeProps.primary.id),
|
40
|
+
name,
|
41
|
+
checked,
|
42
|
+
defaultChecked,
|
43
|
+
disabled,
|
44
|
+
required,
|
45
|
+
'aria-describedby': ariaDescribedBy,
|
46
|
+
...nativeProps.primary
|
47
|
+
}
|
48
|
+
});
|
49
|
+
input.onChange = mergeCallbacks(input.onChange, (ev)=>{
|
50
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
|
51
|
+
value: ev.currentTarget.value
|
52
|
+
});
|
53
|
+
});
|
54
|
+
const label = resolveShorthand(props.label, {
|
55
|
+
defaultProps: {
|
56
|
+
htmlFor: input.id,
|
57
|
+
disabled: input.disabled
|
58
|
+
}
|
59
|
+
});
|
60
|
+
const indicator = resolveShorthand(props.indicator, {
|
61
|
+
required: true,
|
62
|
+
defaultProps: {
|
63
|
+
'aria-hidden': true,
|
64
|
+
children: /*#__PURE__*/ React.createElement(CircleFilled, null)
|
65
|
+
}
|
66
|
+
});
|
67
|
+
return {
|
68
|
+
labelPosition,
|
69
|
+
components: {
|
70
|
+
root: 'span',
|
71
|
+
input: 'input',
|
72
|
+
label: Label,
|
73
|
+
indicator: 'div'
|
74
|
+
},
|
75
|
+
root,
|
76
|
+
input,
|
77
|
+
label,
|
78
|
+
indicator
|
79
|
+
};
|
86
80
|
};
|
81
|
+
|
87
82
|
//# sourceMappingURL=useRadio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"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","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,yBAAyB,EAAEC,cAAc,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ,4BAA4B;AAC/G,SAASC,kCAAkC,QAAQ,mCAAmC;AACtF,SAASC,cAAc,QAAQ,0BAA0B;AAGzD;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC,MAAiD;IACpG,MAAMC,QAAQL;IAEd,MAAM,EACJM,MAAOD,MAAMC,IAAI,CAAA,EACjBC,SAAUF,MAAMG,KAAK,KAAKC,YAAYJ,MAAMG,KAAK,KAAKL,MAAMK,KAAK,GAAGC,SAAS,CAAA,EAC7EC,gBAAiBL,MAAMM,YAAY,KAAKF,YAAYJ,MAAMM,YAAY,KAAKR,MAAMK,KAAK,GAAGC,SAAS,CAAA,EAClGG,eAAgBP,MAAMQ,MAAM,KAAK,uBAAuB,UAAU,OAAO,CAAA,EACzEC,UAAWT,MAAMS,QAAQ,CAAA,EACzBC,UAAWV,MAAMU,QAAQ,CAAA,EACzB,oBAAoBC,kBAAkBX,KAAK,CAAC,mBAAmB,CAAA,EAC/DY,SAAQ,EACT,GAAGd;IAEJ,MAAMe,cAActB,0BAA0B;QAC5CO;QACAgB,oBAAoB;QACpBC,mBAAmB;YAAC;YAAW;YAAkB;SAAW;IAC9D;IAEA,MAAMC,OAAOvB,iBAAiBK,MAAMkB,IAAI,EAAE;QACxCN,UAAU,IAAI;QACdO,cAAc;YACZlB,KAAKH;YACL,GAAGiB,YAAYG,IAAI;QACrB;IACF;IAEA,MAAME,QAAQzB,iBAAiBK,MAAMoB,KAAK,EAAE;QAC1CR,UAAU,IAAI;QACdO,cAAc;YACZlB;YACAoB,MAAM;YACNC,IAAI1B,MAAM,UAAUmB,YAAYQ,OAAO,CAACD,EAAE;YAC1CnB;YACAC;YACAG;YACAI;YACAC;YACA,oBAAoBC;YACpB,GAAGE,YAAYQ,OAAO;QACxB;IACF;IAEAH,MAAMN,QAAQ,GAAGpB,eAAe0B,MAAMN,QAAQ,EAAEU,CAAAA;QAAMV,OAAAA,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAWU,IAAI;YAAEnB,OAAOmB,GAAGC,aAAa,CAACpB,KAAK;QAAC;;IAErG,MAAMqB,QAAQ/B,iBAAiBK,MAAM0B,KAAK,EAAE;QAC1CP,cAAc;YACZQ,SAASP,MAAME,EAAE;YACjBX,UAAUS,MAAMT,QAAQ;QAC1B;IACF;IAEA,MAAMiB,YAAYjC,iBAAiBK,MAAM4B,SAAS,EAAE;QAClDhB,UAAU,IAAI;QACdO,cAAc;YACZ,eAAe,IAAI;YACnBU,wBAAU,oBAACtC;QACb;IACF;IAEA,OAAO;QACLkB;QACAqB,YAAY;YACVZ,MAAM;YACNE,OAAO;YACPM,OAAOlC;YACPoC,WAAW;QACb;QACAV;QACAE;QACAM;QACAE;IACF;AACF,EAAE"}
|
@@ -1 +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
|
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,+tEAI7B;AAEA,MAAMW,aAAA,gBAAgBV,QAAA;EAAAW,QAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAKtB;AAEA,MAAMC,qBAAA,gBAAwBhB,aAAA,26GAsF9B;AAEA,MAAMiB,cAAA,gBAAiBhB,QAAA;EAAAiB,KAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAL,CAAA;AAAA,CAKvB;AAEA,MAAMM,yBAAA,gBAA4BrB,aAAA,2lBAiBlC;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,CAmBvB;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"}
|
@@ -6,13 +6,13 @@ import { useRadioGroupContextValues } from '../../contexts/useRadioGroupContextV
|
|
6
6
|
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
7
7
|
/**
|
8
8
|
* A RadioGroup component presents a set of options where only one option can be selected.
|
9
|
-
*/
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
return renderRadioGroup_unstable(state, contextValues);
|
9
|
+
*/ export const RadioGroup = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
10
|
+
const state = useRadioGroup_unstable(props, ref);
|
11
|
+
const contextValues = useRadioGroupContextValues(state);
|
12
|
+
useRadioGroupStyles_unstable(state);
|
13
|
+
useCustomStyleHook_unstable('useRadioGroupStyles_unstable')(state);
|
14
|
+
return renderRadioGroup_unstable(state, contextValues);
|
16
15
|
});
|
17
16
|
RadioGroup.displayName = 'RadioGroup';
|
17
|
+
|
18
18
|
//# sourceMappingURL=RadioGroup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["React","renderRadioGroup_unstable","useRadioGroup_unstable","useRadioGroupStyles_unstable","useRadioGroupContextValues","useCustomStyleHook_unstable","RadioGroup","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,4BAA4B,QAAQ,+BAA+B;AAC5E,SAASC,0BAA0B,QAAQ,4CAA4C;AACvF,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,2BAAmDN,MAAMO,UAAU,CAAC,CAACC,OAAOC,MAAQ;IAC/F,MAAMC,QAAQR,uBAAuBM,OAAOC;IAC5C,MAAME,gBAAgBP,2BAA2BM;IAEjDP,6BAA6BO;IAE7BL,4BAA4B,gCAAgCK;IAE5D,OAAOT,0BAA0BS,OAAOC;AAC1C,GAAG;AAEHL,WAAWM,WAAW,GAAG"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":[],"mappings":"AAAA,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,+BAA+B"}
|
@@ -1,16 +1,13 @@
|
|
1
|
-
/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
|
1
|
+
/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
|
2
2
|
import { getSlotsNext } from '@fluentui/react-utilities';
|
3
3
|
import { RadioGroupContext } from '../../contexts/RadioGroupContext';
|
4
4
|
/**
|
5
5
|
* Render the final JSX of RadioGroup
|
6
|
-
*/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
slotProps
|
11
|
-
} = getSlotsNext(state);
|
12
|
-
return /*#__PURE__*/createElement(RadioGroupContext.Provider, {
|
13
|
-
value: contextValues.radioGroup
|
14
|
-
}, /*#__PURE__*/createElement(slots.root, slotProps.root));
|
6
|
+
*/ export const renderRadioGroup_unstable = (state, contextValues)=>{
|
7
|
+
const { slots , slotProps } = getSlotsNext(state);
|
8
|
+
return /*#__PURE__*/ createElement(RadioGroupContext.Provider, {
|
9
|
+
value: contextValues.radioGroup
|
10
|
+
}, /*#__PURE__*/ createElement(slots.root, slotProps.root));
|
15
11
|
};
|
12
|
+
|
16
13
|
//# sourceMappingURL=renderRadioGroup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["createElement","getSlotsNext","RadioGroupContext","renderRadioGroup_unstable","state","contextValues","slots","slotProps","Provider","value","radioGroup","root"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,iBAAiB,QAAQ,mCAAmC;AAGrE;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC,OAAwBC,gBAA2C;IAC3G,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGN,aAA8BG;IAE3D,qBACE,AAfJ,cAeKF,kBAAkBM,QAAQ;QAACC,OAAOJ,cAAcK,UAAU;qBACzD,AAhBN,cAgBOJ,MAAMK,IAAI,EAAKJ,UAAUI,IAAI;AAGpC,EAAE"}
|
@@ -9,44 +9,39 @@ import { getNativeElementProps, isHTMLElement, useEventCallback, useId } from '@
|
|
9
9
|
*
|
10
10
|
* @param props - props from this instance of RadioGroup
|
11
11
|
* @param ref - reference to root HTMLElement of RadioGroup
|
12
|
-
*/
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}) && ev.target.type === 'radio') {
|
44
|
-
onChange(ev, {
|
45
|
-
value: ev.target.value
|
46
|
-
});
|
12
|
+
*/ export const useRadioGroup_unstable = (props, ref)=>{
|
13
|
+
// Merge props from surrounding <Field>, if any
|
14
|
+
props = useFieldControlProps_unstable(props);
|
15
|
+
const generatedName = useId('radiogroup-');
|
16
|
+
const { name =generatedName , value , defaultValue , disabled , layout ='vertical' , onChange , required } = props;
|
17
|
+
return {
|
18
|
+
layout,
|
19
|
+
name,
|
20
|
+
value,
|
21
|
+
defaultValue,
|
22
|
+
disabled,
|
23
|
+
required,
|
24
|
+
components: {
|
25
|
+
root: 'div'
|
26
|
+
},
|
27
|
+
root: {
|
28
|
+
ref,
|
29
|
+
role: 'radiogroup',
|
30
|
+
...getNativeElementProps('div', props, /*excludedPropNames:*/ [
|
31
|
+
'onChange',
|
32
|
+
'name'
|
33
|
+
]),
|
34
|
+
onChange: useEventCallback((ev)=>{
|
35
|
+
if (onChange && isHTMLElement(ev.target, {
|
36
|
+
constructorName: 'HTMLInputElement'
|
37
|
+
}) && ev.target.type === 'radio') {
|
38
|
+
onChange(ev, {
|
39
|
+
value: ev.target.value
|
40
|
+
});
|
41
|
+
}
|
42
|
+
})
|
47
43
|
}
|
48
|
-
|
49
|
-
}
|
50
|
-
};
|
44
|
+
};
|
51
45
|
};
|
46
|
+
|
52
47
|
//# sourceMappingURL=useRadioGroup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"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"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ,4BAA4B;AAG1G;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC,MAAoD;IACjH,+CAA+C;IAC/CD,QAAQN,8BAA8BM;IAEtC,MAAME,gBAAgBJ,MAAM;IAE5B,MAAM,EAAEK,MAAOD,cAAa,EAAEE,MAAK,EAAEC,aAAY,EAAEC,SAAQ,EAAEC,QAAS,WAAU,EAAEC,SAAQ,EAAEC,SAAQ,EAAE,GAAGT;IAEzG,OAAO;QACLO;QACAJ;QACAC;QACAC;QACAC;QACAG;QACAC,YAAY;YACVC,MAAM;QACR;QACAA,MAAM;YACJV;YACAW,MAAM;YACN,GAAGjB,sBAAsB,OAAOK,OAAO,oBAAoB,GAAG;gBAAC;gBAAY;aAAO,CAAC;YACnFQ,UAAUX,iBAAiBgB,CAAAA,KAAM;gBAC/B,IACEL,YACAZ,cAAciB,GAAGC,MAAM,EAAE;oBAAEC,iBAAiB;gBAAmB,MAC/DF,GAAGC,MAAM,CAACE,IAAI,KAAK,SACnB;oBACAR,SAASK,IAAI;wBAAET,OAAOS,GAAGC,MAAM,CAACV,KAAK;oBAAC;gBACxC,CAAC;YACH;QACF;IACF;AACF,EAAE"}
|
@@ -1 +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,
|
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,CASlB;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"}
|
@@ -1,17 +1,15 @@
|
|
1
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
|
-
*/
|
5
|
-
export const RadioGroupContext = /*#__PURE__*/React.createContext(undefined);
|
4
|
+
*/ export const RadioGroupContext = React.createContext(undefined);
|
6
5
|
const radioGroupContextDefaultValue = {};
|
7
6
|
export const RadioGroupProvider = RadioGroupContext.Provider;
|
8
7
|
/**
|
9
8
|
* Get the value of the RadioGroupContext.
|
10
|
-
*/
|
11
|
-
export const useRadioGroupContextValue_unstable = () => React.useContext(RadioGroupContext) || radioGroupContextDefaultValue;
|
9
|
+
*/ export const useRadioGroupContextValue_unstable = ()=>React.useContext(RadioGroupContext) || radioGroupContextDefaultValue;
|
12
10
|
/**
|
13
11
|
* @deprecated Use useRadioGroupContextValue_unstable instead.
|
14
12
|
* RadioGroupContext is no longer a selector context, and no longer benefits from having a selector.
|
15
|
-
*/
|
16
|
-
|
13
|
+
*/ export const useRadioGroupContext_unstable = (selector)=>selector(useRadioGroupContextValue_unstable());
|
14
|
+
|
17
15
|
//# sourceMappingURL=RadioGroupContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["React","RadioGroupContext","createContext","undefined","radioGroupContextDefaultValue","RadioGroupProvider","Provider","useRadioGroupContextValue_unstable","useContext","useRadioGroupContext_unstable","selector"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;CAEC,GACD,OAAO,MAAMC,oBAAoBD,MAAME,aAAa,CAAqCC,WAAW;AAEpG,MAAMC,gCAAwD,CAAC;AAE/D,OAAO,MAAMC,qBAAqBJ,kBAAkBK,QAAQ,CAAC;AAE7D;;CAEC,GACD,OAAO,MAAMC,qCAAqC,IAChDP,MAAMQ,UAAU,CAACP,sBAAsBG,8BAA8B;AAEvE;;;CAGC,GACD,OAAO,MAAMK,gCAAgC,CAAIC,WAC/CA,SAASH,sCAAsC"}
|
package/lib/contexts/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/contexts/index.ts"],"sourcesContent":["export * from './RadioGroupContext';\nexport * from './useRadioGroupContextValues';\n"],"names":[],"mappings":"AAAA,cAAc,sBAAsB;AACpC,cAAc,+BAA+B"}
|
@@ -1,25 +1,27 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
export const useRadioGroupContextValues = state
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
2
|
+
export const useRadioGroupContextValues = (state)=>{
|
3
|
+
const { name , value , defaultValue , disabled , layout , required } = state;
|
4
|
+
const ariaDescribedBy = state.root['aria-describedby'];
|
5
|
+
const radioGroup = React.useMemo(()=>({
|
6
|
+
name,
|
7
|
+
value,
|
8
|
+
defaultValue,
|
9
|
+
disabled,
|
10
|
+
layout,
|
11
|
+
required,
|
12
|
+
'aria-describedby': ariaDescribedBy
|
13
|
+
}), [
|
14
|
+
name,
|
15
|
+
value,
|
16
|
+
defaultValue,
|
17
|
+
disabled,
|
18
|
+
layout,
|
19
|
+
required,
|
20
|
+
ariaDescribedBy
|
21
|
+
]);
|
22
|
+
return {
|
23
|
+
radioGroup
|
24
|
+
};
|
24
25
|
};
|
26
|
+
|
25
27
|
//# sourceMappingURL=useRadioGroupContextValues.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["React","useRadioGroupContextValues","state","name","value","defaultValue","disabled","layout","required","ariaDescribedBy","root","radioGroup","useMemo"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B,OAAO,MAAMC,6BAA6B,CAACC,QAAoD;IAC7F,MAAM,EAAEC,KAAI,EAAEC,MAAK,EAAEC,aAAY,EAAEC,SAAQ,EAAEC,OAAM,EAAEC,SAAQ,EAAE,GAAGN;IAClE,MAAMO,kBAAkBP,MAAMQ,IAAI,CAAC,mBAAmB;IAEtD,MAAMC,aAAaX,MAAMY,OAAO,CAC9B,IAAO,CAAA;YACLT;YACAC;YACAC;YACAC;YACAC;YACAC;YACA,oBAAoBC;QACtB,CAAA,GACA;QAACN;QAAMC;QAAOC;QAAcC;QAAUC;QAAQC;QAAUC;KAAgB;IAG1E,OAAO;QAAEE;IAAW;AACtB,EAAE"}
|
package/lib/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
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
3
|
export { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable, useRadioGroupContextValue_unstable } from './contexts/index';
|
4
|
+
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"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"],"names":["RadioGroup","radioGroupClassNames","renderRadioGroup_unstable","useRadioGroupStyles_unstable","useRadioGroup_unstable","Radio","radioClassNames","renderRadio_unstable","useRadioStyles_unstable","useRadio_unstable","RadioGroupProvider","useRadioGroupContextValues","useRadioGroupContext_unstable","useRadioGroupContextValue_unstable"],"mappings":"AAAA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,eAAe;AAStB,SAASC,KAAK,EAAEC,eAAe,EAAEC,oBAAoB,EAAEC,uBAAuB,EAAEC,iBAAiB,QAAQ,UAAU;AAEnH,SACEC,kBAAkB,EAClBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,kCAAkC,QAC7B,mBAAmB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../lib/Radio.js"],"sourcesContent":["export * from './components/Radio/index';\n//# sourceMappingURL=Radio.js.map"],"names":[],"mappings":";;;;;oBAAc;
|
1
|
+
{"version":3,"sources":["../lib/Radio.js"],"sourcesContent":["export * from './components/Radio/index';\n\n//# sourceMappingURL=Radio.js.map"],"names":[],"mappings":";;;;;oBAAc;CAEd,iCAAiC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../lib/RadioGroup.js"],"sourcesContent":["export * from './components/RadioGroup/index';\n//# sourceMappingURL=RadioGroup.js.map"],"names":[],"mappings":";;;;;oBAAc;
|
1
|
+
{"version":3,"sources":["../lib/RadioGroup.js"],"sourcesContent":["export * from './components/RadioGroup/index';\n\n//# sourceMappingURL=RadioGroup.js.map"],"names":[],"mappings":";;;;;oBAAc;CAEd,sCAAsC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Radio/Radio.js"],"sourcesContent":["import * as React from 'react';\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 * Radio component is a wrapper for a radio button with a label.\n
|
1
|
+
{"version":3,"sources":["../../../lib/components/Radio/Radio.js"],"sourcesContent":["import * as React from 'react';\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 * Radio component is a wrapper for a radio button with a label.\n */ export const Radio = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useRadio_unstable(props, ref);\n useRadioStyles_unstable(state);\n useCustomStyleHook_unstable('useRadioStyles_unstable')(state);\n return renderRadio_unstable(state);\n});\nRadio.displayName = 'Radio';\n\n//# sourceMappingURL=Radio.js.map"],"names":["Radio","React","forwardRef","props","ref","state","useRadio_unstable","useRadioStyles_unstable","useCustomStyleHook_unstable","renderRadio_unstable","displayName"],"mappings":";;;;+BAOiBA;;aAAAA;;;6DAPM;6BACc;0BACH;sCACM;qCACI;AAGjC,MAAMA,QAAQ,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAM;IAClE,MAAMC,QAAQC,IAAAA,2BAAiB,EAACH,OAAOC;IACvCG,IAAAA,6CAAuB,EAACF;IACxBG,IAAAA,gDAA2B,EAAC,2BAA2BH;IACvD,OAAOI,IAAAA,iCAAoB,EAACJ;AAChC;AACAL,MAAMU,WAAW,GAAG,SAEpB,iCAAiC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Radio/Radio.types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=Radio.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;
|
1
|
+
{"version":3,"sources":["../../../lib/components/Radio/Radio.types.js"],"sourcesContent":["import * as React from 'react';\n\n//# sourceMappingURL=Radio.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CAEvB,uCAAuC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Radio/index.js"],"sourcesContent":["export * from './Radio';\nexport * from './Radio.types';\nexport * from './renderRadio';\nexport * from './useRadio';\nexport * from './useRadioStyles.styles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;
|
1
|
+
{"version":3,"sources":["../../../lib/components/Radio/index.js"],"sourcesContent":["export * from './Radio';\nexport * from './Radio.types';\nexport * from './renderRadio';\nexport * from './useRadio';\nexport * from './useRadioStyles.styles';\n\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CAEd,iCAAiC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/Radio/renderRadio.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Radio\n
|
1
|
+
{"version":3,"sources":["../../../lib/components/Radio/renderRadio.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Radio\n */ export const renderRadio_unstable = (state)=>{\n const { slots , slotProps } = getSlotsNext(state);\n 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));\n};\n\n//# sourceMappingURL=renderRadio.js.map"],"names":["renderRadio_unstable","state","slots","slotProps","getSlotsNext","createElement","root","input","indicator","label"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAIjCA;;aAAAA;;iCAJkE;gCACtD;AAGlB,MAAMA,uBAAuB,CAACC,QAAQ;IAC7C,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACH;IAC5C,OAAO,WAAW,GAAGI,IAAAA,8BAAa,EAACH,MAAMI,IAAI,EAAEH,UAAUG,IAAI,EAAE,WAAW,GAAGD,IAAAA,8BAAa,EAACH,MAAMK,KAAK,EAAEJ,UAAUI,KAAK,GAAG,WAAW,GAAGF,IAAAA,8BAAa,EAACH,MAAMM,SAAS,EAAEL,UAAUK,SAAS,GAAGN,MAAMO,KAAK,IAAI,WAAW,GAAGJ,IAAAA,8BAAa,EAACH,MAAMO,KAAK,EAAEN,UAAUM,KAAK;AACxQ,GAEA,uCAAuC"}
|
@@ -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 { 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
|
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 */ export const useRadio_unstable = (props, ref)=>{\n const group = useRadioGroupContextValue_unstable();\n 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;\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: [\n 'checked',\n 'defaultChecked',\n 'onChange'\n ]\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\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":";;;;+BAciBA;;aAAAA;;;6DAdM;4BACM;4BACP;gCAC6D;mCAChC;8BACpB;AASpB,MAAMA,oBAAoB,CAACC,OAAOC,MAAM;IAC/C,MAAMC,QAAQC,IAAAA,qDAAkC;IAChD,MAAM,EAAEC,MAAMF,MAAME,IAAI,CAAA,EAAGC,SAASH,MAAMI,KAAK,KAAKC,YAAYL,MAAMI,KAAK,KAAKN,MAAMM,KAAK,GAAGC,SAAS,CAAA,EAAGC,gBAAgBN,MAAMO,YAAY,KAAKF,YAAYL,MAAMO,YAAY,KAAKT,MAAMM,KAAK,GAAGC,SAAS,CAAA,EAAGG,eAAeR,MAAMS,MAAM,KAAK,uBAAuB,UAAU,OAAO,CAAA,EAAGC,UAAUV,MAAMU,QAAQ,CAAA,EAAGC,UAAUX,MAAMW,QAAQ,CAAA,EAAG,oBAAoBC,kBAAkBZ,KAAK,CAAC,mBAAmB,CAAA,EAAGa,SAAQ,EAAG,GAAGf;IAC/Z,MAAMgB,cAAcC,IAAAA,yCAAyB,EAAC;QAC1CjB;QACAkB,oBAAoB;QACpBC,mBAAmB;YACf;YACA;YACA;SACH;IACL;IACA,MAAMC,OAAOC,IAAAA,gCAAgB,EAACrB,MAAMoB,IAAI,EAAE;QACtCP,UAAU,IAAI;QACdS,cAAc;YACVrB,KAAKsB,IAAAA,4BAAc;YACnB,GAAGP,YAAYI,IAAI;QACvB;IACJ;IACA,MAAMI,QAAQH,IAAAA,gCAAgB,EAACrB,MAAMwB,KAAK,EAAE;QACxCX,UAAU,IAAI;QACdS,cAAc;YACVrB;YACAwB,MAAM;YACNC,IAAIC,IAAAA,qBAAK,EAAC,UAAUX,YAAYY,OAAO,CAACF,EAAE;YAC1CtB;YACAC;YACAG;YACAI;YACAC;YACA,oBAAoBC;YACpB,GAAGE,YAAYY,OAAO;QAC1B;IACJ;IACAJ,MAAMT,QAAQ,GAAGc,IAAAA,8BAAc,EAACL,MAAMT,QAAQ,EAAE,CAACe,KAAK;QAClD,OAAOf,aAAa,IAAI,IAAIA,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASe,IAAI;YACpExB,OAAOwB,GAAGC,aAAa,CAACzB,KAAK;QACjC,EAAE;IACN;IACA,MAAM0B,QAAQX,IAAAA,gCAAgB,EAACrB,MAAMgC,KAAK,EAAE;QACxCV,cAAc;YACVW,SAAST,MAAME,EAAE;YACjBd,UAAUY,MAAMZ,QAAQ;QAC5B;IACJ;IACA,MAAMsB,YAAYb,IAAAA,gCAAgB,EAACrB,MAAMkC,SAAS,EAAE;QAChDrB,UAAU,IAAI;QACdS,cAAc;YACV,eAAe,IAAI;YACnBa,UAAU,WAAW,GAAGC,OAAMC,aAAa,CAACC,wBAAY,EAAE,IAAI;QAClE;IACJ;IACA,OAAO;QACH5B;QACA6B,YAAY;YACRnB,MAAM;YACNI,OAAO;YACPQ,OAAOQ,iBAAK;YACZN,WAAW;QACf;QACAd;QACAI;QACAQ;QACAE;IACJ;AACJ,GAEA,oCAAoC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/RadioGroup/RadioGroup.js"],"sourcesContent":["import * as React from 'react';\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 * A RadioGroup component presents a set of options where only one option can be selected.\n
|
1
|
+
{"version":3,"sources":["../../../lib/components/RadioGroup/RadioGroup.js"],"sourcesContent":["import * as React from 'react';\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 * A RadioGroup component presents a set of options where only one option can be selected.\n */ export const RadioGroup = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useRadioGroup_unstable(props, ref);\n const contextValues = useRadioGroupContextValues(state);\n useRadioGroupStyles_unstable(state);\n useCustomStyleHook_unstable('useRadioGroupStyles_unstable')(state);\n return renderRadioGroup_unstable(state, contextValues);\n});\nRadioGroup.displayName = 'RadioGroup';\n\n//# sourceMappingURL=RadioGroup.js.map"],"names":["RadioGroup","React","forwardRef","props","ref","state","useRadioGroup_unstable","contextValues","useRadioGroupContextValues","useRadioGroupStyles_unstable","useCustomStyleHook_unstable","renderRadioGroup_unstable","displayName"],"mappings":";;;;+BAQiBA;;aAAAA;;;6DARM;kCACmB;+BACH;2CACM;4CACF;qCACC;AAGjC,MAAMA,aAAa,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAM;IACvE,MAAMC,QAAQC,IAAAA,qCAAsB,EAACH,OAAOC;IAC5C,MAAMG,gBAAgBC,IAAAA,sDAA0B,EAACH;IACjDI,IAAAA,uDAA4B,EAACJ;IAC7BK,IAAAA,gDAA2B,EAAC,gCAAgCL;IAC5D,OAAOM,IAAAA,2CAAyB,EAACN,OAAOE;AAC5C;AACAP,WAAWY,WAAW,GAAG,cAEzB,sCAAsC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/RadioGroup/RadioGroup.types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=RadioGroup.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;
|
1
|
+
{"version":3,"sources":["../../../lib/components/RadioGroup/RadioGroup.types.js"],"sourcesContent":["import * as React from 'react';\n\n//# sourceMappingURL=RadioGroup.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CAEvB,4CAA4C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/RadioGroup/index.js"],"sourcesContent":["export * from './RadioGroup';\nexport * from './RadioGroup.types';\nexport * from './renderRadioGroup';\nexport * from './useRadioGroup';\nexport * from './useRadioGroupStyles.styles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;
|
1
|
+
{"version":3,"sources":["../../../lib/components/RadioGroup/index.js"],"sourcesContent":["export * from './RadioGroup';\nexport * from './RadioGroup.types';\nexport * from './renderRadioGroup';\nexport * from './useRadioGroup';\nexport * from './useRadioGroupStyles.styles';\n\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CAEd,iCAAiC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/RadioGroup/renderRadioGroup.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\n/**\n * Render the final JSX of RadioGroup\n
|
1
|
+
{"version":3,"sources":["../../../lib/components/RadioGroup/renderRadioGroup.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\n/**\n * Render the final JSX of RadioGroup\n */ export const renderRadioGroup_unstable = (state, contextValues)=>{\n const { slots , slotProps } = getSlotsNext(state);\n return /*#__PURE__*/ createElement(RadioGroupContext.Provider, {\n value: contextValues.radioGroup\n }, /*#__PURE__*/ createElement(slots.root, slotProps.root));\n};\n\n//# sourceMappingURL=renderRadioGroup.js.map"],"names":["renderRadioGroup_unstable","state","contextValues","slots","slotProps","getSlotsNext","createElement","RadioGroupContext","Provider","value","radioGroup","root"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAKjCA;;aAAAA;;iCALkE;gCACtD;mCACK;AAGvB,MAAMA,4BAA4B,CAACC,OAAOC,gBAAgB;IACjE,MAAM,EAAEC,MAAK,EAAGC,UAAS,EAAG,GAAGC,IAAAA,4BAAY,EAACJ;IAC5C,OAAO,WAAW,GAAGK,IAAAA,8BAAa,EAACC,oCAAiB,CAACC,QAAQ,EAAE;QAC3DC,OAAOP,cAAcQ,UAAU;IACnC,GAAG,WAAW,GAAGJ,IAAAA,8BAAa,EAACH,MAAMQ,IAAI,EAAEP,UAAUO,IAAI;AAC7D,GAEA,4CAA4C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/RadioGroup/useRadioGroup.js"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { getNativeElementProps, isHTMLElement, useEventCallback, useId } from '@fluentui/react-utilities';\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
|
1
|
+
{"version":3,"sources":["../../../lib/components/RadioGroup/useRadioGroup.js"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { getNativeElementProps, isHTMLElement, useEventCallback, useId } from '@fluentui/react-utilities';\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 */ export const useRadioGroup_unstable = (props, ref)=>{\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props);\n const generatedName = useId('radiogroup-');\n const { name =generatedName , value , defaultValue , disabled , layout ='vertical' , onChange , required } = props;\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:*/ [\n 'onChange',\n 'name'\n ]),\n onChange: useEventCallback((ev)=>{\n if (onChange && isHTMLElement(ev.target, {\n constructorName: 'HTMLInputElement'\n }) && ev.target.type === 'radio') {\n onChange(ev, {\n value: ev.target.value\n });\n }\n })\n }\n };\n};\n\n//# sourceMappingURL=useRadioGroup.js.map"],"names":["useRadioGroup_unstable","props","ref","useFieldControlProps_unstable","generatedName","useId","name","value","defaultValue","disabled","layout","onChange","required","components","root","role","getNativeElementProps","useEventCallback","ev","isHTMLElement","target","constructorName","type"],"mappings":";;;;+BAWiBA;;aAAAA;;;6DAXM;4BACuB;gCACgC;AASnE,MAAMA,yBAAyB,CAACC,OAAOC,MAAM;IACpD,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAA6B,EAACF;IACtC,MAAMG,gBAAgBC,IAAAA,qBAAK,EAAC;IAC5B,MAAM,EAAEC,MAAMF,cAAa,EAAGG,MAAK,EAAGC,aAAY,EAAGC,SAAQ,EAAGC,QAAQ,WAAU,EAAGC,SAAQ,EAAGC,SAAQ,EAAG,GAAGX;IAC9G,OAAO;QACHS;QACAJ;QACAC;QACAC;QACAC;QACAG;QACAC,YAAY;YACRC,MAAM;QACV;QACAA,MAAM;YACFZ;YACAa,MAAM;YACN,GAAGC,IAAAA,qCAAqB,EAAC,OAAOf,OAAO,oBAAoB,GAAG;gBAC1D;gBACA;aACH,CAAC;YACFU,UAAUM,IAAAA,gCAAgB,EAAC,CAACC,KAAK;gBAC7B,IAAIP,YAAYQ,IAAAA,6BAAa,EAACD,GAAGE,MAAM,EAAE;oBACrCC,iBAAiB;gBACrB,MAAMH,GAAGE,MAAM,CAACE,IAAI,KAAK,SAAS;oBAC9BX,SAASO,IAAI;wBACTX,OAAOW,GAAGE,MAAM,CAACb,KAAK;oBAC1B;gBACJ,CAAC;YACL;QACJ;IACJ;AACJ,GAEA,yCAAyC"}
|
@@ -1 +1 @@
|
|
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
|
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 */ export const RadioGroupContext = React.createContext(undefined);\nconst radioGroupContextDefaultValue = {};\nexport const RadioGroupProvider = RadioGroupContext.Provider;\n/**\n * Get the value of the RadioGroupContext.\n */ export 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 */ export const useRadioGroupContext_unstable = (selector)=>selector(useRadioGroupContextValue_unstable());\n\n//# sourceMappingURL=RadioGroupContext.js.map"],"names":["RadioGroupContext","RadioGroupProvider","useRadioGroupContextValue_unstable","useRadioGroupContext_unstable","React","createContext","undefined","radioGroupContextDefaultValue","Provider","useContext","selector"],"mappings":";;;;;;;;;;;IAGiBA,iBAAiB,MAAjBA;IAEJC,kBAAkB,MAAlBA;IAGIC,kCAAkC,MAAlCA;IAIAC,6BAA6B,MAA7BA;;;6DAZM;AAGZ,MAAMH,kCAAoBI,OAAMC,aAAa,CAACC;AACzD,MAAMC,gCAAgC,CAAC;AAChC,MAAMN,qBAAqBD,kBAAkBQ,QAAQ;AAGjD,MAAMN,qCAAqC,IAAIE,OAAMK,UAAU,CAACT,sBAAsBO;AAItF,MAAMJ,gCAAgC,CAACO,WAAWA,SAASR,uCAEtE,6CAA6C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/contexts/index.js"],"sourcesContent":["export * from './RadioGroupContext';\nexport * from './useRadioGroupContextValues';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;
|
1
|
+
{"version":3,"sources":["../../lib/contexts/index.js"],"sourcesContent":["export * from './RadioGroupContext';\nexport * from './useRadioGroupContextValues';\n\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;CAEd,iCAAiC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/contexts/useRadioGroupContextValues.js"],"sourcesContent":["import * as React from 'react';\nexport const useRadioGroupContextValues = state
|
1
|
+
{"version":3,"sources":["../../lib/contexts/useRadioGroupContextValues.js"],"sourcesContent":["import * as React from 'react';\nexport const useRadioGroupContextValues = (state)=>{\n const { name , value , defaultValue , disabled , layout , required } = 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 }), [\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required,\n ariaDescribedBy\n ]);\n return {\n radioGroup\n };\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,6BAA6B,CAACC,QAAQ;IAC/C,MAAM,EAAEC,KAAI,EAAGC,MAAK,EAAGC,aAAY,EAAGC,SAAQ,EAAGC,OAAM,EAAGC,SAAQ,EAAG,GAAGN;IACxE,MAAMO,kBAAkBP,MAAMQ,IAAI,CAAC,mBAAmB;IACtD,MAAMC,aAAaC,OAAMC,OAAO,CAAC,IAAK,CAAA;YAC9BV;YACAC;YACAC;YACAC;YACAC;YACAC;YACA,oBAAoBC;QACxB,CAAA,GAAI;QACJN;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;IACD,OAAO;QACHE;IACJ;AACJ,GAEA,sDAAsD"}
|
@@ -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, 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;
|
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\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;CAElI,iCAAiC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-radio",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230530-0415.1",
|
4
4
|
"description": "Fluent UI Radio component",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -28,19 +28,19 @@
|
|
28
28
|
"devDependencies": {
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
30
|
"@fluentui/react-conformance": "*",
|
31
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230530-0415.1",
|
32
32
|
"@fluentui/scripts-api-extractor": "*",
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/react-field": "0.0.0-nightly-
|
36
|
+
"@fluentui/react-field": "0.0.0-nightly-20230530-0415.1",
|
37
37
|
"@fluentui/react-icons": "^2.0.196",
|
38
|
-
"@fluentui/react-jsx-runtime": "0.0.0-nightly-
|
39
|
-
"@fluentui/react-label": "0.0.0-nightly-
|
40
|
-
"@fluentui/react-shared-contexts": "0.0.0-nightly-
|
41
|
-
"@fluentui/react-tabster": "0.0.0-nightly-
|
42
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
43
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
38
|
+
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20230530-0415.1",
|
39
|
+
"@fluentui/react-label": "0.0.0-nightly-20230530-0415.1",
|
40
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20230530-0415.1",
|
41
|
+
"@fluentui/react-tabster": "0.0.0-nightly-20230530-0415.1",
|
42
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230530-0415.1",
|
43
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230530-0415.1",
|
44
44
|
"@griffel/react": "^1.5.2",
|
45
45
|
"@swc/helpers": "^0.4.14"
|
46
46
|
},
|