@wix/site-ui 1.30.0 → 1.31.0

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 (173) hide show
  1. package/dist/1268.js +99 -0
  2. package/dist/1279.js +7 -0
  3. package/dist/1457.js +10 -0
  4. package/dist/1477.js +106 -0
  5. package/dist/1500.js +111 -0
  6. package/dist/167.js +6 -0
  7. package/dist/2274.js +34 -0
  8. package/dist/2287.js +17 -0
  9. package/dist/2418.js +31 -0
  10. package/dist/2801.js +20 -0
  11. package/dist/285.js +86 -0
  12. package/dist/2861.js +6 -0
  13. package/dist/3020.js +7 -0
  14. package/dist/3021.js +72 -0
  15. package/dist/3056.js +229 -0
  16. package/dist/3140.js +4 -0
  17. package/dist/3248.js +307 -0
  18. package/dist/3296.js +4 -0
  19. package/dist/3319.js +400 -0
  20. package/dist/3395.js +4 -0
  21. package/dist/3485.js +854 -0
  22. package/dist/353.js +14 -0
  23. package/dist/3670.js +418 -0
  24. package/dist/3829.js +113 -0
  25. package/dist/4026.js +12 -0
  26. package/dist/4143.js +46 -0
  27. package/dist/42.js +32 -0
  28. package/dist/4281.js +30 -0
  29. package/dist/4346.js +2 -0
  30. package/dist/4388.js +418 -0
  31. package/dist/4490.js +32 -0
  32. package/dist/4495.js +9 -0
  33. package/dist/4549.js +24 -0
  34. package/dist/4586.js +41 -0
  35. package/dist/4586.js.LICENSE.txt +19 -0
  36. package/dist/4707.js +19 -0
  37. package/dist/4723.js +7 -0
  38. package/dist/4745.js +7 -0
  39. package/dist/4768.js +35 -0
  40. package/dist/4922.js +15 -0
  41. package/dist/5036.js +17 -0
  42. package/dist/5085.js +20 -0
  43. package/dist/5299.js +597 -0
  44. package/dist/5659.js +4 -0
  45. package/dist/5778.js +10 -0
  46. package/dist/5864.js +86 -0
  47. package/dist/5992.js +913 -0
  48. package/dist/5992.js.LICENSE.txt +19 -0
  49. package/dist/6003.js +10 -0
  50. package/dist/6046.js +29 -0
  51. package/dist/6089.js +2355 -0
  52. package/dist/6107.js +10 -0
  53. package/dist/6247.js +20 -0
  54. package/dist/6270.js +487 -0
  55. package/dist/6329.js +32 -0
  56. package/dist/6330.js +30 -0
  57. package/dist/6499.js +7 -0
  58. package/dist/6535.js +71 -0
  59. package/dist/6588.js +382 -0
  60. package/dist/6706.js +16 -0
  61. package/dist/6825.js +7 -0
  62. package/dist/6882.js +1562 -0
  63. package/dist/6914.js +30 -0
  64. package/dist/7021.js +13 -0
  65. package/dist/7366.js +83 -0
  66. package/dist/7373.js +25 -0
  67. package/dist/7541.js +25 -0
  68. package/dist/7564.js +10 -0
  69. package/dist/7642.js +20 -0
  70. package/dist/7725.js +10 -0
  71. package/dist/7871.js +38 -0
  72. package/dist/8052.js +352 -0
  73. package/dist/8106.js +238 -0
  74. package/dist/8171.js +346 -0
  75. package/dist/8225.js +21 -0
  76. package/dist/8272.js +333 -0
  77. package/dist/8527.js +58 -0
  78. package/dist/8724.js +10 -0
  79. package/dist/8750.js +1920 -0
  80. package/dist/8758.js +43 -0
  81. package/dist/880.js +149 -0
  82. package/dist/8935.js +8 -0
  83. package/dist/8960.js +22 -0
  84. package/dist/8971.js +40 -0
  85. package/dist/8979.js +10 -0
  86. package/dist/8996.js +71 -0
  87. package/dist/904.js +121 -0
  88. package/dist/9048.js +52 -0
  89. package/dist/9087.js +256 -0
  90. package/dist/9189.js +158 -0
  91. package/dist/9255.js +136 -0
  92. package/dist/9352.js +148 -0
  93. package/dist/951.js +22 -0
  94. package/dist/9635.js +22 -0
  95. package/dist/9829.js +4 -0
  96. package/dist/9863.js +8 -0
  97. package/dist/Accordion/index.d.ts +569 -12
  98. package/dist/Accordion/index.js +423 -8
  99. package/dist/AlertDialog/index.d.ts +1417 -18
  100. package/dist/AlertDialog/index.js +34 -14
  101. package/dist/Autocomplete/index.d.ts +1861 -38
  102. package/dist/Autocomplete/index.js +98 -24
  103. package/dist/Avatar/index.d.ts +129 -7
  104. package/dist/Avatar/index.js +149 -6
  105. package/dist/Breadcrumbs/index.d.ts +960 -7
  106. package/dist/Breadcrumbs/index.js +5 -5
  107. package/dist/Button/index.d.ts +88 -6
  108. package/dist/Button/index.js +27 -3
  109. package/dist/Checkbox/index.d.ts +425 -5
  110. package/dist/Checkbox/index.js +45 -5
  111. package/dist/CheckboxGroup/index.d.ts +318 -3
  112. package/dist/CheckboxGroup/index.js +166 -3
  113. package/dist/Collapsible/index.d.ts +377 -7
  114. package/dist/Collapsible/index.js +160 -6
  115. package/dist/Combobox/index.d.ts +1984 -48
  116. package/dist/Combobox/index.js +352 -29
  117. package/dist/ContextMenu/index.d.ts +2340 -36
  118. package/dist/ContextMenu/index.js +197 -22
  119. package/dist/Dialog/index.d.ts +1355 -18
  120. package/dist/Dialog/index.js +16 -14
  121. package/dist/Drawer/index.d.ts +1653 -18
  122. package/dist/Drawer/index.js +2797 -20
  123. package/dist/Field/index.d.ts +655 -15
  124. package/dist/Field/index.js +677 -10
  125. package/dist/Fieldset/index.d.ts +94 -5
  126. package/dist/Fieldset/index.js +68 -5
  127. package/dist/Form/index.d.ts +331 -2
  128. package/dist/Form/index.js +106 -3
  129. package/dist/Input/index.d.ts +692 -3
  130. package/dist/Input/index.js +10 -3
  131. package/dist/Menu/index.d.ts +2301 -36
  132. package/dist/Menu/index.js +365 -26
  133. package/dist/Menubar/index.d.ts +2301 -3
  134. package/dist/Menubar/index.js +105 -3
  135. package/dist/Meter/index.d.ts +175 -11
  136. package/dist/Meter/index.js +129 -9
  137. package/dist/NavigationMenu/index.d.ts +978 -28
  138. package/dist/NavigationMenu/index.js +1034 -17
  139. package/dist/NumberField/index.d.ts +612 -15
  140. package/dist/NumberField/index.js +1409 -11
  141. package/dist/Popover/index.d.ts +1655 -20
  142. package/dist/Popover/index.js +792 -17
  143. package/dist/PreviewCard/index.d.ts +1523 -14
  144. package/dist/PreviewCard/index.js +679 -14
  145. package/dist/Progress/index.d.ts +183 -11
  146. package/dist/Progress/index.js +181 -9
  147. package/dist/Radio/index.d.ts +185 -6
  148. package/dist/Radio/index.js +253 -6
  149. package/dist/RadioGroup/index.d.ts +341 -2
  150. package/dist/RadioGroup/index.js +154 -3
  151. package/dist/ScrollArea/index.d.ts +265 -13
  152. package/dist/ScrollArea/index.js +892 -10
  153. package/dist/Select/index.d.ts +1493 -38
  154. package/dist/Select/index.js +1824 -23
  155. package/dist/Separator/index.d.ts +80 -6
  156. package/dist/Separator/index.js +3 -3
  157. package/dist/Slider/index.d.ts +678 -16
  158. package/dist/Slider/index.js +1199 -11
  159. package/dist/Switch/index.d.ts +393 -5
  160. package/dist/Switch/index.js +208 -6
  161. package/dist/Tabs/index.d.ts +523 -12
  162. package/dist/Tabs/index.js +685 -9
  163. package/dist/Toggle/index.d.ts +305 -2
  164. package/dist/Toggle/index.js +76 -3
  165. package/dist/ToggleGroup/index.d.ts +316 -2
  166. package/dist/ToggleGroup/index.js +102 -3
  167. package/dist/Toolbar/index.d.ts +282 -13
  168. package/dist/Toolbar/index.js +230 -9
  169. package/dist/Tooltip/index.d.ts +1572 -14
  170. package/dist/Tooltip/index.js +965 -14
  171. package/dist/index.d.ts +12749 -652
  172. package/dist/rslib-runtime.js +18 -0
  173. package/package.json +3 -3
@@ -1,7 +1,1405 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { NumberField } from "@base-ui/react/number-field";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
3
2
  import clsx from "clsx";
3
+ import { useRefWithInit, useMergedRefs, useRenderElement, esm_formatErrorMessage } from "../8272.js";
4
+ import { useLabelableContext, fieldValidityMapping, useFieldRootContext } from "../1477.js";
5
+ import { formatNumber, formatNumberMaxPrecision, getFormatter } from "../6914.js";
6
+ import { clamp } from "../3296.js";
7
+ import { useLabelableId } from "../9048.js";
8
+ import { useControlled } from "../8527.js";
9
+ import { useValueAsRef } from "../4707.js";
10
+ import { useIsoLayoutEffect } from "../6499.js";
11
+ import { useForcedRerendering } from "../8935.js";
12
+ import { useStableCallback } from "../7541.js";
13
+ import { inputPaste, inputBlur, inputChange, inputClear, keyboard, incrementPress, decrementPress } from "../2418.js";
14
+ import { createGenericEventDetails, createChangeEventDetails } from "../4768.js";
15
+ import { isFirefox, isIOS, isWebKit } from "../8971.js";
16
+ import { getTarget, activeElement } from "../4549.js";
17
+ import { ownerDocument } from "../9829.js";
18
+ import { addEventListener } from "../4723.js";
19
+ import { visuallyHiddenInput, visuallyHidden } from "../8225.js";
20
+ import { Timeout, useTimeout } from "../42.js";
21
+ import { useOnMount } from "../2861.js";
22
+ import { getWindow } from "../3829.js";
23
+ import { useButton } from "../9189.js";
24
+ import { useFormContext } from "../5085.js";
25
+ import { useRegisterFieldControl } from "../4281.js";
26
+ import { useValueChanged } from "../2801.js";
27
+ import { stopEvent } from "../6330.js";
28
+ import { mergeCleanups } from "../4495.js";
4
29
  import * as __rspack_external_react from "react";
