@fluentui/react-field 9.0.0-alpha.4 → 9.0.0-alpha.6
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +151 -1
- package/CHANGELOG.md +40 -2
- package/dist/index.d.ts +6 -0
- package/lib/components/Field/Field.types.js.map +1 -1
- package/lib/components/Field/useField.js +3 -2
- package/lib/components/Field/useField.js.map +1 -1
- package/lib/components/ProgressField/ProgressField.js +3 -1
- package/lib/components/ProgressField/ProgressField.js.map +1 -1
- package/lib-commonjs/components/Field/useField.js +3 -2
- package/lib-commonjs/components/Field/useField.js.map +1 -1
- package/lib-commonjs/components/ProgressField/ProgressField.js +3 -1
- package/lib-commonjs/components/ProgressField/ProgressField.js.map +1 -1
- package/package.json +21 -21
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,157 @@
|
|
2
2
|
"name": "@fluentui/react-field",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Tue, 25 Oct 2022 00:34:10 GMT",
|
6
|
+
"tag": "@fluentui/react-field_v9.0.0-alpha.6",
|
7
|
+
"version": "9.0.0-alpha.6",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "behowell@microsoft.com",
|
12
|
+
"package": "@fluentui/react-field",
|
13
|
+
"commit": "f9436f583d3c291921fe7a4531f69551096e758c",
|
14
|
+
"comment": "feat: Add support for validationState to ProgressField"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-field",
|
19
|
+
"comment": "Bump @fluentui/react-checkbox to v9.0.10",
|
20
|
+
"commit": "eef12b9ae58b64ff68576dc2d865b601e46c85b9"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-field",
|
25
|
+
"comment": "Bump @fluentui/react-input to v9.2.3",
|
26
|
+
"commit": "eef12b9ae58b64ff68576dc2d865b601e46c85b9"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-field",
|
31
|
+
"comment": "Bump @fluentui/react-progress to v9.0.0-alpha.3",
|
32
|
+
"commit": "eef12b9ae58b64ff68576dc2d865b601e46c85b9"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-field",
|
37
|
+
"comment": "Bump @fluentui/react-spinbutton to v9.0.6",
|
38
|
+
"commit": "eef12b9ae58b64ff68576dc2d865b601e46c85b9"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"date": "Thu, 20 Oct 2022 08:39:33 GMT",
|
45
|
+
"tag": "@fluentui/react-field_v9.0.0-alpha.5",
|
46
|
+
"version": "9.0.0-alpha.5",
|
47
|
+
"comments": {
|
48
|
+
"prerelease": [
|
49
|
+
{
|
50
|
+
"author": "mgodbolt@microsoft.com",
|
51
|
+
"package": "@fluentui/react-field",
|
52
|
+
"commit": "17096b3137d9d3e7c7443ddc3ce0738b2910a334",
|
53
|
+
"comment": "chore: Bump peer deps to support React 18"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"author": "olfedias@microsoft.com",
|
57
|
+
"package": "@fluentui/react-field",
|
58
|
+
"commit": "06865dada128321804646582f564ee86d835d174",
|
59
|
+
"comment": "chore: Update Griffel to latest version"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"author": "beachball",
|
63
|
+
"package": "@fluentui/react-field",
|
64
|
+
"comment": "Bump @fluentui/react-checkbox to v9.0.9",
|
65
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-field",
|
70
|
+
"comment": "Bump @fluentui/react-combobox to v9.0.0-beta.13",
|
71
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"author": "beachball",
|
75
|
+
"package": "@fluentui/react-field",
|
76
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.5",
|
77
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"author": "beachball",
|
81
|
+
"package": "@fluentui/react-field",
|
82
|
+
"comment": "Bump @fluentui/react-input to v9.2.2",
|
83
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"author": "beachball",
|
87
|
+
"package": "@fluentui/react-field",
|
88
|
+
"comment": "Bump @fluentui/react-label to v9.0.8",
|
89
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"author": "beachball",
|
93
|
+
"package": "@fluentui/react-field",
|
94
|
+
"comment": "Bump @fluentui/react-progress to v9.0.0-alpha.2",
|
95
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"author": "beachball",
|
99
|
+
"package": "@fluentui/react-field",
|
100
|
+
"comment": "Bump @fluentui/react-radio to v9.0.9",
|
101
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"author": "beachball",
|
105
|
+
"package": "@fluentui/react-field",
|
106
|
+
"comment": "Bump @fluentui/react-select to v9.0.0-beta.12",
|
107
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"author": "beachball",
|
111
|
+
"package": "@fluentui/react-field",
|
112
|
+
"comment": "Bump @fluentui/react-slider to v9.0.8",
|
113
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"author": "beachball",
|
117
|
+
"package": "@fluentui/react-field",
|
118
|
+
"comment": "Bump @fluentui/react-spinbutton to v9.0.5",
|
119
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
120
|
+
},
|
121
|
+
{
|
122
|
+
"author": "beachball",
|
123
|
+
"package": "@fluentui/react-field",
|
124
|
+
"comment": "Bump @fluentui/react-switch to v9.0.9",
|
125
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"author": "beachball",
|
129
|
+
"package": "@fluentui/react-field",
|
130
|
+
"comment": "Bump @fluentui/react-textarea to v9.1.3",
|
131
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
132
|
+
},
|
133
|
+
{
|
134
|
+
"author": "beachball",
|
135
|
+
"package": "@fluentui/react-field",
|
136
|
+
"comment": "Bump @fluentui/react-theme to v9.1.1",
|
137
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"author": "beachball",
|
141
|
+
"package": "@fluentui/react-field",
|
142
|
+
"comment": "Bump @fluentui/react-utilities to v9.1.2",
|
143
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"author": "beachball",
|
147
|
+
"package": "@fluentui/react-field",
|
148
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.16",
|
149
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
150
|
+
}
|
151
|
+
]
|
152
|
+
}
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"date": "Thu, 13 Oct 2022 11:02:50 GMT",
|
6
156
|
"tag": "@fluentui/react-field_v9.0.0-alpha.4",
|
7
157
|
"version": "9.0.0-alpha.4",
|
8
158
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,50 @@
|
|
1
1
|
# Change Log - @fluentui/react-field
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 25 Oct 2022 00:34:10 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-alpha.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.0.0-alpha.6)
|
8
|
+
|
9
|
+
Tue, 25 Oct 2022 00:34:10 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.5..@fluentui/react-field_v9.0.0-alpha.6)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- feat: Add support for validationState to ProgressField ([PR #25253](https://github.com/microsoft/fluentui/pull/25253) by behowell@microsoft.com)
|
15
|
+
- Bump @fluentui/react-checkbox to v9.0.10 ([PR #25363](https://github.com/microsoft/fluentui/pull/25363) by beachball)
|
16
|
+
- Bump @fluentui/react-input to v9.2.3 ([PR #25363](https://github.com/microsoft/fluentui/pull/25363) by beachball)
|
17
|
+
- Bump @fluentui/react-progress to v9.0.0-alpha.3 ([PR #25363](https://github.com/microsoft/fluentui/pull/25363) by beachball)
|
18
|
+
- Bump @fluentui/react-spinbutton to v9.0.6 ([PR #25363](https://github.com/microsoft/fluentui/pull/25363) by beachball)
|
19
|
+
|
20
|
+
## [9.0.0-alpha.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.0.0-alpha.5)
|
21
|
+
|
22
|
+
Thu, 20 Oct 2022 08:39:33 GMT
|
23
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.4..@fluentui/react-field_v9.0.0-alpha.5)
|
24
|
+
|
25
|
+
### Changes
|
26
|
+
|
27
|
+
- chore: Bump peer deps to support React 18 ([PR #24972](https://github.com/microsoft/fluentui/pull/24972) by mgodbolt@microsoft.com)
|
28
|
+
- chore: Update Griffel to latest version ([PR #25212](https://github.com/microsoft/fluentui/pull/25212) by olfedias@microsoft.com)
|
29
|
+
- Bump @fluentui/react-checkbox to v9.0.9 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
30
|
+
- Bump @fluentui/react-combobox to v9.0.0-beta.13 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
31
|
+
- Bump @fluentui/react-context-selector to v9.0.5 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
32
|
+
- Bump @fluentui/react-input to v9.2.2 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
33
|
+
- Bump @fluentui/react-label to v9.0.8 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
34
|
+
- Bump @fluentui/react-progress to v9.0.0-alpha.2 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
35
|
+
- Bump @fluentui/react-radio to v9.0.9 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
36
|
+
- Bump @fluentui/react-select to v9.0.0-beta.12 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
37
|
+
- Bump @fluentui/react-slider to v9.0.8 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
38
|
+
- Bump @fluentui/react-spinbutton to v9.0.5 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
39
|
+
- Bump @fluentui/react-switch to v9.0.9 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
40
|
+
- Bump @fluentui/react-textarea to v9.1.3 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
41
|
+
- Bump @fluentui/react-theme to v9.1.1 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
42
|
+
- Bump @fluentui/react-utilities to v9.1.2 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
43
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.16 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
44
|
+
|
7
45
|
## [9.0.0-alpha.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.0.0-alpha.4)
|
8
46
|
|
9
|
-
Thu, 13 Oct 2022
|
47
|
+
Thu, 13 Oct 2022 11:02:50 GMT
|
10
48
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.3..@fluentui/react-field_v9.0.0-alpha.4)
|
11
49
|
|
12
50
|
### Changes
|
package/dist/index.d.ts
CHANGED
@@ -73,6 +73,12 @@ export declare type FieldConfig<T extends FieldComponent> = {
|
|
73
73
|
* @default htmlFor
|
74
74
|
*/
|
75
75
|
labelConnection?: 'htmlFor' | 'aria-labelledby';
|
76
|
+
/**
|
77
|
+
* Should the aria-invalid and aria-errormessage attributes be set when validationState="error".
|
78
|
+
*
|
79
|
+
* @default true
|
80
|
+
*/
|
81
|
+
ariaInvalidOnError?: boolean;
|
76
82
|
};
|
77
83
|
|
78
84
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Field.types.js","sourceRoot":"../src/","sources":["components/Field/Field.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot, SlotClassNames } from '@fluentui/react-utilities';\nimport type { SlotComponent } from './SlotComponent.types';\n\n/**\n * The minimum requirement for a component used by Field.\n *\n * Note: the use of VoidFunctionComponent means that component is not *required* to have a children prop,\n * but it is still allowed to have a children prop.\n */\nexport type FieldComponent = React.VoidFunctionComponent<\n Pick<\n React.HTMLAttributes<HTMLElement>,\n 'id' | 'className' | 'style' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-errormessage'\n >\n>;\n\n/**\n * Slots added by Field\n */\nexport type FieldSlots<T extends FieldComponent> = {\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The underlying component wrapped by this field.\n */\n control: SlotComponent<T>;\n\n /**\n * The label associated with the field.\n */\n label?: Slot<typeof Label>;\n\n /**\n * A message about the validation state. The appearance of the `validationMessage` depends on `validationState`.\n */\n validationMessage?: Slot<'div'>;\n\n /**\n * The icon associated with the `validationMessage`. If the `validationState` prop is set, this will default to an\n * icon corresponding to that state.\n *\n * This will only be displayed if `validationMessage` is set.\n */\n validationMessageIcon?: Slot<'span'>;\n\n /**\n * Additional hint text below the field.\n */\n hint?: Slot<'div'>;\n};\n\n/**\n * Field Props\n */\nexport type FieldProps<T extends FieldComponent> = ComponentProps<Partial<FieldSlots<T>>, 'control'> & {\n /**\n * The orientation of the label relative to the field component.\n * This only affects the label, and not the validationMessage or hint (which always appear below the field component).\n *\n * @default vertical\n */\n orientation?: 'vertical' | 'horizontal';\n\n /**\n * The `validationState` affects the color of the `validationMessage`, the `validationMessageIcon`, and for some\n * field components, an `validationState=\"error\"` causes the border to become red.\n *\n * @default undefined\n */\n validationState?: 'error' | 'warning' | 'success';\n};\n\n/**\n * FieldProps plus extra optional props that are supported by useField_unstable, but not required to be part of the\n * API of every Field component.\n *\n * This allows Field to forward the required and size props to the label if the underlying component supports them,\n * but doesn't add them to the public API of fields that don't support them.\n */\nexport type FieldPropsWithOptionalComponentProps<T extends FieldComponent> = FieldProps<T> & {\n /**\n * Whether the field label should be marked as required.\n */\n required?: boolean;\n\n /**\n * Size of the field label.\n *\n * Number sizes will be ignored, but are allowed because the HTML `<input>` element has a prop `size?: number`.\n */\n size?: 'small' | 'medium' | 'large' | number;\n};\n\n/**\n * Configuration parameters for a Field class, passed to useField_unstable\n */\nexport type FieldConfig<T extends FieldComponent> = {\n /**\n * The underlying input component that this field is wrapping.\n */\n component: T;\n\n /**\n * Class names for this component, created by `getFieldClassNames`.\n */\n classNames: SlotClassNames<FieldSlots<T>>;\n\n /**\n * How the label be connected to the control.\n * * htmlFor - Set the Label's htmlFor prop to the component's ID (and generate an ID if not provided).\n * This is the preferred method for components that use the underlying <input> tag.\n * * aria-labelledby - Set the component's aria-labelledby prop to the Label's ID. Use this for components\n * that are not directly <input> elements (such as RadioGroup).\n *\n * @default htmlFor\n */\n labelConnection?: 'htmlFor' | 'aria-labelledby';\n};\n\n/**\n * State used in rendering Field\n */\nexport type FieldState<T extends FieldComponent> = ComponentState<Required<FieldSlots<T>>> &\n Pick<FieldProps<T>, 'orientation' | 'validationState'> & {\n classNames: SlotClassNames<FieldSlots<T>>;\n };\n"]}
|
1
|
+
{"version":3,"file":"Field.types.js","sourceRoot":"../src/","sources":["components/Field/Field.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot, SlotClassNames } from '@fluentui/react-utilities';\nimport type { SlotComponent } from './SlotComponent.types';\n\n/**\n * The minimum requirement for a component used by Field.\n *\n * Note: the use of VoidFunctionComponent means that component is not *required* to have a children prop,\n * but it is still allowed to have a children prop.\n */\nexport type FieldComponent = React.VoidFunctionComponent<\n Pick<\n React.HTMLAttributes<HTMLElement>,\n 'id' | 'className' | 'style' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-errormessage'\n >\n>;\n\n/**\n * Slots added by Field\n */\nexport type FieldSlots<T extends FieldComponent> = {\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The underlying component wrapped by this field.\n */\n control: SlotComponent<T>;\n\n /**\n * The label associated with the field.\n */\n label?: Slot<typeof Label>;\n\n /**\n * A message about the validation state. The appearance of the `validationMessage` depends on `validationState`.\n */\n validationMessage?: Slot<'div'>;\n\n /**\n * The icon associated with the `validationMessage`. If the `validationState` prop is set, this will default to an\n * icon corresponding to that state.\n *\n * This will only be displayed if `validationMessage` is set.\n */\n validationMessageIcon?: Slot<'span'>;\n\n /**\n * Additional hint text below the field.\n */\n hint?: Slot<'div'>;\n};\n\n/**\n * Field Props\n */\nexport type FieldProps<T extends FieldComponent> = ComponentProps<Partial<FieldSlots<T>>, 'control'> & {\n /**\n * The orientation of the label relative to the field component.\n * This only affects the label, and not the validationMessage or hint (which always appear below the field component).\n *\n * @default vertical\n */\n orientation?: 'vertical' | 'horizontal';\n\n /**\n * The `validationState` affects the color of the `validationMessage`, the `validationMessageIcon`, and for some\n * field components, an `validationState=\"error\"` causes the border to become red.\n *\n * @default undefined\n */\n validationState?: 'error' | 'warning' | 'success';\n};\n\n/**\n * FieldProps plus extra optional props that are supported by useField_unstable, but not required to be part of the\n * API of every Field component.\n *\n * This allows Field to forward the required and size props to the label if the underlying component supports them,\n * but doesn't add them to the public API of fields that don't support them.\n */\nexport type FieldPropsWithOptionalComponentProps<T extends FieldComponent> = FieldProps<T> & {\n /**\n * Whether the field label should be marked as required.\n */\n required?: boolean;\n\n /**\n * Size of the field label.\n *\n * Number sizes will be ignored, but are allowed because the HTML `<input>` element has a prop `size?: number`.\n */\n size?: 'small' | 'medium' | 'large' | number;\n};\n\n/**\n * Configuration parameters for a Field class, passed to useField_unstable\n */\nexport type FieldConfig<T extends FieldComponent> = {\n /**\n * The underlying input component that this field is wrapping.\n */\n component: T;\n\n /**\n * Class names for this component, created by `getFieldClassNames`.\n */\n classNames: SlotClassNames<FieldSlots<T>>;\n\n /**\n * How the label be connected to the control.\n * * htmlFor - Set the Label's htmlFor prop to the component's ID (and generate an ID if not provided).\n * This is the preferred method for components that use the underlying <input> tag.\n * * aria-labelledby - Set the component's aria-labelledby prop to the Label's ID. Use this for components\n * that are not directly <input> elements (such as RadioGroup).\n *\n * @default htmlFor\n */\n labelConnection?: 'htmlFor' | 'aria-labelledby';\n\n /**\n * Should the aria-invalid and aria-errormessage attributes be set when validationState=\"error\".\n *\n * @default true\n */\n ariaInvalidOnError?: boolean;\n};\n\n/**\n * State used in rendering Field\n */\nexport type FieldState<T extends FieldComponent> = ComponentState<Required<FieldSlots<T>>> &\n Pick<FieldProps<T>, 'orientation' | 'validationState'> & {\n classNames: SlotClassNames<FieldSlots<T>>;\n };\n"]}
|
@@ -59,7 +59,8 @@ export const useField_unstable = (props, ref, params) => {
|
|
59
59
|
validationState
|
60
60
|
} = fieldProps;
|
61
61
|
const {
|
62
|
-
labelConnection = 'htmlFor'
|
62
|
+
labelConnection = 'htmlFor',
|
63
|
+
ariaInvalidOnError = true
|
63
64
|
} = params;
|
64
65
|
const baseId = useId('field-');
|
65
66
|
const root = resolveShorthand(fieldProps.root, {
|
@@ -103,7 +104,7 @@ export const useField_unstable = (props, ref, params) => {
|
|
103
104
|
(_a = control['aria-labelledby']) !== null && _a !== void 0 ? _a : control['aria-labelledby'] = label.id;
|
104
105
|
}
|
105
106
|
|
106
|
-
if (validationState === 'error') {
|
107
|
+
if (validationState === 'error' && ariaInvalidOnError) {
|
107
108
|
(_b = control['aria-invalid']) !== null && _b !== void 0 ? _b : control['aria-invalid'] = true;
|
108
109
|
|
109
110
|
if (validationMessage) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Field/useField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,uBAAT,EAAkC,mBAAlC,EAAuD,eAAvD,QAA8E,uBAA9E;AACA,SAAS,KAAT,QAAsB,uBAAtB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AASA,MAAM,sBAAsB,GAAG;EAC7B,KAAK,eAAE,KAAA,CAAA,aAAA,CAAC,mBAAD,EAAoB,IAApB,CADsB;EAE7B,OAAO,eAAE,KAAA,CAAA,aAAA,CAAC,eAAD,EAAgB,IAAhB,CAFoB;EAG7B,OAAO,eAAE,KAAA,CAAA,aAAA,CAAC,uBAAD,EAAwB,IAAxB;AAHoB,CAA/B;AAMA;;AAEG;;AACH,OAAO,MAAM,wBAAwB,GAA8C,KAA3C,IAA2D;EACjG,MAAM;IACJ,SADI;IAEJ,OAFI;IAGJ,IAHI;IAIJ,KAJI;IAKJ,WALI;IAMJ,IANI;IAOJ,KAPI;IAQJ,iBARI;IASJ,qBATI;IAUJ,eAVI;IAWJ,GAAG;EAXC,IAYF,KAZJ;EAcA,MAAM,UAAU,GAAG;IACjB,SADiB;IAEj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AC,kBAAD,CAAP,MAA0B,IAA1B,IAA0B,EAAA,KAAA,KAAA,CAA1B,GAA0B,EAA1B,GAAA,OAAO,CAAC,kBAAD,CAAP,GAAgC,IAAI,CAAC,EAArC;IACD;EACF,CARD,MAQO;IACL;IACA,MAAM,WAAW,GAAG,iBAAiB,IAAI,IAAzC;;IACA,IAAI,WAAJ,EAAiB;MACf,CAAA,EAAA,GAAA,OAAO,CAAC,kBAAD,CAAP,MAA0B,IAA1B,IAA0B,EAAA,KAAA,KAAA,CAA1B,GAA0B,EAA1B,GAAA,OAAO,CAAC,kBAAD,CAAP,GAAgC,iBAAiB,IAAI,IAArB,GAA4B,GAAG,iBAAiB,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,EAA9D,GAAmE,WAAW,CAAC,EAA/G;IACD;EACF;;EAED,MAAM,KAAK,GAA+B;IACxC,WADwC;IAExC,eAFwC;IAGxC,UAAU,EAAE,MAAM,CAAC,UAHqB;IAIxC,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,OAAO,EAAE,MAAM,CAAC,SAFN;MAGV,KAAK,EAAE,KAHG;MAIV,iBAAiB,EAAE,KAJT;MAKV,qBAAqB,EAAE,MALb;MAMV,IAAI,EAAE;IANI,CAJ4B;IAYxC,IAZwC;IAaxC,OAbwC;IAcxC,KAdwC;IAexC,qBAfwC;IAgBxC,iBAhBwC;IAiBxC;EAjBwC,CAA1C;EAoBA,OAAO,KAAP;AACD,CA/FM","sourcesContent":["import * as React from 'react';\nimport { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport type {\n FieldComponent,\n FieldConfig,\n FieldProps,\n FieldPropsWithOptionalComponentProps,\n FieldState,\n} from './Field.types';\n\nconst validationMessageIcons = {\n error: <ErrorCircle12Filled />,\n warning: <Warning12Filled />,\n success: <CheckmarkCircle12Filled />,\n} as const;\n\n/**\n * Partition the props used by the Field itself, from the props that are passed to the underlying field component.\n */\nexport const getPartitionedFieldProps = <Props extends FieldProps<FieldComponent>>(props: Props) => {\n const {\n className,\n control,\n hint,\n label,\n orientation,\n root,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n ...restOfProps\n } = props;\n\n const fieldProps = {\n className,\n control,\n hint,\n label,\n orientation,\n root,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n };\n\n return [fieldProps, restOfProps] as const;\n};\n\n/**\n * Create the state required to render Field.\n *\n * The returned state can be modified with hooks such as useFieldStyles_unstable,\n * before being passed to renderField_unstable.\n *\n * @param props - Props passed to this field\n * @param ref - Ref to the control slot (primary slot)\n * @param params - Configuration parameters for this Field\n */\nexport const useField_unstable = <T extends FieldComponent>(\n props: FieldPropsWithOptionalComponentProps<T>,\n ref: React.Ref<HTMLElement>,\n params: FieldConfig<T>,\n): FieldState<T> => {\n const [fieldProps, controlProps] = getPartitionedFieldProps(props);\n const { orientation = 'vertical', validationState } = fieldProps;\n const { labelConnection = 'htmlFor', ariaInvalidOnError = true } = params;\n\n const baseId = useId('field-');\n\n const root = resolveShorthand(fieldProps.root, {\n required: true,\n defaultProps: getNativeElementProps('div', fieldProps),\n });\n\n const control = resolveShorthand(fieldProps.control, {\n required: true,\n defaultProps: {\n ref,\n id: baseId + '__control',\n ...controlProps,\n },\n });\n\n const label = resolveShorthand(fieldProps.label, {\n defaultProps: {\n id: baseId + '__label',\n required: controlProps.required,\n size: typeof controlProps.size === 'string' ? controlProps.size : undefined,\n htmlFor: labelConnection === 'htmlFor' ? control.id : undefined,\n },\n });\n\n const validationMessage = resolveShorthand(fieldProps.validationMessage, {\n defaultProps: {\n id: baseId + '__validationMessage',\n },\n });\n\n const hint = resolveShorthand(fieldProps.hint, {\n defaultProps: {\n id: baseId + '__hint',\n },\n });\n\n const validationMessageIcon = resolveShorthand(fieldProps.validationMessageIcon, {\n required: !!validationState,\n defaultProps: {\n children: validationState ? validationMessageIcons[validationState] : undefined,\n },\n });\n\n // Hook up aria props on the control\n if (label && labelConnection === 'aria-labelledby') {\n control['aria-labelledby'] ??= label.id;\n }\n\n if (validationState === 'error' && ariaInvalidOnError) {\n control['aria-invalid'] ??= true;\n if (validationMessage) {\n control['aria-errormessage'] ??= validationMessage.id;\n }\n if (hint) {\n control['aria-describedby'] ??= hint.id;\n }\n } else {\n // If the state is not an error, then the control is described by the validation message, or hint, or both\n const describedby = validationMessage || hint;\n if (describedby) {\n control['aria-describedby'] ??= validationMessage && hint ? `${validationMessage.id} ${hint.id}` : describedby.id;\n }\n }\n\n const state: FieldState<FieldComponent> = {\n orientation,\n validationState,\n classNames: params.classNames,\n components: {\n root: 'div',\n control: params.component,\n label: Label,\n validationMessage: 'div',\n validationMessageIcon: 'span',\n hint: 'div',\n },\n root,\n control,\n label,\n validationMessageIcon,\n validationMessage,\n hint,\n };\n\n return state as FieldState<T>;\n};\n"],"sourceRoot":"../src/"}
|
@@ -6,8 +6,10 @@ export const ProgressField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
6
|
const state = useField_unstable(props, ref, {
|
7
7
|
component: Progress,
|
8
8
|
classNames: progressFieldClassNames,
|
9
|
-
labelConnection: 'aria-labelledby'
|
9
|
+
labelConnection: 'aria-labelledby',
|
10
|
+
ariaInvalidOnError: false
|
10
11
|
});
|
12
|
+
state.control.validationState = state.validationState;
|
11
13
|
useFieldStyles_unstable(state);
|
12
14
|
return renderField_unstable(state);
|
13
15
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/ProgressField/ProgressField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,0BAAzB;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAIA,OAAO,MAAM,uBAAuB,gBAAG,kBAAkB,CAAC,eAAD,CAAlD;AAEP,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAC1C,SAAS,EAAE,QAD+B;IAE1C,UAAU,EAAE,uBAF8B;IAG1C,eAAe,EAAE;
|
1
|
+
{"version":3,"sources":["components/ProgressField/ProgressField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,0BAAzB;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAIA,OAAO,MAAM,uBAAuB,gBAAG,kBAAkB,CAAC,eAAD,CAAlD;AAEP,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAC1C,SAAS,EAAE,QAD+B;IAE1C,UAAU,EAAE,uBAF8B;IAG1C,eAAe,EAAE,iBAHyB;IAI1C,kBAAkB,EAAE;EAJsB,CAAb,CAA/B;EAMA,KAAK,CAAC,OAAN,CAAc,eAAd,GAAgC,KAAK,CAAC,eAAtC;EACA,uBAAuB,CAAC,KAAD,CAAvB;EACA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAVqE,CAA/D;AAYP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport { Progress } from '@fluentui/react-progress';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type ProgressFieldProps = FieldProps<typeof Progress>;\n\nexport const progressFieldClassNames = getFieldClassNames('ProgressField');\n\nexport const ProgressField: ForwardRefComponent<ProgressFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, {\n component: Progress,\n classNames: progressFieldClassNames,\n labelConnection: 'aria-labelledby',\n ariaInvalidOnError: false,\n });\n state.control.validationState = state.validationState;\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nProgressField.displayName = 'ProgressField';\n"],"sourceRoot":"../src/"}
|
@@ -72,7 +72,8 @@ const useField_unstable = (props, ref, params) => {
|
|
72
72
|
validationState
|
73
73
|
} = fieldProps;
|
74
74
|
const {
|
75
|
-
labelConnection = 'htmlFor'
|
75
|
+
labelConnection = 'htmlFor',
|
76
|
+
ariaInvalidOnError = true
|
76
77
|
} = params;
|
77
78
|
const baseId = react_utilities_1.useId('field-');
|
78
79
|
const root = react_utilities_1.resolveShorthand(fieldProps.root, {
|
@@ -116,7 +117,7 @@ const useField_unstable = (props, ref, params) => {
|
|
116
117
|
(_a = control['aria-labelledby']) !== null && _a !== void 0 ? _a : control['aria-labelledby'] = label.id;
|
117
118
|
}
|
118
119
|
|
119
|
-
if (validationState === 'error') {
|
120
|
+
if (validationState === 'error' && ariaInvalidOnError) {
|
120
121
|
(_b = control['aria-invalid']) !== null && _b !== void 0 ? _b : control['aria-invalid'] = true;
|
121
122
|
|
122
123
|
if (validationMessage) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Field/useField.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;;AASA,MAAM,sBAAsB,GAAG;EAC7B,KAAK,eAAE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,mBAAD,EAAoB,IAApB,CADsB;EAE7B,OAAO,eAAE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,eAAD,EAA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;MACV,IAAI,EAAE,KADI;MAEV,OAAO,EAAE,MAAM,CAAC,SAFN;MAGV,KAAK,EAAE,aAAA,CAAA,KAHG;MAIV,iBAAiB,EAAE,KAJT;MAKV,qBAAqB,EAAE,MALb;MAMV,IAAI,EAAE;IANI,CAJ4B;IAYxC,IAZwC;IAaxC,OAbwC;IAcxC,KAdwC;IAexC,qBAfwC;IAgBxC,iBAhBwC;IAiBxC;EAjBwC,CAA1C;EAoBA,OAAO,KAAP;AACD,CA/FM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport type {\n FieldComponent,\n FieldConfig,\n FieldProps,\n FieldPropsWithOptionalComponentProps,\n FieldState,\n} from './Field.types';\n\nconst validationMessageIcons = {\n error: <ErrorCircle12Filled />,\n warning: <Warning12Filled />,\n success: <CheckmarkCircle12Filled />,\n} as const;\n\n/**\n * Partition the props used by the Field itself, from the props that are passed to the underlying field component.\n */\nexport const getPartitionedFieldProps = <Props extends FieldProps<FieldComponent>>(props: Props) => {\n const {\n className,\n control,\n hint,\n label,\n orientation,\n root,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n ...restOfProps\n } = props;\n\n const fieldProps = {\n className,\n control,\n hint,\n label,\n orientation,\n root,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n };\n\n return [fieldProps, restOfProps] as const;\n};\n\n/**\n * Create the state required to render Field.\n *\n * The returned state can be modified with hooks such as useFieldStyles_unstable,\n * before being passed to renderField_unstable.\n *\n * @param props - Props passed to this field\n * @param ref - Ref to the control slot (primary slot)\n * @param params - Configuration parameters for this Field\n */\nexport const useField_unstable = <T extends FieldComponent>(\n props: FieldPropsWithOptionalComponentProps<T>,\n ref: React.Ref<HTMLElement>,\n params: FieldConfig<T>,\n): FieldState<T> => {\n const [fieldProps, controlProps] = getPartitionedFieldProps(props);\n const { orientation = 'vertical', validationState } = fieldProps;\n const { labelConnection = 'htmlFor', ariaInvalidOnError = true } = params;\n\n const baseId = useId('field-');\n\n const root = resolveShorthand(fieldProps.root, {\n required: true,\n defaultProps: getNativeElementProps('div', fieldProps),\n });\n\n const control = resolveShorthand(fieldProps.control, {\n required: true,\n defaultProps: {\n ref,\n id: baseId + '__control',\n ...controlProps,\n },\n });\n\n const label = resolveShorthand(fieldProps.label, {\n defaultProps: {\n id: baseId + '__label',\n required: controlProps.required,\n size: typeof controlProps.size === 'string' ? controlProps.size : undefined,\n htmlFor: labelConnection === 'htmlFor' ? control.id : undefined,\n },\n });\n\n const validationMessage = resolveShorthand(fieldProps.validationMessage, {\n defaultProps: {\n id: baseId + '__validationMessage',\n },\n });\n\n const hint = resolveShorthand(fieldProps.hint, {\n defaultProps: {\n id: baseId + '__hint',\n },\n });\n\n const validationMessageIcon = resolveShorthand(fieldProps.validationMessageIcon, {\n required: !!validationState,\n defaultProps: {\n children: validationState ? validationMessageIcons[validationState] : undefined,\n },\n });\n\n // Hook up aria props on the control\n if (label && labelConnection === 'aria-labelledby') {\n control['aria-labelledby'] ??= label.id;\n }\n\n if (validationState === 'error' && ariaInvalidOnError) {\n control['aria-invalid'] ??= true;\n if (validationMessage) {\n control['aria-errormessage'] ??= validationMessage.id;\n }\n if (hint) {\n control['aria-describedby'] ??= hint.id;\n }\n } else {\n // If the state is not an error, then the control is described by the validation message, or hint, or both\n const describedby = validationMessage || hint;\n if (describedby) {\n control['aria-describedby'] ??= validationMessage && hint ? `${validationMessage.id} ${hint.id}` : describedby.id;\n }\n }\n\n const state: FieldState<FieldComponent> = {\n orientation,\n validationState,\n classNames: params.classNames,\n components: {\n root: 'div',\n control: params.component,\n label: Label,\n validationMessage: 'div',\n validationMessageIcon: 'span',\n hint: 'div',\n },\n root,\n control,\n label,\n validationMessageIcon,\n validationMessage,\n hint,\n };\n\n return state as FieldState<T>;\n};\n"],"sourceRoot":"../src/"}
|
@@ -16,8 +16,10 @@ exports.ProgressField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
16
16
|
const state = Field_1.useField_unstable(props, ref, {
|
17
17
|
component: react_progress_1.Progress,
|
18
18
|
classNames: exports.progressFieldClassNames,
|
19
|
-
labelConnection: 'aria-labelledby'
|
19
|
+
labelConnection: 'aria-labelledby',
|
20
|
+
ariaInvalidOnError: false
|
20
21
|
});
|
22
|
+
state.control.validationState = state.validationState;
|
21
23
|
Field_1.useFieldStyles_unstable(state);
|
22
24
|
return Field_1.renderField_unstable(state);
|
23
25
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/ProgressField/ProgressField.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AAGA,MAAA,OAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AAIa,OAAA,CAAA,uBAAA,gBAA0B,OAAA,CAAA,kBAAA,CAAmB,eAAnB,CAA1B;AAEA,OAAA,CAAA,aAAA,gBAAyD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,OAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,EAA8B;IAC1C,SAAS,EAAE,gBAAA,CAAA,QAD+B;IAE1C,UAAU,EAAE,OAAA,CAAA,uBAF8B;IAG1C,eAAe,EAAE;
|
1
|
+
{"version":3,"sources":["components/ProgressField/ProgressField.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AAGA,MAAA,OAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AAIa,OAAA,CAAA,uBAAA,gBAA0B,OAAA,CAAA,kBAAA,CAAmB,eAAnB,CAA1B;AAEA,OAAA,CAAA,aAAA,gBAAyD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,OAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,EAA8B;IAC1C,SAAS,EAAE,gBAAA,CAAA,QAD+B;IAE1C,UAAU,EAAE,OAAA,CAAA,uBAF8B;IAG1C,eAAe,EAAE,iBAHyB;IAI1C,kBAAkB,EAAE;EAJsB,CAA9B,CAAd;EAMA,KAAK,CAAC,OAAN,CAAc,eAAd,GAAgC,KAAK,CAAC,eAAtC;EACA,OAAA,CAAA,uBAAA,CAAwB,KAAxB;EACA,OAAO,OAAA,CAAA,oBAAA,CAAqB,KAArB,CAAP;AACD,CAVqE,CAAzD;AAYb,OAAA,CAAA,aAAA,CAAc,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport { Progress } from '@fluentui/react-progress';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type ProgressFieldProps = FieldProps<typeof Progress>;\n\nexport const progressFieldClassNames = getFieldClassNames('ProgressField');\n\nexport const ProgressField: ForwardRefComponent<ProgressFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, {\n component: Progress,\n classNames: progressFieldClassNames,\n labelConnection: 'aria-labelledby',\n ariaInvalidOnError: false,\n });\n state.control.validationState = state.validationState;\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nProgressField.displayName = 'ProgressField';\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-field",
|
3
|
-
"version": "9.0.0-alpha.
|
3
|
+
"version": "9.0.0-alpha.6",
|
4
4
|
"description": "Fluent UI Field components",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -27,33 +27,33 @@
|
|
27
27
|
"devDependencies": {
|
28
28
|
"@fluentui/eslint-plugin": "*",
|
29
29
|
"@fluentui/react-conformance": "*",
|
30
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
30
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.16",
|
31
31
|
"@fluentui/scripts": "^1.0.0"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"@fluentui/react-checkbox": "^9.0.
|
35
|
-
"@fluentui/react-combobox": "^9.0.0-beta.
|
36
|
-
"@fluentui/react-context-selector": "^9.0.
|
34
|
+
"@fluentui/react-checkbox": "^9.0.10",
|
35
|
+
"@fluentui/react-combobox": "^9.0.0-beta.13",
|
36
|
+
"@fluentui/react-context-selector": "^9.0.5",
|
37
37
|
"@fluentui/react-icons": "^2.0.175",
|
38
|
-
"@fluentui/react-input": "^9.2.
|
39
|
-
"@fluentui/react-label": "^9.0.
|
40
|
-
"@fluentui/react-progress": "9.0.0-alpha.
|
41
|
-
"@fluentui/react-radio": "^9.0.
|
42
|
-
"@fluentui/react-select": "9.0.0-beta.
|
43
|
-
"@fluentui/react-slider": "^9.0.
|
44
|
-
"@fluentui/react-spinbutton": "^9.0.
|
45
|
-
"@fluentui/react-switch": "^9.0.
|
46
|
-
"@fluentui/react-textarea": "^9.1.
|
47
|
-
"@fluentui/react-theme": "^9.1.
|
48
|
-
"@fluentui/react-utilities": "^9.1.
|
49
|
-
"@griffel/react": "^1.4.
|
38
|
+
"@fluentui/react-input": "^9.2.3",
|
39
|
+
"@fluentui/react-label": "^9.0.8",
|
40
|
+
"@fluentui/react-progress": "9.0.0-alpha.3",
|
41
|
+
"@fluentui/react-radio": "^9.0.9",
|
42
|
+
"@fluentui/react-select": "9.0.0-beta.12",
|
43
|
+
"@fluentui/react-slider": "^9.0.8",
|
44
|
+
"@fluentui/react-spinbutton": "^9.0.6",
|
45
|
+
"@fluentui/react-switch": "^9.0.9",
|
46
|
+
"@fluentui/react-textarea": "^9.1.3",
|
47
|
+
"@fluentui/react-theme": "^9.1.1",
|
48
|
+
"@fluentui/react-utilities": "^9.1.2",
|
49
|
+
"@griffel/react": "^1.4.1",
|
50
50
|
"tslib": "^2.1.0"
|
51
51
|
},
|
52
52
|
"peerDependencies": {
|
53
|
-
"@types/react": ">=16.8.0 <
|
54
|
-
"@types/react-dom": ">=16.8.0 <
|
55
|
-
"react": ">=16.8.0 <
|
56
|
-
"react-dom": ">=16.8.0 <
|
53
|
+
"@types/react": ">=16.8.0 <19.0.0",
|
54
|
+
"@types/react-dom": ">=16.8.0 <19.0.0",
|
55
|
+
"react": ">=16.8.0 <19.0.0",
|
56
|
+
"react-dom": ">=16.8.0 <19.0.0"
|
57
57
|
},
|
58
58
|
"beachball": {
|
59
59
|
"disallowedChangeTypes": [
|