@fluentui/react-radio 0.0.0-nightly-20220502-0420.1 → 0.0.0-nightly-20220505-0419.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +96 -13
- package/CHANGELOG.md +37 -18
- package/README.md +4 -0
- package/dist/index.d.ts +17 -8
- package/lib/components/Radio/Radio.types.d.ts +1 -1
- package/lib/components/Radio/Radio.types.js.map +1 -1
- package/lib/components/Radio/useRadio.js +15 -9
- package/lib/components/Radio/useRadio.js.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.js +3 -1
- package/lib/components/RadioGroup/RadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.types.d.ts +9 -4
- package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -1
- package/lib/components/RadioGroup/renderRadioGroup.d.ts +2 -2
- package/lib/components/RadioGroup/renderRadioGroup.js +2 -2
- package/lib/components/RadioGroup/renderRadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/useRadioGroup.js +7 -9
- package/lib/components/RadioGroup/useRadioGroup.js.map +1 -1
- package/lib/contexts/RadioGroupContext.d.ts +3 -4
- package/lib/contexts/RadioGroupContext.js +2 -2
- package/lib/contexts/RadioGroupContext.js.map +1 -1
- package/lib/contexts/index.d.ts +2 -0
- package/lib/contexts/index.js +3 -0
- package/lib/contexts/index.js.map +1 -0
- package/lib/contexts/useRadioGroupContextValues.d.ts +2 -0
- package/lib/contexts/useRadioGroupContextValues.js +22 -0
- package/lib/contexts/useRadioGroupContextValues.js.map +1 -0
- package/lib/index.d.ts +2 -3
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Radio/Radio.types.d.ts +1 -1
- package/lib-commonjs/components/Radio/useRadio.js +16 -9
- package/lib-commonjs/components/Radio/useRadio.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/RadioGroup.js +4 -1
- package/lib-commonjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/RadioGroup.types.d.ts +9 -4
- package/lib-commonjs/components/RadioGroup/renderRadioGroup.d.ts +2 -2
- package/lib-commonjs/components/RadioGroup/renderRadioGroup.js +2 -2
- package/lib-commonjs/components/RadioGroup/renderRadioGroup.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/useRadioGroup.js +7 -10
- package/lib-commonjs/components/RadioGroup/useRadioGroup.js.map +1 -1
- package/lib-commonjs/contexts/RadioGroupContext.d.ts +3 -4
- package/lib-commonjs/contexts/RadioGroupContext.js +2 -2
- package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/index.d.ts +2 -0
- package/lib-commonjs/contexts/index.js +12 -0
- package/lib-commonjs/contexts/index.js.map +1 -0
- package/lib-commonjs/contexts/useRadioGroupContextValues.d.ts +2 -0
- package/lib-commonjs/contexts/useRadioGroupContextValues.js +31 -0
- package/lib-commonjs/contexts/useRadioGroupContextValues.js.map +1 -0
- package/lib-commonjs/index.d.ts +2 -3
- package/lib-commonjs/index.js +9 -3
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -8
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/RadioGroup/useRadioGroup.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["components/RadioGroup/useRadioGroup.ts"],"names":[],"mappings":"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,QAA5E;AAAsF,IAAA;AAAtF,MAAmG,KAAzG;AAEA,SAAO;AACL,IAAA,MADK;AAEL,IAAA,IAFK;AAGL,IAAA,KAHK;AAIL,IAAA,YAJK;AAKL,IAAA,QALK;AAML,IAAA,QANK;AAOL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE;AADI,KAPP;AAUL,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;AAVD,GAAP;AAqBD,CA1BM","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, 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 (onChange && ev.target instanceof HTMLInputElement && ev.target.type === 'radio') {\n onChange(ev, { value: ev.target.value });\n }\n }),\n },\n };\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'layout' | 'value' | 'defaultValue' | 'disabled'>;
|
1
|
+
import type { Context } from '@fluentui/react-context-selector';
|
2
|
+
import type { RadioGroupContextValue } from '../RadioGroup';
|
4
3
|
/**
|
5
4
|
* RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
|
6
5
|
*/
|
7
|
-
export declare const RadioGroupContext:
|
6
|
+
export declare const RadioGroupContext: Context<RadioGroupContextValue>;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
1
|
+
import { createContext } from '@fluentui/react-context-selector';
|
2
2
|
/**
|
3
3
|
* RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
|
4
4
|
*/
|
5
5
|
|
6
|
-
export const RadioGroupContext = /*#__PURE__*/
|
6
|
+
export const RadioGroupContext = /*#__PURE__*/createContext({});
|
7
7
|
//# sourceMappingURL=RadioGroupContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["contexts/RadioGroupContext.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"sources":["contexts/RadioGroupContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,kCAA9B;AAIA;;AAEG;;AACH,OAAO,MAAM,iBAAiB,gBAAoC,aAAa,CAAC,EAAD,CAAxE","sourcesContent":["import { createContext } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { RadioGroupContextValue } from '../RadioGroup';\n\n/**\n * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.\n */\nexport const RadioGroupContext: Context<RadioGroupContextValue> = createContext({});\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC","sourcesContent":["export * from './RadioGroupContext';\nexport * from './useRadioGroupContextValues';\n"]}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
export const useRadioGroupContextValues = state => {
|
2
|
+
const {
|
3
|
+
name,
|
4
|
+
value,
|
5
|
+
defaultValue,
|
6
|
+
disabled,
|
7
|
+
layout,
|
8
|
+
required
|
9
|
+
} = state;
|
10
|
+
const radioGroup = {
|
11
|
+
name,
|
12
|
+
value,
|
13
|
+
defaultValue,
|
14
|
+
disabled,
|
15
|
+
layout,
|
16
|
+
required
|
17
|
+
};
|
18
|
+
return {
|
19
|
+
radioGroup
|
20
|
+
};
|
21
|
+
};
|
22
|
+
//# sourceMappingURL=useRadioGroupContextValues.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["contexts/useRadioGroupContextValues.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAAoD;AAC5F,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA,KAAR;AAAe,IAAA,YAAf;AAA6B,IAAA,QAA7B;AAAuC,IAAA,MAAvC;AAA+C,IAAA;AAA/C,MAA4D,KAAlE;AAEA,QAAM,UAAU,GAA2B;AACzC,IAAA,IADyC;AAEzC,IAAA,KAFyC;AAGzC,IAAA,YAHyC;AAIzC,IAAA,QAJyC;AAKzC,IAAA,MALyC;AAMzC,IAAA;AANyC,GAA3C;AASA,SAAO;AAAE,IAAA;AAAF,GAAP;AACD,CAbM","sourcesContent":["import type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupState } from '../RadioGroup';\n\nexport const useRadioGroupContextValues = (state: RadioGroupState): RadioGroupContextValues => {\n const { name, value, defaultValue, disabled, layout, required } = state;\n\n const radioGroup: RadioGroupContextValue = {\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required,\n };\n\n return { radioGroup };\n};\n"],"sourceRoot":"../src/"}
|
package/lib/index.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
export { RadioGroup, radioGroupClassName, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable, } from './RadioGroup';
|
2
|
-
export type { RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState } from './RadioGroup';
|
2
|
+
export type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState, } from './RadioGroup';
|
3
3
|
export { Radio, radioClassName, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable, } from './Radio';
|
4
4
|
export type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';
|
5
|
-
export { RadioGroupContext } from './contexts/
|
6
|
-
export type { RadioGroupContextValue } from './contexts/RadioGroupContext';
|
5
|
+
export { RadioGroupContext, useRadioGroupContextValues } from './contexts/index';
|
package/lib/index.js
CHANGED
@@ -4,5 +4,5 @@ radioGroupClassName, radioGroupClassNames, renderRadioGroup_unstable, useRadioGr
|
|
4
4
|
export { Radio,
|
5
5
|
/* eslint-disable-next-line deprecation/deprecation */
|
6
6
|
radioClassName, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';
|
7
|
-
export { RadioGroupContext } from './contexts/
|
7
|
+
export { RadioGroupContext, useRadioGroupContextValues } from './contexts/index';
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,UADF;AAEE;AACA,mBAHF,EAIE,oBAJF,EAKE,yBALF,EAME,4BANF,EAOE,sBAPF,QAQO,cARP;
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,UADF;AAEE;AACA,mBAHF,EAIE,oBAJF,EAKE,yBALF,EAME,4BANF,EAOE,sBAPF,QAQO,cARP;AAiBA,SACE,KADF;AAEE;AACA,cAHF,EAIE,eAJF,EAKE,oBALF,EAME,uBANF,EAOE,iBAPF,QAQO,SARP;AAUA,SAAS,iBAAT,EAA4B,0BAA5B,QAA8D,kBAA9D","sourcesContent":["export {\n RadioGroup,\n /* eslint-disable-next-line deprecation/deprecation */\n radioGroupClassName,\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 {\n Radio,\n /* eslint-disable-next-line deprecation/deprecation */\n radioClassName,\n radioClassNames,\n renderRadio_unstable,\n useRadioStyles_unstable,\n useRadio_unstable,\n} from './Radio';\nexport type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';\nexport { RadioGroupContext, useRadioGroupContextValues } from './contexts/index';\n"],"sourceRoot":"../src/"}
|
@@ -28,7 +28,7 @@ export declare type RadioSlots = {
|
|
28
28
|
/**
|
29
29
|
* Radio Props
|
30
30
|
*/
|
31
|
-
export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'size'> & {
|
31
|
+
export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & {
|
32
32
|
/**
|
33
33
|
* The value of the RadioGroup when this Radio item is selected.
|
34
34
|
*/
|
@@ -14,6 +14,8 @@ const react_label_1 = /*#__PURE__*/require("@fluentui/react-label");
|
|
14
14
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
15
15
|
|
16
16
|
const RadioGroupContext_1 = /*#__PURE__*/require("../../contexts/RadioGroupContext");
|
17
|
+
|
18
|
+
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
17
19
|
/**
|
18
20
|
* Create the state required to render Radio.
|
19
21
|
*
|
@@ -26,14 +28,19 @@ const RadioGroupContext_1 = /*#__PURE__*/require("../../contexts/RadioGroupConte
|
|
26
28
|
|
27
29
|
|
28
30
|
const useRadio_unstable = (props, ref) => {
|
29
|
-
const
|
31
|
+
const nameGroup = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.name);
|
32
|
+
const value = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.value);
|
33
|
+
const defaultValue = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.defaultValue);
|
34
|
+
const disabledGroup = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.disabled);
|
35
|
+
const layout = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.layout);
|
36
|
+
const requiredGroup = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.required);
|
30
37
|
const {
|
31
|
-
name =
|
32
|
-
checked =
|
33
|
-
defaultChecked =
|
34
|
-
labelPosition =
|
35
|
-
disabled =
|
36
|
-
required,
|
38
|
+
name = nameGroup,
|
39
|
+
checked = value !== undefined ? value === props.value : undefined,
|
40
|
+
defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,
|
41
|
+
labelPosition = layout === 'horizontalStacked' ? 'below' : 'after',
|
42
|
+
disabled = disabledGroup,
|
43
|
+
required = requiredGroup,
|
37
44
|
onChange
|
38
45
|
} = props;
|
39
46
|
const nativeProps = react_utilities_1.getPartitionedNativeProps({
|
@@ -55,6 +62,7 @@ const useRadio_unstable = (props, ref) => {
|
|
55
62
|
checked,
|
56
63
|
defaultChecked,
|
57
64
|
disabled,
|
65
|
+
required,
|
58
66
|
...nativeProps.primary
|
59
67
|
}
|
60
68
|
});
|
@@ -64,8 +72,7 @@ const useRadio_unstable = (props, ref) => {
|
|
64
72
|
const label = react_utilities_1.resolveShorthand(props.label, {
|
65
73
|
defaultProps: {
|
66
74
|
htmlFor: input.id,
|
67
|
-
disabled
|
68
|
-
required
|
75
|
+
disabled
|
69
76
|
}
|
70
77
|
});
|
71
78
|
const indicator = react_utilities_1.resolveShorthand(props.indicator, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Radio/useRadio.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAAoE;AACnG,QAAM,
|
1
|
+
{"version":3,"sources":["components/Radio/useRadio.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAAoE;AACnG,QAAM,SAAS,GAAG,wBAAA,CAAA,kBAAA,CAAmB,mBAAA,CAAA,iBAAnB,EAAsC,GAAG,IAAI,GAAG,CAAC,IAAjD,CAAlB;AACA,QAAM,KAAK,GAAG,wBAAA,CAAA,kBAAA,CAAmB,mBAAA,CAAA,iBAAnB,EAAsC,GAAG,IAAI,GAAG,CAAC,KAAjD,CA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,MADI;AAEV,MAAA,KAAK,EAAE,OAFG;AAGV,MAAA,KAAK,EAAE,aAAA,CAAA,KAHG;AAIV,MAAA,SAAS,EAAE;AAJD,KAFP;AAQL,IAAA,IARK;AASL,IAAA,KATK;AAUL,IAAA,KAVK;AAWL,IAAA;AAXK,GAAP;AAaD,CA1EM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, resolveShorthand, useId, useMergedEventCallbacks } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\nimport { useContextSelector } from '@fluentui/react-context-selector';\nimport type { RadioProps, RadioState } from './Radio.types';\n\n/**\n * Create the state required to render Radio.\n *\n * The returned state can be modified with hooks such as useRadioStyles_unstable,\n * before being passed to renderRadio_unstable.\n *\n * @param props - props from this instance of Radio\n * @param ref - reference to `<input>` element of Radio\n */\nexport const useRadio_unstable = (props: RadioProps, ref: React.Ref<HTMLInputElement>): RadioState => {\n const nameGroup = useContextSelector(RadioGroupContext, ctx => ctx.name);\n const value = useContextSelector(RadioGroupContext, ctx => ctx.value);\n const defaultValue = useContextSelector(RadioGroupContext, ctx => ctx.defaultValue);\n const disabledGroup = useContextSelector(RadioGroupContext, ctx => ctx.disabled);\n const layout = useContextSelector(RadioGroupContext, ctx => ctx.layout);\n const requiredGroup = useContextSelector(RadioGroupContext, ctx => ctx.required);\n\n const {\n name = nameGroup,\n checked = value !== undefined ? value === props.value : undefined,\n defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,\n labelPosition = layout === 'horizontalStacked' ? 'below' : 'after',\n disabled = disabledGroup,\n required = requiredGroup,\n onChange,\n } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: 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\n input.onChange = useMergedEventCallbacks(input.onChange, ev => onChange?.(ev, { value: ev.currentTarget.value }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled,\n },\n });\n\n const indicator = resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n });\n\n return {\n labelPosition,\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/"}
|
@@ -12,6 +12,8 @@ const renderRadioGroup_1 = /*#__PURE__*/require("./renderRadioGroup");
|
|
12
12
|
const useRadioGroup_1 = /*#__PURE__*/require("./useRadioGroup");
|
13
13
|
|
14
14
|
const useRadioGroupStyles_1 = /*#__PURE__*/require("./useRadioGroupStyles");
|
15
|
+
|
16
|
+
const useRadioGroupContextValues_1 = /*#__PURE__*/require("../../contexts/useRadioGroupContextValues");
|
15
17
|
/**
|
16
18
|
* A RadioGroup component presents a set of options where only one option can be selected.
|
17
19
|
*/
|
@@ -19,8 +21,9 @@ const useRadioGroupStyles_1 = /*#__PURE__*/require("./useRadioGroupStyles");
|
|
19
21
|
|
20
22
|
exports.RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
21
23
|
const state = useRadioGroup_1.useRadioGroup_unstable(props, ref);
|
24
|
+
const contextValues = useRadioGroupContextValues_1.useRadioGroupContextValues(state);
|
22
25
|
useRadioGroupStyles_1.useRadioGroupStyles_unstable(state);
|
23
|
-
return renderRadioGroup_1.renderRadioGroup_unstable(state);
|
26
|
+
return renderRadioGroup_1.renderRadioGroup_unstable(state, contextValues);
|
24
27
|
});
|
25
28
|
exports.RadioGroup.displayName = 'RadioGroup';
|
26
29
|
//# sourceMappingURL=RadioGroup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAGA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAEA;;AAEG;;;AACU,OAAA,CAAA,UAAA,gBAAmD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC9F,QAAM,KAAK,GAAG,eAAA,CAAA,sBAAA,CAAuB,KAAvB,EAA8B,GAA9B,CAAd;AAEA,EAAA,qBAAA,CAAA,4BAAA,CAA6B,KAA7B;AACA,SAAO,kBAAA,CAAA,yBAAA,CAA0B,KAA1B,CAAP;AACD,
|
1
|
+
{"version":3,"sources":["components/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAGA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,4BAAA,gBAAA,OAAA,CAAA,2CAAA,CAAA;AAEA;;AAEG;;;AACU,OAAA,CAAA,UAAA,gBAAmD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC9F,QAAM,KAAK,GAAG,eAAA,CAAA,sBAAA,CAAuB,KAAvB,EAA8B,GAA9B,CAAd;AACA,QAAM,aAAa,GAAG,4BAAA,CAAA,0BAAA,CAA2B,KAA3B,CAAtB;AAEA,EAAA,qBAAA,CAAA,4BAAA,CAA6B,KAA7B;AACA,SAAO,kBAAA,CAAA,yBAAA,CAA0B,KAA1B,EAAiC,aAAjC,CAAP;AACD,CAN+D,CAAnD;AAQb,OAAA,CAAA,UAAA,CAAW,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';\nimport { useRadioGroupContextValues } from '../../contexts/useRadioGroupContextValues';\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 return renderRadioGroup_unstable(state, contextValues);\n});\n\nRadioGroup.displayName = 'RadioGroup';\n"],"sourceRoot":"../src/"}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
3
|
-
import { RadioGroupContextValue } from '../../contexts/RadioGroupContext';
|
4
3
|
export declare type RadioGroupSlots = {
|
5
4
|
/**
|
6
5
|
* The radio group root.
|
@@ -33,13 +32,17 @@ export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlot
|
|
33
32
|
/**
|
34
33
|
* How the radio items are laid out in the group.
|
35
34
|
*
|
36
|
-
* @
|
35
|
+
* @default vertical
|
37
36
|
*/
|
38
37
|
layout?: 'vertical' | 'horizontal' | 'horizontalStacked';
|
39
38
|
/**
|
40
39
|
* Disable all Radio items in this group.
|
41
40
|
*/
|
42
41
|
disabled?: boolean;
|
42
|
+
/**
|
43
|
+
* Require all Radio items in this group.
|
44
|
+
*/
|
45
|
+
required?: boolean;
|
43
46
|
};
|
44
47
|
/**
|
45
48
|
* Data for the onChange event for RadioGroup.
|
@@ -53,6 +56,8 @@ export declare type RadioGroupOnChangeData = {
|
|
53
56
|
/**
|
54
57
|
* State used in rendering RadioGroup
|
55
58
|
*/
|
56
|
-
export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> &
|
57
|
-
|
59
|
+
export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>;
|
60
|
+
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;
|
61
|
+
export declare type RadioGroupContextValues = {
|
62
|
+
radioGroup: RadioGroupContextValue;
|
58
63
|
};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { RadioGroupState } from './RadioGroup.types';
|
1
|
+
import { RadioGroupContextValues, RadioGroupState } from './RadioGroup.types';
|
2
2
|
/**
|
3
3
|
* Render the final JSX of RadioGroup
|
4
4
|
*/
|
5
|
-
export declare const renderRadioGroup_unstable: (state: RadioGroupState) => JSX.Element;
|
5
|
+
export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element;
|
@@ -15,13 +15,13 @@ const RadioGroupContext_1 = /*#__PURE__*/require("../../contexts/RadioGroupConte
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
|
18
|
-
const renderRadioGroup_unstable = state => {
|
18
|
+
const renderRadioGroup_unstable = (state, contextValues) => {
|
19
19
|
const {
|
20
20
|
slots,
|
21
21
|
slotProps
|
22
22
|
} = react_utilities_1.getSlots(state);
|
23
23
|
return React.createElement(RadioGroupContext_1.RadioGroupContext.Provider, {
|
24
|
-
value:
|
24
|
+
value: contextValues.radioGroup
|
25
25
|
}, React.createElement(slots.root, { ...slotProps.root
|
26
26
|
}));
|
27
27
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/RadioGroup/renderRadioGroup.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,yBAAyB,
|
1
|
+
{"version":3,"sources":["components/RadioGroup/renderRadioGroup.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,yBAAyB,GAAG,CAAC,KAAD,EAAyB,aAAzB,KAAmE;AAC1G,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAA0B,KAA1B,CAA7B;AAEA,SACE,KAAA,CAAA,aAAA,CAAC,mBAAA,CAAA,iBAAA,CAAkB,QAAnB,EAA2B;AAAC,IAAA,KAAK,EAAE,aAAa,CAAC;AAAtB,GAA3B,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADF,CADF;AAKD,CARM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { getSlots } 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 } = getSlots<RadioGroupSlots>(state);\n\n return (\n <RadioGroupContext.Provider value={contextValues.radioGroup}>\n <slots.root {...slotProps.root} />\n </RadioGroupContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useRadioGroup_unstable = void 0;
|
7
7
|
|
8
|
-
const React = /*#__PURE__*/require("react");
|
9
|
-
|
10
8
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
9
|
/**
|
12
10
|
* Create the state required to render RadioGroup.
|
@@ -27,17 +25,16 @@ const useRadioGroup_unstable = (props, ref) => {
|
|
27
25
|
defaultValue,
|
28
26
|
disabled,
|
29
27
|
layout = 'vertical',
|
30
|
-
onChange
|
28
|
+
onChange,
|
29
|
+
required
|
31
30
|
} = props;
|
32
31
|
return {
|
33
32
|
layout,
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
layout
|
40
|
-
}), [name, layout, value, defaultValue, disabled]),
|
33
|
+
name,
|
34
|
+
value,
|
35
|
+
defaultValue,
|
36
|
+
disabled,
|
37
|
+
required,
|
41
38
|
components: {
|
42
39
|
root: 'div'
|
43
40
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/RadioGroup/useRadioGroup.ts"],"names":[],"mappings":";;;;;;;
|
1
|
+
{"version":3,"sources":["components/RadioGroup/useRadioGroup.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,sBAAsB,GAAG,CAAC,KAAD,EAAyB,GAAzB,KAA4E;AAChH,QAAM,aAAa,GAAG,iBAAA,CAAA,KAAA,CAAM,aAAN,CAAtB;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,QAA5E;AAAsF,IAAA;AAAtF,MAAmG,KAAzG;AAEA,SAAO;AACL,IAAA,MADK;AAEL,IAAA,IAFK;AAGL,IAAA,KAHK;AAIL,IAAA,YAJK;AAKL,IAAA,QALK;AAML,IAAA,QANK;AAOL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE;AADI,KAPP;AAUL,IAAA,IAAI,EAAE;AACJ,MAAA,GADI;AAEJ,MAAA,IAAI,EAAE,YAFF;AAGJ,SAAG,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,KAA7B;AAAoC;AAAuB,OAAC,UAAD,EAAa,MAAb,CAA3D,CAHC;AAIJ,MAAA,QAAQ,EAAE,iBAAA,CAAA,gBAAA,CAAiB,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,OAJS;AAJN;AAVD,GAAP;AAqBD,CA1BM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","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, 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 (onChange && ev.target instanceof HTMLInputElement && ev.target.type === 'radio') {\n onChange(ev, { value: ev.target.value });\n }\n }),\n },\n };\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'layout' | 'value' | 'defaultValue' | 'disabled'>;
|
1
|
+
import type { Context } from '@fluentui/react-context-selector';
|
2
|
+
import type { RadioGroupContextValue } from '../RadioGroup';
|
4
3
|
/**
|
5
4
|
* RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
|
6
5
|
*/
|
7
|
-
export declare const RadioGroupContext:
|
6
|
+
export declare const RadioGroupContext: Context<RadioGroupContextValue>;
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.RadioGroupContext = void 0;
|
7
7
|
|
8
|
-
const
|
8
|
+
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
9
9
|
/**
|
10
10
|
* RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
|
11
11
|
*/
|
12
12
|
|
13
13
|
|
14
|
-
exports.RadioGroupContext = /*#__PURE__*/
|
14
|
+
exports.RadioGroupContext = /*#__PURE__*/react_context_selector_1.createContext({});
|
15
15
|
//# sourceMappingURL=RadioGroupContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["contexts/RadioGroupContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,
|
1
|
+
{"version":3,"sources":["contexts/RadioGroupContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,iBAAA,gBAAqD,wBAAA,CAAA,aAAA,CAAc,EAAd,CAArD","sourcesContent":["import { createContext } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { RadioGroupContextValue } from '../RadioGroup';\n\n/**\n * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.\n */\nexport const RadioGroupContext: Context<RadioGroupContextValue> = createContext({});\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,12 @@
|
|
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("./RadioGroupContext"), exports);
|
10
|
+
|
11
|
+
tslib_1.__exportStar(require("./useRadioGroupContextValues"), exports);
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["contexts/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,8BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './RadioGroupContext';\nexport * from './useRadioGroupContextValues';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useRadioGroupContextValues = void 0;
|
7
|
+
|
8
|
+
const useRadioGroupContextValues = state => {
|
9
|
+
const {
|
10
|
+
name,
|
11
|
+
value,
|
12
|
+
defaultValue,
|
13
|
+
disabled,
|
14
|
+
layout,
|
15
|
+
required
|
16
|
+
} = state;
|
17
|
+
const radioGroup = {
|
18
|
+
name,
|
19
|
+
value,
|
20
|
+
defaultValue,
|
21
|
+
disabled,
|
22
|
+
layout,
|
23
|
+
required
|
24
|
+
};
|
25
|
+
return {
|
26
|
+
radioGroup
|
27
|
+
};
|
28
|
+
};
|
29
|
+
|
30
|
+
exports.useRadioGroupContextValues = useRadioGroupContextValues;
|
31
|
+
//# sourceMappingURL=useRadioGroupContextValues.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["contexts/useRadioGroupContextValues.ts"],"names":[],"mappings":";;;;;;;AAEO,MAAM,0BAA0B,GAAI,KAAD,IAAoD;AAC5F,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA,KAAR;AAAe,IAAA,YAAf;AAA6B,IAAA,QAA7B;AAAuC,IAAA,MAAvC;AAA+C,IAAA;AAA/C,MAA4D,KAAlE;AAEA,QAAM,UAAU,GAA2B;AACzC,IAAA,IADyC;AAEzC,IAAA,KAFyC;AAGzC,IAAA,YAHyC;AAIzC,IAAA,QAJyC;AAKzC,IAAA,MALyC;AAMzC,IAAA;AANyC,GAA3C;AASA,SAAO;AAAE,IAAA;AAAF,GAAP;AACD,CAbM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupState } from '../RadioGroup';\n\nexport const useRadioGroupContextValues = (state: RadioGroupState): RadioGroupContextValues => {\n const { name, value, defaultValue, disabled, layout, required } = state;\n\n const radioGroup: RadioGroupContextValue = {\n name,\n value,\n defaultValue,\n disabled,\n layout,\n required,\n };\n\n return { radioGroup };\n};\n"],"sourceRoot":"../src/"}
|
package/lib-commonjs/index.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
export { RadioGroup, radioGroupClassName, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable, } from './RadioGroup';
|
2
|
-
export type { RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState } from './RadioGroup';
|
2
|
+
export type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState, } from './RadioGroup';
|
3
3
|
export { Radio, radioClassName, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable, } from './Radio';
|
4
4
|
export type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';
|
5
|
-
export { RadioGroupContext } from './contexts/
|
6
|
-
export type { RadioGroupContextValue } from './contexts/RadioGroupContext';
|
5
|
+
export { RadioGroupContext, useRadioGroupContextValues } from './contexts/index';
|
package/lib-commonjs/index.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.RadioGroupContext = exports.useRadio_unstable = exports.useRadioStyles_unstable = exports.renderRadio_unstable = exports.radioClassNames = exports.radioClassName = exports.Radio = exports.useRadioGroup_unstable = exports.useRadioGroupStyles_unstable = exports.renderRadioGroup_unstable = exports.radioGroupClassNames = exports.radioGroupClassName = exports.RadioGroup = void 0;
|
6
|
+
exports.useRadioGroupContextValues = exports.RadioGroupContext = exports.useRadio_unstable = exports.useRadioStyles_unstable = exports.renderRadio_unstable = exports.radioClassNames = exports.radioClassName = exports.Radio = exports.useRadioGroup_unstable = exports.useRadioGroupStyles_unstable = exports.renderRadioGroup_unstable = exports.radioGroupClassNames = exports.radioGroupClassName = exports.RadioGroup = void 0;
|
7
7
|
|
8
8
|
var RadioGroup_1 = /*#__PURE__*/require("./RadioGroup");
|
9
9
|
|
@@ -87,12 +87,18 @@ Object.defineProperty(exports, "useRadio_unstable", {
|
|
87
87
|
}
|
88
88
|
});
|
89
89
|
|
90
|
-
var
|
90
|
+
var index_1 = /*#__PURE__*/require("./contexts/index");
|
91
91
|
|
92
92
|
Object.defineProperty(exports, "RadioGroupContext", {
|
93
93
|
enumerable: true,
|
94
94
|
get: function () {
|
95
|
-
return
|
95
|
+
return index_1.RadioGroupContext;
|
96
|
+
}
|
97
|
+
});
|
98
|
+
Object.defineProperty(exports, "useRadioGroupContextValues", {
|
99
|
+
enumerable: true,
|
100
|
+
get: function () {
|
101
|
+
return index_1.useRadioGroupContextValues;
|
96
102
|
}
|
97
103
|
});
|
98
104
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,YAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,UAAA;AAAU;AAAV,CAAA;AACA;;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,mBAAA;AAAmB;AAAnB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,sBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,oBAAA;AAAoB;AAApB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,yBAAA;AAAyB;AAAzB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,8BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,4BAAA;AAA4B;AAA5B,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,sBAAA;AAAsB;AAAtB,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,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,0BAAA;AAA0B;AAA1B,CAAA","sourcesContent":["export {\n RadioGroup,\n /* eslint-disable-next-line deprecation/deprecation */\n radioGroupClassName,\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 {\n Radio,\n /* eslint-disable-next-line deprecation/deprecation */\n radioClassName,\n radioClassNames,\n renderRadio_unstable,\n useRadioStyles_unstable,\n useRadio_unstable,\n} from './Radio';\nexport type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';\nexport { RadioGroupContext, useRadioGroupContextValues } from './contexts/index';\n"],"sourceRoot":"../src/"}
|
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-20220505-0419.1",
|
4
4
|
"description": "Fluent UI Radio component",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -21,21 +21,22 @@
|
|
21
21
|
"start": "yarn storybook",
|
22
22
|
"test": "jest --passWithNoTests",
|
23
23
|
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
24
|
-
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node
|
25
|
-
"storybook": "node
|
24
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/packages/react-components/react-radio/src && yarn docs",
|
25
|
+
"storybook": "node ../../../scripts/storybook/runner",
|
26
26
|
"type-check": "tsc -b tsconfig.json"
|
27
27
|
},
|
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-20220505-0419.1"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
+
"@fluentui/react-context-selector": "0.0.0-nightly-20220505-0419.1",
|
34
35
|
"@fluentui/react-icons": "^2.0.166-rc.3",
|
35
|
-
"@fluentui/react-label": "0.0.0-nightly-
|
36
|
-
"@fluentui/react-tabster": "0.0.0-nightly-
|
37
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
38
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
36
|
+
"@fluentui/react-label": "0.0.0-nightly-20220505-0419.1",
|
37
|
+
"@fluentui/react-tabster": "0.0.0-nightly-20220505-0419.1",
|
38
|
+
"@fluentui/react-theme": "0.0.0-nightly-20220505-0419.1",
|
39
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20220505-0419.1",
|
39
40
|
"@griffel/react": "1.0.3",
|
40
41
|
"tslib": "^2.1.0"
|
41
42
|
},
|