@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.
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"], function (require, exports, tslib_1, react_1, react_theme_1) {
1
+ define(["require", "exports", "tslib", "@fluentui/react-theme", "@griffel/react"], function (require, exports, tslib_1, react_theme_1, react_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useInputStyles_unstable = exports.inputClassNames = void 0;
@@ -14,53 +14,82 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"
14
14
  medium: '32px',
15
15
  large: '40px',
16
16
  };
17
- var useRootStyles = react_1.makeStyles({
18
- base: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ display: 'inline-flex', alignItems: 'center', flexWrap: 'nowrap' }, react_1.shorthands.gap(react_theme_1.tokens.spacingHorizontalXXS)), { fontFamily: react_theme_1.tokens.fontFamilyBase }), react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium)), { position: 'relative', boxSizing: 'border-box' }),
19
- interactive: {
20
- // This is all for the bottom focus border.
21
- // It's supposed to be 2px flat all the way across and match the radius of the field's corners.
22
- '::after': tslib_1.__assign(tslib_1.__assign({ boxSizing: 'border-box', content: '""', position: 'absolute', left: '-1px', bottom: '-1px', right: '-1px',
23
- // Maintaining the correct corner radius:
24
- // Use the whole border-radius as the height and only put radii on the bottom corners.
25
- // (Otherwise the radius would be automatically reduced to fit available space.)
26
- // max() ensures the focus border still shows up even if someone sets tokens.borderRadiusMedium to 0.
27
- height: "max(2px, " + react_theme_1.tokens.borderRadiusMedium + ")", borderBottomLeftRadius: react_theme_1.tokens.borderRadiusMedium, borderBottomRightRadius: react_theme_1.tokens.borderRadiusMedium }, react_1.shorthands.borderBottom('2px', 'solid', react_theme_1.tokens.colorCompoundBrandStroke)), { clipPath: 'inset(calc(100% - 2px) 0 0 0)',
28
- // Animation for focus OUT
29
- transform: 'scaleX(0)', transitionProperty: 'transform', transitionDuration: react_theme_1.tokens.durationUltraFast, transitionDelay: react_theme_1.tokens.curveAccelerateMid, '@media screen and (prefers-reduced-motion: reduce)': {
30
- transitionDuration: '0.01ms',
31
- transitionDelay: '0.01ms',
32
- } }),
33
- ':focus-within::after': {
34
- // Animation for focus IN
35
- transform: 'scaleX(1)',
36
- transitionProperty: 'transform',
37
- transitionDuration: react_theme_1.tokens.durationNormal,
38
- transitionDelay: react_theme_1.tokens.curveDecelerateMid,
39
- '@media screen and (prefers-reduced-motion: reduce)': {
40
- transitionDuration: '0.01ms',
41
- transitionDelay: '0.01ms',
42
- },
43
- },
44
- ':focus-within:active::after': {
45
- // This is if the user clicks the field again while it's already focused
46
- borderBottomColor: react_theme_1.tokens.colorCompoundBrandStrokePressed,
17
+ var rootBaseStyles = tslib_1.__assign(tslib_1.__assign({ display: 'inline-flex', alignItems: 'center', flexWrap: 'nowrap', gap: react_theme_1.tokens.spacingHorizontalXXS, borderRadius: react_theme_1.tokens.borderRadiusMedium, position: 'relative', boxSizing: 'border-box',
18
+ // size: medium (default)
19
+ minHeight: fieldHeights.medium, padding: "0 " + react_theme_1.tokens.spacingHorizontalMNudge }, react_theme_1.typographyStyles.body1), {
20
+ // appearance: outline (default)
21
+ backgroundColor: react_theme_1.tokens.colorNeutralBackground1, border: "1px solid " + react_theme_1.tokens.colorNeutralStroke1, borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible });
22
+ var rootInteractiveStyles = {
23
+ // This is all for the bottom focus border.
24
+ // It's supposed to be 2px flat all the way across and match the radius of the field's corners.
25
+ '::after': {
26
+ boxSizing: 'border-box',
27
+ content: '""',
28
+ position: 'absolute',
29
+ left: '-1px',
30
+ bottom: '-1px',
31
+ right: '-1px',
32
+ // Maintaining the correct corner radius:
33
+ // Use the whole border-radius as the height and only put radii on the bottom corners.
34
+ // (Otherwise the radius would be automatically reduced to fit available space.)
35
+ // max() ensures the focus border still shows up even if someone sets tokens.borderRadiusMedium to 0.
36
+ height: "max(2px, " + react_theme_1.tokens.borderRadiusMedium + ")",
37
+ borderBottomLeftRadius: react_theme_1.tokens.borderRadiusMedium,
38
+ borderBottomRightRadius: react_theme_1.tokens.borderRadiusMedium,
39
+ // Flat 2px border:
40
+ // By default borderBottom will cause little "horns" on the ends. The clipPath trims them off.
41
+ // (This could be done without trimming using `background: linear-gradient(...)`, but using
42
+ // borderBottom makes it easier for people to override the color if needed.)
43
+ borderBottom: "2px solid " + react_theme_1.tokens.colorCompoundBrandStroke,
44
+ clipPath: 'inset(calc(100% - 2px) 0 0 0)',
45
+ // Animation for focus OUT
46
+ transform: 'scaleX(0)',
47
+ transitionProperty: 'transform',
48
+ transitionDuration: react_theme_1.tokens.durationUltraFast,
49
+ transitionDelay: react_theme_1.tokens.curveAccelerateMid,
50
+ '@media screen and (prefers-reduced-motion: reduce)': {
51
+ transitionDuration: '0.01ms',
52
+ transitionDelay: '0.01ms',
47
53
  },
48
- ':focus-within': {
49
- outlineWidth: '2px',
50
- outlineStyle: 'solid',
51
- outlineColor: 'transparent',
54
+ },
55
+ ':focus-within::after': {
56
+ // Animation for focus IN
57
+ transform: 'scaleX(1)',
58
+ transitionProperty: 'transform',
59
+ transitionDuration: react_theme_1.tokens.durationNormal,
60
+ transitionDelay: react_theme_1.tokens.curveDecelerateMid,
61
+ '@media screen and (prefers-reduced-motion: reduce)': {
62
+ transitionDuration: '0.01ms',
63
+ transitionDelay: '0.01ms',
52
64
  },
53
65
  },
54
- small: tslib_1.__assign(tslib_1.__assign({ minHeight: fieldHeights.small }, react_1.shorthands.padding('0', react_theme_1.tokens.spacingHorizontalSNudge)), react_theme_1.typographyStyles.caption1),
55
- medium: tslib_1.__assign(tslib_1.__assign({ minHeight: fieldHeights.medium }, react_1.shorthands.padding('0', react_theme_1.tokens.spacingHorizontalMNudge)), react_theme_1.typographyStyles.body1),
56
- large: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ minHeight: fieldHeights.large }, react_1.shorthands.padding('0', react_theme_1.tokens.spacingHorizontalM)), react_theme_1.typographyStyles.body2), react_1.shorthands.gap(react_theme_1.tokens.spacingHorizontalSNudge)),
57
- outline: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1 }, react_1.shorthands.border('1px', 'solid', react_theme_1.tokens.colorNeutralStroke1)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible }),
66
+ ':focus-within:active::after': {
67
+ // This is if the user clicks the field again while it's already focused
68
+ borderBottomColor: react_theme_1.tokens.colorCompoundBrandStrokePressed,
69
+ },
70
+ ':focus-within': {
71
+ outline: '2px solid transparent',
72
+ },
73
+ };
74
+ var useRootNonInteractiveClassName = react_1.makeResetStyles(rootBaseStyles);
75
+ var useRootInteractiveClassName = react_1.makeResetStyles(tslib_1.__assign(tslib_1.__assign({}, rootBaseStyles), rootInteractiveStyles));
76
+ var useRootStyles = react_1.makeStyles({
77
+ small: tslib_1.__assign({ minHeight: fieldHeights.small, paddingLeft: react_theme_1.tokens.spacingHorizontalSNudge, paddingRight: react_theme_1.tokens.spacingHorizontalSNudge }, react_theme_1.typographyStyles.caption1),
78
+ medium: {
79
+ // included in rootBaseStyles
80
+ },
81
+ large: tslib_1.__assign(tslib_1.__assign({ minHeight: fieldHeights.large, paddingLeft: react_theme_1.tokens.spacingHorizontalM, paddingRight: react_theme_1.tokens.spacingHorizontalM }, react_theme_1.typographyStyles.body2), react_1.shorthands.gap(react_theme_1.tokens.spacingHorizontalSNudge)),
82
+ outline: {
83
+ // included in rootBaseStyles
84
+ },
58
85
  outlineInteractive: {
59
86
  ':hover': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Hover)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessibleHover }),
