@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.
package/dist/index.js CHANGED
@@ -37,8 +37,7 @@ var import_utils = require("@yamada-ui/utils");
37
37
  var import_react = require("react");
38
38
  var import_jsx_runtime = require("react/jsx-runtime");
39
39
  var isDefaultValidCharacter = (character) => /^[Ee0-9+\-.]$/.test(character);
40
- var isValidNumericKeyboardEvent = ({ key, ctrlKey, altKey, metaKey }, isValid) => {
41
- if (key == null) return true;
40
+ var isValidNumericKeyboardEvent = ({ key, altKey, ctrlKey, metaKey }, isValid) => {
42
41
  const isModifierKey = ctrlKey || altKey || metaKey;
43
42
  const isSingleCharacterKey = key.length === 1;
44
43
  if (!isSingleCharacterKey || isModifierKey) return true;
@@ -46,8 +45,8 @@ var isValidNumericKeyboardEvent = ({ key, ctrlKey, altKey, metaKey }, isValid) =
46
45
  };
47
46
  var getStep = ({
48
47
  ctrlKey,
49
- shiftKey,
50
- metaKey
48
+ metaKey,
49
+ shiftKey
51
50
  }) => {
52
51
  let ratio = 1;
53
52
  if (metaKey || ctrlKey) ratio = 0.1;
@@ -58,33 +57,33 @@ var useNumberInput = (props = {}) => {
58
57
  const {
59
58
  id,
60
59
  name,
61
- value: valueProp,
60
+ allowMouseWheel,
61
+ clampValueOnBlur = true,
62
62
  defaultValue,
63
- inputMode = "decimal",
64
- pattern = "[0-9]*(.[0-9]+)?",
65
63
  focusInputOnChange = true,
66
- clampValueOnBlur = true,
64
+ format: formatProp,
65
+ getAriaValueText: getAriaValueTextProp,
66
+ inputMode = "decimal",
67
+ isValidCharacter: isValidCharacterProp,
67
68
  keepWithinRange = true,
68
- allowMouseWheel,
69
- min = Number.MIN_SAFE_INTEGER,
70
69
  max = Number.MAX_SAFE_INTEGER,
71
- step: stepProp,
72
- precision,
70
+ min = Number.MIN_SAFE_INTEGER,
73
71
  parse: parseProp,
74
- format: formatProp,
75
- onInvalid: onInvalidProp,
76
- isValidCharacter: isValidCharacterProp,
77
- getAriaValueText: getAriaValueTextProp,
72
+ pattern = "[0-9]*(.[0-9]+)?",
73
+ precision,
74
+ step: stepProp,
75
+ value: valueProp,
78
76
  onChange: onChangeProp,
77
+ onInvalid: onInvalidProp,
79
78
  ...rest
80
79
  } = (0, import_form_control.useFormControlProps)(props);
81
80
  const {
82
- required,
81
+ "aria-invalid": isInvalid,
83
82
  disabled,
84
83
  readOnly,
85
- "aria-invalid": isInvalid,
86
- onFocus: onFocusProp,
84
+ required,
87
85
  onBlur: onBlurProp,
86
+ onFocus: onFocusProp,
88
87
  ...formControlProps
89
88
  } = (0, import_utils.pickObject)(rest, import_form_control.formControlProperties);
90
89
  const isRequired = required;
@@ -98,11 +97,11 @@ var useNumberInput = (props = {}) => {
98
97
  const decrementRef = (0, import_react.useRef)(null);
99
98
  const onFocus = (0, import_utils.useCallbackRef)(
100
99
  (0, import_utils.handlerAll)(onFocusProp, (ev) => {
101
- var _a, _b, _c;
100
+ var _a, _b;
102
101
  setFocused(true);
103
102
  if (!inputSelectionRef.current) return;
104
- ev.target.selectionStart = (_b = inputSelectionRef.current.start) != null ? _b : (_a = ev.currentTarget.value) == null ? void 0 : _a.length;
105
- ev.currentTarget.selectionEnd = (_c = inputSelectionRef.current.end) != null ? _c : ev.currentTarget.selectionStart;
103
+ ev.target.selectionStart = (_a = inputSelectionRef.current.start) != null ? _a : ev.currentTarget.value.length;
104
+ ev.currentTarget.selectionEnd = (_b = inputSelectionRef.current.end) != null ? _b : ev.currentTarget.selectionStart;
106
105
  })
107
106
  );
108
107
  const onBlur = (0, import_utils.useCallbackRef)(
@@ -117,27 +116,27 @@ var useNumberInput = (props = {}) => {
117
116
  isValidCharacterProp != null ? isValidCharacterProp : isDefaultValidCharacter
118
117
  );
119
118
  const {
120
- isMin,
119
+ cast,
121
120
  isMax,
121
+ isMin,
122
122
  isOut,
123
- value,
124
- valueAsNumber,
125
123
  setValue,
126
124
  update,
127
- cast,
125
+ value,
126
+ valueAsNumber,
128
127
  ...counter
129
128
  } = (0, import_use_counter.useCounter)({
130
- value: valueProp,
131
129
  defaultValue,
132
- step: stepProp,
133
- min,
130
+ keepWithinRange,
134
131
  max,
132
+ min,
135
133
  precision,
136
- keepWithinRange,
134
+ step: stepProp,
135
+ value: valueProp,
137
136
  onChange: onChangeProp
138
137
  });
139
138
  const valueText = (0, import_react.useMemo)(() => {
140
- let text = getAriaValueText == null ? void 0 : getAriaValueText(value);
139
+ let text = getAriaValueText(value);
141
140
  if (text != null) return text;
142
141
  text = value.toString();
143
142
  return !text ? void 0 : text;
@@ -190,8 +189,8 @@ var useNumberInput = (props = {}) => {
190
189
  const parsedInput = parse(ev.currentTarget.value);
191
190
  update(sanitize(parsedInput));
192
191
  inputSelectionRef.current = {
193
- start: ev.currentTarget.selectionStart,
194
- end: ev.currentTarget.selectionEnd
192
+ end: ev.currentTarget.selectionEnd,
193
+ start: ev.currentTarget.selectionStart
195
194
  };
196
195
  },
197
196
  [parse, update, sanitize]
@@ -203,10 +202,10 @@ var useNumberInput = (props = {}) => {
203
202
  ev.preventDefault();
204
203
  const step = getStep(ev) * (stepProp != null ? stepProp : 1);
205
204
  const keyMap = {
206
- ArrowUp: () => increment(step),
207
205
  ArrowDown: () => decrement(step),
208
- Home: () => update(min),
209
- End: () => update(max)
206
+ ArrowUp: () => increment(step),
207
+ End: () => update(max),
208
+ Home: () => update(min)
210
209
  };
211
210
  const action = keyMap[ev.key];
212
211
  if (!action) return;
@@ -215,7 +214,7 @@ var useNumberInput = (props = {}) => {
215
214
  },
216
215
  [decrement, increment, isValidCharacter, max, min, stepProp, update]
217
216
  );
218
- const { up, down, stop, isSpinning } = useSpinner(increment, decrement);
217
+ const { down, isSpinning, stop, up } = useSpinner(increment, decrement);
219
218
  useAttributeObserver(incrementRef, ["disabled"], isSpinning, stop);
220
219
  useAttributeObserver(decrementRef, ["disabled"], isSpinning, stop);
221
220
  const focusInput = (0, import_react.useCallback)(() => {
@@ -243,9 +242,9 @@ var useNumberInput = (props = {}) => {
243
242
  );
244
243
  (0, import_utils.useUpdateEffect)(() => {
245
244
  if (valueAsNumber > max) {
246
- onInvalid == null ? void 0 : onInvalid("rangeOverflow", format(value), valueAsNumber);
245
+ onInvalid("rangeOverflow", format(value), valueAsNumber);
247
246
  } else if (valueAsNumber < min) {
248
- onInvalid == null ? void 0 : onInvalid("rangeOverflow", format(value), valueAsNumber);
247
+ onInvalid("rangeOverflow", format(value), valueAsNumber);
249
248
  }
250
249
  }, [valueAsNumber, value, format, onInvalid]);
251
250
  (0, import_utils.useSafeLayoutEffect)(() => {
@@ -277,32 +276,32 @@ var useNumberInput = (props = {}) => {
277
276
  const getInputProps = (0, import_react.useCallback)(
278
277
  (props2 = {}, ref = null) => ({
279
278
  id,
280
- name,
281
279
  type: "text",
282
- role: "spinbutton",
280
+ name,
281
+ disabled,
283
282
  inputMode,
284
283
  pattern,
285
- required,
286
- disabled,
287
284
  readOnly,
285
+ required,
286
+ role: "spinbutton",
288
287
  ...formControlProps,
289
288
  ...props2,
290
- min,
291
- max,
292
- step: stepProp,
293
289
  ref: (0, import_utils.mergeRefs)(inputRef, ref),
294
- value: format(value),
295
- "aria-valuemin": min,
290
+ "aria-invalid": (0, import_utils.ariaAttr)(isInvalid != null ? isInvalid : isOut),
296
291
  "aria-valuemax": max,
292
+ "aria-valuemin": min,
297
293
  "aria-valuenow": Number.isNaN(valueAsNumber) ? void 0 : valueAsNumber,
298
294
  "aria-valuetext": valueText,
299
- "aria-invalid": (0, import_utils.ariaAttr)(isInvalid != null ? isInvalid : isOut),
300
295
  autoComplete: "off",
301
296
  autoCorrect: "off",
297
+ max,
298
+ min,
299
+ step: stepProp,
300
+ value: format(value),
301
+ onBlur: (0, import_utils.handlerAll)(props2.onBlur, onBlur),
302
302
  onChange: (0, import_utils.handlerAll)(props2.onChange, onChange),
303
- onKeyDown: (0, import_utils.handlerAll)(props2.onKeyDown, onKeyDown),
304
303
  onFocus: (0, import_utils.handlerAll)(props2.onFocus, onFocus),
305
- onBlur: (0, import_utils.handlerAll)(props2.onBlur, onBlur)
304
+ onKeyDown: (0, import_utils.handlerAll)(props2.onKeyDown, onKeyDown)
306
305
  }),
307
306
  [
308
307
  id,
@@ -333,16 +332,16 @@ var useNumberInput = (props = {}) => {
333
332
  var _a;
334
333
  const trulyDisabled = disabled || keepWithinRange && isMax;
335
334
  return {
336
- required,
337
- readOnly,
338
335
  disabled: trulyDisabled,
336
+ readOnly,
337
+ required,
339
338
  ...formControlProps,
340
339
  ...props2,
340
+ ref: (0, import_utils.mergeRefs)(ref, incrementRef),
341
341
  style: {
342
342
  ...props2.style,
343
343
  cursor: readOnly ? "not-allowed" : (_a = props2.style) == null ? void 0 : _a.cursor
344
344
  },
345
- ref: (0, import_utils.mergeRefs)(ref, incrementRef),
346
345
  tabIndex: -1,
347
346
  onPointerDown: (0, import_utils.handlerAll)(props2.onPointerDown, (ev) => {
348
347
  if (ev.button === 0 && !trulyDisabled) eventUp(ev);
@@ -367,16 +366,16 @@ var useNumberInput = (props = {}) => {
367
366
  var _a;
368
367
  const trulyDisabled = disabled || keepWithinRange && isMin;
369
368
  return {
370
- required,
371
- readOnly,
372
369
  disabled: trulyDisabled,
370
+ readOnly,
371
+ required,
373
372
  ...formControlProps,
374
373
  ...props2,
374
+ ref: (0, import_utils.mergeRefs)(ref, decrementRef),
375
375
  style: {
376
376
  ...props2.style,
377
377
  cursor: readOnly ? "not-allowed" : (_a = props2.style) == null ? void 0 : _a.cursor
378
378
  },
379
- ref: (0, import_utils.mergeRefs)(ref, decrementRef),
380
379
  tabIndex: -1,
381
380
  onPointerDown: (0, import_utils.handlerAll)(props2.onPointerDown, (ev) => {
382
381
  if (ev.button === 0 && !trulyDisabled) eventDown(ev);
@@ -397,16 +396,16 @@ var useNumberInput = (props = {}) => {
397
396
  ]
398
397
  );
399
398
  return {
399
+ isDisabled,
400
+ isFocused,
401
+ isReadOnly,
402
+ isRequired,
400
403
  props: rest,
401
404
  value: format(value),
402
405
  valueAsNumber,
403
- isFocused,
404
- isRequired,
405
- isReadOnly,
406
- isDisabled,
407
- getInputProps,
406
+ getDecrementProps,
408
407
  getIncrementProps,
409
- getDecrementProps
408
+ getInputProps
410
409
  };
411
410
  };
412
411
  var INTERVAL = 50;
@@ -448,7 +447,7 @@ var useSpinner = (increment, decrement) => {
448
447
  (0, import_react.useEffect)(() => {
449
448
  return () => removeTimeout();
450
449
  }, []);
451
- return { up, down, stop, isSpinning };
450
+ return { down, isSpinning, stop, up };
452
451
  };
453
452
  var useAttributeObserver = (ref, attributeFilter, enabled, func) => {
454
453
  (0, import_react.useEffect)(() => {
@@ -461,13 +460,13 @@ var useAttributeObserver = (ref, attributeFilter, enabled, func) => {
461
460
  func();
462
461
  }
463
462
  });
464
- observer.observe(ref.current, { attributes: true, attributeFilter });
463
+ observer.observe(ref.current, { attributeFilter, attributes: true });
465
464
  return () => observer.disconnect();
466
465
  });
467
466
  };
468
467
  var [NumberInputContextProvider, useNumberInputContext] = (0, import_utils.createContext)({
469
- strict: false,
470
- name: "NumberInputContext"
468
+ name: "NumberInputContext",
469
+ errorMessage: `useNumberInputContext returned is 'undefined'. Seems you forgot to wrap the components in "<NumberInput />"`
471
470
  });
472
471
  var NumberInput = (0, import_core.forwardRef)(
473
472
  (props, ref) => {
@@ -475,17 +474,17 @@ var NumberInput = (0, import_core.forwardRef)(
475
474
  const {
476
475
  className,
477
476
  isStepper = true,
478
- containerProps,
479
477
  addonProps,
480
- incrementProps,
478
+ containerProps,
481
479
  decrementProps,
480
+ incrementProps,
482
481
  ...computedProps
483
482
  } = (0, import_core.omitThemeProps)(mergedProps);
484
483
  const {
485
- getInputProps,
486
- getIncrementProps,
484
+ props: rest,
487
485
  getDecrementProps,
488
- props: rest
486
+ getIncrementProps,
487
+ getInputProps
489
488
  } = useNumberInput(computedProps);
490
489
  const css = {
491
490
  position: "relative",
@@ -495,7 +494,7 @@ var NumberInput = (0, import_core.forwardRef)(
495
494
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
496
495
  NumberInputContextProvider,
497
496
  {
498
- value: { getInputProps, getIncrementProps, getDecrementProps, styles },
497
+ value: { styles, getDecrementProps, getIncrementProps, getInputProps },
499
498
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
500
499
  import_core.ui.div,
501
500
  {
@@ -543,11 +542,11 @@ var NumberInputAddon = (0, import_core.forwardRef)(
543
542
  const css = {
544
543
  display: "flex",
545
544
  flexDirection: "column",
546
- position: "absolute",
547
- top: "0",
545
+ height: "calc(100% - 2px)",
548
546
  insetEnd: "0px",
549
547
  margin: "1px",
550
- height: "calc(100% - 2px)",
548
+ position: "absolute",
549
+ top: "0",
551
550
  zIndex: "fallback(yamcha, 1)",
552
551
  ...styles.addon
553
552
  };
@@ -567,19 +566,19 @@ NumberInputAddon.displayName = "NumberInputAddon";
567
566
  NumberInputAddon.__ui__ = "NumberInputAddon";
568
567
  var Stepper = (0, import_core.ui)("button", {
569
568
  baseStyle: {
570
- display: "flex",
571
- justifyContent: "center",
572
569
  alignItems: "center",
570
+ cursor: "pointer",
571
+ display: "flex",
573
572
  flex: 1,
574
- transitionProperty: "common",
573
+ justifyContent: "center",
574
+ lineHeight: "normal",
575
575
  transitionDuration: "normal",
576
- userSelect: "none",
577
- cursor: "pointer",
578
- lineHeight: "normal"
576
+ transitionProperty: "common",
577
+ userSelect: "none"
579
578
  }
580
579
  });
581
580
  var NumberIncrementStepper = (0, import_core.forwardRef)(({ className, children, ...rest }, ref) => {
582
- const { getIncrementProps, styles } = useNumberInputContext();
581
+ const { styles, getIncrementProps } = useNumberInputContext();
583
582
  const css = { ...styles.stepper };
584
583
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
585
584
  Stepper,
@@ -594,7 +593,7 @@ var NumberIncrementStepper = (0, import_core.forwardRef)(({ className, children,
594
593
  NumberIncrementStepper.displayName = "NumberIncrementStepper";
595
594
  NumberIncrementStepper.__ui__ = "NumberIncrementStepper";
596
595
  var NumberDecrementStepper = (0, import_core.forwardRef)(({ className, children, ...rest }, ref) => {
597
- const { getDecrementProps, styles } = useNumberInputContext();
596
+ const { styles, getDecrementProps } = useNumberInputContext();
598
597
  const css = { ...styles.stepper };
599
598
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
600
599
  Stepper,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/number-input.tsx"],"sourcesContent":["export { NumberInput, useNumberInput } from \"./number-input\"\nexport type {\n NumberInputProps,\n UseNumberInputProps,\n UseNumberInputReturn,\n} from \"./number-input\"\n","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;;;ACQA,kBAKO;AAEP,0BAGO;AACP,kBAA4B;AAE5B,yBAA2B;AAC3B,gCAAiC;AACjC,0BAA4B;AAC5B,mBAUO;AAOP,mBAA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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,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/index.ts","../src/number-input.tsx"],"sourcesContent":["export { NumberInput, useNumberInput } from \"./number-input\"\nexport type {\n NumberInputProps,\n UseNumberInputProps,\n UseNumberInputReturn,\n} from \"./number-input\"\n","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":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,kBAKO;AACP,0BAGO;AACP,kBAA4B;AAC5B,yBAA2B;AAC3B,gCAAiC;AACjC,0BAA4B;AAC5B,mBAUO;AACP,mBAAkE;AAyrBxD;AAvrBV,IAAM,0BAA0B,CAAC,cAC/B,gBAAgB,KAAK,SAAS;AAEhC,IAAM,8BAA8B,CAClC,EAAE,KAAK,QAAQ,SAAS,QAAQ,GAChC,YACG;AACH,QAAM,gBAAgB,WAAW,UAAU;AAC3C,QAAM,uBAAuB,IAAI,WAAW;AAE5C,MAAI,CAAC,wBAAwB,cAAe,QAAO;AAEnD,SAAO,QAAQ,GAAG;AACpB;AAEA,IAAM,UAAU,CAAuC;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AACF,MAAS;AACP,MAAI,QAAQ;AAEZ,MAAI,WAAW,QAAS,SAAQ;AAEhC,MAAI,SAAU,SAAQ;AAEtB,SAAO;AACT;AA0EO,IAAM,iBAAiB,CAAC,QAA6B,CAAC,MAAM;AACjE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA,qBAAqB;AAAA,IACrB,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,IAClB,MAAM,OA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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