@fluentui/react-radio 9.0.0-beta.5 → 9.0.0-rc.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/CHANGELOG.json +192 -1
  2. package/CHANGELOG.md +61 -11
  3. package/README.md +4 -0
  4. package/dist/index.d.ts +11 -17
  5. package/{lib → dist}/tsdoc-metadata.json +0 -0
  6. package/lib/components/Radio/useRadio.js +1 -1
  7. package/lib/components/Radio/useRadio.js.map +1 -1
  8. package/lib/components/Radio/useRadioStyles.js +15 -23
  9. package/lib/components/Radio/useRadioStyles.js.map +1 -1
  10. package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -1
  11. package/lib/components/RadioGroup/useRadioGroupStyles.js +0 -5
  12. package/lib/components/RadioGroup/useRadioGroupStyles.js.map +1 -1
  13. package/lib/contexts/RadioGroupContext.js +3 -1
  14. package/lib/contexts/RadioGroupContext.js.map +1 -1
  15. package/lib/contexts/index.js +3 -0
  16. package/lib/contexts/index.js.map +1 -0
  17. package/lib/index.js +3 -7
  18. package/lib/index.js.map +1 -1
  19. package/lib-commonjs/components/Radio/useRadio.js +1 -1
  20. package/lib-commonjs/components/Radio/useRadio.js.map +1 -1
  21. package/lib-commonjs/components/Radio/useRadioStyles.js +16 -24
  22. package/lib-commonjs/components/Radio/useRadioStyles.js.map +1 -1
  23. package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.js +1 -6
  24. package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.js.map +1 -1
  25. package/lib-commonjs/contexts/RadioGroupContext.js +6 -1
  26. package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -1
  27. package/lib-commonjs/contexts/index.js +12 -0
  28. package/lib-commonjs/contexts/index.js.map +1 -0
  29. package/lib-commonjs/index.js +16 -20
  30. package/lib-commonjs/index.js.map +1 -1
  31. package/package.json +11 -11
  32. package/lib/Radio.d.ts +0 -1
  33. package/lib/RadioGroup.d.ts +0 -1
  34. package/lib/components/Radio/Radio.d.ts +0 -6
  35. package/lib/components/Radio/Radio.types.d.ts +0 -69
  36. package/lib/components/Radio/index.d.ts +0 -5
  37. package/lib/components/Radio/renderRadio.d.ts +0 -5
  38. package/lib/components/Radio/useRadio.d.ts +0 -12
  39. package/lib/components/Radio/useRadioStyles.d.ts +0 -11
  40. package/lib/components/RadioGroup/RadioGroup.d.ts +0 -6
  41. package/lib/components/RadioGroup/RadioGroup.types.d.ts +0 -63
  42. package/lib/components/RadioGroup/index.d.ts +0 -5
  43. package/lib/components/RadioGroup/renderRadioGroup.d.ts +0 -5
  44. package/lib/components/RadioGroup/useRadioGroup.d.ts +0 -12
  45. package/lib/components/RadioGroup/useRadioGroupStyles.d.ts +0 -11
  46. package/lib/contexts/RadioGroupContext.d.ts +0 -6
  47. package/lib/contexts/useRadioGroupContextValues.d.ts +0 -2
  48. package/lib/index.d.ts +0 -5
  49. package/lib-commonjs/Radio.d.ts +0 -1
  50. package/lib-commonjs/RadioGroup.d.ts +0 -1
  51. package/lib-commonjs/components/Radio/Radio.d.ts +0 -6
  52. package/lib-commonjs/components/Radio/Radio.types.d.ts +0 -69
  53. package/lib-commonjs/components/Radio/index.d.ts +0 -5
  54. package/lib-commonjs/components/Radio/renderRadio.d.ts +0 -5
  55. package/lib-commonjs/components/Radio/useRadio.d.ts +0 -12
  56. package/lib-commonjs/components/Radio/useRadioStyles.d.ts +0 -11
  57. package/lib-commonjs/components/RadioGroup/RadioGroup.d.ts +0 -6
  58. package/lib-commonjs/components/RadioGroup/RadioGroup.types.d.ts +0 -63
  59. package/lib-commonjs/components/RadioGroup/index.d.ts +0 -5
  60. package/lib-commonjs/components/RadioGroup/renderRadioGroup.d.ts +0 -5
  61. package/lib-commonjs/components/RadioGroup/useRadioGroup.d.ts +0 -12
  62. package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.d.ts +0 -11
  63. package/lib-commonjs/contexts/RadioGroupContext.d.ts +0 -6
  64. package/lib-commonjs/contexts/useRadioGroupContextValues.d.ts +0 -2
  65. package/lib-commonjs/index.d.ts +0 -5
