@fluentui/react-spinbutton 9.0.7 → 9.0.9

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.
Files changed (73) hide show
  1. package/CHANGELOG.json +111 -1
  2. package/CHANGELOG.md +32 -2
  3. package/dist/index.d.ts +9 -0
  4. package/lib/SpinButton.js.map +1 -1
  5. package/lib/SpinButtonField.js +2 -0
  6. package/lib/SpinButtonField.js.map +1 -0
  7. package/lib/components/SpinButton/SpinButton.js.map +1 -1
  8. package/lib/components/SpinButton/SpinButton.types.js.map +1 -1
  9. package/lib/components/SpinButton/index.js.map +1 -1
  10. package/lib/components/SpinButton/renderSpinButton.js.map +1 -1
  11. package/lib/components/SpinButton/useSpinButton.js.map +1 -1
  12. package/lib/components/SpinButton/useSpinButtonStyles.js +10 -43
  13. package/lib/components/SpinButton/useSpinButtonStyles.js.map +1 -1
  14. package/lib/components/SpinButtonField/SpinButtonField.js +14 -0
  15. package/lib/components/SpinButtonField/SpinButtonField.js.map +1 -0
  16. package/lib/components/SpinButtonField/index.js +2 -0
  17. package/lib/components/SpinButtonField/index.js.map +1 -0
  18. package/lib/index.js +1 -0
  19. package/lib/index.js.map +1 -1
  20. package/lib/utils/clamp.js.map +1 -1
  21. package/lib/utils/getBound.js.map +1 -1
  22. package/lib/utils/index.js.map +1 -1
  23. package/lib/utils/precision.js.map +1 -1
  24. package/lib-amd/SpinButton.js +6 -0
  25. package/lib-amd/SpinButton.js.map +1 -0
  26. package/lib-amd/SpinButtonField.js +6 -0
  27. package/lib-amd/SpinButtonField.js.map +1 -0
  28. package/lib-amd/components/SpinButton/SpinButton.js +15 -0
  29. package/lib-amd/components/SpinButton/SpinButton.js.map +1 -0
  30. package/lib-amd/components/SpinButton/SpinButton.types.js +5 -0
  31. package/lib-amd/components/SpinButton/SpinButton.types.js.map +1 -0
  32. package/lib-amd/components/SpinButton/index.js +10 -0
  33. package/lib-amd/components/SpinButton/index.js.map +1 -0
  34. package/lib-amd/components/SpinButton/renderSpinButton.js +36 -0
  35. package/lib-amd/components/SpinButton/renderSpinButton.js.map +1 -0
  36. package/lib-amd/components/SpinButton/useSpinButton.js +252 -0
  37. package/lib-amd/components/SpinButton/useSpinButton.js.map +1 -0
  38. package/lib-amd/components/SpinButton/useSpinButtonStyles.js +312 -0
  39. package/lib-amd/components/SpinButton/useSpinButtonStyles.js.map +1 -0
  40. package/lib-amd/components/SpinButtonField/SpinButtonField.js +13 -0
  41. package/lib-amd/components/SpinButtonField/SpinButtonField.js.map +1 -0
  42. package/lib-amd/components/SpinButtonField/index.js +6 -0
  43. package/lib-amd/components/SpinButtonField/index.js.map +1 -0
  44. package/lib-amd/index.js +13 -0
  45. package/lib-amd/index.js.map +1 -0
  46. package/lib-amd/utils/clamp.js +30 -0
  47. package/lib-amd/utils/clamp.js.map +1 -0
  48. package/lib-amd/utils/getBound.js +19 -0
  49. package/lib-amd/utils/getBound.js.map +1 -0
  50. package/lib-amd/utils/index.js +8 -0
  51. package/lib-amd/utils/index.js.map +1 -0
  52. package/lib-amd/utils/precision.js +44 -0
  53. package/lib-amd/utils/precision.js.map +1 -0
  54. package/lib-commonjs/SpinButton.js.map +1 -1
  55. package/lib-commonjs/SpinButtonField.js +10 -0
  56. package/lib-commonjs/SpinButtonField.js.map +1 -0
  57. package/lib-commonjs/components/SpinButton/SpinButton.js.map +1 -1
  58. package/lib-commonjs/components/SpinButton/index.js.map +1 -1
  59. package/lib-commonjs/components/SpinButton/renderSpinButton.js.map +1 -1
  60. package/lib-commonjs/components/SpinButton/useSpinButton.js.map +1 -1
  61. package/lib-commonjs/components/SpinButton/useSpinButtonStyles.js +10 -43
  62. package/lib-commonjs/components/SpinButton/useSpinButtonStyles.js.map +1 -1
  63. package/lib-commonjs/components/SpinButtonField/SpinButtonField.js +24 -0
  64. package/lib-commonjs/components/SpinButtonField/SpinButtonField.js.map +1 -0
  65. package/lib-commonjs/components/SpinButtonField/index.js +10 -0
  66. package/lib-commonjs/components/SpinButtonField/index.js.map +1 -0
  67. package/lib-commonjs/index.js +16 -1
  68. package/lib-commonjs/index.js.map +1 -1
  69. package/lib-commonjs/utils/clamp.js.map +1 -1
  70. package/lib-commonjs/utils/getBound.js.map +1 -1
  71. package/lib-commonjs/utils/index.js.map +1 -1
  72. package/lib-commonjs/utils/precision.js.map +1 -1
  73. package/package.json +14 -13
