@veevarts/design-system 1.0.0-alpha.14 → 1.0.0-alpha.16
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/dist/tailwind/index.d.ts +176 -0
- package/dist/tailwind/index.js +424 -0
- package/package.json +15 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Veevart Design System - Tailwind Configuration Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface ColorPalette {
|
|
6
|
+
50: string;
|
|
7
|
+
100: string;
|
|
8
|
+
200: string;
|
|
9
|
+
300: string;
|
|
10
|
+
400: string;
|
|
11
|
+
500: string;
|
|
12
|
+
600: string;
|
|
13
|
+
700: string;
|
|
14
|
+
800: string;
|
|
15
|
+
900: string;
|
|
16
|
+
DEFAULT: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface Colors {
|
|
20
|
+
brand: {
|
|
21
|
+
primary: ColorPalette;
|
|
22
|
+
};
|
|
23
|
+
semantic: {
|
|
24
|
+
secondary: string;
|
|
25
|
+
success: string;
|
|
26
|
+
warning: string;
|
|
27
|
+
danger: string;
|
|
28
|
+
info: string;
|
|
29
|
+
};
|
|
30
|
+
neutral: {
|
|
31
|
+
white: string;
|
|
32
|
+
black: string;
|
|
33
|
+
gray: Omit<ColorPalette, 'DEFAULT'>;
|
|
34
|
+
};
|
|
35
|
+
palettes: {
|
|
36
|
+
secondary: ColorPalette;
|
|
37
|
+
danger: ColorPalette;
|
|
38
|
+
success: ColorPalette;
|
|
39
|
+
warning: ColorPalette;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface Typography {
|
|
44
|
+
fontFamily: {
|
|
45
|
+
sans: string[];
|
|
46
|
+
mono: string[];
|
|
47
|
+
};
|
|
48
|
+
fontSize: Record<string, [string, { lineHeight: string }]>;
|
|
49
|
+
fontWeight: Record<string, string>;
|
|
50
|
+
lineHeight: Record<string, string>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface Spacing {
|
|
54
|
+
[key: string]: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface TailwindTheme {
|
|
58
|
+
colors: Record<string, unknown>;
|
|
59
|
+
fontFamily: Typography['fontFamily'];
|
|
60
|
+
spacing: Spacing;
|
|
61
|
+
fontSize: Typography['fontSize'];
|
|
62
|
+
fontWeight: Typography['fontWeight'];
|
|
63
|
+
lineHeight: Typography['lineHeight'];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface HeroUIColorOverrides {
|
|
67
|
+
primary?: string | Partial<ColorPalette>;
|
|
68
|
+
secondary?: string | Partial<ColorPalette>;
|
|
69
|
+
success?: string | Partial<ColorPalette>;
|
|
70
|
+
warning?: string | Partial<ColorPalette>;
|
|
71
|
+
danger?: string | Partial<ColorPalette>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface HeroUIConfigOverrides {
|
|
75
|
+
colors?: HeroUIColorOverrides;
|
|
76
|
+
themes?: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface HeroUIConfig {
|
|
80
|
+
themes: {
|
|
81
|
+
light: {
|
|
82
|
+
colors: {
|
|
83
|
+
primary: ColorPalette;
|
|
84
|
+
secondary: ColorPalette;
|
|
85
|
+
danger: ColorPalette;
|
|
86
|
+
success: ColorPalette;
|
|
87
|
+
warning: ColorPalette;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface VeevartPreset {
|
|
94
|
+
theme: {
|
|
95
|
+
extend: TailwindTheme;
|
|
96
|
+
};
|
|
97
|
+
darkMode: 'class';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Tokens {
|
|
101
|
+
colors: Colors;
|
|
102
|
+
typography: Typography;
|
|
103
|
+
spacing: Spacing;
|
|
104
|
+
tailwindTheme: TailwindTheme;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Veevart Design System Tailwind preset
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* const { veevartPreset } = require('@veevarts/design-system/tailwind');
|
|
112
|
+
*
|
|
113
|
+
* module.exports = {
|
|
114
|
+
* presets: [veevartPreset],
|
|
115
|
+
* content: [...],
|
|
116
|
+
* };
|
|
117
|
+
*/
|
|
118
|
+
export const veevartPreset: VeevartPreset;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Creates HeroUI configuration with optional overrides
|
|
122
|
+
*
|
|
123
|
+
* @param overrides - Configuration overrides
|
|
124
|
+
* @returns HeroUI plugin configuration
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* createHeroUIConfig({
|
|
128
|
+
* colors: {
|
|
129
|
+
* primary: '#FF0000',
|
|
130
|
+
* },
|
|
131
|
+
* });
|
|
132
|
+
*/
|
|
133
|
+
export function createHeroUIConfig(overrides?: HeroUIConfigOverrides): HeroUIConfig;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Design System tokens
|
|
137
|
+
*/
|
|
138
|
+
export const tokens: Tokens;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Color tokens
|
|
142
|
+
*/
|
|
143
|
+
export const colors: Colors;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Typography tokens
|
|
147
|
+
*/
|
|
148
|
+
export const typography: Typography;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Spacing tokens
|
|
152
|
+
*/
|
|
153
|
+
export const spacing: Spacing;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Tailwind theme extension
|
|
157
|
+
*/
|
|
158
|
+
export const tailwindTheme: TailwindTheme;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Default HeroUI theme configuration
|
|
162
|
+
*/
|
|
163
|
+
export const defaultHeroUITheme: HeroUIConfig['themes'];
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Deep merge utility
|
|
167
|
+
*/
|
|
168
|
+
export function deepMerge<T extends object>(target: T, source: Partial<T>): T;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Normalize a color value to a full palette
|
|
172
|
+
*/
|
|
173
|
+
export function normalizeColorPalette(
|
|
174
|
+
color: string | Partial<ColorPalette>,
|
|
175
|
+
defaultPalette: ColorPalette,
|
|
176
|
+
): ColorPalette;
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Veevart Design System - Tailwind Configuration
|
|
3
|
+
*
|
|
4
|
+
* This module exports Tailwind CSS configuration utilities that can be used
|
|
5
|
+
* by consuming applications to maintain consistent styling with the Design System.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // In your tailwind.config.js
|
|
9
|
+
* const { veevartPreset } = require('@veevarts/design-system/tailwind');
|
|
10
|
+
*
|
|
11
|
+
* module.exports = {
|
|
12
|
+
* presets: [veevartPreset],
|
|
13
|
+
* content: [...],
|
|
14
|
+
* };
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // With custom overrides (e.g., client-specific primary color)
|
|
18
|
+
* const { createHeroUIConfig, tokens } = require('@veevarts/design-system/tailwind');
|
|
19
|
+
* const { heroui } = require('@heroui/react');
|
|
20
|
+
*
|
|
21
|
+
* const clientPrimaryColor = '#FF0000'; // From API
|
|
22
|
+
*
|
|
23
|
+
* module.exports = {
|
|
24
|
+
* theme: { extend: tokens.tailwindTheme },
|
|
25
|
+
* plugins: [
|
|
26
|
+
* heroui(createHeroUIConfig({
|
|
27
|
+
* colors: {
|
|
28
|
+
* primary: clientPrimaryColor,
|
|
29
|
+
* },
|
|
30
|
+
* })),
|
|
31
|
+
* ],
|
|
32
|
+
* };
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
// =============================================================================
|
|
36
|
+
// TOKENS
|
|
37
|
+
// =============================================================================
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Color tokens for the Design System
|
|
41
|
+
*/
|
|
42
|
+
const colors = {
|
|
43
|
+
brand: {
|
|
44
|
+
primary: {
|
|
45
|
+
50: '#fef5f1',
|
|
46
|
+
100: '#fde8e0',
|
|
47
|
+
200: '#fbd5c7',
|
|
48
|
+
300: '#f7b79f',
|
|
49
|
+
400: '#f18d68',
|
|
50
|
+
500: '#C14615',
|
|
51
|
+
600: '#a83b11',
|
|
52
|
+
700: '#8b2f0e',
|
|
53
|
+
800: '#73260d',
|
|
54
|
+
900: '#5f210c',
|
|
55
|
+
DEFAULT: '#C14615',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
semantic: {
|
|
59
|
+
secondary: '#000000',
|
|
60
|
+
success: '#057A54',
|
|
61
|
+
warning: '#F5A524',
|
|
62
|
+
danger: '#B62214',
|
|
63
|
+
info: '#2563EB',
|
|
64
|
+
},
|
|
65
|
+
neutral: {
|
|
66
|
+
white: '#FFFFFF',
|
|
67
|
+
black: '#000000',
|
|
68
|
+
gray: {
|
|
69
|
+
50: '#F9FAFB',
|
|
70
|
+
100: '#F3F4F6',
|
|
71
|
+
200: '#E5E7EB',
|
|
72
|
+
300: '#D1D5DB',
|
|
73
|
+
400: '#9CA3AF',
|
|
74
|
+
500: '#6B7280',
|
|
75
|
+
600: '#4B5563',
|
|
76
|
+
700: '#374151',
|
|
77
|
+
800: '#1F2937',
|
|
78
|
+
900: '#111827',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
palettes: {
|
|
82
|
+
secondary: {
|
|
83
|
+
50: '#f9fafb',
|
|
84
|
+
100: '#f3f4f6',
|
|
85
|
+
200: '#e5e7eb',
|
|
86
|
+
300: '#d1d5db',
|
|
87
|
+
400: '#9ca3af',
|
|
88
|
+
500: '#000000',
|
|
89
|
+
600: '#000000',
|
|
90
|
+
700: '#000000',
|
|
91
|
+
800: '#000000',
|
|
92
|
+
900: '#000000',
|
|
93
|
+
DEFAULT: '#000000',
|
|
94
|
+
},
|
|
95
|
+
danger: {
|
|
96
|
+
50: '#fef2f2',
|
|
97
|
+
100: '#fee2e2',
|
|
98
|
+
200: '#fecaca',
|
|
99
|
+
300: '#fca5a5',
|
|
100
|
+
400: '#f87171',
|
|
101
|
+
500: '#B62214',
|
|
102
|
+
600: '#a31e12',
|
|
103
|
+
700: '#8b1a0f',
|
|
104
|
+
800: '#73160d',
|
|
105
|
+
900: '#5c120a',
|
|
106
|
+
DEFAULT: '#B62214',
|
|
107
|
+
},
|
|
108
|
+
success: {
|
|
109
|
+
50: '#ecfdf5',
|
|
110
|
+
100: '#d1fae5',
|
|
111
|
+
200: '#a7f3d0',
|
|
112
|
+
300: '#6ee7b7',
|
|
113
|
+
400: '#34d399',
|
|
114
|
+
500: '#057A54',
|
|
115
|
+
600: '#046c4a',
|
|
116
|
+
700: '#035e40',
|
|
117
|
+
800: '#025035',
|
|
118
|
+
900: '#01422b',
|
|
119
|
+
DEFAULT: '#057A54',
|
|
120
|
+
},
|
|
121
|
+
warning: {
|
|
122
|
+
50: '#fffbeb',
|
|
123
|
+
100: '#fef3c7',
|
|
124
|
+
200: '#fde68a',
|
|
125
|
+
300: '#fcd34d',
|
|
126
|
+
400: '#fbbf24',
|
|
127
|
+
500: '#F5A524',
|
|
128
|
+
600: '#d97706',
|
|
129
|
+
700: '#b45309',
|
|
130
|
+
800: '#92400e',
|
|
131
|
+
900: '#78350f',
|
|
132
|
+
DEFAULT: '#F5A524',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Typography tokens
|
|
139
|
+
*/
|
|
140
|
+
const typography = {
|
|
141
|
+
fontFamily: {
|
|
142
|
+
sans: ['Inter', 'system-ui', 'sans-serif'],
|
|
143
|
+
mono: ['JetBrains Mono', 'monospace'],
|
|
144
|
+
},
|
|
145
|
+
fontSize: {
|
|
146
|
+
xs: ['0.75rem', { lineHeight: '1rem' }],
|
|
147
|
+
sm: ['0.875rem', { lineHeight: '1.25rem' }],
|
|
148
|
+
base: ['1rem', { lineHeight: '1.5rem' }],
|
|
149
|
+
lg: ['1.125rem', { lineHeight: '1.75rem' }],
|
|
150
|
+
xl: ['1.25rem', { lineHeight: '1.75rem' }],
|
|
151
|
+
'2xl': ['1.5rem', { lineHeight: '2rem' }],
|
|
152
|
+
'3xl': ['1.875rem', { lineHeight: '2.25rem' }],
|
|
153
|
+
'4xl': ['2.25rem', { lineHeight: '2.5rem' }],
|
|
154
|
+
},
|
|
155
|
+
fontWeight: {
|
|
156
|
+
normal: '400',
|
|
157
|
+
medium: '500',
|
|
158
|
+
semibold: '600',
|
|
159
|
+
bold: '700',
|
|
160
|
+
},
|
|
161
|
+
lineHeight: {
|
|
162
|
+
tight: '1.25',
|
|
163
|
+
normal: '1.5',
|
|
164
|
+
relaxed: '1.75',
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Spacing tokens
|
|
170
|
+
*/
|
|
171
|
+
const spacing = {
|
|
172
|
+
px: '1px',
|
|
173
|
+
0: '0',
|
|
174
|
+
0.5: '0.125rem',
|
|
175
|
+
1: '0.25rem',
|
|
176
|
+
1.5: '0.375rem',
|
|
177
|
+
2: '0.5rem',
|
|
178
|
+
2.5: '0.625rem',
|
|
179
|
+
3: '0.75rem',
|
|
180
|
+
3.5: '0.875rem',
|
|
181
|
+
4: '1rem',
|
|
182
|
+
5: '1.25rem',
|
|
183
|
+
6: '1.5rem',
|
|
184
|
+
7: '1.75rem',
|
|
185
|
+
8: '2rem',
|
|
186
|
+
9: '2.25rem',
|
|
187
|
+
10: '2.5rem',
|
|
188
|
+
11: '2.75rem',
|
|
189
|
+
12: '3rem',
|
|
190
|
+
14: '3.5rem',
|
|
191
|
+
16: '4rem',
|
|
192
|
+
20: '5rem',
|
|
193
|
+
24: '6rem',
|
|
194
|
+
28: '7rem',
|
|
195
|
+
32: '8rem',
|
|
196
|
+
36: '9rem',
|
|
197
|
+
40: '10rem',
|
|
198
|
+
44: '11rem',
|
|
199
|
+
48: '12rem',
|
|
200
|
+
52: '13rem',
|
|
201
|
+
56: '14rem',
|
|
202
|
+
60: '15rem',
|
|
203
|
+
64: '16rem',
|
|
204
|
+
72: '18rem',
|
|
205
|
+
80: '20rem',
|
|
206
|
+
96: '24rem',
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// =============================================================================
|
|
210
|
+
// TAILWIND THEME EXTENSION
|
|
211
|
+
// =============================================================================
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Tailwind theme extension with Veevart tokens
|
|
215
|
+
*/
|
|
216
|
+
const tailwindTheme = {
|
|
217
|
+
colors: {
|
|
218
|
+
...colors.brand,
|
|
219
|
+
...colors.neutral,
|
|
220
|
+
...colors.semantic,
|
|
221
|
+
},
|
|
222
|
+
fontFamily: typography.fontFamily,
|
|
223
|
+
spacing: spacing,
|
|
224
|
+
fontSize: typography.fontSize,
|
|
225
|
+
fontWeight: typography.fontWeight,
|
|
226
|
+
lineHeight: typography.lineHeight,
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// =============================================================================
|
|
230
|
+
// HEROUI CONFIGURATION
|
|
231
|
+
// =============================================================================
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Default HeroUI theme configuration
|
|
235
|
+
*/
|
|
236
|
+
const defaultHeroUITheme = {
|
|
237
|
+
light: {
|
|
238
|
+
colors: {
|
|
239
|
+
primary: colors.brand.primary,
|
|
240
|
+
secondary: colors.palettes.secondary,
|
|
241
|
+
danger: colors.palettes.danger,
|
|
242
|
+
success: colors.palettes.success,
|
|
243
|
+
warning: colors.palettes.warning,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Deep merge utility for objects
|
|
250
|
+
* @param {object} target - Target object
|
|
251
|
+
* @param {object} source - Source object to merge
|
|
252
|
+
* @returns {object} Merged object
|
|
253
|
+
*/
|
|
254
|
+
function deepMerge(target, source) {
|
|
255
|
+
const result = { ...target };
|
|
256
|
+
|
|
257
|
+
for (const key in source) {
|
|
258
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
259
|
+
if (
|
|
260
|
+
source[key] &&
|
|
261
|
+
typeof source[key] === 'object' &&
|
|
262
|
+
!Array.isArray(source[key]) &&
|
|
263
|
+
target[key] &&
|
|
264
|
+
typeof target[key] === 'object' &&
|
|
265
|
+
!Array.isArray(target[key])
|
|
266
|
+
) {
|
|
267
|
+
result[key] = deepMerge(target[key], source[key]);
|
|
268
|
+
} else {
|
|
269
|
+
result[key] = source[key];
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Creates a color palette from a single color value
|
|
279
|
+
* If a string is provided, it creates a basic palette with that color as the base
|
|
280
|
+
* If an object with shades is provided, it uses those directly
|
|
281
|
+
*
|
|
282
|
+
* @param {string|object} color - Color value or palette object
|
|
283
|
+
* @param {object} defaultPalette - Default palette to use as base
|
|
284
|
+
* @returns {object} Color palette
|
|
285
|
+
*/
|
|
286
|
+
function normalizeColorPalette(color, defaultPalette) {
|
|
287
|
+
if (typeof color === 'string') {
|
|
288
|
+
return {
|
|
289
|
+
...defaultPalette,
|
|
290
|
+
500: color,
|
|
291
|
+
DEFAULT: color,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
return { ...defaultPalette, ...color };
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Creates HeroUI configuration with optional overrides
|
|
299
|
+
*
|
|
300
|
+
* @param {object} overrides - Configuration overrides
|
|
301
|
+
* @param {object} overrides.colors - Color overrides
|
|
302
|
+
* @param {string|object} overrides.colors.primary - Primary color or palette
|
|
303
|
+
* @param {string|object} overrides.colors.secondary - Secondary color or palette
|
|
304
|
+
* @param {string|object} overrides.colors.success - Success color or palette
|
|
305
|
+
* @param {string|object} overrides.colors.warning - Warning color or palette
|
|
306
|
+
* @param {string|object} overrides.colors.danger - Danger color or palette
|
|
307
|
+
* @param {object} overrides.themes - Additional theme configuration
|
|
308
|
+
* @returns {object} HeroUI plugin configuration
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* // Simple color override
|
|
312
|
+
* createHeroUIConfig({
|
|
313
|
+
* colors: {
|
|
314
|
+
* primary: '#FF0000',
|
|
315
|
+
* },
|
|
316
|
+
* });
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* // Full palette override
|
|
320
|
+
* createHeroUIConfig({
|
|
321
|
+
* colors: {
|
|
322
|
+
* primary: {
|
|
323
|
+
* 50: '#fff1f1',
|
|
324
|
+
* 100: '#ffe1e1',
|
|
325
|
+
* // ... more shades
|
|
326
|
+
* 500: '#FF0000',
|
|
327
|
+
* DEFAULT: '#FF0000',
|
|
328
|
+
* },
|
|
329
|
+
* },
|
|
330
|
+
* });
|
|
331
|
+
*/
|
|
332
|
+
function createHeroUIConfig(overrides = {}) {
|
|
333
|
+
const { colors: colorOverrides = {}, themes: themeOverrides = {} } = overrides;
|
|
334
|
+
|
|
335
|
+
// Build the light theme colors with overrides
|
|
336
|
+
const lightColors = {
|
|
337
|
+
primary: colorOverrides.primary
|
|
338
|
+
? normalizeColorPalette(colorOverrides.primary, colors.brand.primary)
|
|
339
|
+
: colors.brand.primary,
|
|
340
|
+
secondary: colorOverrides.secondary
|
|
341
|
+
? normalizeColorPalette(colorOverrides.secondary, colors.palettes.secondary)
|
|
342
|
+
: colors.palettes.secondary,
|
|
343
|
+
danger: colorOverrides.danger
|
|
344
|
+
? normalizeColorPalette(colorOverrides.danger, colors.palettes.danger)
|
|
345
|
+
: colors.palettes.danger,
|
|
346
|
+
success: colorOverrides.success
|
|
347
|
+
? normalizeColorPalette(colorOverrides.success, colors.palettes.success)
|
|
348
|
+
: colors.palettes.success,
|
|
349
|
+
warning: colorOverrides.warning
|
|
350
|
+
? normalizeColorPalette(colorOverrides.warning, colors.palettes.warning)
|
|
351
|
+
: colors.palettes.warning,
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
const baseConfig = {
|
|
355
|
+
themes: {
|
|
356
|
+
light: {
|
|
357
|
+
colors: lightColors,
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// Merge with additional theme overrides if provided
|
|
363
|
+
if (themeOverrides && Object.keys(themeOverrides).length > 0) {
|
|
364
|
+
return deepMerge(baseConfig, { themes: themeOverrides });
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return baseConfig;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// =============================================================================
|
|
371
|
+
// TAILWIND PRESET
|
|
372
|
+
// =============================================================================
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Veevart Design System Tailwind preset
|
|
376
|
+
*
|
|
377
|
+
* Use this preset in your tailwind.config.js to get all Veevart tokens
|
|
378
|
+
* and styling defaults.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* const { veevartPreset } = require('@veevarts/design-system/tailwind');
|
|
382
|
+
*
|
|
383
|
+
* module.exports = {
|
|
384
|
+
* presets: [veevartPreset],
|
|
385
|
+
* content: [...],
|
|
386
|
+
* };
|
|
387
|
+
*/
|
|
388
|
+
const veevartPreset = {
|
|
389
|
+
theme: {
|
|
390
|
+
extend: tailwindTheme,
|
|
391
|
+
},
|
|
392
|
+
darkMode: 'class',
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// =============================================================================
|
|
396
|
+
// EXPORTS
|
|
397
|
+
// =============================================================================
|
|
398
|
+
|
|
399
|
+
module.exports = {
|
|
400
|
+
// Main exports
|
|
401
|
+
veevartPreset,
|
|
402
|
+
createHeroUIConfig,
|
|
403
|
+
|
|
404
|
+
// Tokens for direct access
|
|
405
|
+
tokens: {
|
|
406
|
+
colors,
|
|
407
|
+
typography,
|
|
408
|
+
spacing,
|
|
409
|
+
tailwindTheme,
|
|
410
|
+
},
|
|
411
|
+
|
|
412
|
+
// Individual token exports
|
|
413
|
+
colors,
|
|
414
|
+
typography,
|
|
415
|
+
spacing,
|
|
416
|
+
tailwindTheme,
|
|
417
|
+
|
|
418
|
+
// Default HeroUI theme (for reference)
|
|
419
|
+
defaultHeroUITheme,
|
|
420
|
+
|
|
421
|
+
// Utilities
|
|
422
|
+
deepMerge,
|
|
423
|
+
normalizeColorPalette,
|
|
424
|
+
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veevarts/design-system",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.16",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./tailwind": {
|
|
16
|
+
"types": "./dist/tailwind/index.d.ts",
|
|
17
|
+
"require": "./dist/tailwind/index.js",
|
|
18
|
+
"import": "./dist/tailwind/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
9
21
|
"files": [
|
|
10
22
|
"dist"
|
|
11
23
|
],
|
|
12
24
|
"scripts": {
|
|
13
25
|
"dev": "vite",
|
|
14
|
-
"build": "vite build",
|
|
26
|
+
"build": "vite build && npm run build:tailwind",
|
|
27
|
+
"build:tailwind": "mkdir -p dist/tailwind && cp src/tailwind/index.js dist/tailwind/index.js && cp src/tailwind/index.d.ts dist/tailwind/index.d.ts",
|
|
15
28
|
"lint": "eslint .",
|
|
16
29
|
"preview": "vite preview",
|
|
17
30
|
"test": "vitest --run",
|