@fluentui/react-spinbutton 9.4.7 → 9.5.1
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.md +23 -2
- package/lib/SpinButton.js.map +1 -1
- package/lib/components/SpinButton/SpinButton.js.map +1 -1
- package/lib/components/SpinButton/SpinButton.types.js.map +1 -1
- package/lib/components/SpinButton/index.js.map +1 -1
- package/lib/components/SpinButton/renderSpinButton.js.map +1 -1
- package/lib/components/SpinButton/useSpinButton.js.map +1 -1
- package/lib/components/SpinButton/useSpinButtonStyles.styles.raw.js +359 -0
- package/lib/components/SpinButton/useSpinButtonStyles.styles.raw.js.map +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getBound.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/precision.js.map +1 -1
- package/lib-commonjs/SpinButton.js.map +1 -1
- package/lib-commonjs/components/SpinButton/SpinButton.js.map +1 -1
- package/lib-commonjs/components/SpinButton/SpinButton.types.js.map +1 -1
- package/lib-commonjs/components/SpinButton/index.js.map +1 -1
- package/lib-commonjs/components/SpinButton/renderSpinButton.js.map +1 -1
- package/lib-commonjs/components/SpinButton/useSpinButton.js.map +1 -1
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.raw.js +372 -0
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getBound.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/precision.js.map +1 -1
- package/package.json +4 -4
@@ -0,0 +1,372 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
spinButtonClassNames: function() {
|
13
|
+
return spinButtonClassNames;
|
14
|
+
},
|
15
|
+
useSpinButtonStyles_unstable: function() {
|
16
|
+
return useSpinButtonStyles_unstable;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
const _react = require("@griffel/react");
|
20
|
+
const _reacttheme = require("@fluentui/react-theme");
|
21
|
+
const spinButtonClassNames = {
|
22
|
+
root: 'fui-SpinButton',
|
23
|
+
input: 'fui-SpinButton__input',
|
24
|
+
incrementButton: 'fui-SpinButton__incrementButton',
|
25
|
+
decrementButton: 'fui-SpinButton__decrementButton'
|
26
|
+
};
|
27
|
+
const spinButtonExtraClassNames = {
|
28
|
+
buttonActive: 'fui-SpinButton__button_active'
|
29
|
+
};
|
30
|
+
const fieldHeights = {
|
31
|
+
small: '24px',
|
32
|
+
medium: '32px'
|
33
|
+
};
|
34
|
+
const useRootClassName = (0, _react.makeResetStyles)({
|
35
|
+
display: 'inline-grid',
|
36
|
+
gridTemplateColumns: `1fr 24px`,
|
37
|
+
gridTemplateRows: '1fr 1fr',
|
38
|
+
columnGap: _reacttheme.tokens.spacingHorizontalXS,
|
39
|
+
rowGap: 0,
|
40
|
+
position: 'relative',
|
41
|
+
isolation: 'isolate',
|
42
|
+
verticalAlign: 'middle',
|
43
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1,
|
44
|
+
minHeight: fieldHeights.medium,
|
45
|
+
padding: `0 0 0 ${_reacttheme.tokens.spacingHorizontalMNudge}`,
|
46
|
+
borderRadius: _reacttheme.tokens.borderRadiusMedium,
|
47
|
+
// Apply border styles on the ::before pseudo element.
|
48
|
+
// We cannot use ::after since that is used for selection.
|
49
|
+
// Using the pseudo element allows us to place the border
|
50
|
+
// above content in the component which ensures the buttons
|
51
|
+
// line up visually with the border as expected. Without this
|
52
|
+
// there is a bit of a gap which can become very noticeable
|
53
|
+
// at high zoom or when OS zoom levels are not divisible by 2
|
54
|
+
// (e.g., 150% on Windows in Firefox)
|
55
|
+
// This is most noticeable on the "outline" appearance which is
|
56
|
+
// also the default so it feels worth the extra ceremony to get right.
|
57
|
+
'::before': {
|
58
|
+
content: '""',
|
59
|
+
boxSizing: 'border-box',
|
60
|
+
position: 'absolute',
|
61
|
+
top: 0,
|
62
|
+
right: 0,
|
63
|
+
bottom: 0,
|
64
|
+
left: 0,
|
65
|
+
pointerEvents: 'none',
|
66
|
+
zIndex: 10,
|
67
|
+
border: `1px solid ${_reacttheme.tokens.colorNeutralStroke1}`,
|
68
|
+
borderBottomColor: _reacttheme.tokens.colorNeutralStrokeAccessible,
|
69
|
+
borderRadius: _reacttheme.tokens.borderRadiusMedium
|
70
|
+
},
|
71
|
+
'::after': {
|
72
|
+
boxSizing: 'border-box',
|
73
|
+
content: '""',
|
74
|
+
position: 'absolute',
|
75
|
+
right: 0,
|
76
|
+
bottom: 0,
|
77
|
+
left: 0,
|
78
|
+
zIndex: 20,
|
79
|
+
// Maintaining the correct corner radius:
|
80
|
+
// Use the whole border-radius as the height and only put radii on the bottom corners.
|
81
|
+
// (Otherwise the radius would be automatically reduced to fit available space.)
|
82
|
+
// max() ensures the focus border still shows up even if someone sets tokens.borderRadiusMedium to 0.
|
83
|
+
height: `max(2px, ${_reacttheme.tokens.borderRadiusMedium})`,
|
84
|
+
borderBottomLeftRadius: _reacttheme.tokens.borderRadiusMedium,
|
85
|
+
borderBottomRightRadius: _reacttheme.tokens.borderRadiusMedium,
|
86
|
+
// Flat 2px border:
|
87
|
+
// By default borderBottom will cause little "horns" on the ends. The clipPath trims them off.
|
88
|
+
// (This could be done without trimming using `background: linear-gradient(...)`, but using
|
89
|
+
// borderBottom makes it easier for people to override the color if needed.)
|
90
|
+
borderBottom: `2px solid ${_reacttheme.tokens.colorCompoundBrandStroke}`,
|
91
|
+
clipPath: 'inset(calc(100% - 2px) 0 0 0)',
|
92
|
+
// Animation for focus OUT
|
93
|
+
transform: 'scaleX(0)',
|
94
|
+
transitionProperty: 'transform',
|
95
|
+
transitionDuration: _reacttheme.tokens.durationUltraFast,
|
96
|
+
transitionDelay: _reacttheme.tokens.curveAccelerateMid,
|
97
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
98
|
+
transitionDuration: '0.01ms',
|
99
|
+
transitionDelay: '0.01ms'
|
100
|
+
}
|
101
|
+
},
|
102
|
+
':focus-within::after': {
|
103
|
+
// Animation for focus IN
|
104
|
+
transform: 'scaleX(1)',
|
105
|
+
transitionProperty: 'transform',
|
106
|
+
transitionDuration: _reacttheme.tokens.durationNormal,
|
107
|
+
transitionDelay: _reacttheme.tokens.curveDecelerateMid,
|
108
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
109
|
+
transitionDuration: '0.01ms',
|
110
|
+
transitionDelay: '0.01ms'
|
111
|
+
}
|
112
|
+
},
|
113
|
+
':focus-within:active::after': {
|
114
|
+
// This is if the user clicks the field again while it's already focused
|
115
|
+
borderBottomColor: _reacttheme.tokens.colorCompoundBrandStrokePressed
|
116
|
+
},
|
117
|
+
':focus-within': {
|
118
|
+
outline: '2px solid transparent'
|
119
|
+
}
|
120
|
+
});
|
121
|
+
const useRootStyles = (0, _react.makeStyles)({
|
122
|
+
small: {
|
123
|
+
minHeight: fieldHeights.small,
|
124
|
+
..._reacttheme.typographyStyles.caption1,
|
125
|
+
paddingLeft: _reacttheme.tokens.spacingHorizontalS
|
126
|
+
},
|
127
|
+
medium: {},
|
128
|
+
outline: {},
|
129
|
+
outlineInteractive: {
|
130
|
+
':hover::before': {
|
131
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Hover),
|
132
|
+
borderBottomColor: _reacttheme.tokens.colorNeutralStrokeAccessibleHover
|
133
|
+
},
|
134
|
+
// DO NOT add a space between the selectors! It changes the behavior of make-styles.
|
135
|
+
':active,:focus-within': {
|
136
|
+
'::before': {
|
137
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Pressed),
|
138
|
+
borderBottomColor: _reacttheme.tokens.colorNeutralStrokeAccessiblePressed
|
139
|
+
}
|
140
|
+
}
|
141
|
+
},
|
142
|
+
underline: {
|
143
|
+
'::before': {
|
144
|
+
..._react.shorthands.borderWidth(0, 0, '1px', 0),
|
145
|
+
borderRadius: _reacttheme.tokens.borderRadiusNone
|
146
|
+
}
|
147
|
+
},
|
148
|
+
underlineInteractive: {
|
149
|
+
':hover::before': {
|
150
|
+
borderBottomColor: _reacttheme.tokens.colorNeutralStrokeAccessibleHover
|
151
|
+
},
|
152
|
+
// DO NOT add a space between the selectors! It changes the behavior of make-styles.
|
153
|
+
':active,:focus-within': {
|
154
|
+
'::before': {
|
155
|
+
borderBottomColor: _reacttheme.tokens.colorNeutralStrokeAccessiblePressed
|
156
|
+
}
|
157
|
+
},
|
158
|
+
'::after': {
|
159
|
+
borderRadius: _reacttheme.tokens.borderRadiusNone
|
160
|
+
}
|
161
|
+
},
|
162
|
+
filled: {
|
163
|
+
'::before': {
|
164
|
+
border: `1px solid ${_reacttheme.tokens.colorTransparentStroke}`
|
165
|
+
}
|
166
|
+
},
|
167
|
+
'filled-darker': {
|
168
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground3
|
169
|
+
},
|
170
|
+
'filled-lighter': {
|
171
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1
|
172
|
+
},
|
173
|
+
filledInteractive: {
|
174
|
+
// DO NOT add a space between the selectors! It changes the behavior of make-styles.
|
175
|
+
':hover,:focus-within': {
|
176
|
+
'::before': {
|
177
|
+
// also handles pressed border color (:active)
|
178
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorTransparentStrokeInteractive)
|
179
|
+
}
|
180
|
+
}
|
181
|
+
},
|
182
|
+
invalid: {
|
183
|
+
':not(:focus-within),:hover:not(:focus-within)': {
|
184
|
+
'::before': {
|
185
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorPaletteRedBorder2)
|
186
|
+
}
|
187
|
+
}
|
188
|
+
},
|
189
|
+
disabled: {
|
190
|
+
cursor: 'not-allowed',
|
191
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
192
|
+
'::before': {
|
193
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStrokeDisabled),
|
194
|
+
'@media (forced-colors: active)': {
|
195
|
+
..._react.shorthands.borderColor('GrayText')
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
});
|
200
|
+
const useInputClassName = (0, _react.makeResetStyles)({
|
201
|
+
gridColumnStart: '1',
|
202
|
+
gridColumnEnd: '2',
|
203
|
+
gridRowStart: '1',
|
204
|
+
gridRowEnd: '3',
|
205
|
+
outlineStyle: 'none',
|
206
|
+
border: '0',
|
207
|
+
padding: '0',
|
208
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
209
|
+
// Use literal "transparent" (not from the theme) to always let the color from the root show through
|
210
|
+
backgroundColor: 'transparent',
|
211
|
+
fontFamily: 'inherit',
|
212
|
+
fontSize: 'inherit',
|
213
|
+
fontWeight: 'inherit',
|
214
|
+
lineHeight: 'inherit',
|
215
|
+
width: '100%',
|
216
|
+
'::placeholder': {
|
217
|
+
color: _reacttheme.tokens.colorNeutralForeground4,
|
218
|
+
opacity: 1
|
219
|
+
}
|
220
|
+
});
|
221
|
+
const useInputStyles = (0, _react.makeStyles)({
|
222
|
+
disabled: {
|
223
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled,
|
224
|
+
cursor: 'not-allowed',
|
225
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
226
|
+
'::placeholder': {
|
227
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
228
|
+
}
|
229
|
+
}
|
230
|
+
});
|
231
|
+
const useBaseButtonClassName = (0, _react.makeResetStyles)({
|
232
|
+
display: 'inline-flex',
|
233
|
+
width: '24px',
|
234
|
+
alignItems: 'center',
|
235
|
+
justifyContent: 'center',
|
236
|
+
border: '0',
|
237
|
+
position: 'absolute',
|
238
|
+
outlineStyle: 'none',
|
239
|
+
height: '16px',
|
240
|
+
// Use literal "transparent" (not from the theme) to always let the color from the root show through
|
241
|
+
backgroundColor: 'transparent',
|
242
|
+
color: _reacttheme.tokens.colorNeutralForeground3,
|
243
|
+
// common button layout
|
244
|
+
gridColumnStart: '2',
|
245
|
+
borderRadius: '0',
|
246
|
+
padding: '0 5px 0 5px',
|
247
|
+
':active': {
|
248
|
+
outlineStyle: 'none'
|
249
|
+
},
|
250
|
+
':enabled': {
|
251
|
+
':hover': {
|
252
|
+
cursor: 'pointer',
|
253
|
+
color: _reacttheme.tokens.colorNeutralForeground3Hover,
|
254
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundHover
|
255
|
+
},
|
256
|
+
':active': {
|
257
|
+
color: _reacttheme.tokens.colorNeutralForeground3Pressed,
|
258
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundPressed
|
259
|
+
},
|
260
|
+
[`&.${spinButtonExtraClassNames.buttonActive}`]: {
|
261
|
+
color: _reacttheme.tokens.colorNeutralForeground3Pressed,
|
262
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundPressed
|
263
|
+
}
|
264
|
+
},
|
265
|
+
':disabled': {
|
266
|
+
cursor: 'not-allowed',
|
267
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
268
|
+
}
|
269
|
+
});
|
270
|
+
const useButtonStyles = (0, _react.makeStyles)({
|
271
|
+
increment: {
|
272
|
+
gridRowStart: '1',
|
273
|
+
borderTopRightRadius: _reacttheme.tokens.borderRadiusMedium,
|
274
|
+
paddingTop: '4px',
|
275
|
+
paddingBottom: '1px'
|
276
|
+
},
|
277
|
+
decrement: {
|
278
|
+
gridRowStart: '2',
|
279
|
+
borderBottomRightRadius: _reacttheme.tokens.borderRadiusMedium,
|
280
|
+
paddingTop: '1px',
|
281
|
+
paddingBottom: '4px'
|
282
|
+
},
|
283
|
+
// Padding values numbers don't align with design specs
|
284
|
+
// but visually the padding aligns.
|
285
|
+
// The icons are set in a 16x16px square but the artwork is inset from that
|
286
|
+
// so these padding values are computed by hand.
|
287
|
+
// Additionally the design uses fractional values so these are
|
288
|
+
// rounded to the nearest integer.
|
289
|
+
incrementButtonSmall: {
|
290
|
+
padding: '3px 6px 0px 4px',
|
291
|
+
height: '12px'
|
292
|
+
},
|
293
|
+
decrementButtonSmall: {
|
294
|
+
padding: '0px 6px 3px 4px',
|
295
|
+
height: '12px'
|
296
|
+
},
|
297
|
+
outline: {},
|
298
|
+
underline: {
|
299
|
+
backgroundColor: 'transparent',
|
300
|
+
color: _reacttheme.tokens.colorNeutralForeground3,
|
301
|
+
':enabled': {
|
302
|
+
':hover': {
|
303
|
+
color: _reacttheme.tokens.colorNeutralForeground3Hover,
|
304
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundHover
|
305
|
+
},
|
306
|
+
':active': {
|
307
|
+
color: _reacttheme.tokens.colorNeutralForeground3Pressed,
|
308
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundPressed
|
309
|
+
},
|
310
|
+
[`&.${spinButtonExtraClassNames.buttonActive}`]: {
|
311
|
+
color: _reacttheme.tokens.colorNeutralForeground3Pressed,
|
312
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundPressed
|
313
|
+
}
|
314
|
+
},
|
315
|
+
':disabled': {
|
316
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
317
|
+
}
|
318
|
+
},
|
319
|
+
'filled-darker': {
|
320
|
+
backgroundColor: 'transparent',
|
321
|
+
color: _reacttheme.tokens.colorNeutralForeground3,
|
322
|
+
':enabled': {
|
323
|
+
':hover': {
|
324
|
+
color: _reacttheme.tokens.colorNeutralForeground3Hover,
|
325
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground3Hover
|
326
|
+
},
|
327
|
+
':active': {
|
328
|
+
color: _reacttheme.tokens.colorNeutralForeground3Pressed,
|
329
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground3Pressed
|
330
|
+
},
|
331
|
+
[`&.${spinButtonExtraClassNames.buttonActive}`]: {
|
332
|
+
color: _reacttheme.tokens.colorNeutralForeground3Pressed,
|
333
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground3Pressed
|
334
|
+
}
|
335
|
+
},
|
336
|
+
':disabled': {
|
337
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
338
|
+
}
|
339
|
+
},
|
340
|
+
'filled-lighter': {
|
341
|
+
backgroundColor: 'transparent',
|
342
|
+
color: _reacttheme.tokens.colorNeutralForeground3,
|
343
|
+
':enabled': {
|
344
|
+
':hover': {
|
345
|
+
color: _reacttheme.tokens.colorNeutralForeground3Hover,
|
346
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Hover
|
347
|
+
},
|
348
|
+
[`:active,&.${spinButtonExtraClassNames.buttonActive}`]: {
|
349
|
+
color: _reacttheme.tokens.colorNeutralForeground3Pressed,
|
350
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Pressed
|
351
|
+
}
|
352
|
+
},
|
353
|
+
':disabled': {
|
354
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
355
|
+
}
|
356
|
+
}
|
357
|
+
});
|
358
|
+
const useSpinButtonStyles_unstable = (state)=>{
|
359
|
+
'use no memo';
|
360
|
+
const { appearance, spinState, size } = state;
|
361
|
+
const disabled = state.input.disabled;
|
362
|
+
const invalid = `${state.input['aria-invalid']}` === 'true';
|
363
|
+
const filled = appearance.startsWith('filled');
|
364
|
+
const rootStyles = useRootStyles();
|
365
|
+
const buttonStyles = useButtonStyles();
|
366
|
+
const inputStyles = useInputStyles();
|
367
|
+
state.root.className = (0, _react.mergeClasses)(spinButtonClassNames.root, useRootClassName(), rootStyles[size], rootStyles[appearance], filled && rootStyles.filled, !disabled && appearance === 'outline' && rootStyles.outlineInteractive, !disabled && appearance === 'underline' && rootStyles.underlineInteractive, !disabled && filled && rootStyles.filledInteractive, !disabled && invalid && rootStyles.invalid, disabled && rootStyles.disabled, state.root.className);
|
368
|
+
state.incrementButton.className = (0, _react.mergeClasses)(spinButtonClassNames.incrementButton, spinState === 'up' && `${spinButtonExtraClassNames.buttonActive}`, useBaseButtonClassName(), buttonStyles.increment, buttonStyles[appearance], size === 'small' && buttonStyles.incrementButtonSmall, state.incrementButton.className);
|
369
|
+
state.decrementButton.className = (0, _react.mergeClasses)(spinButtonClassNames.decrementButton, spinState === 'down' && `${spinButtonExtraClassNames.buttonActive}`, useBaseButtonClassName(), buttonStyles.decrement, buttonStyles[appearance], size === 'small' && buttonStyles.decrementButtonSmall, state.decrementButton.className);
|
370
|
+
state.input.className = (0, _react.mergeClasses)(spinButtonClassNames.input, useInputClassName(), disabled && inputStyles.disabled, state.input.className);
|
371
|
+
return state;
|
372
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/SpinButton/useSpinButtonStyles.styles.ts"],"sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SpinButtonSlots, SpinButtonState } from './SpinButton.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\nexport const spinButtonClassNames: SlotClassNames<SpinButtonSlots> = {\n root: 'fui-SpinButton',\n input: 'fui-SpinButton__input',\n incrementButton: 'fui-SpinButton__incrementButton',\n decrementButton: 'fui-SpinButton__decrementButton',\n};\n\nconst spinButtonExtraClassNames = {\n buttonActive: 'fui-SpinButton__button_active',\n};\n\nconst fieldHeights = {\n small: '24px',\n medium: '32px',\n};\n\nconst useRootClassName = makeResetStyles({\n display: 'inline-grid',\n gridTemplateColumns: `1fr 24px`,\n gridTemplateRows: '1fr 1fr',\n columnGap: tokens.spacingHorizontalXS,\n rowGap: 0,\n position: 'relative',\n isolation: 'isolate',\n verticalAlign: 'middle',\n\n backgroundColor: tokens.colorNeutralBackground1,\n minHeight: fieldHeights.medium,\n padding: `0 0 0 ${tokens.spacingHorizontalMNudge}`,\n borderRadius: tokens.borderRadiusMedium,\n\n // Apply border styles on the ::before pseudo element.\n // We cannot use ::after since that is used for selection.\n // Using the pseudo element allows us to place the border\n // above content in the component which ensures the buttons\n // line up visually with the border as expected. Without this\n // there is a bit of a gap which can become very noticeable\n // at high zoom or when OS zoom levels are not divisible by 2\n // (e.g., 150% on Windows in Firefox)\n // This is most noticeable on the \"outline\" appearance which is\n // also the default so it feels worth the extra ceremony to get right.\n '::before': {\n content: '\"\"',\n boxSizing: 'border-box',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n pointerEvents: 'none',\n zIndex: 10,\n border: `1px solid ${tokens.colorNeutralStroke1}`,\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n borderRadius: tokens.borderRadiusMedium,\n },\n\n '::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n right: 0,\n bottom: 0,\n left: 0,\n zIndex: 20,\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\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 useRootStyles = makeStyles({\n small: {\n minHeight: fieldHeights.small,\n ...typographyStyles.caption1,\n paddingLeft: tokens.spacingHorizontalS,\n },\n\n medium: {\n // set by useRootClassName\n },\n\n outline: {\n // set by useRootClassName\n },\n\n outlineInteractive: {\n ':hover::before': {\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 '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n underline: {\n '::before': {\n ...shorthands.borderWidth(0, 0, '1px', 0),\n borderRadius: tokens.borderRadiusNone, // corners look strange if rounded\n },\n },\n\n underlineInteractive: {\n ':hover::before': {\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 '::before': {\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n '::after': {\n borderRadius: tokens.borderRadiusNone, // remove rounded corners from focus underline\n },\n },\n\n filled: {\n '::before': {\n border: `1px solid ${tokens.colorTransparentStroke}`,\n },\n },\n\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n },\n\n filledInteractive: {\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':hover,:focus-within': {\n '::before': {\n // also handles pressed border color (:active)\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n },\n\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n '::before': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n },\n\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n },\n});\n\nconst useInputClassName = makeResetStyles({\n gridColumnStart: '1',\n gridColumnEnd: '2',\n gridRowStart: '1',\n gridRowEnd: '3',\n outlineStyle: 'none',\n border: '0',\n padding: '0',\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 fontFamily: 'inherit',\n fontSize: 'inherit',\n fontWeight: 'inherit',\n lineHeight: 'inherit',\n width: '100%',\n\n '::placeholder': {\n color: tokens.colorNeutralForeground4,\n opacity: 1, // browser style override\n },\n});\n\nconst useInputStyles = makeStyles({\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n '::placeholder': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useBaseButtonClassName = makeResetStyles({\n display: 'inline-flex',\n width: '24px',\n alignItems: 'center',\n justifyContent: 'center',\n border: '0',\n position: 'absolute',\n\n outlineStyle: 'none',\n height: '16px',\n\n // Use literal \"transparent\" (not from the theme) to always let the color from the root show through\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n\n // common button layout\n gridColumnStart: '2',\n borderRadius: '0',\n padding: '0 5px 0 5px',\n\n ':active': {\n outlineStyle: 'none',\n },\n\n ':enabled': {\n ':hover': {\n cursor: 'pointer',\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n\n ':disabled': {\n cursor: 'not-allowed',\n color: tokens.colorNeutralForegroundDisabled,\n },\n});\n\nconst useButtonStyles = makeStyles({\n increment: {\n gridRowStart: '1',\n borderTopRightRadius: tokens.borderRadiusMedium,\n paddingTop: '4px',\n paddingBottom: '1px',\n },\n decrement: {\n gridRowStart: '2',\n borderBottomRightRadius: tokens.borderRadiusMedium,\n paddingTop: '1px',\n paddingBottom: '4px',\n },\n // Padding values numbers don't align with design specs\n // but visually the padding aligns.\n // The icons are set in a 16x16px square but the artwork is inset from that\n // so these padding values are computed by hand.\n // Additionally the design uses fractional values so these are\n // rounded to the nearest integer.\n incrementButtonSmall: {\n padding: '3px 6px 0px 4px',\n height: '12px',\n },\n\n decrementButtonSmall: {\n padding: '0px 6px 3px 4px',\n height: '12px',\n },\n\n outline: {\n // set by useButtonClassName\n },\n\n underline: {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n 'filled-darker': {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorNeutralBackground3Hover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n 'filled-lighter': {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorNeutralBackground1Hover,\n },\n [`:active,&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\n/**\n * Apply styling to the SpinButton slots based on the state\n */\nexport const useSpinButtonStyles_unstable = (state: SpinButtonState): SpinButtonState => {\n 'use no memo';\n\n const { appearance, spinState, size } = 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 buttonStyles = useButtonStyles();\n const inputStyles = useInputStyles();\n\n state.root.className = mergeClasses(\n spinButtonClassNames.root,\n useRootClassName(),\n rootStyles[size],\n rootStyles[appearance],\n filled && rootStyles.filled,\n !disabled && appearance === 'outline' && rootStyles.outlineInteractive,\n !disabled && appearance === 'underline' && rootStyles.underlineInteractive,\n !disabled && filled && rootStyles.filledInteractive,\n !disabled && invalid && rootStyles.invalid,\n disabled && rootStyles.disabled,\n state.root.className,\n );\n\n state.incrementButton.className = mergeClasses(\n spinButtonClassNames.incrementButton,\n spinState === 'up' && `${spinButtonExtraClassNames.buttonActive}`,\n useBaseButtonClassName(),\n buttonStyles.increment,\n buttonStyles[appearance],\n size === 'small' && buttonStyles.incrementButtonSmall,\n state.incrementButton.className,\n );\n state.decrementButton.className = mergeClasses(\n spinButtonClassNames.decrementButton,\n spinState === 'down' && `${spinButtonExtraClassNames.buttonActive}`,\n useBaseButtonClassName(),\n buttonStyles.decrement,\n buttonStyles[appearance],\n size === 'small' && buttonStyles.decrementButtonSmall,\n state.decrementButton.className,\n );\n\n state.input.className = mergeClasses(\n spinButtonClassNames.input,\n useInputClassName(),\n disabled && inputStyles.disabled,\n state.input.className,\n );\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","shorthands","tokens","typographyStyles","spinButtonClassNames","root","input","incrementButton","decrementButton","spinButtonExtraClassNames","buttonActive","fieldHeights","small","medium","useRootClassName","display","gridTemplateColumns","gridTemplateRows","columnGap","spacingHorizontalXS","rowGap","position","isolation","verticalAlign","backgroundColor","colorNeutralBackground1","minHeight","padding","spacingHorizontalMNudge","borderRadius","borderRadiusMedium","content","boxSizing","top","right","bottom","left","pointerEvents","zIndex","border","colorNeutralStroke1","borderBottomColor","colorNeutralStrokeAccessible","height","borderBottomLeftRadius","borderBottomRightRadius","borderBottom","colorCompoundBrandStroke","clipPath","transform","transitionProperty","transitionDuration","durationUltraFast","transitionDelay","curveAccelerateMid","durationNormal","curveDecelerateMid","colorCompoundBrandStrokePressed","outline","useRootStyles","caption1","paddingLeft","spacingHorizontalS","outlineInteractive","borderColor","colorNeutralStroke1Hover","colorNeutralStrokeAccessibleHover","colorNeutralStroke1Pressed","colorNeutralStrokeAccessiblePressed","underline","borderWidth","borderRadiusNone","underlineInteractive","filled","colorTransparentStroke","colorNeutralBackground3","filledInteractive","colorTransparentStrokeInteractive","invalid","colorPaletteRedBorder2","disabled","cursor","colorTransparentBackground","colorNeutralStrokeDisabled","useInputClassName","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","outlineStyle","color","colorNeutralForeground1","fontFamily","fontSize","fontWeight","lineHeight","width","colorNeutralForeground4","opacity","useInputStyles","colorNeutralForegroundDisabled","useBaseButtonClassName","alignItems","justifyContent","colorNeutralForeground3","colorNeutralForeground3Hover","colorSubtleBackgroundHover","colorNeutralForeground3Pressed","colorSubtleBackgroundPressed","useButtonStyles","increment","borderTopRightRadius","paddingTop","paddingBottom","decrement","incrementButtonSmall","decrementButtonSmall","colorNeutralBackground3Hover","colorNeutralBackground3Pressed","colorNeutralBackground1Hover","colorNeutralBackground1Pressed","useSpinButtonStyles_unstable","state","appearance","spinState","size","startsWith","rootStyles","buttonStyles","inputStyles","className"],"mappings":";;;;;;;;;;;IAKaM,oBAAAA;;;gCAmYAqH;eAAAA;;;uBAvYyD,iBAAiB;4BAE9C,wBAAwB;AAE1D,6BAA8D;IACnEpH,MAAM;IACNC,OAAO;IACPC,iBAAiB;IACjBC,iBAAiB;AACnB,EAAE;AAEF,MAAMC,4BAA4B;IAChCC,cAAc;AAChB;AAEA,MAAMC,eAAe;IACnBC,OAAO;IACPC,QAAQ;AACV;AAEA,MAAMC,uBAAmBhB,sBAAAA,EAAgB;IACvCiB,SAAS;IACTC,qBAAqB,CAAC,QAAQ,CAAC;IAC/BC,kBAAkB;IAClBC,WAAWhB,kBAAAA,CAAOiB,mBAAmB;IACrCC,QAAQ;IACRC,UAAU;IACVC,WAAW;IACXC,eAAe;IAEfC,iBAAiBtB,kBAAAA,CAAOuB,uBAAuB;IAC/CC,WAAWf,aAAaE,MAAM;IAC9Bc,SAAS,CAAC,MAAM,EAAEzB,kBAAAA,CAAO0B,uBAAuB,EAAE;IAClDC,cAAc3B,kBAAAA,CAAO4B,kBAAkB;IAEvC,sDAAsD;IACtD,0DAA0D;IAC1D,yDAAyD;IACzD,2DAA2D;IAC3D,6DAA6D;IAC7D,2DAA2D;IAC3D,6DAA6D;IAC7D,qCAAqC;IACrC,+DAA+D;IAC/D,sEAAsE;IACtE,YAAY;QACVC,SAAS;QACTC,WAAW;QACXX,UAAU;QACVY,KAAK;QACLC,OAAO;QACPC,QAAQ;QACRC,MAAM;QACNC,eAAe;QACfC,QAAQ;QACRC,QAAQ,CAAC,UAAU,EAAErC,k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,qBAAqBE,KAAK,EAC1B8E,qBACAJ,YAAYiD,YAAYjD,QAAQ,EAChC0C,MAAMpH,KAAK,CAAC4H,SAAS;IAGvB,OAAOR;AACT,EAAE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n SpinButton,\n renderSpinButton_unstable,\n spinButtonClassNames,\n useSpinButtonStyles_unstable,\n useSpinButton_unstable,\n} from './SpinButton';\nexport type {\n SpinButtonOnChangeData,\n SpinButtonChangeEvent,\n SpinButtonProps,\n SpinButtonSlots,\n SpinButtonState,\n SpinButtonSpinState,\n SpinButtonBounds,\n} from './SpinButton';\n"],"names":["SpinButton","renderSpinButton_unstable","spinButtonClassNames","useSpinButtonStyles_unstable","useSpinButton_unstable"],"
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n SpinButton,\n renderSpinButton_unstable,\n spinButtonClassNames,\n useSpinButtonStyles_unstable,\n useSpinButton_unstable,\n} from './SpinButton';\nexport type {\n SpinButtonOnChangeData,\n SpinButtonChangeEvent,\n SpinButtonProps,\n SpinButtonSlots,\n SpinButtonState,\n SpinButtonSpinState,\n SpinButtonBounds,\n} from './SpinButton';\n"],"names":["SpinButton","renderSpinButton_unstable","spinButtonClassNames","useSpinButtonStyles_unstable","useSpinButton_unstable"],"mappings":";;;;;;;;;;;;eACEA,sBAAU;;;eACVC,qCAAyB;;;eACzBC,gCAAoB;;;eACpBC,wCAA4B;;;eAC5BC,kCAAsB;;;4BACjB,eAAe"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/clamp.ts"],"sourcesContent":["export const clamp = (value: number, min?: number, max?: number): number => {\n let nextValue = value;\n if (min !== undefined) {\n if (max !== undefined && min > max) {\n const error = new Error();\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(\n [\n `\"min\" value \"${min}\" is greater than \"max\" value \"${max}\".`,\n '\"min\" must be less than or equal to \"max\".',\n `Returning value \"${value}\".`,\n error.stack,\n ].join(),\n );\n }\n return value;\n }\n\n nextValue = Math.max(min, nextValue);\n }\n\n if (max !== undefined) {\n nextValue = Math.min(max, nextValue);\n }\n\n return nextValue;\n};\n"],"names":["clamp","value","min","max","nextValue","undefined","error","Error","process","env","NODE_ENV","console","stack","join","Math"],"
|
1
|
+
{"version":3,"sources":["../src/utils/clamp.ts"],"sourcesContent":["export const clamp = (value: number, min?: number, max?: number): number => {\n let nextValue = value;\n if (min !== undefined) {\n if (max !== undefined && min > max) {\n const error = new Error();\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(\n [\n `\"min\" value \"${min}\" is greater than \"max\" value \"${max}\".`,\n '\"min\" must be less than or equal to \"max\".',\n `Returning value \"${value}\".`,\n error.stack,\n ].join(),\n );\n }\n return value;\n }\n\n nextValue = Math.max(min, nextValue);\n }\n\n if (max !== undefined) {\n nextValue = Math.min(max, nextValue);\n }\n\n return nextValue;\n};\n"],"names":["clamp","value","min","max","nextValue","undefined","error","Error","process","env","NODE_ENV","console","stack","join","Math"],"mappings":";;;;+BAAaA;;;;;;AAAN,cAAc,CAACC,OAAeC,KAAcC;IACjD,IAAIC,YAAYH;IAChB,IAAIC,QAAQG,WAAW;QACrB,IAAIF,QAAQE,aAAaH,MAAMC,KAAK;YAClC,MAAMG,QAAQ,IAAIC;YAClB,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,sCAAsC;gBACtCC,QAAQL,KAAK,CACX;oBACE,CAAC,aAAa,EAAEJ,IAAI,+BAA+B,EAAEC,IAAI,EAAE,CAAC;oBAC5D;oBACA,CAAC,iBAAiB,EAAEF,MAAM,EAAE,CAAC;oBAC7BK,MAAMM,KAAK;iBACZ,CAACC,IAAI;YAEV;YACA,OAAOZ;QACT;QAEAG,YAAYU,KAAKX,GAAG,CAACD,KAAKE;IAC5B;IAEA,IAAID,QAAQE,WAAW;QACrBD,YAAYU,KAAKZ,GAAG,CAACC,KAAKC;IAC5B;IAEA,OAAOA;AACT,EAAE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/getBound.ts"],"sourcesContent":["import type { SpinButtonBounds } from '../SpinButton';\n\nexport const getBound = (value: number, min?: number, max?: number): SpinButtonBounds => {\n if (min !== undefined && value === min) {\n if (max === min) {\n return 'both';\n }\n return 'min';\n } else if (max !== undefined && value === max) {\n return 'max';\n }\n\n return 'none';\n};\n"],"names":["getBound","value","min","max","undefined"],"
|
1
|
+
{"version":3,"sources":["../src/utils/getBound.ts"],"sourcesContent":["import type { SpinButtonBounds } from '../SpinButton';\n\nexport const getBound = (value: number, min?: number, max?: number): SpinButtonBounds => {\n if (min !== undefined && value === min) {\n if (max === min) {\n return 'both';\n }\n return 'min';\n } else if (max !== undefined && value === max) {\n return 'max';\n }\n\n return 'none';\n};\n"],"names":["getBound","value","min","max","undefined"],"mappings":";;;;+BAEaA;;;;;;AAAN,iBAAiB,CAACC,OAAeC,KAAcC;IACpD,IAAID,QAAQE,aAAaH,UAAUC,KAAK;QACtC,IAAIC,QAAQD,KAAK;YACf,OAAO;QACT;QACA,OAAO;IACT,OAAO,IAAIC,QAAQC,aAAaH,UAAUE,KAAK;QAC7C,OAAO;IACT;IAEA,OAAO;AACT,EAAE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { clamp } from './clamp';\nexport { getBound } from './getBound';\nexport { calculatePrecision, precisionRound } from './precision';\n"],"names":["
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { clamp } from './clamp';\nexport { getBound } from './getBound';\nexport { calculatePrecision, precisionRound } from './precision';\n"],"names":["clamp","getBound","calculatePrecision","precisionRound"],"mappings":";;;;;;;;;;;;eAESE,6BAAkB;;;eAFlBF,YAAK;;;eACLC,kBAAQ;;;eACYE,yBAAc;;;uBAFrB,UAAU;0BACP,aAAa;2BACa,cAAc"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/precision.ts"],"sourcesContent":["/**\n * Calculates a number's precision based on the number of trailing\n * zeros if the number does not have a decimal indicated by a negative\n * precision. Otherwise, it calculates the number of digits after\n * the decimal point indicated by a positive precision.\n * @param value - the value to determine the precision of\n */\nexport function calculatePrecision(value: number | string): number {\n /**\n * Group 1:\n * [1-9]([0]+$) matches trailing zeros\n * Group 2:\n * \\.([0-9]*) matches all digits after a decimal point.\n */\n const groups = /[1-9]([0]+$)|\\.([0-9]*)/.exec(String(value));\n if (!groups) {\n return 0;\n }\n if (groups[1]) {\n return -groups[1].length;\n }\n if (groups[2]) {\n return groups[2].length;\n }\n return 0;\n}\n\n/**\n * Rounds a number to a certain level of precision. Accepts negative precision.\n * @param value - The value that is being rounded.\n * @param precision - The number of decimal places to round the number to\n */\nexport function precisionRound(value: number, precision: number, base: number = 10): number {\n const exp = Math.pow(base, precision);\n return Math.round(value * exp) / exp;\n}\n"],"names":["calculatePrecision","
|
1
|
+
{"version":3,"sources":["../src/utils/precision.ts"],"sourcesContent":["/**\n * Calculates a number's precision based on the number of trailing\n * zeros if the number does not have a decimal indicated by a negative\n * precision. Otherwise, it calculates the number of digits after\n * the decimal point indicated by a positive precision.\n * @param value - the value to determine the precision of\n */\nexport function calculatePrecision(value: number | string): number {\n /**\n * Group 1:\n * [1-9]([0]+$) matches trailing zeros\n * Group 2:\n * \\.([0-9]*) matches all digits after a decimal point.\n */\n const groups = /[1-9]([0]+$)|\\.([0-9]*)/.exec(String(value));\n if (!groups) {\n return 0;\n }\n if (groups[1]) {\n return -groups[1].length;\n }\n if (groups[2]) {\n return groups[2].length;\n }\n return 0;\n}\n\n/**\n * Rounds a number to a certain level of precision. Accepts negative precision.\n * @param value - The value that is being rounded.\n * @param precision - The number of decimal places to round the number to\n */\nexport function precisionRound(value: number, precision: number, base: number = 10): number {\n const exp = Math.pow(base, precision);\n return Math.round(value * exp) / exp;\n}\n"],"names":["calculatePrecision","value","groups","exec","String","length","precisionRound","precision","base","exp","Math","pow","round"],"mappings":"AAAA;;;;;;CAMC,GACD;;;;;;;;;;;sBAAgBA;;;kBAyBAM;;;;AAzBT,SAASN,mBAAmBC,KAAsB;IACvD;;;;;GAKC,GACD,MAAMC,SAAS,0BAA0BC,IAAI,CAACC,OAAOH;IACrD,IAAI,CAACC,QAAQ;QACX,OAAO;IACT;IACA,IAAIA,MAAM,CAAC,EAAE,EAAE;QACb,OAAO,CAACA,MAAM,CAAC,EAAE,CAACG,MAAM;IAC1B;IACA,IAAIH,MAAM,CAAC,EAAE,EAAE;QACb,OAAOA,MAAM,CAAC,EAAE,CAACG,MAAM;IACzB;IACA,OAAO;AACT;AAOO,SAASC,eAAeL,KAAa,EAAEM,SAAiB,EAAEC,OAAe,EAAE;IAChF,MAAMC,MAAMC,KAAKC,GAAG,CAACH,MAAMD;IAC3B,OAAOG,KAAKE,KAAK,CAACX,QAAQQ,OAAOA;AACnC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-spinbutton",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.5.1",
|
4
4
|
"description": "Fluent UI React SpinButton component.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -20,12 +20,12 @@
|
|
20
20
|
},
|
21
21
|
"dependencies": {
|
22
22
|
"@fluentui/keyboard-keys": "^9.0.8",
|
23
|
-
"@fluentui/react-field": "^9.
|
23
|
+
"@fluentui/react-field": "^9.4.1",
|
24
24
|
"@fluentui/react-icons": "^2.0.245",
|
25
|
-
"@fluentui/react-jsx-runtime": "^9.1.
|
25
|
+
"@fluentui/react-jsx-runtime": "^9.1.3",
|
26
26
|
"@fluentui/react-shared-contexts": "^9.24.0",
|
27
27
|
"@fluentui/react-theme": "^9.1.24",
|
28
|
-
"@fluentui/react-utilities": "^9.
|
28
|
+
"@fluentui/react-utilities": "^9.23.0",
|
29
29
|
"@griffel/react": "^1.5.22",
|
30
30
|
"@swc/helpers": "^0.5.1"
|
31
31
|
},
|