@fluentui/react-radio 0.0.0-nightly-20220302-0405.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. package/CHANGELOG.json +305 -0
  2. package/CHANGELOG.md +106 -0
  3. package/LICENSE +15 -0
  4. package/README.md +5 -0
  5. package/Spec.md +292 -0
  6. package/dist/react-radio.d.ts +183 -0
  7. package/lib/Radio.d.ts +1 -0
  8. package/lib/Radio.js +2 -0
  9. package/lib/Radio.js.map +1 -0
  10. package/lib/RadioGroup.d.ts +1 -0
  11. package/lib/RadioGroup.js +2 -0
  12. package/lib/RadioGroup.js.map +1 -0
  13. package/lib/components/Radio/Radio.d.ts +6 -0
  14. package/lib/components/Radio/Radio.js +15 -0
  15. package/lib/components/Radio/Radio.js.map +1 -0
  16. package/lib/components/Radio/Radio.types.d.ts +52 -0
  17. package/lib/components/Radio/Radio.types.js +2 -0
  18. package/lib/components/Radio/Radio.types.js.map +1 -0
  19. package/lib/components/Radio/index.d.ts +5 -0
  20. package/lib/components/Radio/index.js +6 -0
  21. package/lib/components/Radio/index.js.map +1 -0
  22. package/lib/components/Radio/renderRadio.d.ts +5 -0
  23. package/lib/components/Radio/renderRadio.js +18 -0
  24. package/lib/components/Radio/renderRadio.js.map +1 -0
  25. package/lib/components/Radio/useRadio.d.ts +12 -0
  26. package/lib/components/Radio/useRadio.js +76 -0
  27. package/lib/components/Radio/useRadio.js.map +1 -0
  28. package/lib/components/Radio/useRadioStyles.d.ts +6 -0
  29. package/lib/components/Radio/useRadioStyles.js +174 -0
  30. package/lib/components/Radio/useRadioStyles.js.map +1 -0
  31. package/lib/components/RadioGroup/RadioGroup.d.ts +6 -0
  32. package/lib/components/RadioGroup/RadioGroup.js +15 -0
  33. package/lib/components/RadioGroup/RadioGroup.js.map +1 -0
  34. package/lib/components/RadioGroup/RadioGroup.types.d.ts +58 -0
  35. package/lib/components/RadioGroup/RadioGroup.types.js +2 -0
  36. package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -0
  37. package/lib/components/RadioGroup/index.d.ts +5 -0
  38. package/lib/components/RadioGroup/index.js +6 -0
  39. package/lib/components/RadioGroup/index.js.map +1 -0
  40. package/lib/components/RadioGroup/renderRadioGroup.d.ts +5 -0
  41. package/lib/components/RadioGroup/renderRadioGroup.js +18 -0
  42. package/lib/components/RadioGroup/renderRadioGroup.js.map +1 -0
  43. package/lib/components/RadioGroup/useRadioGroup.d.ts +12 -0
  44. package/lib/components/RadioGroup/useRadioGroup.js +51 -0
  45. package/lib/components/RadioGroup/useRadioGroup.js.map +1 -0
  46. package/lib/components/RadioGroup/useRadioGroupStyles.d.ts +6 -0
  47. package/lib/components/RadioGroup/useRadioGroupStyles.js +24 -0
  48. package/lib/components/RadioGroup/useRadioGroupStyles.js.map +1 -0
  49. package/lib/contexts/RadioGroupContext.d.ts +7 -0
  50. package/lib/contexts/RadioGroupContext.js +7 -0
  51. package/lib/contexts/RadioGroupContext.js.map +1 -0
  52. package/lib/index.d.ts +3 -0
  53. package/lib/index.js +4 -0
  54. package/lib/index.js.map +1 -0
  55. package/lib/tsdoc-metadata.json +11 -0
  56. package/lib-commonjs/Radio.d.ts +1 -0
  57. package/lib-commonjs/Radio.js +10 -0
  58. package/lib-commonjs/Radio.js.map +1 -0
  59. package/lib-commonjs/RadioGroup.d.ts +1 -0
  60. package/lib-commonjs/RadioGroup.js +10 -0
  61. package/lib-commonjs/RadioGroup.js.map +1 -0
  62. package/lib-commonjs/components/Radio/Radio.d.ts +6 -0
  63. package/lib-commonjs/components/Radio/Radio.js +26 -0
  64. package/lib-commonjs/components/Radio/Radio.js.map +1 -0
  65. package/lib-commonjs/components/Radio/Radio.types.d.ts +52 -0
  66. package/lib-commonjs/components/Radio/Radio.types.js +6 -0
  67. package/lib-commonjs/components/Radio/Radio.types.js.map +1 -0
  68. package/lib-commonjs/components/Radio/index.d.ts +5 -0
  69. package/lib-commonjs/components/Radio/index.js +18 -0
  70. package/lib-commonjs/components/Radio/index.js.map +1 -0
  71. package/lib-commonjs/components/Radio/renderRadio.d.ts +5 -0
  72. package/lib-commonjs/components/Radio/renderRadio.js +29 -0
  73. package/lib-commonjs/components/Radio/renderRadio.js.map +1 -0
  74. package/lib-commonjs/components/Radio/useRadio.d.ts +12 -0
  75. package/lib-commonjs/components/Radio/useRadio.js +90 -0
  76. package/lib-commonjs/components/Radio/useRadio.js.map +1 -0
  77. package/lib-commonjs/components/Radio/useRadioStyles.d.ts +6 -0
  78. package/lib-commonjs/components/Radio/useRadioStyles.js +186 -0
  79. package/lib-commonjs/components/Radio/useRadioStyles.js.map +1 -0
  80. package/lib-commonjs/components/RadioGroup/RadioGroup.d.ts +6 -0
  81. package/lib-commonjs/components/RadioGroup/RadioGroup.js +26 -0
  82. package/lib-commonjs/components/RadioGroup/RadioGroup.js.map +1 -0
  83. package/lib-commonjs/components/RadioGroup/RadioGroup.types.d.ts +58 -0
  84. package/lib-commonjs/components/RadioGroup/RadioGroup.types.js +6 -0
  85. package/lib-commonjs/components/RadioGroup/RadioGroup.types.js.map +1 -0
  86. package/lib-commonjs/components/RadioGroup/index.d.ts +5 -0
  87. package/lib-commonjs/components/RadioGroup/index.js +18 -0
  88. package/lib-commonjs/components/RadioGroup/index.js.map +1 -0
  89. package/lib-commonjs/components/RadioGroup/renderRadioGroup.d.ts +5 -0
  90. package/lib-commonjs/components/RadioGroup/renderRadioGroup.js +30 -0
  91. package/lib-commonjs/components/RadioGroup/renderRadioGroup.js.map +1 -0
  92. package/lib-commonjs/components/RadioGroup/useRadioGroup.d.ts +12 -0
  93. package/lib-commonjs/components/RadioGroup/useRadioGroup.js +62 -0
  94. package/lib-commonjs/components/RadioGroup/useRadioGroup.js.map +1 -0
  95. package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.d.ts +6 -0
  96. package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.js +34 -0
  97. package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.js.map +1 -0
  98. package/lib-commonjs/contexts/RadioGroupContext.d.ts +7 -0
  99. package/lib-commonjs/contexts/RadioGroupContext.js +15 -0
  100. package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -0
  101. package/lib-commonjs/index.d.ts +3 -0
  102. package/lib-commonjs/index.js +14 -0
  103. package/lib-commonjs/index.js.map +1 -0
  104. package/package.json +65 -0
