@fluentui/react-field 0.0.0-nightly-20230118-0420.1 → 0.0.0-nightly-20230120-0420.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +13 -13
- package/CHANGELOG.md +9 -9
- package/lib/components/Field/renderField.js +3 -3
- package/lib/components/Field/renderField.js.map +1 -1
- package/lib/components/Field/useFieldStyles.js +39 -58
- package/lib/components/Field/useFieldStyles.js.map +1 -1
- package/lib-commonjs/components/Field/renderField.js +3 -3
- package/lib-commonjs/components/Field/renderField.js.map +1 -1
- package/lib-commonjs/components/Field/useFieldStyles.js +38 -57
- package/lib-commonjs/components/Field/useFieldStyles.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-field",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-field_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Fri, 20 Jan 2023 04:28:45 GMT",
|
6
|
+
"tag": "@fluentui/react-field_v0.0.0-nightly-20230120-0420.1",
|
7
|
+
"version": "0.0.0-nightly-20230120-0420.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,32 +16,32 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-field",
|
19
|
-
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20230120-0420.1",
|
20
|
+
"commit": "b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a"
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"author": "beachball",
|
24
24
|
"package": "@fluentui/react-field",
|
25
|
-
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-
|
26
|
-
"commit": "
|
25
|
+
"comment": "Bump @fluentui/react-label to v0.0.0-nightly-20230120-0420.1",
|
26
|
+
"commit": "b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"author": "beachball",
|
30
30
|
"package": "@fluentui/react-field",
|
31
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
32
|
-
"commit": "
|
31
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230120-0420.1",
|
32
|
+
"commit": "b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a"
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"author": "beachball",
|
36
36
|
"package": "@fluentui/react-field",
|
37
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
38
|
-
"commit": "
|
37
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230120-0420.1",
|
38
|
+
"commit": "b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a"
|
39
39
|
},
|
40
40
|
{
|
41
41
|
"author": "beachball",
|
42
42
|
"package": "@fluentui/react-field",
|
43
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
44
|
-
"commit": "
|
43
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230120-0420.1",
|
44
|
+
"commit": "b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a"
|
45
45
|
}
|
46
46
|
]
|
47
47
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# Change Log - @fluentui/react-field
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Fri, 20 Jan 2023 04:28:45 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230120-0420.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v0.0.0-nightly-20230120-0420.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.15..@fluentui/react-field_v0.0.0-nightly-
|
9
|
+
Fri, 20 Jan 2023 04:28:45 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-field_v9.0.0-alpha.15..@fluentui/react-field_v0.0.0-nightly-20230120-0420.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/react-context-selector to v0.0.0-nightly-
|
16
|
-
- Bump @fluentui/react-label to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
18
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
19
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/react-context-selector to v0.0.0-nightly-20230120-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a) by beachball)
|
16
|
+
- Bump @fluentui/react-label to v0.0.0-nightly-20230120-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a) by beachball)
|
17
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230120-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a) by beachball)
|
18
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230120-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a) by beachball)
|
19
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230120-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/b5182ae219cc5dcdd1843ea7c46c2bcfcd78a12a) by beachball)
|
20
20
|
|
21
21
|
## [9.0.0-alpha.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-field_v9.0.0-alpha.15)
|
22
22
|
|
@@ -14,11 +14,11 @@ export const renderField_unstable = state => {
|
|
14
14
|
...slotProps.label
|
15
15
|
}), slots.control && /*#__PURE__*/React.createElement(slots.control, {
|
16
16
|
...slotProps.control
|
17
|
-
}), slots.validationMessage && slots.validationMessageIcon && /*#__PURE__*/React.createElement(slots.validationMessageIcon, {
|
18
|
-
...slotProps.validationMessageIcon
|
19
17
|
}), slots.validationMessage && /*#__PURE__*/React.createElement(slots.validationMessage, {
|
20
18
|
...slotProps.validationMessage
|
21
|
-
}
|
19
|
+
}, slots.validationMessageIcon && /*#__PURE__*/React.createElement(slots.validationMessageIcon, {
|
20
|
+
...slotProps.validationMessageIcon
|
21
|
+
}), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/React.createElement(slots.hint, {
|
22
22
|
...slotProps.hint
|
23
23
|
}));
|
24
24
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAGpD;;;AAGA,OAAO,MAAMC,oBAAoB,GAA4BC,KAAoB,IAAI;EACnF,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,QAAQ,CAA2BE,KAAiC,CAAC;EAElG,oBACEH,oBAACI,KAAK,CAACE,IAAI;IAAA,GAAKD,SAAS,CAACC;EAAI,GAC3BF,KAAK,CAACG,KAAK,iBAAIP,oBAACI,KAAK,CAACG,KAAK;IAAA,GAAKF,SAAS,CAACE;EAAK,EAAI,EAEnDH,KAAK,CAACI,OAAO,iBAAIR,oBAACI,KAAK,CAACI,OAAO;IAAA,GAAMH,SAAS,CAACG;EAAe,EAAI,EAClEJ,KAAK,CAACK,iBAAiB,
|
1
|
+
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAGpD;;;AAGA,OAAO,MAAMC,oBAAoB,GAA4BC,KAAoB,IAAI;EACnF,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,QAAQ,CAA2BE,KAAiC,CAAC;EAElG,oBACEH,oBAACI,KAAK,CAACE,IAAI;IAAA,GAAKD,SAAS,CAACC;EAAI,GAC3BF,KAAK,CAACG,KAAK,iBAAIP,oBAACI,KAAK,CAACG,KAAK;IAAA,GAAKF,SAAS,CAACE;EAAK,EAAI,EAEnDH,KAAK,CAACI,OAAO,iBAAIR,oBAACI,KAAK,CAACI,OAAO;IAAA,GAAMH,SAAS,CAACG;EAAe,EAAI,EAClEJ,KAAK,CAACK,iBAAiB,iBACtBT,oBAACI,KAAK,CAACK,iBAAiB;IAAA,GAAKJ,SAAS,CAACI;EAAiB,GACrDL,KAAK,CAACM,qBAAqB,iBAAIV,oBAACI,KAAK,CAACM,qBAAqB;IAAA,GAAKL,SAAS,CAACK;EAAqB,EAAI,EACnGL,SAAS,CAACI,iBAAiB,CAACE,QAAQ,CAExC,EACAP,KAAK,CAACQ,IAAI,iBAAIZ,oBAACI,KAAK,CAACQ,IAAI;IAAA,GAAKP,SAAS,CAACO;EAAI,EAAI,CACtC;AAEjB,CAAC","names":["React","getSlots","renderField_unstable","state","slots","slotProps","root","label","control","validationMessage","validationMessageIcon","children","hint"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/renderField.tsx"],"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"]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
2
|
-
import { __styles, mergeClasses } from '@griffel/react';
|
2
|
+
import { __resetStyles, __styles, mergeClasses } from '@griffel/react';
|
3
3
|
export const getFieldClassNames = name => ({
|
4
4
|
root: `fui-${name}`,
|
5
5
|
control: `fui-${name}__control`,
|
@@ -8,83 +8,62 @@ export const getFieldClassNames = name => ({
|
|
8
8
|
validationMessageIcon: `fui-${name}__validationMessageIcon`,
|
9
9
|
hint: `fui-${name}__hint`
|
10
10
|
});
|
11
|
+
// Size of the icon in the validation message
|
12
|
+
const iconSize = '12px';
|
11
13
|
/**
|
12
14
|
* Styles for the root slot
|
13
15
|
*/
|
14
16
|
const useRootStyles = /*#__PURE__*/__styles({
|
15
17
|
base: {
|
16
|
-
mc9l5x: "f13qh94s"
|
17
|
-
Bxotwcr: "f14np9u9",
|
18
|
-
Budl1dq: "fjxzuw",
|
19
|
-
zoa1oz: "f6nraym",
|
20
|
-
B7hvi0a: "f1m2n5bn"
|
18
|
+
mc9l5x: "f13qh94s"
|
21
19
|
},
|
22
20
|
horizontal: {
|
23
|
-
Budl1dq: "
|
24
|
-
|
21
|
+
Budl1dq: "f2wwaib",
|
22
|
+
wkccdc: "f1645dqt"
|
25
23
|
},
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
Ijaq50: "f1tty21m",
|
30
|
-
nk6f5a: "f19648ye"
|
31
|
-
},
|
32
|
-
control: {
|
33
|
-
Br312pm: "f1bfa6ju",
|
34
|
-
Bw0ie65: "fl3lap4"
|
35
|
-
},
|
36
|
-
validationIcon: {
|
37
|
-
Br312pm: "ftfzah7",
|
38
|
-
Bw0ie65: "f1fih8f9"
|
39
|
-
},
|
40
|
-
validationMessage: {
|
41
|
-
Br312pm: "f1n69xcw",
|
42
|
-
Bw0ie65: "f1hw1m5m"
|
43
|
-
},
|
44
|
-
hint: {
|
45
|
-
Br312pm: "fbug73u",
|
46
|
-
Bw0ie65: "fbtgo1w"
|
24
|
+
horizontalNoLabel: {
|
25
|
+
uwmqm3: ["f15jqgz8", "fggqkej"],
|
26
|
+
Budl1dq: "f1c2z91y"
|
47
27
|
}
|
48
28
|
}, {
|
49
|
-
d: [".f13qh94s{display:grid;}", ".
|
29
|
+
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;}"]
|
50
30
|
});
|
51
31
|
const useLabelStyles = /*#__PURE__*/__styles({
|
52
32
|
base: {
|
53
|
-
|
33
|
+
z8tnut: "fclwglc",
|
34
|
+
Byoj8tv: "fywfov9"
|
35
|
+
},
|
36
|
+
large: {
|
37
|
+
z8tnut: "f1sl3k7w",
|
38
|
+
Byoj8tv: "f1brlhvm"
|
39
|
+
},
|
40
|
+
vertical: {
|
54
41
|
jrapky: "fyacil5"
|
55
42
|
},
|
43
|
+
verticalLarge: {
|
44
|
+
jrapky: "f8l5zjj"
|
45
|
+
},
|
56
46
|
horizontal: {
|
57
47
|
t21cq0: ["fkujibs", "f199hnxi"],
|
58
|
-
|
59
|
-
|
48
|
+
Ijaq50: "f16hsg94",
|
49
|
+
nk6f5a: "f1nzqi2z"
|
60
50
|
}
|
61
51
|
}, {
|
62
|
-
d: [".
|
52
|
+
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;}"]
|
63
53
|
});
|
54
|
+
const useSecondaryTextBaseClassName = /*#__PURE__*/__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);}"]);
|
64
55
|
const useSecondaryTextStyles = /*#__PURE__*/__styles({
|
65
|
-
base: {
|
66
|
-
B6of3ja: "fg30ohd",
|
67
|
-
sj55zd: "f11d4kpn",
|
68
|
-
Bahqtrf: "fk6fouc",
|
69
|
-
Be2twd7: "fy9rknc",
|
70
|
-
Bhrd7zp: "figsok6",
|
71
|
-
Bg96gwp: "fwrc4pm"
|
72
|
-
},
|
73
56
|
error: {
|
74
57
|
sj55zd: "f1hcrxcs"
|
58
|
+
},
|
59
|
+
withIcon: {
|
60
|
+
uwmqm3: ["frawy03", "fg4c52"]
|
75
61
|
}
|
76
62
|
}, {
|
77
|
-
d: [".
|
63
|
+
d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}", ".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}"]
|
78
64
|
});
|
65
|
+
const useValidationMessageIconBaseClassName = /*#__PURE__*/__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;}"]);
|
79
66
|
const useValidationMessageIconStyles = /*#__PURE__*/__styles({
|
80
|
-
base: {
|
81
|
-
mc9l5x: "ftgm304",
|
82
|
-
qb2dma: "f9h729m",
|
83
|
-
Be2twd7: "f1ugzwwg",
|
84
|
-
Bg96gwp: "fp4gqsa",
|
85
|
-
t21cq0: ["fm0x6gh", "fbyavb5"],
|
86
|
-
B6of3ja: "fww94b8"
|
87
|
-
},
|
88
67
|
error: {
|
89
68
|
sj55zd: "f1hcrxcs"
|
90
69
|
},
|
@@ -95,7 +74,7 @@ const useValidationMessageIconStyles = /*#__PURE__*/__styles({
|
|
95
74
|
sj55zd: "ffmvakt"
|
96
75
|
}
|
97
76
|
}, {
|
98
|
-
d: [".
|
77
|
+
d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}", ".ffmvakt{color:var(--colorPaletteGreenForeground1);}"]
|
99
78
|
});
|
100
79
|
/**
|
101
80
|
* Apply styling to the Field slots based on the state
|
@@ -105,24 +84,26 @@ export const useFieldStyles_unstable = state => {
|
|
105
84
|
const validationState = state.validationState;
|
106
85
|
const horizontal = state.orientation === 'horizontal';
|
107
86
|
const rootStyles = useRootStyles();
|
108
|
-
state.root.className = mergeClasses(classNames.root, rootStyles.base, horizontal && rootStyles.horizontal, state.root.className);
|
87
|
+
state.root.className = mergeClasses(classNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);
|
109
88
|
if (state.control) {
|
110
|
-
state.control.className = mergeClasses(classNames.control,
|
89
|
+
state.control.className = mergeClasses(classNames.control, state.control.className);
|
111
90
|
}
|
112
91
|
const labelStyles = useLabelStyles();
|
113
92
|
if (state.label) {
|
114
|
-
state.label.className = mergeClasses(classNames.label,
|
93
|
+
state.label.className = mergeClasses(classNames.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);
|
115
94
|
}
|
95
|
+
const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();
|
116
96
|
const validationMessageIconStyles = useValidationMessageIconStyles();
|
117
97
|
if (state.validationMessageIcon) {
|
118
|
-
state.validationMessageIcon.className = mergeClasses(classNames.validationMessageIcon,
|
98
|
+
state.validationMessageIcon.className = mergeClasses(classNames.validationMessageIcon, validationMessageIconBaseClassName, !!validationState && validationMessageIconStyles[validationState], state.validationMessageIcon.className);
|
119
99
|
}
|
100
|
+
const secondaryTextBaseClassName = useSecondaryTextBaseClassName();
|
120
101
|
const secondaryTextStyles = useSecondaryTextStyles();
|
121
102
|
if (state.validationMessage) {
|
122
|
-
state.validationMessage.className = mergeClasses(classNames.validationMessage,
|
103
|
+
state.validationMessage.className = mergeClasses(classNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);
|
123
104
|
}
|
124
105
|
if (state.hint) {
|
125
|
-
state.hint.className = mergeClasses(classNames.hint,
|
106
|
+
state.hint.className = mergeClasses(classNames.hint, secondaryTextBaseClassName, state.hint.className);
|
126
107
|
}
|
127
108
|
};
|
128
109
|
//# sourceMappingURL=useFieldStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":"AAAA,SAASA,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAEhE,
|
1
|
+
{"version":3,"mappings":"AAAA,SAASA,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAEhE,kCAAsCC,YAAY,QAAQ,gBAAgB;AAG1E,OAAO,MAAMC,kBAAkB,GAAIC,IAAY,KAAgD;EAC7FC,IAAI,EAAE,OAAOD,IAAI,EAAE;EACnBE,OAAO,EAAE,OAAOF,IAAI,WAAW;EAC/BG,KAAK,EAAE,OAAOH,IAAI,SAAS;EAC3BI,iBAAiB,EAAE,OAAOJ,IAAI,qBAAqB;EACnDK,qBAAqB,EAAE,OAAOL,IAAI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,KAAK,CAACV,qBAAqB,IAAI2B,mBAAmB,CAACE,QAAQ,EAC7DnB,KAAK,CAACX,iBAAiB,CAACiB,SAAS,CAClC;;EAGH,IAAIN,KAAK,CAACT,IAAI,EAAE;IACdS,KAAK,CAACT,IAAI,CAACe,SAAS,GAAGvB,YAAY,CAACkB,UAAU,CAACV,IAAI,EAAEyB,0BAA0B,EAAEhB,KAAK,CAACT,IAAI,CAACe,SAAS,CAAC;;AAE1G,CAAC","names":["tokens","typographyStyles","mergeClasses","getFieldClassNames","name","root","control","label","validationMessage","validationMessageIcon","hint","iconSize","useRootStyles","useLabelStyles","useSecondaryTextBaseClassName","useSecondaryTextStyles","useValidationMessageIconBaseClassName","useValidationMessageIconStyles","useFieldStyles_unstable","state","classNames","validationState","horizontal","orientation","rootStyles","className","base","horizontalNoLabel","labelStyles","vertical","size","large","verticalLarge","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles","error","withIcon"],"sourceRoot":"","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 { 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// 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 = <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 horizontal && !state.label && rootStyles.horizontalNoLabel,\n state.root.className,\n );\n\n if (state.control) {\n state.control.className = mergeClasses(classNames.control, state.control.className);\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 !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 classNames.validationMessageIcon,\n validationMessageIconBaseClassName,\n !!validationState && 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 classNames.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(classNames.hint, secondaryTextBaseClassName, state.hint.className);\n }\n};\n"]}
|
@@ -20,11 +20,11 @@ const renderField_unstable = state => {
|
|
20
20
|
...slotProps.label
|
21
21
|
}), slots.control && React.createElement(slots.control, {
|
22
22
|
...slotProps.control
|
23
|
-
}), slots.validationMessage && slots.validationMessageIcon && React.createElement(slots.validationMessageIcon, {
|
24
|
-
...slotProps.validationMessageIcon
|
25
23
|
}), slots.validationMessage && React.createElement(slots.validationMessage, {
|
26
24
|
...slotProps.validationMessage
|
27
|
-
}
|
25
|
+
}, slots.validationMessageIcon && React.createElement(slots.validationMessageIcon, {
|
26
|
+
...slotProps.validationMessageIcon
|
27
|
+
}), slotProps.validationMessage.children), slots.hint && React.createElement(slots.hint, {
|
28
28
|
...slotProps.hint
|
29
29
|
}));
|
30
30
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;;;AAGO,MAAMA,oBAAoB,GAA4BC,KAAoB,IAAI;EACnF,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAA2BH,KAAiC,CAAC;EAElG,OACEI,oBAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC3BJ,KAAK,CAACK,KAAK,IAAIF,oBAACH,KAAK,CAACK,KAAK;IAAA,GAAKJ,SAAS,CAACI;EAAK,EAAI,EAEnDL,KAAK,CAACM,OAAO,IAAIH,oBAACH,KAAK,CAACM,OAAO;IAAA,GAAML,SAAS,CAACK;EAAe,EAAI,EAClEN,KAAK,CAACO,iBAAiB,
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;;;AAGO,MAAMA,oBAAoB,GAA4BC,KAAoB,IAAI;EACnF,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAA2BH,KAAiC,CAAC;EAElG,OACEI,oBAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC3BJ,KAAK,CAACK,KAAK,IAAIF,oBAACH,KAAK,CAACK,KAAK;IAAA,GAAKJ,SAAS,CAACI;EAAK,EAAI,EAEnDL,KAAK,CAACM,OAAO,IAAIH,oBAACH,KAAK,CAACM,OAAO;IAAA,GAAML,SAAS,CAACK;EAAe,EAAI,EAClEN,KAAK,CAACO,iBAAiB,IACtBJ,oBAACH,KAAK,CAACO,iBAAiB;IAAA,GAAKN,SAAS,CAACM;EAAiB,GACrDP,KAAK,CAACQ,qBAAqB,IAAIL,oBAACH,KAAK,CAACQ,qBAAqB;IAAA,GAAKP,SAAS,CAACO;EAAqB,EAAI,EACnGP,SAAS,CAACM,iBAAiB,CAACE,QAAQ,CAExC,EACAT,KAAK,CAACU,IAAI,IAAIP,oBAACH,KAAK,CAACU,IAAI;IAAA,GAAKT,SAAS,CAACS;EAAI,EAAI,CACtC;AAEjB,CAAC;AAjBYC,4BAAoB","names":["renderField_unstable","state","slots","slotProps","react_utilities_1","React","root","label","control","validationMessage","validationMessageIcon","children","hint","exports"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-field/src/components/Field/renderField.tsx"],"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"]}
|
@@ -15,83 +15,62 @@ const getFieldClassNames = name => ({
|
|
15
15
|
hint: `fui-${name}__hint`
|
16
16
|
});
|
17
17
|
exports.getFieldClassNames = getFieldClassNames;
|
18
|
+
// Size of the icon in the validation message
|
19
|
+
const iconSize = '12px';
|
18
20
|
/**
|
19
21
|
* Styles for the root slot
|
20
22
|
*/
|
21
23
|
const useRootStyles = /*#__PURE__*/react_1.__styles({
|
22
24
|
base: {
|
23
|
-
mc9l5x: "f13qh94s"
|
24
|
-
Bxotwcr: "f14np9u9",
|
25
|
-
Budl1dq: "fjxzuw",
|
26
|
-
zoa1oz: "f6nraym",
|
27
|
-
B7hvi0a: "f1m2n5bn"
|
25
|
+
mc9l5x: "f13qh94s"
|
28
26
|
},
|
29
27
|
horizontal: {
|
30
|
-
Budl1dq: "
|
31
|
-
|
28
|
+
Budl1dq: "f2wwaib",
|
29
|
+
wkccdc: "f1645dqt"
|
32
30
|
},
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
Ijaq50: "f1tty21m",
|
37
|
-
nk6f5a: "f19648ye"
|
38
|
-
},
|
39
|
-
control: {
|
40
|
-
Br312pm: "f1bfa6ju",
|
41
|
-
Bw0ie65: "fl3lap4"
|
42
|
-
},
|
43
|
-
validationIcon: {
|
44
|
-
Br312pm: "ftfzah7",
|
45
|
-
Bw0ie65: "f1fih8f9"
|
46
|
-
},
|
47
|
-
validationMessage: {
|
48
|
-
Br312pm: "f1n69xcw",
|
49
|
-
Bw0ie65: "f1hw1m5m"
|
50
|
-
},
|
51
|
-
hint: {
|
52
|
-
Br312pm: "fbug73u",
|
53
|
-
Bw0ie65: "fbtgo1w"
|
31
|
+
horizontalNoLabel: {
|
32
|
+
uwmqm3: ["f15jqgz8", "fggqkej"],
|
33
|
+
Budl1dq: "f1c2z91y"
|
54
34
|
}
|
55
35
|
}, {
|
56
|
-
d: [".f13qh94s{display:grid;}", ".
|
36
|
+
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;}"]
|
57
37
|
});
|
58
38
|
const useLabelStyles = /*#__PURE__*/react_1.__styles({
|
59
39
|
base: {
|
60
|
-
|
40
|
+
z8tnut: "fclwglc",
|
41
|
+
Byoj8tv: "fywfov9"
|
42
|
+
},
|
43
|
+
large: {
|
44
|
+
z8tnut: "f1sl3k7w",
|
45
|
+
Byoj8tv: "f1brlhvm"
|
46
|
+
},
|
47
|
+
vertical: {
|
61
48
|
jrapky: "fyacil5"
|
62
49
|
},
|
50
|
+
verticalLarge: {
|
51
|
+
jrapky: "f8l5zjj"
|
52
|
+
},
|
63
53
|
horizontal: {
|
64
54
|
t21cq0: ["fkujibs", "f199hnxi"],
|
65
|
-
|
66
|
-
|
55
|
+
Ijaq50: "f16hsg94",
|
56
|
+
nk6f5a: "f1nzqi2z"
|
67
57
|
}
|
68
58
|
}, {
|
69
|
-
d: [".
|
59
|
+
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;}"]
|
70
60
|
});
|
61
|
+
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);}"]);
|
71
62
|
const useSecondaryTextStyles = /*#__PURE__*/react_1.__styles({
|
72
|
-
base: {
|
73
|
-
B6of3ja: "fg30ohd",
|
74
|
-
sj55zd: "f11d4kpn",
|
75
|
-
Bahqtrf: "fk6fouc",
|
76
|
-
Be2twd7: "fy9rknc",
|
77
|
-
Bhrd7zp: "figsok6",
|
78
|
-
Bg96gwp: "fwrc4pm"
|
79
|
-
},
|
80
63
|
error: {
|
81
64
|
sj55zd: "f1hcrxcs"
|
65
|
+
},
|
66
|
+
withIcon: {
|
67
|
+
uwmqm3: ["frawy03", "fg4c52"]
|
82
68
|
}
|
83
69
|
}, {
|
84
|
-
d: [".
|
70
|
+
d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".frawy03{padding-left:calc(12px + var(--spacingHorizontalXS));}", ".fg4c52{padding-right:calc(12px + var(--spacingHorizontalXS));}"]
|
85
71
|
});
|
72
|
+
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;}"]);
|
86
73
|
const useValidationMessageIconStyles = /*#__PURE__*/react_1.__styles({
|
87
|
-
base: {
|
88
|
-
mc9l5x: "ftgm304",
|
89
|
-
qb2dma: "f9h729m",
|
90
|
-
Be2twd7: "f1ugzwwg",
|
91
|
-
Bg96gwp: "fp4gqsa",
|
92
|
-
t21cq0: ["fm0x6gh", "fbyavb5"],
|
93
|
-
B6of3ja: "fww94b8"
|
94
|
-
},
|
95
74
|
error: {
|
96
75
|
sj55zd: "f1hcrxcs"
|
97
76
|
},
|
@@ -102,7 +81,7 @@ const useValidationMessageIconStyles = /*#__PURE__*/react_1.__styles({
|
|
102
81
|
sj55zd: "ffmvakt"
|
103
82
|
}
|
104
83
|
}, {
|
105
|
-
d: [".
|
84
|
+
d: [".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}", ".ffmvakt{color:var(--colorPaletteGreenForeground1);}"]
|
106
85
|
});
|
107
86
|
/**
|
108
87
|
* Apply styling to the Field slots based on the state
|
@@ -112,24 +91,26 @@ const useFieldStyles_unstable = state => {
|
|
112
91
|
const validationState = state.validationState;
|
113
92
|
const horizontal = state.orientation === 'horizontal';
|
114
93
|
const rootStyles = useRootStyles();
|
115
|
-
state.root.className = react_1.mergeClasses(classNames.root, rootStyles.base, horizontal && rootStyles.horizontal, state.root.className);
|
94
|
+
state.root.className = react_1.mergeClasses(classNames.root, rootStyles.base, horizontal && rootStyles.horizontal, horizontal && !state.label && rootStyles.horizontalNoLabel, state.root.className);
|
116
95
|
if (state.control) {
|
117
|
-
state.control.className = react_1.mergeClasses(classNames.control,
|
96
|
+
state.control.className = react_1.mergeClasses(classNames.control, state.control.className);
|
118
97
|
}
|
119
98
|
const labelStyles = useLabelStyles();
|
120
99
|
if (state.label) {
|
121
|
-
state.label.className = react_1.mergeClasses(classNames.label,
|
100
|
+
state.label.className = react_1.mergeClasses(classNames.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);
|
122
101
|
}
|
102
|
+
const validationMessageIconBaseClassName = useValidationMessageIconBaseClassName();
|
123
103
|
const validationMessageIconStyles = useValidationMessageIconStyles();
|
124
104
|
if (state.validationMessageIcon) {
|
125
|
-
state.validationMessageIcon.className = react_1.mergeClasses(classNames.validationMessageIcon,
|
105
|
+
state.validationMessageIcon.className = react_1.mergeClasses(classNames.validationMessageIcon, validationMessageIconBaseClassName, !!validationState && validationMessageIconStyles[validationState], state.validationMessageIcon.className);
|
126
106
|
}
|
107
|
+
const secondaryTextBaseClassName = useSecondaryTextBaseClassName();
|
127
108
|
const secondaryTextStyles = useSecondaryTextStyles();
|
128
109
|
if (state.validationMessage) {
|
129
|
-
state.validationMessage.className = react_1.mergeClasses(classNames.validationMessage,
|
110
|
+
state.validationMessage.className = react_1.mergeClasses(classNames.validationMessage, secondaryTextBaseClassName, validationState === 'error' && secondaryTextStyles.error, !!state.validationMessageIcon && secondaryTextStyles.withIcon, state.validationMessage.className);
|
130
111
|
}
|
131
112
|
if (state.hint) {
|
132
|
-
state.hint.className = react_1.mergeClasses(classNames.hint,
|
113
|
+
state.hint.className = react_1.mergeClasses(classNames.hint, secondaryTextBaseClassName, state.hint.className);
|
133
114
|
}
|
134
115
|
};
|
135
116
|
exports.useFieldStyles_unstable = useFieldStyles_unstable;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AAEA;AAGO,MAAMA,kBAAkB,GAAIC,IAAY,KAAgD;EAC7FC,IAAI,EAAE,OAAOD,IAAI,EAAE;EACnBE,OAAO,EAAE,OAAOF,IAAI,WAAW;EAC/BG,KAAK,EAAE,OAAOH,IAAI,SAAS;EAC3BI,iBAAiB,EAAE,OAAOJ,IAAI,qBAAqB;EACnDK,qBAAqB,EAAE,OAAOL,IAAI,yBAAyB;EAC3DM,IAAI,EAAE,OAAON,IAAI;CAClB,CAAC;AAPWO,0BAAkB;AAS/B;;;AAGA,MAAMC,aAAa,gBAAGC,gBAAU;EAAA;IAAA;
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAEA;AAGO,MAAMA,kBAAkB,GAAIC,IAAY,KAAgD;EAC7FC,IAAI,EAAE,OAAOD,IAAI,EAAE;EACnBE,OAAO,EAAE,OAAOF,IAAI,WAAW;EAC/BG,KAAK,EAAE,OAAOH,IAAI,SAAS;EAC3BI,iBAAiB,EAAE,OAAOJ,IAAI,qBAAqB;EACnDK,qBAAqB,EAAE,OAAOL,IAAI,yBAAyB;EAC3DM,IAAI,EAAE,OAAON,IAAI;CAClB,CAAC;AAPWO,0BAAkB;AAS/B;AACA,MAAMC,QAAQ,GAAG,MAAM;AAEvB;;;AAGA,MAAMC,aAAa,gBAAGC,gBAAU;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAkB9B;AAEF,MAAMC,cAAc,gBAAGD,gBAAU;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IA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AAzDYhB,+BAAuB","names":["getFieldClassNames","name","root","control","label","validationMessage","validationMessageIcon","hint","exports","iconSize","useRootStyles","react_1","useLabelStyles","useSecondaryTextBaseClassName","useSecondaryTextStyles","useValidationMessageIconBaseClassName","useValidationMessageIconStyles","useFieldStyles_unstable","state","classNames","validationState","horizontal","orientation","rootStyles","className","base","horizontalNoLabel","labelStyles","vertical","size","large","verticalLarge","validationMessageIconBaseClassName","validationMessageIconStyles","secondaryTextBaseClassName","secondaryTextStyles","error","withIcon"],"sourceRoot":"","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 { 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// 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 = <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 horizontal && !state.label && rootStyles.horizontalNoLabel,\n state.root.className,\n );\n\n if (state.control) {\n state.control.className = mergeClasses(classNames.control, state.control.className);\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 !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 classNames.validationMessageIcon,\n validationMessageIconBaseClassName,\n !!validationState && 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 classNames.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(classNames.hint, secondaryTextBaseClassName, state.hint.className);\n }\n};\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-field",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230120-0420.1",
|
4
4
|
"description": "Fluent UI Field components",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -26,16 +26,16 @@
|
|
26
26
|
"devDependencies": {
|
27
27
|
"@fluentui/eslint-plugin": "*",
|
28
28
|
"@fluentui/react-conformance": "*",
|
29
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
29
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230120-0420.1",
|
30
30
|
"@fluentui/scripts-api-extractor": "*",
|
31
31
|
"@fluentui/scripts-tasks": "*"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"@fluentui/react-context-selector": "0.0.0-nightly-
|
34
|
+
"@fluentui/react-context-selector": "0.0.0-nightly-20230120-0420.1",
|
35
35
|
"@fluentui/react-icons": "^2.0.175",
|
36
|
-
"@fluentui/react-label": "0.0.0-nightly-
|
37
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
38
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
36
|
+
"@fluentui/react-label": "0.0.0-nightly-20230120-0420.1",
|
37
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230120-0420.1",
|
38
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230120-0420.1",
|
39
39
|
"@griffel/react": "^1.5.2",
|
40
40
|
"tslib": "^2.1.0"
|
41
41
|
},
|