@fluentui/react-radio 9.1.3 → 9.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +115 -1
- package/CHANGELOG.md +34 -2
- package/lib/Radio.js.map +1 -1
- package/lib/RadioGroup.js.map +1 -1
- package/lib/RadioGroupField.js.map +1 -1
- package/lib/components/Radio/Radio.js.map +1 -1
- package/lib/components/Radio/Radio.types.js +1 -1
- package/lib/components/Radio/Radio.types.js.map +1 -1
- package/lib/components/Radio/index.js.map +1 -1
- package/lib/components/Radio/renderRadio.js +1 -9
- package/lib/components/Radio/renderRadio.js.map +1 -1
- package/lib/components/Radio/useRadio.js +5 -3
- package/lib/components/Radio/useRadio.js.map +1 -1
- package/lib/components/Radio/useRadioStyles.js.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.types.js +1 -1
- package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -1
- package/lib/components/RadioGroup/index.js.map +1 -1
- package/lib/components/RadioGroup/renderRadioGroup.js +1 -3
- package/lib/components/RadioGroup/renderRadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/useRadioGroup.js +1 -0
- package/lib/components/RadioGroup/useRadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/useRadioGroupStyles.js.map +1 -1
- package/lib/components/RadioGroupField/RadioGroupField.js +1 -2
- package/lib/components/RadioGroupField/RadioGroupField.js.map +1 -1
- package/lib/components/RadioGroupField/index.js.map +1 -1
- package/lib/contexts/RadioGroupContext.js.map +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/useRadioGroupContextValues.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Radio.js +5 -4
- package/lib-commonjs/Radio.js.map +1 -1
- package/lib-commonjs/RadioGroup.js +5 -4
- package/lib-commonjs/RadioGroup.js.map +1 -1
- package/lib-commonjs/RadioGroupField.js +5 -4
- package/lib-commonjs/RadioGroupField.js.map +1 -1
- package/lib-commonjs/components/Radio/Radio.js +19 -20
- package/lib-commonjs/components/Radio/Radio.js.map +1 -1
- package/lib-commonjs/components/Radio/Radio.types.js +5 -2
- package/lib-commonjs/components/Radio/Radio.types.js.map +1 -1
- package/lib-commonjs/components/Radio/index.js +9 -8
- package/lib-commonjs/components/Radio/index.js.map +1 -1
- package/lib-commonjs/components/Radio/renderRadio.js +13 -24
- package/lib-commonjs/components/Radio/renderRadio.js.map +1 -1
- package/lib-commonjs/components/Radio/useRadio.js +83 -91
- package/lib-commonjs/components/Radio/useRadio.js.map +1 -1
- package/lib-commonjs/components/Radio/useRadioStyles.js +139 -65
- package/lib-commonjs/components/Radio/useRadioStyles.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/RadioGroup.js +21 -22
- package/lib-commonjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/RadioGroup.types.js +5 -2
- package/lib-commonjs/components/RadioGroup/RadioGroup.types.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/index.js +9 -8
- package/lib-commonjs/components/RadioGroup/index.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/renderRadioGroup.js +16 -21
- package/lib-commonjs/components/RadioGroup/renderRadioGroup.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/useRadioGroup.js +40 -50
- package/lib-commonjs/components/RadioGroup/useRadioGroup.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.js +32 -23
- package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.js.map +1 -1
- package/lib-commonjs/components/RadioGroupField/RadioGroupField.js +17 -11
- package/lib-commonjs/components/RadioGroupField/RadioGroupField.js.map +1 -1
- package/lib-commonjs/components/RadioGroupField/index.js +5 -4
- package/lib-commonjs/components/RadioGroupField/index.js.map +1 -1
- package/lib-commonjs/contexts/RadioGroupContext.js +17 -11
- package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js +6 -5
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/useRadioGroupContextValues.js +20 -25
- package/lib-commonjs/contexts/useRadioGroupContextValues.js.map +1 -1
- package/lib-commonjs/index.js +31 -99
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +13 -12
- package/lib-amd/Radio.js +0 -6
- package/lib-amd/Radio.js.map +0 -1
- package/lib-amd/RadioGroup.js +0 -6
- package/lib-amd/RadioGroup.js.map +0 -1
- package/lib-amd/RadioGroupField.js +0 -6
- package/lib-amd/RadioGroupField.js.map +0 -1
- package/lib-amd/components/Radio/Radio.js +0 -17
- package/lib-amd/components/Radio/Radio.js.map +0 -1
- package/lib-amd/components/Radio/Radio.types.js +0 -5
- package/lib-amd/components/Radio/Radio.types.js.map +0 -1
- package/lib-amd/components/Radio/index.js +0 -10
- package/lib-amd/components/Radio/index.js.map +0 -1
- package/lib-amd/components/Radio/renderRadio.js +0 -17
- package/lib-amd/components/Radio/renderRadio.js.map +0 -1
- package/lib-amd/components/Radio/useRadio.js +0 -65
- package/lib-amd/components/Radio/useRadio.js.map +0 -1
- package/lib-amd/components/Radio/useRadioStyles.js +0 -158
- package/lib-amd/components/Radio/useRadioStyles.js.map +0 -1
- package/lib-amd/components/RadioGroup/RadioGroup.js +0 -18
- package/lib-amd/components/RadioGroup/RadioGroup.js.map +0 -1
- package/lib-amd/components/RadioGroup/RadioGroup.types.js +0 -5
- package/lib-amd/components/RadioGroup/RadioGroup.types.js.map +0 -1
- package/lib-amd/components/RadioGroup/index.js +0 -10
- package/lib-amd/components/RadioGroup/index.js.map +0 -1
- package/lib-amd/components/RadioGroup/renderRadioGroup.js +0 -15
- package/lib-amd/components/RadioGroup/renderRadioGroup.js.map +0 -1
- package/lib-amd/components/RadioGroup/useRadioGroup.js +0 -38
- package/lib-amd/components/RadioGroup/useRadioGroup.js.map +0 -1
- package/lib-amd/components/RadioGroup/useRadioGroupStyles.js +0 -26
- package/lib-amd/components/RadioGroup/useRadioGroupStyles.js.map +0 -1
- package/lib-amd/components/RadioGroupField/RadioGroupField.js +0 -10
- package/lib-amd/components/RadioGroupField/RadioGroupField.js.map +0 -1
- package/lib-amd/components/RadioGroupField/index.js +0 -6
- package/lib-amd/components/RadioGroupField/index.js.map +0 -1
- package/lib-amd/contexts/RadioGroupContext.js +0 -19
- package/lib-amd/contexts/RadioGroupContext.js.map +0 -1
- package/lib-amd/contexts/index.js +0 -7
- package/lib-amd/contexts/index.js.map +0 -1
- package/lib-amd/contexts/useRadioGroupContextValues.js +0 -19
- package/lib-amd/contexts/useRadioGroupContextValues.js.map +0 -1
- package/lib-amd/index.js +0 -21
- package/lib-amd/index.js.map +0 -1
package/lib-commonjs/Radio.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./components/Radio/index"), exports);
|
7
|
+
//# sourceMappingURL=Radio.js.map
|
8
|
+
|
8
9
|
//# sourceMappingURL=Radio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../lib/Radio.js"],"sourcesContent":["export * from './components/Radio/index';\n//# sourceMappingURL=Radio.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,iCAAiC"}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./components/RadioGroup/index"), exports);
|
7
|
+
//# sourceMappingURL=RadioGroup.js.map
|
8
|
+
|
8
9
|
//# sourceMappingURL=RadioGroup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../lib/RadioGroup.js"],"sourcesContent":["export * from './components/RadioGroup/index';\n//# sourceMappingURL=RadioGroup.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,sCAAsC"}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./components/RadioGroupField/index"), exports);
|
7
|
+
//# sourceMappingURL=RadioGroupField.js.map
|
8
|
+
|
8
9
|
//# sourceMappingURL=RadioGroupField.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../lib/RadioGroupField.js"],"sourcesContent":["export * from './components/RadioGroupField/index';\n//# sourceMappingURL=RadioGroupField.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,2CAA2C"}
|
@@ -1,25 +1,24 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "Radio", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>Radio
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
const {
|
19
|
-
useRadioStyles_unstable: useCustomStyles
|
20
|
-
} = react_shared_contexts_1.useCustomStyleHooks_unstable();
|
21
|
-
useCustomStyles(state);
|
22
|
-
return renderRadio_1.renderRadio_unstable(state);
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _renderRadio = require("./renderRadio");
|
12
|
+
const _useRadio = require("./useRadio");
|
13
|
+
const _useRadioStyles = require("./useRadioStyles");
|
14
|
+
const _reactSharedContexts = require("@fluentui/react-shared-contexts");
|
15
|
+
const Radio = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
16
|
+
const state = (0, _useRadio.useRadio_unstable)(props, ref);
|
17
|
+
(0, _useRadioStyles.useRadioStyles_unstable)(state);
|
18
|
+
const { useRadioStyles_unstable: useCustomStyles } = (0, _reactSharedContexts.useCustomStyleHooks_unstable)();
|
19
|
+
useCustomStyles(state);
|
20
|
+
return (0, _renderRadio.renderRadio_unstable)(state);
|
23
21
|
});
|
24
|
-
|
22
|
+
Radio.displayName = 'Radio'; //# sourceMappingURL=Radio.js.map
|
23
|
+
|
25
24
|
//# sourceMappingURL=Radio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n/**\n * Radio component is a wrapper for a radio button with a label.\n */\nexport const Radio = /*#__PURE__*/React.forwardRef((props, ref) => {\n const state = useRadio_unstable(props, ref);\n useRadioStyles_unstable(state);\n const {\n useRadioStyles_unstable: useCustomStyles\n } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n return renderRadio_unstable(state);\n});\nRadio.displayName = 'Radio';\n//# sourceMappingURL=Radio.js.map"],"names":["Radio","React","forwardRef","props","ref","state","useRadio_unstable","useRadioStyles_unstable","useCustomStyles","useCustomStyleHooks_unstable","renderRadio_unstable","displayName"],"mappings":";;;;+BAQaA;;aAAAA;;;6DARU;6BACc;0BACH;gCACM;qCACK;AAItC,MAAMA,QAAQ,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACjE,MAAMC,QAAQC,IAAAA,2BAAiB,EAACH,OAAOC;IACvCG,IAAAA,uCAAuB,EAACF;IACxB,MAAM,EACJE,yBAAyBC,gBAAe,EACzC,GAAGC,IAAAA,iDAA4B;IAChCD,gBAAgBH;IAChB,OAAOK,IAAAA,iCAAoB,EAACL;AAC9B;AACAL,MAAMW,WAAW,GAAG,SACpB,iCAAiC"}
|
@@ -1,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
5
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
6
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
7
|
+
//# sourceMappingURL=Radio.types.js.map
|
8
|
+
|
6
9
|
//# sourceMappingURL=Radio.types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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;CACvB,uCAAuC"}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./Radio"), exports);
|
7
|
+
_exportStar(require("./Radio.types"), exports);
|
8
|
+
_exportStar(require("./renderRadio"), exports);
|
9
|
+
_exportStar(require("./useRadio"), exports);
|
10
|
+
_exportStar(require("./useRadioStyles"), exports);
|
11
|
+
//# sourceMappingURL=index.js.map
|
12
|
+
|
12
13
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
|
@@ -1,28 +1,17 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "renderRadio_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>renderRadio_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
*/
|
12
|
-
|
13
|
-
|
14
|
-
slots,
|
15
|
-
slotProps
|
16
|
-
} = react_utilities_1.getSlots(state);
|
17
|
-
return React.createElement(slots.root, {
|
18
|
-
...slotProps.root
|
19
|
-
}, React.createElement(slots.input, {
|
20
|
-
...slotProps.input
|
21
|
-
}), React.createElement(slots.indicator, {
|
22
|
-
...slotProps.indicator
|
23
|
-
}), slots.label && React.createElement(slots.label, {
|
24
|
-
...slotProps.label
|
25
|
-
}));
|
26
|
-
};
|
27
|
-
exports.renderRadio_unstable = renderRadio_unstable;
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
12
|
+
const renderRadio_unstable = (state)=>{
|
13
|
+
const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
|
14
|
+
return /*#__PURE__*/ _react.createElement(slots.root, slotProps.root, /*#__PURE__*/ _react.createElement(slots.input, slotProps.input), /*#__PURE__*/ _react.createElement(slots.indicator, slotProps.indicator), slots.label && /*#__PURE__*/ _react.createElement(slots.label, slotProps.label));
|
15
|
+
}; //# sourceMappingURL=renderRadio.js.map
|
16
|
+
|
28
17
|
//# sourceMappingURL=renderRadio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Radio/renderRadio.js"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Radio\n */\nexport const renderRadio_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n return /*#__PURE__*/React.createElement(slots.root, slotProps.root, /*#__PURE__*/React.createElement(slots.input, slotProps.input), /*#__PURE__*/React.createElement(slots.indicator, slotProps.indicator), slots.label && /*#__PURE__*/React.createElement(slots.label, slotProps.label));\n};\n//# sourceMappingURL=renderRadio.js.map"],"names":["renderRadio_unstable","state","slots","slotProps","getSlots","React","createElement","root","input","indicator","label"],"mappings":";;;;+BAKaA;;aAAAA;;;6DALU;gCACE;AAIlB,MAAMA,uBAAuBC,CAAAA,QAAS;IAC3C,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,OAAO,WAAW,GAAEI,OAAMC,aAAa,CAACJ,MAAMK,IAAI,EAAEJ,UAAUI,IAAI,EAAE,WAAW,GAAEF,OAAMC,aAAa,CAACJ,MAAMM,KAAK,EAAEL,UAAUK,KAAK,GAAG,WAAW,GAAEH,OAAMC,aAAa,CAACJ,MAAMO,SAAS,EAAEN,UAAUM,SAAS,GAAGP,MAAMQ,KAAK,IAAI,WAAW,GAAEL,OAAMC,aAAa,CAACJ,MAAMQ,KAAK,EAAEP,UAAUO,KAAK;AAC1R,GACA,uCAAuC"}
|
@@ -1,95 +1,87 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "useRadio_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>useRadio_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
input: 'input',
|
85
|
-
label: react_label_1.Label,
|
86
|
-
indicator: 'div'
|
87
|
-
},
|
88
|
-
root,
|
89
|
-
input,
|
90
|
-
label,
|
91
|
-
indicator
|
92
|
-
};
|
93
|
-
};
|
94
|
-
exports.useRadio_unstable = useRadio_unstable;
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _reactIcons = require("@fluentui/react-icons");
|
12
|
+
const _reactLabel = require("@fluentui/react-label");
|
13
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
14
|
+
const _radioGroupContext = require("../../contexts/RadioGroupContext");
|
15
|
+
const _reactTabster = require("@fluentui/react-tabster");
|
16
|
+
const useRadio_unstable = (props, ref)=>{
|
17
|
+
const nameGroup = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.name);
|
18
|
+
const value = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.value);
|
19
|
+
const defaultValue = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.defaultValue);
|
20
|
+
const disabledGroup = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.disabled);
|
21
|
+
const layout = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.layout);
|
22
|
+
const requiredGroup = (0, _radioGroupContext.useRadioGroupContext_unstable)((ctx)=>ctx.required);
|
23
|
+
const { name =nameGroup , checked =value !== undefined ? value === props.value : undefined , defaultChecked =defaultValue !== undefined ? defaultValue === props.value : undefined , labelPosition =layout === 'horizontal-stacked' ? 'below' : 'after' , disabled =disabledGroup , required =requiredGroup , onChange } = props;
|
24
|
+
const nativeProps = (0, _reactUtilities.getPartitionedNativeProps)({
|
25
|
+
props,
|
26
|
+
primarySlotTagName: 'input',
|
27
|
+
excludedPropNames: [
|
28
|
+
'checked',
|
29
|
+
'defaultChecked',
|
30
|
+
'onChange'
|
31
|
+
]
|
32
|
+
});
|
33
|
+
const root = (0, _reactUtilities.resolveShorthand)(props.root, {
|
34
|
+
required: true,
|
35
|
+
defaultProps: {
|
36
|
+
ref: (0, _reactTabster.useFocusWithin)(),
|
37
|
+
...nativeProps.root
|
38
|
+
}
|
39
|
+
});
|
40
|
+
const input = (0, _reactUtilities.resolveShorthand)(props.input, {
|
41
|
+
required: true,
|
42
|
+
defaultProps: {
|
43
|
+
ref,
|
44
|
+
type: 'radio',
|
45
|
+
id: (0, _reactUtilities.useId)('radio-', nativeProps.primary.id),
|
46
|
+
name,
|
47
|
+
checked,
|
48
|
+
defaultChecked,
|
49
|
+
disabled,
|
50
|
+
required,
|
51
|
+
...nativeProps.primary
|
52
|
+
}
|
53
|
+
});
|
54
|
+
input.onChange = (0, _reactUtilities.mergeCallbacks)(input.onChange, (ev)=>{
|
55
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {
|
56
|
+
value: ev.currentTarget.value
|
57
|
+
});
|
58
|
+
});
|
59
|
+
const label = (0, _reactUtilities.resolveShorthand)(props.label, {
|
60
|
+
defaultProps: {
|
61
|
+
htmlFor: input.id,
|
62
|
+
disabled
|
63
|
+
}
|
64
|
+
});
|
65
|
+
const indicator = (0, _reactUtilities.resolveShorthand)(props.indicator, {
|
66
|
+
required: true,
|
67
|
+
defaultProps: {
|
68
|
+
'aria-hidden': true,
|
69
|
+
children: /*#__PURE__*/ _react.createElement(_reactIcons.CircleFilled, null)
|
70
|
+
}
|
71
|
+
});
|
72
|
+
return {
|
73
|
+
labelPosition,
|
74
|
+
components: {
|
75
|
+
root: 'span',
|
76
|
+
input: 'input',
|
77
|
+
label: _reactLabel.Label,
|
78
|
+
indicator: 'div'
|
79
|
+
},
|
80
|
+
root,
|
81
|
+
input,
|
82
|
+
label,
|
83
|
+
indicator
|
84
|
+
};
|
85
|
+
}; //# sourceMappingURL=useRadio.js.map
|
86
|
+
|
95
87
|
//# sourceMappingURL=useRadio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Radio/useRadio.js"],"sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useRadioGroupContext_unstable } from '../../contexts/RadioGroupContext';\nimport { useFocusWithin } from '@fluentui/react-tabster';\n/**\n * Create the state required to render Radio.\n *\n * The returned state can be modified with hooks such as useRadioStyles_unstable,\n * before being passed to renderRadio_unstable.\n *\n * @param props - props from this instance of Radio\n * @param ref - reference to `<input>` element of Radio\n */\nexport const useRadio_unstable = (props, ref) => {\n const nameGroup = useRadioGroupContext_unstable(ctx => ctx.name);\n const value = useRadioGroupContext_unstable(ctx => ctx.value);\n const defaultValue = useRadioGroupContext_unstable(ctx => ctx.defaultValue);\n const disabledGroup = useRadioGroupContext_unstable(ctx => ctx.disabled);\n const layout = useRadioGroupContext_unstable(ctx => ctx.layout);\n const requiredGroup = useRadioGroupContext_unstable(ctx => ctx.required);\n const {\n name = nameGroup,\n checked = value !== undefined ? value === props.value : undefined,\n defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,\n labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after',\n disabled = disabledGroup,\n required = requiredGroup,\n onChange\n } = props;\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange']\n });\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n ref: useFocusWithin(),\n ...nativeProps.root\n }\n });\n const input = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref,\n type: 'radio',\n id: useId('radio-', nativeProps.primary.id),\n name,\n checked,\n defaultChecked,\n disabled,\n required,\n ...nativeProps.primary\n }\n });\n input.onChange = mergeCallbacks(input.onChange, ev => {\n return onChange === null || onChange === void 0 ? void 0 : onChange(ev, {\n value: ev.currentTarget.value\n });\n });\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled\n }\n });\n const indicator = resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: /*#__PURE__*/React.createElement(CircleFilled, null)\n }\n });\n return {\n labelPosition,\n components: {\n root: 'span',\n input: 'input',\n label: Label,\n indicator: 'div'\n },\n root,\n input,\n label,\n indicator\n };\n};\n//# sourceMappingURL=useRadio.js.map"],"names":["useRadio_unstable","props","ref","nameGroup","useRadioGroupContext_unstable","ctx","name","value","defaultValue","disabledGroup","disabled","layout","requiredGroup","required","checked","undefined","defaultChecked","labelPosition","onChange","nativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","root","resolveShorthand","defaultProps","useFocusWithin","input","type","id","useId","primary","mergeCallbacks","ev","currentTarget","label","htmlFor","indicator","children","React","createElement","CircleFilled","components","Label"],"mappings":";;;;+BAeaA;;aAAAA;;;6DAfU;4BACM;4BACP;gCAC6D;mCACrC;8BACf;AAUxB,MAAMA,oBAAoB,CAACC,OAAOC,MAAQ;IAC/C,MAAMC,YAAYC,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIC,IAAI;IAC/D,MAAMC,QAAQH,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIE,KAAK;IAC5D,MAAMC,eAAeJ,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIG,YAAY;IAC1E,MAAMC,gBAAgBL,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIK,QAAQ;IACvE,MAAMC,SAASP,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIM,MAAM;IAC9D,MAAMC,gBAAgBR,IAAAA,gDAA6B,EAACC,CAAAA,MAAOA,IAAIQ,QAAQ;IACvE,MAAM,EACJP,MAAOH,UAAS,EAChBW,SAAUP,UAAUQ,YAAYR,UAAUN,MAAMM,KAAK,GAAGQ,SAAS,CAAA,EACjEC,gBAAiBR,iBAAiBO,YAAYP,iBAAiBP,MAAMM,KAAK,GAAGQ,SAAS,CAAA,EACtFE,eAAgBN,WAAW,uBAAuB,UAAU,OAAO,CAAA,EACnED,UAAWD,cAAa,EACxBI,UAAWD,cAAa,EACxBM,SAAQ,EACT,GAAGjB;IACJ,MAAMkB,cAAcC,IAAAA,yCAAyB,EAAC;QAC5CnB;QACAoB,oBAAoB;QACpBC,mBAAmB;YAAC;YAAW;YAAkB;SAAW;IAC9D;IACA,MAAMC,OAAOC,IAAAA,gCAAgB,EAACvB,MAAMsB,IAAI,EAAE;QACxCV,UAAU,IAAI;QACdY,cAAc;YACZvB,KAAKwB,IAAAA,4BAAc;YACnB,GAAGP,YAAYI,IAAI;QACrB;IACF;IACA,MAAMI,QAAQH,IAAAA,gCAAgB,EAACvB,MAAM0B,KAAK,EAAE;QAC1Cd,UAAU,IAAI;QACdY,cAAc;YACZvB;YACA0B,MAAM;YACNC,IAAIC,IAAAA,qBAAK,EAAC,UAAUX,YAAYY,OAAO,CAACF,EAAE;YAC1CvB;YACAQ;YACAE;YACAN;YACAG;YACA,GAAGM,YAAYY,OAAO;QACxB;IACF;IACAJ,MAAMT,QAAQ,GAAGc,IAAAA,8BAAc,EAACL,MAAMT,QAAQ,EAAEe,CAAAA,KAAM;QACpD,OAAOf,aAAa,IAAI,IAAIA,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASe,IAAI;YACtE1B,OAAO0B,GAAGC,aAAa,CAAC3B,KAAK;QAC/B,EAAE;IACJ;IACA,MAAM4B,QAAQX,IAAAA,gCAAgB,EAACvB,MAAMkC,KAAK,EAAE;QAC1CV,cAAc;YACZW,SAAST,MAAME,EAAE;YACjBnB;QACF;IACF;IACA,MAAM2B,YAAYb,IAAAA,gCAAgB,EAACvB,MAAMoC,SAAS,EAAE;QAClDxB,UAAU,IAAI;QACdY,cAAc;YACZ,eAAe,IAAI;YACnBa,UAAU,WAAW,GAAEC,OAAMC,aAAa,CAACC,wBAAY,EAAE,IAAI;QAC/D;IACF;IACA,OAAO;QACLxB;QACAyB,YAAY;YACVnB,MAAM;YACNI,OAAO;YACPQ,OAAOQ,iBAAK;YACZN,WAAW;QACb;QACAd;QACAI;QACAQ;QACAE;IACF;AACF,GACA,oCAAoC"}
|