@true-tech-team/react-components 0.0.1
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/README.md +586 -0
- package/index.css +1 -0
- package/index.d.ts +15 -0
- package/index.js +1 -0
- package/index.mjs +5224 -0
- package/lib/assets/icons/index.d.ts +105 -0
- package/lib/components/buttons/Button/Button.d.ts +49 -0
- package/lib/components/buttons/Button/index.d.ts +3 -0
- package/lib/components/buttons/IconButton/IconButton.d.ts +48 -0
- package/lib/components/buttons/IconButton/index.d.ts +3 -0
- package/lib/components/buttons/index.d.ts +2 -0
- package/lib/components/display/Icon/Icon.d.ts +43 -0
- package/lib/components/display/Icon/index.d.ts +3 -0
- package/lib/components/display/index.d.ts +1 -0
- package/lib/components/forms/FormBuilder/FormBuilder.d.ts +109 -0
- package/lib/components/forms/FormBuilder/hooks/index.d.ts +2 -0
- package/lib/components/forms/FormBuilder/hooks/useFormState.d.ts +5 -0
- package/lib/components/forms/FormBuilder/hooks/useFormValidation.d.ts +11 -0
- package/lib/components/forms/FormBuilder/index.d.ts +4 -0
- package/lib/components/forms/FormBuilder/types.d.ts +193 -0
- package/lib/components/forms/index.d.ts +1 -0
- package/lib/components/index.d.ts +50 -0
- package/lib/components/inputs/Autocomplete/Autocomplete.d.ts +109 -0
- package/lib/components/inputs/Autocomplete/index.d.ts +2 -0
- package/lib/components/inputs/Checkbox/Checkbox.d.ts +85 -0
- package/lib/components/inputs/Checkbox/index.d.ts +2 -0
- package/lib/components/inputs/ColorPicker/ColorPicker.d.ts +82 -0
- package/lib/components/inputs/ColorPicker/index.d.ts +2 -0
- package/lib/components/inputs/DatePicker/DatePicker.d.ts +81 -0
- package/lib/components/inputs/DatePicker/index.d.ts +2 -0
- package/lib/components/inputs/DateRangePicker/DateRangePicker.d.ts +115 -0
- package/lib/components/inputs/DateRangePicker/index.d.ts +2 -0
- package/lib/components/inputs/FilePicker/FilePicker.d.ts +101 -0
- package/lib/components/inputs/FilePicker/index.d.ts +2 -0
- package/lib/components/inputs/Input/Input.d.ts +171 -0
- package/lib/components/inputs/Input/index.d.ts +3 -0
- package/lib/components/inputs/NumberInput/NumberInput.d.ts +18 -0
- package/lib/components/inputs/NumberInput/index.d.ts +2 -0
- package/lib/components/inputs/PhoneInput/PhoneInput.d.ts +87 -0
- package/lib/components/inputs/PhoneInput/index.d.ts +2 -0
- package/lib/components/inputs/Radio/Radio.d.ts +45 -0
- package/lib/components/inputs/Radio/RadioGroup.d.ts +88 -0
- package/lib/components/inputs/Radio/index.d.ts +4 -0
- package/lib/components/inputs/Rating/Rating.d.ts +22 -0
- package/lib/components/inputs/Rating/index.d.ts +2 -0
- package/lib/components/inputs/Select/Select.d.ts +142 -0
- package/lib/components/inputs/Select/index.d.ts +2 -0
- package/lib/components/inputs/Slider/Slider.d.ts +29 -0
- package/lib/components/inputs/Slider/index.d.ts +2 -0
- package/lib/components/inputs/TagInput/TagInput.d.ts +101 -0
- package/lib/components/inputs/TagInput/index.d.ts +2 -0
- package/lib/components/inputs/Textarea/Textarea.d.ts +90 -0
- package/lib/components/inputs/Textarea/index.d.ts +2 -0
- package/lib/components/inputs/Toggle/Toggle.d.ts +69 -0
- package/lib/components/inputs/Toggle/index.d.ts +2 -0
- package/lib/components/inputs/index.d.ts +16 -0
- package/lib/components/overlays/Dropdown/Dropdown.d.ts +84 -0
- package/lib/components/overlays/Dropdown/index.d.ts +2 -0
- package/lib/components/overlays/Menu/Menu.d.ts +70 -0
- package/lib/components/overlays/Menu/MenuContext.d.ts +68 -0
- package/lib/components/overlays/Menu/MenuDivider.d.ts +10 -0
- package/lib/components/overlays/Menu/MenuGroup.d.ts +20 -0
- package/lib/components/overlays/Menu/MenuItem.d.ts +42 -0
- package/lib/components/overlays/Menu/MenuList.d.ts +16 -0
- package/lib/components/overlays/Menu/index.d.ts +12 -0
- package/lib/components/overlays/Popover/Popover.d.ts +74 -0
- package/lib/components/overlays/Popover/index.d.ts +2 -0
- package/lib/components/overlays/Portal/Portal.d.ts +24 -0
- package/lib/components/overlays/Portal/index.d.ts +2 -0
- package/lib/components/overlays/Tooltip/Tooltip.d.ts +51 -0
- package/lib/components/overlays/Tooltip/index.d.ts +2 -0
- package/lib/components/overlays/index.d.ts +5 -0
- package/lib/contexts/ThemeContext/ThemeContext.d.ts +40 -0
- package/lib/contexts/ThemeContext/index.d.ts +2 -0
- package/lib/contexts/index.d.ts +2 -0
- package/lib/decorators/ComponentDecorator/ComponentDecorator.d.ts +57 -0
- package/lib/decorators/ComponentDecorator/index.d.ts +3 -0
- package/lib/decorators/index.d.ts +2 -0
- package/lib/hooks/index.d.ts +11 -0
- package/lib/hooks/useClickOutside/index.d.ts +1 -0
- package/lib/hooks/useClickOutside/useClickOutside.d.ts +9 -0
- package/lib/hooks/useDebounce/index.d.ts +1 -0
- package/lib/hooks/useDebounce/useDebounce.d.ts +10 -0
- package/lib/hooks/useEscapeKey/index.d.ts +1 -0
- package/lib/hooks/useEscapeKey/useEscapeKey.d.ts +9 -0
- package/lib/hooks/useFocusTrap/index.d.ts +1 -0
- package/lib/hooks/useFocusTrap/useFocusTrap.d.ts +8 -0
- package/lib/hooks/useHover/index.d.ts +2 -0
- package/lib/hooks/useHover/useHover.d.ts +59 -0
- package/lib/hooks/usePopoverPosition/index.d.ts +2 -0
- package/lib/hooks/usePopoverPosition/usePopoverPosition.d.ts +58 -0
- package/lib/hooks/usePortal/index.d.ts +2 -0
- package/lib/hooks/usePortal/usePortal.d.ts +23 -0
- package/lib/hooks/useTheme/index.d.ts +1 -0
- package/lib/providers/GlobalProvider/GlobalProvider.d.ts +56 -0
- package/lib/providers/GlobalProvider/index.d.ts +3 -0
- package/lib/providers/index.d.ts +2 -0
- package/lib/types/component.types.d.ts +129 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/theme.types.d.ts +139 -0
- package/lib/utils/colorUtils.d.ts +71 -0
- package/lib/utils/dateUtils.d.ts +91 -0
- package/lib/utils/dom.d.ts +50 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/positioning.d.ts +59 -0
- package/lib/utils/theme-utils.d.ts +105 -0
- package/lib/utils/validation.d.ts +120 -0
- package/package.json +55 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { InputBaseProps } from '../../../types';
|
|
3
|
+
import { IconName } from '../../../assets/icons';
|
|
4
|
+
/**
|
|
5
|
+
* Validation timing options
|
|
6
|
+
*/
|
|
7
|
+
export type ValidationTiming = 'blur' | 'change' | 'submit' | 'manual';
|
|
8
|
+
/**
|
|
9
|
+
* HTML input types supported
|
|
10
|
+
*/
|
|
11
|
+
export type InputType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local';
|
|
12
|
+
/**
|
|
13
|
+
* Format mask configuration for auto-formatting input
|
|
14
|
+
*/
|
|
15
|
+
export interface FormatMask {
|
|
16
|
+
/**
|
|
17
|
+
* The pattern to format (e.g., "(###) ###-####" for phone)
|
|
18
|
+
*/
|
|
19
|
+
pattern: string;
|
|
20
|
+
/**
|
|
21
|
+
* Character used as placeholder in pattern (default: '#')
|
|
22
|
+
*/
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validation result passed to onValidate callback
|
|
27
|
+
*/
|
|
28
|
+
export interface ValidationResult {
|
|
29
|
+
/**
|
|
30
|
+
* Whether the input is valid
|
|
31
|
+
*/
|
|
32
|
+
isValid: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The value that was validated
|
|
35
|
+
*/
|
|
36
|
+
value: string;
|
|
37
|
+
/**
|
|
38
|
+
* The validation regex pattern used
|
|
39
|
+
*/
|
|
40
|
+
pattern?: RegExp;
|
|
41
|
+
}
|
|
42
|
+
export interface InputProps extends Omit<InputBaseProps, 'children'> {
|
|
43
|
+
/**
|
|
44
|
+
* HTML input type
|
|
45
|
+
* @default 'text'
|
|
46
|
+
*/
|
|
47
|
+
type?: InputType;
|
|
48
|
+
/**
|
|
49
|
+
* Label text to display above input
|
|
50
|
+
*/
|
|
51
|
+
label?: string;
|
|
52
|
+
/**
|
|
53
|
+
* ID for the input element (also used for label[for])
|
|
54
|
+
* Auto-generated if not provided
|
|
55
|
+
*/
|
|
56
|
+
id?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Icon to display at start of input
|
|
59
|
+
* Can be icon name (string) or React component
|
|
60
|
+
*/
|
|
61
|
+
startIcon?: React.ReactNode | IconName;
|
|
62
|
+
/**
|
|
63
|
+
* Icon to display at end of input
|
|
64
|
+
* Can be icon name (string) or React component
|
|
65
|
+
*/
|
|
66
|
+
endIcon?: React.ReactNode | IconName;
|
|
67
|
+
/**
|
|
68
|
+
* Helper text to display below input
|
|
69
|
+
*/
|
|
70
|
+
helperText?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Error message to display (overrides helperText when present)
|
|
73
|
+
*/
|
|
74
|
+
errorMessage?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Whether the input is in an error state
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
error?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Maximum character length (enables character counter)
|
|
82
|
+
*/
|
|
83
|
+
maxLength?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Show character counter when maxLength is set
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
showCounter?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Regex pattern to filter what characters can be entered
|
|
91
|
+
* Prevents invalid characters from being typed
|
|
92
|
+
* @example /^[0-9]*$/ - only allow numbers
|
|
93
|
+
*/
|
|
94
|
+
inputFilter?: RegExp;
|
|
95
|
+
/**
|
|
96
|
+
* Auto-formatting mask to apply as user types
|
|
97
|
+
* Formats the input value according to a pattern
|
|
98
|
+
* @example { pattern: "(###) ###-####" } - formats phone number
|
|
99
|
+
*/
|
|
100
|
+
formatMask?: FormatMask | string;
|
|
101
|
+
/**
|
|
102
|
+
* Regex pattern for validation
|
|
103
|
+
*/
|
|
104
|
+
validationRegex?: RegExp;
|
|
105
|
+
/**
|
|
106
|
+
* Validation callback - called when validation is triggered
|
|
107
|
+
*/
|
|
108
|
+
onValidate?: (result: ValidationResult) => void;
|
|
109
|
+
/**
|
|
110
|
+
* When to trigger validation
|
|
111
|
+
* @default 'blur'
|
|
112
|
+
*/
|
|
113
|
+
validateOn?: ValidationTiming;
|
|
114
|
+
/**
|
|
115
|
+
* Show clear button (X icon) when input has value
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
showClearButton?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Show password visibility toggle for password inputs
|
|
121
|
+
* @default true
|
|
122
|
+
*/
|
|
123
|
+
showPasswordToggle?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Prefix text or component to display before input value
|
|
126
|
+
*/
|
|
127
|
+
prefix?: React.ReactNode | string;
|
|
128
|
+
/**
|
|
129
|
+
* Suffix text or component to display after input value
|
|
130
|
+
*/
|
|
131
|
+
suffix?: React.ReactNode | string;
|
|
132
|
+
/**
|
|
133
|
+
* Loading state - shows spinner
|
|
134
|
+
* @default false
|
|
135
|
+
*/
|
|
136
|
+
loading?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Auto-focus the input on mount
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
autoFocus?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Auto-complete attribute
|
|
144
|
+
*/
|
|
145
|
+
autoComplete?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Default value for uncontrolled component
|
|
148
|
+
*/
|
|
149
|
+
defaultValue?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Callback when input is focused
|
|
152
|
+
*/
|
|
153
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
154
|
+
/**
|
|
155
|
+
* Callback when input loses focus
|
|
156
|
+
*/
|
|
157
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
158
|
+
/**
|
|
159
|
+
* Callback when clear button is clicked
|
|
160
|
+
*/
|
|
161
|
+
onClear?: () => void;
|
|
162
|
+
/**
|
|
163
|
+
* Callback when Enter key is pressed
|
|
164
|
+
*/
|
|
165
|
+
onEnterPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Input component with comprehensive features
|
|
169
|
+
*/
|
|
170
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
171
|
+
export default Input;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'onChange' | 'onBlur'> {
|
|
3
|
+
value?: number;
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
onChange?: (value: number) => void;
|
|
6
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
label?: string;
|
|
11
|
+
helperText?: string;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
error?: boolean;
|
|
14
|
+
formatDisplay?: (value: number) => string;
|
|
15
|
+
id?: string;
|
|
16
|
+
'data-testid'?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { InputBaseProps } from '../../../types/component.types';
|
|
3
|
+
/**
|
|
4
|
+
* Country data for phone input
|
|
5
|
+
*/
|
|
6
|
+
export interface Country {
|
|
7
|
+
code: string;
|
|
8
|
+
name: string;
|
|
9
|
+
dialCode: string;
|
|
10
|
+
flag: string;
|
|
11
|
+
format?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PhoneInputProps extends Omit<InputBaseProps, 'value' | 'onChange' | 'type' | 'onBlur'> {
|
|
14
|
+
/**
|
|
15
|
+
* Controlled phone number value (full number with country code)
|
|
16
|
+
*/
|
|
17
|
+
value?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Default phone number value (uncontrolled)
|
|
20
|
+
*/
|
|
21
|
+
defaultValue?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Default country code (ISO 3166-1 alpha-2)
|
|
24
|
+
*/
|
|
25
|
+
defaultCountry?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Callback when phone number changes
|
|
28
|
+
*/
|
|
29
|
+
onChange?: (phone: string, country: Country) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Callback when input loses focus
|
|
32
|
+
*/
|
|
33
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Input label text
|
|
36
|
+
*/
|
|
37
|
+
label?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Label placement
|
|
40
|
+
*/
|
|
41
|
+
labelPlacement?: 'top' | 'left';
|
|
42
|
+
/**
|
|
43
|
+
* Helper text displayed below the input
|
|
44
|
+
*/
|
|
45
|
+
helperText?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Error message (shows when error is true)
|
|
48
|
+
*/
|
|
49
|
+
errorMessage?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the input is in an error state
|
|
52
|
+
*/
|
|
53
|
+
error?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the field is required
|
|
56
|
+
*/
|
|
57
|
+
required?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to show the country search dropdown
|
|
60
|
+
*/
|
|
61
|
+
showCountrySearch?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Placeholder for country search
|
|
64
|
+
*/
|
|
65
|
+
countrySearchPlaceholder?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Custom country list (defaults to common countries)
|
|
68
|
+
*/
|
|
69
|
+
countries?: Country[];
|
|
70
|
+
/**
|
|
71
|
+
* Whether to format the phone number based on country format
|
|
72
|
+
*/
|
|
73
|
+
autoFormat?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* PhoneInput component with country code selector and auto-formatting
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```tsx
|
|
80
|
+
* <PhoneInput
|
|
81
|
+
* label="Phone Number"
|
|
82
|
+
* defaultCountry="US"
|
|
83
|
+
* onChange={(phone, country) => console.log(phone, country)}
|
|
84
|
+
* />
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconName } from '../../../assets/icons';
|
|
3
|
+
export interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size' | 'type'> {
|
|
4
|
+
/**
|
|
5
|
+
* The value of this radio button
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Label text to display next to radio
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Label placement relative to radio
|
|
14
|
+
* @default 'end'
|
|
15
|
+
*/
|
|
16
|
+
labelPlacement?: 'start' | 'end';
|
|
17
|
+
/**
|
|
18
|
+
* Helper text to display below the radio
|
|
19
|
+
*/
|
|
20
|
+
helperText?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Custom checked icon
|
|
23
|
+
* Can be icon name (string) or React component
|
|
24
|
+
*/
|
|
25
|
+
checkedIcon?: React.ReactNode | IconName;
|
|
26
|
+
/**
|
|
27
|
+
* ID for the input element
|
|
28
|
+
* Auto-generated if not provided
|
|
29
|
+
*/
|
|
30
|
+
id?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Data test ID for testing
|
|
33
|
+
*/
|
|
34
|
+
'data-testid'?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Radio component
|
|
38
|
+
* Individual radio button to be used within RadioGroup
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <Radio value="option1" label="Option 1" />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ComponentSize, ComponentVariant, InputBaseProps } from '../../../types';
|
|
3
|
+
export interface RadioGroupContextValue {
|
|
4
|
+
name: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
size?: ComponentSize;
|
|
10
|
+
variant?: ComponentVariant;
|
|
11
|
+
}
|
|
12
|
+
export declare const RadioGroupContext: React.Context<RadioGroupContextValue | null>;
|
|
13
|
+
export declare const useRadioGroup: () => RadioGroupContextValue;
|
|
14
|
+
export interface RadioGroupProps extends Omit<InputBaseProps, 'value' | 'onChange' | 'placeholder'> {
|
|
15
|
+
/**
|
|
16
|
+
* RadioGroup variant style
|
|
17
|
+
* @default 'primary'
|
|
18
|
+
*/
|
|
19
|
+
variant?: ComponentVariant;
|
|
20
|
+
/**
|
|
21
|
+
* Radio button size
|
|
22
|
+
* @default 'md'
|
|
23
|
+
*/
|
|
24
|
+
size?: ComponentSize;
|
|
25
|
+
/**
|
|
26
|
+
* Currently selected value
|
|
27
|
+
*/
|
|
28
|
+
value?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Default selected value for uncontrolled component
|
|
31
|
+
*/
|
|
32
|
+
defaultValue?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Callback fired when selection changes
|
|
35
|
+
* @param value - The selected value
|
|
36
|
+
* @param event - The change event
|
|
37
|
+
*/
|
|
38
|
+
onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Layout orientation
|
|
41
|
+
* @default 'vertical'
|
|
42
|
+
*/
|
|
43
|
+
orientation?: 'horizontal' | 'vertical';
|
|
44
|
+
/**
|
|
45
|
+
* Group label
|
|
46
|
+
*/
|
|
47
|
+
label?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Helper text to display below the group
|
|
50
|
+
*/
|
|
51
|
+
helperText?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Error message to display when group is in error state
|
|
54
|
+
*/
|
|
55
|
+
errorMessage?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the group is in an error state
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
error?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Radio button children
|
|
63
|
+
*/
|
|
64
|
+
children: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Gap between radio buttons (in spacing units)
|
|
67
|
+
* @default 2 (8px)
|
|
68
|
+
*/
|
|
69
|
+
gap?: number;
|
|
70
|
+
/**
|
|
71
|
+
* ID for the fieldset element
|
|
72
|
+
*/
|
|
73
|
+
id?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* RadioGroup component
|
|
77
|
+
* Container for Radio buttons that manages selection state
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <RadioGroup value={size} onChange={setSize} label="Select size">
|
|
82
|
+
* <Radio value="small" label="Small" />
|
|
83
|
+
* <Radio value="medium" label="Medium" />
|
|
84
|
+
* <Radio value="large" label="Large" />
|
|
85
|
+
* </RadioGroup>
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ComponentSize } from '../../../types';
|
|
3
|
+
import { IconName } from '../../../assets/icons';
|
|
4
|
+
export interface RatingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onBlur'> {
|
|
5
|
+
size?: ComponentSize;
|
|
6
|
+
value?: number;
|
|
7
|
+
defaultValue?: number;
|
|
8
|
+
onChange?: (value: number) => void;
|
|
9
|
+
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
10
|
+
max?: number;
|
|
11
|
+
precision?: number;
|
|
12
|
+
icon?: React.ReactNode | IconName;
|
|
13
|
+
emptyIcon?: React.ReactNode | IconName;
|
|
14
|
+
label?: string;
|
|
15
|
+
helperText?: string;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
id?: string;
|
|
20
|
+
'data-testid'?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const Rating: React.ForwardRefExoticComponent<RatingProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconName } from '../../../assets/icons';
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
/**
|
|
5
|
+
* Option value
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Option label (displayed text)
|
|
10
|
+
*/
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Whether option is disabled
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional group name for grouping options
|
|
19
|
+
*/
|
|
20
|
+
group?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
23
|
+
/**
|
|
24
|
+
* Options to display
|
|
25
|
+
*/
|
|
26
|
+
options: SelectOption[];
|
|
27
|
+
/**
|
|
28
|
+
* Selected value
|
|
29
|
+
*/
|
|
30
|
+
value?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Default selected value for uncontrolled component
|
|
33
|
+
*/
|
|
34
|
+
defaultValue?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Callback fired when selection changes
|
|
37
|
+
*/
|
|
38
|
+
onChange?: (value: string, event: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Callback fired when select loses focus
|
|
41
|
+
*/
|
|
42
|
+
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the select is disabled
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the select is read-only
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
readOnly?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the select is required
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
required?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Label text to display above select
|
|
60
|
+
*/
|
|
61
|
+
label?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Helper text to display below select
|
|
64
|
+
*/
|
|
65
|
+
helperText?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Error message to display when in error state
|
|
68
|
+
*/
|
|
69
|
+
errorMessage?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the select is in an error state
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
error?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Show clear button to reset selection
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
showClearButton?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Icon to display at start of select
|
|
82
|
+
*/
|
|
83
|
+
startIcon?: React.ReactNode | IconName;
|
|
84
|
+
/**
|
|
85
|
+
* Icon to display at end of select (overrides default dropdown arrow)
|
|
86
|
+
*/
|
|
87
|
+
endIcon?: React.ReactNode | IconName;
|
|
88
|
+
/**
|
|
89
|
+
* Placeholder text when no option is selected
|
|
90
|
+
*/
|
|
91
|
+
placeholder?: string;
|
|
92
|
+
/**
|
|
93
|
+
* ID for the select element
|
|
94
|
+
* Auto-generated if not provided
|
|
95
|
+
*/
|
|
96
|
+
id?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Enable search functionality for filtering options
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
searchable?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Placeholder text for search input
|
|
104
|
+
* @default 'Search...'
|
|
105
|
+
*/
|
|
106
|
+
searchPlaceholder?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Whether to scroll to the selected item when menu opens
|
|
109
|
+
* @default true
|
|
110
|
+
*/
|
|
111
|
+
scrollToSelected?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Enable keyboard type-ahead navigation
|
|
114
|
+
* When enabled, typing characters will jump to/cycle through matching items
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
enableTypeAhead?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Delay in milliseconds before resetting the type-ahead search string
|
|
120
|
+
* @default 500
|
|
121
|
+
*/
|
|
122
|
+
typeAheadDelay?: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Select component
|
|
126
|
+
* Custom select element with Menu component, option grouping, and optional search
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```tsx
|
|
130
|
+
* <Select
|
|
131
|
+
* label="Country"
|
|
132
|
+
* options={[
|
|
133
|
+
* { value: 'us', label: 'United States' },
|
|
134
|
+
* { value: 'ca', label: 'Canada' },
|
|
135
|
+
* ]}
|
|
136
|
+
* value={country}
|
|
137
|
+
* onChange={(value) => setCountry(value)}
|
|
138
|
+
* searchable
|
|
139
|
+
* />
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ComponentSize, ComponentVariant } from '../../../types';
|
|
3
|
+
export interface Mark {
|
|
4
|
+
value: number;
|
|
5
|
+
label?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'size' | 'defaultValue'> {
|
|
8
|
+
variant?: ComponentVariant;
|
|
9
|
+
size?: ComponentSize;
|
|
10
|
+
value?: number | number[];
|
|
11
|
+
defaultValue?: number | number[];
|
|
12
|
+
onChange?: (value: number | number[]) => void;
|
|
13
|
+
onChangeCommitted?: (value: number | number[]) => void;
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
step?: number;
|
|
17
|
+
marks?: boolean | Mark[];
|
|
18
|
+
label?: string;
|
|
19
|
+
helperText?: string;
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
error?: boolean;
|
|
22
|
+
showValue?: boolean;
|
|
23
|
+
valueLabelDisplay?: 'on' | 'auto' | 'off';
|
|
24
|
+
valueLabelFormat?: (value: number) => string;
|
|
25
|
+
orientation?: 'horizontal' | 'vertical';
|
|
26
|
+
id?: string;
|
|
27
|
+
'data-testid'?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLInputElement>>;
|