@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,148 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ToastVariant = 'success' | 'error' | 'warning' | 'info' | 'default' | 'primary';
|
|
3
|
+
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
4
|
+
export interface ToastOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Auto close duration in milliseconds
|
|
7
|
+
* Set to false to disable auto close
|
|
8
|
+
* @default 5000
|
|
9
|
+
*/
|
|
10
|
+
autoClose?: number | false;
|
|
11
|
+
/**
|
|
12
|
+
* Show close button
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
closeButton?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Show progress bar
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
progressBar?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Pause on hover
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
pauseOnHover?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Pause on focus loss
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
pauseOnFocusLoss?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Toast variant/type
|
|
33
|
+
* @default 'default'
|
|
34
|
+
*/
|
|
35
|
+
variant?: ToastVariant;
|
|
36
|
+
/**
|
|
37
|
+
* Custom icon or false to hide icon
|
|
38
|
+
*/
|
|
39
|
+
icon?: ReactNode | false;
|
|
40
|
+
/**
|
|
41
|
+
* Custom action button
|
|
42
|
+
*/
|
|
43
|
+
action?: {
|
|
44
|
+
label: string;
|
|
45
|
+
onClick: () => void;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Custom className
|
|
49
|
+
*/
|
|
50
|
+
className?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Custom styles
|
|
53
|
+
*/
|
|
54
|
+
style?: React.CSSProperties;
|
|
55
|
+
/**
|
|
56
|
+
* Toast ID for updates/dismissal
|
|
57
|
+
*/
|
|
58
|
+
toastId?: string | number;
|
|
59
|
+
/**
|
|
60
|
+
* Callback when toast is closed
|
|
61
|
+
*/
|
|
62
|
+
onClose?: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Callback when toast is opened
|
|
65
|
+
*/
|
|
66
|
+
onOpen?: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Rich content with title and description
|
|
69
|
+
*/
|
|
70
|
+
title?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Animation duration in milliseconds
|
|
74
|
+
* @default 300
|
|
75
|
+
*/
|
|
76
|
+
animationDuration?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface ToastProps extends ToastOptions {
|
|
79
|
+
/**
|
|
80
|
+
* Toast content
|
|
81
|
+
*/
|
|
82
|
+
children: ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* Whether toast is visible
|
|
85
|
+
*/
|
|
86
|
+
isVisible: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Function to close the toast
|
|
89
|
+
*/
|
|
90
|
+
onDismiss: () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Unique toast ID
|
|
93
|
+
*/
|
|
94
|
+
id: string | number;
|
|
95
|
+
/**
|
|
96
|
+
* Creation timestamp
|
|
97
|
+
*/
|
|
98
|
+
createdAt: number;
|
|
99
|
+
}
|
|
100
|
+
export interface ToastContainerProps {
|
|
101
|
+
/**
|
|
102
|
+
* Children components to render alongside the toast container
|
|
103
|
+
*/
|
|
104
|
+
children?: ReactNode;
|
|
105
|
+
/**
|
|
106
|
+
* Container position
|
|
107
|
+
* @default 'top-right'
|
|
108
|
+
*/
|
|
109
|
+
position?: ToastPosition;
|
|
110
|
+
/**
|
|
111
|
+
* Maximum number of toasts to show
|
|
112
|
+
* @default 5
|
|
113
|
+
*/
|
|
114
|
+
limit?: number;
|
|
115
|
+
/**
|
|
116
|
+
* Gap between toasts in pixels
|
|
117
|
+
* @default 12
|
|
118
|
+
*/
|
|
119
|
+
gap?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Container margin from viewport edge
|
|
122
|
+
* @default 16
|
|
123
|
+
*/
|
|
124
|
+
margin?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Custom className for container
|
|
127
|
+
*/
|
|
128
|
+
className?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Custom styles for container
|
|
131
|
+
*/
|
|
132
|
+
style?: React.CSSProperties;
|
|
133
|
+
/**
|
|
134
|
+
* Enable stacked layout for mobile
|
|
135
|
+
* @default true
|
|
136
|
+
*/
|
|
137
|
+
stacked?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Custom theme
|
|
140
|
+
*/
|
|
141
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
142
|
+
}
|
|
143
|
+
export interface ToastInstance extends ToastOptions {
|
|
144
|
+
id: string | number;
|
|
145
|
+
content: ReactNode;
|
|
146
|
+
createdAt: number;
|
|
147
|
+
isVisible: boolean;
|
|
148
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ToastInstance, ToastOptions } from './types';
|
|
3
|
+
interface ToastContextValue {
|
|
4
|
+
toasts: ToastInstance[];
|
|
5
|
+
addToast: (content: ReactNode, options?: ToastOptions) => string | number;
|
|
6
|
+
removeToast: (id: string | number) => void;
|
|
7
|
+
clearAllToasts: () => void;
|
|
8
|
+
updateToast: (id: string | number, options: Partial<ToastOptions>) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const useToast: () => ToastContextValue;
|
|
11
|
+
interface ToastProviderProps {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
15
|
+
declare class ToastManager {
|
|
16
|
+
private static instance;
|
|
17
|
+
private addToastFn;
|
|
18
|
+
private removeToastFn;
|
|
19
|
+
private clearAllToastsFn;
|
|
20
|
+
private updateToastFn;
|
|
21
|
+
static getInstance(): ToastManager;
|
|
22
|
+
setMethods(addToast: (content: ReactNode, options?: ToastOptions) => string | number, removeToast: (id: string | number) => void, clearAllToasts: () => void, updateToast: (id: string | number, options: Partial<ToastOptions>) => void): void;
|
|
23
|
+
show(content: ReactNode, options?: ToastOptions): string | number;
|
|
24
|
+
success(content: ReactNode, options?: Omit<ToastOptions, 'variant'>): string | number;
|
|
25
|
+
error(content: ReactNode, options?: Omit<ToastOptions, 'variant'>): string | number;
|
|
26
|
+
warning(content: ReactNode, options?: Omit<ToastOptions, 'variant'>): string | number;
|
|
27
|
+
info(content: ReactNode, options?: Omit<ToastOptions, 'variant'>): string | number;
|
|
28
|
+
primary(content: ReactNode, options?: Omit<ToastOptions, 'variant'>): string | number;
|
|
29
|
+
dismiss(id: string | number): void;
|
|
30
|
+
dismissAll(): void;
|
|
31
|
+
update(id: string | number, options: Partial<ToastOptions>): void;
|
|
32
|
+
}
|
|
33
|
+
export declare const toast: ToastManager;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
import './Tooltip.css';
|
|
3
|
+
export interface TooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
4
|
+
/**
|
|
5
|
+
* Content to display in the tooltip
|
|
6
|
+
* Can be text, JSX, or any React node
|
|
7
|
+
*/
|
|
8
|
+
content: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Placement of the tooltip relative to the trigger element
|
|
11
|
+
* @default 'top'
|
|
12
|
+
*/
|
|
13
|
+
placement?: 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
14
|
+
/**
|
|
15
|
+
* Delay before showing tooltip in milliseconds
|
|
16
|
+
* @default 200
|
|
17
|
+
*/
|
|
18
|
+
delay?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Delay before hiding tooltip in milliseconds
|
|
21
|
+
* @default 0
|
|
22
|
+
*/
|
|
23
|
+
hideDelay?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Element that triggers the tooltip
|
|
26
|
+
*/
|
|
27
|
+
children: React.ReactElement<any>;
|
|
28
|
+
/**
|
|
29
|
+
* If true, tooltip is always visible
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
open?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* If true, tooltip is disabled and won't show
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* If true, shows an arrow pointing to the trigger element
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
arrow?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Maximum width of the tooltip
|
|
45
|
+
* @default '300px'
|
|
46
|
+
*/
|
|
47
|
+
maxWidth?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Tooltip variant for different visual styles
|
|
50
|
+
* @default 'dark'
|
|
51
|
+
*/
|
|
52
|
+
variant?: 'dark' | 'light' | 'error' | 'warning' | 'success' | 'info';
|
|
53
|
+
/**
|
|
54
|
+
* If true, shows a close button to manually dismiss the tooltip
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
dismissible?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Callback fired when tooltip is shown
|
|
60
|
+
*/
|
|
61
|
+
onShow?: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Callback fired when tooltip is hidden
|
|
64
|
+
*/
|
|
65
|
+
onHide?: () => void;
|
|
66
|
+
/**
|
|
67
|
+
* Callback fired when dismiss button is clicked
|
|
68
|
+
*/
|
|
69
|
+
onDismiss?: () => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Tooltip component - Displays helpful information on hover or focus
|
|
73
|
+
*
|
|
74
|
+
* A feature-rich tooltip component with multiple placement options, variants,
|
|
75
|
+
* customizable delays, and arrow indicators.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* Basic usage
|
|
79
|
+
* ```tsx
|
|
80
|
+
* <Tooltip content="Click to save changes" placement="top">
|
|
81
|
+
* <Button>Save</Button>
|
|
82
|
+
* </Tooltip>
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* With arrow and variant
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <Tooltip
|
|
89
|
+
* content="This action cannot be undone"
|
|
90
|
+
* placement="right"
|
|
91
|
+
* variant="warning"
|
|
92
|
+
* arrow
|
|
93
|
+
* >
|
|
94
|
+
* <Button variant="danger">Delete</Button>
|
|
95
|
+
* </Tooltip>
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* Always visible
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <Tooltip content="Important information" open>
|
|
102
|
+
* <span>Hover target</span>
|
|
103
|
+
* </Tooltip>
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
107
|
+
declare const _default: React.FC<TooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
108
|
+
export default _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to handle click events outside of a specified element
|
|
4
|
+
*
|
|
5
|
+
* @param ref - Reference to the element to detect clicks outside of
|
|
6
|
+
* @param handler - Callback function to execute when clicking outside
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* function Dropdown() {
|
|
11
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
12
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
13
|
+
*
|
|
14
|
+
* useClickOutside(ref, () => setIsOpen(false));
|
|
15
|
+
*
|
|
16
|
+
* return <div ref={ref}>Dropdown content</div>;
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const useClickOutside: <T extends HTMLElement = HTMLElement>(ref: RefObject<T>, handler: (event: MouseEvent | TouchEvent) => void) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Hook to manage focus trap within a component (useful for modals, dialogs)
|
|
23
|
+
*
|
|
24
|
+
* @param ref - Reference to the container element
|
|
25
|
+
* @param isActive - Whether the focus trap is active
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* function Modal({ isOpen }) {
|
|
30
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
31
|
+
* useFocusTrap(ref, isOpen);
|
|
32
|
+
* return <div ref={ref}>Modal content</div>;
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const useFocusTrap: <T extends HTMLElement = HTMLElement>(ref: RefObject<T>, isActive: boolean) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Hook to handle escape key press
|
|
39
|
+
*
|
|
40
|
+
* @param handler - Callback function to execute when escape is pressed
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* function Modal({ onClose }) {
|
|
45
|
+
* useEscapeKey(onClose);
|
|
46
|
+
* return <div>Modal content</div>;
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const useEscapeKey: (handler: () => void) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Hook to manage body scroll lock (useful for modals)
|
|
53
|
+
*
|
|
54
|
+
* @param isLocked - Whether to lock the body scroll
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* function Modal({ isOpen }) {
|
|
59
|
+
* useBodyScrollLock(isOpen);
|
|
60
|
+
* return <div>Modal content</div>;
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const useBodyScrollLock: (isLocked: boolean) => void;
|
|
65
|
+
export declare const useId: (prefix?: string) => string;
|
|
66
|
+
/**
|
|
67
|
+
* Hook to debounce a value
|
|
68
|
+
*
|
|
69
|
+
* @param value - Value to debounce
|
|
70
|
+
* @param delay - Delay in milliseconds
|
|
71
|
+
* @returns Debounced value
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* function SearchInput() {
|
|
76
|
+
* const [search, setSearch] = useState('');
|
|
77
|
+
* const debouncedSearch = useDebounce(search, 300);
|
|
78
|
+
*
|
|
79
|
+
* useEffect(() => {
|
|
80
|
+
* // API call with debouncedSearch
|
|
81
|
+
* }, [debouncedSearch]);
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const useDebounce: <T>(value: T, delay: number) => T;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access theme tokens and utilities
|
|
3
|
+
*
|
|
4
|
+
* @returns Theme tokens and theme mode setter
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* function MyComponent() {
|
|
9
|
+
* const { tokens, mode, setMode } = useTheme();
|
|
10
|
+
* return (
|
|
11
|
+
* <button
|
|
12
|
+
* style={{ background: tokens.colors.primary[500] }}
|
|
13
|
+
* onClick={() => setMode(mode === 'light' ? 'dark' : 'light')}
|
|
14
|
+
* >
|
|
15
|
+
* Toggle Theme
|
|
16
|
+
* </button>
|
|
17
|
+
* );
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const useTheme: () => {
|
|
22
|
+
tokens: {
|
|
23
|
+
readonly colors: {
|
|
24
|
+
readonly primary: {
|
|
25
|
+
readonly 50: "#eff6ff";
|
|
26
|
+
readonly 100: "#dbeafe";
|
|
27
|
+
readonly 200: "#bfdbfe";
|
|
28
|
+
readonly 300: "#93c5fd";
|
|
29
|
+
readonly 400: "#60a5fa";
|
|
30
|
+
readonly 500: "#3b82f6";
|
|
31
|
+
readonly 600: "#2563eb";
|
|
32
|
+
readonly 700: "#1d4ed8";
|
|
33
|
+
readonly 800: "#1e40af";
|
|
34
|
+
readonly 900: "#1e3a8a";
|
|
35
|
+
};
|
|
36
|
+
readonly secondary: {
|
|
37
|
+
readonly 50: "#f5f3ff";
|
|
38
|
+
readonly 100: "#ede9fe";
|
|
39
|
+
readonly 200: "#ddd6fe";
|
|
40
|
+
readonly 300: "#c4b5fd";
|
|
41
|
+
readonly 400: "#a78bfa";
|
|
42
|
+
readonly 500: "#8b5cf6";
|
|
43
|
+
readonly 600: "#7c3aed";
|
|
44
|
+
readonly 700: "#6d28d9";
|
|
45
|
+
readonly 800: "#5b21b6";
|
|
46
|
+
readonly 900: "#4c1d95";
|
|
47
|
+
};
|
|
48
|
+
readonly neutral: {
|
|
49
|
+
readonly 50: "#fafafa";
|
|
50
|
+
readonly 100: "#f5f5f5";
|
|
51
|
+
readonly 200: "#e5e5e5";
|
|
52
|
+
readonly 300: "#d4d4d4";
|
|
53
|
+
readonly 400: "#a3a3a3";
|
|
54
|
+
readonly 500: "#737373";
|
|
55
|
+
readonly 600: "#525252";
|
|
56
|
+
readonly 700: "#404040";
|
|
57
|
+
readonly 800: "#262626";
|
|
58
|
+
readonly 900: "#171717";
|
|
59
|
+
};
|
|
60
|
+
readonly success: {
|
|
61
|
+
readonly 50: "#f0fdf4";
|
|
62
|
+
readonly 500: "#22c55e";
|
|
63
|
+
readonly 600: "#16a34a";
|
|
64
|
+
readonly 700: "#15803d";
|
|
65
|
+
};
|
|
66
|
+
readonly warning: {
|
|
67
|
+
readonly 50: "#fffbeb";
|
|
68
|
+
readonly 500: "#f59e0b";
|
|
69
|
+
readonly 600: "#d97706";
|
|
70
|
+
readonly 700: "#b45309";
|
|
71
|
+
};
|
|
72
|
+
readonly error: {
|
|
73
|
+
readonly 50: "#fef2f2";
|
|
74
|
+
readonly 500: "#ef4444";
|
|
75
|
+
readonly 600: "#dc2626";
|
|
76
|
+
readonly 700: "#b91c1c";
|
|
77
|
+
};
|
|
78
|
+
readonly info: {
|
|
79
|
+
readonly 50: "#eff6ff";
|
|
80
|
+
readonly 500: "#3b82f6";
|
|
81
|
+
readonly 600: "#2563eb";
|
|
82
|
+
readonly 700: "#1d4ed8";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
readonly spacing: {
|
|
86
|
+
readonly 0: "0";
|
|
87
|
+
readonly 1: "0.25rem";
|
|
88
|
+
readonly 2: "0.5rem";
|
|
89
|
+
readonly 3: "0.75rem";
|
|
90
|
+
readonly 4: "1rem";
|
|
91
|
+
readonly 5: "1.25rem";
|
|
92
|
+
readonly 6: "1.5rem";
|
|
93
|
+
readonly 8: "2rem";
|
|
94
|
+
readonly 10: "2.5rem";
|
|
95
|
+
readonly 12: "3rem";
|
|
96
|
+
readonly 16: "4rem";
|
|
97
|
+
readonly 20: "5rem";
|
|
98
|
+
readonly 24: "6rem";
|
|
99
|
+
};
|
|
100
|
+
readonly typography: {
|
|
101
|
+
readonly fontFamily: {
|
|
102
|
+
readonly sans: "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
|
|
103
|
+
readonly mono: "ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace";
|
|
104
|
+
};
|
|
105
|
+
readonly fontSize: {
|
|
106
|
+
readonly xs: "0.75rem";
|
|
107
|
+
readonly sm: "0.875rem";
|
|
108
|
+
readonly base: "1rem";
|
|
109
|
+
readonly lg: "1.125rem";
|
|
110
|
+
readonly xl: "1.25rem";
|
|
111
|
+
readonly '2xl': "1.5rem";
|
|
112
|
+
readonly '3xl': "1.875rem";
|
|
113
|
+
readonly '4xl': "2.25rem";
|
|
114
|
+
readonly '5xl': "3rem";
|
|
115
|
+
readonly '6xl': "3.75rem";
|
|
116
|
+
readonly '7xl': "4.5rem";
|
|
117
|
+
readonly '8xl': "6rem";
|
|
118
|
+
readonly '9xl': "8rem";
|
|
119
|
+
};
|
|
120
|
+
readonly fontWeight: {
|
|
121
|
+
readonly thin: "100";
|
|
122
|
+
readonly extralight: "200";
|
|
123
|
+
readonly light: "300";
|
|
124
|
+
readonly normal: "400";
|
|
125
|
+
readonly medium: "500";
|
|
126
|
+
readonly semibold: "600";
|
|
127
|
+
readonly bold: "700";
|
|
128
|
+
readonly extrabold: "800";
|
|
129
|
+
readonly black: "900";
|
|
130
|
+
};
|
|
131
|
+
readonly lineHeight: {
|
|
132
|
+
readonly none: "1";
|
|
133
|
+
readonly tight: "1.25";
|
|
134
|
+
readonly snug: "1.375";
|
|
135
|
+
readonly normal: "1.5";
|
|
136
|
+
readonly relaxed: "1.625";
|
|
137
|
+
readonly loose: "2";
|
|
138
|
+
};
|
|
139
|
+
readonly letterSpacing: {
|
|
140
|
+
readonly tighter: "-0.05em";
|
|
141
|
+
readonly tight: "-0.025em";
|
|
142
|
+
readonly normal: "0";
|
|
143
|
+
readonly wide: "0.025em";
|
|
144
|
+
readonly wider: "0.05em";
|
|
145
|
+
readonly widest: "0.1em";
|
|
146
|
+
};
|
|
147
|
+
readonly textVariants: {
|
|
148
|
+
readonly h1: {
|
|
149
|
+
readonly fontSize: "3.75rem";
|
|
150
|
+
readonly fontWeight: "700";
|
|
151
|
+
readonly lineHeight: "1.2";
|
|
152
|
+
readonly letterSpacing: "-0.025em";
|
|
153
|
+
};
|
|
154
|
+
readonly h2: {
|
|
155
|
+
readonly fontSize: "3rem";
|
|
156
|
+
readonly fontWeight: "700";
|
|
157
|
+
readonly lineHeight: "1.25";
|
|
158
|
+
readonly letterSpacing: "-0.025em";
|
|
159
|
+
};
|
|
160
|
+
readonly h3: {
|
|
161
|
+
readonly fontSize: "2.25rem";
|
|
162
|
+
readonly fontWeight: "600";
|
|
163
|
+
readonly lineHeight: "1.3";
|
|
164
|
+
readonly letterSpacing: "-0.025em";
|
|
165
|
+
};
|
|
166
|
+
readonly h4: {
|
|
167
|
+
readonly fontSize: "1.875rem";
|
|
168
|
+
readonly fontWeight: "600";
|
|
169
|
+
readonly lineHeight: "1.35";
|
|
170
|
+
readonly letterSpacing: "0";
|
|
171
|
+
};
|
|
172
|
+
readonly h5: {
|
|
173
|
+
readonly fontSize: "1.5rem";
|
|
174
|
+
readonly fontWeight: "600";
|
|
175
|
+
readonly lineHeight: "1.4";
|
|
176
|
+
readonly letterSpacing: "0";
|
|
177
|
+
};
|
|
178
|
+
readonly h6: {
|
|
179
|
+
readonly fontSize: "1.25rem";
|
|
180
|
+
readonly fontWeight: "600";
|
|
181
|
+
readonly lineHeight: "1.5";
|
|
182
|
+
readonly letterSpacing: "0";
|
|
183
|
+
};
|
|
184
|
+
readonly body1: {
|
|
185
|
+
readonly fontSize: "1rem";
|
|
186
|
+
readonly fontWeight: "400";
|
|
187
|
+
readonly lineHeight: "1.5";
|
|
188
|
+
readonly letterSpacing: "0";
|
|
189
|
+
};
|
|
190
|
+
readonly body2: {
|
|
191
|
+
readonly fontSize: "0.875rem";
|
|
192
|
+
readonly fontWeight: "400";
|
|
193
|
+
readonly lineHeight: "1.5";
|
|
194
|
+
readonly letterSpacing: "0";
|
|
195
|
+
};
|
|
196
|
+
readonly subtitle1: {
|
|
197
|
+
readonly fontSize: "1.125rem";
|
|
198
|
+
readonly fontWeight: "500";
|
|
199
|
+
readonly lineHeight: "1.5";
|
|
200
|
+
readonly letterSpacing: "0";
|
|
201
|
+
};
|
|
202
|
+
readonly subtitle2: {
|
|
203
|
+
readonly fontSize: "1rem";
|
|
204
|
+
readonly fontWeight: "500";
|
|
205
|
+
readonly lineHeight: "1.5";
|
|
206
|
+
readonly letterSpacing: "0";
|
|
207
|
+
};
|
|
208
|
+
readonly caption: {
|
|
209
|
+
readonly fontSize: "0.75rem";
|
|
210
|
+
readonly fontWeight: "400";
|
|
211
|
+
readonly lineHeight: "1.5";
|
|
212
|
+
readonly letterSpacing: "0.025em";
|
|
213
|
+
};
|
|
214
|
+
readonly overline: {
|
|
215
|
+
readonly fontSize: "0.75rem";
|
|
216
|
+
readonly fontWeight: "600";
|
|
217
|
+
readonly lineHeight: "1.5";
|
|
218
|
+
readonly letterSpacing: "0.1em";
|
|
219
|
+
readonly textTransform: "uppercase";
|
|
220
|
+
};
|
|
221
|
+
readonly button: {
|
|
222
|
+
readonly fontSize: "0.875rem";
|
|
223
|
+
readonly fontWeight: "600";
|
|
224
|
+
readonly lineHeight: "1.5";
|
|
225
|
+
readonly letterSpacing: "0.025em";
|
|
226
|
+
};
|
|
227
|
+
readonly label: {
|
|
228
|
+
readonly fontSize: "0.875rem";
|
|
229
|
+
readonly fontWeight: "500";
|
|
230
|
+
readonly lineHeight: "1.5";
|
|
231
|
+
readonly letterSpacing: "0";
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
readonly borderRadius: {
|
|
236
|
+
readonly none: "0";
|
|
237
|
+
readonly sm: "0.125rem";
|
|
238
|
+
readonly base: "0.25rem";
|
|
239
|
+
readonly md: "0.375rem";
|
|
240
|
+
readonly lg: "0.5rem";
|
|
241
|
+
readonly xl: "0.75rem";
|
|
242
|
+
readonly '2xl': "1rem";
|
|
243
|
+
readonly full: "9999px";
|
|
244
|
+
};
|
|
245
|
+
readonly shadows: {
|
|
246
|
+
readonly sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)";
|
|
247
|
+
readonly base: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)";
|
|
248
|
+
readonly md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)";
|
|
249
|
+
readonly lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)";
|
|
250
|
+
readonly xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)";
|
|
251
|
+
readonly none: "none";
|
|
252
|
+
};
|
|
253
|
+
readonly transitions: {
|
|
254
|
+
readonly fast: "150ms cubic-bezier(0.4, 0, 0.2, 1)";
|
|
255
|
+
readonly base: "200ms cubic-bezier(0.4, 0, 0.2, 1)";
|
|
256
|
+
readonly slow: "300ms cubic-bezier(0.4, 0, 0.2, 1)";
|
|
257
|
+
};
|
|
258
|
+
readonly zIndex: {
|
|
259
|
+
readonly dropdown: 1000;
|
|
260
|
+
readonly sticky: 1100;
|
|
261
|
+
readonly modal: 1200;
|
|
262
|
+
readonly tooltip: 1300;
|
|
263
|
+
readonly notification: 1400;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
mode: "light" | "dark";
|
|
267
|
+
setMode: (mode: "light" | "dark") => void;
|
|
268
|
+
};
|