@fluentui/react-field 9.0.0-alpha.2 → 9.0.0-alpha.20
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +904 -12
- package/CHANGELOG.md +270 -13
- package/README.md +66 -1
- package/dist/index.d.ts +76 -157
- package/lib/Field.js.map +1 -1
- package/lib/components/Field/Field.js +11 -0
- package/lib/components/Field/Field.js.map +1 -0
- package/lib/components/Field/Field.types.js.map +1 -1
- package/lib/components/Field/index.js +1 -0
- package/lib/components/Field/index.js.map +1 -1
- package/lib/components/Field/renderField.js +10 -7
- package/lib/components/Field/renderField.js.map +1 -1
- package/lib/components/Field/useField.js +57 -90
- package/lib/components/Field/useField.js.map +1 -1
- package/lib/components/Field/useFieldStyles.js +61 -76
- package/lib/components/Field/useFieldStyles.js.map +1 -1
- package/lib/index.js +3 -10
- package/lib/index.js.map +1 -1
- package/lib/util/makeDeprecatedField.js +71 -0
- package/lib/util/makeDeprecatedField.js.map +1 -0
- package/lib-amd/Field.js +6 -0
- package/lib-amd/Field.js.map +1 -0
- package/lib-amd/components/Field/Field.js +12 -0
- package/lib-amd/components/Field/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/index.js +10 -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 +99 -0
- package/lib-amd/components/Field/useField.js.map +1 -0
- package/lib-amd/components/Field/useFieldStyles.js +115 -0
- package/lib-amd/components/Field/useFieldStyles.js.map +1 -0
- package/lib-amd/index.js +13 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-amd/util/makeDeprecatedField.js +38 -0
- package/lib-amd/util/makeDeprecatedField.js.map +1 -0
- package/lib-commonjs/Field.js +0 -2
- package/lib-commonjs/Field.js.map +1 -1
- package/lib-commonjs/components/Field/Field.js +17 -0
- package/lib-commonjs/components/Field/Field.js.map +1 -0
- package/lib-commonjs/components/Field/Field.types.js.map +1 -1
- package/lib-commonjs/components/Field/index.js +1 -5
- package/lib-commonjs/components/Field/index.js.map +1 -1
- package/lib-commonjs/components/Field/renderField.js +10 -11
- package/lib-commonjs/components/Field/renderField.js.map +1 -1
- package/lib-commonjs/components/Field/useField.js +58 -99
- package/lib-commonjs/components/Field/useField.js.map +1 -1
- package/lib-commonjs/components/Field/useFieldStyles.js +62 -83
- package/lib-commonjs/components/Field/useFieldStyles.js.map +1 -1
- package/lib-commonjs/index.js +15 -132
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/util/makeDeprecatedField.js +79 -0
- package/lib-commonjs/util/makeDeprecatedField.js.map +1 -0
- package/package.json +25 -25
- package/Spec.md +0 -354
- 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/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/Field/SlotComponent.types.js +0 -2
- package/lib/components/Field/SlotComponent.types.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/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/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/Field/SlotComponent.types.js +0 -6
- package/lib-commonjs/components/Field/SlotComponent.types.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/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
@@ -3,132 +3,111 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useFieldStyles_unstable = exports.
|
7
|
-
|
8
|
-
const react_1 = /*#__PURE__*/require("@griffel/react");
|
9
|
-
|
6
|
+
exports.useFieldStyles_unstable = exports.fieldClassNames = void 0;
|
10
7
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
11
|
-
|
12
|
-
|
13
|
-
root: `fui
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
exports.getFieldClassNames = getFieldClassNames;
|
8
|
+
const react_1 = /*#__PURE__*/require("@griffel/react");
|
9
|
+
exports.fieldClassNames = {
|
10
|
+
root: `fui-Field`,
|
11
|
+
label: `fui-Field__label`,
|
12
|
+
validationMessage: `fui-Field__validationMessage`,
|
13
|
+
validationMessageIcon: `fui-Field__validationMessageIcon`,
|
14
|
+
hint: `fui-Field__hint`
|
15
|
+
};
|
16
|
+
// Size of the icon in the validation message
|
17
|
+
const iconSize = '12px';
|
22
18
|
/**
|
23
19
|
* Styles for the root slot
|
24
20
|
*/
|
25
|
-
|
26
21
|
const useRootStyles = /*#__PURE__*/react_1.__styles({
|
27
|
-
|
28
|
-
|
29
|
-
"Bxotwcr": "f14np9u9",
|
30
|
-
"B7hvi0a": "f1m2n5bn"
|
22
|
+
base: {
|
23
|
+
mc9l5x: "f13qh94s"
|
31
24
|
},
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
horizontal: {
|
26
|
+
Budl1dq: "f2wwaib",
|
27
|
+
wkccdc: "f1645dqt"
|
35
28
|
},
|
36
|
-
|
37
|
-
"
|
29
|
+
horizontalNoLabel: {
|
30
|
+
uwmqm3: ["f15jqgz8", "fggqkej"],
|
31
|
+
Budl1dq: "f1c2z91y"
|
38
32
|
}
|
39
33
|
}, {
|
40
|
-
|
34
|
+
d: [".f13qh94s{display:grid;}", ".f2wwaib{grid-template-columns:33% 1fr;}", ".f1645dqt{grid-template-rows:auto auto auto 1fr;}", ".f15jqgz8{padding-left:33%;}", ".fggqkej{padding-right:33%;}", ".f1c2z91y{grid-template-columns:1fr;}"]
|
41
35
|
});
|
42
|
-
|
43
36
|
const useLabelStyles = /*#__PURE__*/react_1.__styles({
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
base: {
|
38
|
+
z8tnut: "fclwglc",
|
39
|
+
Byoj8tv: "fywfov9"
|
40
|
+
},
|
41
|
+
large: {
|
42
|
+
z8tnut: "f1sl3k7w",
|
43
|
+
Byoj8tv: "f1brlhvm"
|
47
44
|
},
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
vertical: {
|
46
|
+
jrapky: "fyacil5"
|
47
|
+
},
|
48
|
+
verticalLarge: {
|
49
|
+
jrapky: "f8l5zjj"
|
50
|
+
},
|
51
|
+
horizontal: {
|
52
|
+
t21cq0: ["fkujibs", "f199hnxi"],
|
53
|
+
Ijaq50: "f16hsg94",
|
54
|
+
nk6f5a: "f1nzqi2z"
|
54
55
|
}
|
55
56
|
}, {
|
56
|
-
|
57
|
+
d: [".fclwglc{padding-top:var(--spacingVerticalXXS);}", ".fywfov9{padding-bottom:var(--spacingVerticalXXS);}", ".f1sl3k7w{padding-top:1px;}", ".f1brlhvm{padding-bottom:1px;}", ".fyacil5{margin-bottom:var(--spacingVerticalXXS);}", ".f8l5zjj{margin-bottom:var(--spacingVerticalXS);}", ".fkujibs{margin-right:var(--spacingHorizontalM);}", ".f199hnxi{margin-left:var(--spacingHorizontalM);}", ".f16hsg94{grid-row-start:1;}", ".f1nzqi2z{grid-row-end:-1;}"]
|
57
58
|
});
|
58
|
-
|
59
|
+
const useSecondaryTextBaseClassName = /*#__PURE__*/react_1.__resetStyles("r5c4z9l", null, [".r5c4z9l{margin-top:var(--spacingVerticalXXS);color:var(--colorNeutralForeground3);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"]);
|
59
60
|
const useSecondaryTextStyles = /*#__PURE__*/react_1.__styles({
|
60
|
-
|
61
|
-
|
62
|
-
"sj55zd": "f11d4kpn",
|
63
|
-
"Bahqtrf": "fk6fouc",
|
64
|
-
"Be2twd7": "fy9rknc",
|
65
|
-
"Bhrd7zp": "figsok6",
|
66
|
-
"Bg96gwp": "fwrc4pm"
|
61
|
+
error: {
|
62
|
+
sj55zd: "f1hcrxcs"
|
67
63
|
},
|
68
|
-
|
69
|
-
"
|
64
|
+
withIcon: {
|
65
|
+
uwmqm3: ["frawy03", "fg4c52"]
|
70
66
|
}
|
71
67
|
}, {
|
72
|
-
|
68
|
+
d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}", ".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}"]
|
73
69
|
});
|
74
|
-
|
70
|
+
const useValidationMessageIconBaseClassName = /*#__PURE__*/react_1.__resetStyles("ra7h1uk", "r1rh6bd7", [".ra7h1uk{display:inline-block;font-size:12px;margin-left:calc(-12px - var(--spacingHorizontalXS));margin-right:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}", ".r1rh6bd7{display:inline-block;font-size:12px;margin-right:calc(-12px - var(--spacingHorizontalXS));margin-left:var(--spacingHorizontalXS);line-height:0;vertical-align:-1px;}"]);
|
75
71
|
const useValidationMessageIconStyles = /*#__PURE__*/react_1.__styles({
|
76
|
-
|
77
|
-
|
78
|
-
"Bg96gwp": "fp4gqsa",
|
79
|
-
"ha4doy": "fmrv4ls",
|
80
|
-
"t21cq0": ["fm0x6gh", "fbyavb5"]
|
81
|
-
},
|
82
|
-
"error": {
|
83
|
-
"sj55zd": "f1hcrxcs"
|
72
|
+
error: {
|
73
|
+
sj55zd: "f1hcrxcs"
|
84
74
|
},
|
85
|
-
|
86
|
-
|
75
|
+
warning: {
|
76
|
+
sj55zd: "f1k5f75o"
|
87
77
|
},
|
88
|
-
|
89
|
-
|
78
|
+
success: {
|
79
|
+
sj55zd: "ffmvakt"
|
90
80
|
}
|
91
81
|
}, {
|
92
|
-
|
82
|
+
d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}", ".ffmvakt{color:var(--colorPaletteGreenForeground1);}"]
|
93
83
|
});
|
94
84
|
/**
|
95
85
|
* Apply styling to the Field slots based on the state
|
96
86
|
*/
|
97
|
-
|
98
|
-
|
99
87
|
const useFieldStyles_unstable = state => {
|
100
|
-
const
|
101
|
-
|
88
|
+
const {
|
89
|
+
validationState
|
90
|
+
} = state;
|
102
91
|
const horizontal = state.orientation === 'horizontal';
|
103
92
|
const rootStyles = useRootStyles();
|
104
|
-
state.root.className = react_1.mergeClasses(
|
105
|
-
|
106
|
-
if (state.control) {
|
107
|
-
state.control.className = react_1.mergeClasses(classNames.control, horizontal && rootStyles.secondColumn, state.control.className);
|
108
|
-
}
|
109
|
-
|
93
|
+
state.root.className = react_1.mergeClasses(exports.fieldClassNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);
|
110
94
|
const labelStyles = useLabelStyles();
|
111
|
-
|
112
95
|
if (state.label) {
|
113
|
-
state.label.className = react_1.mergeClasses(
|
96
|
+
state.label.className = react_1.mergeClasses(exports.fieldClassNames.label, labelStyles.base, horizontal && labelStyles.horizontal, !horizontal && labelStyles.vertical, state.label.size === 'large' && labelStyles.large, !horizontal && state.label.size === 'large' && labelStyles.verticalLarge, state.label.className);
|
114
97
|
}
|
115
|
-
|
98
|
+
const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();
|
116
99
|
const validationMessageIconStyles = useValidationMessageIconStyles();
|
117
|
-
|
118
100
|
if (state.validationMessageIcon) {
|
119
|
-
state.validationMessageIcon.className = react_1.mergeClasses(
|
101
|
+
state.validationMessageIcon.className = react_1.mergeClasses(exports.fieldClassNames.validationMessageIcon, validationMessageIconBaseClassName, validationState !== 'none' && validationMessageIconStyles[validationState], state.validationMessageIcon.className);
|
120
102
|
}
|
121
|
-
|
103
|
+
const secondaryTextBaseClassName = useSecondaryTextBaseClassName();
|
122
104
|
const secondaryTextStyles = useSecondaryTextStyles();
|
123
|
-
|
124
105
|
if (state.validationMessage) {
|
125
|
-
state.validationMessage.className = react_1.mergeClasses(
|
106
|
+
state.validationMessage.className = react_1.mergeClasses(exports.fieldClassNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);
|
126
107
|
}
|
127
|
-
|
128
108
|
if (state.hint) {
|
129
|
-
state.hint.className = react_1.mergeClasses(
|
109
|
+
state.hint.className = react_1.mergeClasses(exports.fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);
|
130
110
|
}
|
131
111
|
};
|
132
|
-
|
133
112
|
exports.useFieldStyles_unstable = useFieldStyles_unstable;
|
134
113
|
//# sourceMappingURL=useFieldStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":"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","names":["exports","root","label","validationMessage","validationMessageIcon","hint","iconSize","useRootStyles","react_1","useLabelStyles","useSecondaryTextBaseClassName","useSecondaryTextStyles","useValidationMessageIconBaseClassName","useValidationMessageIconStyles","useFieldStyles_unstable","state","validationState","horizontal","orientation","rootStyles","className","base","horizontalNoLabel","labelStyles","vertical","size","large","verticalLarge","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles","error","withIcon"],"sourceRoot":"../src/","sources":["packages/react-components/react-field/src/components/Field/useFieldStyles.ts"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { FieldSlots, FieldState } from './Field.types';\n\nexport const fieldClassNames: SlotClassNames<FieldSlots> = {\n root: `fui-Field`,\n label: `fui-Field__label`,\n validationMessage: `fui-Field__validationMessage`,\n validationMessageIcon: `fui-Field__validationMessageIcon`,\n hint: `fui-Field__hint`,\n};\n\n// Size of the icon in the validation message\nconst iconSize = '12px';\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n display: 'grid',\n },\n\n // In horizontal layout, the field is a grid with the label taking up the entire first column.\n // The last row is slack space in case the label is taller than the rest of the content.\n horizontal: {\n gridTemplateColumns: '33% 1fr',\n gridTemplateRows: 'auto auto auto 1fr',\n },\n\n // In horizontal layout without a label, replace the label's column with padding.\n // This lets grid auto-flow properly place the other children, and keeps fields with and without labels aligned.\n horizontalNoLabel: {\n paddingLeft: '33%',\n gridTemplateColumns: '1fr',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n paddingTop: tokens.spacingVerticalXXS,\n paddingBottom: tokens.spacingVerticalXXS,\n },\n\n large: {\n paddingTop: '1px',\n paddingBottom: '1px',\n },\n\n vertical: {\n marginBottom: tokens.spacingVerticalXXS,\n },\n\n verticalLarge: {\n marginBottom: tokens.spacingVerticalXS,\n },\n\n horizontal: {\n marginRight: tokens.spacingHorizontalM,\n gridRowStart: '1',\n gridRowEnd: '-1',\n },\n});\n\nconst useSecondaryTextBaseClassName = makeResetStyles({\n marginTop: tokens.spacingVerticalXXS,\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.caption1,\n});\n\nconst useSecondaryTextStyles = makeStyles({\n error: {\n color: tokens.colorPaletteRedForeground1,\n },\n\n withIcon: {\n // Add a gutter for the icon, to allow multiple lines of text to line up to the right of the icon.\n paddingLeft: `calc(${iconSize} + ${tokens.spacingHorizontalXS})`,\n },\n});\n\nconst useValidationMessageIconBaseClassName = makeResetStyles({\n display: 'inline-block',\n fontSize: iconSize,\n // Negative left margin puts the icon in the gutter of the validation message div's withIcon style.\n marginLeft: `calc(-${iconSize} - ${tokens.spacingHorizontalXS})`,\n marginRight: tokens.spacingHorizontalXS,\n // Line height of 0 prevents the verticalAlign from affecting the line height of the text.\n lineHeight: '0',\n // Negative verticalAlign shifts the inline icon down to align with the text (effectively top padding).\n verticalAlign: '-1px',\n});\n\nconst useValidationMessageIconStyles = makeStyles({\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 = (state: FieldState) => {\n const { validationState } = state;\n const horizontal = state.orientation === 'horizontal';\n\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n fieldClassNames.root,\n rootStyles.base,\n horizontal && rootStyles.horizontal,\n horizontal && !state.label && rootStyles.horizontalNoLabel,\n state.root.className,\n );\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n fieldClassNames.label,\n labelStyles.base,\n horizontal && labelStyles.horizontal,\n !horizontal && labelStyles.vertical,\n state.label.size === 'large' && labelStyles.large,\n !horizontal && state.label.size === 'large' && labelStyles.verticalLarge,\n state.label.className,\n );\n }\n\n const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();\n const validationMessageIconStyles = useValidationMessageIconStyles();\n if (state.validationMessageIcon) {\n state.validationMessageIcon.className = mergeClasses(\n fieldClassNames.validationMessageIcon,\n validationMessageIconBaseClassName,\n validationState !== 'none' && validationMessageIconStyles[validationState],\n state.validationMessageIcon.className,\n );\n }\n\n const secondaryTextBaseClassName = useSecondaryTextBaseClassName();\n const secondaryTextStyles = useSecondaryTextStyles();\n if (state.validationMessage) {\n state.validationMessage.className = mergeClasses(\n fieldClassNames.validationMessage,\n secondaryTextBaseClassName,\n validationState === 'error' && secondaryTextStyles.error,\n !!state.validationMessageIcon && secondaryTextStyles.withIcon,\n state.validationMessage.className,\n );\n }\n\n if (state.hint) {\n state.hint.className = mergeClasses(fieldClassNames.hint, secondaryTextBaseClassName, state.hint.className);\n }\n};\n"]}
|
package/lib-commonjs/index.js
CHANGED
@@ -3,14 +3,18 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
7
|
-
|
6
|
+
exports.makeDeprecatedField = exports.getDeprecatedFieldClassNames = exports.useField_unstable = exports.useFieldStyles_unstable = exports.renderField_unstable = exports.fieldClassNames = exports.Field = void 0;
|
8
7
|
var Field_1 = /*#__PURE__*/require("./Field");
|
9
|
-
|
10
|
-
|
8
|
+
Object.defineProperty(exports, "Field", {
|
9
|
+
enumerable: true,
|
10
|
+
get: function () {
|
11
|
+
return Field_1.Field;
|
12
|
+
}
|
13
|
+
});
|
14
|
+
Object.defineProperty(exports, "fieldClassNames", {
|
11
15
|
enumerable: true,
|
12
16
|
get: function () {
|
13
|
-
return Field_1.
|
17
|
+
return Field_1.fieldClassNames;
|
14
18
|
}
|
15
19
|
});
|
16
20
|
Object.defineProperty(exports, "renderField_unstable", {
|
@@ -31,139 +35,18 @@ Object.defineProperty(exports, "useField_unstable", {
|
|
31
35
|
return Field_1.useField_unstable;
|
32
36
|
}
|
33
37
|
});
|
34
|
-
|
35
|
-
var
|
36
|
-
|
37
|
-
Object.defineProperty(exports, "CheckboxField", {
|
38
|
-
enumerable: true,
|
39
|
-
get: function () {
|
40
|
-
return CheckboxField_1.CheckboxField;
|
41
|
-
}
|
42
|
-
});
|
43
|
-
Object.defineProperty(exports, "checkboxFieldClassNames", {
|
44
|
-
enumerable: true,
|
45
|
-
get: function () {
|
46
|
-
return CheckboxField_1.checkboxFieldClassNames;
|
47
|
-
}
|
48
|
-
});
|
49
|
-
|
50
|
-
var ComboboxField_1 = /*#__PURE__*/require("./ComboboxField");
|
51
|
-
|
52
|
-
Object.defineProperty(exports, "ComboboxField", {
|
53
|
-
enumerable: true,
|
54
|
-
get: function () {
|
55
|
-
return ComboboxField_1.ComboboxField;
|
56
|
-
}
|
57
|
-
});
|
58
|
-
Object.defineProperty(exports, "comboboxFieldClassNames", {
|
59
|
-
enumerable: true,
|
60
|
-
get: function () {
|
61
|
-
return ComboboxField_1.comboboxFieldClassNames;
|
62
|
-
}
|
63
|
-
});
|
64
|
-
|
65
|
-
var InputField_1 = /*#__PURE__*/require("./InputField");
|
66
|
-
|
67
|
-
Object.defineProperty(exports, "InputField", {
|
68
|
-
enumerable: true,
|
69
|
-
get: function () {
|
70
|
-
return InputField_1.InputField;
|
71
|
-
}
|
72
|
-
});
|
73
|
-
Object.defineProperty(exports, "inputFieldClassNames", {
|
74
|
-
enumerable: true,
|
75
|
-
get: function () {
|
76
|
-
return InputField_1.inputFieldClassNames;
|
77
|
-
}
|
78
|
-
});
|
79
|
-
|
80
|
-
var RadioGroupField_1 = /*#__PURE__*/require("./RadioGroupField");
|
81
|
-
|
82
|
-
Object.defineProperty(exports, "RadioGroupField", {
|
83
|
-
enumerable: true,
|
84
|
-
get: function () {
|
85
|
-
return RadioGroupField_1.RadioGroupField;
|
86
|
-
}
|
87
|
-
});
|
88
|
-
Object.defineProperty(exports, "radioGroupFieldClassNames", {
|
89
|
-
enumerable: true,
|
90
|
-
get: function () {
|
91
|
-
return RadioGroupField_1.radioGroupFieldClassNames;
|
92
|
-
}
|
93
|
-
});
|
94
|
-
|
95
|
-
var SelectField_1 = /*#__PURE__*/require("./SelectField");
|
96
|
-
|
97
|
-
Object.defineProperty(exports, "SelectField", {
|
98
|
-
enumerable: true,
|
99
|
-
get: function () {
|
100
|
-
return SelectField_1.SelectField;
|
101
|
-
}
|
102
|
-
});
|
103
|
-
Object.defineProperty(exports, "selectFieldClassNames", {
|
104
|
-
enumerable: true,
|
105
|
-
get: function () {
|
106
|
-
return SelectField_1.selectFieldClassNames;
|
107
|
-
}
|
108
|
-
});
|
109
|
-
|
110
|
-
var SliderField_1 = /*#__PURE__*/require("./SliderField");
|
111
|
-
|
112
|
-
Object.defineProperty(exports, "SliderField", {
|
113
|
-
enumerable: true,
|
114
|
-
get: function () {
|
115
|
-
return SliderField_1.SliderField;
|
116
|
-
}
|
117
|
-
});
|
118
|
-
Object.defineProperty(exports, "sliderFieldClassNames", {
|
119
|
-
enumerable: true,
|
120
|
-
get: function () {
|
121
|
-
return SliderField_1.sliderFieldClassNames;
|
122
|
-
}
|
123
|
-
});
|
124
|
-
|
125
|
-
var SpinButtonField_1 = /*#__PURE__*/require("./SpinButtonField");
|
126
|
-
|
127
|
-
Object.defineProperty(exports, "SpinButtonField", {
|
128
|
-
enumerable: true,
|
129
|
-
get: function () {
|
130
|
-
return SpinButtonField_1.SpinButtonField;
|
131
|
-
}
|
132
|
-
});
|
133
|
-
Object.defineProperty(exports, "spinButtonFieldClassNames", {
|
134
|
-
enumerable: true,
|
135
|
-
get: function () {
|
136
|
-
return SpinButtonField_1.spinButtonFieldClassNames;
|
137
|
-
}
|
138
|
-
});
|
139
|
-
|
140
|
-
var SwitchField_1 = /*#__PURE__*/require("./SwitchField");
|
141
|
-
|
142
|
-
Object.defineProperty(exports, "SwitchField", {
|
143
|
-
enumerable: true,
|
144
|
-
get: function () {
|
145
|
-
return SwitchField_1.SwitchField;
|
146
|
-
}
|
147
|
-
});
|
148
|
-
Object.defineProperty(exports, "switchFieldClassNames", {
|
149
|
-
enumerable: true,
|
150
|
-
get: function () {
|
151
|
-
return SwitchField_1.switchFieldClassNames;
|
152
|
-
}
|
153
|
-
});
|
154
|
-
|
155
|
-
var TextareaField_1 = /*#__PURE__*/require("./TextareaField");
|
156
|
-
|
157
|
-
Object.defineProperty(exports, "TextareaField", {
|
38
|
+
// eslint-disable-next-line deprecation/deprecation
|
39
|
+
var makeDeprecatedField_1 = /*#__PURE__*/require("./util/makeDeprecatedField");
|
40
|
+
Object.defineProperty(exports, "getDeprecatedFieldClassNames", {
|
158
41
|
enumerable: true,
|
159
42
|
get: function () {
|
160
|
-
return
|
43
|
+
return makeDeprecatedField_1.getDeprecatedFieldClassNames;
|
161
44
|
}
|
162
45
|
});
|
163
|
-
Object.defineProperty(exports, "
|
46
|
+
Object.defineProperty(exports, "makeDeprecatedField", {
|
164
47
|
enumerable: true,
|
165
48
|
get: function () {
|
166
|
-
return
|
49
|
+
return makeDeprecatedField_1.makeDeprecatedField;
|
167
50
|
}
|
168
51
|
});
|
169
52
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAASA;EAAAC;EAAAC;IAAA,oBAAK;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,8BAAe;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,mCAAoB;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,sCAAuB;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,gCAAiB;EAAA;AAAA;AAGjG;AACA;AAASF;EAAAC;EAAAC;IAAA,yDAA4B;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,gDAAmB;EAAA;AAAA","names":["Object","enumerable","get"],"sourceRoot":"../src/","sources":["packages/react-components/react-field/src/index.ts"],"sourcesContent":["export { Field, fieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from './Field';\nexport type { FieldProps, FieldSlots, FieldState } from './Field';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { getDeprecatedFieldClassNames, makeDeprecatedField } from './util/makeDeprecatedField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { DeprecatedFieldProps } from './util/makeDeprecatedField';\n"]}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getDeprecatedFieldClassNames = exports.makeDeprecatedField = void 0;
|
7
|
+
/* eslint-disable deprecation/deprecation */
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
|
+
const Field_1 = /*#__PURE__*/require("../Field");
|
10
|
+
/**
|
11
|
+
* Partition the props used by the Field itself, from the props that are passed to the underlying field component.
|
12
|
+
*/
|
13
|
+
function getPartitionedFieldProps(props) {
|
14
|
+
const {
|
15
|
+
className,
|
16
|
+
control,
|
17
|
+
hint,
|
18
|
+
label,
|
19
|
+
orientation,
|
20
|
+
required,
|
21
|
+
root,
|
22
|
+
size,
|
23
|
+
style,
|
24
|
+
validationMessage,
|
25
|
+
validationMessageIcon,
|
26
|
+
validationState = 'none',
|
27
|
+
...restOfProps
|
28
|
+
} = props;
|
29
|
+
return [{
|
30
|
+
className,
|
31
|
+
hint,
|
32
|
+
label,
|
33
|
+
orientation,
|
34
|
+
required,
|
35
|
+
size,
|
36
|
+
style,
|
37
|
+
validationMessage,
|
38
|
+
validationMessageIcon,
|
39
|
+
validationState,
|
40
|
+
...root
|
41
|
+
}, {
|
42
|
+
required,
|
43
|
+
size,
|
44
|
+
...restOfProps,
|
45
|
+
...control
|
46
|
+
}];
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* @deprecated Only for use to make deprecated [Control]Field shim components.
|
50
|
+
* @internal
|
51
|
+
*/
|
52
|
+
function makeDeprecatedField(Control, options = {}) {
|
53
|
+
const {
|
54
|
+
mapProps = props => props,
|
55
|
+
displayName = `${Control.displayName}Field`
|
56
|
+
} = options;
|
57
|
+
const DeprecatedField = React.forwardRef((props, ref) => {
|
58
|
+
const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));
|
59
|
+
return React.createElement(Field_1.Field, {
|
60
|
+
...fieldProps
|
61
|
+
}, React.createElement(Control, {
|
62
|
+
...controlProps,
|
63
|
+
ref: ref
|
64
|
+
}));
|
65
|
+
});
|
66
|
+
DeprecatedField.displayName = displayName;
|
67
|
+
return DeprecatedField;
|
68
|
+
}
|
69
|
+
exports.makeDeprecatedField = makeDeprecatedField;
|
70
|
+
/**
|
71
|
+
* @deprecated Only for use to make deprecated [Control]Field shim components.
|
72
|
+
* @internal
|
73
|
+
*/
|
74
|
+
const getDeprecatedFieldClassNames = controlRootClassName => ({
|
75
|
+
...Field_1.fieldClassNames,
|
76
|
+
control: controlRootClassName
|
77
|
+
});
|
78
|
+
exports.getDeprecatedFieldClassNames = getDeprecatedFieldClassNames;
|
79
|
+
//# sourceMappingURL=makeDeprecatedField.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;AAqBA;;;AAGA,SAASA,wBAAwB,CAC/BC,KAAiF;EAEjF,MAAM;IACJC,SAAS;IACTC,OAAO;IACPC,IAAI;IACJC,KAAK;IACLC,WAAW;IACXC,QAAQ;IACRC,IAAI;IACJC,IAAI;IACJC,KAAK;IACLC,iBAAiB;IACjBC,qBAAqB;IACrBC,eAAe,GAAG,MAAM;IACxB,GAAGC;EAAW,CACf,GAAGb,KAAK;EAET,OAAO,CACL;IACEC,SAAS;IACTE,IAAI;IACJC,KAAK;IACLC,WAAW;IACXC,QAAQ;IACRE,IAAI;IACJC,KAAK;IACLC,iBAAiB;IACjBC,qBAAqB;IACrBC,eAAe;IACf,GAAGL;GACJ,EACD;IACED,QAAQ;IACRE,IAAI;IACJ,GAAGK,WAAW;IACd,GAAGX;GACJ,CACF;AACH;AAEA;;;;AAIA,SAAgBY,mBAAmB,CACjCC,OAA0C,EAC1CC,UAGI,EAAE;EAEN,MAAM;IAAEC,QAAQ,GAAGjB,KAAK,IAAIA,KAAK;IAAEkB,WAAW,GAAG,GAAGH,OAAO,CAACG,WAAW;EAAO,CAAE,GAAGF,OAAO;EAE1F,MAAMG,eAAe,GAAGC,KAAK,CAACC,UAAU,CAAC,CAACrB,KAAK,EAAEsB,GAAG,KAAI;IACtD,MAAM,CAACC,UAAU,EAAEC,YAAY,CAAC,GAAGzB,wBAAwB,CAACkB,QAAQ,CAACjB,KAAK,CAAC,CAAC;IAC5E,OACEoB,oBAACK,aAAK;MAAA,GAAKF;IAAU,GAEnBH,oBAACL,OAAO;MAAA,GAAMS,YAAoB;MAAEF,GAAG,EAAEA;IAAU,EAAI,CACjD;EAEZ,CAAC,CAA4D;EAE7DH,eAAe,CAACD,WAAW,GAAGA,WAAW;EAEzC,OAAOC,eAAe;AACxB;AAtBAO;AAwBA;;;;AAIO,MAAMC,4BAA4B,GAAIC,oBAA4B,KAAM;EAC7E,GAAGH,uBAAe;EAClBvB,OAAO,EAAE0B;CACV,CAAC;AAHWF,oCAA4B","names":["getPartitionedFieldProps","props","className","control","hint","label","orientation","required","root","size","style","validationMessage","validationMessageIcon","validationState","restOfProps","makeDeprecatedField","Control","options","mapProps","displayName","DeprecatedField","React","forwardRef","ref","fieldProps","controlProps","Field_1","exports","getDeprecatedFieldClassNames","controlRootClassName"],"sourceRoot":"../src/","sources":["packages/react-components/react-field/src/util/makeDeprecatedField.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport * as React from 'react';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../Field';\nimport { Field, fieldClassNames } from '../Field';\n\n/**\n * @deprecated Only for use to make deprecated [Control]Field shim components.\n * @internal\n */\nexport type DeprecatedFieldProps<ControlProps> = ControlProps & {\n root?: FieldProps;\n control?: ControlProps;\n} & Pick<\n FieldProps,\n | 'className'\n | 'hint'\n | 'label'\n | 'orientation'\n | 'style'\n | 'validationMessage'\n | 'validationMessageIcon'\n | 'validationState'\n >;\n\n/**\n * Partition the props used by the Field itself, from the props that are passed to the underlying field component.\n */\nfunction getPartitionedFieldProps<ControlProps>(\n props: DeprecatedFieldProps<ControlProps> & Pick<FieldProps, 'required' | 'size'>,\n) {\n const {\n className,\n control,\n hint,\n label,\n orientation,\n required,\n root,\n size,\n style,\n validationMessage,\n validationMessageIcon,\n validationState = 'none',\n ...restOfProps\n } = props;\n\n return [\n {\n className,\n hint,\n label,\n orientation,\n required,\n size,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n ...root,\n },\n {\n required,\n size,\n ...restOfProps,\n ...control,\n },\n ];\n}\n\n/**\n * @deprecated Only for use to make deprecated [Control]Field shim components.\n * @internal\n */\nexport function makeDeprecatedField<ControlProps>(\n Control: React.ComponentType<ControlProps>,\n options: {\n mapProps?: (props: DeprecatedFieldProps<ControlProps>) => DeprecatedFieldProps<ControlProps>;\n displayName?: string;\n } = {},\n) {\n const { mapProps = props => props, displayName = `${Control.displayName}Field` } = options;\n\n const DeprecatedField = React.forwardRef((props, ref) => {\n const [fieldProps, controlProps] = getPartitionedFieldProps(mapProps(props));\n return (\n <Field {...fieldProps}>\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\n <Control {...(controlProps as any)} ref={ref as any} />\n </Field>\n );\n }) as ForwardRefComponent<DeprecatedFieldProps<ControlProps>>;\n\n DeprecatedField.displayName = displayName;\n\n return DeprecatedField;\n}\n\n/**\n * @deprecated Only for use to make deprecated [Control]Field shim components.\n * @internal\n */\nexport const getDeprecatedFieldClassNames = (controlRootClassName: string) => ({\n ...fieldClassNames,\n control: controlRootClassName,\n});\n"]}
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-field",
|
3
|
-
"version": "9.0.0-alpha.
|
3
|
+
"version": "9.0.0-alpha.20",
|
4
4
|
"description": "Fluent UI Field components",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
7
|
-
"typings": "dist/index.d.ts",
|
7
|
+
"typings": "./dist/index.d.ts",
|
8
8
|
"sideEffects": false,
|
9
9
|
"repository": {
|
10
10
|
"type": "git",
|
@@ -13,6 +13,7 @@
|
|
13
13
|
"license": "MIT",
|
14
14
|
"scripts": {
|
15
15
|
"build": "just-scripts build",
|
16
|
+
"bundle-size": "bundle-size measure",
|
16
17
|
"clean": "just-scripts clean",
|
17
18
|
"code-style": "just-scripts code-style",
|
18
19
|
"just": "just-scripts",
|
@@ -20,39 +21,30 @@
|
|
20
21
|
"start": "yarn storybook",
|
21
22
|
"storybook": "start-storybook",
|
22
23
|
"test": "jest --passWithNoTests",
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"type-check": "tsc -b tsconfig.json"
|
24
|
+
"type-check": "tsc -b tsconfig.json",
|
25
|
+
"generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"@fluentui/eslint-plugin": "*",
|
29
29
|
"@fluentui/react-conformance": "*",
|
30
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
31
|
-
"@fluentui/scripts": "
|
30
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.19",
|
31
|
+
"@fluentui/scripts-api-extractor": "*",
|
32
|
+
"@fluentui/scripts-tasks": "*"
|
32
33
|
},
|
33
34
|
"dependencies": {
|
34
|
-
"@fluentui/react-
|
35
|
-
"@fluentui/react-combobox": "^9.0.0-beta.10",
|
36
|
-
"@fluentui/react-context-selector": "^9.0.3",
|
35
|
+
"@fluentui/react-context-selector": "^9.1.9",
|
37
36
|
"@fluentui/react-icons": "^2.0.175",
|
38
|
-
"@fluentui/react-
|
39
|
-
"@fluentui/react-
|
40
|
-
"@fluentui/react-
|
41
|
-
"@
|
42
|
-
"@fluentui/react-slider": "^9.0.5",
|
43
|
-
"@fluentui/react-spinbutton": "^9.0.2",
|
44
|
-
"@fluentui/react-switch": "^9.0.6",
|
45
|
-
"@fluentui/react-textarea": "^9.1.0",
|
46
|
-
"@fluentui/react-theme": "^9.1.0",
|
47
|
-
"@fluentui/react-utilities": "^9.1.0",
|
48
|
-
"@griffel/react": "^1.3.0",
|
37
|
+
"@fluentui/react-label": "^9.0.21",
|
38
|
+
"@fluentui/react-theme": "^9.1.5",
|
39
|
+
"@fluentui/react-utilities": "^9.5.3",
|
40
|
+
"@griffel/react": "^1.5.2",
|
49
41
|
"tslib": "^2.1.0"
|
50
42
|
},
|
51
43
|
"peerDependencies": {
|
52
|
-
"@types/react": ">=16.8.0 <
|
53
|
-
"@types/react-dom": ">=16.8.0 <
|
54
|
-
"react": ">=16.8.0 <
|
55
|
-
"react-dom": ">=16.8.0 <
|
44
|
+
"@types/react": ">=16.8.0 <19.0.0",
|
45
|
+
"@types/react-dom": ">=16.8.0 <19.0.0",
|
46
|
+
"react": ">=16.8.0 <19.0.0",
|
47
|
+
"react-dom": ">=16.8.0 <19.0.0"
|
56
48
|
},
|
57
49
|
"beachball": {
|
58
50
|
"disallowedChangeTypes": [
|
@@ -60,5 +52,13 @@
|
|
60
52
|
"minor",
|
61
53
|
"patch"
|
62
54
|
]
|
55
|
+
},
|
56
|
+
"exports": {
|
57
|
+
".": {
|
58
|
+
"types": "./dist/index.d.ts",
|
59
|
+
"import": "./lib/index.js",
|
60
|
+
"require": "./lib-commonjs/index.js"
|
61
|
+
},
|
62
|
+
"./package.json": "./package.json"
|
63
63
|
}
|
64
64
|
}
|