@yamada-ui/number-input 0.1.11 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -416,10 +416,10 @@ var NumberInput = forwardRef((props, ref) => {
416
416
  const {
417
417
  className,
418
418
  isStepper = true,
419
- container,
420
- addon,
421
- increment,
422
- decrement,
419
+ containerProps,
420
+ addonProps,
421
+ incrementProps,
422
+ decrementProps,
423
423
  onChange,
424
424
  ...rest
425
425
  } = omitThemeProps(mergedProps);
@@ -436,11 +436,11 @@ var NumberInput = forwardRef((props, ref) => {
436
436
  NumberInputContextProvider,
437
437
  {
438
438
  value: { getInputProps, getIncrementProps, getDecrementProps, styles },
439
- children: /* @__PURE__ */ jsxs(ui.div, { className: cx("ui-number-input", className), __css: css, ...container, children: [
439
+ children: /* @__PURE__ */ jsxs(ui.div, { className: cx("ui-number-input", className), __css: css, ...containerProps, children: [
440
440
  /* @__PURE__ */ jsx(NumberInputField, { ...getInputProps(rest, ref) }),
441
- isStepper ? /* @__PURE__ */ jsxs(NumberInputAddon, { ...addon, children: [
442
- /* @__PURE__ */ jsx(NumberIncrementStepper, { ...increment }),
443
- /* @__PURE__ */ jsx(NumberDecrementStepper, { ...decrement })
441
+ isStepper ? /* @__PURE__ */ jsxs(NumberInputAddon, { ...addonProps, children: [
442
+ /* @__PURE__ */ jsx(NumberIncrementStepper, { ...incrementProps }),
443
+ /* @__PURE__ */ jsx(NumberDecrementStepper, { ...decrementProps })
444
444
  ] }) : null
445
445
  ] })
446
446
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { NumberInput, NumberInputProps, UseNumberInputProps, useNumberInput } from './number-input.js';
1
+ export { NumberInput, NumberInputProps, UseNumberInputProps, UseNumberInputReturn, useNumberInput } from './number-input.js';
2
2
  import '@yamada-ui/core';
3
3
  import '@yamada-ui/form-control';
4
4
  import '@yamada-ui/use-counter';
package/dist/index.js CHANGED
@@ -419,10 +419,10 @@ var NumberInput = (0, import_core.forwardRef)((props, ref) => {
419
419
  const {
420
420
  className,
421
421
  isStepper = true,
422
- container,
423
- addon,
424
- increment,
425
- decrement,
422
+ containerProps,
423
+ addonProps,
424
+ incrementProps,
425
+ decrementProps,
426
426
  onChange,
427
427
  ...rest
428
428
  } = (0, import_core.omitThemeProps)(mergedProps);
@@ -439,11 +439,11 @@ var NumberInput = (0, import_core.forwardRef)((props, ref) => {
439
439
  NumberInputContextProvider,
440
440
  {
441
441
  value: { getInputProps, getIncrementProps, getDecrementProps, styles },
442
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.ui.div, { className: (0, import_utils.cx)("ui-number-input", className), __css: css, ...container, children: [
442
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.ui.div, { className: (0, import_utils.cx)("ui-number-input", className), __css: css, ...containerProps, children: [
443
443
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInputField, { ...getInputProps(rest, ref) }),
444
- isStepper ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(NumberInputAddon, { ...addon, children: [
445
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberIncrementStepper, { ...increment }),
446
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberDecrementStepper, { ...decrement })
444
+ isStepper ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(NumberInputAddon, { ...addonProps, children: [
445
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberIncrementStepper, { ...incrementProps }),
446
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberDecrementStepper, { ...decrementProps })
447
447
  ] }) : null
448
448
  ] })
449
449
  }
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NumberInput,
3
3
  useNumberInput
4
- } from "./chunk-L2FQDPVY.mjs";
4
+ } from "./chunk-BQMXCZW3.mjs";
5
5
  export {
6
6
  NumberInput,
7
7
  useNumberInput
@@ -7,16 +7,64 @@ import { InputHTMLAttributes } from 'react';
7
7
 
8
8
  type ValidityState = 'rangeUnderflow' | 'rangeOverflow';
9
9
  type UseNumberInputProps = UseFormControlProps<HTMLInputElement> & UseCounterProps & {
10
+ /**
11
+ * The HTML `name` attribute used for forms.
12
+ */
10
13
  name?: string;
14
+ /**
15
+ * Hints at the type of data that might be entered by the user.
16
+ * It also determines the type of keyboard shown to the user on mobile devices.
17
+ *
18
+ * @default 'decimal'
19
+ */
11
20
  inputMode?: InputHTMLAttributes<any>['inputMode'];
21
+ /**
22
+ * The pattern used to check the <input> element's value against on form submission.
23
+ *
24
+ * @default '[0-9]*(.[0-9]+)?'
25
+ */
12
26
  pattern?: InputHTMLAttributes<any>['pattern'];
27
+ /**
28
+ * If `true`, the input will be focused as you increment or decrement the value with the stepper.
29
+ *
30
+ * @default true
31
+ */
13
32
  focusInputOnChange?: boolean;
33
+ /**
34
+ * This controls the value update when you blur out of the input.
35
+ * - If `true` and the value is greater than `max`, the value will be reset to `max`.
36
+ * - Else, the value remains the same.
37
+ *
38
+ * @default true
39
+ */
14
40
  clampValueOnBlur?: boolean;
41
+ /**
42
+ * If `true`, the input's value will change based on mouse wheel.
43
+ */
15
44
  allowMouseWheel?: boolean;
45
+ /**
46
+ * The callback invoked when invalid number is entered.
47
+ */
16
48
  onInvalid?: (message: ValidityState, value: string, valueAsNumber: number) => void;
49
+ /**
50
+ * This is used to format the value so that screen readers
51
+ * can speak out a more human-friendly value.
52
+ *
53
+ * It is used to set the `aria-valuetext` property of the input.
54
+ */
17
55
  getAriaValueText?: (value: string | number) => string;
56
+ /**
57
+ * Whether the pressed key should be allowed in the input.
58
+ * The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/.
59
+ */
18
60
  isValidCharacter?: (value: string) => boolean;
61
+ /**
62
+ * If using a custom display format, this converts the custom format to a format `parseFloat` understands.
63
+ */
19
64
  parse?: (value: string) => string;
65
+ /**
66
+ * If using a custom display format, this converts the default format to the custom format.
67
+ */
20
68
  format?: (value: string | number) => string | number;
21
69
  };
22
70
  declare const useNumberInput: (props?: UseNumberInputProps) => {
@@ -30,13 +78,35 @@ declare const useNumberInput: (props?: UseNumberInputProps) => {
30
78
  getIncrementProps: PropGetter;
31
79
  getDecrementProps: PropGetter;
32
80
  };
81
+ type UseNumberInputReturn = ReturnType<typeof useNumberInput>;
33
82
  type NumberInputOptions = {
83
+ /**
84
+ * If `true`, display the addon for the number input.
85
+ */
34
86
  isStepper?: boolean;
35
- container?: HTMLUIProps<'div'>;
36
- addon?: HTMLUIProps<'div'>;
37
- increment?: NumberIncrementStepperProps;
38
- decrement?: NumberDecrementStepperProps;
87
+ /**
88
+ * Props for container element.
89
+ */
90
+ containerProps?: HTMLUIProps<'div'>;
91
+ /**
92
+ * Props for addon component.
93
+ */
94
+ addonProps?: HTMLUIProps<'div'>;
95
+ /**
96
+ * Props for increment component.
97
+ */
98
+ incrementProps?: NumberIncrementStepperProps;
99
+ /**
100
+ * Props for decrement component.
101
+ */
102
+ decrementProps?: NumberDecrementStepperProps;
103
+ /**
104
+ * The border color when the input is focused.
105
+ */
39
106
  focusBorderColor?: CSSUIProps<'unresponsive'>['borderColor'];
107
+ /**
108
+ * The border color when the input is invalid.
109
+ */
40
110
  errorBorderColor?: CSSUIProps<'unresponsive'>['borderColor'];
41
111
  };
42
112
  type NumberInputProps = Omit<HTMLUIProps<'input'>, 'disabled' | 'required' | 'readOnly' | 'size' | 'onChange'> & ThemeProps<'NumberInput'> & Omit<UseNumberInputProps, 'disabled' | 'required' | 'readOnly'> & NumberInputOptions;
@@ -44,4 +114,4 @@ declare const NumberInput: _yamada_ui_core.Component<"input", NumberInputProps>;
44
114
  type NumberIncrementStepperProps = HTMLUIProps<'div'>;
45
115
  type NumberDecrementStepperProps = HTMLUIProps<'div'>;
46
116
 
47
- export { NumberInput, NumberInputProps, UseNumberInputProps, useNumberInput };
117
+ export { NumberInput, NumberInputProps, UseNumberInputProps, UseNumberInputReturn, useNumberInput };
@@ -417,10 +417,10 @@ var NumberInput = (0, import_core.forwardRef)((props, ref) => {
417
417
  const {
418
418
  className,
419
419
  isStepper = true,
420
- container,
421
- addon,
422
- increment,
423
- decrement,
420
+ containerProps,
421
+ addonProps,
422
+ incrementProps,
423
+ decrementProps,
424
424
  onChange,
425
425
  ...rest
426
426
  } = (0, import_core.omitThemeProps)(mergedProps);
@@ -437,11 +437,11 @@ var NumberInput = (0, import_core.forwardRef)((props, ref) => {
437
437
  NumberInputContextProvider,
438
438
  {
439
439
  value: { getInputProps, getIncrementProps, getDecrementProps, styles },
440
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.ui.div, { className: (0, import_utils.cx)("ui-number-input", className), __css: css, ...container, children: [
440
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.ui.div, { className: (0, import_utils.cx)("ui-number-input", className), __css: css, ...containerProps, children: [
441
441
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInputField, { ...getInputProps(rest, ref) }),
442
- isStepper ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(NumberInputAddon, { ...addon, children: [
443
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberIncrementStepper, { ...increment }),
444
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberDecrementStepper, { ...decrement })
442
+ isStepper ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(NumberInputAddon, { ...addonProps, children: [
443
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberIncrementStepper, { ...incrementProps }),
444
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberDecrementStepper, { ...decrementProps })
445
445
  ] }) : null
446
446
  ] })
447
447
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NumberInput,
3
3
  useNumberInput
4
- } from "./chunk-L2FQDPVY.mjs";
4
+ } from "./chunk-BQMXCZW3.mjs";
5
5
  export {
6
6
  NumberInput,
7
7
  useNumberInput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/number-input",
3
- "version": "0.1.11",
3
+ "version": "0.2.0",
4
4
  "description": "Yamada UI number input component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -35,11 +35,11 @@
35
35
  "url": "https://github.com/hirotomoyamada/yamada-ui/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@yamada-ui/core": "0.2.3",
38
+ "@yamada-ui/core": "0.3.1",
39
39
  "@yamada-ui/utils": "0.1.1",
40
- "@yamada-ui/form-control": "0.1.10",
41
- "@yamada-ui/icon": "0.1.10",
42
- "@yamada-ui/use-counter": "0.1.1",
40
+ "@yamada-ui/form-control": "0.2.0",
41
+ "@yamada-ui/icon": "0.2.0",
42
+ "@yamada-ui/use-counter": "0.2.0",
43
43
  "@yamada-ui/use-interval": "0.1.2",
44
44
  "@yamada-ui/use-event-listener": "0.1.1"
45
45
  },