60
87
  // DO NOT add a space between the selectors! It changes the behavior of make-styles.
61
88
  ':active,:focus-within': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Pressed)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessiblePressed }),
62
89
  },
63
- underline: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderRadius(0)), react_1.shorthands.borderBottom('1px', 'solid', react_theme_1.tokens.colorNeutralStrokeAccessible)),
90
+ underline: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderRadius(0)), {
91
+ // border is specified in rootBaseStyles, but we only want a bottom border here
92
+ borderTopStyle: 'none', borderRightStyle: 'none', borderLeftStyle: 'none' }),
64
93
  underlineInteractive: {
65
94
  ':hover': {
66
95
  borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessibleHover,
@@ -71,7 +100,7 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"
71
100
  },
72
101
  '::after': react_1.shorthands.borderRadius(0), // remove rounded corners from focus underline
73
102
  },
74
- filled: tslib_1.__assign({}, react_1.shorthands.border('1px', 'solid', react_theme_1.tokens.colorTransparentStroke)),
103
+ filled: tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)),
75
104
  filledInteractive: {
76
105
  // DO NOT add a space between the selectors! It changes the behavior of make-styles.
77
106
  ':hover,:focus-within': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStrokeInteractive)),
@@ -95,16 +124,31 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"
95
124
  },