@@ -0,0 +1,76 @@
1
+ import * as React from 'react';
2
+ import { CircleFilled } from '@fluentui/react-icons';
3
+ import { Label } from '@fluentui/react-label';
4
+ import { getPartitionedNativeProps, resolveShorthand, useId } from '@fluentui/react-utilities';
5
+ import { RadioGroupContext } from '../../contexts/RadioGroupContext';
6
+ /**
7
+ * Create the state required to render Radio.
8
+ *
9
+ * The returned state can be modified with hooks such as useRadioStyles_unstable,
10
+ * before being passed to renderRadio_unstable.
11
+ *
12
+ * @param props - props from this instance of Radio
13
+ * @param ref - reference to `<input>` element of Radio
14
+ */
15
+
16
+ export const useRadio_unstable = (props, ref) => {
17
+ const group = React.useContext(RadioGroupContext);
18
+ const {
19
+ name = group.name,
20
+ checked = group.value !== undefined ? group.value === props.value : undefined,
21
+ defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined,
22
+ labelPosition = group.layout === 'horizontalStacked' ? 'below' : 'after',
23
+ disabled = group.disabled,
24
+ required
25
+ } = props;
26
+ const nativeProps = getPartitionedNativeProps({
27
+ props,
28
+ primarySlotTagName: 'input',
29
+ excludedPropNames: ['checked', 'defaultChecked']
30
+ });
31
+ const root = resolveShorthand(props.root, {
32
+ required: true,
33
+ defaultProps: nativeProps.root
34
+ });
35
+ const input = resolveShorthand(props.input, {
36
+ required: true,
37
+ defaultProps: {
38
+ ref,
39
+ type: 'radio',
40
+ id: useId('radio-', nativeProps.primary.id),
41
+ name,
42
+ checked,
43
+ defaultChecked,
44
+ disabled,
45
+ ...nativeProps.primary
46
+ }
47
+ });
48
+ const label = resolveShorthand(props.label, {
49
+ defaultProps: {
50
+ htmlFor: input.id,
51
+ disabled,
52
+ required
53
+ }
54
+ });
55
+ const indicator = resolveShorthand(props.indicator, {
56
+ required: true,
57
+ defaultProps: {
58
+ 'aria-hidden': true,
59
+ children: /*#__PURE__*/React.createElement(CircleFilled, null)
60
+ }
61
+ });
62
+ return {
63
+ labelPosition,
64
+ components: {
65
+ root: 'span',
66
+ input: 'input',
67
+ label: Label,
68
+ indicator: 'div'
69
+ },
70
+ root,
71
+ input,
72
+ label,
73
+ indicator
74
+ };
75
+ };
76
+ //# sourceMappingURL=useRadio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Radio/useRadio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6B,uBAA7B;AACA,SAAS,KAAT,QAAsB,uBAAtB;AACA,SAAS,yBAAT,EAAoC,gBAApC,EAAsD,KAAtD,QAAmE,2BAAnE;AACA,SAAS,iBAAT,QAAkC,kCAAlC;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAAoE;AACnG,QAAM,KAAK,GAAG,KAAK,CAAC,UAAN,CAAiB,iBAAjB,CAAd;AAEA,QAAM;AACJ,IAAA,IAAI,GAAG,KAAK,CAAC,IADT;AAEJ,IAAA,OAAO,GAAG,KAAK,CAAC,KAAN,KAAgB,SAAhB,GAA4B,KAAK,CAAC,KAAN,KAAgB,KAAK,CAAC,KAAlD,GAA0D,SAFhE;AAGJ,IAAA,cAAc,GAAG,KAAK,CAAC,YAAN,KAAuB,SAAvB,GAAmC,KAAK,CAAC,YAAN,KAAuB,KAAK,CAAC,KAAhE,GAAwE,SAHrF;AAIJ,IAAA,aAAa,GAAG,KAAK,CAAC,MAAN,KAAiB,mBAAjB,GAAuC,OAAvC,GAAiD,OAJ7D;AAKJ,IAAA,QAAQ,GAAG,KAAK,CAAC,QALb;AAMJ,IAAA;AANI,MAOF,KAPJ;AASA,QAAM,WAAW,GAAG,yBAAyB,CAAC;AAC5C,IAAA,KAD4C;AAE5C,IAAA,kBAAkB,EAAE,OAFwB;AAG5C,IAAA,iBAAiB,EAAE,CAAC,SAAD,EAAY,gBAAZ;AAHyB,GAAD,CAA7C;AAMA,QAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAP,EAAa;AACxC,IAAA,QAAQ,EAAE,IAD8B;AAExC,IAAA,YAAY,EAAE,WAAW,CAAC;AAFc,GAAb,CAA7B;AAKA,QAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAP,EAAc;AAC1C,IAAA,QAAQ,EAAE,IADgC;AAE1C,IAAA,YAAY,EAAE;AACZ,MAAA,GADY;AAEZ,MAAA,IAAI,EAAE,OAFM;AAGZ,MAAA,EAAE,EAAE,KAAK,CAAC,QAAD,EAAW,WAAW,CAAC,OAAZ,CAAoB,EAA/B,CAHG;AAIZ,MAAA,IAJY;AAKZ,MAAA,OALY;AAMZ,MAAA,cANY;AAOZ,MAAA,QAPY;AAQZ,SAAG,WAAW,CAAC;AARH;AAF4B,GAAd,CAA9B;AAcA,QAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAP,EAAc;AAC1C,IAAA,YAAY,EAAE;AACZ,MAAA,OAAO,EAAE,KAAK,CAAC,EADH;AAEZ,MAAA,QAFY;AAGZ,MAAA;AAHY;AAD4B,GAAd,CAA9B;AAQA,QAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,SAAP,EAAkB;AAClD,IAAA,QAAQ,EAAE,IADwC;AAElD,IAAA,YAAY,EAAE;AACZ,qBAAe,IADH;AAEZ,MAAA,QAAQ,eAAE,KAAA,CAAA,aAAA,CAAC,YAAD,EAAa,IAAb;AAFE;AAFoC,GAAlB,CAAlC;AAQA,SAAO;AACL,IAAA,aADK;AAEL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,MADI;AAEV,MAAA,KAAK,EAAE,OAFG;AAGV,MAAA,KAAK,EAAE,KAHG;AAIV,MAAA,SAAS,EAAE;AAJD,KAFP;AAQL,IAAA,IARK;AASL,IAAA,KATK;AAUL,IAAA,KAVK;AAWL,IAAA;AAXK,GAAP;AAaD,CAlEM","sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\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 = React.useContext(RadioGroupContext);\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 === 'horizontalStacked' ? 'below' : 'after',\n disabled = group.disabled,\n required,\n } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked'],\n });\n\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: 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 ...nativeProps.primary,\n },\n });\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled,\n required,\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"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import type { RadioState } from './Radio.types';
2
+ export declare const radioClassName = "fui-Radio";
3
+ /**
4
+ * Apply styling to the Radio slots based on the state
5
+ */
6
+ export declare const useRadioStyles_unstable: (state: RadioState) => void;
@@ -0,0 +1,174 @@
1
+ import { createFocusOutlineStyle } from '@fluentui/react-tabster';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ import { __styles, mergeClasses, shorthands } from '@griffel/react';
4
+ export const radioClassName = 'fui-Radio';
5
+ const indicatorClassName = 'fui-Radio__indicator';
6
+ const labelClassName = 'fui-Radio__label'; // TODO replace these spacing constants with theme values once they're on the theme
7
+
8
+ const spacingHorizontalS = '8px';
9
+ const spacingHorizontalM = '12px'; // The indicator size is used by the indicator and label styles
10
+
11
+ const indicatorSize = '16px';
12
+ /**
13
+ * Styles for the root slot
14
+ */
15
+
16
+ const useRootStyles = /*#__PURE__*/__styles({
17
+ "base": {
18
+ "mc9l5x": "ftuwxu6",
19
+ "qhf8xq": "f10pi13n",
20
+ "i8kkvl": "f4akndk",
21
+ "z8tnut": "fp9bwmr",
22
+ "z189sj": ["f19lj068", "f177v4lu"],
23
+ "Byoj8tv": "f150uoa4",
24
+ "uwmqm3": ["f177v4lu", "f19lj068"]
25
+ },
26
+ "vertical": {
27
+ "Beiy3e4": "f1vx9l62",
28
+ "Bt984gj": "f122n59",
29
+ "Belr9w4": "fe5j3v"
30
+ },
31
+ "focusIndicator": {
32
+ "B486eqv": "f2hkw1w",
33
+ "c2y4jd": "fsofd9k",
34
+ "B8vm7ur": "f12sql3b",
35
+ "f4hv8x": "f1i4q40k",
36
+ "Gpan81": "fcrbge9",
37
+ "z7afg": "ft464mn",
38
+ "rsjj6t": "fskqmiq",
39
+ "Bqsd8kq": "f2gy8jn",
40
+ "sfhsbh": "f1pke3uf",
41
+ "Bugh3ej": "f18xdlq9",
42
+ "hpanx6": "f1114nks",
43
+ "Bjkpy09": "f1unftzx",
44
+ "Jxg1p8": "f8rjbh6",
45
+ "Bc94xmo": ["fxfgh6q", "f8l10fm"],
46
+ "Bj23z95": ["f8l10fm", "fxfgh6q"]
47
+ }
48
+ }, {
49
+ "d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".f4akndk{-webkit-column-gap:12px;column-gap:12px;}", ".fp9bwmr{padding-top:8px;}", ".f19lj068{padding-right:8px;}", ".f177v4lu{padding-left:8px;}", ".f150uoa4{padding-bottom:8px;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".fe5j3v{row-gap:12px;}", "[data-keyboard-nav] .fsofd9k:focus-within{border-color:transparent;}", "[data-keyboard-nav] .f12sql3b:focus-within:after{content:\"\";}", "[data-keyboard-nav] .f1i4q40k:focus-within:after{position:absolute;}", "[data-keyboard-nav] .fcrbge9:focus-within:after{pointer-events:none;}", "[data-keyboard-nav] .ft464mn:focus-within:after{box-sizing:outline-box;}", "[data-keyboard-nav] .fskqmiq:focus-within:after{z-index:1;}", "[data-keyboard-nav] .f2gy8jn:focus-within:after{border-style:solid;}", "[data-keyboard-nav] .f1pke3uf:focus-within:after{border-width:2px;}", "[data-keyboard-nav] .f18xdlq9:focus-within:after{border-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f1114nks:focus-within:after{border-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1unftzx:focus-within:after{top:-2px;}", "[data-keyboard-nav] .f8rjbh6:focus-within:after{bottom:-2px;}", "[data-keyboard-nav] .fxfgh6q:focus-within:after{left:-2px;}", "[data-keyboard-nav] .f8l10fm:focus-within:after{right:-2px;}"],
50
+ "i": [".f2hkw1w:focus-visible{outline-style:none;}"]
51
+ });
52
+
53
+ const useInputStyles = /*#__PURE__*/__styles({
54
+ "base": {
55
+ "qhf8xq": "f1euv43f",
56
+ "oyh7mz": ["f1vgc2s3", "f1e31b4d"],
57
+ "Bhzewxz": "f15twtuk",
58
+ "a9b677": "fly5x3f",
59
+ "Bqenvij": "f1l02sjl",
60
+ "B7ck84d": "f1ewtqcl",
61
+ "B6of3ja": "f1hu3pq6",
62
+ "t21cq0": ["f11qmguv", "f1tyq0we"],
63
+ "jrapky": "f19f4twv",
64
+ "Frg6f3": ["f1tyq0we", "f11qmguv"],
65
+ "abs64n": "fk73vx1",
66
+ "By9lhj9": "fg45n87",
67
+ "Bojc29n": "fhb1dn5",
68
+ "p8xby4": "fiegpko",
69
+ "Bmzgt9v": "fdi60kf",
70
+ "un08vv": ["fz3jc1r", "f1fwo01y"],
71
+ "Bluxpkm": "f1m2gv5u",
72
+ "upm9ap": ["f1fwo01y", "fz3jc1r"],
73
+ "Bv6ccmg": "ft7ju8s",
74
+ "w6pjei": "f1ofw0le",
75
+ "drfev3": ["fothmfx", "f13qgzgl"],
76
+ "ujr3xk": "fp5vmb3",
77
+ "Bib2mth": ["f13qgzgl", "fothmfx"],
78
+ "za2ojl": "f1snis2b",
79
+ "Bu1fve0": "ff9psms",
80
+ "B42z6en": ["f1fg9ko4", "fqj7xkg"],
81
+ "mosl6v": "f1vebft2",
82
+ "e3wlmb": ["fqj7xkg", "f1fg9ko4"],
83
+ "swj8lc": "f1vtc7ej",
84
+ "kbzjta": "f1fj62aq",
85
+ "Bnazurh": ["fc4i2ph", "f137d5x6"],
86
+ "Enz1qu": "f1v2xs8c",
87
+ "B4rl0r3": ["f137d5x6", "fc4i2ph"],
88
+ "oi7lcb": "f14bpgh5",
89
+ "bwebxt": "f1ariq71",
90
+ "ax4tcq": ["fu58av6", "f1qj5h2v"],
91
+ "z2by79": "fptcwjq",
92
+ "Bpz2hdf": ["f1qj5h2v", "fu58av6"],
93
+ "Btliz3o": "filss48",
94
+ "Bre5bwy": "frtrqgn",
95
+ "Bayw8dt": ["f1v1lrlm", "fapcpph"],
96
+ "lb5vkw": "f49ptgb",
97
+ "yhmu5n": ["fapcpph", "f1v1lrlm"],
98
+ "Blcfbx4": "fgnwcez",
99
+ "yksgid": "f1l3wt4b",
100
+ "B78hamy": "fdubm5j",
101
+ "t61w4e": ["f11to73e", "f9u8p8h"],
102
+ "Dvncu9": "fw62pkm",
103
+ "qbflri": ["f9u8p8h", "f11to73e"],
104
+ "Byzt4r9": "fqaqzd4"
105
+ }
106
+ }, {
107
+ "d": [".f1euv43f{position:absolute;}", ".f1vgc2s3{left:0;}", ".f1e31b4d{right:0;}", ".f15twtuk{top:0;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f1ewtqcl{box-sizing:border-box;}", ".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}", ".fk73vx1{opacity:0;}", ".fg45n87:enabled{cursor:pointer;}", ".fhb1dn5:not(:checked)~.fui-Radio__indicator>*{opacity:0;}", ".fiegpko:enabled:not(:checked)~.fui-Radio__label{color:var(--colorNeutralForeground3);}", ".fdi60kf:enabled:not(:checked)~.fui-Radio__indicator{border-top-color:var(--colorNeutralStrokeAccessible);}", ".fz3jc1r:enabled:not(:checked)~.fui-Radio__indicator{border-right-color:var(--colorNeutralStrokeAccessible);}", ".f1fwo01y:enabled:not(:checked)~.fui-Radio__indicator{border-left-color:var(--colorNeutralStrokeAccessible);}", ".f1m2gv5u:enabled:not(:checked)~.fui-Radio__indicator{border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".ft7ju8s:enabled:not(:checked):hover~.fui-Radio__label{color:var(--colorNeutralForeground2);}", ".f1ofw0le:enabled:not(:checked):hover~.fui-Radio__indicator{border-top-color:var(--colorNeutralStrokeAccessibleHover);}", ".fothmfx:enabled:not(:checked):hover~.fui-Radio__indicator{border-right-color:var(--colorNeutralStrokeAccessibleHover);}", ".f13qgzgl:enabled:not(:checked):hover~.fui-Radio__indicator{border-left-color:var(--colorNeutralStrokeAccessibleHover);}", ".fp5vmb3:enabled:not(:checked):hover~.fui-Radio__indicator{border-bottom-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1snis2b:enabled:not(:checked):hover:active~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".ff9psms:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-top-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f1fg9ko4:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-right-color:var(--colorNeutralStrokeAccessiblePressed);}", ".fqj7xkg:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-left-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f1vebft2:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-bottom-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f1vtc7ej:enabled:checked~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".f1fj62aq:enabled:checked~.fui-Radio__indicator{border-top-color:var(--colorCompoundBrandStroke);}", ".fc4i2ph:enabled:checked~.fui-Radio__indicator{border-right-color:var(--colorCompoundBrandStroke);}", ".f137d5x6:enabled:checked~.fui-Radio__indicator{border-left-color:var(--colorCompoundBrandStroke);}", ".f1v2xs8c:enabled:checked~.fui-Radio__indicator{border-bottom-color:var(--colorCompoundBrandStroke);}", ".f14bpgh5:enabled:checked~.fui-Radio__indicator{color:var(--colorCompoundBrandForeground1);}", ".f1ariq71:enabled:checked:hover~.fui-Radio__indicator{border-top-color:var(--colorCompoundBrandStrokeHover);}", ".fu58av6:enabled:checked:hover~.fui-Radio__indicator{border-right-color:var(--colorCompoundBrandStrokeHover);}", ".f1qj5h2v:enabled:checked:hover~.fui-Radio__indicator{border-left-color:var(--colorCompoundBrandStrokeHover);}", ".fptcwjq:enabled:checked:hover~.fui-Radio__indicator{border-bottom-color:var(--colorCompoundBrandStrokeHover);}", ".filss48:enabled:checked:hover~.fui-Radio__indicator{color:var(--colorCompoundBrandForeground1Hover);}", ".frtrqgn:enabled:checked:hover:active~.fui-Radio__indicator{border-top-color:var(--colorCompoundBrandStrokePressed);}", ".f1v1lrlm:enabled:checked:hover:active~.fui-Radio__indicator{border-right-color:var(--colorCompoundBrandStrokePressed);}", ".fapcpph:enabled:checked:hover:active~.fui-Radio__indicator{border-left-color:var(--colorCompoundBrandStrokePressed);}", ".f49ptgb:enabled:checked:hover:active~.fui-Radio__indicator{border-bottom-color:var(--colorCompoundBrandStrokePressed);}", ".fgnwcez:enabled:checked:hover:active~.fui-Radio__indicator{color:var(--colorCompoundBrandForeground1Pressed);}", ".f1l3wt4b:disabled~.fui-Radio__label{color:var(--colorNeutralForegroundDisabled);}", ".fdubm5j:disabled~.fui-Radio__indicator{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f11to73e:disabled~.fui-Radio__indicator{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f9u8p8h:disabled~.fui-Radio__indicator{border-left-color:var(--colorNeutralStrokeDisabled);}", ".fw62pkm:disabled~.fui-Radio__indicator{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".fqaqzd4:disabled~.fui-Radio__indicator{color:var(--colorNeutralForegroundDisabled);}"]
108
+ });
109
+
110
+ const useIndicatorStyles = /*#__PURE__*/__styles({
111
+ "base": {
112
+ "a9b677": "fjw5fx7",
113
+ "Bqenvij": "fd461yt",
114
+ "Be2twd7": "f1ugzwwg",
115
+ "B7ck84d": "f1ewtqcl",
116
+ "Bnnss6s": "fi64zpg",
117
+ "mc9l5x": "f22iagw",
118
+ "Bt984gj": "f122n59",
119
+ "Brf1p80": "f4d9j23",
120
+ "B68tc82": "f1p9o1ba",
121
+ "Bmxbyg5": "f1sil6mw",
122
+ "B4j52fo": "f192inf7",
123
+ "Bekrc4i": ["f5tn483", "f1ojsxk5"],
124
+ "Bn0qgzm": "f1vxd6vx",
125
+ "ibv6hh": ["f1ojsxk5", "f5tn483"],
126
+ "icvyot": "fzkkow9",
127
+ "vrafjx": ["fcdblym", "fjik90z"],
128
+ "oivjwe": "fg706s2",
129
+ "wvpqe5": ["fjik90z", "fcdblym"],
130
+ "Bbmb7ep": ["f8fbkgy", "f1nfllo7"],
131
+ "Beyfa6y": ["f1nfllo7", "f8fbkgy"],
132
+ "B7oj6ja": ["f1djnp8u", "f1s8kh49"],
133
+ "Btl43ni": ["f1s8kh49", "f1djnp8u"],
134
+ "Bkfmm31": "f1w9h62z",
135
+ "Bkecrkj": "f1aehjj5"
136
+ }
137
+ }, {
138
+ "d": [".fjw5fx7{width:16px;}", ".fd461yt{height:16px;}", ".f1ugzwwg{font-size:12px;}", ".f1ewtqcl{box-sizing:border-box;}", ".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".f1p9o1ba{overflow-x:hidden;}", ".f1sil6mw{overflow-y:hidden;}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".f8fbkgy{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f1nfllo7{border-bottom-left-radius:var(--borderRadiusCircular);}", ".f1djnp8u{border-top-right-radius:var(--borderRadiusCircular);}", ".f1s8kh49{border-top-left-radius:var(--borderRadiusCircular);}", ".f1w9h62z{fill:currentColor;}", ".f1aehjj5{pointer-events:none;}"]
139
+ });
140
+
141
+ const useLabelStyles = /*#__PURE__*/__styles({
142
+ "base": {
143
+ "qb2dma": "f7nlbp4",
144
+ "famaaq": "f1xqy1su",
145
+ "B6of3ja": "fjzwpt6",
146
+ "t21cq0": ["f11qmguv", "f1tyq0we"],
147
+ "jrapky": "fh6j2fo",
148
+ "Frg6f3": ["f1tyq0we", "f11qmguv"]
149
+ },
150
+ "below": {
151
+ "fsow6f": "f17mccla"
152
+ }
153
+ }, {
154
+ "d": [".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".f1xqy1su{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}", ".fjzwpt6{margin-top:calc((16px - var(--lineHeightBase300)) / 2);}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".fh6j2fo{margin-bottom:calc((16px - var(--lineHeightBase300)) / 2);}", ".f17mccla{text-align:center;}"]
155
+ });
156
+ /**
157
+ * Apply styling to the Radio slots based on the state
158
+ */
159
+
160
+
161
+ export const useRadioStyles_unstable = state => {
162
+ const rootStyles = useRootStyles();
163
+ state.root.className = mergeClasses(radioClassName, rootStyles.base, rootStyles.focusIndicator, state.labelPosition === 'below' && rootStyles.vertical, state.root.className);
164
+ const inputStyles = useInputStyles();
165
+ state.input.className = mergeClasses(inputStyles.base, state.input.className);
166
+ const indicatorStyles = useIndicatorStyles();
167
+ state.indicator.className = mergeClasses(indicatorClassName, indicatorStyles.base, state.indicator.className);
168
+ const labelStyles = useLabelStyles();
169
+
170
+ if (state.label) {
171
+ state.label.className = mergeClasses(labelClassName, labelStyles.base, state.labelPosition === 'below' && labelStyles.below, state.label.className);
172
+ }
173
+ };
174
+ //# sourceMappingURL=useRadioStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Radio/useRadioStyles.ts"],"names":[],"mappings":"AAAA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AAGA,OAAO,MAAM,cAAc,GAAG,WAAvB;AACP,MAAM,kBAAkB,GAAG,sBAA3B;AACA,MAAM,cAAc,GAAG,kBAAvB,C,CAEA;;AACA,MAAM,kBAAkB,GAAG,KAA3B;AACA,MAAM,kBAAkB,GAAG,MAA3B,C,CAEA;;AACA,MAAM,aAAa,GAAG,MAAtB;AAEA;;AAEG;;AACH,MAAM,aAAa,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAtB;;AAiBA,MAAM,cAAc,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAvB;;AAsFA,MAAM,kBAAkB,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA3B;;AAoBA,MAAM,cAAc,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAvB;AAeA;;AAEG;;;AACH,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAsB;AAC3D,QAAM,UAAU,GAAG,aAAa,EAAhC;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,cADiC,EAEjC,UAAU,CAAC,IAFsB,EAGjC,UAAU,CAAC,cAHsB,EAIjC,KAAK,CAAC,aAAN,KAAwB,OAAxB,IAAmC,UAAU,CAAC,QAJb,EAKjC,KAAK,CAAC,IAAN,CAAW,SALsB,CAAnC;AAQA,QAAM,WAAW,GAAG,cAAc,EAAlC;AACA,EAAA,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,YAAY,CAAC,WAAW,CAAC,IAAb,EAAmB,KAAK,CAAC,KAAN,CAAY,SAA/B,CAApC;AAEA,QAAM,eAAe,GAAG,kBAAkB,EAA1C;AACA,EAAA,KAAK,CAAC,SAAN,CAAgB,SAAhB,GAA4B,YAAY,CAAC,kBAAD,EAAqB,eAAe,CAAC,IAArC,EAA2C,KAAK,CAAC,SAAN,CAAgB,SAA3D,CAAxC;AAEA,QAAM,WAAW,GAAG,cAAc,EAAlC;;AACA,MAAI,KAAK,CAAC,KAAV,EAAiB;AACf,IAAA,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,YAAY,CAClC,cADkC,EAElC,WAAW,CAAC,IAFsB,EAGlC,KAAK,CAAC,aAAN,KAAwB,OAAxB,IAAmC,WAAW,CAAC,KAHb,EAIlC,KAAK,CAAC,KAAN,CAAY,SAJsB,CAApC;AAMD;AACF,CAzBM","sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { RadioState } from './Radio.types';\n\nexport const radioClassName = 'fui-Radio';\nconst indicatorClassName = 'fui-Radio__indicator';\nconst labelClassName = 'fui-Radio__label';\n\n// TODO replace these spacing constants with theme values once they're on the theme\nconst spacingHorizontalS = '8px';\nconst spacingHorizontalM = '12px';\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSize = '16px';\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n display: 'inline-flex',\n position: 'relative',\n columnGap: spacingHorizontalM,\n ...shorthands.padding(spacingHorizontalS),\n },\n\n vertical: {\n flexDirection: 'column',\n alignItems: 'center',\n rowGap: spacingHorizontalM,\n },\n\n focusIndicator: createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useInputStyles = makeStyles({\n base: {\n position: 'absolute',\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n boxSizing: 'border-box',\n ...shorthands.margin(0),\n opacity: 0,\n\n ':enabled': {\n cursor: 'pointer',\n },\n\n // When unchecked, hide the circle icon (child of the indicator)\n [`:not(:checked) ~ .${indicatorClassName} > *`]: {\n opacity: '0',\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked)': {\n [`& ~ .${labelClassName}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${indicatorClassName}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n\n ':hover': {\n [`& ~ .${labelClassName}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${indicatorClassName}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessibleHover),\n },\n },\n\n ':hover:active': {\n [`& ~ .${labelClassName}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${indicatorClassName}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessiblePressed),\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked': {\n [`& ~ .${labelClassName}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${indicatorClassName}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStroke),\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${indicatorClassName}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokeHover),\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${indicatorClassName}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokePressed),\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n // Colors for the disabled state\n ':disabled': {\n [`& ~ .${labelClassName}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n [`& ~ .${indicatorClassName}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\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 ...shorthands.overflow('hidden'),\n\n ...shorthands.border(tokens.strokeWidthThin, 'solid'),\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n fill: 'currentColor',\n pointerEvents: 'none',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n userSelect: 'none',\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 ...shorthands.margin(`calc((${indicatorSize} - ${tokens.lineHeightBase300}) / 2)`, 0),\n },\n\n below: {\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 rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n radioClassName,\n rootStyles.base,\n rootStyles.focusIndicator,\n state.labelPosition === 'below' && rootStyles.vertical,\n state.root.className,\n );\n\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(inputStyles.base, state.input.className);\n\n const indicatorStyles = useIndicatorStyles();\n state.indicator.className = mergeClasses(indicatorClassName, indicatorStyles.base, state.indicator.className);\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n labelClassName,\n labelStyles.base,\n state.labelPosition === 'below' && labelStyles.below,\n state.label.className,\n );\n }\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
2
+ import { RadioGroupProps } from './RadioGroup.types';
3
+ /**
4
+ * A RadioGroup component presents a set of options where only one option can be selected.
5
+ */
6
+ export declare const RadioGroup: ForwardRefComponent<RadioGroupProps>;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { renderRadioGroup_unstable } from './renderRadioGroup';
3
+ import { useRadioGroup_unstable } from './useRadioGroup';
4
+ import { useRadioGroupStyles_unstable } from './useRadioGroupStyles';
5
+ /**
6
+ * A RadioGroup component presents a set of options where only one option can be selected.
7
+ */
8
+
9
+ export const RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = useRadioGroup_unstable(props, ref);
11
+ useRadioGroupStyles_unstable(state);
12
+ return renderRadioGroup_unstable(state);
13
+ });
14
+ RadioGroup.displayName = 'RadioGroup';
15
+ //# sourceMappingURL=RadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,SAAS,yBAAT,QAA0C,oBAA1C;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,4BAAT,QAA6C,uBAA7C;AAEA;;AAEG;;AACH,OAAO,MAAM,UAAU,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC9F,QAAM,KAAK,GAAG,sBAAsB,CAAC,KAAD,EAAQ,GAAR,CAApC;AAEA,EAAA,4BAA4B,CAAC,KAAD,CAA5B;AACA,SAAO,yBAAyB,CAAC,KAAD,CAAhC;AACD,CAL+D,CAAzD;AAOP,UAAU,CAAC,WAAX,GAAyB,YAAzB","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';\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\n useRadioGroupStyles_unstable(state);\n return renderRadioGroup_unstable(state);\n});\n\nRadioGroup.displayName = 'RadioGroup';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,58 @@
1
+ import * as React from 'react';
2
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
3
+ import { RadioGroupContextValue } from '../../contexts/RadioGroupContext';
4
+ export declare type RadioGroupSlots = {
5
+ /**
6
+ * The radio group root.
7
+ */
8
+ root: Slot<'div'>;
9
+ };
10
+ export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {
11
+ /**
12
+ * The name of this radio group. This name is applied to all Radio items inside this group.
13
+ *
14
+ * If no name is provided, one will be generated so that all of the Radio items have the same name.
15
+ */
16
+ name?: string;
17
+ /**
18
+ * The selected Radio item in this group.
19
+ *
20
+ * This should be the `value` prop of one of the Radio items inside this group.
21
+ */
22
+ value?: string;
23
+ /**
24
+ * The default selected Radio item in this group.
25
+ *
26
+ * This should be the `value` prop of one of the Radio items inside this group.
27
+ */
28
+ defaultValue?: string;
29
+ /**
30
+ * Callback when the selected Radio item changes.
31
+ */
32
+ onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;
33
+ /**
34
+ * How the radio items are laid out in the group.
35
+ *
36
+ * @defaultvalue vertical
37
+ */
38
+ layout?: 'vertical' | 'horizontal' | 'horizontalStacked';
39
+ /**
40
+ * Disable all Radio items in this group.
41
+ */
42
+ disabled?: boolean;
43
+ };
44
+ /**
45
+ * Data for the onChange event for RadioGroup.
46
+ */
47
+ export declare type RadioGroupOnChangeData = {
48
+ /**
49
+ * The value of the newly selected Radio item.
50
+ */
51
+ value: string;
52
+ };
53
+ /**
54
+ * State used in rendering RadioGroup
55
+ */
56
+ export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & {
57
+ context: RadioGroupContextValue;
58
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RadioGroup.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.types.js","sourceRoot":"../src/","sources":["components/RadioGroup/RadioGroup.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RadioGroupContextValue } from '../../contexts/RadioGroupContext';\n\nexport type RadioGroupSlots = {\n /**\n * The radio group root.\n */\n root: 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 * @defaultvalue vertical\n */\n layout?: 'vertical' | 'horizontal' | 'horizontalStacked';\n\n /**\n * Disable all Radio items in this group.\n */\n disabled?: 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 context: RadioGroupContextValue;\n };\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './RadioGroup';
2
+ export * from './RadioGroup.types';
3
+ export * from './renderRadioGroup';
4
+ export * from './useRadioGroup';
5
+ export * from './useRadioGroupStyles';
@@ -0,0 +1,6 @@
1
+ export * from './RadioGroup';
2
+ export * from './RadioGroup.types';
3
+ export * from './renderRadioGroup';
4
+ export * from './useRadioGroup';
5
+ export * from './useRadioGroupStyles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/RadioGroup/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './RadioGroup';\nexport * from './RadioGroup.types';\nexport * from './renderRadioGroup';\nexport * from './useRadioGroup';\nexport * from './useRadioGroupStyles';\n"]}
@@ -0,0 +1,5 @@
1
+ import { RadioGroupState } from './RadioGroup.types';
2
+ /**
3
+ * Render the final JSX of RadioGroup
4
+ */
5
+ export declare const renderRadioGroup_unstable: (state: RadioGroupState) => JSX.Element;
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import { getSlots } from '@fluentui/react-utilities';
3
+ import { RadioGroupContext } from '../../contexts/RadioGroupContext';
4
+ /**
5
+ * Render the final JSX of RadioGroup
6
+ */
7
+
8
+ export const renderRadioGroup_unstable = state => {
9
+ const {
10
+ slots,
11
+ slotProps
12
+ } = getSlots(state);
13
+ return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {
14
+ value: state.context
15
+ }, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
16
+ }));
17
+ };
18
+ //# sourceMappingURL=renderRadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/RadioGroup/renderRadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,iBAAT,QAAkC,kCAAlC;AAGA;;AAEG;;AACH,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAA2B;AAClE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAkB,KAAlB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,iBAAiB,CAAC,QAAnB,EAA2B;AAAC,IAAA,KAAK,EAAE,KAAK,CAAC;AAAd,GAA3B,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\nimport { RadioGroupSlots, RadioGroupState } from './RadioGroup.types';\n\n/**\n * Render the final JSX of RadioGroup\n */\nexport const renderRadioGroup_unstable = (state: RadioGroupState) => {\n const { slots, slotProps } = getSlots<RadioGroupSlots>(state);\n\n return (\n <RadioGroupContext.Provider value={state.context}>\n <slots.root {...slotProps.root} />\n </RadioGroupContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { RadioGroupProps, RadioGroupState } from './RadioGroup.types';
3
+ /**
4
+ * Create the state required to render RadioGroup.
5
+ *
6
+ * The returned state can be modified with hooks such as useRadioGroupStyles_unstable,
7
+ * before being passed to renderRadioGroup_unstable.
8
+ *
9
+ * @param props - props from this instance of RadioGroup
10
+ * @param ref - reference to root HTMLElement of RadioGroup
11
+ */
12
+ export declare const useRadioGroup_unstable: (props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) => RadioGroupState;
@@ -0,0 +1,51 @@
1
+ import * as React from 'react';
2
+ import { getNativeElementProps, useEventCallback, useId } from '@fluentui/react-utilities';
3
+ /**
4
+ * Create the state required to render RadioGroup.
5
+ *
6
+ * The returned state can be modified with hooks such as useRadioGroupStyles_unstable,
7
+ * before being passed to renderRadioGroup_unstable.
8
+ *
9
+ * @param props - props from this instance of RadioGroup
10
+ * @param ref - reference to root HTMLElement of RadioGroup
11
+ */
12
+
13
+ export const useRadioGroup_unstable = (props, ref) => {
14
+ const generatedName = useId('radiogroup-');
15
+ const {
16
+ name = generatedName,
17
+ value,
18
+ defaultValue,
19
+ disabled,
20
+ layout = 'vertical',
21
+ onChange
22
+ } = props;
23
+ return {
24
+ layout,
25
+ context: React.useMemo(() => ({
26
+ name,
27
+ value,
28
+ defaultValue,
29
+ disabled,
30
+ layout
31
+ }), [name, layout, value, defaultValue, disabled]),
32
+ components: {
33
+ root: 'div'
34
+ },
35
+ root: {
36
+ ref,
37
+ role: 'radiogroup',
38
+ ...getNativeElementProps('div', props,
39
+ /*excludedPropNames:*/
40
+ ['onChange', 'name']),
41
+ onChange: useEventCallback(ev => {
42
+ if (onChange && ev.target instanceof HTMLInputElement && ev.target.type === 'radio') {
43
+ onChange(ev, {
44
+ value: ev.target.value
45
+ });
46
+ }
47
+ })
48
+ }
49
+ };
50
+ };
51
+ //# sourceMappingURL=useRadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/RadioGroup/useRadioGroup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,sBAAsB,GAAG,CAAC,KAAD,EAAyB,GAAzB,KAA4E;AAChH,QAAM,aAAa,GAAG,KAAK,CAAC,aAAD,CAA3B;AAEA,QAAM;AAAE,IAAA,IAAI,GAAG,aAAT;AAAwB,IAAA,KAAxB;AAA+B,IAAA,YAA/B;AAA6C,IAAA,QAA7C;AAAuD,IAAA,MAAM,GAAG,UAAhE;AAA4E,IAAA;AAA5E,MAAyF,KAA/F;AAEA,SAAO;AACL,IAAA,MADK;AAEL,IAAA,OAAO,EAAE,KAAK,CAAC,OAAN,CACP,OAAO;AACL,MAAA,IADK;AAEL,MAAA,KAFK;AAGL,MAAA,YAHK;AAIL,MAAA,QAJK;AAKL,MAAA;AALK,KAAP,CADO,EAQP,CAAC,IAAD,EAAO,MAAP,EAAe,KAAf,EAAsB,YAAtB,EAAoC,QAApC,CARO,CAFJ;AAYL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE;AADI,KAZP;AAeL,IAAA,IAAI,EAAE;AACJ,MAAA,GADI;AAEJ,MAAA,IAAI,EAAE,YAFF;AAGJ,SAAG,qBAAqB,CAAC,KAAD,EAAQ,KAAR;AAAe;AAAuB,OAAC,UAAD,EAAa,MAAb,CAAtC,CAHpB;AAIJ,MAAA,QAAQ,EAAE,gBAAgB,CAAC,EAAE,IAAG;AAC9B,YAAI,QAAQ,IAAI,EAAE,CAAC,MAAH,YAAqB,gBAAjC,IAAqD,EAAE,CAAC,MAAH,CAAU,IAAV,KAAmB,OAA5E,EAAqF;AACnF,UAAA,QAAQ,CAAC,EAAD,EAAK;AAAE,YAAA,KAAK,EAAE,EAAE,CAAC,MAAH,CAAU;AAAnB,WAAL,CAAR;AACD;AACF,OAJyB;AAJtB;AAfD,GAAP;AA0BD,CA/BM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, 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 const generatedName = useId('radiogroup-');\n\n const { name = generatedName, value, defaultValue, disabled, layout = 'vertical', onChange } = props;\n\n return {\n layout,\n context: React.useMemo(\n () => ({\n name,\n value,\n defaultValue,\n disabled,\n layout,\n }),\n [name, layout, value, defaultValue, disabled],\n ),\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 (onChange && ev.target instanceof HTMLInputElement && ev.target.type === 'radio') {\n onChange(ev, { value: ev.target.value });\n }\n }),\n },\n };\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import { RadioGroupState } from './RadioGroup.types';
2
+ export declare const radioGroupClassName = "fui-RadioGroup";
3
+ /**
4
+ * Apply styling to the RadioGroup slots based on the state
5
+ */
6
+ export declare const useRadioGroupStyles_unstable: (state: RadioGroupState) => void;
@@ -0,0 +1,24 @@
1
+ import { __styles, mergeClasses } from '@griffel/react';
2
+ export const radioGroupClassName = 'fui-RadioGroup';
3
+
4
+ const useStyles = /*#__PURE__*/__styles({
5
+ "root": {
6
+ "mc9l5x": "f22iagw",
7
+ "Bt984gj": "f6jr5hl"
8
+ },
9
+ "vertical": {
10
+ "Beiy3e4": "f1vx9l62"
11
+ }
12
+ }, {
13
+ "d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f6jr5hl{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"]
14
+ });
15
+ /**
16
+ * Apply styling to the RadioGroup slots based on the state
17
+ */
18
+
19
+
20
+ export const useRadioGroupStyles_unstable = state => {
21
+ const styles = useStyles();
22
+ state.root.className = mergeClasses(radioGroupClassName, styles.root, state.layout === 'vertical' && styles.vertical, state.root.className);
23
+ };
24
+ //# sourceMappingURL=useRadioGroupStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/RadioGroup/useRadioGroupStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AAGA,OAAO,MAAM,mBAAmB,GAAG,gBAA5B;;AAEP,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAWA;;AAEG;;;AACH,OAAO,MAAM,4BAA4B,GAAI,KAAD,IAA2B;AACrE,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,mBADiC,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,MAAN,KAAiB,UAAjB,IAA+B,MAAM,CAAC,QAHL,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;AAMD,CARM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { RadioGroupState } from './RadioGroup.types';\n\nexport const radioGroupClassName = 'fui-RadioGroup';\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 radioGroupClassName,\n styles.root,\n state.layout === 'vertical' && styles.vertical,\n state.root.className,\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { RadioGroupProps } from '../RadioGroup';
3
+ export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'layout' | 'value' | 'defaultValue' | 'disabled'>;
4
+ /**
5
+ * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
6
+ */
7
+ export declare const RadioGroupContext: React.Context<RadioGroupContextValue>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
4
+ */
5
+
6
+ export const RadioGroupContext = /*#__PURE__*/React.createContext({});
7
+ //# sourceMappingURL=RadioGroupContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["contexts/RadioGroupContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAKA;;AAEG;;AACH,OAAO,MAAM,iBAAiB,gBAAG,KAAK,CAAC,aAAN,CAA4C,EAA5C,CAA1B","sourcesContent":["import * as React from 'react';\nimport { RadioGroupProps } from '../RadioGroup';\n\nexport type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'layout' | 'value' | 'defaultValue' | 'disabled'>;\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>({});\n"],"sourceRoot":"../src/"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './RadioGroup';
2
+ export * from './Radio';
3
+ export * from './contexts/RadioGroupContext';
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './RadioGroup';
2
+ export * from './Radio';
3
+ export * from './contexts/RadioGroupContext';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,8BAA8B,CAAC","sourcesContent":["export * from './RadioGroup';\nexport * from './Radio';\nexport * from './contexts/RadioGroupContext';\n"]}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.18.1"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1 @@
1
+ export * from './components/Radio/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/Radio/index"), exports);
10
+ //# sourceMappingURL=Radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Radio.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Radio/index';\n"],"sourceRoot":"../src/"}