@yamada-ui/number-input 0.2.4 → 0.2.5
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.
- package/dist/index.d.mts +6 -0
- package/dist/number-input.d.mts +117 -0
- package/package.json +8 -8
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { NumberInput, NumberInputProps, UseNumberInputProps, UseNumberInputReturn, useNumberInput } from './number-input.mjs';
|
|
2
|
+
import '@yamada-ui/core';
|
|
3
|
+
import '@yamada-ui/form-control';
|
|
4
|
+
import '@yamada-ui/use-counter';
|
|
5
|
+
import '@yamada-ui/utils';
|
|
6
|
+
import 'react';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
|
+
import { HTMLUIProps, ThemeProps, CSSUIProps } from '@yamada-ui/core';
|
|
3
|
+
import { UseFormControlProps } from '@yamada-ui/form-control';
|
|
4
|
+
import { UseCounterProps } from '@yamada-ui/use-counter';
|
|
5
|
+
import { PropGetter } from '@yamada-ui/utils';
|
|
6
|
+
import { InputHTMLAttributes } from 'react';
|
|
7
|
+
|
|
8
|
+
type ValidityState = 'rangeUnderflow' | 'rangeOverflow';
|
|
9
|
+
type UseNumberInputProps = UseFormControlProps<HTMLInputElement> & UseCounterProps & {
|
|
10
|
+
/**
|
|
11
|
+
* The HTML `name` attribute used for forms.
|
|
12
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
40
|
+
clampValueOnBlur?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* If `true`, the input's value will change based on mouse wheel.
|
|
43
|
+
*/
|
|
44
|
+
allowMouseWheel?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The callback invoked when invalid number is entered.
|
|
47
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
60
|
+
isValidCharacter?: (value: string) => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* If using a custom display format, this converts the custom format to a format `parseFloat` understands.
|
|
63
|
+
*/
|
|
64
|
+
parse?: (value: string) => string;
|
|
65
|
+
/**
|
|
66
|
+
* If using a custom display format, this converts the default format to the custom format.
|
|
67
|
+
*/
|
|
68
|
+
format?: (value: string | number) => string | number;
|
|
69
|
+
};
|
|
70
|
+
declare const useNumberInput: (props?: UseNumberInputProps) => {
|
|
71
|
+
value: string;
|
|
72
|
+
valueAsNumber: number;
|
|
73
|
+
isFocused: boolean;
|
|
74
|
+
isRequired: boolean | undefined;
|
|
75
|
+
isReadOnly: boolean | undefined;
|
|
76
|
+
isDisabled: boolean | undefined;
|
|
77
|
+
getInputProps: PropGetter;
|
|
78
|
+
getIncrementProps: PropGetter;
|
|
79
|
+
getDecrementProps: PropGetter;
|
|
80
|
+
};
|
|
81
|
+
type UseNumberInputReturn = ReturnType<typeof useNumberInput>;
|
|
82
|
+
type NumberInputOptions = {
|
|
83
|
+
/**
|
|
84
|
+
* If `true`, display the addon for the number input.
|
|
85
|
+
*/
|
|
86
|
+
isStepper?: boolean;
|
|
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
|
+
*/
|
|
106
|
+
focusBorderColor?: CSSUIProps<'unresponsive'>['borderColor'];
|
|
107
|
+
/**
|
|
108
|
+
* The border color when the input is invalid.
|
|
109
|
+
*/
|
|
110
|
+
errorBorderColor?: CSSUIProps<'unresponsive'>['borderColor'];
|
|
111
|
+
};
|
|
112
|
+
type NumberInputProps = Omit<HTMLUIProps<'input'>, 'disabled' | 'required' | 'readOnly' | 'size' | 'onChange'> & ThemeProps<'NumberInput'> & Omit<UseNumberInputProps, 'disabled' | 'required' | 'readOnly'> & NumberInputOptions;
|
|
113
|
+
declare const NumberInput: _yamada_ui_core.Component<"input", NumberInputProps>;
|
|
114
|
+
type NumberIncrementStepperProps = HTMLUIProps<'div'>;
|
|
115
|
+
type NumberDecrementStepperProps = HTMLUIProps<'div'>;
|
|
116
|
+
|
|
117
|
+
export { NumberInput, NumberInputProps, UseNumberInputProps, UseNumberInputReturn, useNumberInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamada-ui/number-input",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Yamada UI number input component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yamada",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"url": "https://github.com/hirotomoyamada/yamada-ui/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yamada-ui/core": "0.
|
|
39
|
-
"@yamada-ui/utils": "0.1.
|
|
40
|
-
"@yamada-ui/form-control": "0.2.
|
|
41
|
-
"@yamada-ui/icon": "0.2.
|
|
42
|
-
"@yamada-ui/use-counter": "0.2.
|
|
43
|
-
"@yamada-ui/use-interval": "0.1.
|
|
44
|
-
"@yamada-ui/use-event-listener": "0.1.
|
|
38
|
+
"@yamada-ui/core": "0.5.0",
|
|
39
|
+
"@yamada-ui/utils": "0.1.3",
|
|
40
|
+
"@yamada-ui/form-control": "0.2.5",
|
|
41
|
+
"@yamada-ui/icon": "0.2.5",
|
|
42
|
+
"@yamada-ui/use-counter": "0.2.2",
|
|
43
|
+
"@yamada-ui/use-interval": "0.1.4",
|
|
44
|
+
"@yamada-ui/use-event-listener": "0.1.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"react": "^18.0.0",
|