@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,138 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Header.css';
|
|
3
|
+
export interface NotificationItem {
|
|
4
|
+
/**
|
|
5
|
+
* Notification ID
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Notification title
|
|
10
|
+
*/
|
|
11
|
+
title: string;
|
|
12
|
+
/**
|
|
13
|
+
* Notification description
|
|
14
|
+
*/
|
|
15
|
+
description?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Timestamp or time ago string
|
|
18
|
+
*/
|
|
19
|
+
time: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether notification is read
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
read?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Notification icon
|
|
27
|
+
*/
|
|
28
|
+
icon?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Click handler
|
|
31
|
+
*/
|
|
32
|
+
onClick?: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Notification type for styling
|
|
35
|
+
*/
|
|
36
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
37
|
+
}
|
|
38
|
+
export interface HeaderProps {
|
|
39
|
+
/**
|
|
40
|
+
* Logo or brand element
|
|
41
|
+
*/
|
|
42
|
+
logo?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Title text
|
|
45
|
+
*/
|
|
46
|
+
title?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Toggle button click handler (for sidebar)
|
|
49
|
+
*/
|
|
50
|
+
onToggleSidebar?: () => void;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to show toggle button
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
showToggle?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Notifications list
|
|
58
|
+
*/
|
|
59
|
+
notifications?: NotificationItem[];
|
|
60
|
+
/**
|
|
61
|
+
* Notification click handler
|
|
62
|
+
*/
|
|
63
|
+
onNotificationClick?: (notification: NotificationItem) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Mark all as read handler
|
|
66
|
+
*/
|
|
67
|
+
onMarkAllAsRead?: () => void;
|
|
68
|
+
/**
|
|
69
|
+
* User name
|
|
70
|
+
*/
|
|
71
|
+
userName?: string;
|
|
72
|
+
/**
|
|
73
|
+
* User email or role
|
|
74
|
+
*/
|
|
75
|
+
userSubtitle?: string;
|
|
76
|
+
/**
|
|
77
|
+
* User avatar image URL
|
|
78
|
+
*/
|
|
79
|
+
userAvatar?: string;
|
|
80
|
+
/**
|
|
81
|
+
* User menu items
|
|
82
|
+
*/
|
|
83
|
+
userMenuItems?: Array<{
|
|
84
|
+
label: string;
|
|
85
|
+
icon?: React.ReactNode;
|
|
86
|
+
onClick?: () => void;
|
|
87
|
+
variant?: 'default' | 'danger';
|
|
88
|
+
divider?: boolean;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Custom actions (buttons, search, etc.)
|
|
92
|
+
*/
|
|
93
|
+
actions?: React.ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Custom className
|
|
96
|
+
*/
|
|
97
|
+
className?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Whether header is sticky
|
|
100
|
+
* @default true
|
|
101
|
+
*/
|
|
102
|
+
sticky?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Header component - Professional admin panel header with notifications and user menu
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* Basic header
|
|
109
|
+
* ```tsx
|
|
110
|
+
* <Header
|
|
111
|
+
* title="Admin Dashboard"
|
|
112
|
+
* userName="John Doe"
|
|
113
|
+
* userSubtitle="Admin"
|
|
114
|
+
* onToggleSidebar={() => setCollapsed(!collapsed)}
|
|
115
|
+
* />
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* With notifications
|
|
120
|
+
* ```tsx
|
|
121
|
+
* <Header
|
|
122
|
+
* title="Dashboard"
|
|
123
|
+
* notifications={[
|
|
124
|
+
* { id: '1', title: 'New order received', time: '2 min ago', read: false },
|
|
125
|
+
* { id: '2', title: 'User registered', time: '1 hour ago', read: true }
|
|
126
|
+
* ]}
|
|
127
|
+
* userName="John Doe"
|
|
128
|
+
* userMenuItems={[
|
|
129
|
+
* { label: 'Profile', icon: <UserIcon /> },
|
|
130
|
+
* { label: 'Settings', icon: <SettingsIcon /> },
|
|
131
|
+
* { label: 'Logout', icon: <LogoutIcon />, variant: 'danger' }
|
|
132
|
+
* ]}
|
|
133
|
+
* />
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
137
|
+
declare const _default: React.FC<HeaderProps & React.RefAttributes<HTMLElement>>;
|
|
138
|
+
export default _default;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
+
import './Input.css';
|
|
3
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
4
|
+
/**
|
|
5
|
+
* Label text displayed above the input
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Helper text displayed below the input
|
|
10
|
+
* Provides additional context or instructions
|
|
11
|
+
*/
|
|
12
|
+
helperText?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Error message - when provided, input is shown in error state
|
|
15
|
+
* Takes precedence over helperText when both are present
|
|
16
|
+
*/
|
|
17
|
+
error?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Success message - when provided, input is shown in success state
|
|
20
|
+
*/
|
|
21
|
+
success?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Size of the input
|
|
24
|
+
* @default 'medium'
|
|
25
|
+
*/
|
|
26
|
+
size?: 'small' | 'medium' | 'large';
|
|
27
|
+
/**
|
|
28
|
+
* If true, input will take full width of its container
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
fullWidth?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Icon or element to display at the start of the input
|
|
34
|
+
*/
|
|
35
|
+
leftIcon?: React.ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Icon or element to display at the end of the input
|
|
38
|
+
*/
|
|
39
|
+
rightIcon?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* If true, shows a clear button when input has value
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
clearable?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Callback fired when clear button is clicked
|
|
47
|
+
*/
|
|
48
|
+
onClear?: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* If true, adds a character counter below the input
|
|
51
|
+
* Requires maxLength prop to be set
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
showCount?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Custom class name for the wrapper element
|
|
57
|
+
*/
|
|
58
|
+
wrapperClassName?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Custom class name for the label element
|
|
61
|
+
*/
|
|
62
|
+
labelClassName?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Custom class name for the input element itself
|
|
65
|
+
*/
|
|
66
|
+
inputClassName?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Prefix text to display before input value
|
|
69
|
+
*/
|
|
70
|
+
prefix?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Suffix text to display after input value
|
|
73
|
+
*/
|
|
74
|
+
suffix?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Input component - Text input field with label, helper text, validation states, and rich features
|
|
78
|
+
*
|
|
79
|
+
* A comprehensive input component with support for icons, prefixes, suffixes, character counting,
|
|
80
|
+
* clear functionality, and various validation states.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* Basic usage
|
|
84
|
+
* ```tsx
|
|
85
|
+
* <Input
|
|
86
|
+
* label="Email"
|
|
87
|
+
* type="email"
|
|
88
|
+
* placeholder="Enter your email"
|
|
89
|
+
* helperText="We'll never share your email"
|
|
90
|
+
* />
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* With error state
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <Input
|
|
97
|
+
* label="Username"
|
|
98
|
+
* error="Username is already taken"
|
|
99
|
+
* value={username}
|
|
100
|
+
* onChange={(e) => setUsername(e.target.value)}
|
|
101
|
+
* />
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* With icons and clear button
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <Input
|
|
108
|
+
* label="Search"
|
|
109
|
+
* leftIcon={<SearchIcon />}
|
|
110
|
+
* clearable
|
|
111
|
+
* onClear={() => setSearch('')}
|
|
112
|
+
* />
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* With character counter
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <Input
|
|
119
|
+
* label="Bio"
|
|
120
|
+
* maxLength={100}
|
|
121
|
+
* showCount
|
|
122
|
+
* value={bio}
|
|
123
|
+
* onChange={(e) => setBio(e.target.value)}
|
|
124
|
+
* />
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
128
|
+
declare const _default: React.FC<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
129
|
+
export default _default;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Menu.css';
|
|
3
|
+
export interface MenuItemProps {
|
|
4
|
+
/**
|
|
5
|
+
* Menu item label
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Click handler
|
|
10
|
+
*/
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Icon to display before label
|
|
14
|
+
*/
|
|
15
|
+
icon?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Icon to display after label
|
|
18
|
+
*/
|
|
19
|
+
rightIcon?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the item is disabled
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the item is active/selected
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
active?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Item variant
|
|
32
|
+
* @default 'default'
|
|
33
|
+
*/
|
|
34
|
+
variant?: 'default' | 'danger';
|
|
35
|
+
/**
|
|
36
|
+
* Keyboard shortcut to display
|
|
37
|
+
*/
|
|
38
|
+
shortcut?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Divider after this item
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
divider?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Submenu items for multi-level menus
|
|
46
|
+
*/
|
|
47
|
+
items?: MenuItemProps[];
|
|
48
|
+
}
|
|
49
|
+
export interface MenuProps {
|
|
50
|
+
/**
|
|
51
|
+
* Menu items configuration
|
|
52
|
+
*/
|
|
53
|
+
items?: MenuItemProps[];
|
|
54
|
+
/**
|
|
55
|
+
* Custom children (MenuItem components)
|
|
56
|
+
*/
|
|
57
|
+
children?: React.ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* Menu orientation
|
|
60
|
+
* @default 'vertical'
|
|
61
|
+
*/
|
|
62
|
+
orientation?: 'vertical' | 'horizontal';
|
|
63
|
+
/**
|
|
64
|
+
* Whether menu is responsive (converts to hamburger on mobile)
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
responsive?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Custom className
|
|
70
|
+
*/
|
|
71
|
+
className?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Menu width (for vertical menus)
|
|
74
|
+
*/
|
|
75
|
+
width?: string | number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* MenuItem component - Individual menu item with submenu support
|
|
79
|
+
*/
|
|
80
|
+
export declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
/**
|
|
82
|
+
* Menu component - Navigation or action menu with responsive support
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* Basic menu with items array
|
|
86
|
+
* ```tsx
|
|
87
|
+
* <Menu
|
|
88
|
+
* items={[
|
|
89
|
+
* { label: 'Profile', icon: <UserIcon />, onClick: () => {} },
|
|
90
|
+
* { label: 'Settings', icon: <SettingsIcon />, onClick: () => {} },
|
|
91
|
+
* { label: 'Logout', icon: <LogoutIcon />, onClick: () => {}, variant: 'danger' }
|
|
92
|
+
* ]}
|
|
93
|
+
* />
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* Horizontal menu with custom children
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <Menu orientation="horizontal">
|
|
100
|
+
* <MenuItem label="Home" active />
|
|
101
|
+
* <MenuItem label="Products" />
|
|
102
|
+
* <MenuItem label="About" />
|
|
103
|
+
* </Menu>
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* Responsive menu (hamburger on mobile)
|
|
108
|
+
* ```tsx
|
|
109
|
+
* <Menu responsive items={menuItems} />
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
113
|
+
declare const _default: React.FC<MenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
114
|
+
export default _default;
|
|
@@ -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;
|