@xsolla/xui-counter 0.200.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.
@@ -0,0 +1,676 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Counter: () => Counter
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/Counter.tsx
38
+ var import_react2 = __toESM(require("react"));
39
+
40
+ // ../../foundation/primitives-native/src/Box.tsx
41
+ var import_react_native = require("react-native");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var roleToAccessibilityRole = {
44
+ button: "button",
45
+ link: "link",
46
+ img: "image",
47
+ image: "image",
48
+ summary: "summary",
49
+ switch: "switch",
50
+ checkbox: "checkbox",
51
+ radio: "radio",
52
+ heading: "header",
53
+ text: "text",
54
+ search: "search",
55
+ alert: "alert",
56
+ none: "none",
57
+ presentation: "none",
58
+ progressbar: "progressbar",
59
+ scrollbar: "scrollbar",
60
+ adjustable: "adjustable",
61
+ tab: "tab",
62
+ menu: "menu",
63
+ menuitem: "menuitem",
64
+ list: "list",
65
+ timer: "timer"
66
+ };
67
+ var toGapValue = (gap) => {
68
+ if (gap === void 0) return void 0;
69
+ if (typeof gap === "number") return gap;
70
+ const pxMatch = /^(\d+(?:\.\d+)?)px$/.exec(gap);
71
+ if (pxMatch) return Number(pxMatch[1]);
72
+ const asNumber = Number(gap);
73
+ return Number.isFinite(asNumber) ? asNumber : void 0;
74
+ };
75
+ var Box = ({
76
+ children,
77
+ onPress,
78
+ onLayout,
79
+ onMoveShouldSetResponder,
80
+ onResponderGrant,
81
+ onResponderMove,
82
+ onResponderRelease,
83
+ onResponderTerminate,
84
+ backgroundColor,
85
+ borderColor,
86
+ borderWidth,
87
+ borderBottomWidth,
88
+ borderBottomColor,
89
+ borderTopWidth,
90
+ borderTopColor,
91
+ borderLeftWidth,
92
+ borderLeftColor,
93
+ borderRightWidth,
94
+ borderRightColor,
95
+ borderRadius,
96
+ borderStyle,
97
+ height,
98
+ padding,
99
+ paddingHorizontal,
100
+ paddingVertical,
101
+ margin,
102
+ marginTop,
103
+ marginBottom,
104
+ marginLeft,
105
+ marginRight,
106
+ flexDirection,
107
+ flexWrap,
108
+ alignItems,
109
+ justifyContent,
110
+ alignSelf,
111
+ position,
112
+ top,
113
+ bottom,
114
+ left,
115
+ right,
116
+ width,
117
+ minWidth,
118
+ minHeight,
119
+ maxWidth,
120
+ maxHeight,
121
+ flex,
122
+ flexShrink,
123
+ gap,
124
+ overflow,
125
+ zIndex,
126
+ hoverStyle,
127
+ pressStyle,
128
+ style,
129
+ disabled,
130
+ "data-testid": dataTestId,
131
+ testID,
132
+ as,
133
+ src,
134
+ alt,
135
+ ...rest
136
+ }) => {
137
+ const getContainerStyle = (pressed) => ({
138
+ backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
139
+ borderColor,
140
+ borderWidth,
141
+ borderBottomWidth,
142
+ borderBottomColor,
143
+ borderTopWidth,
144
+ borderTopColor,
145
+ borderLeftWidth,
146
+ borderLeftColor,
147
+ borderRightWidth,
148
+ borderRightColor,
149
+ borderRadius,
150
+ borderStyle,
151
+ overflow,
152
+ zIndex,
153
+ height,
154
+ width,
155
+ minWidth,
156
+ minHeight,
157
+ maxWidth,
158
+ maxHeight,
159
+ padding,
160
+ paddingHorizontal,
161
+ paddingVertical,
162
+ margin,
163
+ marginTop,
164
+ marginBottom,
165
+ marginLeft,
166
+ marginRight,
167
+ flexDirection,
168
+ flexWrap,
169
+ alignItems,
170
+ justifyContent,
171
+ alignSelf,
172
+ position,
173
+ top,
174
+ bottom,
175
+ left,
176
+ right,
177
+ flex,
178
+ flexShrink,
179
+ gap: toGapValue(gap),
180
+ ...style
181
+ });
182
+ const finalTestID = dataTestId || testID;
183
+ const {
184
+ role,
185
+ tabIndex,
186
+ onKeyDown,
187
+ onKeyUp,
188
+ "aria-label": ariaLabel,
189
+ "aria-labelledby": _ariaLabelledBy,
190
+ "aria-current": _ariaCurrent,
191
+ "aria-disabled": ariaDisabled,
192
+ "aria-live": ariaLive,
193
+ "aria-busy": ariaBusy,
194
+ className,
195
+ "data-testid": _dataTestId,
196
+ cursor: _cursor,
197
+ type: _type,
198
+ ...nativeRest
199
+ } = rest;
200
+ const accessibilityRole = typeof role === "string" && roleToAccessibilityRole[role] || (as === "button" ? "button" : void 0);
201
+ const isDisabled = Boolean(disabled || ariaDisabled);
202
+ const accessibilityState = {
203
+ disabled: isDisabled || void 0,
204
+ busy: Boolean(ariaBusy) || void 0
205
+ };
206
+ const accessibilityLiveRegion = ariaLive === "polite" || ariaLive === "assertive" ? ariaLive : void 0;
207
+ if (as === "img" && src) {
208
+ const imageStyle = {
209
+ width,
210
+ height,
211
+ borderRadius,
212
+ position,
213
+ top,
214
+ bottom,
215
+ left,
216
+ right,
217
+ ...style
218
+ };
219
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
220
+ import_react_native.Image,
221
+ {
222
+ source: { uri: src },
223
+ style: imageStyle,
224
+ testID: finalTestID,
225
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : alt,
226
+ resizeMode: "cover",
227
+ ...nativeRest
228
+ }
229
+ );
230
+ }
231
+ if (onPress || as === "button") {
232
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
233
+ import_react_native.Pressable,
234
+ {
235
+ onPress: !isDisabled && onPress ? onPress : void 0,
236
+ disabled: isDisabled,
237
+ onLayout,
238
+ onMoveShouldSetResponder,
239
+ onResponderGrant,
240
+ onResponderMove,
241
+ onResponderRelease,
242
+ onResponderTerminate,
243
+ style: ({ pressed }) => getContainerStyle(pressed),
244
+ testID: finalTestID,
245
+ accessibilityRole,
246
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
247
+ accessibilityState,
248
+ accessibilityLiveRegion,
249
+ ...nativeRest,
250
+ children
251
+ }
252
+ );
253
+ }
254
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
255
+ import_react_native.View,
256
+ {
257
+ style: getContainerStyle(),
258
+ testID: finalTestID,
259
+ onLayout,
260
+ onMoveShouldSetResponder,
261
+ onResponderGrant,
262
+ onResponderMove,
263
+ onResponderRelease,
264
+ onResponderTerminate,
265
+ accessibilityRole,
266
+ accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
267
+ accessibilityState,
268
+ accessibilityLiveRegion,
269
+ ...nativeRest,
270
+ children
271
+ }
272
+ );
273
+ };
274
+
275
+ // ../../foundation/primitives-native/src/Text.tsx
276
+ var import_react_native2 = require("react-native");
277
+ var import_jsx_runtime2 = require("react/jsx-runtime");
278
+ var roleMap = {
279
+ alert: "alert",
280
+ heading: "header",
281
+ button: "button",
282
+ link: "link",
283
+ text: "text"
284
+ };
285
+ var parseNumericValue = (value) => {
286
+ if (value === void 0) return void 0;
287
+ if (typeof value === "number") return value;
288
+ const parsed = parseFloat(value);
289
+ return isNaN(parsed) ? void 0 : parsed;
290
+ };
291
+ var Text = ({
292
+ children,
293
+ color,
294
+ fontSize,
295
+ fontWeight,
296
+ fontFamily,
297
+ textAlign,
298
+ lineHeight,
299
+ numberOfLines,
300
+ id,
301
+ role,
302
+ testID,
303
+ "data-testid": dataTestId,
304
+ style: styleProp,
305
+ ...props
306
+ }) => {
307
+ let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
308
+ if (resolvedFontFamily === "Pilat Wide" || resolvedFontFamily === "Pilat Wide Bold" || resolvedFontFamily === "Aktiv Grotesk") {
309
+ resolvedFontFamily = void 0;
310
+ }
311
+ const incomingStyle = import_react_native2.StyleSheet.flatten(styleProp);
312
+ const baseStyle = {
313
+ color: color ?? incomingStyle?.color,
314
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
315
+ fontWeight,
316
+ fontFamily: resolvedFontFamily,
317
+ textDecorationLine: props.textDecoration,
318
+ textAlign: textAlign ?? incomingStyle?.textAlign,
319
+ lineHeight: parseNumericValue(lineHeight ?? incomingStyle?.lineHeight),
320
+ marginTop: parseNumericValue(
321
+ incomingStyle?.marginTop
322
+ ),
323
+ marginBottom: parseNumericValue(
324
+ incomingStyle?.marginBottom
325
+ )
326
+ };
327
+ const accessibilityRole = role ? roleMap[role] : void 0;
328
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
329
+ import_react_native2.Text,
330
+ {
331
+ style: baseStyle,
332
+ numberOfLines,
333
+ testID: dataTestId || testID || id,
334
+ accessibilityRole,
335
+ children
336
+ }
337
+ );
338
+ };
339
+
340
+ // ../../foundation/primitives-native/src/Icon.tsx
341
+ var import_react = __toESM(require("react"));
342
+ var import_react_native3 = require("react-native");
343
+ var import_jsx_runtime3 = require("react/jsx-runtime");
344
+ var Icon = ({
345
+ children,
346
+ color,
347
+ size,
348
+ testID,
349
+ "data-testid": dataTestId
350
+ }) => {
351
+ const style = {
352
+ width: typeof size === "number" ? size : void 0,
353
+ height: typeof size === "number" ? size : void 0,
354
+ alignItems: "center",
355
+ justifyContent: "center"
356
+ };
357
+ const childrenWithProps = import_react.default.Children.map(children, (child) => {
358
+ if (import_react.default.isValidElement(child)) {
359
+ return import_react.default.cloneElement(child, {
360
+ color: child.props.color || color,
361
+ // Also pass size if child seems to be an icon that needs it
362
+ size: child.props.size || size
363
+ });
364
+ }
365
+ return child;
366
+ });
367
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style, testID: dataTestId || testID, children: childrenWithProps });
368
+ };
369
+
370
+ // ../../foundation/primitives-native/src/index.tsx
371
+ var isWeb = false;
372
+
373
+ // src/Counter.tsx
374
+ var import_xui_core = require("@xsolla/xui-core");
375
+ var import_xui_input = require("@xsolla/xui-input");
376
+ var import_xui_icons_base = require("@xsolla/xui-icons-base");
377
+
378
+ // src/utils.ts
379
+ var COUNTER_SIZE_CONFIG = {
380
+ xl: { control: 28, gap: 10, inputWidth: 149, readOnlyWidth: 100 },
381
+ lg: { control: 24, gap: 10, inputWidth: 142, readOnlyWidth: 90 },
382
+ md: { control: 24, gap: 8, inputWidth: 132, readOnlyWidth: 83 },
383
+ sm: { control: 18, gap: 8, inputWidth: 92, readOnlyWidth: 69 },
384
+ xs: { control: 16, gap: 6, inputWidth: 82, readOnlyWidth: 59 }
385
+ };
386
+ var clampToRange = (value, min, max) => {
387
+ let next = value;
388
+ if (typeof min === "number" && next < min) next = min;
389
+ if (typeof max === "number" && next > max) next = max;
390
+ return next;
391
+ };
392
+ var sanitizeCounterInput = (raw, allowNegative) => {
393
+ const digitsAndSigns = raw.replace(/[^\d-]/g, "");
394
+ const digits = digitsAndSigns.replace(/-/g, "");
395
+ if (allowNegative && digitsAndSigns.startsWith("-")) {
396
+ return `-${digits}`;
397
+ }
398
+ return digits;
399
+ };
400
+ var parseCounterValue = (raw) => {
401
+ const trimmed = raw.trim();
402
+ if (trimmed === "" || trimmed === "-") return null;
403
+ const parsed = Number.parseInt(trimmed, 10);
404
+ return Number.isNaN(parsed) ? null : parsed;
405
+ };
406
+ var allowsNegative = (min) => typeof min !== "number" || min < 0;
407
+
408
+ // src/Counter.tsx
409
+ var import_jsx_runtime4 = require("react/jsx-runtime");
410
+ var CounterButton = ({
411
+ icon,
412
+ label,
413
+ onPress,
414
+ available,
415
+ boxSize,
416
+ borderRadius,
417
+ color,
418
+ hoverColor,
419
+ testID
420
+ }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
421
+ Box,
422
+ {
423
+ as: "button",
424
+ type: "button",
425
+ width: boxSize,
426
+ height: boxSize,
427
+ flexShrink: 0,
428
+ alignItems: "center",
429
+ justifyContent: "center",
430
+ padding: 0,
431
+ borderWidth: 0,
432
+ borderRadius,
433
+ backgroundColor: "transparent",
434
+ cursor: available ? "pointer" : "not-allowed",
435
+ disabled: !available,
436
+ "aria-disabled": !available || void 0,
437
+ "aria-label": label,
438
+ onPress,
439
+ hoverStyle: available ? { backgroundColor: hoverColor } : void 0,
440
+ ...isWeb && {
441
+ onMouseDown: (e) => e.preventDefault()
442
+ },
443
+ "data-testid": testID,
444
+ testID,
445
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { size: boxSize, color, children: icon })
446
+ }
447
+ );
448
+ var Counter = (0, import_react2.forwardRef)(
449
+ ({
450
+ value,
451
+ defaultValue = null,
452
+ onChange,
453
+ min,
454
+ max,
455
+ step = 1,
456
+ size = "md",
457
+ type = "input",
458
+ disabled = false,
459
+ label,
460
+ "aria-label": ariaLabel,
461
+ decrementLabel = "Decrease quantity",
462
+ incrementLabel = "Increase quantity",
463
+ name,
464
+ id: providedId,
465
+ testID,
466
+ themeMode,
467
+ themeProductContext
468
+ }, ref) => {
469
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
470
+ const rawId = (0, import_xui_core.useId)();
471
+ const safeId = rawId.replace(/:/g, "");
472
+ const counterId = providedId || `counter-${safeId}`;
473
+ const isControlled = value !== void 0;
474
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react2.useState)(
475
+ defaultValue
476
+ );
477
+ const committedValue = isControlled ? value ?? null : uncontrolledValue;
478
+ const [draft, setDraft] = (0, import_react2.useState)(null);
479
+ const inputRef = (0, import_react2.useRef)(null);
480
+ import_react2.default.useImperativeHandle(
481
+ ref,
482
+ () => inputRef.current,
483
+ []
484
+ );
485
+ const sizeConfig = COUNTER_SIZE_CONFIG[size];
486
+ const inputSizing = theme.sizing.input(size);
487
+ const isReadOnly = type === "readOnly";
488
+ const pendingValue = draft !== null ? parseCounterValue(draft) : committedValue;
489
+ const stepBase = pendingValue ?? min ?? 0;
490
+ const canDecrement = !disabled && (typeof min !== "number" || stepBase > min);
491
+ const canIncrement = !disabled && (typeof max !== "number" || stepBase < max);
492
+ const commit = (next) => {
493
+ setDraft(null);
494
+ const resolved = next ?? committedValue;
495
+ if (resolved === null) return;
496
+ const clamped = clampToRange(resolved, min, max);
497
+ if (!isControlled) setUncontrolledValue(clamped);
498
+ if (clamped !== committedValue) onChange?.(clamped);
499
+ };
500
+ const stepBy = (direction) => {
501
+ commit(clampToRange(stepBase + direction * step, min, max));
502
+ };
503
+ const handleInputChange = (e) => {
504
+ setDraft(sanitizeCounterInput(e.target.value, allowsNegative(min)));
505
+ };
506
+ const handleBlur = () => {
507
+ commit(draft !== null ? parseCounterValue(draft) : committedValue);
508
+ };
509
+ const handleKeyDown = (e) => {
510
+ if (e.key === "ArrowUp") {
511
+ e.preventDefault();
512
+ if (canIncrement) stepBy(1);
513
+ return;
514
+ }
515
+ if (e.key === "ArrowDown") {
516
+ e.preventDefault();
517
+ if (canDecrement) stepBy(-1);
518
+ return;
519
+ }
520
+ if (e.key === "Home" && typeof min === "number") {
521
+ e.preventDefault();
522
+ commit(min);
523
+ return;
524
+ }
525
+ if (e.key === "End" && typeof max === "number") {
526
+ e.preventDefault();
527
+ commit(max);
528
+ return;
529
+ }
530
+ if (e.key === "Enter" || e.key === "\n") {
531
+ e.preventDefault();
532
+ commit(draft !== null ? parseCounterValue(draft) : committedValue);
533
+ }
534
+ };
535
+ const enabledIconColor = theme.colors.content.secondary;
536
+ const disabledIconColor = theme.colors.control.text.disable;
537
+ const hoverColor = theme.colors.overlay.mono;
538
+ const buttonRadius = theme.shape.input[size].borderRadius;
539
+ const decrementButton = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
540
+ CounterButton,
541
+ {
542
+ icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_xui_icons_base.MinusSq, {}),
543
+ label: decrementLabel,
544
+ onPress: () => {
545
+ if (canDecrement) stepBy(-1);
546
+ },
547
+ available: canDecrement,
548
+ boxSize: sizeConfig.control,
549
+ borderRadius: buttonRadius,
550
+ color: canDecrement ? enabledIconColor : disabledIconColor,
551
+ hoverColor,
552
+ testID: testID ? `${testID}__decrement` : void 0
553
+ }
554
+ );
555
+ const incrementButton = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
556
+ CounterButton,
557
+ {
558
+ icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_xui_icons_base.PlusSq, {}),
559
+ label: incrementLabel,
560
+ onPress: () => {
561
+ if (canIncrement) stepBy(1);
562
+ },
563
+ available: canIncrement,
564
+ boxSize: sizeConfig.control,
565
+ borderRadius: buttonRadius,
566
+ color: canIncrement ? enabledIconColor : disabledIconColor,
567
+ hoverColor,
568
+ testID: testID ? `${testID}__increment` : void 0
569
+ }
570
+ );
571
+ const labelId = `${counterId}-label`;
572
+ const showLabel = Boolean(label) && !isReadOnly;
573
+ const labelNode = showLabel ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box, { as: "label", id: labelId, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
574
+ Text,
575
+ {
576
+ color: theme.colors.content.secondary,
577
+ fontSize: inputSizing.fontSize - 2,
578
+ fontWeight: "500",
579
+ children: label
580
+ }
581
+ ) }) : null;
582
+ if (isReadOnly) {
583
+ const readOnlyValue = String(committedValue ?? min ?? 0);
584
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
585
+ Box,
586
+ {
587
+ flexDirection: "row",
588
+ alignItems: "center",
589
+ gap: sizeConfig.gap,
590
+ width: sizeConfig.readOnlyWidth,
591
+ role: "group",
592
+ "aria-label": ariaLabel || label,
593
+ "aria-disabled": disabled || void 0,
594
+ "data-testid": testID,
595
+ children: [
596
+ decrementButton,
597
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box, { flex: 1, minWidth: 0, "aria-live": "polite", alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
598
+ Text,
599
+ {
600
+ color: disabled ? theme.colors.control.input.textDisable : theme.colors.control.input.text,
601
+ fontSize: inputSizing.fontSize,
602
+ lineHeight: inputSizing.fontSize + 2,
603
+ textAlign: "center",
604
+ "data-testid": testID ? `${testID}__value` : void 0,
605
+ children: readOnlyValue
606
+ }
607
+ ) }),
608
+ incrementButton
609
+ ]
610
+ }
611
+ );
612
+ }
613
+ const displayValue = draft !== null ? draft : committedValue === null ? "" : String(committedValue);
614
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
615
+ Box,
616
+ {
617
+ flexDirection: "column",
618
+ gap: inputSizing.fieldGap,
619
+ alignItems: "flex-start",
620
+ role: "group",
621
+ "aria-label": showLabel ? void 0 : ariaLabel,
622
+ "aria-labelledby": showLabel ? labelId : void 0,
623
+ "aria-disabled": disabled || void 0,
624
+ "data-testid": testID,
625
+ children: [
626
+ labelNode,
627
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
628
+ Box,
629
+ {
630
+ flexDirection: "row",
631
+ alignItems: "center",
632
+ gap: sizeConfig.gap,
633
+ width: sizeConfig.inputWidth,
634
+ children: [
635
+ decrementButton,
636
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box, { flex: 1, minWidth: 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
637
+ import_xui_input.Input,
638
+ {
639
+ ref: inputRef,
640
+ id: counterId,
641
+ name,
642
+ size,
643
+ value: displayValue,
644
+ disabled,
645
+ onChange: handleInputChange,
646
+ onBlur: handleBlur,
647
+ onKeyDown: handleKeyDown,
648
+ type: "text",
649
+ inputMode: "numeric",
650
+ role: "spinbutton",
651
+ "aria-valuenow": committedValue ?? void 0,
652
+ "aria-valuemin": min,
653
+ "aria-valuemax": max,
654
+ "aria-label": showLabel ? void 0 : ariaLabel,
655
+ ...showLabel ? { "aria-labelledby": labelId } : {},
656
+ style: { textAlign: "center" },
657
+ themeMode,
658
+ themeProductContext,
659
+ testID: testID ? `${testID}__input` : void 0
660
+ }
661
+ ) }),
662
+ incrementButton
663
+ ]
664
+ }
665
+ )
666
+ ]
667
+ }
668
+ );
669
+ }
670
+ );
671
+ Counter.displayName = "Counter";
672
+ // Annotate the CommonJS export names for ESM import in node:
673
+ 0 && (module.exports = {
674
+ Counter
675
+ });
676
+ //# sourceMappingURL=index.js.map