@vtx-ui/react 0.0.1-beta.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/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/components/Accordion/Accordion.d.ts +31 -0
- package/dist/components/Accordion/Accordion.examples.d.ts +3 -0
- package/dist/components/Accordion/AccordionItem.d.ts +5 -0
- package/dist/components/Accordion/index.d.ts +4 -0
- package/dist/components/Accordion/types.d.ts +98 -0
- package/dist/components/Alert/Alert.d.ts +119 -0
- package/dist/components/Alert/index.d.ts +3 -0
- package/dist/components/Avatar/Avatar.d.ts +63 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/Badge/Badge.d.ts +81 -0
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Button/Button.d.ts +117 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Card/Card.d.ts +120 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts +114 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +121 -0
- package/dist/components/CheckboxGroup/index.d.ts +3 -0
- package/dist/components/Chip/Chip.d.ts +91 -0
- package/dist/components/Chip/index.d.ts +3 -0
- package/dist/components/Divider/Divider.d.ts +118 -0
- package/dist/components/Divider/index.d.ts +3 -0
- package/dist/components/Flex/Flex.d.ts +66 -0
- package/dist/components/Flex/index.d.ts +3 -0
- package/dist/components/Grid/Grid.d.ts +156 -0
- package/dist/components/Grid/index.d.ts +3 -0
- package/dist/components/Header/Header.d.ts +138 -0
- package/dist/components/Header/index.d.ts +3 -0
- package/dist/components/Input/Input.d.ts +129 -0
- package/dist/components/Input/index.d.ts +3 -0
- package/dist/components/Menu/Menu.d.ts +114 -0
- package/dist/components/Menu/index.d.ts +4 -0
- package/dist/components/Modal/Modal.d.ts +201 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +190 -0
- package/dist/components/MultiSelect/index.d.ts +3 -0
- package/dist/components/Radio/Radio.d.ts +105 -0
- package/dist/components/Radio/index.d.ts +3 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +134 -0
- package/dist/components/RadioGroup/index.d.ts +3 -0
- package/dist/components/Select/Select.d.ts +169 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/SideMenu/SideMenu.d.ts +118 -0
- package/dist/components/SideMenu/index.d.ts +4 -0
- package/dist/components/Table/Table.d.ts +211 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Text/Text.d.ts +160 -0
- package/dist/components/Text/index.d.ts +3 -0
- package/dist/components/Toast/Toast.d.ts +56 -0
- package/dist/components/Toast/ToastContainer.d.ts +6 -0
- package/dist/components/Toast/index.d.ts +5 -0
- package/dist/components/Toast/types.d.ts +148 -0
- package/dist/components/Toast/useToast.d.ts +34 -0
- package/dist/components/Tooltip/Tooltip.d.ts +108 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/hooks/index.d.ts +85 -0
- package/dist/hooks/useTheme.d.ts +268 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +39 -0
- package/dist/theme/cssVariables.d.ts +9 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/tokens.d.ts +258 -0
- package/dist/types/components/Accordion/Accordion.d.ts +31 -0
- package/dist/types/components/Accordion/Accordion.examples.d.ts +3 -0
- package/dist/types/components/Accordion/AccordionItem.d.ts +5 -0
- package/dist/types/components/Accordion/index.d.ts +4 -0
- package/dist/types/components/Accordion/types.d.ts +98 -0
- package/dist/types/components/Alert/Alert.d.ts +119 -0
- package/dist/types/components/Alert/index.d.ts +3 -0
- package/dist/types/components/Avatar/Avatar.d.ts +63 -0
- package/dist/types/components/Avatar/index.d.ts +3 -0
- package/dist/types/components/Badge/Badge.d.ts +81 -0
- package/dist/types/components/Badge/index.d.ts +3 -0
- package/dist/types/components/Button/Button.d.ts +117 -0
- package/dist/types/components/Button/index.d.ts +3 -0
- package/dist/types/components/Card/Card.d.ts +120 -0
- package/dist/types/components/Card/index.d.ts +3 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +114 -0
- package/dist/types/components/Checkbox/index.d.ts +3 -0
- package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts +121 -0
- package/dist/types/components/CheckboxGroup/index.d.ts +3 -0
- package/dist/types/components/Chip/Chip.d.ts +91 -0
- package/dist/types/components/Chip/index.d.ts +3 -0
- package/dist/types/components/Divider/Divider.d.ts +118 -0
- package/dist/types/components/Divider/index.d.ts +3 -0
- package/dist/types/components/Flex/Flex.d.ts +66 -0
- package/dist/types/components/Flex/index.d.ts +3 -0
- package/dist/types/components/Grid/Grid.d.ts +156 -0
- package/dist/types/components/Grid/index.d.ts +3 -0
- package/dist/types/components/Header/Header.d.ts +138 -0
- package/dist/types/components/Header/index.d.ts +3 -0
- package/dist/types/components/Input/Input.d.ts +129 -0
- package/dist/types/components/Input/index.d.ts +3 -0
- package/dist/types/components/Menu/Menu.d.ts +114 -0
- package/dist/types/components/Menu/index.d.ts +4 -0
- package/dist/types/components/Modal/Modal.d.ts +201 -0
- package/dist/types/components/Modal/index.d.ts +3 -0
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +190 -0
- package/dist/types/components/MultiSelect/index.d.ts +3 -0
- package/dist/types/components/Radio/Radio.d.ts +105 -0
- package/dist/types/components/Radio/index.d.ts +3 -0
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +134 -0
- package/dist/types/components/RadioGroup/index.d.ts +3 -0
- package/dist/types/components/Select/Select.d.ts +169 -0
- package/dist/types/components/Select/index.d.ts +3 -0
- package/dist/types/components/SideMenu/SideMenu.d.ts +118 -0
- package/dist/types/components/SideMenu/index.d.ts +4 -0
- package/dist/types/components/Table/Table.d.ts +211 -0
- package/dist/types/components/Table/index.d.ts +3 -0
- package/dist/types/components/Text/Text.d.ts +160 -0
- package/dist/types/components/Text/index.d.ts +3 -0
- package/dist/types/components/Toast/Toast.d.ts +56 -0
- package/dist/types/components/Toast/ToastContainer.d.ts +6 -0
- package/dist/types/components/Toast/index.d.ts +5 -0
- package/dist/types/components/Toast/types.d.ts +148 -0
- package/dist/types/components/Toast/useToast.d.ts +34 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +108 -0
- package/dist/types/components/Tooltip/index.d.ts +3 -0
- package/dist/types/hooks/index.d.ts +85 -0
- package/dist/types/hooks/useTheme.d.ts +268 -0
- package/dist/types/index.d.ts +55 -0
- package/dist/types/theme/ThemeProvider.d.ts +39 -0
- package/dist/types/theme/cssVariables.d.ts +9 -0
- package/dist/types/theme/index.d.ts +6 -0
- package/dist/types/theme/tokens.d.ts +258 -0
- package/package.json +59 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './MultiSelect.css';
|
|
3
|
+
export interface MultiSelectOption {
|
|
4
|
+
/**
|
|
5
|
+
* Value of the option
|
|
6
|
+
*/
|
|
7
|
+
value: string | number;
|
|
8
|
+
/**
|
|
9
|
+
* Display label for the option
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* If true, option cannot be selected
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional group this option belongs to
|
|
19
|
+
*/
|
|
20
|
+
group?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface MultiSelectProps {
|
|
23
|
+
/**
|
|
24
|
+
* Label text displayed above the select
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Helper text displayed below the select
|
|
29
|
+
*/
|
|
30
|
+
helperText?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Error message - when provided, select is shown in error state
|
|
33
|
+
*/
|
|
34
|
+
error?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Success message - when provided, select is shown in success state
|
|
37
|
+
*/
|
|
38
|
+
success?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Size of the select
|
|
41
|
+
* @default 'medium'
|
|
42
|
+
*/
|
|
43
|
+
size?: 'sm' | 'md' | 'lg';
|
|
44
|
+
/**
|
|
45
|
+
* If true, select will take full width of its container
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
fullWidth?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Options to display in the select dropdown
|
|
51
|
+
*/
|
|
52
|
+
options: MultiSelectOption[];
|
|
53
|
+
/**
|
|
54
|
+
* Selected values
|
|
55
|
+
*/
|
|
56
|
+
value?: (string | number)[];
|
|
57
|
+
/**
|
|
58
|
+
* Default selected values for uncontrolled component
|
|
59
|
+
*/
|
|
60
|
+
defaultValue?: (string | number)[];
|
|
61
|
+
/**
|
|
62
|
+
* Placeholder text shown when no option is selected
|
|
63
|
+
*/
|
|
64
|
+
placeholder?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Custom class name for the wrapper element
|
|
67
|
+
*/
|
|
68
|
+
className?: string;
|
|
69
|
+
/**
|
|
70
|
+
* If true, options will be grouped
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
grouped?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Property name or function to extract the display label from each option
|
|
76
|
+
*/
|
|
77
|
+
getOptionLabel?: string | ((option: any) => string);
|
|
78
|
+
/**
|
|
79
|
+
* Property name or function to extract the value from each option
|
|
80
|
+
*/
|
|
81
|
+
getOptionValue?: string | ((option: any) => string | number);
|
|
82
|
+
/**
|
|
83
|
+
* Property name or function to determine if an option is disabled
|
|
84
|
+
*/
|
|
85
|
+
getOptionDisabled?: string | ((option: any) => boolean);
|
|
86
|
+
/**
|
|
87
|
+
* Property name or function to extract the group from each option
|
|
88
|
+
*/
|
|
89
|
+
getOptionGroup?: string | ((option: any) => string);
|
|
90
|
+
/**
|
|
91
|
+
* Callback fired when selection changes
|
|
92
|
+
*/
|
|
93
|
+
onChange?: (values: (string | number)[], selectedOptions: MultiSelectOption[]) => void;
|
|
94
|
+
/**
|
|
95
|
+
* If true, component is disabled
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* If true, field is required
|
|
101
|
+
* @default false
|
|
102
|
+
*/
|
|
103
|
+
required?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Unique identifier
|
|
106
|
+
*/
|
|
107
|
+
id?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Name attribute for form integration
|
|
110
|
+
*/
|
|
111
|
+
name?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Selection style
|
|
114
|
+
* @default 'checkbox'
|
|
115
|
+
*/
|
|
116
|
+
selectionStyle?: 'checkbox' | 'checkmark';
|
|
117
|
+
/**
|
|
118
|
+
* If true, shows a searchable input in the dropdown
|
|
119
|
+
* @default false
|
|
120
|
+
*/
|
|
121
|
+
searchable?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* If true, shows Select All / Clear All actions
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
showSelectAll?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Maximum number of chips to display before showing "+N more"
|
|
129
|
+
* @default undefined (shows all)
|
|
130
|
+
*/
|
|
131
|
+
maxChipsDisplay?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Custom chip color
|
|
134
|
+
* @default 'primary'
|
|
135
|
+
*/
|
|
136
|
+
chipColor?: 'default' | 'primary' | 'success' | 'error' | 'warning' | 'info';
|
|
137
|
+
/**
|
|
138
|
+
* Custom chip variant
|
|
139
|
+
* @default 'light'
|
|
140
|
+
*/
|
|
141
|
+
chipVariant?: 'filled' | 'outlined' | 'light';
|
|
142
|
+
/**
|
|
143
|
+
* If true, shows a loading spinner in the dropdown
|
|
144
|
+
* @default false
|
|
145
|
+
*/
|
|
146
|
+
loading?: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* MultiSelect component - Multi-selection dropdown with chips display
|
|
150
|
+
*
|
|
151
|
+
* A professional multi-select component supporting checkbox or checkmark styles,
|
|
152
|
+
* with chips display, search functionality, and group support.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* Basic usage with checkbox style
|
|
156
|
+
* ```tsx
|
|
157
|
+
* <MultiSelect
|
|
158
|
+
* label="Select Technologies"
|
|
159
|
+
* placeholder="Choose technologies"
|
|
160
|
+
* options={technologies}
|
|
161
|
+
* onChange={(values) => console.log(values)}
|
|
162
|
+
* />
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* With checkmark style
|
|
167
|
+
* ```tsx
|
|
168
|
+
* <MultiSelect
|
|
169
|
+
* label="Select Skills"
|
|
170
|
+
* options={skills}
|
|
171
|
+
* selectionStyle="checkmark"
|
|
172
|
+
* searchable
|
|
173
|
+
* showSelectAll
|
|
174
|
+
* />
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* Customize loading spinner via CSS
|
|
179
|
+
* ```css
|
|
180
|
+
* .vtx-multiselect-icon-spinner {
|
|
181
|
+
* --vtx-multiselect-loader-color: #10b981;
|
|
182
|
+
* --vtx-multiselect-loader-speed: 1.2s;
|
|
183
|
+
* --vtx-multiselect-loader-track-opacity: 0.15;
|
|
184
|
+
* --vtx-multiselect-loader-path-opacity: 0.85;
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
189
|
+
declare const _default: React.FC<MultiSelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
190
|
+
export default _default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Radio.css';
|
|
3
|
+
export interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
4
|
+
/**
|
|
5
|
+
* If true, the radio is checked
|
|
6
|
+
*/
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* If true, the radio is disabled
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The label for the radio
|
|
15
|
+
*/
|
|
16
|
+
label?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* The size of the radio
|
|
19
|
+
* @default 'medium'
|
|
20
|
+
*/
|
|
21
|
+
size?: 'small' | 'medium' | 'large';
|
|
22
|
+
/**
|
|
23
|
+
* The variant of the radio
|
|
24
|
+
* @default 'primary'
|
|
25
|
+
*/
|
|
26
|
+
variant?: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info';
|
|
27
|
+
/**
|
|
28
|
+
* If true, displays error styling
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
error?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Helper text displayed below the radio
|
|
34
|
+
*/
|
|
35
|
+
helperText?: React.ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Callback fired when the state is changed
|
|
38
|
+
*/
|
|
39
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Additional CSS class name for the container
|
|
42
|
+
*/
|
|
43
|
+
className?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Additional CSS class name for the input element
|
|
46
|
+
*/
|
|
47
|
+
inputClassName?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Radio component - Allows users to select a single option from a set
|
|
51
|
+
*
|
|
52
|
+
* The Radio component provides a customizable radio input with support
|
|
53
|
+
* for labels, error states, variants, and three sizes.
|
|
54
|
+
*
|
|
55
|
+
* ## CSS Customization
|
|
56
|
+
*
|
|
57
|
+
* You can customize the radio appearance using CSS custom properties:
|
|
58
|
+
*
|
|
59
|
+
* ```css
|
|
60
|
+
* :root {
|
|
61
|
+
* --vtx-radio-color: #1976d2;
|
|
62
|
+
* --vtx-radio-size: 20px;
|
|
63
|
+
* --vtx-radio-border-width: 2px;
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* Basic radio
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <Radio label="Option 1" name="options" value="1" />
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* Controlled radio
|
|
75
|
+
* ```tsx
|
|
76
|
+
* const [selected, setSelected] = useState('1');
|
|
77
|
+
* <Radio
|
|
78
|
+
* checked={selected === '1'}
|
|
79
|
+
* onChange={(e) => setSelected(e.target.value)}
|
|
80
|
+
* label="Option 1"
|
|
81
|
+
* value="1"
|
|
82
|
+
* />
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* With error state
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <Radio
|
|
89
|
+
* label="Required option"
|
|
90
|
+
* error
|
|
91
|
+
* helperText="Please select an option"
|
|
92
|
+
* />
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* Different variants
|
|
97
|
+
* ```tsx
|
|
98
|
+
* <Radio label="Primary" variant="primary" />
|
|
99
|
+
* <Radio label="Success" variant="success" />
|
|
100
|
+
* <Radio label="Error" variant="error" />
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
104
|
+
declare const _default: React.FC<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
105
|
+
export default _default;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './RadioGroup.css';
|
|
3
|
+
export interface RadioOption {
|
|
4
|
+
/**
|
|
5
|
+
* The value of the radio
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* The label for the radio
|
|
10
|
+
*/
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* If true, the radio is disabled
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
18
|
+
/**
|
|
19
|
+
* The name for the radio group (all radios will share this name)
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* The label for the radio group
|
|
24
|
+
*/
|
|
25
|
+
label?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Array of radio options
|
|
28
|
+
*/
|
|
29
|
+
options: RadioOption[];
|
|
30
|
+
/**
|
|
31
|
+
* The selected value
|
|
32
|
+
*/
|
|
33
|
+
value?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Default selected value for uncontrolled mode
|
|
36
|
+
*/
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Callback fired when the selection changes
|
|
40
|
+
*/
|
|
41
|
+
onChange?: (value: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* If true, all radios are disabled
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* If true, displays error styling
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
error?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Helper text displayed below the group
|
|
54
|
+
*/
|
|
55
|
+
helperText?: React.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* The layout orientation of the radios
|
|
58
|
+
* @default 'vertical'
|
|
59
|
+
*/
|
|
60
|
+
orientation?: 'horizontal' | 'vertical';
|
|
61
|
+
/**
|
|
62
|
+
* The size of the radios
|
|
63
|
+
* @default 'medium'
|
|
64
|
+
*/
|
|
65
|
+
size?: 'small' | 'medium' | 'large';
|
|
66
|
+
/**
|
|
67
|
+
* The variant of the radios
|
|
68
|
+
* @default 'primary'
|
|
69
|
+
*/
|
|
70
|
+
variant?: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info';
|
|
71
|
+
/**
|
|
72
|
+
* Additional CSS class name
|
|
73
|
+
*/
|
|
74
|
+
className?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* RadioGroup component - Manages a group of related radio buttons
|
|
78
|
+
*
|
|
79
|
+
* The RadioGroup component provides a convenient way to manage multiple
|
|
80
|
+
* radio buttons with shared state, labels, and error handling.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* Basic usage
|
|
84
|
+
* ```tsx
|
|
85
|
+
* <RadioGroup
|
|
86
|
+
* name="plan"
|
|
87
|
+
* label="Select your plan"
|
|
88
|
+
* options={[
|
|
89
|
+
* { value: 'basic', label: 'Basic' },
|
|
90
|
+
* { value: 'pro', label: 'Pro' },
|
|
91
|
+
* { value: 'enterprise', label: 'Enterprise' },
|
|
92
|
+
* ]}
|
|
93
|
+
* />
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* Controlled mode
|
|
98
|
+
* ```tsx
|
|
99
|
+
* const [selected, setSelected] = useState('basic');
|
|
100
|
+
* <RadioGroup
|
|
101
|
+
* name="plan"
|
|
102
|
+
* label="Plan"
|
|
103
|
+
* options={options}
|
|
104
|
+
* value={selected}
|
|
105
|
+
* onChange={setSelected}
|
|
106
|
+
* />
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* Horizontal layout
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <RadioGroup
|
|
113
|
+
* name="answer"
|
|
114
|
+
* label="Your answer"
|
|
115
|
+
* options={options}
|
|
116
|
+
* orientation="horizontal"
|
|
117
|
+
* />
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* With error state
|
|
122
|
+
* ```tsx
|
|
123
|
+
* <RadioGroup
|
|
124
|
+
* name="required"
|
|
125
|
+
* label="Required selection"
|
|
126
|
+
* options={options}
|
|
127
|
+
* error
|
|
128
|
+
* helperText="Please select an option"
|
|
129
|
+
* />
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
133
|
+
declare const _default: React.FC<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
134
|
+
export default _default;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import React, { SelectHTMLAttributes } from 'react';
|
|
2
|
+
import './Select.css';
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
/**
|
|
5
|
+
* Value of the option
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Display label for the option
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* If true, option cannot be selected
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional group this option belongs to
|
|
19
|
+
*/
|
|
20
|
+
group?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
23
|
+
/**
|
|
24
|
+
* Label text displayed above the select
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Helper text displayed below the select
|
|
29
|
+
* Provides additional context or instructions
|
|
30
|
+
*/
|
|
31
|
+
helperText?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Error message - when provided, select is shown in error state
|
|
34
|
+
*/
|
|
35
|
+
error?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Success message - when provided, select is shown in success state
|
|
38
|
+
*/
|
|
39
|
+
success?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Size of the select
|
|
42
|
+
* @default 'medium'
|
|
43
|
+
*/
|
|
44
|
+
size?: 'small' | 'medium' | 'large';
|
|
45
|
+
/**
|
|
46
|
+
* If true, select will take full width of its container
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
fullWidth?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Options to display in the select dropdown
|
|
52
|
+
*/
|
|
53
|
+
options: SelectOption[];
|
|
54
|
+
/**
|
|
55
|
+
* Placeholder text shown when no option is selected
|
|
56
|
+
*/
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Custom class name for the wrapper element
|
|
60
|
+
*/
|
|
61
|
+
wrapperClassName?: string;
|
|
62
|
+
/**
|
|
63
|
+
* If true, groups options by their group property
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
grouped?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Property name or function to extract the display label from each option
|
|
69
|
+
* @default 'label'
|
|
70
|
+
* @example
|
|
71
|
+
* getOptionLabel="productName" // uses option.productName
|
|
72
|
+
* getOptionLabel={(option) => option.firstName + ' ' + option.lastName}
|
|
73
|
+
*/
|
|
74
|
+
getOptionLabel?: string | ((option: any) => string);
|
|
75
|
+
/**
|
|
76
|
+
* Property name or function to extract the value from each option
|
|
77
|
+
* @default 'value'
|
|
78
|
+
* @example
|
|
79
|
+
* getOptionValue="id" // uses option.id
|
|
80
|
+
* getOptionValue={(option) => option.uuid}
|
|
81
|
+
*/
|
|
82
|
+
getOptionValue?: string | ((option: any) => string | number);
|
|
83
|
+
/**
|
|
84
|
+
* Property name or function to determine if an option is disabled
|
|
85
|
+
* @default 'disabled'
|
|
86
|
+
* @example
|
|
87
|
+
* getOptionDisabled="isInactive" // uses option.isInactive
|
|
88
|
+
* getOptionDisabled={(option) => option.stock === 0}
|
|
89
|
+
*/
|
|
90
|
+
getOptionDisabled?: string | ((option: any) => boolean);
|
|
91
|
+
/**
|
|
92
|
+
* Property name or function to extract the group from each option
|
|
93
|
+
* @default 'group'
|
|
94
|
+
* @example
|
|
95
|
+
* getOptionGroup="category" // uses option.category
|
|
96
|
+
* getOptionGroup={(option) => option.department}
|
|
97
|
+
*/
|
|
98
|
+
getOptionGroup?: string | ((option: any) => string);
|
|
99
|
+
/**
|
|
100
|
+
* Callback fired when selection changes
|
|
101
|
+
* Provides both event and selected option
|
|
102
|
+
*/
|
|
103
|
+
onSelectChange?: (value: string, option: SelectOption | undefined) => void;
|
|
104
|
+
/**
|
|
105
|
+
* If true, shows a loading spinner in place of the dropdown icon
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
loading?: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Select component - Dropdown selection control with label, validation states, and grouping support
|
|
112
|
+
*
|
|
113
|
+
* A comprehensive select component with support for grouped options, validation states,
|
|
114
|
+
* and enhanced accessibility features.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* Basic usage
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <Select
|
|
120
|
+
* label="Country"
|
|
121
|
+
* placeholder="Select a country"
|
|
122
|
+
* options={[
|
|
123
|
+
* { value: 'us', label: 'United States' },
|
|
124
|
+
* { value: 'uk', label: 'United Kingdom' },
|
|
125
|
+
* ]}
|
|
126
|
+
* />
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* With grouped options
|
|
131
|
+
* ```tsx
|
|
132
|
+
* <Select
|
|
133
|
+
* label="Framework"
|
|
134
|
+
* grouped
|
|
135
|
+
* options={[
|
|
136
|
+
* { value: 'react', label: 'React', group: 'Frontend' },
|
|
137
|
+
* { value: 'vue', label: 'Vue', group: 'Frontend' },
|
|
138
|
+
* { value: 'node', label: 'Node.js', group: 'Backend' },
|
|
139
|
+
* { value: 'django', label: 'Django', group: 'Backend' },
|
|
140
|
+
* ]}
|
|
141
|
+
* />
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* With change callback
|
|
146
|
+
* ```tsx
|
|
147
|
+
* <Select
|
|
148
|
+
* label="Status"
|
|
149
|
+
* options={statusOptions}
|
|
150
|
+
* onSelectChange={(value, option) => {
|
|
151
|
+
* console.log('Selected:', value, option);
|
|
152
|
+
* }}
|
|
153
|
+
* />
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* Customize loading spinner via CSS
|
|
158
|
+
* ```css
|
|
159
|
+
* .vtx-select-icon-spinner {
|
|
160
|
+
* --vtx-select-loader-color: #10b981;
|
|
161
|
+
* --vtx-select-loader-speed: 1.2s;
|
|
162
|
+
* --vtx-select-loader-track-opacity: 0.15;
|
|
163
|
+
* --vtx-select-loader-path-opacity: 0.85;
|
|
164
|
+
* }
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
168
|
+
declare const _default: React.FC<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
169
|
+
export default _default;
|