@lp-labs/ui-components 0.0.0-stage → 1.0.0
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/CHANGELOG.md +41 -0
- package/LICENSE +21 -0
- package/README.md +256 -2
- package/dist/cjs/components/Accordion.d.ts +78 -0
- package/dist/cjs/components/Accordion.js +78 -0
- package/dist/cjs/components/AdvancedComponents.d.ts +353 -0
- package/dist/cjs/components/AdvancedComponents.js +353 -0
- package/dist/cjs/components/Alert.d.ts +102 -0
- package/dist/cjs/components/Alert.js +102 -0
- package/dist/cjs/components/Avatar.d.ts +89 -0
- package/dist/cjs/components/Avatar.js +89 -0
- package/dist/cjs/components/Badge.d.ts +57 -0
- package/dist/cjs/components/Badge.js +57 -0
- package/dist/cjs/components/Breadcrumb.d.ts +50 -0
- package/dist/cjs/components/Breadcrumb.js +50 -0
- package/dist/cjs/components/Button.d.ts +77 -0
- package/dist/cjs/components/Button.js +77 -0
- package/dist/cjs/components/ButtonVariants.d.ts +261 -0
- package/dist/cjs/components/ButtonVariants.js +261 -0
- package/dist/cjs/components/Card.d.ts +56 -0
- package/dist/cjs/components/Card.js +56 -0
- package/dist/cjs/components/CardVariants.d.ts +267 -0
- package/dist/cjs/components/CardVariants.js +267 -0
- package/dist/cjs/components/Checkbox.d.ts +50 -0
- package/dist/cjs/components/Checkbox.js +50 -0
- package/dist/cjs/components/Chip.d.ts +104 -0
- package/dist/cjs/components/Chip.js +104 -0
- package/dist/cjs/components/DataDisplayComponents.d.ts +275 -0
- package/dist/cjs/components/DataDisplayComponents.js +275 -0
- package/dist/cjs/components/Divider.d.ts +77 -0
- package/dist/cjs/components/Divider.js +77 -0
- package/dist/cjs/components/Drawer.d.ts +142 -0
- package/dist/cjs/components/Drawer.js +142 -0
- package/dist/cjs/components/Dropdown.d.ts +139 -0
- package/dist/cjs/components/Dropdown.js +139 -0
- package/dist/cjs/components/Form.d.ts +41 -0
- package/dist/cjs/components/Form.js +41 -0
- package/dist/cjs/components/FormGroup.d.ts +58 -0
- package/dist/cjs/components/FormGroup.js +58 -0
- package/dist/cjs/components/FormInputVariants.d.ts +298 -0
- package/dist/cjs/components/FormInputVariants.js +298 -0
- package/dist/cjs/components/Image.d.ts +106 -0
- package/dist/cjs/components/Image.js +106 -0
- package/dist/cjs/components/Input.d.ts +65 -0
- package/dist/cjs/components/Input.js +65 -0
- package/dist/cjs/components/LayoutComponents.d.ts +258 -0
- package/dist/cjs/components/LayoutComponents.js +258 -0
- package/dist/cjs/components/Link.d.ts +71 -0
- package/dist/cjs/components/Link.js +71 -0
- package/dist/cjs/components/LoadingFeedbackComponents.d.ts +230 -0
- package/dist/cjs/components/LoadingFeedbackComponents.js +230 -0
- package/dist/cjs/components/Menu.d.ts +167 -0
- package/dist/cjs/components/Menu.js +167 -0
- package/dist/cjs/components/Modal.d.ts +145 -0
- package/dist/cjs/components/Modal.js +145 -0
- package/dist/cjs/components/ModalTypes.d.ts +288 -0
- package/dist/cjs/components/ModalTypes.js +288 -0
- package/dist/cjs/components/Navbar.d.ts +181 -0
- package/dist/cjs/components/Navbar.js +181 -0
- package/dist/cjs/components/NavigationComponents.d.ts +276 -0
- package/dist/cjs/components/NavigationComponents.js +276 -0
- package/dist/cjs/components/Pagination.d.ts +94 -0
- package/dist/cjs/components/Pagination.js +94 -0
- package/dist/cjs/components/Popover.d.ts +108 -0
- package/dist/cjs/components/Popover.js +108 -0
- package/dist/cjs/components/Progress.d.ts +68 -0
- package/dist/cjs/components/Progress.js +68 -0
- package/dist/cjs/components/Radio.d.ts +93 -0
- package/dist/cjs/components/Radio.js +93 -0
- package/dist/cjs/components/Rating.d.ts +82 -0
- package/dist/cjs/components/Rating.js +82 -0
- package/dist/cjs/components/Select.d.ts +74 -0
- package/dist/cjs/components/Select.js +74 -0
- package/dist/cjs/components/Sidebar.d.ts +174 -0
- package/dist/cjs/components/Sidebar.js +174 -0
- package/dist/cjs/components/Skeleton.d.ts +57 -0
- package/dist/cjs/components/Skeleton.js +57 -0
- package/dist/cjs/components/Slider.d.ts +64 -0
- package/dist/cjs/components/Slider.js +64 -0
- package/dist/cjs/components/Spinner.d.ts +70 -0
- package/dist/cjs/components/Spinner.js +70 -0
- package/dist/cjs/components/Stack.d.ts +75 -0
- package/dist/cjs/components/Stack.js +75 -0
- package/dist/cjs/components/Stepper.d.ts +150 -0
- package/dist/cjs/components/Stepper.js +150 -0
- package/dist/cjs/components/Table.d.ts +173 -0
- package/dist/cjs/components/Table.js +173 -0
- package/dist/cjs/components/Tabs.d.ts +104 -0
- package/dist/cjs/components/Tabs.js +104 -0
- package/dist/cjs/components/Tag.d.ts +74 -0
- package/dist/cjs/components/Tag.js +74 -0
- package/dist/cjs/components/Textarea.d.ts +75 -0
- package/dist/cjs/components/Textarea.js +75 -0
- package/dist/cjs/components/Timeline.d.ts +124 -0
- package/dist/cjs/components/Timeline.js +124 -0
- package/dist/cjs/components/Toast.d.ts +155 -0
- package/dist/cjs/components/Toast.js +155 -0
- package/dist/cjs/components/Toggle.d.ts +75 -0
- package/dist/cjs/components/Toggle.js +75 -0
- package/dist/cjs/components/Tooltip.d.ts +80 -0
- package/dist/cjs/components/Tooltip.js +80 -0
- package/dist/cjs/components/TypographyComponents.d.ts +265 -0
- package/dist/cjs/components/TypographyComponents.js +265 -0
- package/dist/cjs/components/UtilityComponents.d.ts +345 -0
- package/dist/cjs/components/UtilityComponents.js +345 -0
- package/dist/cjs/components/Video.d.ts +82 -0
- package/dist/cjs/components/Video.js +82 -0
- package/dist/cjs/components/index.d.ts +311 -0
- package/dist/cjs/components/index.js +311 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/styles/main.css +493 -0
- package/dist/cjs/theme/ThemeProvider.d.ts +185 -0
- package/dist/cjs/theme/ThemeProvider.js +185 -0
- package/dist/cjs/theme/index.d.ts +2 -0
- package/dist/cjs/theme/index.js +2 -0
- package/dist/cjs/utilities/classNames.d.ts +200 -0
- package/dist/cjs/utilities/classNames.js +200 -0
- package/dist/cjs/utilities/index.d.ts +3 -0
- package/dist/cjs/utilities/index.js +3 -0
- package/dist/cjs/utilities/styles.d.ts +94 -0
- package/dist/cjs/utilities/styles.js +94 -0
- package/dist/esm/components/Accordion.d.ts +78 -0
- package/dist/esm/components/Accordion.js +78 -0
- package/dist/esm/components/AdvancedComponents.d.ts +353 -0
- package/dist/esm/components/AdvancedComponents.js +353 -0
- package/dist/esm/components/Alert.d.ts +102 -0
- package/dist/esm/components/Alert.js +102 -0
- package/dist/esm/components/Avatar.d.ts +89 -0
- package/dist/esm/components/Avatar.js +89 -0
- package/dist/esm/components/Badge.d.ts +57 -0
- package/dist/esm/components/Badge.js +57 -0
- package/dist/esm/components/Breadcrumb.d.ts +50 -0
- package/dist/esm/components/Breadcrumb.js +50 -0
- package/dist/esm/components/Button.d.ts +77 -0
- package/dist/esm/components/Button.js +77 -0
- package/dist/esm/components/ButtonVariants.d.ts +261 -0
- package/dist/esm/components/ButtonVariants.js +261 -0
- package/dist/esm/components/Card.d.ts +56 -0
- package/dist/esm/components/Card.js +56 -0
- package/dist/esm/components/CardVariants.d.ts +267 -0
- package/dist/esm/components/CardVariants.js +267 -0
- package/dist/esm/components/Checkbox.d.ts +50 -0
- package/dist/esm/components/Checkbox.js +50 -0
- package/dist/esm/components/Chip.d.ts +104 -0
- package/dist/esm/components/Chip.js +104 -0
- package/dist/esm/components/DataDisplayComponents.d.ts +275 -0
- package/dist/esm/components/DataDisplayComponents.js +275 -0
- package/dist/esm/components/Divider.d.ts +77 -0
- package/dist/esm/components/Divider.js +77 -0
- package/dist/esm/components/Drawer.d.ts +142 -0
- package/dist/esm/components/Drawer.js +142 -0
- package/dist/esm/components/Dropdown.d.ts +139 -0
- package/dist/esm/components/Dropdown.js +139 -0
- package/dist/esm/components/Form.d.ts +41 -0
- package/dist/esm/components/Form.js +41 -0
- package/dist/esm/components/FormGroup.d.ts +58 -0
- package/dist/esm/components/FormGroup.js +58 -0
- package/dist/esm/components/FormInputVariants.d.ts +298 -0
- package/dist/esm/components/FormInputVariants.js +298 -0
- package/dist/esm/components/Image.d.ts +106 -0
- package/dist/esm/components/Image.js +106 -0
- package/dist/esm/components/Input.d.ts +65 -0
- package/dist/esm/components/Input.js +65 -0
- package/dist/esm/components/LayoutComponents.d.ts +258 -0
- package/dist/esm/components/LayoutComponents.js +258 -0
- package/dist/esm/components/Link.d.ts +71 -0
- package/dist/esm/components/Link.js +71 -0
- package/dist/esm/components/LoadingFeedbackComponents.d.ts +230 -0
- package/dist/esm/components/LoadingFeedbackComponents.js +230 -0
- package/dist/esm/components/Menu.d.ts +167 -0
- package/dist/esm/components/Menu.js +167 -0
- package/dist/esm/components/Modal.d.ts +145 -0
- package/dist/esm/components/Modal.js +145 -0
- package/dist/esm/components/ModalTypes.d.ts +288 -0
- package/dist/esm/components/ModalTypes.js +288 -0
- package/dist/esm/components/Navbar.d.ts +181 -0
- package/dist/esm/components/Navbar.js +181 -0
- package/dist/esm/components/NavigationComponents.d.ts +276 -0
- package/dist/esm/components/NavigationComponents.js +276 -0
- package/dist/esm/components/Pagination.d.ts +94 -0
- package/dist/esm/components/Pagination.js +94 -0
- package/dist/esm/components/Popover.d.ts +108 -0
- package/dist/esm/components/Popover.js +108 -0
- package/dist/esm/components/Progress.d.ts +68 -0
- package/dist/esm/components/Progress.js +68 -0
- package/dist/esm/components/Radio.d.ts +93 -0
- package/dist/esm/components/Radio.js +93 -0
- package/dist/esm/components/Rating.d.ts +82 -0
- package/dist/esm/components/Rating.js +82 -0
- package/dist/esm/components/Select.d.ts +74 -0
- package/dist/esm/components/Select.js +74 -0
- package/dist/esm/components/Sidebar.d.ts +174 -0
- package/dist/esm/components/Sidebar.js +174 -0
- package/dist/esm/components/Skeleton.d.ts +57 -0
- package/dist/esm/components/Skeleton.js +57 -0
- package/dist/esm/components/Slider.d.ts +64 -0
- package/dist/esm/components/Slider.js +64 -0
- package/dist/esm/components/Spinner.d.ts +70 -0
- package/dist/esm/components/Spinner.js +70 -0
- package/dist/esm/components/Stack.d.ts +75 -0
- package/dist/esm/components/Stack.js +75 -0
- package/dist/esm/components/Stepper.d.ts +150 -0
- package/dist/esm/components/Stepper.js +150 -0
- package/dist/esm/components/Table.d.ts +173 -0
- package/dist/esm/components/Table.js +173 -0
- package/dist/esm/components/Tabs.d.ts +104 -0
- package/dist/esm/components/Tabs.js +104 -0
- package/dist/esm/components/Tag.d.ts +74 -0
- package/dist/esm/components/Tag.js +74 -0
- package/dist/esm/components/Textarea.d.ts +75 -0
- package/dist/esm/components/Textarea.js +75 -0
- package/dist/esm/components/Timeline.d.ts +124 -0
- package/dist/esm/components/Timeline.js +124 -0
- package/dist/esm/components/Toast.d.ts +155 -0
- package/dist/esm/components/Toast.js +155 -0
- package/dist/esm/components/Toggle.d.ts +75 -0
- package/dist/esm/components/Toggle.js +75 -0
- package/dist/esm/components/Tooltip.d.ts +80 -0
- package/dist/esm/components/Tooltip.js +80 -0
- package/dist/esm/components/TypographyComponents.d.ts +265 -0
- package/dist/esm/components/TypographyComponents.js +265 -0
- package/dist/esm/components/UtilityComponents.d.ts +345 -0
- package/dist/esm/components/UtilityComponents.js +345 -0
- package/dist/esm/components/Video.d.ts +82 -0
- package/dist/esm/components/Video.js +82 -0
- package/dist/esm/components/index.d.ts +311 -0
- package/dist/esm/components/index.js +311 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/styles/main.css +493 -0
- package/dist/esm/theme/ThemeProvider.d.ts +185 -0
- package/dist/esm/theme/ThemeProvider.js +185 -0
- package/dist/esm/theme/index.d.ts +2 -0
- package/dist/esm/theme/index.js +2 -0
- package/dist/esm/utilities/classNames.d.ts +200 -0
- package/dist/esm/utilities/classNames.js +200 -0
- package/dist/esm/utilities/index.d.ts +3 -0
- package/dist/esm/utilities/index.js +3 -0
- package/dist/esm/utilities/styles.d.ts +94 -0
- package/dist/esm/utilities/styles.js +94 -0
- package/dist/styles/main.css +493 -0
- package/package.json +124 -6
- package/src/styles/main.css +493 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React, { createContext, useContext, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ThemeName = 'light' | 'dark' | 'auto';
|
|
4
|
+
|
|
5
|
+
export interface ThemeColors {
|
|
6
|
+
primary: string;
|
|
7
|
+
secondary: string;
|
|
8
|
+
success: string;
|
|
9
|
+
warning: string;
|
|
10
|
+
danger: string;
|
|
11
|
+
info: string;
|
|
12
|
+
background: string;
|
|
13
|
+
backgroundAlt: string;
|
|
14
|
+
text: string;
|
|
15
|
+
textMuted: string;
|
|
16
|
+
border: string;
|
|
17
|
+
borderLight: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ThemeSpacing {
|
|
21
|
+
xs: string;
|
|
22
|
+
sm: string;
|
|
23
|
+
md: string;
|
|
24
|
+
lg: string;
|
|
25
|
+
xl: string;
|
|
26
|
+
'2xl': string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ThemeTypography {
|
|
30
|
+
fontFamily: string;
|
|
31
|
+
fontSize: {
|
|
32
|
+
xs: string;
|
|
33
|
+
sm: string;
|
|
34
|
+
md: string;
|
|
35
|
+
lg: string;
|
|
36
|
+
xl: string;
|
|
37
|
+
'2xl': string;
|
|
38
|
+
};
|
|
39
|
+
lineHeight: {
|
|
40
|
+
tight: number;
|
|
41
|
+
normal: number;
|
|
42
|
+
relaxed: number;
|
|
43
|
+
};
|
|
44
|
+
fontWeight: {
|
|
45
|
+
light: number;
|
|
46
|
+
normal: number;
|
|
47
|
+
medium: number;
|
|
48
|
+
semibold: number;
|
|
49
|
+
bold: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ThemeConfig {
|
|
54
|
+
colors: ThemeColors;
|
|
55
|
+
spacing: ThemeSpacing;
|
|
56
|
+
typography: ThemeTypography;
|
|
57
|
+
borderRadius: {
|
|
58
|
+
sm: string;
|
|
59
|
+
md: string;
|
|
60
|
+
lg: string;
|
|
61
|
+
full: string;
|
|
62
|
+
};
|
|
63
|
+
shadows: {
|
|
64
|
+
sm: string;
|
|
65
|
+
md: string;
|
|
66
|
+
lg: string;
|
|
67
|
+
xl: string;
|
|
68
|
+
};
|
|
69
|
+
transitions: {
|
|
70
|
+
fast: string;
|
|
71
|
+
normal: string;
|
|
72
|
+
slow: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const defaultTheme: ThemeConfig = {
|
|
77
|
+
colors: {
|
|
78
|
+
primary: '#007bff',
|
|
79
|
+
secondary: '#6c757d',
|
|
80
|
+
success: '#28a745',
|
|
81
|
+
warning: '#ffc107',
|
|
82
|
+
danger: '#dc3545',
|
|
83
|
+
info: '#17a2b8',
|
|
84
|
+
background: '#ffffff',
|
|
85
|
+
backgroundAlt: '#f8f9fa',
|
|
86
|
+
text: '#212529',
|
|
87
|
+
textMuted: '#6c757d',
|
|
88
|
+
border: '#dee2e6',
|
|
89
|
+
borderLight: '#e9ecef',
|
|
90
|
+
},
|
|
91
|
+
spacing: {
|
|
92
|
+
xs: '4px',
|
|
93
|
+
sm: '8px',
|
|
94
|
+
md: '16px',
|
|
95
|
+
lg: '24px',
|
|
96
|
+
xl: '32px',
|
|
97
|
+
'2xl': '48px',
|
|
98
|
+
},
|
|
99
|
+
typography: {
|
|
100
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
101
|
+
fontSize: {
|
|
102
|
+
xs: '12px',
|
|
103
|
+
sm: '14px',
|
|
104
|
+
md: '16px',
|
|
105
|
+
lg: '18px',
|
|
106
|
+
xl: '20px',
|
|
107
|
+
'2xl': '24px',
|
|
108
|
+
},
|
|
109
|
+
lineHeight: {
|
|
110
|
+
tight: 1.2,
|
|
111
|
+
normal: 1.5,
|
|
112
|
+
relaxed: 1.75,
|
|
113
|
+
},
|
|
114
|
+
fontWeight: {
|
|
115
|
+
light: 300,
|
|
116
|
+
normal: 400,
|
|
117
|
+
medium: 500,
|
|
118
|
+
semibold: 600,
|
|
119
|
+
bold: 700,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
borderRadius: {
|
|
123
|
+
sm: '4px',
|
|
124
|
+
md: '8px',
|
|
125
|
+
lg: '12px',
|
|
126
|
+
full: '9999px',
|
|
127
|
+
},
|
|
128
|
+
shadows: {
|
|
129
|
+
sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
130
|
+
md: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',
|
|
131
|
+
lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1)',
|
|
132
|
+
xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1)',
|
|
133
|
+
},
|
|
134
|
+
transitions: {
|
|
135
|
+
fast: '150ms ease-in-out',
|
|
136
|
+
normal: '250ms ease-in-out',
|
|
137
|
+
slow: '350ms ease-in-out',
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
interface ThemeContextValue {
|
|
142
|
+
theme: ThemeConfig;
|
|
143
|
+
themeName: ThemeName;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
|
|
147
|
+
|
|
148
|
+
export interface ThemeProviderProps {
|
|
149
|
+
children: ReactNode;
|
|
150
|
+
theme?: ThemeName | ThemeConfig;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function ThemeProvider({ children, theme = 'light' }: ThemeProviderProps) {
|
|
154
|
+
const themeConfig = typeof theme === 'string' ? defaultTheme : { ...defaultTheme, ...theme };
|
|
155
|
+
const themeName = typeof theme === 'string' ? theme : 'light';
|
|
156
|
+
|
|
157
|
+
const value: ThemeContextValue = {
|
|
158
|
+
theme: themeConfig,
|
|
159
|
+
themeName: themeName as ThemeName,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<ThemeContext.Provider value={value}>
|
|
164
|
+
<div data-theme={themeName}>{children}</div>
|
|
165
|
+
</ThemeContext.Provider>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function useTheme(): ThemeConfig {
|
|
170
|
+
const context = useContext(ThemeContext);
|
|
171
|
+
if (!context) {
|
|
172
|
+
console.warn(
|
|
173
|
+
'useTheme must be used within a ThemeProvider. Falling back to default theme.',
|
|
174
|
+
);
|
|
175
|
+
return defaultTheme;
|
|
176
|
+
}
|
|
177
|
+
return context.theme;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function useThemeName(): ThemeName {
|
|
181
|
+
const context = useContext(ThemeContext);
|
|
182
|
+
return context?.themeName || 'light';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { defaultTheme };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class name utilities for combining and conditionally applying class names
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export function cn(...classes: (string | undefined | null | false)[]): string {
|
|
6
|
+
return classes
|
|
7
|
+
.filter((cls) => typeof cls === 'string' && cls.trim())
|
|
8
|
+
.join(' ');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Spacing utility classes
|
|
13
|
+
*/
|
|
14
|
+
export const spacing = {
|
|
15
|
+
padding: {
|
|
16
|
+
none: 'p-0',
|
|
17
|
+
xs: 'p-1',
|
|
18
|
+
sm: 'p-2',
|
|
19
|
+
medium: 'p-4',
|
|
20
|
+
md: 'p-4',
|
|
21
|
+
lg: 'p-6',
|
|
22
|
+
xl: 'p-8',
|
|
23
|
+
'2xl': 'p-12',
|
|
24
|
+
},
|
|
25
|
+
margin: {
|
|
26
|
+
none: 'm-0',
|
|
27
|
+
xs: 'm-1',
|
|
28
|
+
sm: 'm-2',
|
|
29
|
+
medium: 'm-4',
|
|
30
|
+
md: 'm-4',
|
|
31
|
+
lg: 'm-6',
|
|
32
|
+
xl: 'm-8',
|
|
33
|
+
'2xl': 'm-12',
|
|
34
|
+
},
|
|
35
|
+
gap: {
|
|
36
|
+
xs: 'gap-1',
|
|
37
|
+
sm: 'gap-2',
|
|
38
|
+
md: 'gap-4',
|
|
39
|
+
lg: 'gap-6',
|
|
40
|
+
xl: 'gap-8',
|
|
41
|
+
'2xl': 'gap-12',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Color utility classes
|
|
47
|
+
*/
|
|
48
|
+
export const colors = {
|
|
49
|
+
background: {
|
|
50
|
+
light: 'bg-white',
|
|
51
|
+
alt: 'bg-gray-50',
|
|
52
|
+
dark: 'bg-gray-900',
|
|
53
|
+
primary: 'bg-blue-50',
|
|
54
|
+
success: 'bg-green-50',
|
|
55
|
+
warning: 'bg-yellow-50',
|
|
56
|
+
danger: 'bg-red-50',
|
|
57
|
+
},
|
|
58
|
+
text: {
|
|
59
|
+
dark: 'text-gray-900',
|
|
60
|
+
primary: 'text-gray-700',
|
|
61
|
+
muted: 'text-gray-500',
|
|
62
|
+
light: 'text-white',
|
|
63
|
+
success: 'text-green-600',
|
|
64
|
+
warning: 'text-yellow-600',
|
|
65
|
+
danger: 'text-red-600',
|
|
66
|
+
info: 'text-blue-600',
|
|
67
|
+
},
|
|
68
|
+
border: {
|
|
69
|
+
light: 'border-gray-200',
|
|
70
|
+
medium: 'border-gray-300',
|
|
71
|
+
dark: 'border-gray-400',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Typography utility classes
|
|
77
|
+
*/
|
|
78
|
+
export const typography = {
|
|
79
|
+
size: {
|
|
80
|
+
xs: 'text-xs',
|
|
81
|
+
sm: 'text-sm',
|
|
82
|
+
base: 'text-base',
|
|
83
|
+
md: 'text-base',
|
|
84
|
+
lg: 'text-lg',
|
|
85
|
+
xl: 'text-xl',
|
|
86
|
+
'2xl': 'text-2xl',
|
|
87
|
+
},
|
|
88
|
+
weight: {
|
|
89
|
+
light: 'font-light',
|
|
90
|
+
normal: 'font-normal',
|
|
91
|
+
medium: 'font-medium',
|
|
92
|
+
semibold: 'font-semibold',
|
|
93
|
+
bold: 'font-bold',
|
|
94
|
+
},
|
|
95
|
+
line: {
|
|
96
|
+
tight: 'leading-tight',
|
|
97
|
+
normal: 'leading-normal',
|
|
98
|
+
relaxed: 'leading-relaxed',
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Border radius utility classes
|
|
104
|
+
*/
|
|
105
|
+
export const radius = {
|
|
106
|
+
none: 'rounded-none',
|
|
107
|
+
sm: 'rounded-sm',
|
|
108
|
+
md: 'rounded-md',
|
|
109
|
+
lg: 'rounded-lg',
|
|
110
|
+
full: 'rounded-full',
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Shadow utility classes
|
|
115
|
+
*/
|
|
116
|
+
export const shadows = {
|
|
117
|
+
none: 'shadow-none',
|
|
118
|
+
sm: 'shadow-sm',
|
|
119
|
+
md: 'shadow-md',
|
|
120
|
+
lg: 'shadow-lg',
|
|
121
|
+
xl: 'shadow-xl',
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Flex utility classes
|
|
126
|
+
*/
|
|
127
|
+
export const flex = {
|
|
128
|
+
center: 'flex items-center justify-center',
|
|
129
|
+
between: 'flex items-center justify-between',
|
|
130
|
+
start: 'flex items-start justify-start',
|
|
131
|
+
end: 'flex items-end justify-end',
|
|
132
|
+
col: 'flex flex-col',
|
|
133
|
+
colCenter: 'flex flex-col items-center justify-center',
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Responsive utility classes
|
|
138
|
+
*/
|
|
139
|
+
export const responsive = {
|
|
140
|
+
hidden: 'hidden',
|
|
141
|
+
smOnly: 'sm:block hidden',
|
|
142
|
+
mdOnly: 'md:block hidden lg:hidden',
|
|
143
|
+
lgOnly: 'lg:block hidden',
|
|
144
|
+
smHidden: 'sm:hidden',
|
|
145
|
+
mdHidden: 'md:hidden',
|
|
146
|
+
lgHidden: 'lg:hidden',
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Display utility classes
|
|
151
|
+
*/
|
|
152
|
+
export const display = {
|
|
153
|
+
block: 'block',
|
|
154
|
+
inline: 'inline',
|
|
155
|
+
inlineBlock: 'inline-block',
|
|
156
|
+
flex: 'flex',
|
|
157
|
+
grid: 'grid',
|
|
158
|
+
hidden: 'hidden',
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Position utility classes
|
|
163
|
+
*/
|
|
164
|
+
export const position = {
|
|
165
|
+
relative: 'relative',
|
|
166
|
+
absolute: 'absolute',
|
|
167
|
+
fixed: 'fixed',
|
|
168
|
+
sticky: 'sticky',
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Size utility classes
|
|
173
|
+
*/
|
|
174
|
+
export const size = {
|
|
175
|
+
full: 'w-full h-full',
|
|
176
|
+
screen: 'w-screen h-screen',
|
|
177
|
+
min: 'w-min h-min',
|
|
178
|
+
max: 'w-max h-max',
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Variant helper function for creating consistent variant classes
|
|
183
|
+
*/
|
|
184
|
+
export function variant(
|
|
185
|
+
variants: Record<string, string>,
|
|
186
|
+
defaultVariant: string,
|
|
187
|
+
selected?: string,
|
|
188
|
+
): string {
|
|
189
|
+
return variants[selected || defaultVariant] || variants[defaultVariant];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* State utility classes
|
|
194
|
+
*/
|
|
195
|
+
export const state = {
|
|
196
|
+
focus: 'focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2',
|
|
197
|
+
hover: 'hover:opacity-90 transition-opacity',
|
|
198
|
+
active: 'active:opacity-75',
|
|
199
|
+
disabled: 'disabled:opacity-50 disabled:cursor-not-allowed',
|
|
200
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class name utilities for combining and conditionally applying class names
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export function cn(...classes: (string | undefined | null | false)[]): string {
|
|
6
|
+
return classes
|
|
7
|
+
.filter((cls) => typeof cls === 'string' && cls.trim())
|
|
8
|
+
.join(' ');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Spacing utility classes
|
|
13
|
+
*/
|
|
14
|
+
export const spacing = {
|
|
15
|
+
padding: {
|
|
16
|
+
none: 'p-0',
|
|
17
|
+
xs: 'p-1',
|
|
18
|
+
sm: 'p-2',
|
|
19
|
+
medium: 'p-4',
|
|
20
|
+
md: 'p-4',
|
|
21
|
+
lg: 'p-6',
|
|
22
|
+
xl: 'p-8',
|
|
23
|
+
'2xl': 'p-12',
|
|
24
|
+
},
|
|
25
|
+
margin: {
|
|
26
|
+
none: 'm-0',
|
|
27
|
+
xs: 'm-1',
|
|
28
|
+
sm: 'm-2',
|
|
29
|
+
medium: 'm-4',
|
|
30
|
+
md: 'm-4',
|
|
31
|
+
lg: 'm-6',
|
|
32
|
+
xl: 'm-8',
|
|
33
|
+
'2xl': 'm-12',
|
|
34
|
+
},
|
|
35
|
+
gap: {
|
|
36
|
+
xs: 'gap-1',
|
|
37
|
+
sm: 'gap-2',
|
|
38
|
+
md: 'gap-4',
|
|
39
|
+
lg: 'gap-6',
|
|
40
|
+
xl: 'gap-8',
|
|
41
|
+
'2xl': 'gap-12',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Color utility classes
|
|
47
|
+
*/
|
|
48
|
+
export const colors = {
|
|
49
|
+
background: {
|
|
50
|
+
light: 'bg-white',
|
|
51
|
+
alt: 'bg-gray-50',
|
|
52
|
+
dark: 'bg-gray-900',
|
|
53
|
+
primary: 'bg-blue-50',
|
|
54
|
+
success: 'bg-green-50',
|
|
55
|
+
warning: 'bg-yellow-50',
|
|
56
|
+
danger: 'bg-red-50',
|
|
57
|
+
},
|
|
58
|
+
text: {
|
|
59
|
+
dark: 'text-gray-900',
|
|
60
|
+
primary: 'text-gray-700',
|
|
61
|
+
muted: 'text-gray-500',
|
|
62
|
+
light: 'text-white',
|
|
63
|
+
success: 'text-green-600',
|
|
64
|
+
warning: 'text-yellow-600',
|
|
65
|
+
danger: 'text-red-600',
|
|
66
|
+
info: 'text-blue-600',
|
|
67
|
+
},
|
|
68
|
+
border: {
|
|
69
|
+
light: 'border-gray-200',
|
|
70
|
+
medium: 'border-gray-300',
|
|
71
|
+
dark: 'border-gray-400',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Typography utility classes
|
|
77
|
+
*/
|
|
78
|
+
export const typography = {
|
|
79
|
+
size: {
|
|
80
|
+
xs: 'text-xs',
|
|
81
|
+
sm: 'text-sm',
|
|
82
|
+
base: 'text-base',
|
|
83
|
+
md: 'text-base',
|
|
84
|
+
lg: 'text-lg',
|
|
85
|
+
xl: 'text-xl',
|
|
86
|
+
'2xl': 'text-2xl',
|
|
87
|
+
},
|
|
88
|
+
weight: {
|
|
89
|
+
light: 'font-light',
|
|
90
|
+
normal: 'font-normal',
|
|
91
|
+
medium: 'font-medium',
|
|
92
|
+
semibold: 'font-semibold',
|
|
93
|
+
bold: 'font-bold',
|
|
94
|
+
},
|
|
95
|
+
line: {
|
|
96
|
+
tight: 'leading-tight',
|
|
97
|
+
normal: 'leading-normal',
|
|
98
|
+
relaxed: 'leading-relaxed',
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Border radius utility classes
|
|
104
|
+
*/
|
|
105
|
+
export const radius = {
|
|
106
|
+
none: 'rounded-none',
|
|
107
|
+
sm: 'rounded-sm',
|
|
108
|
+
md: 'rounded-md',
|
|
109
|
+
lg: 'rounded-lg',
|
|
110
|
+
full: 'rounded-full',
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Shadow utility classes
|
|
115
|
+
*/
|
|
116
|
+
export const shadows = {
|
|
117
|
+
none: 'shadow-none',
|
|
118
|
+
sm: 'shadow-sm',
|
|
119
|
+
md: 'shadow-md',
|
|
120
|
+
lg: 'shadow-lg',
|
|
121
|
+
xl: 'shadow-xl',
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Flex utility classes
|
|
126
|
+
*/
|
|
127
|
+
export const flex = {
|
|
128
|
+
center: 'flex items-center justify-center',
|
|
129
|
+
between: 'flex items-center justify-between',
|
|
130
|
+
start: 'flex items-start justify-start',
|
|
131
|
+
end: 'flex items-end justify-end',
|
|
132
|
+
col: 'flex flex-col',
|
|
133
|
+
colCenter: 'flex flex-col items-center justify-center',
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Responsive utility classes
|
|
138
|
+
*/
|
|
139
|
+
export const responsive = {
|
|
140
|
+
hidden: 'hidden',
|
|
141
|
+
smOnly: 'sm:block hidden',
|
|
142
|
+
mdOnly: 'md:block hidden lg:hidden',
|
|
143
|
+
lgOnly: 'lg:block hidden',
|
|
144
|
+
smHidden: 'sm:hidden',
|
|
145
|
+
mdHidden: 'md:hidden',
|
|
146
|
+
lgHidden: 'lg:hidden',
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Display utility classes
|
|
151
|
+
*/
|
|
152
|
+
export const display = {
|
|
153
|
+
block: 'block',
|
|
154
|
+
inline: 'inline',
|
|
155
|
+
inlineBlock: 'inline-block',
|
|
156
|
+
flex: 'flex',
|
|
157
|
+
grid: 'grid',
|
|
158
|
+
hidden: 'hidden',
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Position utility classes
|
|
163
|
+
*/
|
|
164
|
+
export const position = {
|
|
165
|
+
relative: 'relative',
|
|
166
|
+
absolute: 'absolute',
|
|
167
|
+
fixed: 'fixed',
|
|
168
|
+
sticky: 'sticky',
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Size utility classes
|
|
173
|
+
*/
|
|
174
|
+
export const size = {
|
|
175
|
+
full: 'w-full h-full',
|
|
176
|
+
screen: 'w-screen h-screen',
|
|
177
|
+
min: 'w-min h-min',
|
|
178
|
+
max: 'w-max h-max',
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Variant helper function for creating consistent variant classes
|
|
183
|
+
*/
|
|
184
|
+
export function variant(
|
|
185
|
+
variants: Record<string, string>,
|
|
186
|
+
defaultVariant: string,
|
|
187
|
+
selected?: string,
|
|
188
|
+
): string {
|
|
189
|
+
return variants[selected || defaultVariant] || variants[defaultVariant];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* State utility classes
|
|
194
|
+
*/
|
|
195
|
+
export const state = {
|
|
196
|
+
focus: 'focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2',
|
|
197
|
+
hover: 'hover:opacity-90 transition-opacity',
|
|
198
|
+
active: 'active:opacity-75',
|
|
199
|
+
disabled: 'disabled:opacity-50 disabled:cursor-not-allowed',
|
|
200
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { cn, spacing, colors, typography, radius, shadows, flex, responsive, display, position, size, variant, state } from './classNames';
|
|
2
|
+
export { createStyles, combineStyles, media, createCSSVariables, getCSSVariable, setCSSVariable, animations } from './styles';
|
|
3
|
+
export type { StyleObject } from './styles';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { cn, spacing, colors, typography, radius, shadows, flex, responsive, display, position, size, variant, state } from './classNames';
|
|
2
|
+
export { createStyles, combineStyles, media, createCSSVariables, getCSSVariable, setCSSVariable, animations } from './styles';
|
|
3
|
+
export type { StyleObject } from './styles';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS-in-JS style utilities for dynamic styling
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface StyleObject {
|
|
6
|
+
[key: string]: string | number | undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function createStyles(styles: StyleObject): React.CSSProperties {
|
|
10
|
+
const result: React.CSSProperties = {};
|
|
11
|
+
|
|
12
|
+
for (const [key, value] of Object.entries(styles)) {
|
|
13
|
+
if (value !== undefined) {
|
|
14
|
+
// Convert camelCase CSS property names to kebab-case if needed
|
|
15
|
+
const cssKey = key as keyof React.CSSProperties;
|
|
16
|
+
result[cssKey] = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function combineStyles(...styles: (StyleObject | undefined | null)[]): React.CSSProperties {
|
|
24
|
+
const result: React.CSSProperties = {};
|
|
25
|
+
|
|
26
|
+
for (const style of styles) {
|
|
27
|
+
if (style) {
|
|
28
|
+
Object.assign(result, createStyles(style));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Media query builder
|
|
37
|
+
*/
|
|
38
|
+
export const media = {
|
|
39
|
+
sm: '@media (min-width: 640px)',
|
|
40
|
+
md: '@media (min-width: 768px)',
|
|
41
|
+
lg: '@media (min-width: 1024px)',
|
|
42
|
+
xl: '@media (min-width: 1280px)',
|
|
43
|
+
'2xl': '@media (min-width: 1536px)',
|
|
44
|
+
dark: '@media (prefers-color-scheme: dark)',
|
|
45
|
+
light: '@media (prefers-color-scheme: light)',
|
|
46
|
+
motion: '@media (prefers-reduced-motion: no-preference)',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* CSS variable builder
|
|
51
|
+
*/
|
|
52
|
+
export function createCSSVariables(variables: Record<string, string>): Record<string, string> {
|
|
53
|
+
const result: Record<string, string> = {};
|
|
54
|
+
|
|
55
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
56
|
+
result[`--${key}`] = value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get CSS variable value
|
|
64
|
+
*/
|
|
65
|
+
export function getCSSVariable(name: string): string {
|
|
66
|
+
if (typeof window === 'undefined') {
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
return getComputedStyle(document.documentElement).getPropertyValue(`--${name}`).trim();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Set CSS variable value
|
|
74
|
+
*/
|
|
75
|
+
export function setCSSVariable(name: string, value: string): void {
|
|
76
|
+
if (typeof document === 'undefined') {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
document.documentElement.style.setProperty(`--${name}`, value);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* CSS animation utilities
|
|
84
|
+
*/
|
|
85
|
+
export const animations = {
|
|
86
|
+
fadeIn: 'animation: fadeIn 0.3s ease-in-out',
|
|
87
|
+
fadeOut: 'animation: fadeOut 0.3s ease-in-out',
|
|
88
|
+
slideInUp: 'animation: slideInUp 0.3s ease-in-out',
|
|
89
|
+
slideOutDown: 'animation: slideOutDown 0.3s ease-in-out',
|
|
90
|
+
slideInRight: 'animation: slideInRight 0.3s ease-in-out',
|
|
91
|
+
slideOutLeft: 'animation: slideOutLeft 0.3s ease-in-out',
|
|
92
|
+
scaleIn: 'animation: scaleIn 0.3s ease-in-out',
|
|
93
|
+
scaleOut: 'animation: scaleOut 0.3s ease-in-out',
|
|
94
|
+
};
|