@fluentui/react-input 9.3.4 → 9.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +16 -1
- package/CHANGELOG.md +11 -2
- package/lib/components/Input/useInputStyles.js +97 -154
- package/lib/components/Input/useInputStyles.js.map +1 -1
- package/lib-amd/components/Input/useInputStyles.js +109 -60
- package/lib-amd/components/Input/useInputStyles.js.map +1 -1
- package/lib-commonjs/components/Input/useInputStyles.js +96 -153
- package/lib-commonjs/components/Input/useInputStyles.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useInputStyles_unstable = exports.inputClassNames = void 0;
|
|
7
|
-
const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
8
7
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
8
|
+
const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
9
9
|
exports.inputClassNames = {
|
|
10
10
|
root: 'fui-Input',
|
|
11
11
|
input: 'fui-Input__input',
|
|
@@ -18,80 +18,92 @@ const fieldHeights = {
|
|
|
18
18
|
medium: '32px',
|
|
19
19
|
large: '40px'
|
|
20
20
|
};
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
const rootBaseStyles = {
|
|
22
|
+
display: 'inline-flex',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
flexWrap: 'nowrap',
|
|
25
|
+
gap: react_theme_1.tokens.spacingHorizontalXXS,
|
|
26
|
+
borderRadius: react_theme_1.tokens.borderRadiusMedium,
|
|
27
|
+
position: 'relative',
|
|
28
|
+
boxSizing: 'border-box',
|
|
29
|
+
// size: medium (default)
|
|
30
|
+
minHeight: fieldHeights.medium,
|
|
31
|
+
padding: `0 ${react_theme_1.tokens.spacingHorizontalMNudge}`,
|
|
32
|
+
...react_theme_1.typographyStyles.body1,
|
|
33
|
+
// appearance: outline (default)
|
|
34
|
+
backgroundColor: react_theme_1.tokens.colorNeutralBackground1,
|
|
35
|
+
border: `1px solid ${react_theme_1.tokens.colorNeutralStroke1}`,
|
|
36
|
+
borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible
|
|
37
|
+
};
|
|
38
|
+
const rootInteractiveStyles = {
|
|
39
|
+
// This is all for the bottom focus border.
|
|
40
|
+
// It's supposed to be 2px flat all the way across and match the radius of the field's corners.
|
|
41
|
+
'::after': {
|
|
42
|
+
boxSizing: 'border-box',
|
|
43
|
+
content: '""',
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
left: '-1px',
|
|
46
|
+
bottom: '-1px',
|
|
47
|
+
right: '-1px',
|
|
48
|
+
// Maintaining the correct corner radius:
|
|
49
|
+
// Use the whole border-radius as the height and only put radii on the bottom corners.
|
|
50
|
+
// (Otherwise the radius would be automatically reduced to fit available space.)
|
|
51
|
+
// max() ensures the focus border still shows up even if someone sets tokens.borderRadiusMedium to 0.
|
|
52
|
+
height: `max(2px, ${react_theme_1.tokens.borderRadiusMedium})`,
|
|
53
|
+
borderBottomLeftRadius: react_theme_1.tokens.borderRadiusMedium,
|
|
54
|
+
borderBottomRightRadius: react_theme_1.tokens.borderRadiusMedium,
|
|
55
|
+
// Flat 2px border:
|
|
56
|
+
// By default borderBottom will cause little "horns" on the ends. The clipPath trims them off.
|
|
57
|
+
// (This could be done without trimming using `background: linear-gradient(...)`, but using
|
|
58
|
+
// borderBottom makes it easier for people to override the color if needed.)
|
|
59
|
+
borderBottom: `2px solid ${react_theme_1.tokens.colorCompoundBrandStroke}`,
|
|
60
|
+
clipPath: 'inset(calc(100% - 2px) 0 0 0)',
|
|
61
|
+
// Animation for focus OUT
|
|
62
|
+
transform: 'scaleX(0)',
|
|
63
|
+
transitionProperty: 'transform',
|
|
64
|
+
transitionDuration: react_theme_1.tokens.durationUltraFast,
|
|
65
|
+
transitionDelay: react_theme_1.tokens.curveAccelerateMid,
|
|
66
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
|
67
|
+
transitionDuration: '0.01ms',
|
|
68
|
+
transitionDelay: '0.01ms'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
':focus-within::after': {
|
|
72
|
+
// Animation for focus IN
|
|
73
|
+
transform: 'scaleX(1)',
|
|
74
|
+
transitionProperty: 'transform',
|
|
75
|
+
transitionDuration: react_theme_1.tokens.durationNormal,
|
|
76
|
+
transitionDelay: react_theme_1.tokens.curveDecelerateMid,
|
|
77
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
|
78
|
+
transitionDuration: '0.01ms',
|
|
79
|
+
transitionDelay: '0.01ms'
|
|
80
|
+
}
|
|
35
81
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
E3zdtr: "f1mdlcz9",
|
|
40
|
-
Eqx8gd: ["f1a7op3", "f1cjjd47"],
|
|
41
|
-
By385i5: "f1gboi2j",
|
|
42
|
-
B1piin3: ["f1cjjd47", "f1a7op3"],
|
|
43
|
-
Dlnsje: "f145g4dw",
|
|
44
|
-
d9w3h3: ["f1kp91vd", "f1ibwz09"],
|
|
45
|
-
B3778ie: ["f1ibwz09", "f1kp91vd"],
|
|
46
|
-
Bcgy8vk: "f1cb6c3",
|
|
47
|
-
Bw17bha: "f1lh990p",
|
|
48
|
-
B1q35kw: "f1jc6hxc",
|
|
49
|
-
Gjdm7m: "f13evtba",
|
|
50
|
-
b1kco5: "f1yk9hq",
|
|
51
|
-
Ba2ppi3: "fhwpy7i",
|
|
52
|
-
F2fol1: "f14ee0xe",
|
|
53
|
-
lck23g: "f1xhbsuh",
|
|
54
|
-
df92cz: "fv8e3ye",
|
|
55
|
-
I188md: "ftb5wc6",
|
|
56
|
-
umuwi5: "fjw5xc1",
|
|
57
|
-
Blcqepd: "f1xdyd5c",
|
|
58
|
-
nplu4u: "fatpbeo",
|
|
59
|
-
Bioka5o: "fb7uyps",
|
|
60
|
-
H713fs: "f1cmft4k",
|
|
61
|
-
B9ooomg: "f1x58t8o",
|
|
62
|
-
Bercvud: "f1ibeo51",
|
|
63
|
-
Bbr2w1p: "f14a1fxs",
|
|
64
|
-
Bduesf4: "f3e99gv",
|
|
65
|
-
Bpq79vn: "fhljsf7"
|
|
82
|
+
':focus-within:active::after': {
|
|
83
|
+
// This is if the user clicks the field again while it's already focused
|
|
84
|
+
borderBottomColor: react_theme_1.tokens.colorCompoundBrandStrokePressed
|
|
66
85
|
},
|
|
86
|
+
':focus-within': {
|
|
87
|
+
outline: '2px solid transparent'
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const useRootNonInteractiveClassName = /*#__PURE__*/react_1.__resetStyles("rqztyh5", null, [".rqztyh5{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;gap:var(--spacingHorizontalXXS);border-radius:var(--borderRadiusMedium);position:relative;box-sizing:border-box;min-height:32px;padding:0 var(--spacingHorizontalMNudge);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase300);background-color:var(--colorNeutralBackground1);border:1px solid var(--colorNeutralStroke1);border-bottom-color:var(--colorNeutralStrokeAccessible);}"]);
|
|
91
|
+
const useRootInteractiveClassName = /*#__PURE__*/react_1.__resetStyles("r1jtohuq", "rl1z2p5", [".r1jtohuq{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;gap:var(--spacingHorizontalXXS);border-radius:var(--borderRadiusMedium);position:relative;box-sizing:border-box;min-height:32px;padding:0 var(--spacingHorizontalMNudge);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase300);background-color:var(--colorNeutralBackground1);border:1px solid var(--colorNeutralStroke1);border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".r1jtohuq::after{box-sizing:border-box;content:\"\";position:absolute;left:-1px;bottom:-1px;right:-1px;height:max(2px, var(--borderRadiusMedium));border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-bottom:2px solid var(--colorCompoundBrandStroke);-webkit-clip-path:inset(calc(100% - 2px) 0 0 0);clip-path:inset(calc(100% - 2px) 0 0 0);-webkit-transform:scaleX(0);-moz-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);transition-property:transform;transition-duration:var(--durationUltraFast);transition-delay:var(--curveAccelerateMid);}", "@media screen and (prefers-reduced-motion: reduce){.r1jtohuq::after{transition-duration:0.01ms;transition-delay:0.01ms;}}", ".r1jtohuq:focus-within::after{-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);transition-property:transform;transition-duration:var(--durationNormal);transition-delay:var(--curveDecelerateMid);}", "@media screen and (prefers-reduced-motion: reduce){.r1jtohuq:focus-within::after{transition-duration:0.01ms;transition-delay:0.01ms;}}", ".r1jtohuq:focus-within:active::after{border-bottom-color:var(--colorCompoundBrandStrokePressed);}", ".r1jtohuq:focus-within{outline:2px solid transparent;}", ".rl1z2p5{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-flex-wrap:nowrap;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;gap:var(--spacingHorizontalXXS);border-radius:var(--borderRadiusMedium);position:relative;box-sizing:border-box;min-height:32px;padding:0 var(--spacingHorizontalMNudge);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase300);background-color:var(--colorNeutralBackground1);border:1px solid var(--colorNeutralStroke1);border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".rl1z2p5::after{box-sizing:border-box;content:\"\";position:absolute;right:-1px;bottom:-1px;left:-1px;height:max(2px, var(--borderRadiusMedium));border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-bottom:2px solid var(--colorCompoundBrandStroke);-webkit-clip-path:inset(calc(100% - 2px) 0 0 0);clip-path:inset(calc(100% - 2px) 0 0 0);-webkit-transform:scaleX(0);-moz-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);transition-property:transform;transition-duration:var(--durationUltraFast);transition-delay:var(--curveAccelerateMid);}", "@media screen and (prefers-reduced-motion: reduce){.rl1z2p5::after{transition-duration:0.01ms;transition-delay:0.01ms;}}", ".rl1z2p5:focus-within::after{-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);transition-property:transform;transition-duration:var(--durationNormal);transition-delay:var(--curveDecelerateMid);}", "@media screen and (prefers-reduced-motion: reduce){.rl1z2p5:focus-within::after{transition-duration:0.01ms;transition-delay:0.01ms;}}", ".rl1z2p5:focus-within:active::after{border-bottom-color:var(--colorCompoundBrandStrokePressed);}", ".rl1z2p5:focus-within{outline:2px solid transparent;}"]);
|
|
92
|
+
const useRootStyles = /*#__PURE__*/react_1.__styles({
|
|
67
93
|
small: {
|
|
68
94
|
sshi5w: "f1pha7fy",
|
|
69
|
-
z8tnut: "f1g0x7ka",
|
|
70
|
-
z189sj: ["fdw0yi8", "fk8j09s"],
|
|
71
|
-
Byoj8tv: "f1qch9an",
|
|
72
95
|
uwmqm3: ["fk8j09s", "fdw0yi8"],
|
|
96
|
+
z189sj: ["fdw0yi8", "fk8j09s"],
|
|
73
97
|
Bahqtrf: "fk6fouc",
|
|
74
98
|
Be2twd7: "fy9rknc",
|
|
75
99
|
Bhrd7zp: "figsok6",
|
|
76
100
|
Bg96gwp: "fwrc4pm"
|
|
77
101
|
},
|
|
78
|
-
medium: {
|
|
79
|
-
sshi5w: "f1nxs5xn",
|
|
80
|
-
z8tnut: "f1g0x7ka",
|
|
81
|
-
z189sj: ["f11gcy0p", "f1ng84yb"],
|
|
82
|
-
Byoj8tv: "f1qch9an",
|
|
83
|
-
uwmqm3: ["f1ng84yb", "f11gcy0p"],
|
|
84
|
-
Bahqtrf: "fk6fouc",
|
|
85
|
-
Be2twd7: "fkhj508",
|
|
86
|
-
Bhrd7zp: "figsok6",
|
|
87
|
-
Bg96gwp: "f1i3iumi"
|
|
88
|
-
},
|
|
102
|
+
medium: {},
|
|
89
103
|
large: {
|
|
90
104
|
sshi5w: "f1w5jphr",
|
|
91
|
-
z8tnut: "f1g0x7ka",
|
|
92
|
-
z189sj: ["fw5db7e", "f1uw59to"],
|
|
93
|
-
Byoj8tv: "f1qch9an",
|
|
94
105
|
uwmqm3: ["f1uw59to", "fw5db7e"],
|
|
106
|
+
z189sj: ["fw5db7e", "f1uw59to"],
|
|
95
107
|
Bahqtrf: "fk6fouc",
|
|
96
108
|
Be2twd7: "fod5ikn",
|
|
97
109
|
Bhrd7zp: "figsok6",
|
|
@@ -99,21 +111,7 @@ const useRootStyles = /*#__PURE__*/react_1.__styles({
|
|
|
99
111
|
i8kkvl: "f1rjii52",
|
|
100
112
|
Belr9w4: "f1r7g2jn"
|
|
101
113
|
},
|
|
102
|
-
outline: {
|
|
103
|
-
De3pzq: "fxugw4r",
|
|
104
|
-
B4j52fo: "f5ogflp",
|
|
105
|
-
Bekrc4i: ["f1hqa2wf", "finvdd3"],
|
|
106
|
-
Bn0qgzm: "f1f09k3d",
|
|
107
|
-
ibv6hh: ["finvdd3", "f1hqa2wf"],
|
|
108
|
-
icvyot: "fzkkow9",
|
|
109
|
-
vrafjx: ["fcdblym", "fjik90z"],
|
|
110
|
-
oivjwe: "fg706s2",
|
|
111
|
-
wvpqe5: ["fjik90z", "fcdblym"],
|
|
112
|
-
g2u3we: "fj3muxo",
|
|
113
|
-
h3c5rm: ["f1akhkt", "f1lxtadh"],
|
|
114
|
-
B9xav0g: "f1c1zstj",
|
|
115
|
-
zhjwy3: ["f1lxtadh", "f1akhkt"]
|
|
116
|
-
},
|
|
114
|
+
outline: {},
|
|
117
115
|
outlineInteractive: {
|
|
118
116
|
Bgoe8wy: "fvcxoqz",
|
|
119
117
|
Bwzppfd: ["f1ub3y4t", "f1m52nbi"],
|
|
@@ -130,9 +128,9 @@ const useRootStyles = /*#__PURE__*/react_1.__styles({
|
|
|
130
128
|
Beyfa6y: ["f1deotkl", "f1krrbdw"],
|
|
131
129
|
B7oj6ja: ["f10ostut", "f1ozlkrg"],
|
|
132
130
|
Btl43ni: ["f1ozlkrg", "f10ostut"],
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
icvyot: "f1ern45e",
|
|
132
|
+
vrafjx: ["f1n71otn", "f1deefiw"],
|
|
133
|
+
wvpqe5: ["f1deefiw", "f1n71otn"]
|
|
136
134
|
},
|
|
137
135
|
underlineInteractive: {
|
|
138
136
|
oetu4i: "f1l4zc64",
|
|
@@ -143,14 +141,6 @@ const useRootStyles = /*#__PURE__*/react_1.__styles({
|
|
|
143
141
|
B4j8arr: ["f53nyzz", "f18vqdqu"]
|
|
144
142
|
},
|
|
145
143
|
filled: {
|
|
146
|
-
B4j52fo: "f5ogflp",
|
|
147
|
-
Bekrc4i: ["f1hqa2wf", "finvdd3"],
|
|
148
|
-
Bn0qgzm: "f1f09k3d",
|
|
149
|
-
ibv6hh: ["finvdd3", "f1hqa2wf"],
|
|
150
|
-
icvyot: "fzkkow9",
|
|
151
|
-
vrafjx: ["fcdblym", "fjik90z"],
|
|
152
|
-
oivjwe: "fg706s2",
|
|
153
|
-
wvpqe5: ["fjik90z", "fcdblym"],
|
|
154
144
|
g2u3we: "fghlq4f",
|
|
155
145
|
h3c5rm: ["f1gn591s", "fjscplz"],
|
|
156
146
|
B9xav0g: "fb073pr",
|
|
@@ -195,16 +185,10 @@ const useRootStyles = /*#__PURE__*/react_1.__styles({
|
|
|
195
185
|
n51gp8: ["f14g86mu", "f1rvyvqg"]
|
|
196
186
|
}
|
|
197
187
|
}, {
|
|
198
|
-
d: [".
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
m: "screen and (prefers-reduced-motion: reduce)"
|
|
203
|
-
}], ["@media screen and (prefers-reduced-motion: reduce){.f1cmft4k:focus-within::after{transition-duration:0.01ms;}}", {
|
|
204
|
-
m: "screen and (prefers-reduced-motion: reduce)"
|
|
205
|
-
}], ["@media screen and (prefers-reduced-motion: reduce){.f1x58t8o:focus-within::after{transition-delay:0.01ms;}}", {
|
|
206
|
-
m: "screen and (prefers-reduced-motion: reduce)"
|
|
207
|
-
}], ["@media (forced-colors: active){.fg455y9{border-top-color:GrayText;}}", {
|
|
188
|
+
d: [".f1pha7fy{min-height:24px;}", ".fk8j09s{padding-left:var(--spacingHorizontalSNudge);}", ".fdw0yi8{padding-right:var(--spacingHorizontalSNudge);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".f1w5jphr{min-height:40px;}", ".f1uw59to{padding-left:var(--spacingHorizontalM);}", ".fw5db7e{padding-right:var(--spacingHorizontalM);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".faaz57k{line-height:var(--lineHeightBase400);}", ".f1rjii52{-webkit-column-gap:var(--spacingHorizontalSNudge);column-gap:var(--spacingHorizontalSNudge);}", ".f1r7g2jn{row-gap:var(--spacingHorizontalSNudge);}", ".f1c21dwh{background-color:var(--colorTransparentBackground);}", ".f1krrbdw{border-bottom-right-radius:0;}", ".f1deotkl{border-bottom-left-radius:0;}", ".f10ostut{border-top-right-radius:0;}", ".f1ozlkrg{border-top-left-radius:0;}", ".f1ern45e{border-top-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1nf3wye::after{border-bottom-right-radius:0;}", ".feulmo5::after{border-bottom-left-radius:0;}", ".f18vqdqu::after{border-top-right-radius:0;}", ".f53nyzz::after{border-top-left-radius:0;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".fs4k3qj:not(:focus-within),.fs4k3qj:hover:not(:focus-within){border-top-color:var(--colorPaletteRedBorder2);}", ".fcee079:not(:focus-within),.fcee079:hover:not(:focus-within){border-right-color:var(--colorPaletteRedBorder2);}", ".fmyw78r:not(:focus-within),.fmyw78r:hover:not(:focus-within){border-left-color:var(--colorPaletteRedBorder2);}", ".f1fgmyf4:not(:focus-within),.f1fgmyf4:hover:not(:focus-within){border-bottom-color:var(--colorPaletteRedBorder2);}", ".f16xq7d1{background-color:var(--colorNeutralBackground3);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".fyed02w{box-shadow:var(--shadow2);}", ".fdrzuqr{cursor:not-allowed;}", ".f1jj8ep1{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f15xbau{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fy0fskl{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f4ikngz{border-bottom-color:var(--colorNeutralStrokeDisabled);}"],
|
|
189
|
+
h: [".fvcxoqz:hover{border-top-color:var(--colorNeutralStroke1Hover);}", ".f1ub3y4t:hover{border-right-color:var(--colorNeutralStroke1Hover);}", ".f1m52nbi:hover{border-left-color:var(--colorNeutralStroke1Hover);}", ".f1l4zc64:hover{border-bottom-color:var(--colorNeutralStrokeAccessibleHover);}", ".ftmjh5b:hover,.ftmjh5b:focus-within{border-top-color:var(--colorTransparentStrokeInteractive);}", ".f17blpuu:hover,.f17blpuu:focus-within{border-right-color:var(--colorTransparentStrokeInteractive);}", ".fsrcdbj:hover,.fsrcdbj:focus-within{border-left-color:var(--colorTransparentStrokeInteractive);}", ".f1tpwn32:hover,.f1tpwn32:focus-within{border-bottom-color:var(--colorTransparentStrokeInteractive);}"],
|
|
190
|
+
a: [".f8vnjqi:active,.f8vnjqi:focus-within{border-top-color:var(--colorNeutralStroke1Pressed);}", ".fz1etlk:active,.fz1etlk:focus-within{border-right-color:var(--colorNeutralStroke1Pressed);}", ".f1hc16gm:active,.f1hc16gm:focus-within{border-left-color:var(--colorNeutralStroke1Pressed);}", ".f1klwx88:active,.f1klwx88:focus-within{border-bottom-color:var(--colorNeutralStrokeAccessiblePressed);}"],
|
|
191
|
+
m: [["@media (forced-colors: active){.fg455y9{border-top-color:GrayText;}}", {
|
|
208
192
|
m: "(forced-colors: active)"
|
|
209
193
|
}], ["@media (forced-colors: active){.f1rvyvqg{border-right-color:GrayText;}.f14g86mu{border-left-color:GrayText;}}", {
|
|
210
194
|
m: "(forced-colors: active)"
|
|
@@ -212,51 +196,13 @@ const useRootStyles = /*#__PURE__*/react_1.__styles({
|
|
|
212
196
|
m: "(forced-colors: active)"
|
|
213
197
|
}], ["@media (forced-colors: active){.f14g86mu{border-left-color:GrayText;}.f1rvyvqg{border-right-color:GrayText;}}", {
|
|
214
198
|
m: "(forced-colors: active)"
|
|
215
|
-
}]]
|
|
216
|
-
w: [".fjw5xc1:focus-within::after{-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);}", ".f1xdyd5c:focus-within::after{transition-property:transform;}", ".fatpbeo:focus-within::after{transition-duration:var(--durationNormal);}", ".fb7uyps:focus-within::after{transition-delay:var(--curveDecelerateMid);}", ".f1ibeo51:focus-within:active::after{border-bottom-color:var(--colorCompoundBrandStrokePressed);}", ".f14a1fxs:focus-within{outline-width:2px;}", ".f3e99gv:focus-within{outline-style:solid;}", ".fhljsf7:focus-within{outline-color:transparent;}"],
|
|
217
|
-
h: [".fvcxoqz:hover{border-top-color:var(--colorNeutralStroke1Hover);}", ".f1ub3y4t:hover{border-right-color:var(--colorNeutralStroke1Hover);}", ".f1m52nbi:hover{border-left-color:var(--colorNeutralStroke1Hover);}", ".f1l4zc64:hover{border-bottom-color:var(--colorNeutralStrokeAccessibleHover);}", ".ftmjh5b:hover,.ftmjh5b:focus-within{border-top-color:var(--colorTransparentStrokeInteractive);}", ".f17blpuu:hover,.f17blpuu:focus-within{border-right-color:var(--colorTransparentStrokeInteractive);}", ".fsrcdbj:hover,.fsrcdbj:focus-within{border-left-color:var(--colorTransparentStrokeInteractive);}", ".f1tpwn32:hover,.f1tpwn32:focus-within{border-bottom-color:var(--colorTransparentStrokeInteractive);}"],
|
|
218
|
-
a: [".f8vnjqi:active,.f8vnjqi:focus-within{border-top-color:var(--colorNeutralStroke1Pressed);}", ".fz1etlk:active,.fz1etlk:focus-within{border-right-color:var(--colorNeutralStroke1Pressed);}", ".f1hc16gm:active,.f1hc16gm:focus-within{border-left-color:var(--colorNeutralStroke1Pressed);}", ".f1klwx88:active,.f1klwx88:focus-within{border-bottom-color:var(--colorNeutralStrokeAccessiblePressed);}"]
|
|
199
|
+
}]]
|
|
219
200
|
});
|
|
201
|
+
const useInputClassName = /*#__PURE__*/react_1.__resetStyles("rvp2gzh", null, [".rvp2gzh{box-sizing:border-box;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;min-width:0;border-style:none;padding:0 var(--spacingHorizontalXXS);color:var(--colorNeutralForeground1);background-color:transparent;outline-style:none;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;}", ".rvp2gzh::-webkit-input-placeholder{color:var(--colorNeutralForeground4);opacity:1;}", ".rvp2gzh::-moz-placeholder{color:var(--colorNeutralForeground4);opacity:1;}", ".rvp2gzh:-ms-input-placeholder{color:var(--colorNeutralForeground4);opacity:1;}", ".rvp2gzh::placeholder{color:var(--colorNeutralForeground4);opacity:1;}"]);
|
|
220
202
|
const useInputElementStyles = /*#__PURE__*/react_1.__styles({
|
|
221
|
-
base: {
|
|
222
|
-
B7ck84d: "f1ewtqcl",
|
|
223
|
-
Bh6795r: "fqerorx",
|
|
224
|
-
Bf4jedk: "fy77jfu",
|
|
225
|
-
icvyot: "f1ern45e",
|
|
226
|
-
vrafjx: ["f1n71otn", "f1deefiw"],
|
|
227
|
-
oivjwe: "f1h8hb77",
|
|
228
|
-
wvpqe5: ["f1deefiw", "f1n71otn"],
|
|
229
|
-
z8tnut: "f1g0x7ka",
|
|
230
|
-
z189sj: ["ffczdla", "fgiv446"],
|
|
231
|
-
Byoj8tv: "f1qch9an",
|
|
232
|
-
uwmqm3: ["fgiv446", "ffczdla"],
|
|
233
|
-
sj55zd: "f19n0e5",
|
|
234
|
-
De3pzq: "f3rmtva",
|
|
235
|
-
yvdlaj: "fwyc1cq",
|
|
236
|
-
B3o7kgh: "f13ta7ih",
|
|
237
|
-
oeaueh: "f1s6fcnf"
|
|
238
|
-
},
|
|
239
|
-
small: {
|
|
240
|
-
Bahqtrf: "fk6fouc",
|
|
241
|
-
Be2twd7: "fy9rknc",
|
|
242
|
-
Bhrd7zp: "figsok6",
|
|
243
|
-
Bg96gwp: "fwrc4pm"
|
|
244
|
-
},
|
|
245
|
-
medium: {
|
|
246
|
-
Bahqtrf: "fk6fouc",
|
|
247
|
-
Be2twd7: "fkhj508",
|
|
248
|
-
Bhrd7zp: "figsok6",
|
|
249
|
-
Bg96gwp: "f1i3iumi"
|
|
250
|
-
},
|
|
251
203
|
large: {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
Bhrd7zp: "figsok6",
|
|
255
|
-
Bg96gwp: "faaz57k",
|
|
256
|
-
z8tnut: "f1g0x7ka",
|
|
257
|
-
z189sj: ["fdw0yi8", "fk8j09s"],
|
|
258
|
-
Byoj8tv: "f1qch9an",
|
|
259
|
-
uwmqm3: ["fk8j09s", "fdw0yi8"]
|
|
204
|
+
uwmqm3: ["fk8j09s", "fdw0yi8"],
|
|
205
|
+
z189sj: ["fdw0yi8", "fk8j09s"]
|
|
260
206
|
},
|
|
261
207
|
disabled: {
|
|
262
208
|
sj55zd: "f1s2aq7o",
|
|
@@ -265,28 +211,22 @@ const useInputElementStyles = /*#__PURE__*/react_1.__styles({
|
|
|
265
211
|
yvdlaj: "fahhnxm"
|
|
266
212
|
}
|
|
267
213
|
}, {
|
|
268
|
-
d: [".
|
|
214
|
+
d: [".fk8j09s{padding-left:var(--spacingHorizontalSNudge);}", ".fdw0yi8{padding-right:var(--spacingHorizontalSNudge);}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".f1c21dwh{background-color:var(--colorTransparentBackground);}", ".fdrzuqr{cursor:not-allowed;}", ".fahhnxm::-webkit-input-placeholder{color:var(--colorNeutralForegroundDisabled);}", ".fahhnxm::-moz-placeholder{color:var(--colorNeutralForegroundDisabled);}"]
|
|
269
215
|
});
|
|
216
|
+
const useContentClassName = /*#__PURE__*/react_1.__resetStyles("r1572tok", null, [".r1572tok{box-sizing:border-box;color:var(--colorNeutralForeground3);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".r1572tok>svg{font-size:20px;}"]);
|
|
270
217
|
const useContentStyles = /*#__PURE__*/react_1.__styles({
|
|
271
|
-
base: {
|
|
272
|
-
B7ck84d: "f1ewtqcl",
|
|
273
|
-
sj55zd: "f11d4kpn",
|
|
274
|
-
mc9l5x: "f22iagw"
|
|
275
|
-
},
|
|
276
218
|
disabled: {
|
|
277
219
|
sj55zd: "f1s2aq7o"
|
|
278
220
|
},
|
|
279
221
|
small: {
|
|
280
222
|
kwki1k: "f3u2cy0"
|
|
281
223
|
},
|
|
282
|
-
medium: {
|
|
283
|
-
kwki1k: "f1oqplr0"
|
|
284
|
-
},
|
|
224
|
+
medium: {},
|
|
285
225
|
large: {
|
|
286
226
|
kwki1k: "fa420co"
|
|
287
227
|
}
|
|
288
228
|
}, {
|
|
289
|
-
d: [".
|
|
229
|
+
d: [".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".f3u2cy0>svg{font-size:16px;}", ".fa420co>svg{font-size:24px;}"]
|
|
290
230
|
});
|
|
291
231
|
/**
|
|
292
232
|
* Apply styling to the Input slots based on the state
|
|
@@ -299,12 +239,15 @@ const useInputStyles_unstable = state => {
|
|
|
299
239
|
const disabled = state.input.disabled;
|
|
300
240
|
const invalid = `${state.input['aria-invalid']}` === 'true';
|
|
301
241
|
const filled = appearance.startsWith('filled');
|
|
242
|
+
// Call exactly one of the two base className hooks. Each of these hooks is functionally identical, but with
|
|
243
|
+
// different styles applied, which makes it ok to conditionally change which hook is called.
|
|
244
|
+
const useRootClassName = disabled ? useRootNonInteractiveClassName : useRootInteractiveClassName;
|
|
302
245
|
const rootStyles = useRootStyles();
|
|
303
246
|
const inputStyles = useInputElementStyles();
|
|
304
247
|
const contentStyles = useContentStyles();
|
|
305
|
-
state.root.className = react_1.mergeClasses(exports.inputClassNames.root,
|
|
306
|
-
state.input.className = react_1.mergeClasses(exports.inputClassNames.input,
|
|
307
|
-
const contentClasses = [
|
|
248
|
+
state.root.className = react_1.mergeClasses(exports.inputClassNames.root, useRootClassName(), rootStyles[size], rootStyles[appearance], !disabled && appearance === 'outline' && rootStyles.outlineInteractive, !disabled && appearance === 'underline' && rootStyles.underlineInteractive, !disabled && filled && rootStyles.filledInteractive, filled && rootStyles.filled, !disabled && invalid && rootStyles.invalid, disabled && rootStyles.disabled, state.root.className);
|
|
249
|
+
state.input.className = react_1.mergeClasses(exports.inputClassNames.input, useInputClassName(), size === 'large' && inputStyles.large, disabled && inputStyles.disabled, state.input.className);
|
|
250
|
+
const contentClasses = [useContentClassName(), disabled && contentStyles.disabled, contentStyles[size]];
|
|
308
251
|
if (state.contentBefore) {
|
|
309
252
|
state.contentBefore.className = react_1.mergeClasses(exports.inputClassNames.contentBefore, ...contentClasses, state.contentBefore.className);
|
|
310
253
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AACA;AAIaA,uBAAe,GAA+B;EACzDC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,kBAAkB;EACzBC,aAAa,EAAE,0BAA0B;EACzCC,YAAY,EAAE;CACf;AAED;AACA,MAAMC,YAAY,GAAG;EACnBC,KAAK,EAAE,MAAM;EACbC,MAAM,EAAE,MAAM;EACdC,KAAK,EAAE;CACR;AAED,MAAMC,aAAa,gBAAGC,gBAAU;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA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AEH,IAAIV,KAAK,CAACV,YAAY,EAAE;IACtBU,KAAK,CAACV,YAAY,CAACoB,SAAS,GAAGd,oBAAY,CACzCV,uBAAe,CAACI,YAAY,EAC5B,GAAG0B,cAAc,EACjBhB,KAAK,CAACV,YAAY,CAACoB,SAAS,CAC7B;;EAGH,OAAOV,KAAK;AACd,CAAC;AAlDYd,+BAAuB","names":["exports","root","input","contentBefore","contentAfter","fieldHeights","small","medium","large","useRootStyles","react_1","useInputElementStyles","useContentStyles","useInputStyles_unstable","state","size","appearance","disabled","invalid","filled","startsWith","rootStyles","inputStyles","contentStyles","className","base","interactive","outlineInteractive","underlineInteractive","filledInteractive","contentClasses"],"sourceRoot":"../src/","sources":["packages/react-components/react-input/src/components/Input/useInputStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { InputSlots, InputState } from './Input.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const inputClassNames: SlotClassNames<InputSlots> = {\n root: 'fui-Input',\n input: 'fui-Input__input',\n contentBefore: 'fui-Input__contentBefore',\n contentAfter: 'fui-Input__contentAfter',\n};\n\n// TODO(sharing) should these be shared somewhere?\nconst fieldHeights = {\n small: '24px',\n medium: '32px',\n large: '40px',\n};\n\nconst useRootStyles = makeStyles({\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n flexWrap: 'nowrap',\n ...shorthands.gap(tokens.spacingHorizontalXXS),\n fontFamily: tokens.fontFamilyBase,\n ...shorthands.borderRadius(tokens.borderRadiusMedium), // used for all but underline\n position: 'relative',\n boxSizing: 'border-box',\n },\n interactive: {\n // This is all for the bottom focus border.\n // It's supposed to be 2px flat all the way across and match the radius of the field's corners.\n '::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n left: '-1px',\n bottom: '-1px',\n right: '-1px',\n\n // Maintaining the correct corner radius:\n // Use the whole border-radius as the height and only put radii on the bottom corners.\n // (Otherwise the radius would be automatically reduced to fit available space.)\n // max() ensures the focus border still shows up even if someone sets tokens.borderRadiusMedium to 0.\n height: `max(2px, ${tokens.borderRadiusMedium})`,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderBottomRightRadius: tokens.borderRadiusMedium,\n\n // Flat 2px border:\n // By default borderBottom will cause little \"horns\" on the ends. The clipPath trims them off.\n // (This could be done without trimming using `background: linear-gradient(...)`, but using\n // borderBottom makes it easier for people to override the color if needed.)\n ...shorthands.borderBottom('2px', 'solid', tokens.colorCompoundBrandStroke),\n clipPath: 'inset(calc(100% - 2px) 0 0 0)',\n\n // Animation for focus OUT\n transform: 'scaleX(0)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationUltraFast,\n transitionDelay: tokens.curveAccelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within::after': {\n // Animation for focus IN\n transform: 'scaleX(1)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationNormal,\n transitionDelay: tokens.curveDecelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within:active::after': {\n // This is if the user clicks the field again while it's already focused\n borderBottomColor: tokens.colorCompoundBrandStrokePressed,\n },\n ':focus-within': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: 'transparent',\n },\n },\n small: {\n minHeight: fieldHeights.small,\n ...shorthands.padding('0', tokens.spacingHorizontalSNudge),\n ...typographyStyles.caption1,\n },\n medium: {\n minHeight: fieldHeights.medium,\n ...shorthands.padding('0', tokens.spacingHorizontalMNudge),\n ...typographyStyles.body1,\n },\n large: {\n minHeight: fieldHeights.large,\n ...shorthands.padding('0', tokens.spacingHorizontalM),\n ...typographyStyles.body2,\n ...shorthands.gap(tokens.spacingHorizontalSNudge),\n },\n outline: {\n backgroundColor: tokens.colorNeutralBackground1,\n ...shorthands.border('1px', 'solid', tokens.colorNeutralStroke1),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n outlineInteractive: {\n ':hover': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':active,:focus-within': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n underline: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderRadius(0), // corners look strange if rounded\n ...shorthands.borderBottom('1px', 'solid', tokens.colorNeutralStrokeAccessible),\n },\n underlineInteractive: {\n ':hover': {\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':active,:focus-within': {\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n '::after': shorthands.borderRadius(0), // remove rounded corners from focus underline\n },\n filled: {\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\n filledInteractive: {\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':hover,:focus-within': {\n // also handles pressed border color (:active)\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n },\n 'filled-darker-shadow': {\n backgroundColor: tokens.colorNeutralBackground3,\n boxShadow: tokens.shadow2,\n },\n 'filled-lighter-shadow': {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow2,\n },\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n});\n\nconst useInputElementStyles = makeStyles({\n base: {\n boxSizing: 'border-box',\n flexGrow: 1,\n minWidth: 0, // required to make the input shrink to fit the wrapper\n ...shorthands.borderStyle('none'), // input itself never has a border (this is handled by inputWrapper)\n ...shorthands.padding('0', tokens.spacingHorizontalXXS),\n color: tokens.colorNeutralForeground1,\n // Use literal \"transparent\" (not from the theme) to always let the color from the root show through\n backgroundColor: 'transparent',\n\n '::placeholder': {\n color: tokens.colorNeutralForeground4,\n opacity: 1, // browser style override\n },\n\n outlineStyle: 'none', // disable default browser outline\n },\n small: {\n // This is set on root but doesn't inherit\n ...typographyStyles.caption1,\n },\n medium: {\n ...typographyStyles.body1,\n },\n large: {\n ...typographyStyles.body2,\n ...shorthands.padding('0', tokens.spacingHorizontalSNudge),\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorTransparentBackground,\n cursor: 'not-allowed',\n '::placeholder': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useContentStyles = makeStyles({\n base: {\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground3, // \"icon color\" in design spec\n display: 'flex',\n // special case styling for icons (most common case) to ensure they're centered vertically\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n // Ensure resizable icons show up with the proper font size\n small: {\n '> svg': { fontSize: '16px' },\n },\n medium: {\n '> svg': { fontSize: '20px' },\n },\n large: {\n '> svg': { fontSize: '24px' },\n },\n});\n\n/**\n * Apply styling to the Input slots based on the state\n */\nexport const useInputStyles_unstable = (state: InputState): InputState => {\n const { size, appearance } = state;\n const disabled = state.input.disabled;\n const invalid = `${state.input['aria-invalid']}` === 'true';\n const filled = appearance.startsWith('filled');\n\n const rootStyles = useRootStyles();\n const inputStyles = useInputElementStyles();\n const contentStyles = useContentStyles();\n\n state.root.className = mergeClasses(\n inputClassNames.root,\n rootStyles.base,\n rootStyles[size],\n rootStyles[appearance],\n !disabled && rootStyles.interactive,\n !disabled && appearance === 'outline' && rootStyles.outlineInteractive,\n !disabled && appearance === 'underline' && rootStyles.underlineInteractive,\n !disabled && filled && rootStyles.filledInteractive,\n filled && rootStyles.filled,\n !disabled && invalid && rootStyles.invalid,\n disabled && rootStyles.disabled,\n state.root.className,\n );\n\n state.input.className = mergeClasses(\n inputClassNames.input,\n inputStyles.base,\n inputStyles[size],\n disabled && inputStyles.disabled,\n state.input.className,\n );\n\n const contentClasses = [contentStyles.base, disabled && contentStyles.disabled, contentStyles[size]];\n if (state.contentBefore) {\n state.contentBefore.className = mergeClasses(\n inputClassNames.contentBefore,\n ...contentClasses,\n state.contentBefore.className,\n );\n }\n if (state.contentAfter) {\n state.contentAfter.className = mergeClasses(\n inputClassNames.contentAfter,\n ...contentClasses,\n state.contentAfter.className,\n );\n }\n\n return state;\n};\n"]}
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAGA;AAGaA,uBAAe,GAA+B;EACzDC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,kBAAkB;EACzBC,aAAa,EAAE,0BAA0B;EACzCC,YAAY,EAAE;CACf;AAED;AACA,MAAMC,YAAY,GAAG;EACnBC,KAAK,EAAE,MAAM;EACbC,MAAM,EAAE,MAAM;EACdC,KAAK,EAAE;CACR;AAED,MAAMC,cAAc,GAAsB;EACxCC,OAAO,EAAE,aAAa;EACtBC,UAAU,EAAE,QAAQ;EACpBC,QAAQ,EAAE,QAAQ;EAClBC,GAAG,EAAEC,oBAAM,CAACC,oBAAoB;EAChCC,YAAY,EAAEF,oBAAM,CAACG,kBAAkB;EACvCC,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,YAAY;EAEvB;EACAC,SAAS,EAAEf,YAAY,CAACE,MAAM;EAC9Bc,OAAO,EAAE,KAAKP,oBAAM,CAACQ,uBAAuB,EAAE;EAC9C,GAAGR,8BAAgB,CAACS,KAAK;EAEzB;EACAC,eAAe,EAAEV,oB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mBAAmB,EAAE,EAAEM,QAAQ,IAAIO,aAAa,CAACP,QAAQ,EAAEO,aAAa,CAACT,IAAI,CAAC,CAAC;EACvG,IAAID,KAAK,CAACzD,aAAa,EAAE;IACvByD,KAAK,CAACzD,aAAa,CAACoE,SAAS,GAAGnB,oBAAY,CAC1CpD,uBAAe,CAACG,aAAa,EAC7B,GAAGwE,cAAc,EACjBf,KAAK,CAACzD,aAAa,CAACoE,SAAS,CAC9B;;EAEH,IAAIX,KAAK,CAACxD,YAAY,EAAE;IACtBwD,KAAK,CAACxD,YAAY,CAACmE,SAAS,GAAGnB,oBAAY,CACzCpD,uBAAe,CAACI,YAAY,EAC5B,GAAGuE,cAAc,EACjBf,KAAK,CAACxD,YAAY,CAACmE,SAAS,CAC7B;;EAGH,OAAOX,KAAK;AACd,CAAC;AArDY5D,+BAAuB","names":["exports","root","input","contentBefore","contentAfter","fieldHeights","small","medium","large","rootBaseStyles","display","alignItems","flexWrap","gap","react_theme_1","spacingHorizontalXXS","borderRadius","borderRadiusMedium","position","boxSizing","minHeight","padding","spacingHorizontalMNudge","body1","backgroundColor","colorNeutralBackground1","border","colorNeutralStroke1","borderBottomColor","colorNeutralStrokeAccessible","rootInteractiveStyles","content","left","bottom","right","height","borderBottomLeftRadius","borderBottomRightRadius","borderBottom","colorCompoundBrandStroke","clipPath","transform","transitionProperty","transitionDuration","durationUltraFast","transitionDelay","curveAccelerateMid","durationNormal","curveDecelerateMid","colorCompoundBrandStrokePressed","outline","useRootNonInteractiveClassName","react_1","useRootInteractiveClassName","useRootStyles","useInputClassName","useInputElementStyles","useContentClassName","useContentStyles","useInputStyles_unstable","state","size","appearance","disabled","invalid","filled","startsWith","useRootClassName","rootStyles","inputStyles","contentStyles","className","outlineInteractive","underlineInteractive","filledInteractive","contentClasses"],"sourceRoot":"../src/","sources":["packages/react-components/react-input/src/components/Input/useInputStyles.ts"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { GriffelResetStyle } from '@griffel/react';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { InputSlots, InputState } from './Input.types';\n\nexport const inputClassNames: SlotClassNames<InputSlots> = {\n root: 'fui-Input',\n input: 'fui-Input__input',\n contentBefore: 'fui-Input__contentBefore',\n contentAfter: 'fui-Input__contentAfter',\n};\n\n// TODO(sharing) should these be shared somewhere?\nconst fieldHeights = {\n small: '24px',\n medium: '32px',\n large: '40px',\n};\n\nconst rootBaseStyles: GriffelResetStyle = {\n display: 'inline-flex',\n alignItems: 'center',\n flexWrap: 'nowrap',\n gap: tokens.spacingHorizontalXXS,\n borderRadius: tokens.borderRadiusMedium, // used for all but underline\n position: 'relative',\n boxSizing: 'border-box',\n\n // size: medium (default)\n minHeight: fieldHeights.medium,\n padding: `0 ${tokens.spacingHorizontalMNudge}`,\n ...typographyStyles.body1,\n\n // appearance: outline (default)\n backgroundColor: tokens.colorNeutralBackground1,\n border: `1px solid ${tokens.colorNeutralStroke1}`,\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n};\n\nconst rootInteractiveStyles: GriffelResetStyle = {\n // This is all for the bottom focus border.\n // It's supposed to be 2px flat all the way across and match the radius of the field's corners.\n '::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n left: '-1px',\n bottom: '-1px',\n right: '-1px',\n\n // Maintaining the correct corner radius:\n // Use the whole border-radius as the height and only put radii on the bottom corners.\n // (Otherwise the radius would be automatically reduced to fit available space.)\n // max() ensures the focus border still shows up even if someone sets tokens.borderRadiusMedium to 0.\n height: `max(2px, ${tokens.borderRadiusMedium})`,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderBottomRightRadius: tokens.borderRadiusMedium,\n\n // Flat 2px border:\n // By default borderBottom will cause little \"horns\" on the ends. The clipPath trims them off.\n // (This could be done without trimming using `background: linear-gradient(...)`, but using\n // borderBottom makes it easier for people to override the color if needed.)\n borderBottom: `2px solid ${tokens.colorCompoundBrandStroke}`,\n clipPath: 'inset(calc(100% - 2px) 0 0 0)',\n\n // Animation for focus OUT\n transform: 'scaleX(0)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationUltraFast,\n transitionDelay: tokens.curveAccelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within::after': {\n // Animation for focus IN\n transform: 'scaleX(1)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationNormal,\n transitionDelay: tokens.curveDecelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within:active::after': {\n // This is if the user clicks the field again while it's already focused\n borderBottomColor: tokens.colorCompoundBrandStrokePressed,\n },\n ':focus-within': {\n outline: '2px solid transparent',\n },\n};\n\nconst useRootNonInteractiveClassName = makeResetStyles(rootBaseStyles);\nconst useRootInteractiveClassName = makeResetStyles({ ...rootBaseStyles, ...rootInteractiveStyles });\n\nconst useRootStyles = makeStyles({\n small: {\n minHeight: fieldHeights.small,\n paddingLeft: tokens.spacingHorizontalSNudge,\n paddingRight: tokens.spacingHorizontalSNudge,\n ...typographyStyles.caption1,\n },\n medium: {\n // included in rootBaseStyles\n },\n large: {\n minHeight: fieldHeights.large,\n paddingLeft: tokens.spacingHorizontalM,\n paddingRight: tokens.spacingHorizontalM,\n ...typographyStyles.body2,\n ...shorthands.gap(tokens.spacingHorizontalSNudge),\n },\n outline: {\n // included in rootBaseStyles\n },\n outlineInteractive: {\n ':hover': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':active,:focus-within': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n underline: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderRadius(0), // corners look strange if rounded\n // border is specified in rootBaseStyles, but we only want a bottom border here\n borderTopStyle: 'none',\n borderRightStyle: 'none',\n borderLeftStyle: 'none',\n },\n underlineInteractive: {\n ':hover': {\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':active,:focus-within': {\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n '::after': shorthands.borderRadius(0), // remove rounded corners from focus underline\n },\n filled: {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n filledInteractive: {\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':hover,:focus-within': {\n // also handles pressed border color (:active)\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n },\n 'filled-darker-shadow': {\n backgroundColor: tokens.colorNeutralBackground3,\n boxShadow: tokens.shadow2,\n },\n 'filled-lighter-shadow': {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow2,\n },\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n});\n\nconst useInputClassName = makeResetStyles({\n boxSizing: 'border-box',\n flexGrow: 1,\n minWidth: 0, // required to make the input shrink to fit the wrapper\n borderStyle: 'none', // input itself never has a border (this is handled by inputWrapper)\n padding: `0 ${tokens.spacingHorizontalXXS}`,\n color: tokens.colorNeutralForeground1,\n // Use literal \"transparent\" (not from the theme) to always let the color from the root show through\n backgroundColor: 'transparent',\n\n '::placeholder': {\n color: tokens.colorNeutralForeground4,\n opacity: 1, // browser style override\n },\n\n outlineStyle: 'none', // disable default browser outline\n\n // Inherit typography styles from root\n fontFamily: 'inherit',\n fontSize: 'inherit',\n fontWeight: 'inherit',\n lineHeight: 'inherit',\n});\n\nconst useInputElementStyles = makeStyles({\n large: {\n paddingLeft: tokens.spacingHorizontalSNudge,\n paddingRight: tokens.spacingHorizontalSNudge,\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorTransparentBackground,\n cursor: 'not-allowed',\n '::placeholder': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useContentClassName = makeResetStyles({\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground3, // \"icon color\" in design spec\n display: 'flex',\n // special case styling for icons (most common case) to ensure they're centered vertically\n // size: medium (default)\n '> svg': { fontSize: '20px' },\n});\n\nconst useContentStyles = makeStyles({\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n // Ensure resizable icons show up with the proper font size\n small: {\n '> svg': { fontSize: '16px' },\n },\n medium: {\n // included in useContentClassName\n },\n large: {\n '> svg': { fontSize: '24px' },\n },\n});\n\n/**\n * Apply styling to the Input slots based on the state\n */\nexport const useInputStyles_unstable = (state: InputState): InputState => {\n const { size, appearance } = state;\n const disabled = state.input.disabled;\n const invalid = `${state.input['aria-invalid']}` === 'true';\n const filled = appearance.startsWith('filled');\n\n // Call exactly one of the two base className hooks. Each of these hooks is functionally identical, but with\n // different styles applied, which makes it ok to conditionally change which hook is called.\n const useRootClassName = disabled ? useRootNonInteractiveClassName : useRootInteractiveClassName;\n\n const rootStyles = useRootStyles();\n const inputStyles = useInputElementStyles();\n const contentStyles = useContentStyles();\n\n state.root.className = mergeClasses(\n inputClassNames.root,\n useRootClassName(),\n rootStyles[size],\n rootStyles[appearance],\n !disabled && appearance === 'outline' && rootStyles.outlineInteractive,\n !disabled && appearance === 'underline' && rootStyles.underlineInteractive,\n !disabled && filled && rootStyles.filledInteractive,\n filled && rootStyles.filled,\n !disabled && invalid && rootStyles.invalid,\n disabled && rootStyles.disabled,\n state.root.className,\n );\n\n state.input.className = mergeClasses(\n inputClassNames.input,\n useInputClassName(),\n size === 'large' && inputStyles.large,\n disabled && inputStyles.disabled,\n state.input.className,\n );\n\n const contentClasses = [useContentClassName(), disabled && contentStyles.disabled, contentStyles[size]];\n if (state.contentBefore) {\n state.contentBefore.className = mergeClasses(\n inputClassNames.contentBefore,\n ...contentClasses,\n state.contentBefore.className,\n );\n }\n if (state.contentAfter) {\n state.contentAfter.className = mergeClasses(\n inputClassNames.contentAfter,\n ...contentClasses,\n state.contentAfter.className,\n );\n }\n\n return state;\n};\n"]}
|