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

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,8 +35,7 @@ var import_utils = require("@yamada-ui/utils");
35
35
  var import_react = require("react");
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
37
37
  var isDefaultValidCharacter = (character) => /^[Ee0-9+\-.]$/.test(character);
38
- var isValidNumericKeyboardEvent = ({ key, ctrlKey, altKey, metaKey }, isValid) => {
39
- if (key == null) return true;
38
+ var isValidNumericKeyboardEvent = ({ key, altKey, ctrlKey, metaKey }, isValid) => {
40
39
  const isModifierKey = ctrlKey || altKey || metaKey;
41
40
  const isSingleCharacterKey = key.length === 1;
42
41
  if (!isSingleCharacterKey || isModifierKey) return true;
@@ -44,8 +43,8 @@ var isValidNumericKeyboardEvent = ({ key, ctrlKey, altKey, metaKey }, isValid) =
44
43
  };
45
44
  var getStep = ({
46
45
  ctrlKey,
47
- shiftKey,
48
- metaKey
46
+ metaKey,
47
+ shiftKey
49
48
  }) => {
50
49
  let ratio = 1;
51
50
  if (metaKey || ctrlKey) ratio = 0.1;
@@ -56,33 +55,33 @@ var useNumberInput = (props = {}) => {
56
55
  const {
57
56
  id,
58
57
  name,
59
- value: valueProp,
58
+ allowMouseWheel,
59
+ clampValueOnBlur = true,
60
60
  defaultValue,
61
- inputMode = "decimal",
62
- pattern = "[0-9]*(.[0-9]+)?",
63
61
  focusInputOnChange = true,
64
- clampValueOnBlur = true,
62
+ format: formatProp,
63
+ getAriaValueText: getAriaValueTextProp,
64
+ inputMode = "decimal",
65
+ isValidCharacter: isValidCharacterProp,
65
66
  keepWithinRange = true,
66
- allowMouseWheel,
67
- min = Number.MIN_SAFE_INTEGER,
68
67
  max = Number.MAX_SAFE_INTEGER,
69
- step: stepProp,
70
- precision,
68
+ min = Number.MIN_SAFE_INTEGER,
71
69
  parse: parseProp,
72
- format: formatProp,
73
- onInvalid: onInvalidProp,
74
- isValidCharacter: isValidCharacterProp,
75
- getAriaValueText: getAriaValueTextProp,
70
+ pattern = "[0-9]*(.[0-9]+)?",
71
+ precision,
72
+ step: stepProp,
73
+ value: valueProp,
76
74
  onChange: onChangeProp,
75
+ onInvalid: onInvalidProp,
77
76
  ...rest
78
77
  } = (0, import_form_control.useFormControlProps)(props);
79
78
  const {
80
- required,
79
+ "aria-invalid": isInvalid,
81
80
  disabled,
82
81
  readOnly,
83
- "aria-invalid": isInvalid,
84
- onFocus: onFocusProp,
82
+ required,
85
83
  onBlur: onBlurProp,
84
+ onFocus: onFocusProp,
86
85
  ...formControlProps
87
86
  } = (0, import_utils.pickObject)(rest, import_form_control.formControlProperties);
88
87
  const isRequired = required;
@@ -96,11 +95,11 @@ var useNumberInput = (props = {}) => {
96
95
  const decrementRef = (0, import_react.useRef)(null);
97
96
  const onFocus = (0, import_utils.useCallbackRef)(
98
97
  (0, import_utils.handlerAll)(onFocusProp, (ev) => {
99
- var _a, _b, _c;
98
+ var _a, _b;
100
99
  setFocused(true);
101
100
  if (!inputSelectionRef.current) return;
102
- ev.target.selectionStart = (_b = inputSelectionRef.current.start) != null ? _b : (_a = ev.currentTarget.value) == null ? void 0 : _a.length;
103
- ev.currentTarget.selectionEnd = (_c = inputSelectionRef.current.end) != null ? _c : ev.currentTarget.selectionStart;
101
+ ev.target.selectionStart = (_a = inputSelectionRef.current.start) != null ? _a : ev.currentTarget.value.length;
102
+ ev.currentTarget.selectionEnd = (_b = inputSelectionRef.current.end) != null ? _b : ev.currentTarget.selectionStart;
104
103
  })
105
104
  );
106
105
  const onBlur = (0, import_utils.useCallbackRef)(
@@ -115,27 +114,27 @@ var useNumberInput = (props = {}) => {
115
114
  isValidCharacterProp != null ? isValidCharacterProp : isDefaultValidCharacter
116
115
  );
117
116
  const {
118
- isMin,
117
+ cast,
119
118
  isMax,
119
+ isMin,
120
120
  isOut,
121
- value,
122
- valueAsNumber,
123
121
  setValue,
124
122
  update,
125
- cast,
123
+ value,
124
+ valueAsNumber,
126
125
  ...counter
127
126
  } = (0, import_use_counter.useCounter)({
128
- value: valueProp,
129
127
  defaultValue,
130
- step: stepProp,
131
- min,
128
+ keepWithinRange,
132
129
  max,
130
+ min,
133
131
  precision,
134
- keepWithinRange,
132
+ step: stepProp,
133
+ value: valueProp,
135
134
  onChange: onChangeProp
136
135
  });
137
136
  const valueText = (0, import_react.useMemo)(() => {
138
- let text = getAriaValueText == null ? void 0 : getAriaValueText(value);
137
+ let text = getAriaValueText(value);
139
138
  if (text != null) return text;
140
139
  text = value.toString();
141
140
  return !text ? void 0 : text;
@@ -188,8 +187,8 @@ var useNumberInput = (props = {}) => {
188
187
  const parsedInput = parse(ev.currentTarget.value);
189
188
  update(sanitize(parsedInput));
190
189
  inputSelectionRef.current = {
191
- start: ev.currentTarget.selectionStart,
192
- end: ev.currentTarget.selectionEnd
190
+ end: ev.currentTarget.selectionEnd,
191
+ start: ev.currentTarget.selectionStart
193
192
  };
194
193
  },
195
194
  [parse, update, sanitize]
@@ -201,10 +200,10 @@ var useNumberInput = (props = {}) => {
201
200
  ev.preventDefault();
202
201
  const step = getStep(ev) * (stepProp != null ? stepProp : 1);
203
202
  const keyMap = {
204
- ArrowUp: () => increment(step),
205
203
  ArrowDown: () => decrement(step),
206
- Home: () => update(min),
207
- End: () => update(max)
204
+ ArrowUp: () => increment(step),
205
+ End: () => update(max),
206
+ Home: () => update(min)
208
207
  };
209
208
  const action = keyMap[ev.key];
210
209
  if (!action) return;
@@ -213,7 +212,7 @@ var useNumberInput = (props = {}) => {
213
212
  },
214
213
  [decrement, increment, isValidCharacter, max, min, stepProp, update]
215
214
  );
216
- const { up, down, stop, isSpinning } = useSpinner(increment, decrement);
215
+ const { down, isSpinning, stop, up } = useSpinner(increment, decrement);
217
216
  useAttributeObserver(incrementRef, ["disabled"], isSpinning, stop);
218
217
  useAttributeObserver(decrementRef, ["disabled"], isSpinning, stop);
219
218
  const focusInput = (0, import_react.useCallback)(() => {
@@ -241,9 +240,9 @@ var useNumberInput = (props = {}) => {
241
240
  );
242
241
  (0, import_utils.useUpdateEffect)(() => {
243
242
  if (valueAsNumber > max) {
244
- onInvalid == null ? void 0 : onInvalid("rangeOverflow", format(value), valueAsNumber);
243
+ onInvalid("rangeOverflow", format(value), valueAsNumber);
245
244
  } else if (valueAsNumber < min) {
246
- onInvalid == null ? void 0 : onInvalid("rangeOverflow", format(value), valueAsNumber);
245
+ onInvalid("rangeOverflow", format(value), valueAsNumber);
247
246
  }
248
247
  }, [valueAsNumber, value, format, onInvalid]);
249
248
  (0, import_utils.useSafeLayoutEffect)(() => {
@@ -275,32 +274,32 @@ var useNumberInput = (props = {}) => {
275
274
  const getInputProps = (0, import_react.useCallback)(
276
275
  (props2 = {}, ref = null) => ({
277
276
  id,
278
- name,
279
277
  type: "text",
280
- role: "spinbutton",
278
+ name,
279
+ disabled,
281
280
  inputMode,
282
281
  pattern,
283
- required,
284
- disabled,
285
282
  readOnly,
283
+ required,
284
+ role: "spinbutton",
286
285
  ...formControlProps,
287
286
  ...props2,
288
- min,
289
- max,
290
- step: stepProp,
291
287
  ref: (0, import_utils.mergeRefs)(inputRef, ref),
292
- value: format(value),
293
- "aria-valuemin": min,
288
+ "aria-invalid": (0, import_utils.ariaAttr)(isInvalid != null ? isInvalid : isOut),
294
289
  "aria-valuemax": max,
290
+ "aria-valuemin": min,
295
291
  "aria-valuenow": Number.isNaN(valueAsNumber) ? void 0 : valueAsNumber,
296
292
  "aria-valuetext": valueText,
297
- "aria-invalid": (0, import_utils.ariaAttr)(isInvalid != null ? isInvalid : isOut),
298
293
  autoComplete: "off",
299
294
  autoCorrect: "off",
295
+ max,
296
+ min,
297
+ step: stepProp,
298
+ value: format(value),
299
+ onBlur: (0, import_utils.handlerAll)(props2.onBlur, onBlur),
300
300
  onChange: (0, import_utils.handlerAll)(props2.onChange, onChange),
301
- onKeyDown: (0, import_utils.handlerAll)(props2.onKeyDown, onKeyDown),
302
301
  onFocus: (0, import_utils.handlerAll)(props2.onFocus, onFocus),
303
- onBlur: (0, import_utils.handlerAll)(props2.onBlur, onBlur)
302
+ onKeyDown: (0, import_utils.handlerAll)(props2.onKeyDown, onKeyDown)
304
303
  }),
305
304
  [
306
305
  id,
@@ -331,16 +330,16 @@ var useNumberInput = (props = {}) => {
331
330
  var _a;
332
331
  const trulyDisabled = disabled || keepWithinRange && isMax;
333
332
  return {
334
- required,
335
- readOnly,
336
333
  disabled: trulyDisabled,
334
+ readOnly,
335
+ required,
337
336
  ...formControlProps,
338
337
  ...props2,
338
+ ref: (0, import_utils.mergeRefs)(ref, incrementRef),
339
339
  style: {
340
340
  ...props2.style,
341
341
  cursor: readOnly ? "not-allowed" : (_a = props2.style) == null ? void 0 : _a.cursor
342
342
  },
343
- ref: (0, import_utils.mergeRefs)(ref, incrementRef),
344
343
  tabIndex: -1,
345
344
  onPointerDown: (0, import_utils.handlerAll)(props2.onPointerDown, (ev) => {
346
345
  if (ev.button === 0 && !trulyDisabled) eventUp(ev);
@@ -365,16 +364,16 @@ var useNumberInput = (props = {}) => {
365
364
  var _a;
366
365
  const trulyDisabled = disabled || keepWithinRange && isMin;
367
366
  return {
368
- required,
369
- readOnly,
370
367
  disabled: trulyDisabled,
368
+ readOnly,
369
+ required,
371
370
  ...formControlProps,
372
371
  ...props2,
372
+ ref: (0, import_utils.mergeRefs)(ref, decrementRef),
373
373
  style: {
374
374
  ...props2.style,
375
375
  cursor: readOnly ? "not-allowed" : (_a = props2.style) == null ? void 0 : _a.cursor
376
376
  },
377
- ref: (0, import_utils.mergeRefs)(ref, decrementRef),
378
377
  tabIndex: -1,
379
378
  onPointerDown: (0, import_utils.handlerAll)(props2.onPointerDown, (ev) => {
380
379
  if (ev.button === 0 && !trulyDisabled) eventDown(ev);
@@ -395,16 +394,16 @@ var useNumberInput = (props = {}) => {
395
394
  ]
396
395
  );
397
396
  return {
397
+ isDisabled,
398
+ isFocused,
399
+ isReadOnly,
400
+ isRequired,
398
401
  props: rest,
399
402
  value: format(value),
400
403
  valueAsNumber,
401
- isFocused,
402
- isRequired,
403
- isReadOnly,
404
- isDisabled,
405
- getInputProps,
404
+ getDecrementProps,
406
405
  getIncrementProps,
407
- getDecrementProps
406
+ getInputProps
408
407
  };
409
408
  };
410
409
  var INTERVAL = 50;
@@ -446,7 +445,7 @@ var useSpinner = (increment, decrement) => {
446
445
  (0, import_react.useEffect)(() => {
447
446
  return () => removeTimeout();
448
447
  }, []);
449
- return { up, down, stop, isSpinning };
448
+ return { down, isSpinning, stop, up };
450
449
  };
451
450
  var useAttributeObserver = (ref, attributeFilter, enabled, func) => {
452
451
  (0, import_react.useEffect)(() => {
@@ -459,13 +458,13 @@ var useAttributeObserver = (ref, attributeFilter, enabled, func) => {
459
458
  func();
460
459
  }
461
460
  });
462
- observer.observe(ref.current, { attributes: true, attributeFilter });
461
+ observer.observe(ref.current, { attributeFilter, attributes: true });
463
462
  return () => observer.disconnect();
464
463
  });
465
464
  };
466
465
  var [NumberInputContextProvider, useNumberInputContext] = (0, import_utils.createContext)({
467
- strict: false,
468
- name: "NumberInputContext"
466
+ name: "NumberInputContext",
467
+ errorMessage: `useNumberInputContext returned is 'undefined'. Seems you forgot to wrap the components in "<NumberInput />"`
469
468
  });
470
469
  var NumberInput = (0, import_core.forwardRef)(
471
470
  (props, ref) => {
@@ -473,17 +472,17 @@ var NumberInput = (0, import_core.forwardRef)(
473
472
  const {
474
473
  className,
475
474
  isStepper = true,
476
- containerProps,
477
475
  addonProps,
478
- incrementProps,
476
+ containerProps,
479
477
  decrementProps,
478
+ incrementProps,
480
479
  ...computedProps
481
480
  } = (0, import_core.omitThemeProps)(mergedProps);
482
481
  const {
483
- getInputProps,
484
- getIncrementProps,
482
+ props: rest,
485
483
  getDecrementProps,
486
- props: rest
484
+ getIncrementProps,
485
+ getInputProps
487
486
  } = useNumberInput(computedProps);
488
487
  const css = {
489
488
  position: "relative",
@@ -493,7 +492,7 @@ var NumberInput = (0, import_core.forwardRef)(
493
492
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
494
493
  NumberInputContextProvider,
495
494
  {
496
- value: { getInputProps, getIncrementProps, getDecrementProps, styles },
495
+ value: { styles, getDecrementProps, getIncrementProps, getInputProps },
497
496
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
498
497
  import_core.ui.div,
499
498
  {
@@ -541,11 +540,11 @@ var NumberInputAddon = (0, import_core.forwardRef)(
541
540
  const css = {
542
541
  display: "flex",
543
542
  flexDirection: "column",
544
- position: "absolute",
545
- top: "0",
543
+ height: "calc(100% - 2px)",
546
544
  insetEnd: "0px",
547
545
  margin: "1px",
548
- height: "calc(100% - 2px)",
546
+ position: "absolute",
547
+ top: "0",
549
548
  zIndex: "fallback(yamcha, 1)",
550
549
  ...styles.addon
551
550
  };
@@ -565,19 +564,19 @@ NumberInputAddon.displayName = "NumberInputAddon";
565
564
  NumberInputAddon.__ui__ = "NumberInputAddon";
566
565
  var Stepper = (0, import_core.ui)("button", {
567
566
  baseStyle: {
568
- display: "flex",
569
- justifyContent: "center",
570
567
  alignItems: "center",
568
+ cursor: "pointer",
569
+ display: "flex",
571
570
  flex: 1,
572
- transitionProperty: "common",
571
+ justifyContent: "center",
572
+ lineHeight: "normal",
573
573
  transitionDuration: "normal",
574
- userSelect: "none",
575
- cursor: "pointer",
576
- lineHeight: "normal"
574
+ transitionProperty: "common",
575
+ userSelect: "none"
577
576
  }
578
577
  });
579
578
  var NumberIncrementStepper = (0, import_core.forwardRef)(({ className, children, ...rest }, ref) => {
580
- const { getIncrementProps, styles } = useNumberInputContext();
579
+ const { styles, getIncrementProps } = useNumberInputContext();
581
580
  const css = { ...styles.stepper };
582
581
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
583
582
  Stepper,
@@ -592,7 +591,7 @@ var NumberIncrementStepper = (0, import_core.forwardRef)(({ className, children,
592
591
  NumberIncrementStepper.displayName = "NumberIncrementStepper";
593
592
  NumberIncrementStepper.__ui__ = "NumberIncrementStepper";
594
593
  var NumberDecrementStepper = (0, import_core.forwardRef)(({ className, children, ...rest }, ref) => {
595
- const { getDecrementProps, styles } = useNumberInputContext();
594
+ const { styles, getDecrementProps } = useNumberInputContext();
596
595
  const css = { ...styles.stepper };
597
596
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
598
597
  Stepper,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/number-input.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useComponentMultiStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport type { UseFormControlProps } from \"@yamada-ui/form-control\"\nimport {\n formControlProperties,\n useFormControlProps,\n} from \"@yamada-ui/form-control\"\nimport { ChevronIcon } from \"@yamada-ui/icon\"\nimport type { UseCounterProps } from \"@yamada-ui/use-counter\"\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 type {\n ChangeEvent,\n InputHTMLAttributes,\n KeyboardEvent,\n KeyboardEventHandler,\n} from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nconst isDefaultValidCharacter = (character: string) =>\n /^[Ee0-9+\\-.]$/.test(character)\n\nconst isValidNumericKeyboardEvent = (\n { key, ctrlKey, altKey, metaKey }: KeyboardEvent,\n isValid: (key: string) => boolean,\n) => {\n if (key == null) return true\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 shiftKey,\n metaKey,\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 = \"rangeUnderflow\" | \"rangeOverflow\"\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 * 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 * 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 * 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 * 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's value will change based on mouse wheel.\n *\n * @default false\n */\n allowMouseWheel?: boolean\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 * 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: string | number) => string\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 * If using a custom display format, this converts the default format to the custom format.\n */\n format?: (value: string | number) => string | number\n}\n\nexport const useNumberInput = (props: UseNumberInputProps = {}) => {\n const {\n id,\n name,\n value: valueProp,\n defaultValue,\n inputMode = \"decimal\",\n pattern = \"[0-9]*(.[0-9]+)?\",\n focusInputOnChange = true,\n clampValueOnBlur = true,\n keepWithinRange = true,\n allowMouseWheel,\n min = Number.MIN_SAFE_INTEGER,\n max = Number.MAX_SAFE_INTEGER,\n step: stepProp,\n precision,\n parse: parseProp,\n format: formatProp,\n onInvalid: onInvalidProp,\n isValidCharacter: isValidCharacterProp,\n getAriaValueText: getAriaValueTextProp,\n onChange: onChangeProp,\n ...rest\n } = useFormControlProps(props)\n const {\n required,\n disabled,\n readOnly,\n \"aria-invalid\": isInvalid,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\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 start: number | null\n end: number | null\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 isMin,\n isMax,\n isOut,\n value,\n valueAsNumber,\n setValue,\n update,\n cast,\n ...counter\n } = useCounter({\n value: valueProp,\n defaultValue,\n step: stepProp,\n min,\n max,\n precision,\n keepWithinRange,\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: string | number) => (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 string | number\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 start: ev.currentTarget.selectionStart,\n end: ev.currentTarget.selectionEnd,\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 ArrowUp: () => increment(step),\n ArrowDown: () => decrement(step),\n Home: () => update(min),\n End: () => update(max),\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 { up, down, stop, isSpinning } = 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 name,\n type: \"text\",\n role: \"spinbutton\",\n inputMode,\n pattern,\n required,\n disabled,\n readOnly,\n ...formControlProps,\n ...props,\n min,\n max,\n step: stepProp,\n ref: mergeRefs(inputRef, ref),\n value: format(value),\n \"aria-valuemin\": min,\n \"aria-valuemax\": max,\n \"aria-valuenow\": Number.isNaN(valueAsNumber) ? undefined : valueAsNumber,\n \"aria-valuetext\": valueText,\n \"aria-invalid\": ariaAttr(isInvalid ?? isOut),\n autoComplete: \"off\",\n autoCorrect: \"off\",\n onChange: handlerAll(props.onChange, onChange),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n onFocus: handlerAll(props.onFocus, onFocus),\n onBlur: handlerAll(props.onBlur, onBlur),\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 required,\n readOnly,\n disabled: trulyDisabled,\n ...formControlProps,\n ...props,\n style: {\n ...props.style,\n cursor: readOnly ? \"not-allowed\" : props.style?.cursor,\n },\n ref: mergeRefs(ref, incrementRef),\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 required,\n readOnly,\n disabled: trulyDisabled,\n ...formControlProps,\n ...props,\n style: {\n ...props.style,\n cursor: readOnly ? \"not-allowed\" : props.style?.cursor,\n },\n ref: mergeRefs(ref, decrementRef),\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 props: rest,\n value: format(value),\n valueAsNumber,\n isFocused,\n isRequired,\n isReadOnly,\n isDisabled,\n getInputProps,\n getIncrementProps,\n getDecrementProps,\n }\n}\n\nexport type UseNumberInputReturn = ReturnType<typeof useNumberInput>\n\nconst INTERVAL = 50\n\nconst DELAY = 300\n\ntype Action = \"increment\" | \"decrement\"\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 { up, down, stop, isSpinning }\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, { attributes: true, attributeFilter })\n\n return () => observer.disconnect()\n })\n}\n\ninterface NumberInputOptions {\n /**\n * If `true`, display the addon for the number input.\n */\n isStepper?: boolean\n /**\n * Props for container element.\n */\n containerProps?: HTMLUIProps\n /**\n * Props for addon component.\n */\n addonProps?: HTMLUIProps\n /**\n * Props for increment component.\n */\n incrementProps?: NumberIncrementStepperProps\n /**\n * Props for decrement component.\n */\n decrementProps?: NumberDecrementStepperProps\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n}\n\nexport interface NumberInputProps\n extends Omit<\n HTMLUIProps<\"input\">,\n | \"value\"\n | \"defaultValue\"\n | \"disabled\"\n | \"required\"\n | \"readOnly\"\n | \"size\"\n | \"min\"\n | \"max\"\n | \"step\"\n | \"onChange\"\n | \"onInvalid\"\n >,\n ThemeProps<\"NumberInput\">,\n Omit<UseNumberInputProps, \"disabled\" | \"required\" | \"readOnly\">,\n NumberInputOptions {}\n\ninterface NumberInputContext {\n getInputProps: PropGetter<\"input\">\n getIncrementProps: PropGetter<\"button\">\n getDecrementProps: PropGetter<\"button\">\n styles: { [key: string]: CSSUIObject }\n}\n\nconst [NumberInputContextProvider, useNumberInputContext] =\n createContext<NumberInputContext>({\n strict: false,\n name: \"NumberInputContext\",\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 containerProps,\n addonProps,\n incrementProps,\n decrementProps,\n ...computedProps\n } = omitThemeProps(mergedProps)\n const {\n getInputProps,\n getIncrementProps,\n getDecrementProps,\n props: rest,\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={{ getInputProps, getIncrementProps, getDecrementProps, styles }}\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\" | \"required\" | \"readOnly\" | \"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 position: \"absolute\",\n top: \"0\",\n insetEnd: \"0px\",\n margin: \"1px\",\n height: \"calc(100% - 2px)\",\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 display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n flex: 1,\n transitionProperty: \"common\",\n transitionDuration: \"normal\",\n userSelect: \"none\",\n cursor: \"pointer\",\n lineHeight: \"normal\",\n },\n})\n\ntype NumberIncrementStepperProps = HTMLUIProps<\"button\">\n\nconst NumberIncrementStepper = forwardRef<\n NumberIncrementStepperProps,\n \"button\"\n>(({ className, children, ...rest }, ref) => {\n const { getIncrementProps, styles } = 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 { getDecrementProps, styles } = 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":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,kBAKO;AAEP,0BAGO;AACP,kBAA4B;AAE5B,yBAA2B;AAC3B,gCAAiC;AACjC,0BAA4B;AAC5B,mBAUO;AAOP,mBAAkE;AA2rBxD;AAzrBV,IAAM,0BAA0B,CAAC,cAC/B,gBAAgB,KAAK,SAAS;AAEhC,IAAM,8BAA8B,CAClC,EAAE,KAAK,SAAS,QAAQ,QAAQ,GAChC,YACG;AACH,MAAI,OA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AAO,EAAE,WAAW,iBAAiB,GAAG;AAAA;AAAA,EACpE;AAEJ,CAAC;AAED,uBAAuB,cAAc;AACrC,uBAAuB,SAAS;AAIhC,IAAM,6BAAyB,wBAG7B,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC3C,QAAM,EAAE,mBAAmB,OAAO,IAAI,sBAAsB;AAE5D,QAAM,MAAmB,EAAE,GAAG,OAAO,QAAQ;AAE7C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,iBAAG,kCAAkC,SAAS;AAAA,MACxD,GAAG,kBAAkB,MAAM,GAAG;AAAA,MAC/B,OAAO;AAAA,MAEN,wCAAY,4CAAC,2BAAY;AAAA;AAAA,EAC5B;AAEJ,CAAC;AAED,uBAAuB,cAAc;AACrC,uBAAuB,SAAS;","names":["value","isFocused","props"]}
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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oB;AAAA,IACpB,oBAAoB;AAAA,IACpB,YAAY;AAAA,EACd;AACF,CAAC;AAID,IAAM,6BAAyB,wBAG7B,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC3C,QAAM,EAAE,QAAQ,kBAAkB,IAAI,sBAAsB;AAE5D,QAAM,MAAmB,EAAE,GAAG,OAAO,QAAQ;AAE7C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,iBAAG,gCAAgC,SAAS;AAAA,MACtD,GAAG,kBAAkB,MAAM,GAAG;AAAA,MAC/B,OAAO;AAAA,MAEN,wCAAY,4CAAC,2BAAY,OAAO,EAAE,WAAW,iBAAiB,GAAG;AAAA;AAAA,EACpE;AAEJ,CAAC;AAED,uBAAuB,cAAc;AACrC,uBAAuB,SAAS;AAIhC,IAAM,6BAAyB,wBAG7B,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC3C,QAAM,EAAE,QAAQ,kBAAkB,IAAI,sBAAsB;AAE5D,QAAM,MAAmB,EAAE,GAAG,OAAO,QAAQ;AAE7C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,iBAAG,kCAAkC,SAAS;AAAA,MACxD,GAAG,kBAAkB,MAAM,GAAG;AAAA,MAC/B,OAAO;AAAA,MAEN,wCAAY,4CAAC,2BAAY;AAAA;AAAA,EAC5B;AAEJ,CAAC;AAED,uBAAuB,cAAc;AACrC,uBAAuB,SAAS;","names":["value","isFocused","props"]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  NumberInput,
4
4
  useNumberInput
5
- } from "./chunk-XNRNUDHZ.mjs";
5
+ } from "./chunk-OFYIJUE5.mjs";
6
6
  export {
7
7
  NumberInput,
8
8
  useNumberInput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/number-input",
3
- "version": "1.1.16-next-20241005220055",
3
+ "version": "1.1.16",
4
4
  "description": "Yamada UI number input component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -36,13 +36,13 @@
36
36
  "url": "https://github.com/yamada-ui/yamada-ui/issues"
37
37
  },
38
38
  "dependencies": {
39
- "@yamada-ui/core": "1.15.2-next-20241005220055",
40
- "@yamada-ui/form-control": "2.1.4-next-20241005220055",
41
- "@yamada-ui/icon": "1.1.8-next-20241005220055",
42
- "@yamada-ui/use-counter": "1.0.22",
43
- "@yamada-ui/use-event-listener": "1.0.21",
44
- "@yamada-ui/use-interval": "1.0.21",
45
- "@yamada-ui/utils": "1.5.2"
39
+ "@yamada-ui/core": "1.15.2",
40
+ "@yamada-ui/form-control": "2.1.4",
41
+ "@yamada-ui/icon": "1.1.8",
42
+ "@yamada-ui/use-counter": "1.0.23",
43
+ "@yamada-ui/use-event-listener": "1.0.22",
44
+ "@yamada-ui/use-interval": "1.0.22",
45
+ "@yamada-ui/utils": "1.5.3"
46
46
  },
47
47
  "devDependencies": {
48
48
  "clean-package": "2.2.0",