@common-origin/design-system 1.11.3 → 1.12.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.
- package/dist/components/molecules/NumberInput/NumberInput.d.ts +86 -0
- package/dist/components/molecules/NumberInput/index.d.ts +2 -0
- package/dist/components/molecules/index.d.ts +1 -0
- package/dist/index.esm.js +418 -161
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +417 -159
- package/dist/index.js.map +1 -1
- package/dist/styles/icons.json +12 -4
- package/dist/styles/tokens.json +3 -3
- package/dist/tokens/index.esm.js +3 -3
- package/dist/tokens/index.js +3 -3
- package/dist/types/icons.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ChangeEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the NumberInput component
|
|
4
|
+
*/
|
|
5
|
+
export interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'value' | 'defaultValue'> {
|
|
6
|
+
/**
|
|
7
|
+
* Label text for the input
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Helper text displayed below the input
|
|
12
|
+
*/
|
|
13
|
+
helperText?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Error message to display
|
|
16
|
+
*/
|
|
17
|
+
error?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the field is required
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
required?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the input is disabled
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Minimum allowed value
|
|
30
|
+
*/
|
|
31
|
+
min?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum allowed value
|
|
34
|
+
*/
|
|
35
|
+
max?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Step increment/decrement value
|
|
38
|
+
* @default 1
|
|
39
|
+
*/
|
|
40
|
+
step?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Current value (controlled)
|
|
43
|
+
*/
|
|
44
|
+
value?: number | '';
|
|
45
|
+
/**
|
|
46
|
+
* Default value (uncontrolled)
|
|
47
|
+
*/
|
|
48
|
+
defaultValue?: number | '';
|
|
49
|
+
/**
|
|
50
|
+
* Callback fired when value changes
|
|
51
|
+
*/
|
|
52
|
+
onChange?: (value: number | '', event: ChangeEvent<HTMLInputElement>) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Unique identifier for the input
|
|
55
|
+
* Generated automatically if not provided
|
|
56
|
+
*/
|
|
57
|
+
id?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Test identifier for automated testing
|
|
60
|
+
*/
|
|
61
|
+
'data-testid'?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* NumberInput component for numeric input with stepper buttons and WCAG 2.2 AA compliance
|
|
65
|
+
*
|
|
66
|
+
* Features:
|
|
67
|
+
* - Stepper buttons for increment/decrement
|
|
68
|
+
* - Keyboard arrow up/down support
|
|
69
|
+
* - Min/max value constraints
|
|
70
|
+
* - Custom step values
|
|
71
|
+
* - Decimal and integer support
|
|
72
|
+
* - Full accessibility with ARIA attributes
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <NumberInput
|
|
77
|
+
* label="Quantity"
|
|
78
|
+
* min={0}
|
|
79
|
+
* max={100}
|
|
80
|
+
* step={1}
|
|
81
|
+
* value={value}
|
|
82
|
+
* onChange={(newValue) => setValue(newValue)}
|
|
83
|
+
* />
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLInputElement>>;
|