@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,201 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Modal.css';
|
|
3
|
+
export interface ModalFooterButton {
|
|
4
|
+
/**
|
|
5
|
+
* Button label text
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Click handler for the button
|
|
10
|
+
*/
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Button variant
|
|
14
|
+
* @default 'secondary'
|
|
15
|
+
*/
|
|
16
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success' | 'warning';
|
|
17
|
+
/**
|
|
18
|
+
* Button size
|
|
19
|
+
* @default 'medium'
|
|
20
|
+
*/
|
|
21
|
+
size?: 'sm' | 'md' | 'lg';
|
|
22
|
+
/**
|
|
23
|
+
* Loading state
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Disabled state
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ModalProps {
|
|
34
|
+
/**
|
|
35
|
+
* Whether the modal is open
|
|
36
|
+
*/
|
|
37
|
+
isOpen: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Callback fired when the modal requests to be closed
|
|
40
|
+
* Called on backdrop click, escape key, or close button click
|
|
41
|
+
*/
|
|
42
|
+
onClose: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Modal title displayed in header
|
|
45
|
+
*/
|
|
46
|
+
title?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Optional subtitle or description below the title
|
|
49
|
+
*/
|
|
50
|
+
description?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Modal content
|
|
53
|
+
*/
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* Optional header content to replace the default title area
|
|
57
|
+
* When provided, title and description are ignored
|
|
58
|
+
*/
|
|
59
|
+
header?: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Optional footer content (typically action buttons)
|
|
62
|
+
* Can be a ReactNode or an array of button configurations
|
|
63
|
+
*/
|
|
64
|
+
footer?: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Array of footer buttons to auto-generate footer
|
|
67
|
+
* If provided, footer prop is ignored
|
|
68
|
+
*/
|
|
69
|
+
footerButtons?: ModalFooterButton[];
|
|
70
|
+
/** Size of the modal ('sm', 'md', 'lg', 'fullscreen', 'auto'). Defaults to theme defaultSize */
|
|
71
|
+
size?: 'sm' | 'md' | 'lg' | 'fullscreen' | 'auto';
|
|
72
|
+
/**
|
|
73
|
+
* If false, clicking the backdrop won't close the modal
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
closeOnBackdropClick?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* If false, pressing Escape won't close the modal
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
closeOnEscape?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* If false, hides the close button in the header
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
showCloseButton?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* If true, modal backdrop will be transparent
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
transparentBackdrop?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Custom class name for the modal content
|
|
94
|
+
*/
|
|
95
|
+
className?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Custom class name for the modal backdrop
|
|
98
|
+
*/
|
|
99
|
+
backdropClassName?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Prevents body scroll when modal is open
|
|
102
|
+
* @default true
|
|
103
|
+
*/
|
|
104
|
+
preventScroll?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Animation variant for modal entrance
|
|
107
|
+
* @default 'fade'
|
|
108
|
+
*/
|
|
109
|
+
animation?: 'fade' | 'slide-up' | 'slide-down' | 'zoom' | 'none';
|
|
110
|
+
/**
|
|
111
|
+
* Callback fired after modal opens (after animation completes)
|
|
112
|
+
*/
|
|
113
|
+
onAfterOpen?: () => void;
|
|
114
|
+
/**
|
|
115
|
+
* Callback fired after modal closes (after animation completes)
|
|
116
|
+
*/
|
|
117
|
+
onAfterClose?: () => void;
|
|
118
|
+
/**
|
|
119
|
+
* If true, modal will be scrollable inside
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
scrollable?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* If true, centers the modal vertically
|
|
125
|
+
* @default true
|
|
126
|
+
*/
|
|
127
|
+
centered?: boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Modal component - Overlay dialog for focused user interactions
|
|
131
|
+
*
|
|
132
|
+
* A feature-rich modal component with accessibility features including focus trap,
|
|
133
|
+
* body scroll lock, keyboard navigation, and customizable animations.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* Basic confirmation modal with footerButtons array
|
|
137
|
+
* ```tsx
|
|
138
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
139
|
+
*
|
|
140
|
+
* <Modal
|
|
141
|
+
* isOpen={isOpen}
|
|
142
|
+
* onClose={() => setIsOpen(false)}
|
|
143
|
+
* title="Confirm Action"
|
|
144
|
+
* description="Are you sure you want to proceed with this action?"
|
|
145
|
+
* footerButtons={[
|
|
146
|
+
* { label: 'Cancel', onClick: () => setIsOpen(false), variant: 'outline' },
|
|
147
|
+
* { label: 'Confirm', onClick: handleConfirm, variant: 'primary' }
|
|
148
|
+
* ]}
|
|
149
|
+
* >
|
|
150
|
+
* <p>This action cannot be undone.</p>
|
|
151
|
+
* </Modal>
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* Custom footer with ReactNode
|
|
156
|
+
* ```tsx
|
|
157
|
+
* <Modal
|
|
158
|
+
* isOpen={isOpen}
|
|
159
|
+
* onClose={() => setIsOpen(false)}
|
|
160
|
+
* title="Custom Footer"
|
|
161
|
+
* footer={
|
|
162
|
+
* <>
|
|
163
|
+
* <Button onClick={() => setIsOpen(false)}>Cancel</Button>
|
|
164
|
+
* <Button variant="primary">Save</Button>
|
|
165
|
+
* </>
|
|
166
|
+
* }
|
|
167
|
+
* >
|
|
168
|
+
* <p>Custom content here.</p>
|
|
169
|
+
* </Modal>
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* Form modal with custom header
|
|
174
|
+
* ```tsx
|
|
175
|
+
* <Modal
|
|
176
|
+
* isOpen={isOpen}
|
|
177
|
+
* onClose={() => setIsOpen(false)}
|
|
178
|
+
* size="large"
|
|
179
|
+
* header={<CustomHeader />}
|
|
180
|
+
* scrollable
|
|
181
|
+
* >
|
|
182
|
+
* <FormContent />
|
|
183
|
+
* </Modal>
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* Fullscreen modal without backdrop close
|
|
188
|
+
* ```tsx
|
|
189
|
+
* <Modal
|
|
190
|
+
* isOpen={isOpen}
|
|
191
|
+
* onClose={() => setIsOpen(false)}
|
|
192
|
+
* size="fullscreen"
|
|
193
|
+
* closeOnBackdropClick={false}
|
|
194
|
+
* animation="slide-up"
|
|
195
|
+
* >
|
|
196
|
+
* <FullscreenContent />
|
|
197
|
+
* </Modal>
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
export declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
201
|
+
export default Modal;
|
|
@@ -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;
|