@@ -1,63 +0,0 @@
1
- import * as React from 'react';
2
- import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
3
- export declare type RadioGroupSlots = {
4
- /**
5
- * The radio group root.
6
- */
7
- root: NonNullable<Slot<'div'>>;
8
- };
9
- export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {
10
- /**
11
- * The name of this radio group. This name is applied to all Radio items inside this group.
12
- *
13
- * If no name is provided, one will be generated so that all of the Radio items have the same name.
14
- */
15
- name?: string;
16
- /**
17
- * The selected Radio item in this group.
18
- *
19
- * This should be the `value` prop of one of the Radio items inside this group.
20
- */
21
- value?: string;
22
- /**
23
- * The default selected Radio item in this group.
24
- *
25
- * This should be the `value` prop of one of the Radio items inside this group.
26
- */
27
- defaultValue?: string;
28
- /**
29
- * Callback when the selected Radio item changes.
30
- */
31
- onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;
32
- /**
33
- * How the radio items are laid out in the group.
34
- *
35
- * @default vertical
36
- */
37
- layout?: 'vertical' | 'horizontal' | 'horizontalStacked';
38
- /**
39
- * Disable all Radio items in this group.
40
- */
41
- disabled?: boolean;
42
- /**
43
- * Require all Radio items in this group.
44
- */
45
- required?: boolean;
46
- };
47
- /**
48
- * Data for the onChange event for RadioGroup.
49
- */
50
- export declare type RadioGroupOnChangeData = {
51
- /**
52
- * The value of the newly selected Radio item.
53
- */
54
- value: string;
55
- };
56
- /**
57
- * State used in rendering RadioGroup
58
- */
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;
63
- };
@@ -1,5 +0,0 @@
1
- export * from './RadioGroup';
2
- export * from './RadioGroup.types';
3
- export * from './renderRadioGroup';
4
- export * from './useRadioGroup';
5
- export * from './useRadioGroupStyles';
@@ -1,5 +0,0 @@
1
- import { RadioGroupContextValues, RadioGroupState } from './RadioGroup.types';
2
- /**
3
- * Render the final JSX of RadioGroup
4
- */
5
- export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element;
@@ -1,12 +0,0 @@
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;
@@ -1,11 +0,0 @@
1
- import { RadioGroupSlots, RadioGroupState } from './RadioGroup.types';
2
- import type { SlotClassNames } from '@fluentui/react-utilities';
3
- /**
4
- * @deprecated Use `radioGroupClassNames.root` instead.
5
- */
6
- export declare const radioGroupClassName = "fui-RadioGroup";
7
- export declare const radioGroupClassNames: SlotClassNames<RadioGroupSlots>;
8
- /**
9
- * Apply styling to the RadioGroup slots based on the state
10
- */
11
- export declare const useRadioGroupStyles_unstable: (state: RadioGroupState) => void;
@@ -1,6 +0,0 @@
1
- import type { Context } from '@fluentui/react-context-selector';
2
- import type { RadioGroupContextValue } from '../RadioGroup';
3
- /**
4
- * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
5
- */
6
- export declare const RadioGroupContext: Context<RadioGroupContextValue>;
@@ -1,2 +0,0 @@
1
- import type { RadioGroupContextValues, RadioGroupState } from '../RadioGroup';
2
- export declare const useRadioGroupContextValues: (state: RadioGroupState) => RadioGroupContextValues;
package/lib/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { RadioGroup, radioGroupClassName, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable, } from './RadioGroup';
2
- export type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState, } from './RadioGroup';
3
- export { Radio, radioClassName, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable, } from './Radio';
4
- export type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';
5
- export { RadioGroupContext } from './contexts/RadioGroupContext';
@@ -1 +0,0 @@
1
- export * from './components/Radio/index';
@@ -1 +0,0 @@
1
- export * from './components/RadioGroup/index';
@@ -1,6 +0,0 @@
1
- import type { ForwardRefComponent } from '@fluentui/react-utilities';
2
- import type { RadioProps } from './Radio.types';
3
- /**
4
- * Radio component is a wrapper for a radio button with a label.
5
- */
6
- export declare const Radio: ForwardRefComponent<RadioProps>;
@@ -1,69 +0,0 @@
1
- import * as React from 'react';
2
- import { Label } from '@fluentui/react-label';
3
- import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
4
- export declare type RadioSlots = {
5
- /**
6
- * The root element of the Radio.
7
- *
8
- * The root slot receives the `className` and `style` specified directly on the `<Radio>`.
9
- * All other native props will be applied to the primary slot: `input`
10
- */
11
- root: NonNullable<Slot<'span'>>;
12
- /**
13
- * The Radio's label.
14
- */
15
- label: Slot<typeof Label>;
16
- /**
17
- * Hidden input that handles the radio's functionality.
18
- *
19
- * This is the PRIMARY slot: all native properties specified directly on `<Radio>` will be applied to this slot,
20
- * except `className` and `style`, which remain on the root slot.
21
- */
22
- input: NonNullable<Slot<'input'>>;
23
- /**
24
- * A circle outline, with a filled circle icon inside when the Radio is checked.
25
- */
26
- indicator: NonNullable<Slot<'div'>>;
27
- };
28
- /**
29
- * Radio Props
30
- */
31
- export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & {
32
- /**
33
- * The value of the RadioGroup when this Radio item is selected.
34
- */
35
- value?: string;
36
- /**
37
- * The position of the label relative to the radio indicator.
38
- *
39
- * This defaults to `after` unless the Radio is inside a RadioGroup with `layout="horizontalStacked"`,
40
- * in which case it defaults to `below`.
41
- *
42
- * @defaultvalue after
43
- */
44
- labelPosition?: 'after' | 'below';
45
- /**
46
- * Disable this Radio item.
47
- */
48
- disabled?: boolean;
49
- /**
50
- * Callback when this Radio is selected in its group.
51
- *
52
- * **Note:** `onChange` is NOT called when this Radio is deselected.
53
- * Use RadioGroup's `onChange` event to determine when the selection in the group changes.
54
- */
55
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: RadioOnChangeData) => void;
56
- };
57
- /**
58
- * Data for the onChange event for Radio.
59
- */
60
- export declare type RadioOnChangeData = {
61
- /**
62
- * The value prop of this Radio item.
63
- */
64
- value: string;
65
- };
66
- /**
67
- * State used in rendering Radio
68
- */
69
- export declare type RadioState = ComponentState<RadioSlots> & Required<Pick<RadioProps, 'labelPosition'>>;
@@ -1,5 +0,0 @@
1
- export * from './Radio';
2
- export * from './Radio.types';
3
- export * from './renderRadio';
4
- export * from './useRadio';
5
- export * from './useRadioStyles';
@@ -1,5 +0,0 @@
1
- import type { RadioState } from './Radio.types';
2
- /**
3
- * Render the final JSX of Radio
4
- */
5
- export declare const renderRadio_unstable: (state: RadioState) => JSX.Element;
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import type { RadioProps, RadioState } from './Radio.types';
3
- /**
4
- * Create the state required to render Radio.
5
- *
6
- * The returned state can be modified with hooks such as useRadioStyles_unstable,
7
- * before being passed to renderRadio_unstable.
8
- *
9
- * @param props - props from this instance of Radio
10
- * @param ref - reference to `<input>` element of Radio
11
- */
12
- export declare const useRadio_unstable: (props: RadioProps, ref: React.Ref<HTMLInputElement>) => RadioState;
@@ -1,11 +0,0 @@
1
- import type { RadioSlots, RadioState } from './Radio.types';
2
- import type { SlotClassNames } from '@fluentui/react-utilities';
3
- /**
4
- * @deprecated Use `radioClassNames.root` instead.
5
- */
6
- export declare const radioClassName = "fui-Radio";
7
- export declare const radioClassNames: SlotClassNames<RadioSlots>;
8
- /**
9
- * Apply styling to the Radio slots based on the state
10
- */
11
- export declare const useRadioStyles_unstable: (state: RadioState) => void;
@@ -1,6 +0,0 @@
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>;
@@ -1,63 +0,0 @@
1
- import * as React from 'react';
2
- import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
3
- export declare type RadioGroupSlots = {
4
- /**
5
- * The radio group root.
6
- */
7
- root: NonNullable<Slot<'div'>>;
8
- };
9
- export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {
10
- /**
11
- * The name of this radio group. This name is applied to all Radio items inside this group.
12
- *
13
- * If no name is provided, one will be generated so that all of the Radio items have the same name.
14
- */
15
- name?: string;
16
- /**
17
- * The selected Radio item in this group.
18
- *
19
- * This should be the `value` prop of one of the Radio items inside this group.
20
- */
21
- value?: string;
22
- /**
23
- * The default selected Radio item in this group.
24
- *
25
- * This should be the `value` prop of one of the Radio items inside this group.
26
- */
27
- defaultValue?: string;
28
- /**
29
- * Callback when the selected Radio item changes.
30
- */
31
- onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;
32
- /**
33
- * How the radio items are laid out in the group.
34
- *
35
- * @default vertical
36
- */
37
- layout?: 'vertical' | 'horizontal' | 'horizontalStacked';
38
- /**
39
- * Disable all Radio items in this group.
40
- */
41
- disabled?: boolean;
42
- /**
43
- * Require all Radio items in this group.
44
- */
45
- required?: boolean;
46
- };
47
- /**
48
- * Data for the onChange event for RadioGroup.
49
- */
50
- export declare type RadioGroupOnChangeData = {
51
- /**
52
- * The value of the newly selected Radio item.
53
- */
54
- value: string;
55
- };
56
- /**
57
- * State used in rendering RadioGroup
58
- */
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;
63
- };
@@ -1,5 +0,0 @@
1
- export * from './RadioGroup';
2
- export * from './RadioGroup.types';
3
- export * from './renderRadioGroup';
4
- export * from './useRadioGroup';
5
- export * from './useRadioGroupStyles';
@@ -1,5 +0,0 @@
1
- import { RadioGroupContextValues, RadioGroupState } from './RadioGroup.types';
2
- /**
3
- * Render the final JSX of RadioGroup
4
- */
5
- export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element;
@@ -1,12 +0,0 @@
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;
@@ -1,11 +0,0 @@
1
- import { RadioGroupSlots, RadioGroupState } from './RadioGroup.types';
2
- import type { SlotClassNames } from '@fluentui/react-utilities';
3
- /**
4
- * @deprecated Use `radioGroupClassNames.root` instead.
5
- */
6
- export declare const radioGroupClassName = "fui-RadioGroup";
7
- export declare const radioGroupClassNames: SlotClassNames<RadioGroupSlots>;
8
- /**
9
- * Apply styling to the RadioGroup slots based on the state
10
- */
11
- export declare const useRadioGroupStyles_unstable: (state: RadioGroupState) => void;
@@ -1,6 +0,0 @@
1
- import type { Context } from '@fluentui/react-context-selector';
2
- import type { RadioGroupContextValue } from '../RadioGroup';
3
- /**
4
- * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
5
- */
6
- export declare const RadioGroupContext: Context<RadioGroupContextValue>;
@@ -1,2 +0,0 @@
1
- import type { RadioGroupContextValues, RadioGroupState } from '../RadioGroup';
2
- export declare const useRadioGroupContextValues: (state: RadioGroupState) => RadioGroupContextValues;
@@ -1,5 +0,0 @@
1
- export { RadioGroup, radioGroupClassName, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable, } from './RadioGroup';
2
- export type { RadioGroupContextValue, RadioGroupContextValues, RadioGroupOnChangeData, RadioGroupProps, RadioGroupSlots, RadioGroupState, } from './RadioGroup';
3
- export { Radio, radioClassName, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable, } from './Radio';
4
- export type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';
5
- export { RadioGroupContext } from './contexts/RadioGroupContext';