@fluentui/react-radio
Advanced tools
Comparing version 0.0.0-nightly-20220503-0421.1 to 0.0.0-nightly-20220504-0420.1
@@ -5,5 +5,5 @@ { | ||
{ | ||
"date": "Tue, 03 May 2022 04:34:45 GMT", | ||
"tag": "@fluentui/react-radio_v0.0.0-nightly-20220503-0421.1", | ||
"version": "0.0.0-nightly-20220503-0421.1", | ||
"date": "Wed, 04 May 2022 04:33:36 GMT", | ||
"tag": "@fluentui/react-radio_v0.0.0-nightly-20220504-0420.1", | ||
"version": "0.0.0-nightly-20220504-0420.1", | ||
"comments": { | ||
@@ -18,4 +18,16 @@ "prerelease": [ | ||
{ | ||
"author": "miroslav.stastny@microsoft.com", | ||
"package": "@fluentui/react-radio", | ||
"commit": "3be7a89d9e9323780bba5b24d3bcc4342e1f1ec7", | ||
"comment": "Allow data argument on onChange" | ||
}, | ||
{ | ||
"author": "seanmonahan@microsoft.com", | ||
"package": "@fluentui/react-radio", | ||
"commit": "9132814df4b6d40d1f5d93d8324d756c1284b294", | ||
"comment": "react-radio: update context usage" | ||
}, | ||
{ | ||
"author": "seanmonahan@microsoft.com", | ||
"package": "@fluentui/react-radio", | ||
"commit": "8d990349b5af2d61057cccda2357412d2f5ab9b9", | ||
@@ -27,2 +39,14 @@ "comment": "add bundle size fixtures" | ||
"package": "@fluentui/react-radio", | ||
"commit": "6a017c3b1f2a282fa86c28b675e5ed34a1bb2aee", | ||
"comment": "react-radio: add required prop to RadioGroup" | ||
}, | ||
{ | ||
"author": "seanmonahan@microsoft.com", | ||
"package": "@fluentui/react-radio", | ||
"commit": "4bc1c43194cb9f44c5ad40ae43ab26556778157e", | ||
"comment": "react-radio: remove required indicator from label" | ||
}, | ||
{ | ||
"author": "seanmonahan@microsoft.com", | ||
"package": "@fluentui/react-radio", | ||
"commit": "5f27c51743f22f08741a75c2c10032a02afdf6fb", | ||
@@ -34,4 +58,4 @@ "comment": "write readme" | ||
"package": "@fluentui/react-radio", | ||
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20220503-0421.1", | ||
"commit": "0a280b0835179cafee6022280911ba42ab7baeac" | ||
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20220504-0420.1", | ||
"commit": "158bbd218038e21eb173d3fa7efa00c595be789c" | ||
}, | ||
@@ -41,4 +65,4 @@ { | ||
"package": "@fluentui/react-radio", | ||
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20220503-0421.1", | ||
"commit": "0a280b0835179cafee6022280911ba42ab7baeac" | ||
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20220504-0420.1", | ||
"commit": "158bbd218038e21eb173d3fa7efa00c595be789c" | ||
}, | ||
@@ -48,4 +72,4 @@ { | ||
"package": "@fluentui/react-radio", | ||
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20220503-0421.1", | ||
"commit": "0a280b0835179cafee6022280911ba42ab7baeac" | ||
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20220504-0420.1", | ||
"commit": "158bbd218038e21eb173d3fa7efa00c595be789c" | ||
}, | ||
@@ -55,4 +79,4 @@ { | ||
"package": "@fluentui/react-radio", | ||
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220503-0421.1", | ||
"commit": "0a280b0835179cafee6022280911ba42ab7baeac" | ||
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20220504-0420.1", | ||
"commit": "158bbd218038e21eb173d3fa7efa00c595be789c" | ||
}, | ||
@@ -62,4 +86,10 @@ { | ||
"package": "@fluentui/react-radio", | ||
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220503-0421.1", | ||
"commit": "0a280b0835179cafee6022280911ba42ab7baeac" | ||
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220504-0420.1", | ||
"commit": "158bbd218038e21eb173d3fa7efa00c595be789c" | ||
}, | ||
{ | ||
"author": "beachball", | ||
"package": "@fluentui/react-radio", | ||
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220504-0420.1", | ||
"commit": "158bbd218038e21eb173d3fa7efa00c595be789c" | ||
} | ||
@@ -66,0 +96,0 @@ ] |
# Change Log - @fluentui/react-radio | ||
This log was last generated on Tue, 03 May 2022 04:34:45 GMT and should not be manually modified. | ||
This log was last generated on Wed, 04 May 2022 04:33:36 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [0.0.0-nightly-20220503-0421.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v0.0.0-nightly-20220503-0421.1) | ||
## [0.0.0-nightly-20220504-0420.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v0.0.0-nightly-20220504-0420.1) | ||
Tue, 03 May 2022 04:34:45 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.4..@fluentui/react-radio_v0.0.0-nightly-20220503-0421.1) | ||
Wed, 04 May 2022 04:33:36 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.4..@fluentui/react-radio_v0.0.0-nightly-20220504-0420.1) | ||
@@ -15,9 +15,14 @@ ### Changes | ||
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by email not defined) | ||
- Allow data argument on onChange ([PR #22753](https://github.com/microsoft/fluentui/pull/22753) by miroslav.stastny@microsoft.com) | ||
- react-radio: update context usage ([PR #22803](https://github.com/microsoft/fluentui/pull/22803) by seanmonahan@microsoft.com) | ||
- add bundle size fixtures ([PR #22675](https://github.com/microsoft/fluentui/pull/22675) by seanmonahan@microsoft.com) | ||
- react-radio: add required prop to RadioGroup ([PR #22809](https://github.com/microsoft/fluentui/pull/22809) by seanmonahan@microsoft.com) | ||
- react-radio: remove required indicator from label ([PR #22782](https://github.com/microsoft/fluentui/pull/22782) by seanmonahan@microsoft.com) | ||
- write readme ([PR #22676](https://github.com/microsoft/fluentui/pull/22676) by seanmonahan@microsoft.com) | ||
- Bump @fluentui/react-label to v0.0.0-nightly-20220503-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/0a280b0835179cafee6022280911ba42ab7baeac) by beachball) | ||
- Bump @fluentui/react-tabster to v0.0.0-nightly-20220503-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/0a280b0835179cafee6022280911ba42ab7baeac) by beachball) | ||
- Bump @fluentui/react-theme to v0.0.0-nightly-20220503-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/0a280b0835179cafee6022280911ba42ab7baeac) by beachball) | ||
- Bump @fluentui/react-utilities to v0.0.0-nightly-20220503-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/0a280b0835179cafee6022280911ba42ab7baeac) by beachball) | ||
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220503-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/0a280b0835179cafee6022280911ba42ab7baeac) by beachball) | ||
- Bump @fluentui/react-context-selector to v0.0.0-nightly-20220504-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/158bbd218038e21eb173d3fa7efa00c595be789c) by beachball) | ||
- Bump @fluentui/react-label to v0.0.0-nightly-20220504-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/158bbd218038e21eb173d3fa7efa00c595be789c) by beachball) | ||
- Bump @fluentui/react-tabster to v0.0.0-nightly-20220504-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/158bbd218038e21eb173d3fa7efa00c595be789c) by beachball) | ||
- Bump @fluentui/react-theme to v0.0.0-nightly-20220504-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/158bbd218038e21eb173d3fa7efa00c595be789c) by beachball) | ||
- Bump @fluentui/react-utilities to v0.0.0-nightly-20220504-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/158bbd218038e21eb173d3fa7efa00c595be789c) by beachball) | ||
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220504-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/158bbd218038e21eb173d3fa7efa00c595be789c) by beachball) | ||
@@ -24,0 +29,0 @@ ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.4) |
import type { ComponentProps } from '@fluentui/react-utilities'; | ||
import type { ComponentState } from '@fluentui/react-utilities'; | ||
import type { Context } from '@fluentui/react-context-selector'; | ||
import type { ForwardRefComponent } from '@fluentui/react-utilities'; | ||
@@ -36,6 +37,10 @@ import { Label } from '@fluentui/react-label'; | ||
*/ | ||
export declare const RadioGroupContext: React_2.Context<RadioGroupContextValue>; | ||
export declare const RadioGroupContext: Context<RadioGroupContextValue>; | ||
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'layout' | 'value' | 'defaultValue' | 'disabled'>; | ||
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>; | ||
export declare type RadioGroupContextValues = { | ||
radioGroup: RadioGroupContextValue; | ||
}; | ||
/** | ||
@@ -77,3 +82,3 @@ * Data for the onChange event for RadioGroup. | ||
* | ||
* @defaultvalue vertical | ||
* @default vertical | ||
*/ | ||
@@ -85,2 +90,6 @@ layout?: 'vertical' | 'horizontal' | 'horizontalStacked'; | ||
disabled?: boolean; | ||
/** | ||
* Require all Radio items in this group. | ||
*/ | ||
required?: boolean; | ||
}; | ||
@@ -98,5 +107,3 @@ | ||
*/ | ||
export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & { | ||
context: RadioGroupContextValue; | ||
}; | ||
export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>; | ||
@@ -116,3 +123,3 @@ /** | ||
*/ | ||
export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'size'> & { | ||
export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & { | ||
/** | ||
@@ -182,3 +189,3 @@ * The value of the RadioGroup when this Radio item is selected. | ||
*/ | ||
export declare const renderRadioGroup_unstable: (state: RadioGroupState) => JSX.Element; | ||
export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element; | ||
@@ -185,0 +192,0 @@ /** |
@@ -31,3 +31,3 @@ import * as React from 'react'; | ||
*/ | ||
export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'size'> & { | ||
export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & { | ||
/** | ||
@@ -34,0 +34,0 @@ * The value of the RadioGroup when this Radio item is selected. |
@@ -17,2 +17,4 @@ "use strict"; | ||
const RadioGroupContext_1 = /*#__PURE__*/require("../../contexts/RadioGroupContext"); | ||
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector"); | ||
/** | ||
@@ -30,10 +32,15 @@ * Create the state required to render Radio. | ||
const useRadio_unstable = (props, ref) => { | ||
const group = React.useContext(RadioGroupContext_1.RadioGroupContext); | ||
const nameGroup = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.name); | ||
const value = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.value); | ||
const defaultValue = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.defaultValue); | ||
const disabledGroup = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.disabled); | ||
const layout = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.layout); | ||
const requiredGroup = react_context_selector_1.useContextSelector(RadioGroupContext_1.RadioGroupContext, ctx => ctx.required); | ||
const { | ||
name = group.name, | ||
checked = group.value !== undefined ? group.value === props.value : undefined, | ||
defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined, | ||
labelPosition = group.layout === 'horizontalStacked' ? 'below' : 'after', | ||
disabled = group.disabled, | ||
required, | ||
name = nameGroup, | ||
checked = value !== undefined ? value === props.value : undefined, | ||
defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined, | ||
labelPosition = layout === 'horizontalStacked' ? 'below' : 'after', | ||
disabled = disabledGroup, | ||
required = requiredGroup, | ||
onChange | ||
@@ -60,2 +67,3 @@ } = props; | ||
disabled, | ||
required, | ||
...nativeProps.primary | ||
@@ -70,4 +78,3 @@ } | ||
htmlFor: input.id, | ||
disabled, | ||
required | ||
disabled | ||
} | ||
@@ -74,0 +81,0 @@ }); |
@@ -15,2 +15,4 @@ "use strict"; | ||
const useRadioGroupStyles_1 = /*#__PURE__*/require("./useRadioGroupStyles"); | ||
const useRadioGroupContextValues_1 = /*#__PURE__*/require("../../contexts/useRadioGroupContextValues"); | ||
/** | ||
@@ -23,6 +25,7 @@ * A RadioGroup component presents a set of options where only one option can be selected. | ||
const state = useRadioGroup_1.useRadioGroup_unstable(props, ref); | ||
const contextValues = useRadioGroupContextValues_1.useRadioGroupContextValues(state); | ||
useRadioGroupStyles_1.useRadioGroupStyles_unstable(state); | ||
return renderRadioGroup_1.renderRadioGroup_unstable(state); | ||
return renderRadioGroup_1.renderRadioGroup_unstable(state, contextValues); | ||
}); | ||
exports.RadioGroup.displayName = 'RadioGroup'; | ||
//# sourceMappingURL=RadioGroup.js.map |
import * as React from 'react'; | ||
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; | ||
import { RadioGroupContextValue } from '../../contexts/RadioGroupContext'; | ||
export declare type RadioGroupSlots = { | ||
@@ -36,3 +35,3 @@ /** | ||
* | ||
* @defaultvalue vertical | ||
* @default vertical | ||
*/ | ||
@@ -44,2 +43,6 @@ layout?: 'vertical' | 'horizontal' | 'horizontalStacked'; | ||
disabled?: boolean; | ||
/** | ||
* Require all Radio items in this group. | ||
*/ | ||
required?: boolean; | ||
}; | ||
@@ -58,4 +61,6 @@ /** | ||
*/ | ||
export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & { | ||
context: RadioGroupContextValue; | ||
export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>; | ||
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>; | ||
export declare type RadioGroupContextValues = { | ||
radioGroup: RadioGroupContextValue; | ||
}; |
@@ -1,5 +0,5 @@ | ||
import { RadioGroupState } from './RadioGroup.types'; | ||
import { RadioGroupContextValues, RadioGroupState } from './RadioGroup.types'; | ||
/** | ||
* Render the final JSX of RadioGroup | ||
*/ | ||
export declare const renderRadioGroup_unstable: (state: RadioGroupState) => JSX.Element; | ||
export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element; |
@@ -18,3 +18,3 @@ "use strict"; | ||
const renderRadioGroup_unstable = state => { | ||
const renderRadioGroup_unstable = (state, contextValues) => { | ||
const { | ||
@@ -25,3 +25,3 @@ slots, | ||
return React.createElement(RadioGroupContext_1.RadioGroupContext.Provider, { | ||
value: state.context | ||
value: contextValues.radioGroup | ||
}, React.createElement(slots.root, { ...slotProps.root | ||
@@ -28,0 +28,0 @@ })); |
@@ -8,4 +8,2 @@ "use strict"; | ||
const React = /*#__PURE__*/require("react"); | ||
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities"); | ||
@@ -31,13 +29,12 @@ /** | ||
layout = 'vertical', | ||
onChange | ||
onChange, | ||
required | ||
} = props; | ||
return { | ||
layout, | ||
context: React.useMemo(() => ({ | ||
name, | ||
value, | ||
defaultValue, | ||
disabled, | ||
layout | ||
}), [name, layout, value, defaultValue, disabled]), | ||
name, | ||
value, | ||
defaultValue, | ||
disabled, | ||
required, | ||
components: { | ||
@@ -44,0 +41,0 @@ root: 'div' |
@@ -1,7 +0,6 @@ | ||
import * as React from 'react'; | ||
import { RadioGroupProps } from '../RadioGroup'; | ||
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'layout' | 'value' | 'defaultValue' | 'disabled'>; | ||
import type { Context } from '@fluentui/react-context-selector'; | ||
import type { RadioGroupContextValue } from '../RadioGroup'; | ||
/** | ||
* RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props. | ||
*/ | ||
export declare const RadioGroupContext: React.Context<RadioGroupContextValue>; | ||
export declare const RadioGroupContext: Context<RadioGroupContextValue>; |
@@ -8,3 +8,3 @@ "use strict"; | ||
const React = /*#__PURE__*/require("react"); | ||
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector"); | ||
/** | ||
@@ -15,3 +15,3 @@ * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props. | ||
exports.RadioGroupContext = /*#__PURE__*/React.createContext({}); | ||
exports.RadioGroupContext = /*#__PURE__*/react_context_selector_1.createContext({}); | ||
//# sourceMappingURL=RadioGroupContext.js.map |
export { RadioGroup, radioGroupClassName, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable, } from './RadioGroup'; | ||
export type { RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState } from './RadioGroup'; | ||
export type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState, } from './RadioGroup'; | ||
export { Radio, radioClassName, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable, } from './Radio'; | ||
export type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio'; | ||
export { RadioGroupContext } from './contexts/RadioGroupContext'; | ||
export type { RadioGroupContextValue } from './contexts/RadioGroupContext'; |
@@ -31,3 +31,3 @@ import * as React from 'react'; | ||
*/ | ||
export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'size'> & { | ||
export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & { | ||
/** | ||
@@ -34,0 +34,0 @@ * The value of the RadioGroup when this Radio item is selected. |
@@ -6,2 +6,3 @@ import * as React from 'react'; | ||
import { RadioGroupContext } from '../../contexts/RadioGroupContext'; | ||
import { useContextSelector } from '@fluentui/react-context-selector'; | ||
/** | ||
@@ -18,10 +19,15 @@ * Create the state required to render Radio. | ||
export const useRadio_unstable = (props, ref) => { | ||
const group = React.useContext(RadioGroupContext); | ||
const nameGroup = useContextSelector(RadioGroupContext, ctx => ctx.name); | ||
const value = useContextSelector(RadioGroupContext, ctx => ctx.value); | ||
const defaultValue = useContextSelector(RadioGroupContext, ctx => ctx.defaultValue); | ||
const disabledGroup = useContextSelector(RadioGroupContext, ctx => ctx.disabled); | ||
const layout = useContextSelector(RadioGroupContext, ctx => ctx.layout); | ||
const requiredGroup = useContextSelector(RadioGroupContext, ctx => ctx.required); | ||
const { | ||
name = group.name, | ||
checked = group.value !== undefined ? group.value === props.value : undefined, | ||
defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined, | ||
labelPosition = group.layout === 'horizontalStacked' ? 'below' : 'after', | ||
disabled = group.disabled, | ||
required, | ||
name = nameGroup, | ||
checked = value !== undefined ? value === props.value : undefined, | ||
defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined, | ||
labelPosition = layout === 'horizontalStacked' ? 'below' : 'after', | ||
disabled = disabledGroup, | ||
required = requiredGroup, | ||
onChange | ||
@@ -48,2 +54,3 @@ } = props; | ||
disabled, | ||
required, | ||
...nativeProps.primary | ||
@@ -58,4 +65,3 @@ } | ||
htmlFor: input.id, | ||
disabled, | ||
required | ||
disabled | ||
} | ||
@@ -62,0 +68,0 @@ }); |
@@ -5,2 +5,3 @@ import * as React from 'react'; | ||
import { useRadioGroupStyles_unstable } from './useRadioGroupStyles'; | ||
import { useRadioGroupContextValues } from '../../contexts/useRadioGroupContextValues'; | ||
/** | ||
@@ -12,6 +13,7 @@ * A RadioGroup component presents a set of options where only one option can be selected. | ||
const state = useRadioGroup_unstable(props, ref); | ||
const contextValues = useRadioGroupContextValues(state); | ||
useRadioGroupStyles_unstable(state); | ||
return renderRadioGroup_unstable(state); | ||
return renderRadioGroup_unstable(state, contextValues); | ||
}); | ||
RadioGroup.displayName = 'RadioGroup'; | ||
//# sourceMappingURL=RadioGroup.js.map |
import * as React from 'react'; | ||
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; | ||
import { RadioGroupContextValue } from '../../contexts/RadioGroupContext'; | ||
export declare type RadioGroupSlots = { | ||
@@ -36,3 +35,3 @@ /** | ||
* | ||
* @defaultvalue vertical | ||
* @default vertical | ||
*/ | ||
@@ -44,2 +43,6 @@ layout?: 'vertical' | 'horizontal' | 'horizontalStacked'; | ||
disabled?: boolean; | ||
/** | ||
* Require all Radio items in this group. | ||
*/ | ||
required?: boolean; | ||
}; | ||
@@ -58,4 +61,6 @@ /** | ||
*/ | ||
export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & { | ||
context: RadioGroupContextValue; | ||
export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>; | ||
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>; | ||
export declare type RadioGroupContextValues = { | ||
radioGroup: RadioGroupContextValue; | ||
}; |
@@ -1,5 +0,5 @@ | ||
import { RadioGroupState } from './RadioGroup.types'; | ||
import { RadioGroupContextValues, RadioGroupState } from './RadioGroup.types'; | ||
/** | ||
* Render the final JSX of RadioGroup | ||
*/ | ||
export declare const renderRadioGroup_unstable: (state: RadioGroupState) => JSX.Element; | ||
export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element; |
@@ -8,3 +8,3 @@ import * as React from 'react'; | ||
export const renderRadioGroup_unstable = state => { | ||
export const renderRadioGroup_unstable = (state, contextValues) => { | ||
const { | ||
@@ -15,3 +15,3 @@ slots, | ||
return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, { | ||
value: state.context | ||
value: contextValues.radioGroup | ||
}, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root | ||
@@ -18,0 +18,0 @@ })); |
@@ -1,2 +0,1 @@ | ||
import * as React from 'react'; | ||
import { getNativeElementProps, useEventCallback, useId } from '@fluentui/react-utilities'; | ||
@@ -21,13 +20,12 @@ /** | ||
layout = 'vertical', | ||
onChange | ||
onChange, | ||
required | ||
} = props; | ||
return { | ||
layout, | ||
context: React.useMemo(() => ({ | ||
name, | ||
value, | ||
defaultValue, | ||
disabled, | ||
layout | ||
}), [name, layout, value, defaultValue, disabled]), | ||
name, | ||
value, | ||
defaultValue, | ||
disabled, | ||
required, | ||
components: { | ||
@@ -34,0 +32,0 @@ root: 'div' |
@@ -1,7 +0,6 @@ | ||
import * as React from 'react'; | ||
import { RadioGroupProps } from '../RadioGroup'; | ||
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'layout' | 'value' | 'defaultValue' | 'disabled'>; | ||
import type { Context } from '@fluentui/react-context-selector'; | ||
import type { RadioGroupContextValue } from '../RadioGroup'; | ||
/** | ||
* RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props. | ||
*/ | ||
export declare const RadioGroupContext: React.Context<RadioGroupContextValue>; | ||
export declare const RadioGroupContext: Context<RadioGroupContextValue>; |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
import { createContext } from '@fluentui/react-context-selector'; | ||
/** | ||
@@ -6,3 +6,3 @@ * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props. | ||
export const RadioGroupContext = /*#__PURE__*/React.createContext({}); | ||
export const RadioGroupContext = /*#__PURE__*/createContext({}); | ||
//# sourceMappingURL=RadioGroupContext.js.map |
export { RadioGroup, radioGroupClassName, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable, } from './RadioGroup'; | ||
export type { RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState } from './RadioGroup'; | ||
export type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState, } from './RadioGroup'; | ||
export { Radio, radioClassName, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable, } from './Radio'; | ||
export type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio'; | ||
export { RadioGroupContext } from './contexts/RadioGroupContext'; | ||
export type { RadioGroupContextValue } from './contexts/RadioGroupContext'; |
{ | ||
"name": "@fluentui/react-radio", | ||
"version": "0.0.0-nightly-20220503-0421.1", | ||
"version": "0.0.0-nightly-20220504-0420.1", | ||
"description": "Fluent UI Radio component", | ||
@@ -31,10 +31,11 @@ "main": "lib-commonjs/index.js", | ||
"@fluentui/react-conformance": "*", | ||
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20220503-0421.1" | ||
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20220504-0420.1" | ||
}, | ||
"dependencies": { | ||
"@fluentui/react-context-selector": "0.0.0-nightly-20220504-0420.1", | ||
"@fluentui/react-icons": "^2.0.166-rc.3", | ||
"@fluentui/react-label": "0.0.0-nightly-20220503-0421.1", | ||
"@fluentui/react-tabster": "0.0.0-nightly-20220503-0421.1", | ||
"@fluentui/react-theme": "0.0.0-nightly-20220503-0421.1", | ||
"@fluentui/react-utilities": "0.0.0-nightly-20220503-0421.1", | ||
"@fluentui/react-label": "0.0.0-nightly-20220504-0420.1", | ||
"@fluentui/react-tabster": "0.0.0-nightly-20220504-0420.1", | ||
"@fluentui/react-theme": "0.0.0-nightly-20220504-0420.1", | ||
"@fluentui/react-utilities": "0.0.0-nightly-20220504-0420.1", | ||
"@griffel/react": "1.0.3", | ||
@@ -41,0 +42,0 @@ "tslib": "^2.1.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192546
110
2274
12
+ Added@fluentui/react-context-selector@0.0.0-nightly-20220504-0420.1
+ Added@fluentui/keyboard-keys@0.0.0-nightly-20220504-0420.1(transitive)
+ Added@fluentui/react-context-selector@0.0.0-nightly-20220504-0420.1(transitive)
+ Added@fluentui/react-label@0.0.0-nightly-20220504-0420.1(transitive)
+ Added@fluentui/react-shared-contexts@0.0.0-nightly-20220504-0420.1(transitive)
+ Added@fluentui/react-tabster@0.0.0-nightly-20220504-0420.1(transitive)
+ Added@fluentui/react-theme@0.0.0-nightly-20220504-0420.1(transitive)
+ Added@fluentui/react-utilities@0.0.0-nightly-20220504-0420.1(transitive)
- Removed@fluentui/keyboard-keys@0.0.0-nightly-20220503-0421.1(transitive)
- Removed@fluentui/react-label@0.0.0-nightly-20220503-0421.1(transitive)
- Removed@fluentui/react-shared-contexts@0.0.0-nightly-20220503-0421.1(transitive)
- Removed@fluentui/react-tabster@0.0.0-nightly-20220503-0421.1(transitive)
- Removed@fluentui/react-theme@0.0.0-nightly-20220503-0421.1(transitive)
- Removed@fluentui/react-utilities@0.0.0-nightly-20220503-0421.1(transitive)
Updated@fluentui/react-tabster@0.0.0-nightly-20220504-0420.1
Updated@fluentui/react-utilities@0.0.0-nightly-20220504-0420.1