@@ -0,0 +1,312 @@
1
+ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme", "@fluentui/react-input"], function (require, exports, tslib_1, react_1, react_theme_1, react_input_1) {
2
+ "use strict";
3
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.useSpinButtonStyles_unstable = exports.spinButtonClassNames = void 0;
6
+ exports.spinButtonClassNames = {
7
+ root: 'fui-SpinButton',
8
+ input: 'fui-SpinButton__input',
9
+ incrementButton: 'fui-SpinButton__incrementButton',
10
+ decrementButton: 'fui-SpinButton__decrementButton',
11
+ };
12
+ var spinButtonExtraClassNames = {
13
+ buttonActive: 'fui-SpinButton__button_active',
14
+ };
15
+ var useRootStyles = react_1.makeStyles({
16
+ base: tslib_1.__assign(tslib_1.__assign({ display: 'inline-grid', gridTemplateColumns: "1fr 24px", gridTemplateRows: '1fr 1fr', columnGap: react_theme_1.tokens.spacingHorizontalXS, rowGap: 0, paddingRight: 0, position: 'relative' }, react_1.shorthands.border('0')), { isolation: 'isolate',
17
+ // Apply border styles on the ::before pseudo element.
18
+ // We cannot use ::after since react-input uses that
19
+ // for the selector styles.
20
+ // Using the pseudo element allows us to place the border
21
+ // above content in the component which ensures the buttons
22
+ // line up visually with the border as expected. Without this
23
+ // there is a bit of a gap which can become very noticeable
24
+ // at high zoom or when OS zoom levels are not divisible by 2
25
+ // (e.g., 150% on Windows in Firefox)
26
+ // This is most noticeable on the "outline" appearance which is
27
+ // also the default so it feels worth the extra ceremony to get right.
28
+ '::before': tslib_1.__assign(tslib_1.__assign({ content: '""', boxSizing: 'border-box', position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 }, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium)), { pointerEvents: 'none', zIndex: 10 }), '::after': {
29
+ right: 0,
30
+ bottom: 0,
31
+ left: 0,
32
+ zIndex: 20,
33
+ } }),
34
+ small: {
35
+ paddingLeft: react_theme_1.tokens.spacingHorizontalS,
36
+ },
37
+ // intentionally empty
38
+ medium: {},
39
+ outline: {
40
+ '::before': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.border('1px', 'solid', react_theme_1.tokens.colorNeutralStroke1)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible }),
41
+ },
42
+ outlineInteractive: {
43
+ ':hover': {
44
+ '::before': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Hover)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessibleHover }),
45
+ },
46
+ // DO NOT add a space between the selectors! It changes the behavior of make-styles.
47
+ ':active,:focus-within': {
48
+ '::before': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Pressed)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessiblePressed }),
49
+ },
50
+ },
51
+ underline: {
52
+ '::before': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderRadius(0)), react_1.shorthands.borderBottom('1px', 'solid', react_theme_1.tokens.colorNeutralStrokeAccessible)),
53
+ },
54
+ underlineInteractive: {
55
+ ':hover': {
56
+ '::before': {
57
+ borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessibleHover,
58
+ },
59
+ },
60
+ // DO NOT add a space between the selectors! It changes the behavior of make-styles.
61
+ ':active,:focus-within': {
62
+ '::before': {
63
+ borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessiblePressed,
64
+ },
65
+ },
66
+ },
67
+ filled: {
68
+ '::before': tslib_1.__assign({}, react_1.shorthands.border('1px', 'solid', react_theme_1.tokens.colorTransparentStroke)),
69
+ },
70
+ filledInteractive: {
71
+ // DO NOT add a space between the selectors! It changes the behavior of make-styles.
72
+ ':hover,:focus-within': {
73
+ '::before': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStrokeInteractive)),
74
+ },
75
+ },
76
+ invalid: {
77
+ ':not(:focus-within),:hover:not(:focus-within)': {
78
+ '::before': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorPaletteRedBorder2)),
79
+ },
80
+ },
81
+ disabled: {
82
+ '::before': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { '@media (forced-colors: active)': tslib_1.__assign({}, react_1.shorthands.borderColor('GrayText')) }),
83
+ },
84
+ });
85
+ var useInputStyles = react_1.makeStyles({
86
+ base: tslib_1.__assign({ gridColumnStart: '1', gridColumnEnd: '2', gridRowStart: '1', gridRowEnd: '3', outlineStyle: 'none' }, react_1.shorthands.padding(0)),
87
+ });
88
+ var useButtonStyles = react_1.makeStyles({
89
+ base: tslib_1.__assign(tslib_1.__assign({ display: 'inline-flex', width: '24px', alignItems: 'center', justifyContent: 'center' }, react_1.shorthands.border(0)), { position: 'absolute', outlineStyle: 'none', height: '100%', ':enabled:hover': {
90
+ cursor: 'pointer',
91
+ }, ':active': {
92
+ outlineStyle: 'none',
93
+ }, ':disabled': {
94
+ cursor: 'not-allowed',
95
+ } }),
96
+ incrementButton: tslib_1.__assign({ gridColumnStart: '2', gridColumnEnd: '3', gridRowStart: '1', gridRowEnd: '2' }, react_1.shorthands.borderRadius(0, react_theme_1.tokens.borderRadiusMedium, 0, 0)),
97
+ // Padding values numbers don't align with design specs
98
+ // but visually the padding aligns.
99
+ // The icons are set in a 16x16px square but the artwork is inset from that
100
+ // so these padding values are computed by hand.
101
+ // Additionally the design uses fractional values so these are
102
+ // rounded to the nearest integer.
103
+ incrementButtonSmall: tslib_1.__assign({}, react_1.shorthands.padding('3px', '6px', '0px', '4px')),
104
+ incrementButtonMedium: tslib_1.__assign({}, react_1.shorthands.padding('4px', '5px', '1px', '5px')),
105
+ decrementButton: tslib_1.__assign({ gridColumnStart: '2', gridColumnEnd: '3', gridRowStart: '2', gridRowEnd: '3' }, react_1.shorthands.borderRadius(0, 0, react_theme_1.tokens.borderRadiusMedium, 0)),
106
+ decrementButtonSmall: tslib_1.__assign({}, react_1.shorthands.padding('0px', '6px', '3px', '4px')),
107
+ decrementButtonMedium: tslib_1.__assign({}, react_1.shorthands.padding('1px', '5px', '4px', '5px')),
108
+ outline: {
109
+ backgroundColor: 'transparent',
110
+ color: react_theme_1.tokens.colorNeutralForeground3,
111
+ ':enabled': (_a = {
112
+ ':hover': {
113
+ color: react_theme_1.tokens.colorNeutralForeground3Hover,
114
+ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundHover,
115
+ },
116
+ ':active': {
117
+ color: react_theme_1.tokens.colorNeutralForeground3Pressed,
118
+ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundPressed,
119
+ }
120
+ },
121
+ _a["&." + spinButtonExtraClassNames.buttonActive] = {
122
+ color: react_theme_1.tokens.colorNeutralForeground3Pressed,
123
+ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundPressed,
124
+ },
125
+ _a),
126
+ ':disabled': {
127
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
128
+ },
129
+ },
130
+ underline: {
131
+ backgroundColor: 'transparent',
132
+ color: react_theme_1.tokens.colorNeutralForeground3,
133
+ ':enabled': (_b = {
134
+ ':hover': {
135
+ color: react_theme_1.tokens.colorNeutralForeground3Hover,
136
+ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundHover,
137
+ },
138
+ ':active': {
139
+ color: react_theme_1.tokens.colorNeutralForeground3Pressed,
140
+ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundPressed,
141
+ }
142
+ },
143
+ _b["&." + spinButtonExtraClassNames.buttonActive] = {
144
+ color: react_theme_1.tokens.colorNeutralForeground3Pressed,
145
+ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundPressed,
146
+ },
147
+ _b),
148
+ ':disabled': {
149
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
150
+ },
151
+ },
152
+ 'filled-darker': {
153
+ backgroundColor: 'transparent',
154
+ color: react_theme_1.tokens.colorNeutralForeground3,
155
+ ':enabled': (_c = {
156
+ ':hover': {
157
+ color: react_theme_1.tokens.colorNeutralForeground3Hover,
158
+ backgroundColor: react_theme_1.tokens.colorNeutralBackground3Hover,
159
+ },
160
+ ':active': {
161
+ color: react_theme_1.tokens.colorNeutralForeground3Pressed,
162
+ backgroundColor: react_theme_1.tokens.colorNeutralBackground3Pressed,
163
+ }
164
+ },
165
+ _c["&." + spinButtonExtraClassNames.buttonActive] = {
166
+ color: react_theme_1.tokens.colorNeutralForeground3Pressed,
167
+ backgroundColor: react_theme_1.tokens.colorNeutralBackground3Pressed,
168
+ },
169
+ _c),
170
+ ':disabled': {
171
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
172
+ },
173
+ },
174
+ 'filled-lighter': {
175
+ backgroundColor: 'transparent',
176
+ color: react_theme_1.tokens.colorNeutralForeground3,
177
+ ':enabled': (_d = {
178
+ ':hover': {
179
+ color: react_theme_1.tokens.colorNeutralForeground3Hover,
180
+ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Hover,
181
+ }
182
+ },
183
+ _d[":active,&." + spinButtonExtraClassNames.buttonActive] = {
184
+ color: react_theme_1.tokens.colorNeutralForeground3Pressed,
185
+ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Pressed,
186
+ },
187
+ _d),
188
+ ':disabled': {
189
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
190
+ },
191
+ },
192
+ });
193
+ // Cannot just disable button as they need to remain
194
+ // exposed to ATs like screen readers.
195
+ var useButtonDisabledStyles = react_1.makeStyles({
196
+ base: {
197
+ cursor: 'not-allowed',
198
+ ':hover': {
199
+ cursor: 'not-allowed',
200
+ },
201
+ },
202
+ outline: {
203
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
204
+ ':enabled': (_e = {
205
+ ':hover': {
206
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
207
+ backgroundColor: 'transparent',
208
+ },
209
+ ':active': {
210
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
211
+ backgroundColor: 'transparent',
212
+ }
213
+ },
214
+ _e["&." + spinButtonExtraClassNames.buttonActive] = {
215
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
216
+ backgroundColor: 'transparent',
217
+ },
218
+ _e),
219
+ },
220
+ underline: {
221
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
222
+ ':enabled': (_f = {
223
+ ':hover': {
224
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
225
+ backgroundColor: 'transparent',
226
+ },
227
+ ':active': {
228
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
229
+ backgroundColor: 'transparent',
230
+ }
231
+ },
232
+ _f["&." + spinButtonExtraClassNames.buttonActive] = {
233
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
234
+ backgroundColor: 'transparent',
235
+ },
236
+ _f),
237
+ },
238
+ 'filled-darker': {
239
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
240
+ ':enabled': (_g = {
241
+ ':hover': {
242
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
243
+ backgroundColor: 'transparent',
244
+ },
245
+ ':active': {
246
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
247
+ backgroundColor: 'transparent',
248
+ }
249
+ },
250
+ _g["&." + spinButtonExtraClassNames.buttonActive] = {
251
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
252
+ backgroundColor: 'transparent',
253
+ },
254
+ _g),
255
+ },
256
+ 'filled-lighter': {
257
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
258
+ ':enabled': (_h = {
259
+ ':hover': {
260
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
261
+ backgroundColor: 'transparent',
262
+ },
263
+ ':active': {
264
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
265
+ backgroundColor: 'transparent',
266
+ }
267
+ },
268
+ _h["&." + spinButtonExtraClassNames.buttonActive] = {
269
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
270
+ backgroundColor: 'transparent',
271
+ },
272
+ _h),
273
+ },
274
+ });
275
+ /**
276
+ * Apply styling to the SpinButton slots based on the state
277
+ */
278
+ var useSpinButtonStyles_unstable = function (state) {
279
+ var appearance = state.appearance, atBound = state.atBound, spinState = state.spinState, size = state.size;
280
+ var disabled = state.input.disabled;
281
+ var invalid = "" + state.input['aria-invalid'] === 'true';
282
+ var filled = appearance.startsWith('filled');
283
+ var rootStyles = useRootStyles();
284
+ var buttonStyles = useButtonStyles();
285
+ var buttonDisabledStyles = useButtonDisabledStyles();
286
+ var inputStyles = useInputStyles();
287
+ // Grab the root className here so we can be sure to merge is last
288
+ var rootClassName = state.root.className;
289
+ state.root.className = undefined;
290
+ // Reuse react-input's styles without re-using the Input component.
291
+ react_input_1.useInputStyles_unstable({
292
+ size: size,
293
+ appearance: appearance,
294
+ input: state.input,
295
+ root: state.root,
296
+ components: {
297
+ root: 'span',
298
+ input: 'input',
299
+ contentBefore: 'span',
300
+ contentAfter: 'span',
301
+ },
302
+ });
303
+ state.root.className = react_1.mergeClasses(state.root.className, // Get the classes from useInputStyles_unstable
304
+ exports.spinButtonClassNames.root, rootStyles.base, rootStyles[size], appearance === 'outline' && rootStyles.outline, appearance === 'underline' && rootStyles.underline, filled && rootStyles.filled, !disabled && appearance === 'outline' && rootStyles.outlineInteractive, !disabled && appearance === 'underline' && rootStyles.underlineInteractive, !disabled && filled && rootStyles.filledInteractive, !disabled && invalid && rootStyles.invalid, disabled && rootStyles.disabled, rootClassName);
305
+ state.incrementButton.className = react_1.mergeClasses(exports.spinButtonClassNames.incrementButton, spinState === 'up' && "" + spinButtonExtraClassNames.buttonActive, buttonStyles.base, buttonStyles.incrementButton, buttonStyles[appearance], size === 'small' ? buttonStyles.incrementButtonSmall : buttonStyles.incrementButtonMedium, (atBound === 'max' || atBound === 'both') && buttonDisabledStyles.base, (atBound === 'max' || atBound === 'both') && buttonDisabledStyles[appearance], state.incrementButton.className);
306
+ state.decrementButton.className = react_1.mergeClasses(exports.spinButtonClassNames.decrementButton, spinState === 'down' && "" + spinButtonExtraClassNames.buttonActive, buttonStyles.base, buttonStyles.decrementButton, buttonStyles[appearance], size === 'small' ? buttonStyles.decrementButtonSmall : buttonStyles.decrementButtonMedium, (atBound === 'min' || atBound === 'both') && buttonDisabledStyles.base, (atBound === 'min' || atBound === 'both') && buttonDisabledStyles[appearance], state.decrementButton.className);
307
+ state.input.className = react_1.mergeClasses(exports.spinButtonClassNames.input, state.input.className, inputStyles.base);
308
+ return state;
309
+ };
310
+ exports.useSpinButtonStyles_unstable = useSpinButtonStyles_unstable;
311
+ });
312
+ //# sourceMappingURL=useSpinButtonStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSpinButtonStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-spinbutton/src/components/SpinButton/useSpinButtonStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,oBAAoB,GAAoC;QACnE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,uBAAuB;QAC9B,eAAe,EAAE,iCAAiC;QAClD,eAAe,EAAE,iCAAiC;KACnD,CAAC;IAEF,IAAM,yBAAyB,GAAG;QAChC,YAAY,EAAE,+BAA+B;KAC9C,CAAC;IAEF,IAAM,aAAa,GAAG,kBAAU,CAAC;QAC/B,IAAI,sCACF,OAAO,EAAE,aAAa,EACtB,mBAAmB,EAAE,UAAU,EAC/B,gBAAgB,EAAE,SAAS,EAC3B,SAAS,EAAE,oBAAM,CAAC,mBAAmB,EACrC,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,EACf,QAAQ,EAAE,UAAU,I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,EACxB,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,CAAC,qBAAqB,EACzF,CAAC,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,MAAM,CAAC,IAAI,oBAAoB,CAAC,IAAI,EACtE,CAAC,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,MAAM,CAAC,IAAI,oBAAoB,CAAC,UAAU,CAAC,EAC7E,KAAK,CAAC,eAAe,CAAC,SAAS,CAChC,CAAC;QAEF,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAAC,4BAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAE1G,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAtEW,QAAA,4BAA4B,gCAsEvC","sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SpinButtonSlots, SpinButtonState } from './SpinButton.types';\nimport { tokens } from '@fluentui/react-theme';\nimport { useInputStyles_unstable } from '@fluentui/react-input';\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 useRootStyles = makeStyles({\n base: {\n display: 'inline-grid',\n gridTemplateColumns: `1fr 24px`,\n gridTemplateRows: '1fr 1fr',\n columnGap: tokens.spacingHorizontalXS,\n rowGap: 0,\n paddingRight: 0,\n position: 'relative',\n // Remove the border styles from react-input\n ...shorthands.border('0'),\n isolation: 'isolate',\n\n // Apply border styles on the ::before pseudo element.\n // We cannot use ::after since react-input uses that\n // for the selector styles.\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 ...shorthands.borderRadius(tokens.borderRadiusMedium),\n pointerEvents: 'none',\n zIndex: 10,\n },\n\n '::after': {\n right: 0,\n bottom: 0,\n left: 0,\n zIndex: 20,\n },\n },\n\n small: {\n paddingLeft: tokens.spacingHorizontalS,\n },\n\n // intentionally empty\n medium: {},\n\n outline: {\n '::before': {\n ...shorthands.border('1px', 'solid', tokens.colorNeutralStroke1),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n },\n\n outlineInteractive: {\n ':hover': {\n '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\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.borderRadius(0), // corners look strange if rounded\n ...shorthands.borderBottom('1px', 'solid', tokens.colorNeutralStrokeAccessible),\n },\n },\n\n underlineInteractive: {\n ':hover': {\n '::before': {\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\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 },\n\n filled: {\n '::before': {\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\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 '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n base: {\n gridColumnStart: '1',\n gridColumnEnd: '2',\n gridRowStart: '1',\n gridRowEnd: '3',\n outlineStyle: 'none',\n ...shorthands.padding(0),\n },\n});\n\nconst useButtonStyles = makeStyles({\n base: {\n display: 'inline-flex',\n width: '24px',\n alignItems: 'center',\n justifyContent: 'center',\n ...shorthands.border(0),\n position: 'absolute',\n\n outlineStyle: 'none',\n height: '100%',\n\n ':enabled:hover': {\n cursor: 'pointer',\n },\n\n ':active': {\n outlineStyle: 'none',\n },\n\n ':disabled': {\n cursor: 'not-allowed',\n },\n },\n\n incrementButton: {\n gridColumnStart: '2',\n gridColumnEnd: '3',\n gridRowStart: '1',\n gridRowEnd: '2',\n ...shorthands.borderRadius(0, tokens.borderRadiusMedium, 0, 0),\n },\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 ...shorthands.padding('3px', '6px', '0px', '4px'),\n },\n\n incrementButtonMedium: {\n ...shorthands.padding('4px', '5px', '1px', '5px'),\n },\n\n decrementButton: {\n gridColumnStart: '2',\n gridColumnEnd: '3',\n gridRowStart: '2',\n gridRowEnd: '3',\n ...shorthands.borderRadius(0, 0, tokens.borderRadiusMedium, 0),\n },\n\n decrementButtonSmall: {\n ...shorthands.padding('0px', '6px', '3px', '4px'),\n },\n\n decrementButtonMedium: {\n ...shorthands.padding('1px', '5px', '4px', '5px'),\n },\n\n outline: {\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\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// Cannot just disable button as they need to remain\n// exposed to ATs like screen readers.\nconst useButtonDisabledStyles = makeStyles({\n base: {\n cursor: 'not-allowed',\n\n ':hover': {\n cursor: 'not-allowed',\n },\n },\n\n outline: {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n underline: {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n 'filled-darker': {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n 'filled-lighter': {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\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 const { appearance, atBound, 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 buttonDisabledStyles = useButtonDisabledStyles();\n const inputStyles = useInputStyles();\n\n // Grab the root className here so we can be sure to merge is last\n const rootClassName = state.root.className;\n state.root.className = undefined;\n // Reuse react-input's styles without re-using the Input component.\n useInputStyles_unstable({\n size,\n appearance,\n input: state.input,\n root: state.root,\n components: {\n root: 'span',\n input: 'input',\n contentBefore: 'span',\n contentAfter: 'span',\n },\n });\n\n state.root.className = mergeClasses(\n state.root.className, // Get the classes from useInputStyles_unstable\n spinButtonClassNames.root,\n rootStyles.base,\n rootStyles[size],\n appearance === 'outline' && rootStyles.outline,\n appearance === 'underline' && rootStyles.underline,\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 rootClassName, // Make sure any original class name is applied last\n );\n\n state.incrementButton.className = mergeClasses(\n spinButtonClassNames.incrementButton,\n spinState === 'up' && `${spinButtonExtraClassNames.buttonActive}`,\n buttonStyles.base,\n buttonStyles.incrementButton,\n buttonStyles[appearance],\n size === 'small' ? buttonStyles.incrementButtonSmall : buttonStyles.incrementButtonMedium,\n (atBound === 'max' || atBound === 'both') && buttonDisabledStyles.base,\n (atBound === 'max' || atBound === 'both') && buttonDisabledStyles[appearance],\n state.incrementButton.className,\n );\n state.decrementButton.className = mergeClasses(\n spinButtonClassNames.decrementButton,\n spinState === 'down' && `${spinButtonExtraClassNames.buttonActive}`,\n buttonStyles.base,\n buttonStyles.decrementButton,\n buttonStyles[appearance],\n size === 'small' ? buttonStyles.decrementButtonSmall : buttonStyles.decrementButtonMedium,\n (atBound === 'min' || atBound === 'both') && buttonDisabledStyles.base,\n (atBound === 'min' || atBound === 'both') && buttonDisabledStyles[appearance],\n state.decrementButton.className,\n );\n\n state.input.className = mergeClasses(spinButtonClassNames.input, state.input.className, inputStyles.base);\n\n return state;\n};\n"]}
@@ -0,0 +1,13 @@
1
+ define(["require", "exports", "react", "@fluentui/react-field", "../../SpinButton"], function (require, exports, React, react_field_1, SpinButton_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SpinButtonField = exports.spinButtonFieldClassNames = void 0;
5
+ exports.spinButtonFieldClassNames = react_field_1.getFieldClassNames('SpinButtonField');
6
+ exports.SpinButtonField = React.forwardRef(function (props, ref) {
7
+ var state = react_field_1.useField_unstable(props, ref, { component: SpinButton_1.SpinButton, classNames: exports.spinButtonFieldClassNames });
8
+ react_field_1.useFieldStyles_unstable(state);
9
+ return react_field_1.renderField_unstable(state);
10
+ });
11
+ exports.SpinButtonField.displayName = 'SpinButtonField';
12
+ });
13
+ //# sourceMappingURL=SpinButtonField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpinButtonField.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-spinbutton/src/components/SpinButtonField/SpinButtonField.tsx"],"names":[],"mappings":";;;;IAaa,QAAA,yBAAyB,GAAG,gCAAkB,CAAC,iBAAiB,CAAC,CAAC;IAElE,QAAA,eAAe,GAA8C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QACpG,IAAM,KAAK,GAAG,+BAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,uBAAU,EAAE,UAAU,EAAE,iCAAyB,EAAE,CAAC,CAAC;QAC9G,qCAAuB,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,kCAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,uBAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import * as React from 'react';\nimport type { FieldProps } from '@fluentui/react-field';\nimport {\n getFieldClassNames,\n renderField_unstable,\n useFieldStyles_unstable,\n useField_unstable,\n} from '@fluentui/react-field';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { SpinButton } from '../../SpinButton';\n\nexport type SpinButtonFieldProps = FieldProps<typeof SpinButton>;\n\nexport const spinButtonFieldClassNames = getFieldClassNames('SpinButtonField');\n\nexport const SpinButtonField: ForwardRefComponent<SpinButtonFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, { component: SpinButton, classNames: spinButtonFieldClassNames });\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nSpinButtonField.displayName = 'SpinButtonField';\n"]}
@@ -0,0 +1,6 @@
1
+ define(["require", "exports", "tslib", "./SpinButtonField"], function (require, exports, tslib_1, SpinButtonField_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(SpinButtonField_1, exports);
5
+ });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-spinbutton/src/components/SpinButtonField/index.ts"],"names":[],"mappings":";;;IAAA,iDAAkC","sourcesContent":["export * from './SpinButtonField';\n"]}
@@ -0,0 +1,13 @@
1
+ define(["require", "exports", "./SpinButton", "./SpinButtonField"], function (require, exports, SpinButton_1, SpinButtonField_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.spinButtonFieldClassNames = exports.SpinButtonField_unstable = exports.useSpinButton_unstable = exports.useSpinButtonStyles_unstable = exports.spinButtonClassNames = exports.renderSpinButton_unstable = exports.SpinButton = void 0;
5
+ Object.defineProperty(exports, "SpinButton", { enumerable: true, get: function () { return SpinButton_1.SpinButton; } });
6
+ Object.defineProperty(exports, "renderSpinButton_unstable", { enumerable: true, get: function () { return SpinButton_1.renderSpinButton_unstable; } });
7
+ Object.defineProperty(exports, "spinButtonClassNames", { enumerable: true, get: function () { return SpinButton_1.spinButtonClassNames; } });
8
+ Object.defineProperty(exports, "useSpinButtonStyles_unstable", { enumerable: true, get: function () { return SpinButton_1.useSpinButtonStyles_unstable; } });
9
+ Object.defineProperty(exports, "useSpinButton_unstable", { enumerable: true, get: function () { return SpinButton_1.useSpinButton_unstable; } });
10
+ Object.defineProperty(exports, "SpinButtonField_unstable", { enumerable: true, get: function () { return SpinButtonField_1.SpinButtonField; } });
11
+ Object.defineProperty(exports, "spinButtonFieldClassNames", { enumerable: true, get: function () { return SpinButtonField_1.spinButtonFieldClassNames; } });
12
+ });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-spinbutton/src/index.ts"],"names":[],"mappings":";;;;IACE,wGAAA,UAAU,OAAA;IACV,uHAAA,yBAAyB,OAAA;IACzB,kHAAA,oBAAoB,OAAA;IACpB,0HAAA,4BAA4B,OAAA;IAC5B,oHAAA,sBAAsB,OAAA;IAYf,2HAAA,eAAe,OAA4B;IAAE,4HAAA,yBAAyB,OAAA","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\nexport { SpinButtonField as SpinButtonField_unstable, spinButtonFieldClassNames } from './SpinButtonField';\nexport type { SpinButtonFieldProps as SpinButtonFieldProps_unstable } from './SpinButtonField';\n"]}
@@ -0,0 +1,30 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clamp = void 0;
5
+ var clamp = function (value, min, max) {
6
+ var nextValue = value;
7
+ if (min !== undefined) {
8
+ if (max !== undefined && min > max) {
9
+ var error = new Error();
10
+ if (process.env.NODE_ENV !== 'production') {
11
+ // eslint-disable-next-line no-console
12
+ console.error([
13
+ "\"min\" value \"" + min + "\" is greater than \"max\" value \"" + max + "\".",
14
+ '"min" must be less than or equal to "max".',
15
+ "Returning value \"" + value + "\".",
16
+ error.stack,
17
+ ].join());
18
+ }
19
+ return value;
20
+ }
21
+ nextValue = Math.max(min, nextValue);
22
+ }
23
+ if (max !== undefined) {
24
+ nextValue = Math.min(max, nextValue);
25
+ }
26
+ return nextValue;
27
+ };
28
+ exports.clamp = clamp;
29
+ });
30
+ //# sourceMappingURL=clamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-spinbutton/src/utils/clamp.ts"],"names":[],"mappings":";;;;IAAO,IAAM,KAAK,GAAG,UAAC,KAAa,EAAE,GAAY,EAAE,GAAY;QAC7D,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,GAAG,EAAE;gBAClC,IAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;gBAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;oBACzC,sCAAsC;oBACtC,OAAO,CAAC,KAAK,CACX;wBACE,qBAAgB,GAAG,2CAAkC,GAAG,QAAI;wBAC5D,4CAA4C;wBAC5C,uBAAoB,KAAK,QAAI;wBAC7B,KAAK,CAAC,KAAK;qBACZ,CAAC,IAAI,EAAE,CACT,CAAC;iBACH;gBACD,OAAO,KAAK,CAAC;aACd;YAED,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;SACtC;QAED,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;SACtC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IA3BW,QAAA,KAAK,SA2BhB","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"]}
@@ -0,0 +1,19 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getBound = void 0;
5
+ var getBound = function (value, min, max) {
6
+ if (min !== undefined && value === min) {
7
+ if (max === min) {
8
+ return 'both';
9
+ }
10
+ return 'min';
11
+ }
12
+ else if (max !== undefined && value === max) {
13
+ return 'max';
14
+ }
15
+ return 'none';
16
+ };
17
+ exports.getBound = getBound;
18
+ });
19
+ //# sourceMappingURL=getBound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBound.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-spinbutton/src/utils/getBound.ts"],"names":[],"mappings":";;;;IAEO,IAAM,QAAQ,GAAG,UAAC,KAAa,EAAE,GAAY,EAAE,GAAY;QAChE,IAAI,GAAG,KAAK,SAAS,IAAI,KAAK,KAAK,GAAG,EAAE;YACtC,IAAI,GAAG,KAAK,GAAG,EAAE;gBACf,OAAO,MAAM,CAAC;aACf;YACD,OAAO,KAAK,CAAC;SACd;aAAM,IAAI,GAAG,KAAK,SAAS,IAAI,KAAK,KAAK,GAAG,EAAE;YAC7C,OAAO,KAAK,CAAC;SACd;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAXW,QAAA,QAAQ,YAWnB","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"]}
@@ -0,0 +1,8 @@
1
+ define(["require", "exports", "tslib", "./clamp", "./getBound", "./precision"], function (require, exports, tslib_1, clamp_1, getBound_1, precision_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(clamp_1, exports);
5
+ tslib_1.__exportStar(getBound_1, exports);
6
+ tslib_1.__exportStar(precision_1, exports);
7
+ });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-spinbutton/src/utils/index.ts"],"names":[],"mappings":";;;IAAA,uCAAwB;IACxB,0CAA2B;IAC3B,2CAA4B","sourcesContent":["export * from './clamp';\nexport * from './getBound';\nexport * from './precision';\n"]}
@@ -0,0 +1,44 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.precisionRound = exports.calculatePrecision = void 0;
5
+ /**
6
+ * Calculates a number's precision based on the number of trailing
7
+ * zeros if the number does not have a decimal indicated by a negative
8
+ * precision. Otherwise, it calculates the number of digits after
9
+ * the decimal point indicated by a positive precision.
10
+ * @param value - the value to determine the precision of
11
+ */
12
+ function calculatePrecision(value) {
13
+ /**
14
+ * Group 1:
15
+ * [1-9]([0]+$) matches trailing zeros
16
+ * Group 2:
17
+ * \.([0-9]*) matches all digits after a decimal point.
18
+ */
19
+ var groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value));
20
+ if (!groups) {
21
+ return 0;
22
+ }
23
+ if (groups[1]) {
24
+ return -groups[1].length;
25
+ }
26
+ if (groups[2]) {
27
+ return groups[2].length;
28
+ }
29
+ return 0;
30
+ }
31
+ exports.calculatePrecision = calculatePrecision;
32
+ /**
33
+ * Rounds a number to a certain level of precision. Accepts negative precision.
34
+ * @param value - The value that is being rounded.
35
+ * @param precision - The number of decimal places to round the number to
36
+ */
37
+ function precisionRound(value, precision, base) {
38
+ if (base === void 0) { base = 10; }
39
+ var exp = Math.pow(base, precision);
40
+ return Math.round(value * exp) / exp;
41
+ }
42
+ exports.precisionRound = precisionRound;
43
+ });
44
+ //# sourceMappingURL=precision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precision.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-spinbutton/src/utils/precision.ts"],"names":[],"mappings":";;;;IAAA;;;;;;OAMG;IACH,SAAgB,kBAAkB,CAAC,KAAsB;QACvD;;;;;WAKG;QACH,IAAM,MAAM,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,CAAC,CAAC;SACV;QACD,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;SAC1B;QACD,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;SACzB;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAlBD,gDAkBC;IAED;;;;OAIG;IACH,SAAgB,cAAc,CAAC,KAAa,EAAE,SAAiB,EAAE,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAChF,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IACvC,CAAC;IAHD,wCAGC","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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["SpinButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/SpinButton/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-spinbutton/src/SpinButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/SpinButton/index';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/SpinButtonField/index"), exports);
10
+ //# sourceMappingURL=SpinButtonField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["packages/react-components/react-spinbutton/src/SpinButtonField.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/SpinButtonField/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/SpinButton/SpinButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AACA,MAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,UAAA,gBAAmD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAC9F,MAAM,KAAK,GAAG,eAAA,CAAA,sBAAA,CAAuB,KAAvB,EAA8B,GAA9B,CAAd;EAEA,qBAAA,CAAA,4BAAA,CAA6B,KAA7B;EACA,OAAO,kBAAA,CAAA,yBAAA,CAA0B,KAA1B,CAAP;AACD,CAL+D,CAAnD;AAOb,OAAA,CAAA,UAAA,CAAW,WAAX,GAAyB,YAAzB","sourcesContent":["import * as React from 'react';\nimport { useSpinButton_unstable } from './useSpinButton';\nimport { renderSpinButton_unstable } from './renderSpinButton';\nimport { useSpinButtonStyles_unstable } from './useSpinButtonStyles';\nimport type { SpinButtonProps } from './SpinButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * A SpinButton allows someone to incrementally adjust a value in small steps.\n */\nexport const SpinButton: ForwardRefComponent<SpinButtonProps> = React.forwardRef((props, ref) => {\n const state = useSpinButton_unstable(props, ref);\n\n useSpinButtonStyles_unstable(state);\n return renderSpinButton_unstable(state);\n});\n\nSpinButton.displayName = 'SpinButton';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-spinbutton/src/components/SpinButton/SpinButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AACA,MAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,UAAA,gBAAmD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAC9F,MAAM,KAAK,GAAG,eAAA,CAAA,sBAAA,CAAuB,KAAvB,EAA8B,GAA9B,CAAd;EAEA,qBAAA,CAAA,4BAAA,CAA6B,KAA7B;EACA,OAAO,kBAAA,CAAA,yBAAA,CAA0B,KAA1B,CAAP;AACD,CAL+D,CAAnD;AAOb,OAAA,CAAA,UAAA,CAAW,WAAX,GAAyB,YAAzB","sourcesContent":["import * as React from 'react';\nimport { useSpinButton_unstable } from './useSpinButton';\nimport { renderSpinButton_unstable } from './renderSpinButton';\nimport { useSpinButtonStyles_unstable } from './useSpinButtonStyles';\nimport type { SpinButtonProps } from './SpinButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * A SpinButton allows someone to incrementally adjust a value in small steps.\n */\nexport const SpinButton: ForwardRefComponent<SpinButtonProps> = React.forwardRef((props, ref) => {\n const state = useSpinButton_unstable(props, ref);\n\n useSpinButtonStyles_unstable(state);\n return renderSpinButton_unstable(state);\n});\n\nSpinButton.displayName = 'SpinButton';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/SpinButton/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './SpinButton';\nexport * from './SpinButton.types';\nexport * from './renderSpinButton';\nexport * from './useSpinButton';\nexport * from './useSpinButtonStyles';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-spinbutton/src/components/SpinButton/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './SpinButton';\nexport * from './SpinButton.types';\nexport * from './renderSpinButton';\nexport * from './useSpinButton';\nexport * from './useSpinButtonStyles';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/SpinButton/renderSpinButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,yBAAyB,GAAI,KAAD,IAA2B;EAClE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAA0B,KAA1B,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CADF,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,eAAP,EAAsB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAtB,CAFF,EAGE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,eAAP,EAAsB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAtB,CAHF,CADF;AAOD,CAhCM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SpinButtonState, SpinButtonSlots } from './SpinButton.types';\n\n/**\n * Render the final JSX of SpinButton\n */\nexport const renderSpinButton_unstable = (state: SpinButtonState) => {\n // Leaving this here for now.\n // This is the approach using react-input's Input component.\n // It has some Typescript problems and feels hacky.\n // const { slots, slotProps } = getSlots<SpinButtonSlots>(state);\n\n // const { contentAfter, ...otherInputSlotProps } = slotProps.input as SpinButtonSlots['input'];\n // const inputContentAfter = {\n // ...contentAfter,\n // children: (\n // <>\n // <slots.incrementButton {...slotProps.incrementButton} />\n // <slots.decrementButton {...slotProps.decrementButton} />\n // </>\n // ),\n // };\n\n // return (\n // <slots.root {...slotProps.root}>\n // <slots.input {...otherInputSlotProps} contentAfter={inputContentAfter}/>\n // </slots.root>\n // );\n\n const { slots, slotProps } = getSlots<SpinButtonSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n <slots.incrementButton {...slotProps.incrementButton} />\n <slots.decrementButton {...slotProps.decrementButton} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-spinbutton/src/components/SpinButton/renderSpinButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,yBAAyB,GAAI,KAAD,IAA2B;EAClE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAA0B,KAA1B,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CADF,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,eAAP,EAAsB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAtB,CAFF,EAGE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,eAAP,EAAsB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAtB,CAHF,CADF;AAOD,CAhCM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SpinButtonState, SpinButtonSlots } from './SpinButton.types';\n\n/**\n * Render the final JSX of SpinButton\n */\nexport const renderSpinButton_unstable = (state: SpinButtonState) => {\n // Leaving this here for now.\n // This is the approach using react-input's Input component.\n // It has some Typescript problems and feels hacky.\n // const { slots, slotProps } = getSlots<SpinButtonSlots>(state);\n\n // const { contentAfter, ...otherInputSlotProps } = slotProps.input as SpinButtonSlots['input'];\n // const inputContentAfter = {\n // ...contentAfter,\n // children: (\n // <>\n // <slots.incrementButton {...slotProps.incrementButton} />\n // <slots.decrementButton {...slotProps.decrementButton} />\n // </>\n // ),\n // };\n\n // return (\n // <slots.root {...slotProps.root}>\n // <slots.input {...otherInputSlotProps} contentAfter={inputContentAfter}/>\n // </slots.root>\n // );\n\n const { slots, slotProps } = getSlots<SpinButtonSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n <slots.incrementButton {...slotProps.incrementButton} />\n <slots.decrementButton {...slotProps.decrementButton} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}