@fluentui/react-field 9.0.0-alpha.7 → 9.0.0-alpha.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +93 -1
- package/CHANGELOG.md +29 -2
- package/dist/index.d.ts +18 -100
- package/lib/Field.js.map +1 -1
- package/lib/components/Field/Field.types.js.map +1 -1
- package/lib/components/Field/SlotComponent.types.js.map +1 -1
- package/lib/components/Field/index.js.map +1 -1
- package/lib/components/Field/renderField.js.map +1 -1
- package/lib/components/Field/useField.js.map +1 -1
- package/lib/components/Field/useFieldStyles.js +1 -1
- package/lib/components/Field/useFieldStyles.js.map +1 -1
- package/lib/index.js +0 -10
- package/lib/index.js.map +1 -1
- package/lib-amd/Field.js +6 -0
- package/lib-amd/Field.js.map +1 -0
- package/lib-amd/components/Field/Field.types.js +5 -0
- package/lib-amd/components/Field/Field.types.js.map +1 -0
- package/lib-amd/components/Field/SlotComponent.types.js +5 -0
- package/lib-amd/components/Field/SlotComponent.types.js.map +1 -0
- package/lib-amd/components/Field/index.js +9 -0
- package/lib-amd/components/Field/index.js.map +1 -0
- package/lib-amd/components/Field/renderField.js +20 -0
- package/lib-amd/components/Field/renderField.js.map +1 -0
- package/lib-amd/components/Field/useField.js +121 -0
- package/lib-amd/components/Field/useField.js.map +1 -0
- package/lib-amd/components/Field/useFieldStyles.js +97 -0
- package/lib-amd/components/Field/useFieldStyles.js.map +1 -0
- package/lib-amd/index.js +10 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-commonjs/Field.js.map +1 -1
- package/lib-commonjs/components/Field/index.js.map +1 -1
- package/lib-commonjs/components/Field/renderField.js.map +1 -1
- package/lib-commonjs/components/Field/useField.js.map +1 -1
- package/lib-commonjs/components/Field/useFieldStyles.js +2 -2
- package/lib-commonjs/components/Field/useFieldStyles.js.map +1 -1
- package/lib-commonjs/index.js +1 -151
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +17 -20
- package/lib/CheckboxField.js +0 -2
- package/lib/CheckboxField.js.map +0 -1
- package/lib/ComboboxField.js +0 -2
- package/lib/ComboboxField.js.map +0 -1
- package/lib/InputField.js +0 -2
- package/lib/InputField.js.map +0 -1
- package/lib/ProgressField.js +0 -2
- package/lib/ProgressField.js.map +0 -1
- package/lib/RadioGroupField.js +0 -2
- package/lib/RadioGroupField.js.map +0 -1
- package/lib/SelectField.js +0 -2
- package/lib/SelectField.js.map +0 -1
- package/lib/SliderField.js +0 -2
- package/lib/SliderField.js.map +0 -1
- package/lib/SpinButtonField.js +0 -2
- package/lib/SpinButtonField.js.map +0 -1
- package/lib/SwitchField.js +0 -2
- package/lib/SwitchField.js.map +0 -1
- package/lib/TextareaField.js +0 -2
- package/lib/TextareaField.js.map +0 -1
- package/lib/components/CheckboxField/CheckboxField.js +0 -32
- package/lib/components/CheckboxField/CheckboxField.js.map +0 -1
- package/lib/components/CheckboxField/index.js +0 -2
- package/lib/components/CheckboxField/index.js.map +0 -1
- package/lib/components/ComboboxField/ComboboxField.js +0 -14
- package/lib/components/ComboboxField/ComboboxField.js.map +0 -1
- package/lib/components/ComboboxField/index.js +0 -2
- package/lib/components/ComboboxField/index.js.map +0 -1
- package/lib/components/InputField/InputField.js +0 -14
- package/lib/components/InputField/InputField.js.map +0 -1
- package/lib/components/InputField/index.js +0 -2
- package/lib/components/InputField/index.js.map +0 -1
- package/lib/components/ProgressField/ProgressField.js +0 -17
- package/lib/components/ProgressField/ProgressField.js.map +0 -1
- package/lib/components/ProgressField/index.js +0 -2
- package/lib/components/ProgressField/index.js.map +0 -1
- package/lib/components/RadioGroupField/RadioGroupField.js +0 -15
- package/lib/components/RadioGroupField/RadioGroupField.js.map +0 -1
- package/lib/components/RadioGroupField/index.js +0 -2
- package/lib/components/RadioGroupField/index.js.map +0 -1
- package/lib/components/SelectField/SelectField.js +0 -14
- package/lib/components/SelectField/SelectField.js.map +0 -1
- package/lib/components/SelectField/index.js +0 -2
- package/lib/components/SelectField/index.js.map +0 -1
- package/lib/components/SliderField/SliderField.js +0 -14
- package/lib/components/SliderField/SliderField.js.map +0 -1
- package/lib/components/SliderField/index.js +0 -2
- package/lib/components/SliderField/index.js.map +0 -1
- package/lib/components/SpinButtonField/SpinButtonField.js +0 -14
- package/lib/components/SpinButtonField/SpinButtonField.js.map +0 -1
- package/lib/components/SpinButtonField/index.js +0 -2
- package/lib/components/SpinButtonField/index.js.map +0 -1
- package/lib/components/SwitchField/SwitchField.js +0 -14
- package/lib/components/SwitchField/SwitchField.js.map +0 -1
- package/lib/components/SwitchField/index.js +0 -2
- package/lib/components/SwitchField/index.js.map +0 -1
- package/lib/components/TextareaField/TextareaField.js +0 -14
- package/lib/components/TextareaField/TextareaField.js.map +0 -1
- package/lib/components/TextareaField/index.js +0 -2
- package/lib/components/TextareaField/index.js.map +0 -1
- package/lib-commonjs/CheckboxField.js +0 -10
- package/lib-commonjs/CheckboxField.js.map +0 -1
- package/lib-commonjs/ComboboxField.js +0 -10
- package/lib-commonjs/ComboboxField.js.map +0 -1
- package/lib-commonjs/InputField.js +0 -10
- package/lib-commonjs/InputField.js.map +0 -1
- package/lib-commonjs/ProgressField.js +0 -10
- package/lib-commonjs/ProgressField.js.map +0 -1
- package/lib-commonjs/RadioGroupField.js +0 -10
- package/lib-commonjs/RadioGroupField.js.map +0 -1
- package/lib-commonjs/SelectField.js +0 -10
- package/lib-commonjs/SelectField.js.map +0 -1
- package/lib-commonjs/SliderField.js +0 -10
- package/lib-commonjs/SliderField.js.map +0 -1
- package/lib-commonjs/SpinButtonField.js +0 -10
- package/lib-commonjs/SpinButtonField.js.map +0 -1
- package/lib-commonjs/SwitchField.js +0 -10
- package/lib-commonjs/SwitchField.js.map +0 -1
- package/lib-commonjs/TextareaField.js +0 -10
- package/lib-commonjs/TextareaField.js.map +0 -1
- package/lib-commonjs/components/CheckboxField/CheckboxField.js +0 -42
- package/lib-commonjs/components/CheckboxField/CheckboxField.js.map +0 -1
- package/lib-commonjs/components/CheckboxField/index.js +0 -10
- package/lib-commonjs/components/CheckboxField/index.js.map +0 -1
- package/lib-commonjs/components/ComboboxField/ComboboxField.js +0 -24
- package/lib-commonjs/components/ComboboxField/ComboboxField.js.map +0 -1
- package/lib-commonjs/components/ComboboxField/index.js +0 -10
- package/lib-commonjs/components/ComboboxField/index.js.map +0 -1
- package/lib-commonjs/components/InputField/InputField.js +0 -24
- package/lib-commonjs/components/InputField/InputField.js.map +0 -1
- package/lib-commonjs/components/InputField/index.js +0 -10
- package/lib-commonjs/components/InputField/index.js.map +0 -1
- package/lib-commonjs/components/ProgressField/ProgressField.js +0 -27
- package/lib-commonjs/components/ProgressField/ProgressField.js.map +0 -1
- package/lib-commonjs/components/ProgressField/index.js +0 -10
- package/lib-commonjs/components/ProgressField/index.js.map +0 -1
- package/lib-commonjs/components/RadioGroupField/RadioGroupField.js +0 -25
- package/lib-commonjs/components/RadioGroupField/RadioGroupField.js.map +0 -1
- package/lib-commonjs/components/RadioGroupField/index.js +0 -10
- package/lib-commonjs/components/RadioGroupField/index.js.map +0 -1
- package/lib-commonjs/components/SelectField/SelectField.js +0 -24
- package/lib-commonjs/components/SelectField/SelectField.js.map +0 -1
- package/lib-commonjs/components/SelectField/index.js +0 -10
- package/lib-commonjs/components/SelectField/index.js.map +0 -1
- package/lib-commonjs/components/SliderField/SliderField.js +0 -24
- package/lib-commonjs/components/SliderField/SliderField.js.map +0 -1
- package/lib-commonjs/components/SliderField/index.js +0 -10
- package/lib-commonjs/components/SliderField/index.js.map +0 -1
- package/lib-commonjs/components/SpinButtonField/SpinButtonField.js +0 -24
- package/lib-commonjs/components/SpinButtonField/SpinButtonField.js.map +0 -1
- package/lib-commonjs/components/SpinButtonField/index.js +0 -10
- package/lib-commonjs/components/SpinButtonField/index.js.map +0 -1
- package/lib-commonjs/components/SwitchField/SwitchField.js +0 -24
- package/lib-commonjs/components/SwitchField/SwitchField.js.map +0 -1
- package/lib-commonjs/components/SwitchField/index.js +0 -10
- package/lib-commonjs/components/SwitchField/index.js.map +0 -1
- package/lib-commonjs/components/TextareaField/TextareaField.js +0 -24
- package/lib-commonjs/components/TextareaField/TextareaField.js.map +0 -1
- package/lib-commonjs/components/TextareaField/index.js +0 -10
- package/lib-commonjs/components/TextareaField/index.js.map +0 -1
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,99 @@
|
|
2
2
|
"name": "@fluentui/react-field",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Thu, 17 Nov 2022 23:02:36 GMT",
|
6
|
+
"tag": "@fluentui/react-field_v9.0.0-alpha.9",
|
7
|
+
"version": "9.0.0-alpha.9",
|
8
|
+
"comments": {
|
9
|
+
"none": [
|
10
|
+
{
|
11
|
+
"author": "martinhochel@microsoft.com",
|
12
|
+
"package": "@fluentui/react-field",
|
13
|
+
"commit": "ea768501802d65d63ddc63fff3816fb6b5008ae4",
|
14
|
+
"comment": "chore: update package scaffold"
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"prerelease": [
|
18
|
+
{
|
19
|
+
"author": "beachball",
|
20
|
+
"package": "@fluentui/react-field",
|
21
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.2",
|
22
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"author": "beachball",
|
26
|
+
"package": "@fluentui/react-field",
|
27
|
+
"comment": "Bump @fluentui/react-label to v9.0.11",
|
28
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"author": "beachball",
|
32
|
+
"package": "@fluentui/react-field",
|
33
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.2",
|
34
|
+
"commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
|
35
|
+
}
|
36
|
+
]
|
37
|
+
}
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"date": "Fri, 11 Nov 2022 14:58:03 GMT",
|
41
|
+
"tag": "@fluentui/react-field_v9.0.0-alpha.8",
|
42
|
+
"version": "9.0.0-alpha.8",
|
43
|
+
"comments": {
|
44
|
+
"prerelease": [
|
45
|
+
{
|
46
|
+
"author": "martinhochel@microsoft.com",
|
47
|
+
"package": "@fluentui/react-field",
|
48
|
+
"commit": "b3907043bd8d7b650c55e8e7c3119b14f2606c38",
|
49
|
+
"comment": "fix: create valid export maps"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"author": "behowell@microsoft.com",
|
53
|
+
"package": "@fluentui/react-field",
|
54
|
+
"commit": "b997f7086d8bc5d630f95eec27aa464f2cb53fe1",
|
55
|
+
"comment": "chore: Clean up Field tests and story imports in preparation of moving to individual packages"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"author": "behowell@microsoft.com",
|
59
|
+
"package": "@fluentui/react-field",
|
60
|
+
"commit": "39ba7b6d4648781b979fcf694579f97b851348af",
|
61
|
+
"comment": "chore: Move individual field components into their respective packages, and out of @fluentui/react-field"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"author": "beachball",
|
65
|
+
"package": "@fluentui/react-field",
|
66
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.1",
|
67
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"author": "beachball",
|
71
|
+
"package": "@fluentui/react-field",
|
72
|
+
"comment": "Bump @fluentui/react-label to v9.0.10",
|
73
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"author": "beachball",
|
77
|
+
"package": "@fluentui/react-field",
|
78
|
+
"comment": "Bump @fluentui/react-theme to v9.1.2",
|
79
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"author": "beachball",
|
83
|
+
"package": "@fluentui/react-field",
|
84
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.1",
|
85
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"author": "beachball",
|
89
|
+
"package": "@fluentui/react-field",
|
90
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.18",
|
91
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
92
|
+
}
|
93
|
+
]
|
94
|
+
}
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"date": "Wed, 02 Nov 2022 11:57:52 GMT",
|
6
98
|
"tag": "@fluentui/react-field_v9.0.0-alpha.7",
|
7
99
|
"version": "9.0.0-alpha.7",
|
8
100
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,39 @@
|
|
1
1
|
# Change Log - @fluentui/react-field
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 17 Nov 2022 23:02:36 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-alpha.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.0.0-alpha.9)
|
8
|
+
|
9
|
+
Thu, 17 Nov 2022 23:02:36 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.8..@fluentui/react-field_v9.0.0-alpha.9)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump @fluentui/react-context-selector to v9.1.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
15
|
+
- Bump @fluentui/react-label to v9.0.11 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
16
|
+
- Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
17
|
+
|
18
|
+
## [9.0.0-alpha.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.0.0-alpha.8)
|
19
|
+
|
20
|
+
Fri, 11 Nov 2022 14:58:03 GMT
|
21
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.7..@fluentui/react-field_v9.0.0-alpha.8)
|
22
|
+
|
23
|
+
### Changes
|
24
|
+
|
25
|
+
- fix: create valid export maps ([PR #25558](https://github.com/microsoft/fluentui/pull/25558) by martinhochel@microsoft.com)
|
26
|
+
- chore: Clean up Field tests and story imports in preparation of moving to individual packages ([PR #25594](https://github.com/microsoft/fluentui/pull/25594) by behowell@microsoft.com)
|
27
|
+
- chore: Move individual field components into their respective packages, and out of @fluentui/react-field ([PR #25593](https://github.com/microsoft/fluentui/pull/25593) by behowell@microsoft.com)
|
28
|
+
- Bump @fluentui/react-context-selector to v9.1.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
29
|
+
- Bump @fluentui/react-label to v9.0.10 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
30
|
+
- Bump @fluentui/react-theme to v9.1.2 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
31
|
+
- Bump @fluentui/react-utilities to v9.2.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
32
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.18 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
33
|
+
|
7
34
|
## [9.0.0-alpha.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.0.0-alpha.7)
|
8
35
|
|
9
|
-
Wed, 02 Nov 2022 11:
|
36
|
+
Wed, 02 Nov 2022 11:57:52 GMT
|
10
37
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.6..@fluentui/react-field_v9.0.0-alpha.7)
|
11
38
|
|
12
39
|
### Changes
|
package/dist/index.d.ts
CHANGED
@@ -1,60 +1,18 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
|
3
|
-
import { Checkbox } from '@fluentui/react-checkbox';
|
4
|
-
import type { CheckboxProps } from '@fluentui/react-checkbox';
|
5
|
-
import { Combobox } from '@fluentui/react-combobox';
|
6
3
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
7
4
|
import type { ComponentState } from '@fluentui/react-utilities';
|
8
|
-
import { ForwardRefComponent } from '@fluentui/react-utilities';
|
9
|
-
import { Input } from '@fluentui/react-input';
|
10
5
|
import { Label } from '@fluentui/react-label';
|
11
|
-
import { Progress } from '@fluentui/react-progress';
|
12
|
-
import { RadioGroup } from '@fluentui/react-radio';
|
13
6
|
import * as React_2 from 'react';
|
14
|
-
import { Select } from '@fluentui/react-select';
|
15
|
-
import { Slider } from '@fluentui/react-slider';
|
16
7
|
import type { Slot } from '@fluentui/react-utilities';
|
17
|
-
import { SlotClassNames } from '@fluentui/react-utilities';
|
8
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
18
9
|
import type { SlotRenderFunction } from '@fluentui/react-utilities';
|
19
10
|
import type { SlotShorthandValue } from '@fluentui/react-utilities';
|
20
|
-
import { SpinButton } from '@fluentui/react-spinbutton';
|
21
|
-
import { Switch } from '@fluentui/react-switch';
|
22
|
-
import { Textarea } from '@fluentui/react-textarea';
|
23
|
-
|
24
|
-
export declare const CheckboxField: ForwardRefComponent<CheckboxFieldProps>;
|
25
|
-
|
26
|
-
export declare const checkboxFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
27
|
-
|
28
|
-
export declare type CheckboxFieldProps = Omit<FieldProps<typeof Checkbox>, 'label'> & {
|
29
|
-
/**
|
30
|
-
* The Checkbox's label.
|
31
|
-
*/
|
32
|
-
label?: CheckboxProps['label'];
|
33
|
-
/**
|
34
|
-
* The label for the CheckboxField, which appears above or before the Checkbox, depending on the `orientation` prop.
|
35
|
-
* It is recommended to only set the `label` prop, and not `fieldLabel`.
|
36
|
-
*/
|
37
|
-
fieldLabel?: FieldProps<typeof Checkbox>['label'];
|
38
|
-
};
|
39
|
-
|
40
|
-
export declare const ComboboxField: ForwardRefComponent<ComboboxFieldProps>;
|
41
|
-
|
42
|
-
export declare const comboboxFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
43
|
-
|
44
|
-
export declare type ComboboxFieldProps = FieldProps<typeof Combobox>;
|
45
|
-
|
46
|
-
/**
|
47
|
-
* The minimum requirement for a component used by Field.
|
48
|
-
*
|
49
|
-
* Note: the use of VoidFunctionComponent means that component is not *required* to have a children prop,
|
50
|
-
* but it is still allowed to have a children prop.
|
51
|
-
*/
|
52
|
-
declare type FieldComponent = React_2.VoidFunctionComponent<Pick<React_2.HTMLAttributes<HTMLElement>, 'id' | 'className' | 'style' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-errormessage'>>;
|
53
11
|
|
54
12
|
/**
|
55
13
|
* Configuration parameters for a Field class, passed to useField_unstable
|
56
14
|
*/
|
57
|
-
export declare type FieldConfig<T extends
|
15
|
+
export declare type FieldConfig<T extends FieldControl> = {
|
58
16
|
/**
|
59
17
|
* The underlying input component that this field is wrapping.
|
60
18
|
*/
|
@@ -81,10 +39,18 @@ export declare type FieldConfig<T extends FieldComponent> = {
|
|
81
39
|
ariaInvalidOnError?: boolean;
|
82
40
|
};
|
83
41
|
|
42
|
+
/**
|
43
|
+
* The minimum requirement for a component used by Field.
|
44
|
+
*
|
45
|
+
* Note: the use of VoidFunctionComponent means that component is not *required* to have a children prop,
|
46
|
+
* but it is still allowed to have a children prop.
|
47
|
+
*/
|
48
|
+
export declare type FieldControl = React_2.VoidFunctionComponent<Pick<React_2.HTMLAttributes<HTMLElement>, 'id' | 'className' | 'style' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-errormessage'>>;
|
49
|
+
|
84
50
|
/**
|
85
51
|
* Field Props
|
86
52
|
*/
|
87
|
-
export declare type FieldProps<T extends
|
53
|
+
export declare type FieldProps<T extends FieldControl> = ComponentProps<Partial<FieldSlots<T>>, 'control'> & {
|
88
54
|
/**
|
89
55
|
* The orientation of the label relative to the field component.
|
90
56
|
* This only affects the label, and not the validationMessage or hint (which always appear below the field component).
|
@@ -108,7 +74,7 @@ export declare type FieldProps<T extends FieldComponent> = ComponentProps<Partia
|
|
108
74
|
* This allows Field to forward the required and size props to the label if the underlying component supports them,
|
109
75
|
* but doesn't add them to the public API of fields that don't support them.
|
110
76
|
*/
|
111
|
-
declare type FieldPropsWithOptionalComponentProps<T extends
|
77
|
+
declare type FieldPropsWithOptionalComponentProps<T extends FieldControl> = FieldProps<T> & {
|
112
78
|
/**
|
113
79
|
* Whether the field label should be marked as required.
|
114
80
|
*/
|
@@ -124,7 +90,7 @@ declare type FieldPropsWithOptionalComponentProps<T extends FieldComponent> = Fi
|
|
124
90
|
/**
|
125
91
|
* Slots added by Field
|
126
92
|
*/
|
127
|
-
export declare type FieldSlots<T extends
|
93
|
+
export declare type FieldSlots<T extends FieldControl> = {
|
128
94
|
root: NonNullable<Slot<'div'>>;
|
129
95
|
/**
|
130
96
|
* The underlying component wrapped by this field.
|
@@ -154,46 +120,16 @@ export declare type FieldSlots<T extends FieldComponent> = {
|
|
154
120
|
/**
|
155
121
|
* State used in rendering Field
|
156
122
|
*/
|
157
|
-
export declare type FieldState<T extends
|
123
|
+
export declare type FieldState<T extends FieldControl> = ComponentState<Required<FieldSlots<T>>> & Pick<FieldProps<T>, 'orientation' | 'validationState'> & {
|
158
124
|
classNames: SlotClassNames<FieldSlots<T>>;
|
159
125
|
};
|
160
126
|
|
161
|
-
export declare const getFieldClassNames: (name: string) => SlotClassNames<FieldSlots<
|
162
|
-
|
163
|
-
export declare const InputField: ForwardRefComponent<InputFieldProps>;
|
164
|
-
|
165
|
-
export declare const inputFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
166
|
-
|
167
|
-
export declare type InputFieldProps = FieldProps<typeof Input>;
|
168
|
-
|
169
|
-
export declare const ProgressField: ForwardRefComponent<ProgressFieldProps>;
|
170
|
-
|
171
|
-
export declare const progressFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
172
|
-
|
173
|
-
export declare type ProgressFieldProps = FieldProps<typeof Progress>;
|
174
|
-
|
175
|
-
export declare const RadioGroupField: ForwardRefComponent<RadioGroupFieldProps>;
|
176
|
-
|
177
|
-
export declare const radioGroupFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
178
|
-
|
179
|
-
export declare type RadioGroupFieldProps = FieldProps<typeof RadioGroup>;
|
127
|
+
export declare const getFieldClassNames: (name: string) => SlotClassNames<FieldSlots<FieldControl>>;
|
180
128
|
|
181
129
|
/**
|
182
130
|
* Render the final JSX of Field
|
183
131
|
*/
|
184
|
-
export declare const renderField_unstable: <T extends
|
185
|
-
|
186
|
-
export declare const SelectField: ForwardRefComponent<SelectFieldProps>;
|
187
|
-
|
188
|
-
export declare const selectFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
189
|
-
|
190
|
-
export declare type SelectFieldProps = FieldProps<typeof Select>;
|
191
|
-
|
192
|
-
export declare const SliderField: ForwardRefComponent<SliderFieldProps>;
|
193
|
-
|
194
|
-
export declare const sliderFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
195
|
-
|
196
|
-
export declare type SliderFieldProps = FieldProps<typeof Slider>;
|
132
|
+
export declare const renderField_unstable: <T extends FieldControl>(state: FieldState<T>) => JSX.Element;
|
197
133
|
|
198
134
|
declare type SlotComponent<Type extends React_2.ComponentType | React_2.VoidFunctionComponent> = WithSlotShorthandValue<Type extends React_2.ComponentType<infer Props> ? WithSlotRenderFunction<Props extends {
|
199
135
|
children?: unknown;
|
@@ -201,24 +137,6 @@ declare type SlotComponent<Type extends React_2.ComponentType | React_2.VoidFunc
|
|
201
137
|
children?: never;
|
202
138
|
}> : never>;
|
203
139
|
|
204
|
-
export declare const SpinButtonField: ForwardRefComponent<SpinButtonFieldProps>;
|
205
|
-
|
206
|
-
export declare const spinButtonFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
207
|
-
|
208
|
-
export declare type SpinButtonFieldProps = FieldProps<typeof SpinButton>;
|
209
|
-
|
210
|
-
export declare const SwitchField: ForwardRefComponent<SwitchFieldProps>;
|
211
|
-
|
212
|
-
export declare const switchFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
213
|
-
|
214
|
-
export declare type SwitchFieldProps = Omit<FieldProps<typeof Switch>, 'labelPosition'>;
|
215
|
-
|
216
|
-
export declare const TextareaField: ForwardRefComponent<TextareaFieldProps>;
|
217
|
-
|
218
|
-
export declare const textareaFieldClassNames: SlotClassNames<FieldSlots<FieldComponent>>;
|
219
|
-
|
220
|
-
export declare type TextareaFieldProps = FieldProps<typeof Textarea>;
|
221
|
-
|
222
140
|
/**
|
223
141
|
* Create the state required to render Field.
|
224
142
|
*
|
@@ -229,12 +147,12 @@ export declare type TextareaFieldProps = FieldProps<typeof Textarea>;
|
|
229
147
|
* @param ref - Ref to the control slot (primary slot)
|
230
148
|
* @param params - Configuration parameters for this Field
|
231
149
|
*/
|
232
|
-
export declare const useField_unstable: <T extends
|
150
|
+
export declare const useField_unstable: <T extends FieldControl>(props: FieldPropsWithOptionalComponentProps<T>, ref: React_2.Ref<HTMLElement>, params: FieldConfig<T>) => FieldState<T>;
|
233
151
|
|
234
152
|
/**
|
235
153
|
* Apply styling to the Field slots based on the state
|
236
154
|
*/
|
237
|
-
export declare const useFieldStyles_unstable: <T extends
|
155
|
+
export declare const useFieldStyles_unstable: <T extends FieldControl>(state: FieldState<T>) => void;
|
238
156
|
|
239
157
|
declare type WithSlotRenderFunction<Props extends {
|
240
158
|
children?: unknown;
|
package/lib/Field.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"../src/","sources":["Field.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './components/Field/index';\n"]}
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"../src/","sources":["packages/react-components/react-field/src/Field.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './components/Field/index';\n"]}
|
@@ -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
|
1
|
+
{"version":3,"file":"Field.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-field/src/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 FieldControl = 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 FieldControl> = {\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 FieldControl> = 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 FieldControl> = 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 FieldControl> = {\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 FieldControl> = ComponentState<Required<FieldSlots<T>>> &\n Pick<FieldProps<T>, 'orientation' | 'validationState'> & {\n classNames: SlotClassNames<FieldSlots<T>>;\n };\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SlotComponent.types.js","sourceRoot":"../src/","sources":["components/Field/SlotComponent.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { SlotShorthandValue, SlotRenderFunction } from '@fluentui/react-utilities';\n\n//\n// TEMPORARY definition of the SlotComponent type, until it is available from react-utilities\n//\n\nexport type SlotComponent<Type extends React.ComponentType | React.VoidFunctionComponent> = WithSlotShorthandValue<\n Type extends React.ComponentType<infer Props>\n ? // If this is a VoidFunctionComponent that doesn't allow children, add { children?: never }\n WithSlotRenderFunction<Props extends { children?: unknown } ? Props : Props & { children?: never }>\n : never\n>;\n\n//\n// TEMPORARY copied versions of the non-exported helper types from react-utilities\n//\n\ntype WithSlotShorthandValue<Props extends { children?: unknown }> =\n | Props\n | Extract<SlotShorthandValue, Props['children']>;\n\ntype WithSlotRenderFunction<Props extends { children?: unknown }> = Props & {\n children?: Props['children'] | SlotRenderFunction<Props>;\n};\n"]}
|
1
|
+
{"version":3,"file":"SlotComponent.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-field/src/components/Field/SlotComponent.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { SlotShorthandValue, SlotRenderFunction } from '@fluentui/react-utilities';\n\n//\n// TEMPORARY definition of the SlotComponent type, until it is available from react-utilities\n//\n\nexport type SlotComponent<Type extends React.ComponentType | React.VoidFunctionComponent> = WithSlotShorthandValue<\n Type extends React.ComponentType<infer Props>\n ? // If this is a VoidFunctionComponent that doesn't allow children, add { children?: never }\n WithSlotRenderFunction<Props extends { children?: unknown } ? Props : Props & { children?: never }>\n : never\n>;\n\n//\n// TEMPORARY copied versions of the non-exported helper types from react-utilities\n//\n\ntype WithSlotShorthandValue<Props extends { children?: unknown }> =\n | Props\n | Extract<SlotShorthandValue, Props['children']>;\n\ntype WithSlotRenderFunction<Props extends { children?: unknown }> = Props & {\n children?: Props['children'] | SlotRenderFunction<Props>;\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Field/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './Field.types';\nexport * from './renderField';\nexport * from './useField';\nexport * from './useFieldStyles';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-field/src/components/Field/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './Field.types';\nexport * from './renderField';\nexport * from './useField';\nexport * from './useFieldStyles';\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Field/renderField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,oBAAoB,
|
1
|
+
{"version":3,"sources":["packages/react-components/react-field/src/components/Field/renderField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,oBAAoB,GAA4B,KAAzB,IAAiD;EACnF,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAA2B,KAA3B,CAArC;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,KAAN,iBAAe,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CADlB,EAGG,KAAK,CAAC,OAAN,iBAAiB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAM,SAAS,CAAC;EAAhB,CAAd,CAHpB,EAIG,KAAK,CAAC,iBAAN,iBACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,iBAAP,EAAwB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAxB,EACG,KAAK,CAAC,qBAAN,iBAA+B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,qBAAP,EAA4B,EAAA,GAAK,SAAS,CAAC;EAAf,CAA5B,CADlC,EAEG,SAAS,CAAC,iBAAV,CAA4B,QAF/B,CALJ,EAUG,KAAK,CAAC,IAAN,iBAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CAVjB,CADF;AAcD,CAjBM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { FieldControl, FieldSlots, FieldState } from './Field.types';\n\n/**\n * Render the final JSX of Field\n */\nexport const renderField_unstable = <T extends FieldControl>(state: FieldState<T>) => {\n const { slots, slotProps } = getSlots<FieldSlots<FieldControl>>(state as FieldState<FieldControl>);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.label && <slots.label {...slotProps.label} />}\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\n {slots.control && <slots.control {...(slotProps.control as any)} />}\n {slots.validationMessage && (\n <slots.validationMessage {...slotProps.validationMessage}>\n {slots.validationMessageIcon && <slots.validationMessageIcon {...slotProps.validationMessageIcon} />}\n {slotProps.validationMessage.children}\n </slots.validationMessage>\n )}\n {slots.hint && <slots.hint {...slotProps.hint} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -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,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AA1B,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,GAA6B;IACtC,WADsC;IAEtC,eAFsC;IAGtC,UAAU,EAAE,MAAM,CAAC,UAHmB;IAItC,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,CAJ0B;IAYtC,IAZsC;IAatC,OAbsC;IActC,KAdsC;IAetC,qBAfsC;IAgBtC,iBAhBsC;IAiBtC;EAjBsC,CAAxC;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 FieldConfig,\n FieldControl,\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<FieldControl>>(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 FieldControl>(\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<FieldControl> = {\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/"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { __styles, mergeClasses } from '@griffel/react';
|
2
1
|
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
2
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
3
3
|
export const getFieldClassNames = name => ({
|
4
4
|
root: `fui-${name}`,
|
5
5
|
control: `fui-${name}__control`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Field/useFieldStyles.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"sources":["packages/react-components/react-field/src/components/Field/useFieldStyles.ts"],"names":[],"mappings":"AAAA,SAAS,MAAT,EAAiB,gBAAjB,QAAyC,uBAAzC;AAEA,mBAAqB,YAArB,QAAyC,gBAAzC;AAGA,OAAO,MAAM,kBAAkB,GAAI,IAAD,KAA6D;EAC7F,IAAI,EAAE,OAAO,IAAI,EAD4E;EAE7F,OAAO,EAAE,OAAO,IAAI,WAFyE;EAG7F,KAAK,EAAE,OAAO,IAAI,SAH2E;EAI7F,iBAAiB,EAAE,OAAO,IAAI,qBAJ+D;EAK7F,qBAAqB,EAAE,OAAO,IAAI,yBAL2D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AlC;;EACA,IAAI,KAAK,CAAC,KAAV,EAAiB;IACf,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,YAAY,CAClC,UAAU,CAAC,KADuB,EAElC,WAAW,CAAC,IAFsB,EAGlC,UAAU,IAAI,WAAW,CAAC,UAHQ,EAIlC,KAAK,CAAC,KAAN,CAAY,SAJsB,CAApC;EAMD;;EAED,MAAM,2BAA2B,GAAG,8BAA8B,EAAlE;;EACA,IAAI,KAAK,CAAC,qBAAV,EAAiC;IAC/B,KAAK,CAAC,qBAAN,CAA4B,SAA5B,GAAwC,YAAY,CAClD,UAAU,CAAC,qBADuC,EAElD,2BAA2B,CAAC,IAFsB,EAGlD,CAAC,CAAC,eAAF,IAAqB,2BAA2B,CAAC,eAAD,CAHE,EAIlD,KAAK,CAAC,qBAAN,CAA4B,SAJsB,CAApD;EAMD;;EAED,MAAM,mBAAmB,GAAG,sBAAsB,EAAlD;;EACA,IAAI,KAAK,CAAC,iBAAV,EAA6B;IAC3B,KAAK,CAAC,iBAAN,CAAwB,SAAxB,GAAoC,YAAY,CAC9C,UAAU,CAAC,iBADmC,EAE9C,mBAAmB,CAAC,IAF0B,EAG9C,UAAU,IAAI,UAAU,CAAC,YAHqB,EAI9C,eAAe,KAAK,OAApB,IAA+B,mBAAmB,CAAC,KAJL,EAK9C,KAAK,CAAC,iBAAN,CAAwB,SALsB,CAAhD;EAOD;;EAED,IAAI,KAAK,CAAC,IAAV,EAAgB;IACd,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,UAAU,CAAC,IADsB,EAEjC,mBAAmB,CAAC,IAFa,EAGjC,UAAU,IAAI,UAAU,CAAC,YAHQ,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;EAMD;AACF,CA5DM","sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { FieldControl, FieldProps, FieldSlots, FieldState } from './Field.types';\n\nexport const getFieldClassNames = (name: string): SlotClassNames<FieldSlots<FieldControl>> => ({\n root: `fui-${name}`,\n control: `fui-${name}__control`,\n label: `fui-${name}__label`,\n validationMessage: `fui-${name}__validationMessage`,\n validationMessageIcon: `fui-${name}__validationMessageIcon`,\n hint: `fui-${name}__hint`,\n});\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n display: 'grid',\n gridAutoFlow: 'row',\n justifyItems: 'start',\n },\n\n horizontal: {\n gridTemplateRows: 'auto auto auto auto',\n gridTemplateColumns: '1fr 2fr',\n },\n\n secondColumn: {\n gridColumnStart: '2',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n marginTop: tokens.spacingVerticalXXS,\n marginBottom: tokens.spacingVerticalXXS,\n },\n\n horizontal: {\n gridRowStart: '1',\n gridRowEnd: '-1',\n marginRight: tokens.spacingHorizontalM,\n alignSelf: 'start',\n justifySelf: 'stretch',\n },\n});\n\nconst useSecondaryTextStyles = makeStyles({\n base: {\n marginTop: tokens.spacingVerticalXXS,\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.caption1,\n },\n\n error: {\n color: tokens.colorPaletteRedForeground1,\n },\n});\n\nconst useValidationMessageIconStyles = makeStyles({\n base: {\n fontSize: '12px',\n lineHeight: '12px',\n verticalAlign: 'middle',\n marginRight: tokens.spacingHorizontalXS,\n },\n\n error: {\n color: tokens.colorPaletteRedForeground1,\n },\n warning: {\n color: tokens.colorPaletteDarkOrangeForeground1,\n },\n success: {\n color: tokens.colorPaletteGreenForeground1,\n },\n});\n\n/**\n * Apply styling to the Field slots based on the state\n */\nexport const useFieldStyles_unstable = <T extends FieldControl>(state: FieldState<T>) => {\n const classNames = state.classNames;\n const validationState: FieldProps<FieldControl>['validationState'] = state.validationState;\n const horizontal = state.orientation === 'horizontal';\n\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n classNames.root,\n rootStyles.base,\n horizontal && rootStyles.horizontal,\n state.root.className,\n );\n\n if (state.control) {\n state.control.className = mergeClasses(\n classNames.control,\n horizontal && rootStyles.secondColumn,\n state.control.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n classNames.label,\n labelStyles.base,\n horizontal && labelStyles.horizontal,\n state.label.className,\n );\n }\n\n const validationMessageIconStyles = useValidationMessageIconStyles();\n if (state.validationMessageIcon) {\n state.validationMessageIcon.className = mergeClasses(\n classNames.validationMessageIcon,\n validationMessageIconStyles.base,\n !!validationState && validationMessageIconStyles[validationState],\n state.validationMessageIcon.className,\n );\n }\n\n const secondaryTextStyles = useSecondaryTextStyles();\n if (state.validationMessage) {\n state.validationMessage.className = mergeClasses(\n classNames.validationMessage,\n secondaryTextStyles.base,\n horizontal && rootStyles.secondColumn,\n validationState === 'error' && secondaryTextStyles.error,\n state.validationMessage.className,\n );\n }\n\n if (state.hint) {\n state.hint.className = mergeClasses(\n classNames.hint,\n secondaryTextStyles.base,\n horizontal && rootStyles.secondColumn,\n state.hint.className,\n );\n }\n};\n"],"sourceRoot":"../src/"}
|
package/lib/index.js
CHANGED
@@ -1,12 +1,2 @@
|
|
1
1
|
export { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';
|
2
|
-
export { CheckboxField, checkboxFieldClassNames } from './CheckboxField';
|
3
|
-
export { ComboboxField, comboboxFieldClassNames } from './ComboboxField';
|
4
|
-
export { InputField, inputFieldClassNames } from './InputField';
|
5
|
-
export { ProgressField, progressFieldClassNames } from './ProgressField';
|
6
|
-
export { RadioGroupField, radioGroupFieldClassNames } from './RadioGroupField';
|
7
|
-
export { SelectField, selectFieldClassNames } from './SelectField';
|
8
|
-
export { SliderField, sliderFieldClassNames } from './SliderField';
|
9
|
-
export { SpinButtonField, spinButtonFieldClassNames } from './SpinButtonField';
|
10
|
-
export { SwitchField, switchFieldClassNames } from './SwitchField';
|
11
|
-
export { TextareaField, textareaFieldClassNames } from './TextareaField';
|
12
2
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-field/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';\nexport type { FieldConfig, FieldControl, FieldProps, FieldSlots, FieldState } from './Field';\n"]}
|
package/lib-amd/Field.js
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/Field/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=Field.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-field/src/Field.ts"],"names":[],"mappings":";;;IAAA,uCAAyC","sourcesContent":["export * from './components/Field/index';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Field.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/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 FieldControl = 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 FieldControl> = {\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 FieldControl> = 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 FieldControl> = 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 FieldControl> = {\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 FieldControl> = ComponentState<Required<FieldSlots<T>>> &\n Pick<FieldProps<T>, 'orientation' | 'validationState'> & {\n classNames: SlotClassNames<FieldSlots<T>>;\n };\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SlotComponent.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/SlotComponent.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { SlotShorthandValue, SlotRenderFunction } from '@fluentui/react-utilities';\n\n//\n// TEMPORARY definition of the SlotComponent type, until it is available from react-utilities\n//\n\nexport type SlotComponent<Type extends React.ComponentType | React.VoidFunctionComponent> = WithSlotShorthandValue<\n Type extends React.ComponentType<infer Props>\n ? // If this is a VoidFunctionComponent that doesn't allow children, add { children?: never }\n WithSlotRenderFunction<Props extends { children?: unknown } ? Props : Props & { children?: never }>\n : never\n>;\n\n//\n// TEMPORARY copied versions of the non-exported helper types from react-utilities\n//\n\ntype WithSlotShorthandValue<Props extends { children?: unknown }> =\n | Props\n | Extract<SlotShorthandValue, Props['children']>;\n\ntype WithSlotRenderFunction<Props extends { children?: unknown }> = Props & {\n children?: Props['children'] | SlotRenderFunction<Props>;\n};\n"]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./Field.types", "./renderField", "./useField", "./useFieldStyles"], function (require, exports, tslib_1, Field_types_1, renderField_1, useField_1, useFieldStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(Field_types_1, exports);
|
5
|
+
tslib_1.__exportStar(renderField_1, exports);
|
6
|
+
tslib_1.__exportStar(useField_1, exports);
|
7
|
+
tslib_1.__exportStar(useFieldStyles_1, exports);
|
8
|
+
});
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/index.ts"],"names":[],"mappings":";;;IAAA,6CAA8B;IAC9B,6CAA8B;IAC9B,0CAA2B;IAC3B,gDAAiC","sourcesContent":["export * from './Field.types';\nexport * from './renderField';\nexport * from './useField';\nexport * from './useFieldStyles';\n"]}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.renderField_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Render the final JSX of Field
|
7
|
+
*/
|
8
|
+
var renderField_unstable = function (state) {
|
9
|
+
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
10
|
+
return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
|
11
|
+
slots.label && React.createElement(slots.label, tslib_1.__assign({}, slotProps.label)),
|
12
|
+
slots.control && React.createElement(slots.control, tslib_1.__assign({}, slotProps.control)),
|
13
|
+
slots.validationMessage && (React.createElement(slots.validationMessage, tslib_1.__assign({}, slotProps.validationMessage),
|
14
|
+
slots.validationMessageIcon && React.createElement(slots.validationMessageIcon, tslib_1.__assign({}, slotProps.validationMessageIcon)),
|
15
|
+
slotProps.validationMessage.children)),
|
16
|
+
slots.hint && React.createElement(slots.hint, tslib_1.__assign({}, slotProps.hint))));
|
17
|
+
};
|
18
|
+
exports.renderField_unstable = renderField_unstable;
|
19
|
+
});
|
20
|
+
//# sourceMappingURL=renderField.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderField.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/renderField.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAyB,KAAoB;QACzE,IAAA,KAAuB,0BAAQ,CAA2B,KAAiC,CAAC,EAA1F,KAAK,WAAA,EAAE,SAAS,eAA0E,CAAC;QAEnG,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,KAAK,CAAC,KAAK,IAAI,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI;YAEnD,KAAK,CAAC,OAAO,IAAI,oBAAC,KAAK,CAAC,OAAO,uBAAM,SAAS,CAAC,OAAe,EAAI;YAClE,KAAK,CAAC,iBAAiB,IAAI,CAC1B,oBAAC,KAAK,CAAC,iBAAiB,uBAAK,SAAS,CAAC,iBAAiB;gBACrD,KAAK,CAAC,qBAAqB,IAAI,oBAAC,KAAK,CAAC,qBAAqB,uBAAK,SAAS,CAAC,qBAAqB,EAAI;gBACnG,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CACb,CAC3B;YACA,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACtC,CACd,CAAC;IACJ,CAAC,CAAC;IAjBW,QAAA,oBAAoB,wBAiB/B","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { FieldControl, FieldSlots, FieldState } from './Field.types';\n\n/**\n * Render the final JSX of Field\n */\nexport const renderField_unstable = <T extends FieldControl>(state: FieldState<T>) => {\n const { slots, slotProps } = getSlots<FieldSlots<FieldControl>>(state as FieldState<FieldControl>);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.label && <slots.label {...slotProps.label} />}\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\n {slots.control && <slots.control {...(slotProps.control as any)} />}\n {slots.validationMessage && (\n <slots.validationMessage {...slotProps.validationMessage}>\n {slots.validationMessageIcon && <slots.validationMessageIcon {...slotProps.validationMessageIcon} />}\n {slotProps.validationMessage.children}\n </slots.validationMessage>\n )}\n {slots.hint && <slots.hint {...slotProps.hint} />}\n </slots.root>\n );\n};\n"]}
|