96
125
  disabled: tslib_1.__assign(tslib_1.__assign({ cursor: 'not-allowed', backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { '@media (forced-colors: active)': tslib_1.__assign({}, react_1.shorthands.borderColor('GrayText')) }),
97
126
  });
127
+ var useInputClassName = react_1.makeResetStyles({
128
+ boxSizing: 'border-box',
129
+ flexGrow: 1,
130
+ minWidth: 0,
131
+ borderStyle: 'none',
132
+ padding: "0 " + react_theme_1.tokens.spacingHorizontalXXS,
133
+ color: react_theme_1.tokens.colorNeutralForeground1,
134
+ // Use literal "transparent" (not from the theme) to always let the color from the root show through
135
+ backgroundColor: 'transparent',
136
+ '::placeholder': {
137
+ color: react_theme_1.tokens.colorNeutralForeground4,
138
+ opacity: 1, // browser style override
139
+ },
140
+ outlineStyle: 'none',
141
+ // Inherit typography styles from root
142
+ fontFamily: 'inherit',
143
+ fontSize: 'inherit',
144
+ fontWeight: 'inherit',
145
+ lineHeight: 'inherit',
146
+ });
98
147
  var useInputElementStyles = react_1.makeStyles({
99
- base: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ boxSizing: 'border-box', flexGrow: 1, minWidth: 0 }, react_1.shorthands.borderStyle('none')), react_1.shorthands.padding('0', react_theme_1.tokens.spacingHorizontalXXS)), { color: react_theme_1.tokens.colorNeutralForeground1,
100
- // Use literal "transparent" (not from the theme) to always let the color from the root show through
101
- backgroundColor: 'transparent', '::placeholder': {
102
- color: react_theme_1.tokens.colorNeutralForeground4,
103
- opacity: 1, // browser style override
104
- }, outlineStyle: 'none' }),
105
- small: tslib_1.__assign({}, react_theme_1.typographyStyles.caption1),
106
- medium: tslib_1.__assign({}, react_theme_1.typographyStyles.body1),
107
- large: tslib_1.__assign(tslib_1.__assign({}, react_theme_1.typographyStyles.body2), react_1.shorthands.padding('0', react_theme_1.tokens.spacingHorizontalSNudge)),
148
+ large: {
149
+ paddingLeft: react_theme_1.tokens.spacingHorizontalSNudge,
150
+ paddingRight: react_theme_1.tokens.spacingHorizontalSNudge,
151
+ },
108
152
  disabled: {
109
153
  color: react_theme_1.tokens.colorNeutralForegroundDisabled,
110
154
  backgroundColor: react_theme_1.tokens.colorTransparentBackground,
@@ -114,13 +158,15 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"
114
158
  },
