@yamada-ui/number-input 1.1.16-next-20241005220055 → 1.1.16-next-20241008193728

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,10 +2,10 @@
2
2
 
3
3
  // src/number-input.tsx
4
4
  import {
5
- ui,
6
5
  forwardRef,
7
- useComponentMultiStyle,
8
- omitThemeProps
6
+ omitThemeProps,
7
+ ui,
8
+ useComponentMultiStyle
9
9
  } from "@yamada-ui/core";
10
10
  import {
11
11
  formControlProperties,
@@ -29,8 +29,7 @@ import {
29
29
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
30
30
  import { jsx, jsxs } from "react/jsx-runtime";
31
31
  var isDefaultValidCharacter = (character) => /^[Ee0-9+\-.]$/.test(character);
32
- var isValidNumericKeyboardEvent = ({ key, ctrlKey, altKey, metaKey }, isValid) => {
33
- if (key == null) return true;
32
+ var isValidNumericKeyboardEvent = ({ key, altKey, ctrlKey, metaKey }, isValid) => {
34
33
  const isModifierKey = ctrlKey || altKey || metaKey;
35
34
  const isSingleCharacterKey = key.length === 1;
36
35
  if (!isSingleCharacterKey || isModifierKey) return true;
@@ -38,8 +37,8 @@ var isValidNumericKeyboardEvent = ({ key, ctrlKey, altKey, metaKey }, isValid) =
38
37
  };
39
38
  var getStep = ({
40
39
  ctrlKey,
41
- shiftKey,
42
- metaKey
40
+ metaKey,
41
+ shiftKey
43
42
  }) => {
44
43
  let ratio = 1;
45
44
  if (metaKey || ctrlKey) ratio = 0.1;
@@ -50,33 +49,33 @@ var useNumberInput = (props = {}) => {
50
49
  const {
51
50
  id,
52
51
  name,
53
- value: valueProp,
52
+ allowMouseWheel,
53
+ clampValueOnBlur = true,
54
54
  defaultValue,
55
- inputMode = "decimal",
56
- pattern = "[0-9]*(.[0-9]+)?",
57
55
  focusInputOnChange = true,
58
- clampValueOnBlur = true,
56
+ format: formatProp,
57
+ getAriaValueText: getAriaValueTextProp,
58
+ inputMode = "decimal",
59
+ isValidCharacter: isValidCharacterProp,
59
60
  keepWithinRange = true,
60
- allowMouseWheel,
61
- min = Number.MIN_SAFE_INTEGER,
62
61
  max = Number.MAX_SAFE_INTEGER,
63
- step: stepProp,
64
- precision,
62
+ min = Number.MIN_SAFE_INTEGER,
65
63
  parse: parseProp,
66
- format: formatProp,
67
- onInvalid: onInvalidProp,
68
- isValidCharacter: isValidCharacterProp,
69
- getAriaValueText: getAriaValueTextProp,
64
+ pattern = "[0-9]*(.[0-9]+)?",
65
+ precision,
66
+ step: stepProp,
67
+ value: valueProp,
70
68
  onChange: onChangeProp,
69
+ onInvalid: onInvalidProp,
71
70
  ...rest
72
71
  } = useFormControlProps(props);
73
72
  const {
74
- required,
73
+ "aria-invalid": isInvalid,
75
74
  disabled,
76
75
  readOnly,
77
- "aria-invalid": isInvalid,
78
- onFocus: onFocusProp,
76
+ required,
79
77
  onBlur: onBlurProp,
78
+ onFocus: onFocusProp,
80
79
  ...formControlProps
81
80
  } = pickObject(rest, formControlProperties);
82
81
  const isRequired = required;
@@ -90,11 +89,11 @@ var useNumberInput = (props = {}) => {
90
89
  const decrementRef = useRef(null);
91
90
  const onFocus = useCallbackRef(
92
91
  handlerAll(onFocusProp, (ev) => {
93
- var _a, _b, _c;
92
+ var _a, _b;
94
93
  setFocused(true);
95
94
  if (!inputSelectionRef.current) return;
96
- ev.target.selectionStart = (_b = inputSelectionRef.current.start) != null ? _b : (_a = ev.currentTarget.value) == null ? void 0 : _a.length;
97
- ev.currentTarget.selectionEnd = (_c = inputSelectionRef.current.end) != null ? _c : ev.currentTarget.selectionStart;
95
+ ev.target.selectionStart = (_a = inputSelectionRef.current.start) != null ? _a : ev.currentTarget.value.length;
96
+ ev.currentTarget.selectionEnd = (_b = inputSelectionRef.current.end) != null ? _b : ev.currentTarget.selectionStart;
98
97
  })
99
98
  );
100
99
  const onBlur = useCallbackRef(
@@ -109,27 +108,27 @@ var useNumberInput = (props = {}) => {
109
108
  isValidCharacterProp != null ? isValidCharacterProp : isDefaultValidCharacter
110
109
  );
111
110
  const {
112
- isMin,
111
+ cast,
113
112
  isMax,
113
+ isMin,
114
114
  isOut,
115
- value,
116
- valueAsNumber,
117
115
  setValue,
118
116
  update,
119
- cast,
117
+ value,
118
+ valueAsNumber,
120
119
  ...counter
121
120
  } = useCounter({
122
- value: valueProp,
123
121
  defaultValue,
124
- step: stepProp,
125
- min,
122
+ keepWithinRange,
126
123
  max,
124
+ min,
127
125
  precision,
128
- keepWithinRange,
126
+ step: stepProp,
127
+ value: valueProp,
129
128
  onChange: onChangeProp
130
129
  });
131
130
  const valueText = useMemo(() => {
132
- let text = getAriaValueText == null ? void 0 : getAriaValueText(value);
131
+ let text = getAriaValueText(value);
133
132
  if (text != null) return text;
134
133
  text = value.toString();
135
134
  return !text ? void 0 : text;
@@ -182,8 +181,8 @@ var useNumberInput = (props = {}) => {
182
181
  const parsedInput = parse(ev.currentTarget.value);
183
182
  update(sanitize(parsedInput));
184
183
  inputSelectionRef.current = {
185
- start: ev.currentTarget.selectionStart,
186
- end: ev.currentTarget.selectionEnd
184
+ end: ev.currentTarget.selectionEnd,
185
+ start: ev.currentTarget.selectionStart
187
186
  };
188
187
  },
189
188
  [parse, update, sanitize]
@@ -195,10 +194,10 @@ var useNumberInput = (props = {}) => {
195
194
  ev.preventDefault();
196
195
  const step = getStep(ev) * (stepProp != null ? stepProp : 1);
197
196
  const keyMap = {
198
- ArrowUp: () => increment(step),
199
197
  ArrowDown: () => decrement(step),
200
- Home: () => update(min),
201
- End: () => update(max)
198
+ ArrowUp: () => increment(step),
199
+ End: () => update(max),
200
+ Home: () => update(min)
202
201
  };
203
202
  const action = keyMap[ev.key];
204
203
  if (!action) return;
@@ -207,7 +206,7 @@ var useNumberInput = (props = {}) => {
207
206
  },
208
207
  [decrement, increment, isValidCharacter, max, min, stepProp, update]
209
208
  );
210
- const { up, down, stop, isSpinning } = useSpinner(increment, decrement);
209
+ const { down, isSpinning, stop, up } = useSpinner(increment, decrement);
211
210
  useAttributeObserver(incrementRef, ["disabled"], isSpinning, stop);
212
211
  useAttributeObserver(decrementRef, ["disabled"], isSpinning, stop);
213
212
  const focusInput = useCallback(() => {
@@ -235,9 +234,9 @@ var useNumberInput = (props = {}) => {
235
234
  );
236
235
  useUpdateEffect(() => {
237
236
  if (valueAsNumber > max) {
238
- onInvalid == null ? void 0 : onInvalid("rangeOverflow", format(value), valueAsNumber);
237
+ onInvalid("rangeOverflow", format(value), valueAsNumber);
239
238
  } else if (valueAsNumber < min) {
240
- onInvalid == null ? void 0 : onInvalid("rangeOverflow", format(value), valueAsNumber);
239
+ onInvalid("rangeOverflow", format(value), valueAsNumber);
241
240
  }
242
241
  }, [valueAsNumber, value, format, onInvalid]);
243
242
  useSafeLayoutEffect(() => {
@@ -269,32 +268,32 @@ var useNumberInput = (props = {}) => {
269
268
  const getInputProps = useCallback(
270
269
  (props2 = {}, ref = null) => ({
271
270
  id,
272
- name,
273
271
  type: "text",
274
- role: "spinbutton",
272
+ name,
273
+ disabled,
275
274
  inputMode,
276
275
  pattern,
277
- required,
278
- disabled,
279
276
  readOnly,
277
+ required,
278
+ role: "spinbutton",
280
279
  ...formControlProps,
281
280
  ...props2,
282
- min,
283
- max,
284
- step: stepProp,
285
281
  ref: mergeRefs(inputRef, ref),
286
- value: format(value),
287
- "aria-valuemin": min,
282
+ "aria-invalid": ariaAttr(isInvalid != null ? isInvalid : isOut),
288
283
  "aria-valuemax": max,
284
+ "aria-valuemin": min,
289
285
  "aria-valuenow": Number.isNaN(valueAsNumber) ? void 0 : valueAsNumber,
290
286
  "aria-valuetext": valueText,
291
- "aria-invalid": ariaAttr(isInvalid != null ? isInvalid : isOut),
292
287
  autoComplete: "off",
293
288
  autoCorrect: "off",
289
+ max,
290
+ min,
291
+ step: stepProp,
292
+ value: format(value),
293
+ onBlur: handlerAll(props2.onBlur, onBlur),
294
294
  onChange: handlerAll(props2.onChange, onChange),
295
- onKeyDown: handlerAll(props2.onKeyDown, onKeyDown),
296
295
  onFocus: handlerAll(props2.onFocus, onFocus),
297
- onBlur: handlerAll(props2.onBlur, onBlur)
296
+ onKeyDown: handlerAll(props2.onKeyDown, onKeyDown)
298
297
  }),
299
298
  [
300
299
  id,
@@ -325,16 +324,16 @@ var useNumberInput = (props = {}) => {
325
324
  var _a;
326
325
  const trulyDisabled = disabled || keepWithinRange && isMax;
327
326
  return {
328
- required,
329
- readOnly,
330
327
  disabled: trulyDisabled,
328
+ readOnly,
329
+ required,
331
330
  ...formControlProps,
332
331
  ...props2,
332
+ ref: mergeRefs(ref, incrementRef),
333
333
  style: {
334
334
  ...props2.style,
335
335
  cursor: readOnly ? "not-allowed" : (_a = props2.style) == null ? void 0 : _a.cursor
336
336
  },
337
- ref: mergeRefs(ref, incrementRef),
338
337
  tabIndex: -1,
339
338
  onPointerDown: handlerAll(props2.onPointerDown, (ev) => {
340
339
  if (ev.button === 0 && !trulyDisabled) eventUp(ev);
@@ -359,16 +358,16 @@ var useNumberInput = (props = {}) => {
359
358
  var _a;
360
359
  const trulyDisabled = disabled || keepWithinRange && isMin;
361
360
  return {
362
- required,
363
- readOnly,
364
361
  disabled: trulyDisabled,
362
+ readOnly,
363
+ required,
365
364
  ...formControlProps,
366
365
  ...props2,
366
+ ref: mergeRefs(ref, decrementRef),
367
367
  style: {
368
368
  ...props2.style,
369
369
  cursor: readOnly ? "not-allowed" : (_a = props2.style) == null ? void 0 : _a.cursor
370
370
  },
371
- ref: mergeRefs(ref, decrementRef),
372
371
  tabIndex: -1,
373
372
  onPointerDown: handlerAll(props2.onPointerDown, (ev) => {
374
373
  if (ev.button === 0 && !trulyDisabled) eventDown(ev);
@@ -389,16 +388,16 @@ var useNumberInput = (props = {}) => {
389
388
  ]
390
389
  );
391
390
  return {
391
+ isDisabled,
392
+ isFocused,
393
+ isReadOnly,
394
+ isRequired,
392
395
  props: rest,
393
396
  value: format(value),
394
397
  valueAsNumber,
395
- isFocused,
396
- isRequired,
397
- isReadOnly,
398
- isDisabled,
399
- getInputProps,
398
+ getDecrementProps,
400
399
  getIncrementProps,
401
- getDecrementProps
400
+ getInputProps
402
401
  };
403
402
  };
404
403
  var INTERVAL = 50;
@@ -440,7 +439,7 @@ var useSpinner = (increment, decrement) => {
440
439
  useEffect(() => {
441
440
  return () => removeTimeout();
442
441
  }, []);
443
- return { up, down, stop, isSpinning };
442
+ return { down, isSpinning, stop, up };
444
443
  };
445
444
  var useAttributeObserver = (ref, attributeFilter, enabled, func) => {
446
445
  useEffect(() => {
@@ -453,13 +452,13 @@ var useAttributeObserver = (ref, attributeFilter, enabled, func) => {
453
452
  func();
454
453
  }
455
454
  });
456
- observer.observe(ref.current, { attributes: true, attributeFilter });
455
+ observer.observe(ref.current, { attributeFilter, attributes: true });
457
456
  return () => observer.disconnect();
458
457
  });
459
458
  };
460
459
  var [NumberInputContextProvider, useNumberInputContext] = createContext({
461
- strict: false,
462
- name: "NumberInputContext"
460
+ name: "NumberInputContext",
461
+ errorMessage: `useNumberInputContext returned is 'undefined'. Seems you forgot to wrap the components in "<NumberInput />"`
463
462
  });
464
463
  var NumberInput = forwardRef(
465
464
  (props, ref) => {
@@ -467,17 +466,17 @@ var NumberInput = forwardRef(
467
466
  const {
468
467
  className,
469
468
  isStepper = true,
470
- containerProps,
471
469
  addonProps,
472
- incrementProps,
470
+ containerProps,
473
471
  decrementProps,
472
+ incrementProps,
474
473
  ...computedProps
475
474
  } = omitThemeProps(mergedProps);
476
475
  const {
477
- getInputProps,
478
- getIncrementProps,
476
+ props: rest,
479
477
  getDecrementProps,
480
- props: rest
478
+ getIncrementProps,
479
+ getInputProps
481
480
  } = useNumberInput(computedProps);
482
481
  const css = {
483
482
  position: "relative",
@@ -487,7 +486,7 @@ var NumberInput = forwardRef(
487
486
  return /* @__PURE__ */ jsx(
488
487
  NumberInputContextProvider,
489
488
  {
490
- value: { getInputProps, getIncrementProps, getDecrementProps, styles },
489
+ value: { styles, getDecrementProps, getIncrementProps, getInputProps },
491
490
  children: /* @__PURE__ */ jsxs(
492
491
  ui.div,
493
492
  {
@@ -535,11 +534,11 @@ var NumberInputAddon = forwardRef(
535
534
  const css = {
536
535
  display: "flex",
537
536
  flexDirection: "column",
538
- position: "absolute",
539
- top: "0",
537
+ height: "calc(100% - 2px)",
540
538
  insetEnd: "0px",
541
539
  margin: "1px",
542
- height: "calc(100% - 2px)",
540
+ position: "absolute",
541
+ top: "0",
543
542
  zIndex: "fallback(yamcha, 1)",
544
543
  ...styles.addon
545
544
  };
@@ -559,19 +558,19 @@ NumberInputAddon.displayName = "NumberInputAddon";
559
558
  NumberInputAddon.__ui__ = "NumberInputAddon";
560
559
  var Stepper = ui("button", {
561
560
  baseStyle: {
562
- display: "flex",
563
- justifyContent: "center",
564
561
  alignItems: "center",
562
+ cursor: "pointer",
563
+ display: "flex",
565
564
  flex: 1,
566
- transitionProperty: "common",
565
+ justifyContent: "center",
566
+ lineHeight: "normal",
567
567
  transitionDuration: "normal",
568
- userSelect: "none",
569
- cursor: "pointer",
570
- lineHeight: "normal"
568
+ transitionProperty: "common",
569
+ userSelect: "none"
571
570
  }
572
571
  });
573
572
  var NumberIncrementStepper = forwardRef(({ className, children, ...rest }, ref) => {
574
- const { getIncrementProps, styles } = useNumberInputContext();
573
+ const { styles, getIncrementProps } = useNumberInputContext();
575
574
  const css = { ...styles.stepper };
576
575
  return /* @__PURE__ */ jsx(
577
576
  Stepper,
@@ -586,7 +585,7 @@ var NumberIncrementStepper = forwardRef(({ className, children, ...rest }, ref)
586
585
  NumberIncrementStepper.displayName = "NumberIncrementStepper";
587
586
  NumberIncrementStepper.__ui__ = "NumberIncrementStepper";
588
587
  var NumberDecrementStepper = forwardRef(({ className, children, ...rest }, ref) => {
589
- const { getDecrementProps, styles } = useNumberInputContext();
588
+ const { styles, getDecrementProps } = useNumberInputContext();
590
589
  const css = { ...styles.stepper };
591
590
  return /* @__PURE__ */ jsx(
592
591
  Stepper,
@@ -605,4 +604,4 @@ export {
605
604
  useNumberInput,
606
605
  NumberInput
607
606
  };
608
- //# sourceMappingURL=chunk-XNRNUDHZ.mjs.map
607
+ //# sourceMappingURL=chunk-OFYIJUE5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/number-input.tsx"],"sourcesContent":["import type {\n ColorModeToken,\n CSS,\n CSSUIObject,\n HTMLUIProps,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { UseFormControlProps } from \"@yamada-ui/form-control\"\nimport type { UseCounterProps } from \"@yamada-ui/use-counter\"\nimport type {\n ChangeEvent,\n InputHTMLAttributes,\n KeyboardEvent,\n KeyboardEventHandler,\n} from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport {\n formControlProperties,\n useFormControlProps,\n} from \"@yamada-ui/form-control\"\nimport { ChevronIcon } from \"@yamada-ui/icon\"\nimport { useCounter } from \"@yamada-ui/use-counter\"\nimport { useEventListener } from \"@yamada-ui/use-event-listener\"\nimport { useInterval } from \"@yamada-ui/use-interval\"\nimport {\n ariaAttr,\n createContext,\n cx,\n handlerAll,\n mergeRefs,\n pickObject,\n useCallbackRef,\n useSafeLayoutEffect,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst isDefaultValidCharacter = (character: string) =>\n /^[Ee0-9+\\-.]$/.test(character)\n\nconst isValidNumericKeyboardEvent = (\n { key, altKey, ctrlKey, metaKey }: KeyboardEvent,\n isValid: (key: string) => boolean,\n) => {\n const isModifierKey = ctrlKey || altKey || metaKey\n const isSingleCharacterKey = key.length === 1\n\n if (!isSingleCharacterKey || isModifierKey) return true\n\n return isValid(key)\n}\n\nconst getStep = <Y extends KeyboardEvent | WheelEvent>({\n ctrlKey,\n metaKey,\n shiftKey,\n}: Y) => {\n let ratio = 1\n\n if (metaKey || ctrlKey) ratio = 0.1\n\n if (shiftKey) ratio = 10\n\n return ratio\n}\n\ntype ValidityState = \"rangeOverflow\" | \"rangeUnderflow\"\n\nexport interface UseNumberInputProps\n extends UseFormControlProps<HTMLInputElement>,\n UseCounterProps {\n /**\n * The HTML `name` attribute used for forms.\n */\n name?: string\n /**\n * If `true`, the input's value will change based on mouse wheel.\n *\n * @default false\n */\n allowMouseWheel?: boolean\n /**\n * This controls the value update when you blur out of the input.\n * - If `true` and the value is greater than `max`, the value will be reset to `max`.\n * - Else, the value remains the same.\n *\n * @default true\n */\n clampValueOnBlur?: boolean\n /**\n * If `true`, the input will be focused as you increment or decrement the value with the stepper.\n *\n * @default true\n */\n focusInputOnChange?: boolean\n /**\n * If using a custom display format, this converts the default format to the custom format.\n */\n format?: (value: number | string) => number | string\n /**\n * This is used to format the value so that screen readers\n * can speak out a more human-friendly value.\n *\n * It is used to set the `aria-valuetext` property of the input.\n */\n getAriaValueText?: (value: number | string) => string | undefined\n /**\n * Hints at the type of data that might be entered by the user.\n * It also determines the type of keyboard shown to the user on mobile devices.\n *\n * @default 'decimal'\n */\n inputMode?: InputHTMLAttributes<any>[\"inputMode\"]\n /**\n * Whether the pressed key should be allowed in the input.\n * The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\\-.]$/.\n */\n isValidCharacter?: (value: string) => boolean\n /**\n * If using a custom display format, this converts the custom format to a format `parseFloat` understands.\n */\n parse?: (value: string) => string\n /**\n * The pattern used to check the <input> element's value against on form submission.\n *\n * @default '[0-9]*(.[0-9]+)?'\n */\n pattern?: InputHTMLAttributes<any>[\"pattern\"]\n /**\n * The callback invoked when invalid number is entered.\n */\n onInvalid?: (\n message: ValidityState,\n value: string,\n valueAsNumber: number,\n ) => void\n}\n\nexport const useNumberInput = (props: UseNumberInputProps = {}) => {\n const {\n id,\n name,\n allowMouseWheel,\n clampValueOnBlur = true,\n defaultValue,\n focusInputOnChange = true,\n format: formatProp,\n getAriaValueText: getAriaValueTextProp,\n inputMode = \"decimal\",\n isValidCharacter: isValidCharacterProp,\n keepWithinRange = true,\n max = Number.MAX_SAFE_INTEGER,\n min = Number.MIN_SAFE_INTEGER,\n parse: parseProp,\n pattern = \"[0-9]*(.[0-9]+)?\",\n precision,\n step: stepProp,\n value: valueProp,\n onChange: onChangeProp,\n onInvalid: onInvalidProp,\n ...rest\n } = useFormControlProps(props)\n const {\n \"aria-invalid\": isInvalid,\n disabled,\n readOnly,\n required,\n onBlur: onBlurProp,\n onFocus: onFocusProp,\n ...formControlProps\n } = pickObject(rest, formControlProperties)\n\n const isRequired = required\n const isReadOnly = readOnly\n const isDisabled = disabled\n\n const [isFocused, setFocused] = useState(false)\n const isInteractive = !(readOnly || disabled)\n\n const inputRef = useRef<HTMLInputElement>(null)\n const inputSelectionRef = useRef<{\n end: null | number\n start: null | number\n } | null>(null)\n const incrementRef = useRef<HTMLButtonElement>(null)\n const decrementRef = useRef<HTMLButtonElement>(null)\n\n const onFocus = useCallbackRef(\n handlerAll(onFocusProp, (ev) => {\n setFocused(true)\n\n if (!inputSelectionRef.current) return\n\n ev.target.selectionStart =\n inputSelectionRef.current.start ?? ev.currentTarget.value.length\n ev.currentTarget.selectionEnd =\n inputSelectionRef.current.end ?? ev.currentTarget.selectionStart\n }),\n )\n const onBlur = useCallbackRef(\n handlerAll(onBlurProp, () => {\n setFocused(false)\n\n if (clampValueOnBlur) validateAndClamp()\n }),\n )\n const onInvalid = useCallbackRef(onInvalidProp)\n const getAriaValueText = useCallbackRef(getAriaValueTextProp)\n const isValidCharacter = useCallbackRef(\n isValidCharacterProp ?? isDefaultValidCharacter,\n )\n\n const {\n cast,\n isMax,\n isMin,\n isOut,\n setValue,\n update,\n value,\n valueAsNumber,\n ...counter\n } = useCounter({\n defaultValue,\n keepWithinRange,\n max,\n min,\n precision,\n step: stepProp,\n value: valueProp,\n onChange: onChangeProp,\n })\n\n const valueText = useMemo(() => {\n let text = getAriaValueText(value)\n\n if (text != null) return text\n\n text = value.toString()\n\n return !text ? undefined : text\n }, [value, getAriaValueText])\n\n const sanitize = useCallback(\n (value: string) => value.split(\"\").filter(isValidCharacter).join(\"\"),\n [isValidCharacter],\n )\n\n const parse = useCallback(\n (value: string) => parseProp?.(value) ?? value,\n [parseProp],\n )\n\n const format = useCallback(\n (value: number | string) => (formatProp?.(value) ?? value).toString(),\n [formatProp],\n )\n\n const increment = useCallback(\n (step = stepProp ?? 1) => {\n if (isInteractive) counter.increment(step)\n },\n [isInteractive, counter, stepProp],\n )\n\n const decrement = useCallback(\n (step = stepProp ?? 1) => {\n if (isInteractive) counter.decrement(step)\n },\n [isInteractive, counter, stepProp],\n )\n\n const validateAndClamp = useCallback(() => {\n let next = value as number | string\n\n if (value === \"\") return\n\n const valueStartsWithE = /^[eE]/.test(value.toString())\n\n if (valueStartsWithE) {\n setValue(\"\")\n } else {\n if (valueAsNumber < min) next = min\n\n if (valueAsNumber > max) next = max\n\n cast(next)\n }\n }, [cast, max, min, setValue, value, valueAsNumber])\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if ((ev.nativeEvent as InputEvent).isComposing) return\n\n const parsedInput = parse(ev.currentTarget.value)\n\n update(sanitize(parsedInput))\n\n inputSelectionRef.current = {\n end: ev.currentTarget.selectionEnd,\n start: ev.currentTarget.selectionStart,\n }\n },\n [parse, update, sanitize],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (ev.nativeEvent.isComposing) return\n\n if (!isValidNumericKeyboardEvent(ev, isValidCharacter))\n ev.preventDefault()\n\n const step = getStep(ev) * (stepProp ?? 1)\n\n const keyMap: { [key: string]: KeyboardEventHandler } = {\n ArrowDown: () => decrement(step),\n ArrowUp: () => increment(step),\n End: () => update(max),\n Home: () => update(min),\n }\n\n const action = keyMap[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n action(ev)\n },\n [decrement, increment, isValidCharacter, max, min, stepProp, update],\n )\n\n const { down, isSpinning, stop, up } = useSpinner(increment, decrement)\n\n useAttributeObserver(incrementRef, [\"disabled\"], isSpinning, stop)\n useAttributeObserver(decrementRef, [\"disabled\"], isSpinning, stop)\n\n const focusInput = useCallback(() => {\n if (focusInputOnChange)\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n }, [focusInputOnChange])\n\n const eventUp = useCallback(\n (ev: any) => {\n ev.preventDefault()\n up()\n focusInput()\n },\n [focusInput, up],\n )\n\n const eventDown = useCallback(\n (ev: any) => {\n ev.preventDefault()\n down()\n focusInput()\n },\n [focusInput, down],\n )\n\n useUpdateEffect(() => {\n if (valueAsNumber > max) {\n onInvalid(\"rangeOverflow\", format(value), valueAsNumber)\n } else if (valueAsNumber < min) {\n onInvalid(\"rangeOverflow\", format(value), valueAsNumber)\n }\n }, [valueAsNumber, value, format, onInvalid])\n\n useSafeLayoutEffect(() => {\n if (!inputRef.current) return\n\n const notInSync = inputRef.current.value != value\n\n if (!notInSync) return\n\n const parsedInput = parse(inputRef.current.value)\n\n setValue(sanitize(parsedInput))\n }, [parse, sanitize])\n\n useEventListener(\n () => inputRef.current,\n \"wheel\",\n (ev) => {\n const ownerDocument = inputRef.current?.ownerDocument ?? document\n const isFocused = ownerDocument.activeElement === inputRef.current\n\n if (!allowMouseWheel || !isFocused) return\n\n ev.preventDefault()\n\n const step = getStep(ev as any) * (stepProp ?? 1)\n const direction = Math.sign(ev.deltaY)\n\n if (direction === -1) {\n increment(step)\n } else if (direction === 1) {\n decrement(step)\n }\n },\n { passive: false },\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}, ref = null) => ({\n id,\n type: \"text\",\n name,\n disabled,\n inputMode,\n pattern,\n readOnly,\n required,\n role: \"spinbutton\",\n ...formControlProps,\n ...props,\n ref: mergeRefs(inputRef, ref),\n \"aria-invalid\": ariaAttr(isInvalid ?? isOut),\n \"aria-valuemax\": max,\n \"aria-valuemin\": min,\n \"aria-valuenow\": Number.isNaN(valueAsNumber) ? undefined : valueAsNumber,\n \"aria-valuetext\": valueText,\n autoComplete: \"off\",\n autoCorrect: \"off\",\n max,\n min,\n step: stepProp,\n value: format(value),\n onBlur: handlerAll(props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onChange),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n id,\n name,\n inputMode,\n pattern,\n required,\n disabled,\n readOnly,\n formControlProps,\n min,\n max,\n stepProp,\n format,\n value,\n valueAsNumber,\n valueText,\n isInvalid,\n isOut,\n onChange,\n onKeyDown,\n onFocus,\n onBlur,\n ],\n )\n\n const getIncrementProps: PropGetter<\"button\"> = useCallback(\n (props = {}, ref = null) => {\n const trulyDisabled = disabled || (keepWithinRange && isMax)\n\n return {\n disabled: trulyDisabled,\n readOnly,\n required,\n ...formControlProps,\n ...props,\n ref: mergeRefs(ref, incrementRef),\n style: {\n ...props.style,\n cursor: readOnly ? \"not-allowed\" : props.style?.cursor,\n },\n tabIndex: -1,\n onPointerDown: handlerAll(props.onPointerDown, (ev) => {\n if (ev.button === 0 && !trulyDisabled) eventUp(ev)\n }),\n onPointerLeave: handlerAll(props.onPointerLeave, stop),\n onPointerUp: handlerAll(props.onPointerUp, stop),\n }\n },\n [\n disabled,\n keepWithinRange,\n isMax,\n required,\n readOnly,\n formControlProps,\n stop,\n eventUp,\n ],\n )\n\n const getDecrementProps: PropGetter<\"button\"> = useCallback(\n (props = {}, ref = null) => {\n const trulyDisabled = disabled || (keepWithinRange && isMin)\n\n return {\n disabled: trulyDisabled,\n readOnly,\n required,\n ...formControlProps,\n ...props,\n ref: mergeRefs(ref, decrementRef),\n style: {\n ...props.style,\n cursor: readOnly ? \"not-allowed\" : props.style?.cursor,\n },\n tabIndex: -1,\n onPointerDown: handlerAll(props.onPointerDown, (ev) => {\n if (ev.button === 0 && !trulyDisabled) eventDown(ev)\n }),\n onPointerLeave: handlerAll(props.onPointerLeave, stop),\n onPointerUp: handlerAll(props.onPointerUp, stop),\n }\n },\n [\n disabled,\n keepWithinRange,\n isMin,\n required,\n readOnly,\n formControlProps,\n stop,\n eventDown,\n ],\n )\n\n return {\n isDisabled,\n isFocused,\n isReadOnly,\n isRequired,\n props: rest,\n value: format(value),\n valueAsNumber,\n getDecrementProps,\n getIncrementProps,\n getInputProps,\n }\n}\n\nexport type UseNumberInputReturn = ReturnType<typeof useNumberInput>\n\nconst INTERVAL = 50\n\nconst DELAY = 300\n\ntype Action = \"decrement\" | \"increment\"\n\nconst useSpinner = (increment: Function, decrement: Function) => {\n const [isSpinning, setIsSpinning] = useState(false)\n const [action, setAction] = useState<Action | null>(null)\n const [isOnce, setIsOnce] = useState(true)\n const timeoutRef = useRef<any>(null)\n\n const removeTimeout = () => clearTimeout(timeoutRef.current)\n\n useInterval(\n () => {\n if (action === \"increment\") increment()\n\n if (action === \"decrement\") decrement()\n },\n isSpinning ? INTERVAL : null,\n )\n\n const up = useCallback(() => {\n if (isOnce) increment()\n\n timeoutRef.current = setTimeout(() => {\n setIsOnce(false)\n setIsSpinning(true)\n setAction(\"increment\")\n }, DELAY)\n }, [increment, isOnce])\n\n const down = useCallback(() => {\n if (isOnce) decrement()\n\n timeoutRef.current = setTimeout(() => {\n setIsOnce(false)\n setIsSpinning(true)\n setAction(\"decrement\")\n }, DELAY)\n }, [decrement, isOnce])\n\n const stop = useCallback(() => {\n setIsOnce(true)\n setIsSpinning(false)\n removeTimeout()\n }, [])\n\n useEffect(() => {\n return () => removeTimeout()\n }, [])\n\n return { down, isSpinning, stop, up }\n}\n\nconst useAttributeObserver = (\n ref: React.RefObject<HTMLElement | null>,\n attributeFilter: string[],\n enabled: boolean,\n func: () => void,\n) => {\n useEffect(() => {\n if (!ref.current || !enabled) return\n\n const ownerDocument = ref.current.ownerDocument.defaultView ?? window\n\n const observer = new ownerDocument.MutationObserver((changes) => {\n for (const { type, attributeName } of changes) {\n if (\n type === \"attributes\" &&\n attributeName &&\n attributeFilter.includes(attributeName)\n )\n func()\n }\n })\n\n observer.observe(ref.current, { attributeFilter, attributes: true })\n\n return () => observer.disconnect()\n })\n}\n\ninterface NumberInputOptions {\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * If `true`, display the addon for the number input.\n */\n isStepper?: boolean\n /**\n * Props for addon component.\n */\n addonProps?: HTMLUIProps\n /**\n * Props for container element.\n */\n containerProps?: HTMLUIProps\n /**\n * Props for decrement component.\n */\n decrementProps?: NumberDecrementStepperProps\n /**\n * Props for increment component.\n */\n incrementProps?: NumberIncrementStepperProps\n}\n\nexport interface NumberInputProps\n extends Omit<\n HTMLUIProps<\"input\">,\n | \"defaultValue\"\n | \"disabled\"\n | \"max\"\n | \"min\"\n | \"onChange\"\n | \"onInvalid\"\n | \"readOnly\"\n | \"required\"\n | \"size\"\n | \"step\"\n | \"value\"\n >,\n ThemeProps<\"NumberInput\">,\n Omit<UseNumberInputProps, \"disabled\" | \"readOnly\" | \"required\">,\n NumberInputOptions {}\n\ninterface NumberInputContext {\n styles: { [key: string]: CSSUIObject | undefined }\n getDecrementProps: PropGetter<\"button\">\n getIncrementProps: PropGetter<\"button\">\n getInputProps: PropGetter<\"input\">\n}\n\nconst [NumberInputContextProvider, useNumberInputContext] =\n createContext<NumberInputContext>({\n name: \"NumberInputContext\",\n errorMessage: `useNumberInputContext returned is 'undefined'. Seems you forgot to wrap the components in \"<NumberInput />\"`,\n })\n\n/**\n * `NumberInput` is a component used to obtain numeric input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/number-input\n */\nexport const NumberInput = forwardRef<NumberInputProps, \"input\">(\n (props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"NumberInput\", props)\n const {\n className,\n isStepper = true,\n addonProps,\n containerProps,\n decrementProps,\n incrementProps,\n ...computedProps\n } = omitThemeProps(mergedProps)\n const {\n props: rest,\n getDecrementProps,\n getIncrementProps,\n getInputProps,\n } = useNumberInput(computedProps)\n\n const css: CSSUIObject = {\n position: \"relative\",\n zIndex: 0,\n ...styles.container,\n }\n\n return (\n <NumberInputContextProvider\n value={{ styles, getDecrementProps, getIncrementProps, getInputProps }}\n >\n <ui.div\n className={cx(\"ui-number-input\", className)}\n __css={css}\n {...containerProps}\n >\n <NumberInputField {...getInputProps(rest, ref)} />\n\n {isStepper ? (\n <NumberInputAddon {...addonProps}>\n <NumberIncrementStepper {...incrementProps} />\n <NumberDecrementStepper {...decrementProps} />\n </NumberInputAddon>\n ) : null}\n </ui.div>\n </NumberInputContextProvider>\n )\n },\n)\n\nNumberInput.displayName = \"NumberInput\"\nNumberInput.__ui__ = \"NumberInput\"\n\ntype NumberInputFieldProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"readOnly\" | \"required\" | \"size\"\n>\n\nconst NumberInputField = forwardRef<NumberInputFieldProps, \"input\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useNumberInputContext()\n\n const css: CSSUIObject = {\n width: \"100%\",\n ...styles.field,\n }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-number-input__field\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nNumberInputField.displayName = \"NumberInputField\"\nNumberInputField.__ui__ = \"NumberInputField\"\n\ntype NumberInputAddonProps = HTMLUIProps\n\nconst NumberInputAddon = forwardRef<NumberInputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useNumberInputContext()\n\n const css: CSSUIObject = {\n display: \"flex\",\n flexDirection: \"column\",\n height: \"calc(100% - 2px)\",\n insetEnd: \"0px\",\n margin: \"1px\",\n position: \"absolute\",\n top: \"0\",\n zIndex: \"fallback(yamcha, 1)\",\n ...styles.addon,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-number-input__addon\", className)}\n aria-hidden\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nNumberInputAddon.displayName = \"NumberInputAddon\"\nNumberInputAddon.__ui__ = \"NumberInputAddon\"\n\nconst Stepper = ui(\"button\", {\n baseStyle: {\n alignItems: \"center\",\n cursor: \"pointer\",\n display: \"flex\",\n flex: 1,\n justifyContent: \"center\",\n lineHeight: \"normal\",\n transitionDuration: \"normal\",\n transitionProperty: \"common\",\n userSelect: \"none\",\n },\n})\n\ntype NumberIncrementStepperProps = HTMLUIProps<\"button\">\n\nconst NumberIncrementStepper = forwardRef<\n NumberIncrementStepperProps,\n \"button\"\n>(({ className, children, ...rest }, ref) => {\n const { styles, getIncrementProps } = useNumberInputContext()\n\n const css: CSSUIObject = { ...styles.stepper }\n\n return (\n <Stepper\n className={cx(\"ui-number-input__stepper--up\", className)}\n {...getIncrementProps(rest, ref)}\n __css={css}\n >\n {children ?? <ChevronIcon __css={{ transform: \"rotate(180deg)\" }} />}\n </Stepper>\n )\n})\n\nNumberIncrementStepper.displayName = \"NumberIncrementStepper\"\nNumberIncrementStepper.__ui__ = \"NumberIncrementStepper\"\n\ntype NumberDecrementStepperProps = HTMLUIProps<\"button\">\n\nconst NumberDecrementStepper = forwardRef<\n NumberDecrementStepperProps,\n \"button\"\n>(({ className, children, ...rest }, ref) => {\n const { styles, getDecrementProps } = useNumberInputContext()\n\n const css: CSSUIObject = { ...styles.stepper }\n\n return (\n <Stepper\n className={cx(\"ui-number-input__stepper--down\", className)}\n {...getDecrementProps(rest, ref)}\n __css={css}\n >\n {children ?? <ChevronIcon />}\n </Stepper>\n )\n})\n\nNumberDecrementStepper.displayName = \"NumberDecrementStepper\"\nNumberDecrementStepper.__ui__ = \"NumberDecrementStepper\"\n"],"mappings":";;;AAgBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AAyrBxD,cAGE,YAHF;AAvrBV,IAAM,0BAA0B,CAAC,cAC/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