30
+ import * as __rspack_external_react_dom_7136dc57 from "react-dom";
31
+ const NumberFieldRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
32
+ if ("production" !== process.env.NODE_ENV) NumberFieldRootContext.displayName = "NumberFieldRootContext";
33
+ function useNumberFieldRootContext() {
34
+ const context = __rspack_external_react.useContext(NumberFieldRootContext);
35
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: NumberFieldRootContext is missing. NumberField parts must be placed within <NumberField.Root>.' : esm_formatErrorMessage(43));
36
+ return context;
37
+ }
38
+ const stateAttributesMapping = {
39
+ inputValue: ()=>null,
40
+ value: ()=>null,
41
+ ...fieldValidityMapping
42
+ };
43
+ const HAN_NUMERALS = [
44
+ '零',
45
+ '〇',
46
+ '一',
47
+ '二',
48
+ '三',
49
+ '四',
50
+ '五',
51
+ '六',
52
+ '七',
53
+ '八',
54
+ '九'
55
+ ];
56
+ const HAN_NUMERAL_TO_DIGIT = {
57
+ 零: '0',
58
+ 〇: '0',
59
+ 一: '1',
60
+ 二: '2',
61
+ 三: '3',
62
+ 四: '4',
63
+ 五: '5',
64
+ 六: '6',
65
+ 七: '7',
66
+ 八: '8',
67
+ 九: '9'
68
+ };
69
+ const ARABIC_NUMERALS = [
70
+ '٠',
71
+ '١',
72
+ '٢',
73
+ '٣',
74
+ '٤',
75
+ '٥',
76
+ '٦',
77
+ '٧',
78
+ '٨',
79
+ '٩'
80
+ ];
81
+ const PERSIAN_NUMERALS = [
82
+ '۰',
83
+ '۱',
84
+ '۲',
85
+ '۳',
86
+ '۴',
87
+ '۵',
88
+ '۶',
89
+ '۷',
90
+ '۸',
91
+ '۹'
92
+ ];
93
+ const FULLWIDTH_NUMERALS = [
94
+ '0',
95
+ '1',
96
+ '2',
97
+ '3',
98
+ '4',
99
+ '5',
100
+ '6',
101
+ '7',
102
+ '8',
103
+ '9'
104
+ ];
105
+ const PERCENTAGES = [
106
+ '%',
107
+ '٪',
108
+ '%',
109
+ '﹪'
110
+ ];
111
+ const PERMILLE = [
112
+ '‰',
113
+ '؉'
114
+ ];
115
+ const UNICODE_MINUS_SIGNS = [
116
+ '−',
117
+ '-',
118
+ '‒',
119
+ '–',
120
+ '—',
121
+ '﹣'
122
+ ];
123
+ const UNICODE_PLUS_SIGNS = [
124
+ '+',
125
+ '﹢'
126
+ ];
127
+ const FULLWIDTH_DECIMAL = '.';
128
+ const FULLWIDTH_GROUP = ',';
129
+ const ARABIC_RE = new RegExp(`[${ARABIC_NUMERALS.join('')}]`, 'g');
130
+ const PERSIAN_RE = new RegExp(`[${PERSIAN_NUMERALS.join('')}]`, 'g');
131
+ const FULLWIDTH_RE = new RegExp(`[${FULLWIDTH_NUMERALS.join('')}]`, 'g');
132
+ const HAN_RE = new RegExp(`[${HAN_NUMERALS.join('')}]`, 'g');
133
+ const PERCENT_RE = new RegExp(`[${PERCENTAGES.join('')}]`);
134
+ const PERMILLE_RE = new RegExp(`[${PERMILLE.join('')}]`);
135
+ const ARABIC_DETECT_RE = /[٠١٢٣٤٥٦٧٨٩]/;
136
+ const PERSIAN_DETECT_RE = /[۰۱۲۳۴۵۶۷۸۹]/;
137
+ const HAN_DETECT_RE = /[零〇一二三四五六七八九]/;
138
+ const FULLWIDTH_DETECT_RE = new RegExp(`[${FULLWIDTH_NUMERALS.join('')}]`);
139
+ const BASE_NON_NUMERIC_SYMBOLS = [
140
+ '.',
141
+ ',',
142
+ FULLWIDTH_DECIMAL,
143
+ FULLWIDTH_GROUP,
144
+ '٫',
145
+ '٬'
146
+ ];
147
+ const SPACE_SEPARATOR_RE = /\p{Zs}/u;
148
+ const PLUS_SIGNS_WITH_ASCII = [
149
+ '+',
150
+ ...UNICODE_PLUS_SIGNS
151
+ ];
152
+ const MINUS_SIGNS_WITH_ASCII = [
153
+ '-',
154
+ ...UNICODE_MINUS_SIGNS
155
+ ];
156
+ const escapeRegExp = (s)=>s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
157
+ const escapeClassChar = (s)=>s.replace(/[-\\\]^]/g, (m)=>`\\${m}`);
158
+ const charClassFrom = (chars)=>`[${chars.map(escapeClassChar).join('')}]`;
159
+ const ANY_MINUS_CLASS = charClassFrom([
160
+ '-'
161
+ ].concat(UNICODE_MINUS_SIGNS));
162
+ const ANY_PLUS_CLASS = charClassFrom([
163
+ '+'
164
+ ].concat(UNICODE_PLUS_SIGNS));
165
+ const ANY_MINUS_RE = new RegExp(ANY_MINUS_CLASS, 'gu');
166
+ const ANY_PLUS_RE = new RegExp(ANY_PLUS_CLASS, 'gu');
167
+ const ANY_MINUS_DETECT_RE = new RegExp(ANY_MINUS_CLASS);
168
+ const ANY_PLUS_DETECT_RE = new RegExp(ANY_PLUS_CLASS);
169
+ function getNumberLocaleDetails(locale, options) {
170
+ const parts = getFormatter(locale, options).formatToParts(11111.1);
171
+ const result = {};
172
+ parts.forEach((part)=>{
173
+ result[part.type] = part.value;
174
+ });
175
+ getFormatter(locale).formatToParts(0.1).forEach((part)=>{
176
+ if ('decimal' === part.type) result[part.type] = part.value;
177
+ });
178
+ return result;
179
+ }
180
+ function parseNumber(formattedNumber, locale, options) {
181
+ if (null == formattedNumber) return null;
182
+ let input = String(formattedNumber).replace(/\p{Cf}/gu, '').trim();
183
+ input = input.replace(ANY_MINUS_RE, '-').replace(ANY_PLUS_RE, '+');
184
+ let isNegative = false;
185
+ const trailing = input.match(/([+-])\s*$/);
186
+ if (trailing) {
187
+ if ('-' === trailing[1]) isNegative = true;
188
+ input = input.replace(/([+-])\s*$/, '');
189
+ }
190
+ const leading = input.match(/^\s*([+-])/);
191
+ if (leading) {
192
+ if ('-' === leading[1]) isNegative = true;
193
+ input = input.replace(/^\s*[+-]/, '');
194
+ }
195
+ let computedLocale = locale;
196
+ if (void 0 === computedLocale) {
197
+ if (ARABIC_DETECT_RE.test(input) || PERSIAN_DETECT_RE.test(input)) computedLocale = 'ar';
198
+ else if (HAN_DETECT_RE.test(input)) computedLocale = 'zh';
199
+ }
200
+ const { group, decimal, currency } = getNumberLocaleDetails(computedLocale, options);
201
+ const unitParts = getFormatter(computedLocale, options).formatToParts(1).filter((p)=>'unit' === p.type).map((p)=>escapeRegExp(p.value));
202
+ const unitRegex = unitParts.length ? new RegExp(unitParts.join('|'), 'g') : null;
203
+ let groupRegex = null;
204
+ if (group) {
205
+ const isSpaceGroup = /\p{Zs}/u.test(group);
206
+ const isApostropheGroup = "'" === group || '’' === group;
207
+ groupRegex = isSpaceGroup ? /\p{Zs}/gu : isApostropheGroup ? /['’]/g : new RegExp(escapeRegExp(group), 'g');
208
+ }
209
+ const replacements = [
210
+ {
211
+ regex: group ? groupRegex : null,
212
+ replacement: ''
213
+ },
214
+ {
215
+ regex: decimal ? new RegExp(escapeRegExp(decimal), 'g') : null,
216
+ replacement: '.'
217
+ },
218
+ {
219
+ regex: /./g,
220
+ replacement: '.'
221
+ },
222
+ {
223
+ regex: /,/g,
224
+ replacement: ''
225
+ },
226
+ {
227
+ regex: /٫/g,
228
+ replacement: '.'
229
+ },
230
+ {
231
+ regex: /٬/g,
232
+ replacement: ''
233
+ },
234
+ {
235
+ regex: currency ? new RegExp(escapeRegExp(currency), 'g') : null,
236
+ replacement: ''
237
+ },
238
+ {
239
+ regex: unitRegex,
240
+ replacement: ''
241
+ },
242
+ {
243
+ regex: ARABIC_RE,
244
+ replacement: (ch)=>String(ARABIC_NUMERALS.indexOf(ch))
245
+ },
246
+ {
247
+ regex: PERSIAN_RE,
248
+ replacement: (ch)=>String(PERSIAN_NUMERALS.indexOf(ch))
249
+ },
250
+ {
251
+ regex: FULLWIDTH_RE,
252
+ replacement: (ch)=>String(FULLWIDTH_NUMERALS.indexOf(ch))
253
+ },
254
+ {
255
+ regex: HAN_RE,
256
+ replacement: (ch)=>HAN_NUMERAL_TO_DIGIT[ch]
257
+ }
258
+ ];
259
+ let unformatted = replacements.reduce((acc, { regex, replacement })=>regex ? acc.replace(regex, replacement) : acc, input);
260
+ const lastDot = unformatted.lastIndexOf('.');
261
+ if (-1 !== lastDot) unformatted = `${unformatted.slice(0, lastDot).replace(/\./g, '')}.${unformatted.slice(lastDot + 1).replace(/\./g, '')}`;
262
+ if (/^[-+]?Infinity$/i.test(input) || /[∞]/.test(input)) return null;
263
+ const parseTarget = (isNegative ? '-' : '') + unformatted;
264
+ let num = parseFloat(parseTarget);
265
+ const style = options?.style;
266
+ const isUnitPercent = 'unit' === style && options?.unit === 'percent';
267
+ const hasPercentSymbol = PERCENT_RE.test(formattedNumber) || 'percent' === style;
268
+ const hasPermilleSymbol = PERMILLE_RE.test(formattedNumber);
269
+ if (hasPermilleSymbol) num /= 1000;
270
+ else if (!isUnitPercent && hasPercentSymbol) num /= 100;
271
+ if (Number.isNaN(num)) return null;
272
+ return num;
273
+ }
274
+ const STEP_EPSILON_FACTOR = 1e-10;
275
+ function getFractionDigits(format) {
276
+ const defaultOptions = getFormatter('en-US').resolvedOptions();
277
+ const minimumFractionDigits = format?.minimumFractionDigits ?? defaultOptions.minimumFractionDigits ?? 0;
278
+ const maximumFractionDigits = Math.max(format?.maximumFractionDigits ?? defaultOptions.maximumFractionDigits ?? 20, minimumFractionDigits);
279
+ return {
280
+ maximumFractionDigits,
281
+ minimumFractionDigits
282
+ };
283
+ }
284
+ function roundToFractionDigits(value, maximumFractionDigits) {
285
+ if (!Number.isFinite(value)) return value;
286
+ const digits = Math.min(Math.max(maximumFractionDigits, 0), 20);
287
+ return Number(value.toFixed(digits));
288
+ }
289
+ function removeFloatingPointErrors(value, format) {
290
+ const { maximumFractionDigits } = getFractionDigits(format);
291
+ return roundToFractionDigits(value, maximumFractionDigits);
292
+ }
293
+ function snapToStep(clampedValue, base, step, mode = 'directional') {
294
+ if (0 === step) return clampedValue;
295
+ const stepSize = Math.abs(step);
296
+ const direction = Math.sign(step);
297
+ const tolerance = stepSize * STEP_EPSILON_FACTOR * direction;
298
+ const divisor = 'nearest' === mode ? step : stepSize;
299
+ const rawSteps = (clampedValue - base + tolerance) / divisor;
300
+ let snappedSteps;
301
+ snappedSteps = 'nearest' === mode ? Math.round(rawSteps) : direction > 0 ? Math.floor(rawSteps) : Math.ceil(rawSteps);
302
+ const stepForResult = 'nearest' === mode ? step : stepSize;
303
+ return base + snappedSteps * stepForResult;
304
+ }
305
+ function toValidatedNumber(value, { step, minWithDefault, maxWithDefault, minWithZeroDefault, format, snapOnStep, small, clamp: shouldClamp }) {
306
+ if (null === value) return value;
307
+ const clampedValue = shouldClamp ? clamp(value, minWithDefault, maxWithDefault) : value;
308
+ if (null != step && snapOnStep) {
309
+ if (0 === step) return removeFloatingPointErrors(clampedValue, format);
310
+ let base = minWithZeroDefault;
311
+ if (!small && minWithDefault !== Number.MIN_SAFE_INTEGER) base = minWithDefault;
312
+ const snappedValue = snapToStep(clampedValue, base, step, small ? 'nearest' : 'directional');
313
+ return removeFloatingPointErrors(snappedValue, format);
314
+ }
315
+ return removeFloatingPointErrors(clampedValue, format);
316
+ }
317
+ const NumberFieldRoot_NumberFieldRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
318
+ const { id: idProp, min, max, smallStep = 0.1, step: stepProp = 1, largeStep = 10, required = false, disabled: disabledProp = false, readOnly = false, form, name: nameProp, defaultValue, value: valueProp, onValueChange: onValueChangeProp, onValueCommitted: onValueCommittedProp, allowWheelScrub = false, snapOnStep = false, allowOutOfRange = false, format, locale, render, className, inputRef: inputRefProp, style, ...elementProps } = componentProps;
319
+ const { setDirty, validityData, disabled: fieldDisabled, setFilled, invalid, name: fieldName, state: fieldState, validation, shouldValidateOnChange } = useFieldRootContext();
320
+ const disabled = fieldDisabled || disabledProp;
321
+ const name = fieldName ?? nameProp;
322
+ const step = 'any' === stepProp ? 1 : stepProp;
323
+ const [isScrubbing, setIsScrubbing] = __rspack_external_react.useState(false);
324
+ const minWithDefault = min ?? Number.MIN_SAFE_INTEGER;
325
+ const maxWithDefault = max ?? Number.MAX_SAFE_INTEGER;
326
+ const minWithZeroDefault = min ?? 0;
327
+ const formatStyle = format?.style;
328
+ const inputRef = __rspack_external_react.useRef(null);
329
+ const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);
330
+ const id = useLabelableId({
331
+ id: idProp
332
+ });
333
+ const [valueUnwrapped, setValueUnwrapped] = useControlled({
334
+ controlled: valueProp,
335
+ default: defaultValue,
336
+ name: 'NumberField',
337
+ state: 'value'
338
+ });
339
+ const value = valueUnwrapped ?? null;
340
+ const valueRef = useValueAsRef(value);
341
+ useIsoLayoutEffect(()=>{
342
+ setFilled(null !== value);
343
+ }, [
344
+ setFilled,
345
+ value
346
+ ]);
347
+ const forceRender = useForcedRerendering();
348
+ const formatOptionsRef = useValueAsRef(format);
349
+ const hasPendingCommitRef = __rspack_external_react.useRef(false);
350
+ const onValueCommitted = useStableCallback((nextValue, eventDetails)=>{
351
+ hasPendingCommitRef.current = false;
352
+ onValueCommittedProp?.(nextValue, eventDetails);
353
+ });
354
+ const allowInputSyncRef = __rspack_external_react.useRef(true);
355
+ const lastChangedValueRef = __rspack_external_react.useRef(null);
356
+ const [inputValue, setInputValue] = __rspack_external_react.useState(()=>{
357
+ if (void 0 !== valueProp) return getControlledInputValue(value, locale, format);
358
+ return formatNumber(value, locale, format);
359
+ });
360
+ const [inputMode, setInputMode] = __rspack_external_react.useState('numeric');
361
+ const getAllowedNonNumericKeys = useStableCallback(()=>{
362
+ const { decimal, group, currency, literal } = getNumberLocaleDetails(locale, format);
363
+ const keys = new Set();
364
+ BASE_NON_NUMERIC_SYMBOLS.forEach((symbol)=>keys.add(symbol));
365
+ if (decimal) keys.add(decimal);
366
+ if (group) {
367
+ keys.add(group);
368
+ if (SPACE_SEPARATOR_RE.test(group)) keys.add(' ');
369
+ }
370
+ const allowPercentSymbols = 'percent' === formatStyle || 'unit' === formatStyle && format?.unit === 'percent';
371
+ const allowPermilleSymbols = 'percent' === formatStyle || 'unit' === formatStyle && format?.unit === 'permille';
372
+ if (allowPercentSymbols) PERCENTAGES.forEach((key)=>keys.add(key));
373
+ if (allowPermilleSymbols) PERMILLE.forEach((key)=>keys.add(key));
374
+ if ('currency' === formatStyle && currency) keys.add(currency);
375
+ if (literal) {
376
+ Array.from(literal).forEach((char)=>keys.add(char));
377
+ if (SPACE_SEPARATOR_RE.test(literal)) keys.add(' ');
378
+ }
379
+ PLUS_SIGNS_WITH_ASCII.forEach((key)=>keys.add(key));
380
+ if (minWithDefault < 0) MINUS_SIGNS_WITH_ASCII.forEach((key)=>keys.add(key));
381
+ return keys;
382
+ });
383
+ const getStepAmount = useStableCallback((event)=>{
384
+ if (event?.altKey) return smallStep;
385
+ if (event?.shiftKey) return largeStep;
386
+ return step;
387
+ });
388
+ const setValue = useStableCallback((unvalidatedValue, details)=>{
389
+ const eventWithOptionalKeyState = details.event;
390
+ const dir = details.direction;
391
+ const reason = details.reason;
392
+ const shouldClampValue = !allowOutOfRange || !(reason === inputChange || reason === inputBlur || reason === inputPaste || reason === inputClear || "none" === reason);
393
+ const validatedValue = toValidatedNumber(unvalidatedValue, {
394
+ step: dir ? getStepAmount(eventWithOptionalKeyState) * dir : void 0,
395
+ format: formatOptionsRef.current,
396
+ minWithDefault,
397
+ maxWithDefault,
398
+ minWithZeroDefault,
399
+ snapOnStep,
400
+ small: eventWithOptionalKeyState?.altKey ?? false,
401
+ clamp: shouldClampValue
402
+ });
403
+ const isInputReason = details.reason === inputChange || details.reason === inputClear || details.reason === inputBlur || details.reason === inputPaste || "none" === details.reason;
404
+ const shouldFireChange = validatedValue !== value || isInputReason && (unvalidatedValue !== value || false === allowInputSyncRef.current);
405
+ if (shouldFireChange) {
406
+ lastChangedValueRef.current = validatedValue;
407
+ onValueChangeProp?.(validatedValue, details);
408
+ if (details.isCanceled) return shouldFireChange;
409
+ setValueUnwrapped(validatedValue);
410
+ setDirty(validatedValue !== validityData.initialValue);
411
+ hasPendingCommitRef.current = true;
412
+ }
413
+ if (allowInputSyncRef.current) setInputValue(formatNumber(validatedValue, locale, format));
414
+ forceRender();
415
+ return shouldFireChange;
416
+ });
417
+ const incrementValue = useStableCallback((amount, { direction, currentValue, event, reason })=>{
418
+ const prevValue = null == currentValue ? valueRef.current : currentValue;
419
+ const nextValue = 'number' == typeof prevValue ? prevValue + amount * direction : Math.max(0, min ?? 0);
420
+ const nativeEvent = event;
421
+ return setValue(nextValue, createChangeEventDetails(reason, nativeEvent, void 0, {
422
+ direction
423
+ }));
424
+ });
425
+ useIsoLayoutEffect(function() {
426
+ if (!allowInputSyncRef.current) return;
427
+ const nextInputValue = void 0 !== valueProp ? getControlledInputValue(value, locale, format) : formatNumber(value, locale, format);
428
+ if (nextInputValue !== inputValue) setInputValue(nextInputValue);
429
+ });
430
+ useIsoLayoutEffect(function() {
431
+ if (!isIOS) return;
432
+ let computedInputMode = 'text';
433
+ if (minWithDefault >= 0) computedInputMode = 'decimal';
434
+ setInputMode(computedInputMode);
435
+ }, [
436
+ minWithDefault,
437
+ formatStyle
438
+ ]);
439
+ __rspack_external_react.useEffect(function() {
440
+ const element = inputRef.current;
441
+ if (disabled || readOnly || !allowWheelScrub || !element) return;
442
+ function handleWheel(event) {
443
+ if (event.ctrlKey || activeElement(ownerDocument(inputRef.current)) !== inputRef.current) return;
444
+ event.preventDefault();
445
+ allowInputSyncRef.current = true;
446
+ const amount = getStepAmount(event) ?? 1;
447
+ incrementValue(amount, {
448
+ direction: event.deltaY > 0 ? -1 : 1,
449
+ event,
450
+ reason: 'wheel'
451
+ });
452
+ }
453
+ return addEventListener(element, 'wheel', handleWheel);
454
+ }, [
455
+ allowWheelScrub,
456
+ incrementValue,
457
+ disabled,
458
+ readOnly,
459
+ getStepAmount
460
+ ]);
461
+ const state = __rspack_external_react.useMemo(()=>({
462
+ ...fieldState,
463
+ disabled,
464
+ readOnly,
465
+ required,
466
+ value,
467
+ inputValue,
468
+ scrubbing: isScrubbing
469
+ }), [
470
+ fieldState,
471
+ disabled,
472
+ readOnly,
473
+ required,
474
+ value,
475
+ inputValue,
476
+ isScrubbing
477
+ ]);
478
+ const contextValue = __rspack_external_react.useMemo(()=>({
479
+ inputRef,
480
+ inputValue,
481
+ value,
482
+ minWithDefault,
483
+ maxWithDefault,
484
+ disabled,
485
+ readOnly,
486
+ id,
487
+ setValue,
488
+ incrementValue,
489
+ getStepAmount,
490
+ allowInputSyncRef,
491
+ formatOptionsRef,
492
+ valueRef,
493
+ lastChangedValueRef,
494
+ hasPendingCommitRef,
495
+ name,
496
+ required,
497
+ invalid,
498
+ inputMode,
499
+ getAllowedNonNumericKeys,
500
+ min,
501
+ max,
502
+ setInputValue,
503
+ locale,
504
+ isScrubbing,
505
+ setIsScrubbing,
506
+ state,
507
+ onValueCommitted
508
+ }), [
509
+ inputRef,
510
+ inputValue,
511
+ value,
512
+ minWithDefault,
513
+ maxWithDefault,
514
+ disabled,
515
+ readOnly,
516
+ id,
517
+ setValue,
518
+ incrementValue,
519
+ getStepAmount,
520
+ formatOptionsRef,
521
+ valueRef,
522
+ name,
523
+ required,
524
+ invalid,
525
+ inputMode,
526
+ getAllowedNonNumericKeys,
527
+ min,
528
+ max,
529
+ setInputValue,
530
+ locale,
531
+ isScrubbing,
532
+ state,
533
+ onValueCommitted
534
+ ]);
535
+ const element = useRenderElement('div', componentProps, {
536
+ ref: forwardedRef,
537
+ state,
538
+ props: elementProps,
539
+ stateAttributesMapping: stateAttributesMapping
540
+ });
541
+ return /*#__PURE__*/ jsxs(NumberFieldRootContext.Provider, {
542
+ value: contextValue,
543
+ children: [
544
+ element,
545
+ /*#__PURE__*/ jsx("input", {
546
+ ...validation.getInputValidationProps({
547
+ onFocus () {
548
+ inputRef.current?.focus();
549
+ },
550
+ onChange (event) {
551
+ if (event.nativeEvent.defaultPrevented || disabled || readOnly) return void event.preventBaseUIHandler?.();
552
+ const nextValue = event.currentTarget.valueAsNumber;
553
+ const parsedValue = Number.isNaN(nextValue) ? null : nextValue;
554
+ const details = createChangeEventDetails("none", event.nativeEvent);
555
+ setDirty(parsedValue !== validityData.initialValue);
556
+ setValue(parsedValue, details);
557
+ if (shouldValidateOnChange()) validation.commit(parsedValue);
558
+ }
559
+ }),
560
+ ref: hiddenInputRef,
561
+ type: "number",
562
+ form: form,
563
+ name: name,
564
+ value: value ?? '',
565
+ min: min,
566
+ max: max,
567
+ step: stepProp,
568
+ disabled: disabled,
569
+ required: required,
570
+ "aria-hidden": true,
571
+ tabIndex: -1,
572
+ style: name ? visuallyHiddenInput : visuallyHidden,
573
+ suppressHydrationWarning: true
574
+ })
575
+ ]
576
+ });
577
+ });
578
+ if ("production" !== process.env.NODE_ENV) NumberFieldRoot_NumberFieldRoot.displayName = "NumberFieldRoot";
579
+ function getControlledInputValue(value, locale, format) {
580
+ const explicitPrecision = format?.maximumFractionDigits != null || format?.minimumFractionDigits != null;
581
+ return explicitPrecision ? formatNumber(value, locale, format) : formatNumberMaxPrecision(value, locale, format);
582
+ }
583
+ const NumberFieldGroup_NumberFieldGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
584
+ const { render, className, style, ...elementProps } = componentProps;
585
+ const { state } = useNumberFieldRootContext();
586
+ const element = useRenderElement('div', componentProps, {
587
+ ref: forwardedRef,
588
+ state,
589
+ props: [
590
+ {
591
+ role: 'group'
592
+ },
593
+ elementProps
594
+ ],
595
+ stateAttributesMapping: stateAttributesMapping
596
+ });
597
+ return element;
598
+ });
599
+ if ("production" !== process.env.NODE_ENV) NumberFieldGroup_NumberFieldGroup.displayName = "NumberFieldGroup";
600
+ const EMPTY = 0;
601
+ class Interval extends Timeout {
602
+ static create() {
603
+ return new Interval();
604
+ }
605
+ start(delay, fn) {
606
+ this.clear();
607
+ this.currentId = setInterval(()=>{
608
+ fn();
609
+ }, delay);
610
+ }
611
+ clear = ()=>{
612
+ if (this.currentId !== EMPTY) {
613
+ clearInterval(this.currentId);
614
+ this.currentId = EMPTY;
615
+ }
616
+ };
617
+ }
618
+ function useInterval() {
619
+ const timeout = useRefWithInit(Interval.create).current;
620
+ useOnMount(timeout.disposeEffect);
621
+ return timeout;
622
+ }
623
+ const DEFAULT_TICK_DELAY = 60;
624
+ const DEFAULT_START_DELAY = 400;
625
+ const DEFAULT_SCROLL_DISTANCE = 8;
626
+ const TOUCH_TIMEOUT = 50;
627
+ const MAX_POINTER_MOVES_AFTER_TOUCH = 3;
628
+ function isTouchLikePointerType(pointerType) {
629
+ return 'touch' === pointerType || 'pen' === pointerType;
630
+ }
631
+ function usePressAndHold(params) {
632
+ const { disabled, readOnly = false, tick, onStop, tickDelay = DEFAULT_TICK_DELAY, startDelay = DEFAULT_START_DELAY, scrollDistance = DEFAULT_SCROLL_DISTANCE, elementRef } = params;
633
+ const startTickTimeout = useTimeout();
634
+ const tickInterval = useInterval();
635
+ const intentionalTouchCheckTimeout = useTimeout();
636
+ const isPressedRef = __rspack_external_react.useRef(false);
637
+ const movesAfterTouchRef = __rspack_external_react.useRef(0);
638
+ const downCoordsRef = __rspack_external_react.useRef({
639
+ x: 0,
640
+ y: 0
641
+ });
642
+ const isTouchingButtonRef = __rspack_external_react.useRef(false);
643
+ const ignoreClickRef = __rspack_external_react.useRef(false);
644
+ const pointerTypeRef = __rspack_external_react.useRef('');
645
+ const unsubscribeFromGlobalContextMenuRef = __rspack_external_react.useRef(()=>{});
646
+ const stopAutoChange = useStableCallback(()=>{
647
+ intentionalTouchCheckTimeout.clear();
648
+ startTickTimeout.clear();
649
+ tickInterval.clear();
650
+ unsubscribeFromGlobalContextMenuRef.current();
651
+ movesAfterTouchRef.current = 0;
652
+ });
653
+ function startAutoChange(triggerNativeEvent) {
654
+ stopAutoChange();
655
+ const element = elementRef.current;
656
+ if (!element) return;
657
+ const win = getWindow(element);
658
+ function handleContextMenu(event) {
659
+ event.preventDefault();
660
+ }
661
+ unsubscribeFromGlobalContextMenuRef.current = addEventListener(win, 'contextmenu', handleContextMenu);
662
+ addEventListener(win, 'pointerup', (event)=>{
663
+ isPressedRef.current = false;
664
+ stopAutoChange();
665
+ onStop?.(event);
666
+ }, {
667
+ once: true
668
+ });
669
+ if (!tick(triggerNativeEvent)) return void stopAutoChange();
670
+ startTickTimeout.start(startDelay, ()=>{
671
+ tickInterval.start(tickDelay, ()=>{
672
+ if (!tick(triggerNativeEvent)) stopAutoChange();
673
+ });
674
+ });
675
+ }
676
+ __rspack_external_react.useEffect(()=>()=>stopAutoChange(), [
677
+ stopAutoChange
678
+ ]);
679
+ const pointerHandlers = {
680
+ onTouchStart () {
681
+ isTouchingButtonRef.current = true;
682
+ },
683
+ onTouchEnd () {
684
+ isTouchingButtonRef.current = false;
685
+ },
686
+ onPointerDown (event) {
687
+ const isMainButton = !event.button || 0 === event.button;
688
+ if (event.defaultPrevented || !isMainButton || disabled || readOnly) return;
689
+ pointerTypeRef.current = event.pointerType;
690
+ ignoreClickRef.current = false;
691
+ isPressedRef.current = true;
692
+ downCoordsRef.current = {
693
+ x: event.clientX,
694
+ y: event.clientY
695
+ };
696
+ const isTouchPointer = isTouchLikePointerType(event.pointerType);
697
+ if (isTouchPointer) intentionalTouchCheckTimeout.start(TOUCH_TIMEOUT, ()=>{
698
+ const moves = movesAfterTouchRef.current;
699
+ movesAfterTouchRef.current = 0;
700
+ const stillPressed = isPressedRef.current;
701
+ if (stillPressed && moves < MAX_POINTER_MOVES_AFTER_TOUCH) {
702
+ startAutoChange(event.nativeEvent);
703
+ ignoreClickRef.current = true;
704
+ } else {
705
+ ignoreClickRef.current = false;
706
+ stopAutoChange();
707
+ }
708
+ });
709
+ else {
710
+ event.preventDefault();
711
+ startAutoChange(event.nativeEvent);
712
+ }
713
+ },
714
+ onPointerUp (event) {
715
+ if (isTouchLikePointerType(event.pointerType)) isPressedRef.current = false;
716
+ },
717
+ onPointerMove (event) {
718
+ if (disabled || readOnly || !isTouchLikePointerType(event.pointerType) || !isPressedRef.current) return;
719
+ if (null != movesAfterTouchRef.current) movesAfterTouchRef.current += 1;
720
+ const { x, y } = downCoordsRef.current;
721
+ const dx = x - event.clientX;
722
+ const dy = y - event.clientY;
723
+ if (dx ** 2 + dy ** 2 > scrollDistance ** 2) stopAutoChange();
724
+ },
725
+ onMouseEnter (event) {
726
+ if (event.defaultPrevented || disabled || readOnly || !isPressedRef.current || isTouchingButtonRef.current || isTouchLikePointerType(pointerTypeRef.current)) return;
727
+ startAutoChange(event.nativeEvent);
728
+ },
729
+ onMouseLeave () {
730
+ if (isTouchingButtonRef.current) return;
731
+ stopAutoChange();
732
+ },
733
+ onMouseUp () {
734
+ if (isTouchingButtonRef.current) return;
735
+ stopAutoChange();
736
+ }
737
+ };
738
+ const shouldSkipClick = useStableCallback((event)=>{
739
+ if (event.defaultPrevented) return true;
740
+ if (isTouchLikePointerType(pointerTypeRef.current)) return ignoreClickRef.current;
741
+ return 0 !== event.detail;
742
+ });
743
+ return {
744
+ pointerHandlers,
745
+ shouldSkipClick
746
+ };
747
+ }
748
+ function useNumberFieldButton_isTouchLikePointerType(pointerType) {
749
+ return 'touch' === pointerType || 'pen' === pointerType;
750
+ }
751
+ function useNumberFieldButton(params) {
752
+ const { allowInputSyncRef, disabled, formatOptionsRef, getStepAmount, id, incrementValue, inputRef, inputValue, isIncrement, locale, readOnly, setValue, valueRef, lastChangedValueRef, onValueCommitted } = params;
753
+ const pressReason = isIncrement ? incrementPress : decrementPress;
754
+ function commitValue(nativeEvent) {
755
+ allowInputSyncRef.current = true;
756
+ const parsedValue = parseNumber(inputValue, locale, formatOptionsRef.current);
757
+ if (null !== parsedValue) {
758
+ valueRef.current = parsedValue;
759
+ setValue(parsedValue, createChangeEventDetails(pressReason, nativeEvent, void 0, {
760
+ direction: isIncrement ? 1 : -1
761
+ }));
762
+ }
763
+ }
764
+ const { pointerHandlers, shouldSkipClick } = usePressAndHold({
765
+ disabled: disabled || readOnly,
766
+ elementRef: inputRef,
767
+ tickDelay: 60,
768
+ startDelay: 400,
769
+ scrollDistance: 8,
770
+ tick (triggerEvent) {
771
+ const amount = getStepAmount(triggerEvent) ?? 1;
772
+ return incrementValue(amount, {
773
+ direction: isIncrement ? 1 : -1,
774
+ event: triggerEvent,
775
+ reason: pressReason
776
+ });
777
+ },
778
+ onStop (nativeEvent) {
779
+ const committed = lastChangedValueRef.current ?? valueRef.current;
780
+ onValueCommitted(committed, createGenericEventDetails(pressReason, nativeEvent));
781
+ }
782
+ });
783
+ const props = {
784
+ disabled,
785
+ 'aria-readonly': readOnly || void 0,
786
+ 'aria-label': isIncrement ? 'Increase' : 'Decrease',
787
+ 'aria-controls': id,
788
+ tabIndex: -1,
789
+ style: {
790
+ WebkitUserSelect: 'none',
791
+ userSelect: 'none'
792
+ },
793
+ ...pointerHandlers,
794
+ onClick (event) {
795
+ const isDisabled = disabled || readOnly;
796
+ if (event.defaultPrevented || isDisabled || shouldSkipClick(event)) return;
797
+ commitValue(event.nativeEvent);
798
+ const amount = getStepAmount(event) ?? 1;
799
+ const prev = valueRef.current;
800
+ incrementValue(amount, {
801
+ direction: isIncrement ? 1 : -1,
802
+ event: event.nativeEvent,
803
+ reason: pressReason
804
+ });
805
+ const committed = lastChangedValueRef.current ?? valueRef.current;
806
+ if (committed !== prev) onValueCommitted(committed, createGenericEventDetails(pressReason, event.nativeEvent));
807
+ },
808
+ onPointerDown (event) {
809
+ const isMainButton = !event.button || 0 === event.button;
810
+ if (event.defaultPrevented || readOnly || !isMainButton || disabled) return;
811
+ commitValue(event.nativeEvent);
812
+ if (!useNumberFieldButton_isTouchLikePointerType(event.pointerType)) inputRef.current?.focus();
813
+ pointerHandlers.onPointerDown(event);
814
+ }
815
+ };
816
+ return props;
817
+ }
818
+ const NumberFieldIncrement_NumberFieldIncrement = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
819
+ const { render, className, disabled: disabledProp = false, nativeButton = true, style, ...elementProps } = componentProps;
820
+ const { allowInputSyncRef, disabled: contextDisabled, formatOptionsRef, getStepAmount, id, incrementValue, inputRef, inputValue, locale, maxWithDefault, readOnly, setValue, state, value, valueRef, lastChangedValueRef, onValueCommitted } = useNumberFieldRootContext();
821
+ const isMax = null != value && value >= maxWithDefault;
822
+ const disabled = disabledProp || contextDisabled || isMax;
823
+ const props = useNumberFieldButton({
824
+ isIncrement: true,
825
+ inputRef,
826
+ inputValue,
827
+ disabled,
828
+ readOnly,
829
+ id,
830
+ setValue,
831
+ getStepAmount,
832
+ incrementValue,
833
+ allowInputSyncRef,
834
+ formatOptionsRef,
835
+ valueRef,
836
+ locale,
837
+ lastChangedValueRef,
838
+ onValueCommitted
839
+ });
840
+ const { getButtonProps, buttonRef } = useButton({
841
+ disabled,
842
+ native: nativeButton,
843
+ focusableWhenDisabled: true
844
+ });
845
+ const buttonState = __rspack_external_react.useMemo(()=>({
846
+ ...state,
847
+ disabled
848
+ }), [
849
+ state,
850
+ disabled
851
+ ]);
852
+ const element = useRenderElement('button', componentProps, {
853
+ ref: [
854
+ forwardedRef,
855
+ buttonRef
856
+ ],
857
+ state: buttonState,
858
+ props: [
859
+ props,
860
+ elementProps,
861
+ getButtonProps
862
+ ],
863
+ stateAttributesMapping: stateAttributesMapping
864
+ });
865
+ return element;
866
+ });
867
+ if ("production" !== process.env.NODE_ENV) NumberFieldIncrement_NumberFieldIncrement.displayName = "NumberFieldIncrement";
868
+ const NumberFieldDecrement_NumberFieldDecrement = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
869
+ const { render, className, disabled: disabledProp = false, nativeButton = true, style, ...elementProps } = componentProps;
870
+ const { allowInputSyncRef, disabled: contextDisabled, formatOptionsRef, getStepAmount, id, incrementValue, inputRef, inputValue, minWithDefault, readOnly, setValue, state, value, valueRef, locale, lastChangedValueRef, onValueCommitted } = useNumberFieldRootContext();
871
+ const isMin = null != value && value <= minWithDefault;
872
+ const disabled = disabledProp || contextDisabled || isMin;
873
+ const props = useNumberFieldButton({
874
+ isIncrement: false,
875
+ inputRef,
876
+ inputValue,
877
+ disabled,
878
+ readOnly,
879
+ id,
880
+ setValue,
881
+ getStepAmount,
882
+ incrementValue,
883
+ allowInputSyncRef,
884
+ formatOptionsRef,
885
+ valueRef,
886
+ locale,
887
+ lastChangedValueRef,
888
+ onValueCommitted
889
+ });
890
+ const { getButtonProps, buttonRef } = useButton({
891
+ disabled,
892
+ native: nativeButton,
893
+ focusableWhenDisabled: true
894
+ });
895
+ const buttonState = __rspack_external_react.useMemo(()=>({
896
+ ...state,
897
+ disabled
898
+ }), [
899
+ state,
900
+ disabled
901
+ ]);
902
+ const element = useRenderElement('button', componentProps, {
903
+ ref: [
904
+ forwardedRef,
905
+ buttonRef
906
+ ],
907
+ state: buttonState,
908
+ props: [
909
+ props,
910
+ elementProps,
911
+ getButtonProps
912
+ ],
913
+ stateAttributesMapping: stateAttributesMapping
914
+ });
915
+ return element;
916
+ });
917
+ if ("production" !== process.env.NODE_ENV) NumberFieldDecrement_NumberFieldDecrement.displayName = "NumberFieldDecrement";
918
+ const NumberFieldInput_stateAttributesMapping = {
919
+ ...fieldValidityMapping,
920
+ ...stateAttributesMapping
921
+ };
922
+ const NAVIGATE_KEYS = new Set([
923
+ 'Backspace',
924
+ 'Delete',
925
+ 'ArrowLeft',
926
+ 'ArrowRight',
927
+ 'Tab',
928
+ 'Enter',
929
+ 'Escape'
930
+ ]);
931
+ const NumberFieldInput_NumberFieldInput = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
932
+ const { render, className, style, ...elementProps } = componentProps;
933
+ const { allowInputSyncRef, disabled, formatOptionsRef, getAllowedNonNumericKeys, getStepAmount, id, incrementValue, inputMode, inputValue, max, min, name, readOnly, required, setValue, state, setInputValue, locale, inputRef, value, onValueCommitted, lastChangedValueRef, hasPendingCommitRef, valueRef } = useNumberFieldRootContext();
934
+ const { clearErrors } = useFormContext();
935
+ const { validationMode, setTouched, setFocused, invalid, shouldValidateOnChange, validation } = useFieldRootContext();
936
+ const { labelId } = useLabelableContext();
937
+ const hasTouchedInputRef = __rspack_external_react.useRef(false);
938
+ const blockRevalidationRef = __rspack_external_react.useRef(false);
939
+ useRegisterFieldControl(inputRef, id, value);
940
+ useValueChanged(value, (previousValue)=>{
941
+ const validateOnChange = shouldValidateOnChange();
942
+ clearErrors(name);
943
+ if (validateOnChange) validation.commit(value);
944
+ if (previousValue === value || validateOnChange) return;
945
+ if (blockRevalidationRef.current) {
946
+ blockRevalidationRef.current = false;
947
+ return;
948
+ }
949
+ validation.commit(value, true);
950
+ });
951
+ const inputProps = {
952
+ id,
953
+ required,
954
+ disabled,
955
+ readOnly,
956
+ inputMode,
957
+ value: inputValue,
958
+ type: 'text',
959
+ autoComplete: 'off',
960
+ autoCorrect: 'off',
961
+ spellCheck: 'false',
962
+ "aria-roledescription": 'Number field',
963
+ 'aria-invalid': invalid || void 0,
964
+ 'aria-labelledby': labelId,
965
+ suppressHydrationWarning: true,
966
+ onFocus (event) {
967
+ if (event.defaultPrevented || readOnly || disabled) return;
968
+ setFocused(true);
969
+ if (hasTouchedInputRef.current) return;
970
+ hasTouchedInputRef.current = true;
971
+ const target = event.currentTarget;
972
+ const length = target.value.length;
973
+ target.setSelectionRange(length, length);
974
+ },
975
+ onBlur (event) {
976
+ if (event.defaultPrevented || readOnly || disabled) return;
977
+ setTouched(true);
978
+ setFocused(false);
979
+ const hadManualInput = !allowInputSyncRef.current;
980
+ const hadPendingProgrammaticChange = hasPendingCommitRef.current;
981
+ allowInputSyncRef.current = true;
982
+ if ('' === inputValue.trim()) {
983
+ setValue(null, createChangeEventDetails(inputClear, event.nativeEvent));
984
+ if ('onBlur' === validationMode) validation.commit(null);
985
+ onValueCommitted(null, createGenericEventDetails(inputClear, event.nativeEvent));
986
+ return;
987
+ }
988
+ const formatOptions = formatOptionsRef.current;
989
+ const parsedValue = parseNumber(inputValue, locale, formatOptions);
990
+ if (null === parsedValue) return;
991
+ const hasExplicitPrecision = formatOptions?.maximumFractionDigits != null || formatOptions?.minimumFractionDigits != null;
992
+ const maxFrac = formatOptions?.maximumFractionDigits;
993
+ const committed = hasExplicitPrecision && 'number' == typeof maxFrac ? Number(parsedValue.toFixed(maxFrac)) : parsedValue;
994
+ const nextEventDetails = createGenericEventDetails(inputBlur, event.nativeEvent);
995
+ const shouldUpdateValue = value !== committed;
996
+ const shouldCommit = hadManualInput || shouldUpdateValue || hadPendingProgrammaticChange;
997
+ if ('onBlur' === validationMode) validation.commit(committed);
998
+ if (shouldUpdateValue) {
999
+ blockRevalidationRef.current = true;
1000
+ setValue(committed, createChangeEventDetails(inputBlur, event.nativeEvent));
1001
+ }
1002
+ if (shouldCommit) onValueCommitted(committed, nextEventDetails);
1003
+ const canonicalText = formatNumber(committed, locale, formatOptions);
1004
+ const shouldPreserveFullPrecision = !hasExplicitPrecision && parsedValue === value && inputValue === formatNumberMaxPrecision(parsedValue, locale, formatOptions);
1005
+ if (!shouldPreserveFullPrecision && inputValue !== canonicalText) setInputValue(canonicalText);
1006
+ },
1007
+ onChange (event) {
1008
+ if (event.nativeEvent.defaultPrevented) return;
1009
+ allowInputSyncRef.current = false;
1010
+ const targetValue = event.currentTarget.value;
1011
+ if ('' === targetValue.trim()) {
1012
+ setInputValue(targetValue);
1013
+ setValue(null, createChangeEventDetails(inputClear, event.nativeEvent));
1014
+ return;
1015
+ }
1016
+ const allowedNonNumericKeys = getAllowedNonNumericKeys();
1017
+ const isValidCharacterString = Array.from(targetValue).every((ch)=>{
1018
+ const isAsciiDigit = ch >= '0' && ch <= '9';
1019
+ const isArabicNumeral = ARABIC_DETECT_RE.test(ch);
1020
+ const isHanNumeral = HAN_DETECT_RE.test(ch);
1021
+ const isPersianNumeral = PERSIAN_DETECT_RE.test(ch);
1022
+ const isFullwidthNumeral = FULLWIDTH_DETECT_RE.test(ch);
1023
+ const isMinus = ANY_MINUS_DETECT_RE.test(ch);
1024
+ return isAsciiDigit || isArabicNumeral || isHanNumeral || isPersianNumeral || isFullwidthNumeral || isMinus || allowedNonNumericKeys.has(ch);
1025
+ });
1026
+ if (!isValidCharacterString) return;
1027
+ const parsedValue = parseNumber(targetValue, locale, formatOptionsRef.current);
1028
+ setInputValue(targetValue);
1029
+ if (null !== parsedValue) setValue(parsedValue, createChangeEventDetails(inputChange, event.nativeEvent));
1030
+ },
1031
+ onKeyDown (event) {
1032
+ if (event.defaultPrevented || readOnly || disabled) return;
1033
+ const nativeEvent = event.nativeEvent;
1034
+ allowInputSyncRef.current = true;
1035
+ const allowedNonNumericKeys = getAllowedNonNumericKeys();
1036
+ let isAllowedNonNumericKey = allowedNonNumericKeys.has(event.key);
1037
+ const { decimal, currency, percentSign } = getNumberLocaleDetails(locale, formatOptionsRef.current);
1038
+ const selectionStart = event.currentTarget.selectionStart;
1039
+ const selectionEnd = event.currentTarget.selectionEnd;
1040
+ const isAllSelected = 0 === selectionStart && selectionEnd === inputValue.length;
1041
+ const selectionContainsIndex = (index)=>null != selectionStart && null != selectionEnd && index >= selectionStart && index < selectionEnd;
1042
+ if (ANY_MINUS_DETECT_RE.test(event.key) && Array.from(allowedNonNumericKeys).some((k)=>ANY_MINUS_DETECT_RE.test(k || ''))) {
1043
+ const existingIndex = inputValue.search(ANY_MINUS_RE);
1044
+ const isReplacingExisting = null != existingIndex && -1 !== existingIndex && selectionContainsIndex(existingIndex);
1045
+ isAllowedNonNumericKey = !(ANY_MINUS_DETECT_RE.test(inputValue) || ANY_PLUS_DETECT_RE.test(inputValue)) || isAllSelected || isReplacingExisting;
1046
+ }
1047
+ if (ANY_PLUS_DETECT_RE.test(event.key) && Array.from(allowedNonNumericKeys).some((k)=>ANY_PLUS_DETECT_RE.test(k || ''))) {
1048
+ const existingIndex = inputValue.search(ANY_PLUS_RE);
1049
+ const isReplacingExisting = null != existingIndex && -1 !== existingIndex && selectionContainsIndex(existingIndex);
1050
+ isAllowedNonNumericKey = !(ANY_MINUS_DETECT_RE.test(inputValue) || ANY_PLUS_DETECT_RE.test(inputValue)) || isAllSelected || isReplacingExisting;
1051
+ }
1052
+ [
1053
+ decimal,
1054
+ currency,
1055
+ percentSign
1056
+ ].forEach((symbol)=>{
1057
+ if (event.key === symbol) {
1058
+ const symbolIndex = inputValue.indexOf(symbol);
1059
+ const isSymbolHighlighted = selectionContainsIndex(symbolIndex);
1060
+ isAllowedNonNumericKey = !inputValue.includes(symbol) || isAllSelected || isSymbolHighlighted;
1061
+ }
1062
+ });
1063
+ const isAsciiDigit = event.key >= '0' && event.key <= '9';
1064
+ const isArabicNumeral = ARABIC_DETECT_RE.test(event.key);
1065
+ const isHanNumeral = HAN_DETECT_RE.test(event.key);
1066
+ const isPersianNumeral = PERSIAN_DETECT_RE.test(event.key);
1067
+ const isFullwidthNumeral = FULLWIDTH_DETECT_RE.test(event.key);
1068
+ const isNavigateKey = NAVIGATE_KEYS.has(event.key);
1069
+ if (229 === event.which || event.altKey || event.ctrlKey || event.metaKey || isAllowedNonNumericKey || isAsciiDigit || isArabicNumeral || isFullwidthNumeral || isHanNumeral || isPersianNumeral || isNavigateKey) return;
1070
+ const parsedValue = parseNumber(inputValue, locale, formatOptionsRef.current);
1071
+ const amount = getStepAmount(event) ?? 1;
1072
+ stopEvent(event);
1073
+ const commitDetails = createGenericEventDetails(keyboard, nativeEvent);
1074
+ if ('ArrowUp' === event.key) {
1075
+ incrementValue(amount, {
1076
+ direction: 1,
1077
+ currentValue: parsedValue,
1078
+ event: nativeEvent,
1079
+ reason: keyboard
1080
+ });
1081
+ onValueCommitted(lastChangedValueRef.current ?? valueRef.current, commitDetails);
1082
+ } else if ('ArrowDown' === event.key) {
1083
+ incrementValue(amount, {
1084
+ direction: -1,
1085
+ currentValue: parsedValue,
1086
+ event: nativeEvent,
1087
+ reason: keyboard
1088
+ });
1089
+ onValueCommitted(lastChangedValueRef.current ?? valueRef.current, commitDetails);
1090
+ } else if ('Home' === event.key && null != min) {
1091
+ setValue(min, createChangeEventDetails(keyboard, nativeEvent));
1092
+ onValueCommitted(lastChangedValueRef.current ?? valueRef.current, commitDetails);
1093
+ } else if ('End' === event.key && null != max) {
1094
+ setValue(max, createChangeEventDetails(keyboard, nativeEvent));
1095
+ onValueCommitted(lastChangedValueRef.current ?? valueRef.current, commitDetails);
1096
+ }
1097
+ },
1098
+ onPaste (event) {
1099
+ if (event.defaultPrevented || readOnly || disabled) return;
1100
+ event.preventDefault();
1101
+ const clipboardData = event.clipboardData || window.Clipboard;
1102
+ const pastedData = clipboardData.getData('text/plain');
1103
+ const parsedValue = parseNumber(pastedData, locale, formatOptionsRef.current);
1104
+ if (null !== parsedValue) {
1105
+ allowInputSyncRef.current = false;
1106
+ setValue(parsedValue, createChangeEventDetails(inputPaste, event.nativeEvent));
1107
+ setInputValue(pastedData);
1108
+ }
1109
+ }
1110
+ };
1111
+ const element = useRenderElement('input', componentProps, {
1112
+ ref: [
1113
+ forwardedRef,
1114
+ inputRef
1115
+ ],
1116
+ state,
1117
+ props: [
1118
+ inputProps,
1119
+ validation.getValidationProps(),
1120
+ elementProps
1121
+ ],
1122
+ stateAttributesMapping: NumberFieldInput_stateAttributesMapping
1123
+ });
1124
+ return element;
1125
+ });
1126
+ if ("production" !== process.env.NODE_ENV) NumberFieldInput_NumberFieldInput.displayName = "NumberFieldInput";
1127
+ const NumberFieldScrubAreaContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
1128
+ if ("production" !== process.env.NODE_ENV) NumberFieldScrubAreaContext.displayName = "NumberFieldScrubAreaContext";
1129
+ function useNumberFieldScrubAreaContext() {
1130
+ const context = __rspack_external_react.useContext(NumberFieldScrubAreaContext);
1131
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: NumberFieldScrubAreaContext is missing. NumberFieldScrubArea parts must be placed within <NumberField.ScrubArea>.' : esm_formatErrorMessage(44));
1132
+ return context;
1133
+ }
1134
+ function getViewportRect(teleportDistance, scrubAreaEl) {
1135
+ const win = getWindow(scrubAreaEl);
1136
+ const rect = scrubAreaEl.getBoundingClientRect();
1137
+ if (rect && null != teleportDistance) return {
1138
+ x: rect.left - teleportDistance / 2,
1139
+ y: rect.top - teleportDistance / 2,
1140
+ width: rect.right + teleportDistance / 2,
1141
+ height: rect.bottom + teleportDistance / 2
1142
+ };
1143
+ const vV = win.visualViewport;
1144
+ if (vV) return {
1145
+ x: vV.offsetLeft,
1146
+ y: vV.offsetTop,
1147
+ width: vV.offsetLeft + vV.width,
1148
+ height: vV.offsetTop + vV.height
1149
+ };
1150
+ return {
1151
+ x: 0,
1152
+ y: 0,
1153
+ width: win.document.documentElement.clientWidth,
1154
+ height: win.document.documentElement.clientHeight
1155
+ };
1156
+ }
1157
+ function subscribeToVisualViewportResize(element, visualScaleRef) {
1158
+ const vV = getWindow(element).visualViewport;
1159
+ if (!vV) return ()=>{};
1160
+ function handleVisualResize() {
1161
+ if (vV) visualScaleRef.current = vV.scale;
1162
+ }
1163
+ handleVisualResize();
1164
+ return addEventListener(vV, 'resize', handleVisualResize);
1165
+ }
1166
+ const NumberFieldScrubArea_NumberFieldScrubArea = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
1167
+ const { render, className, direction = 'horizontal', pixelSensitivity = 2, teleportDistance, style, ...elementProps } = componentProps;
1168
+ const { state, setIsScrubbing: setRootScrubbing, disabled, readOnly, inputRef, incrementValue, allowInputSyncRef, getStepAmount, onValueCommitted, lastChangedValueRef, valueRef } = useNumberFieldRootContext();
1169
+ const scrubAreaRef = __rspack_external_react.useRef(null);
1170
+ const isScrubbingRef = __rspack_external_react.useRef(false);
1171
+ const didMoveRef = __rspack_external_react.useRef(false);
1172
+ const pointerDownTargetRef = __rspack_external_react.useRef(null);
1173
+ const scrubAreaCursorRef = __rspack_external_react.useRef(null);
1174
+ const virtualCursorCoords = __rspack_external_react.useRef({
1175
+ x: 0,
1176
+ y: 0
1177
+ });
1178
+ const visualScaleRef = __rspack_external_react.useRef(1);
1179
+ const exitPointerLockTimeout = useTimeout();
1180
+ const [isTouchInput, setIsTouchInput] = __rspack_external_react.useState(false);
1181
+ const [isPointerLockDenied, setIsPointerLockDenied] = __rspack_external_react.useState(false);
1182
+ const [isScrubbing, setIsScrubbing] = __rspack_external_react.useState(false);
1183
+ __rspack_external_react.useEffect(()=>{
1184
+ if (!isScrubbing || !scrubAreaCursorRef.current) return;
1185
+ return subscribeToVisualViewportResize(scrubAreaCursorRef.current, visualScaleRef);
1186
+ }, [
1187
+ isScrubbing
1188
+ ]);
1189
+ function updateCursorTransform(x, y) {
1190
+ if (scrubAreaCursorRef.current) scrubAreaCursorRef.current.style.transform = `translate3d(${x}px,${y}px,0) scale(${1 / visualScaleRef.current})`;
1191
+ }
1192
+ const onScrub = useStableCallback(({ movementX, movementY })=>{
1193
+ const virtualCursor = scrubAreaCursorRef.current;
1194
+ const scrubAreaEl = scrubAreaRef.current;
1195
+ if (!virtualCursor || !scrubAreaEl) return;
1196
+ const rect = getViewportRect(teleportDistance, scrubAreaEl);
1197
+ const coords = virtualCursorCoords.current;
1198
+ const newCoords = {
1199
+ x: Math.round(coords.x + movementX),
1200
+ y: Math.round(coords.y + movementY)
1201
+ };
1202
+ const cursorWidth = virtualCursor.offsetWidth;
1203
+ const cursorHeight = virtualCursor.offsetHeight;
1204
+ if (newCoords.x + cursorWidth / 2 < rect.x) newCoords.x = rect.width - cursorWidth / 2;
1205
+ else if (newCoords.x + cursorWidth / 2 > rect.width) newCoords.x = rect.x - cursorWidth / 2;
1206
+ if (newCoords.y + cursorHeight / 2 < rect.y) newCoords.y = rect.height - cursorHeight / 2;
1207
+ else if (newCoords.y + cursorHeight / 2 > rect.height) newCoords.y = rect.y - cursorHeight / 2;
1208
+ virtualCursorCoords.current = newCoords;
1209
+ updateCursorTransform(newCoords.x, newCoords.y);
1210
+ });
1211
+ const onScrubbingChange = useStableCallback((scrubbingValue, { clientX, clientY })=>{
1212
+ __rspack_external_react_dom_7136dc57.flushSync(()=>{
1213
+ setIsScrubbing(scrubbingValue);
1214
+ setRootScrubbing(scrubbingValue);
1215
+ });
1216
+ const virtualCursor = scrubAreaCursorRef.current;
1217
+ if (!virtualCursor || !scrubbingValue) return;
1218
+ const initialCoords = {
1219
+ x: clientX - virtualCursor.offsetWidth / 2,
1220
+ y: clientY - virtualCursor.offsetHeight / 2
1221
+ };
1222
+ virtualCursorCoords.current = initialCoords;
1223
+ updateCursorTransform(initialCoords.x, initialCoords.y);
1224
+ });
1225
+ __rspack_external_react.useEffect(function() {
1226
+ if (!inputRef.current || disabled || readOnly || !isScrubbing) return;
1227
+ let cumulativeDelta = 0;
1228
+ function handleScrubPointerUp(event) {
1229
+ function handler() {
1230
+ try {
1231
+ ownerDocument(scrubAreaRef.current).exitPointerLock();
1232
+ } catch {} finally{
1233
+ isScrubbingRef.current = false;
1234
+ onScrubbingChange(false, event);
1235
+ onValueCommitted(lastChangedValueRef.current ?? valueRef.current, createGenericEventDetails("scrub", event));
1236
+ const pointerDownTarget = pointerDownTargetRef.current;
1237
+ const input = inputRef.current;
1238
+ if (!didMoveRef.current && null != pointerDownTarget && input) pointerDownTarget.dispatchEvent(new (getWindow(input)).MouseEvent('click', {
1239
+ bubbles: true,
1240
+ cancelable: true
1241
+ }));
1242
+ didMoveRef.current = false;
1243
+ pointerDownTargetRef.current = null;
1244
+ }
1245
+ }
1246
+ if (isFirefox) exitPointerLockTimeout.start(20, handler);
1247
+ else handler();
1248
+ }
1249
+ function handleScrubPointerMove(event) {
1250
+ if (!isScrubbingRef.current) return;
1251
+ event.preventDefault();
1252
+ onScrub(event);
1253
+ const { movementX, movementY } = event;
1254
+ cumulativeDelta += 'vertical' === direction ? movementY : movementX;
1255
+ if (Math.abs(cumulativeDelta) >= pixelSensitivity) {
1256
+ cumulativeDelta = 0;
1257
+ didMoveRef.current = true;
1258
+ const dValue = 'vertical' === direction ? -movementY : movementX;
1259
+ const stepAmount = getStepAmount(event) ?? 1;
1260
+ const rawAmount = dValue * stepAmount;
1261
+ if (0 !== rawAmount) {
1262
+ allowInputSyncRef.current = true;
1263
+ incrementValue(Math.abs(rawAmount), {
1264
+ direction: rawAmount >= 0 ? 1 : -1,
1265
+ event,
1266
+ reason: "scrub"
1267
+ });
1268
+ }
1269
+ }
1270
+ }
1271
+ const win = getWindow(inputRef.current);
1272
+ const unsubscribe = mergeCleanups(addEventListener(win, 'pointerup', handleScrubPointerUp, true), addEventListener(win, 'pointermove', handleScrubPointerMove, true));
1273
+ return ()=>{
1274
+ exitPointerLockTimeout.clear();
1275
+ unsubscribe();
1276
+ };
1277
+ }, [
1278
+ disabled,
1279
+ readOnly,
1280
+ allowInputSyncRef,
1281
+ incrementValue,
1282
+ isScrubbing,
1283
+ getStepAmount,
1284
+ inputRef,
1285
+ onScrubbingChange,
1286
+ onScrub,
1287
+ direction,
1288
+ pixelSensitivity,
1289
+ lastChangedValueRef,
1290
+ onValueCommitted,
1291
+ valueRef,
1292
+ exitPointerLockTimeout
1293
+ ]);
1294
+ __rspack_external_react.useEffect(function() {
1295
+ const element = scrubAreaRef.current;
1296
+ if (!element || disabled || readOnly) return;
1297
+ function handleTouchStart(event) {
1298
+ if (1 === event.touches.length) event.preventDefault();
1299
+ }
1300
+ return addEventListener(element, 'touchstart', handleTouchStart);
1301
+ }, [
1302
+ disabled,
1303
+ readOnly
1304
+ ]);
1305
+ const defaultProps = {
1306
+ role: 'presentation',
1307
+ style: {
1308
+ touchAction: 'none',
1309
+ WebkitUserSelect: 'none',
1310
+ userSelect: 'none'
1311
+ },
1312
+ async onPointerDown (event) {
1313
+ const isMainButton = !event.button || 0 === event.button;
1314
+ if (event.defaultPrevented || readOnly || !isMainButton || disabled) return;
1315
+ const isTouch = 'touch' === event.pointerType;
1316
+ setIsTouchInput(isTouch);
1317
+ if ('mouse' === event.pointerType) {
1318
+ event.preventDefault();
1319
+ inputRef.current?.focus();
1320
+ }
1321
+ isScrubbingRef.current = true;
1322
+ didMoveRef.current = false;
1323
+ pointerDownTargetRef.current = getTarget(event.nativeEvent);
1324
+ onScrubbingChange(true, event.nativeEvent);
1325
+ if (!isTouch && !isWebKit) try {
1326
+ await ownerDocument(scrubAreaRef.current).body.requestPointerLock();
1327
+ setIsPointerLockDenied(false);
1328
+ } catch (error) {
1329
+ setIsPointerLockDenied(true);
1330
+ } finally{
1331
+ if (isScrubbingRef.current) __rspack_external_react_dom_7136dc57.flushSync(()=>{
1332
+ onScrubbingChange(true, event.nativeEvent);
1333
+ });
1334
+ }
1335
+ }
1336
+ };
1337
+ const element = useRenderElement('span', componentProps, {
1338
+ ref: [
1339
+ forwardedRef,
1340
+ scrubAreaRef
1341
+ ],
1342
+ state,
1343
+ props: [
1344
+ defaultProps,
1345
+ elementProps
1346
+ ],
1347
+ stateAttributesMapping: stateAttributesMapping
1348
+ });
1349
+ const contextValue = __rspack_external_react.useMemo(()=>({
1350
+ isScrubbing,
1351
+ isTouchInput,
1352
+ isPointerLockDenied,
1353
+ scrubAreaCursorRef,
1354
+ scrubAreaRef,
1355
+ direction,
1356
+ pixelSensitivity,
1357
+ teleportDistance
1358
+ }), [
1359
+ isScrubbing,
1360
+ isTouchInput,
1361
+ isPointerLockDenied,
1362
+ direction,
1363
+ pixelSensitivity,
1364
+ teleportDistance
1365
+ ]);
1366
+ return /*#__PURE__*/ jsx(NumberFieldScrubAreaContext.Provider, {
1367
+ value: contextValue,
1368
+ children: element
1369
+ });
1370
+ });
1371
+ if ("production" !== process.env.NODE_ENV) NumberFieldScrubArea_NumberFieldScrubArea.displayName = "NumberFieldScrubArea";
1372
+ const NumberFieldScrubAreaCursor_NumberFieldScrubAreaCursor = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
1373
+ const { render, className, style, ...elementProps } = componentProps;
1374
+ const { state } = useNumberFieldRootContext();
1375
+ const { isScrubbing, isTouchInput, isPointerLockDenied, scrubAreaCursorRef } = useNumberFieldScrubAreaContext();
1376
+ const [domElement, setDomElement] = __rspack_external_react.useState(null);
1377
+ const shouldRender = isScrubbing && !isWebKit && !isTouchInput && !isPointerLockDenied;
1378
+ const element = useRenderElement('span', componentProps, {
1379
+ enabled: shouldRender,
1380
+ ref: [
1381
+ forwardedRef,
1382
+ scrubAreaCursorRef,
1383
+ setDomElement
1384
+ ],
1385
+ state,
1386
+ props: [
1387
+ {
1388
+ role: 'presentation',
1389
+ style: {
1390
+ position: 'fixed',
1391
+ top: 0,
1392
+ left: 0,
1393
+ pointerEvents: 'none'
1394
+ }
1395
+ },
1396
+ elementProps
1397
+ ],
1398
+ stateAttributesMapping: stateAttributesMapping
1399
+ });
1400
+ return element && /*#__PURE__*/ __rspack_external_react_dom_7136dc57.createPortal(element, ownerDocument(domElement).body);
1401
+ });
1402
+ if ("production" !== process.env.NODE_ENV) NumberFieldScrubAreaCursor_NumberFieldScrubAreaCursor.displayName = "NumberFieldScrubAreaCursor";
5
1403
  const NumberField_module = {
6
1404
  root: "root-XA6trs",
7
1405
  group: "group-lqMZOf",
@@ -10,42 +1408,42 @@ const NumberField_module = {
10
1408
  decrement: "decrement-zkpqlA",
11
1409
  scrubArea: "scrubArea-XsXHM_"
12
1410
  };
13
- const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberField.Root, {
1411
+ const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberFieldRoot_NumberFieldRoot, {
14
1412
  ref: ref,
15
1413
  className: clsx(NumberField_module.root, className),
16
1414
  ...props
17
1415
  }));