115
159
  },
116
160
  });
161
+ var useContentClassName = react_1.makeResetStyles({
162
+ boxSizing: 'border-box',
163
+ color: react_theme_1.tokens.colorNeutralForeground3,
164
+ display: 'flex',
165
+ // special case styling for icons (most common case) to ensure they're centered vertically
166
+ // size: medium (default)
167
+ '> svg': { fontSize: '20px' },
168
+ });
117
169
  var useContentStyles = react_1.makeStyles({
118
- base: {
119
- boxSizing: 'border-box',
120
- color: react_theme_1.tokens.colorNeutralForeground3,
121
- display: 'flex',
122
- // special case styling for icons (most common case) to ensure they're centered vertically
123
- },
124
170
  disabled: {
125
171
  color: react_theme_1.tokens.colorNeutralForegroundDisabled,
126
172
  },
@@ -129,7 +175,7 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"
129
175
  '> svg': { fontSize: '16px' },
130
176
  },
131
177
  medium: {
132
- '> svg': { fontSize: '20px' },
178
+ // included in useContentClassName
133
179
  },
134
180
  large: {
135
181
  '> svg': { fontSize: '24px' },
@@ -143,12 +189,15 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"
143
189
  var disabled = state.input.disabled;
144
190
  var invalid = "" + state.input['aria-invalid'] === 'true';
145
191
  var filled = appearance.startsWith('filled');
192
+ // Call exactly one of the two base className hooks. Each of these hooks is functionally identical, but with
193
+ // different styles applied, which makes it ok to conditionally change which hook is called.
194
+ var useRootClassName = disabled ? useRootNonInteractiveClassName : useRootInteractiveClassName;
146
195
  var rootStyles = useRootStyles();
147
196
  var inputStyles = useInputElementStyles();
148
197
  var contentStyles = useContentStyles();
149
- state.root.className = react_1.mergeClasses(exports.inputClassNames.root, rootStyles.base, rootStyles[size], rootStyles[appearance], !disabled && rootStyles.interactive, !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);
150
- state.input.className = react_1.mergeClasses(exports.inputClassNames.input, inputStyles.base, inputStyles[size], disabled && inputStyles.disabled, state.input.className);
151
- var contentClasses = [contentStyles.base, disabled && contentStyles.disabled, contentStyles[size]];
198
+ 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);
199
+ state.input.className = react_1.mergeClasses(exports.inputClassNames.input, useInputClassName(), size === 'large' && inputStyles.large, disabled && inputStyles.disabled, state.input.className);
200
+ var contentClasses = [useContentClassName(), disabled && contentStyles.disabled, contentStyles[size]];
152
201
  if (state.contentBefore) {
153
202
  state.contentBefore.className = react_1.mergeClasses.apply(void 0, tslib_1.__spreadArray(tslib_1.__spreadArray([exports.inputClassNames.contentBefore], contentClasses), [state.contentBefore.className]));
154
203
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useInputStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-input/src/components/Input/useInputStyles.ts"],"names":[],"mappings":";;;;IAKa,QAAA,eAAe,GAA+B;QACzD,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,kBAAkB;QACzB,aAAa,EAAE,0BAA0B;QACzC,YAAY,EAAE,yBAAyB;KACxC,CAAC;IAEF,kDAAkD;IAClD,IAAM,YAAY,GAAG;QACnB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KACd,CAAC;IAEF,IAAM,aAAa,GAAG,kBAAU,CAAC;QAC/B,IAAI,wEACF,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,QAAQ,EACpB,QAAQ,EAAE,QAAQ,IACf,kBAAU,CAAC,GAAG,CAAC,oBAAM,CAAC,oBAAoB,CAAC,KAC9C,UAAU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,WAAW,CAAC,IAAI,CAAC,EACjB,QAAQ,IAAI,WAAW,CAAC,QAAQ,EAChC,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;QAEF,IAAM,cAAc,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,IAAI,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QACrG,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,KAAK,CAAC,aAAa,CAAC,SAAS,GAAG,oBAAY,4DAC1C,uBAAe,CAAC,aAAa,GAC1B,cAAc,IACjB,KAAK,CAAC,aAAa,CAAC,SAAS,GAC9B,CAAC;SACH;QACD,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,KAAK,CAAC,YAAY,CAAC,SAAS,GAAG,oBAAY,4DACzC,uBAAe,CAAC,YAAY,GACzB,cAAc,IACjB,KAAK,CAAC,YAAY,CAAC,SAAS,GAC7B,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAlDW,QAAA,uBAAuB,2BAkDlC","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,"file":"useInputStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-input/src/components/Input/useInputStyles.ts"],"names":[],"mappings":";;;;IAMa,QAAA,eAAe,GAA+B;QACzD,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,kBAAkB;QACzB,aAAa,EAAE,0BAA0B;QACzC,YAAY,EAAE,yBAAyB;KACxC,CAAC;IAEF,kDAAkD;IAClD,IAAM,YAAY,GAAG;QACnB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KACd,CAAC;IAEF,IAAM,cAAc,uCAClB,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,QAAQ,EACpB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,oBAA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,MAAM,IAAI,UAAU,CAAC,MAAM,EAC3B,CAAC,QAAQ,IAAI,OAAO,IAAI,UAAU,CAAC,OAAO,EAC1C,QAAQ,IAAI,UAAU,CAAC,QAAQ,EAC/B,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QAEF,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAClC,uBAAe,CAAC,KAAK,EACrB,iBAAiB,EAAE,EACnB,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,KAAK,EACrC,QAAQ,IAAI,WAAW,CAAC,QAAQ,EAChC,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;QAEF,IAAM,cAAc,GAAG,CAAC,mBAAmB,EAAE,EAAE,QAAQ,IAAI,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QACxG,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,KAAK,CAAC,aAAa,CAAC,SAAS,GAAG,oBAAY,4DAC1C,uBAAe,CAAC,aAAa,GAC1B,cAAc,IACjB,KAAK,CAAC,aAAa,CAAC,SAAS,GAC9B,CAAC;SACH;QACD,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,KAAK,CAAC,YAAY,CAAC,SAAS,GAAG,oBAAY,4DACzC,uBAAe,CAAC,YAAY,GACzB,cAAc,IACjB,KAAK,CAAC,YAAY,CAAC,SAAS,GAC7B,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IArDW,QAAA,uBAAuB,2BAqDlC","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"]}