18
- const Group = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberField.Group, {
1416
+ const Group = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberFieldGroup_NumberFieldGroup, {
19
1417
  ref: ref,
20
1418
  className: clsx(NumberField_module.group, className),
21
1419
  ...props
22
1420
  }));
23
- const Increment = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberField.Increment, {
1421
+ const Increment = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberFieldIncrement_NumberFieldIncrement, {
24
1422
  ref: ref,
25
1423
  className: clsx(NumberField_module.increment, className),
26
1424
  ...props
27
1425
  }));
28
- const Decrement = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberField.Decrement, {
1426
+ const Decrement = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberFieldDecrement_NumberFieldDecrement, {
29
1427
  ref: ref,
30
1428
  className: clsx(NumberField_module.decrement, className),
31
1429
  ...props
32
1430
  }));
33
- const Input = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberField.Input, {
1431
+ const Input = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberFieldInput_NumberFieldInput, {
34
1432
  ref: ref,
35
1433
  className: clsx(NumberField_module.input, className),
36
1434
  ...props
37
1435
  }));
38
- const ScrubArea = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberField.ScrubArea, {
1436
+ const ScrubArea = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberFieldScrubArea_NumberFieldScrubArea, {
39
1437
  ref: ref,
40
1438
  className: clsx(NumberField_module.scrubArea, className),
41
1439
  ...props
42
1440
  }));
43
- const ScrubAreaCursor = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberField.ScrubAreaCursor, {
1441
+ const ScrubAreaCursor = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NumberFieldScrubAreaCursor_NumberFieldScrubAreaCursor, {
44
1442
  ref: ref,
45
1443
  className: clsx(NumberField_module.scrubAreaCursor, className),
46
1444
  ...props
47
1445
  }));
48
- const NumberField_NumberField = {
1446
+ const NumberField = {
49
1447
  Root: Root,
50
1448
  Group: Group,
51
1449
  Increment: Increment,
@@ -54,4 +1452,4 @@ const NumberField_NumberField = {
54
1452
  ScrubArea: ScrubArea,
55
1453
  ScrubAreaCursor: ScrubAreaCursor
56
1454
  };
57
- export { NumberField_NumberField as NumberField };
1455
+ export { NumberField };