@aurora-ds/theme 2.0.0 → 3.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/README.md +506 -546
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +277 -415
- package/dist/index.d.ts +277 -415
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/README.dev.md +0 -424
package/dist/index.d.cts
CHANGED
|
@@ -2,9 +2,138 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
export { CSSProperties } from 'react';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Default token values for theme creation - V3
|
|
7
|
+
* TypeScript infers the types automatically from the values using `as const`
|
|
8
|
+
* Note: No default colors/palette - colors must be defined by the user
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Default spacing scale
|
|
12
|
+
*/
|
|
13
|
+
declare const defaultSpacing: {
|
|
14
|
+
readonly none: "0";
|
|
15
|
+
readonly '2xs': "0.125rem";
|
|
16
|
+
readonly xs: "0.25rem";
|
|
17
|
+
readonly sm: "0.5rem";
|
|
18
|
+
readonly md: "1rem";
|
|
19
|
+
readonly lg: "1.5rem";
|
|
20
|
+
readonly xl: "2rem";
|
|
21
|
+
readonly '2xl': "3rem";
|
|
22
|
+
readonly '3xl': "4rem";
|
|
23
|
+
readonly '4xl': "6rem";
|
|
24
|
+
readonly '5xl': "8rem";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Default border radius scale
|
|
28
|
+
*/
|
|
29
|
+
declare const defaultRadius: {
|
|
30
|
+
readonly none: "0";
|
|
31
|
+
readonly xs: "0.125rem";
|
|
32
|
+
readonly sm: "0.25rem";
|
|
33
|
+
readonly md: "0.375rem";
|
|
34
|
+
readonly lg: "0.5rem";
|
|
35
|
+
readonly xl: "0.75rem";
|
|
36
|
+
readonly '2xl': "1rem";
|
|
37
|
+
readonly full: "9999px";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Default shadow scale
|
|
41
|
+
*/
|
|
42
|
+
declare const defaultShadows: {
|
|
43
|
+
readonly none: "none";
|
|
44
|
+
readonly xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)";
|
|
45
|
+
readonly sm: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)";
|
|
46
|
+
readonly md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)";
|
|
47
|
+
readonly lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)";
|
|
48
|
+
readonly xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)";
|
|
49
|
+
readonly '2xl': "0 25px 50px -12px rgb(0 0 0 / 0.25)";
|
|
50
|
+
readonly inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)";
|
|
51
|
+
readonly focus: "0 0 0 3px rgb(99 102 241 / 0.4)";
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Default font size scale
|
|
55
|
+
*/
|
|
56
|
+
declare const defaultFontSize: {
|
|
57
|
+
readonly '2xs': "0.625rem";
|
|
58
|
+
readonly xs: "0.75rem";
|
|
59
|
+
readonly sm: "0.875rem";
|
|
60
|
+
readonly md: "1rem";
|
|
61
|
+
readonly lg: "1.25rem";
|
|
62
|
+
readonly xl: "1.5rem";
|
|
63
|
+
readonly '2xl': "2rem";
|
|
64
|
+
readonly '3xl': "2.5rem";
|
|
65
|
+
readonly '4xl': "3rem";
|
|
66
|
+
readonly '5xl': "4rem";
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Default font weight scale
|
|
70
|
+
*/
|
|
71
|
+
declare const defaultFontWeight: {
|
|
72
|
+
readonly light: 300;
|
|
73
|
+
readonly regular: 400;
|
|
74
|
+
readonly medium: 500;
|
|
75
|
+
readonly semibold: 600;
|
|
76
|
+
readonly bold: 700;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Default line height scale
|
|
80
|
+
*/
|
|
81
|
+
declare const defaultLineHeight: {
|
|
82
|
+
readonly none: 1;
|
|
83
|
+
readonly tight: 1.25;
|
|
84
|
+
readonly normal: 1.5;
|
|
85
|
+
readonly relaxed: 1.75;
|
|
86
|
+
readonly loose: 2;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Default z-index scale
|
|
90
|
+
*/
|
|
91
|
+
declare const defaultZIndex: {
|
|
92
|
+
readonly behind: -1;
|
|
93
|
+
readonly base: 0;
|
|
94
|
+
readonly dropdown: 1000;
|
|
95
|
+
readonly sticky: 1100;
|
|
96
|
+
readonly overlay: 1300;
|
|
97
|
+
readonly modal: 1400;
|
|
98
|
+
readonly popover: 1500;
|
|
99
|
+
readonly tooltip: 1600;
|
|
100
|
+
readonly toast: 1700;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Default transition scale
|
|
104
|
+
*/
|
|
105
|
+
declare const defaultTransition: {
|
|
106
|
+
readonly fast: "150ms ease-out";
|
|
107
|
+
readonly normal: "250ms ease-out";
|
|
108
|
+
readonly slow: "350ms ease-out";
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Default opacity scale
|
|
112
|
+
*/
|
|
113
|
+
declare const defaultOpacity: {
|
|
114
|
+
readonly none: 0;
|
|
115
|
+
readonly lowest: 0.05;
|
|
116
|
+
readonly low: 0.1;
|
|
117
|
+
readonly medium: 0.25;
|
|
118
|
+
readonly high: 0.5;
|
|
119
|
+
readonly higher: 0.75;
|
|
120
|
+
readonly full: 1;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Default responsive breakpoints
|
|
124
|
+
*/
|
|
125
|
+
declare const defaultBreakpoints: {
|
|
126
|
+
readonly xs: "480px";
|
|
127
|
+
readonly sm: "640px";
|
|
128
|
+
readonly md: "768px";
|
|
129
|
+
readonly lg: "1024px";
|
|
130
|
+
readonly xl: "1280px";
|
|
131
|
+
readonly '2xl': "1536px";
|
|
132
|
+
};
|
|
133
|
+
|
|
5
134
|
/**
|
|
6
135
|
* Responsive breakpoints for mobile-first design
|
|
7
|
-
*
|
|
136
|
+
* Type inferred automatically from defaultBreakpoints values
|
|
8
137
|
*
|
|
9
138
|
* - xs: Extra small devices (phones in portrait)
|
|
10
139
|
* - sm: Small devices (phones in landscape, small tablets)
|
|
@@ -13,14 +142,7 @@ export { CSSProperties } from 'react';
|
|
|
13
142
|
* - xl: Extra large devices (large desktops)
|
|
14
143
|
* - 2xl: Extra extra large devices (wide screens)
|
|
15
144
|
*/
|
|
16
|
-
type BaseBreakpoints =
|
|
17
|
-
xs: string;
|
|
18
|
-
sm: string;
|
|
19
|
-
md: string;
|
|
20
|
-
lg: string;
|
|
21
|
-
xl: string;
|
|
22
|
-
'2xl': string;
|
|
23
|
-
};
|
|
145
|
+
type BaseBreakpoints = typeof defaultBreakpoints;
|
|
24
146
|
|
|
25
147
|
/**
|
|
26
148
|
* Base color tokens following modern design system semantics - V2
|
|
@@ -66,265 +188,98 @@ type BaseColors = {
|
|
|
66
188
|
|
|
67
189
|
/**
|
|
68
190
|
* Spacing scale with semantic naming
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
type BaseSpacing =
|
|
72
|
-
none: string;
|
|
73
|
-
'2xs': string;
|
|
74
|
-
xs: string;
|
|
75
|
-
sm: string;
|
|
76
|
-
md: string;
|
|
77
|
-
lg: string;
|
|
78
|
-
xl: string;
|
|
79
|
-
'2xl': string;
|
|
80
|
-
'3xl': string;
|
|
81
|
-
'4xl': string;
|
|
82
|
-
'5xl': string;
|
|
83
|
-
};
|
|
191
|
+
* Type inferred automatically from defaultSpacing values
|
|
192
|
+
*/
|
|
193
|
+
type BaseSpacing = typeof defaultSpacing;
|
|
84
194
|
|
|
85
195
|
/**
|
|
86
196
|
* Border radius scale
|
|
197
|
+
* Type inferred automatically from defaultRadius values
|
|
87
198
|
*/
|
|
88
|
-
type BaseRadius =
|
|
89
|
-
none: string;
|
|
90
|
-
xs: string;
|
|
91
|
-
sm: string;
|
|
92
|
-
md: string;
|
|
93
|
-
lg: string;
|
|
94
|
-
xl: string;
|
|
95
|
-
'2xl': string;
|
|
96
|
-
full: string;
|
|
97
|
-
};
|
|
199
|
+
type BaseRadius = typeof defaultRadius;
|
|
98
200
|
|
|
99
201
|
/**
|
|
100
202
|
* Shadow scale for elevation
|
|
203
|
+
* Type inferred automatically from defaultShadows values
|
|
101
204
|
*/
|
|
102
|
-
type BaseShadows =
|
|
103
|
-
none: string;
|
|
104
|
-
xs: string;
|
|
105
|
-
sm: string;
|
|
106
|
-
md: string;
|
|
107
|
-
lg: string;
|
|
108
|
-
xl: string;
|
|
109
|
-
'2xl': string;
|
|
110
|
-
inner: string;
|
|
111
|
-
focus: string;
|
|
112
|
-
};
|
|
205
|
+
type BaseShadows = typeof defaultShadows;
|
|
113
206
|
|
|
114
207
|
/**
|
|
115
208
|
* Font size scale
|
|
209
|
+
* Type inferred automatically from defaultFontSize values
|
|
116
210
|
*/
|
|
117
|
-
type BaseFontSize =
|
|
118
|
-
'2xs': string;
|
|
119
|
-
xs: string;
|
|
120
|
-
sm: string;
|
|
121
|
-
md: string;
|
|
122
|
-
lg: string;
|
|
123
|
-
xl: string;
|
|
124
|
-
'2xl': string;
|
|
125
|
-
'3xl': string;
|
|
126
|
-
'4xl': string;
|
|
127
|
-
'5xl': string;
|
|
128
|
-
};
|
|
211
|
+
type BaseFontSize = typeof defaultFontSize;
|
|
129
212
|
|
|
130
213
|
/**
|
|
131
214
|
* Font weight scale
|
|
215
|
+
* Type inferred automatically from defaultFontWeight values
|
|
132
216
|
*/
|
|
133
|
-
type BaseFontWeight =
|
|
134
|
-
light: number;
|
|
135
|
-
regular: number;
|
|
136
|
-
medium: number;
|
|
137
|
-
semibold: number;
|
|
138
|
-
bold: number;
|
|
139
|
-
};
|
|
217
|
+
type BaseFontWeight = typeof defaultFontWeight;
|
|
140
218
|
|
|
141
219
|
/**
|
|
142
220
|
* Line height scale
|
|
221
|
+
* Type inferred automatically from defaultLineHeight values
|
|
143
222
|
*/
|
|
144
|
-
type BaseLineHeight =
|
|
145
|
-
none: number;
|
|
146
|
-
tight: number;
|
|
147
|
-
normal: number;
|
|
148
|
-
relaxed: number;
|
|
149
|
-
loose: number;
|
|
150
|
-
};
|
|
223
|
+
type BaseLineHeight = typeof defaultLineHeight;
|
|
151
224
|
|
|
152
225
|
/**
|
|
153
226
|
* Z-index scale for layering
|
|
227
|
+
* Type inferred automatically from defaultZIndex values
|
|
154
228
|
*/
|
|
155
|
-
type BaseZIndex =
|
|
156
|
-
behind: number;
|
|
157
|
-
base: number;
|
|
158
|
-
dropdown: number;
|
|
159
|
-
sticky: number;
|
|
160
|
-
overlay: number;
|
|
161
|
-
modal: number;
|
|
162
|
-
popover: number;
|
|
163
|
-
tooltip: number;
|
|
164
|
-
toast: number;
|
|
165
|
-
};
|
|
229
|
+
type BaseZIndex = typeof defaultZIndex;
|
|
166
230
|
|
|
167
231
|
/**
|
|
168
232
|
* Transition timing scale
|
|
233
|
+
* Type inferred automatically from defaultTransition values
|
|
169
234
|
*/
|
|
170
|
-
type BaseTransition =
|
|
171
|
-
fast: string;
|
|
172
|
-
normal: string;
|
|
173
|
-
slow: string;
|
|
174
|
-
};
|
|
235
|
+
type BaseTransition = typeof defaultTransition;
|
|
175
236
|
|
|
176
237
|
/**
|
|
177
238
|
* Base opacity scale for consistent transparency
|
|
239
|
+
* Type inferred automatically from defaultOpacity values
|
|
178
240
|
*/
|
|
179
|
-
type BaseOpacity =
|
|
180
|
-
/** Fully transparent - 0 */
|
|
181
|
-
none: number;
|
|
182
|
-
/** Very low opacity - 0.05 */
|
|
183
|
-
lowest: number;
|
|
184
|
-
/** Low opacity - 0.1 */
|
|
185
|
-
low: number;
|
|
186
|
-
/** Medium-low opacity - 0.25 */
|
|
187
|
-
medium: number;
|
|
188
|
-
/** Medium-high opacity - 0.5 */
|
|
189
|
-
high: number;
|
|
190
|
-
/** High opacity - 0.75 */
|
|
191
|
-
higher: number;
|
|
192
|
-
/** Fully opaque - 1 */
|
|
193
|
-
full: number;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Standard theme type with all required tokens
|
|
198
|
-
*/
|
|
199
|
-
type Theme = {
|
|
200
|
-
colors: BaseColors;
|
|
201
|
-
spacing: BaseSpacing;
|
|
202
|
-
radius: BaseRadius;
|
|
203
|
-
shadows: BaseShadows;
|
|
204
|
-
fontSize: BaseFontSize;
|
|
205
|
-
fontWeight: BaseFontWeight;
|
|
206
|
-
lineHeight: BaseLineHeight;
|
|
207
|
-
zIndex: BaseZIndex;
|
|
208
|
-
transition: BaseTransition;
|
|
209
|
-
opacity: BaseOpacity;
|
|
210
|
-
breakpoints: BaseBreakpoints;
|
|
211
|
-
};
|
|
241
|
+
type BaseOpacity = typeof defaultOpacity;
|
|
212
242
|
|
|
213
243
|
/**
|
|
214
|
-
*
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
spacing: TSpacing;
|
|
219
|
-
radius: TRadius;
|
|
220
|
-
shadows: TShadows;
|
|
221
|
-
fontSize: TFontSize;
|
|
222
|
-
fontWeight: TFontWeight;
|
|
223
|
-
lineHeight: TLineHeight;
|
|
224
|
-
zIndex: TZIndex;
|
|
225
|
-
transition: TTransition;
|
|
226
|
-
} & TExtensions;
|
|
227
|
-
/**
|
|
228
|
-
* Helper type to create a custom theme with extensions
|
|
229
|
-
*/
|
|
230
|
-
type ExtendTheme<T extends Partial<Theme> & Record<string, unknown>> = Theme & T;
|
|
231
|
-
/**
|
|
232
|
-
* Utility type to deeply make all properties optional
|
|
233
|
-
*/
|
|
234
|
-
type DeepPartial<T> = {
|
|
235
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
* Type for theme overrides
|
|
239
|
-
*/
|
|
240
|
-
type ThemeOverride<T extends Theme = Theme> = DeepPartial<T>;
|
|
241
|
-
/**
|
|
242
|
-
* Base structure for custom themes with user-defined color tokens
|
|
243
|
-
* Use this when you want to completely replace the default color tokens
|
|
244
|
-
* with your own semantic tokens
|
|
245
|
-
*/
|
|
246
|
-
type CustomThemeBase<TColors extends Record<string, string>> = {
|
|
247
|
-
colors: TColors;
|
|
248
|
-
spacing: BaseSpacing;
|
|
249
|
-
radius: BaseRadius;
|
|
250
|
-
shadows: BaseShadows;
|
|
251
|
-
fontSize: BaseFontSize;
|
|
252
|
-
fontWeight: BaseFontWeight;
|
|
253
|
-
lineHeight: BaseLineHeight;
|
|
254
|
-
zIndex: BaseZIndex;
|
|
255
|
-
transition: BaseTransition;
|
|
256
|
-
opacity: BaseOpacity;
|
|
257
|
-
breakpoints: BaseBreakpoints;
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Fully customizable theme where ALL token categories can be replaced
|
|
244
|
+
* @deprecated Don't use Theme directly. Use `typeof yourTheme` instead.
|
|
245
|
+
*
|
|
246
|
+
* The Theme type has been removed in favor of type inference.
|
|
247
|
+
* This forces better type safety and prevents issues with custom themes.
|
|
261
248
|
*
|
|
262
249
|
* @example
|
|
263
250
|
* ```ts
|
|
264
|
-
* //
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* textPrimary: string
|
|
270
|
-
* textSecondary: string
|
|
271
|
-
* }
|
|
251
|
+
* // ✅ DO THIS - Infer type from your theme
|
|
252
|
+
* const myTheme = createTheme({
|
|
253
|
+
* colors: { brand: '#000', accent: '#fff' }
|
|
254
|
+
* })
|
|
255
|
+
* type MyTheme = typeof myTheme
|
|
272
256
|
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
257
|
+
* type Props = {
|
|
258
|
+
* color: keyof MyTheme['colors'] // Type-safe!
|
|
259
|
+
* }
|
|
275
260
|
*
|
|
276
|
-
* //
|
|
277
|
-
*
|
|
278
|
-
* colors: {
|
|
279
|
-
* brand: '#007bff',
|
|
280
|
-
* brandHover: '#0056b3',
|
|
281
|
-
* surface: '#ffffff',
|
|
282
|
-
* textPrimary: '#212529',
|
|
283
|
-
* textSecondary: '#6c757d',
|
|
284
|
-
* },
|
|
285
|
-
* // ... other tokens use defaults or custom
|
|
286
|
-
* })
|
|
261
|
+
* // ❌ DON'T DO THIS
|
|
262
|
+
* import type { Theme } from '@aurora-ds/theme' // Theme no longer exists!
|
|
287
263
|
* ```
|
|
288
264
|
*/
|
|
289
|
-
type
|
|
290
|
-
|
|
291
|
-
spacing: TSpacing;
|
|
292
|
-
radius: TRadius;
|
|
293
|
-
shadows: TShadows;
|
|
294
|
-
fontSize: TFontSize;
|
|
295
|
-
fontWeight: TFontWeight;
|
|
296
|
-
lineHeight: TLineHeight;
|
|
297
|
-
zIndex: TZIndex;
|
|
298
|
-
transition: TTransition;
|
|
299
|
-
opacity: TOpacity;
|
|
300
|
-
breakpoints: TBreakpoints;
|
|
301
|
-
};
|
|
302
|
-
/**
|
|
303
|
-
* Options for theme creation
|
|
304
|
-
*/
|
|
305
|
-
type CreateThemeOptions = {
|
|
306
|
-
/**
|
|
307
|
-
* How to handle the merge of overrides with the base theme
|
|
308
|
-
* - 'merge': Deep merge overrides into base (default, preserves base tokens)
|
|
309
|
-
* - 'replace': Replace entire categories when specified in overrides
|
|
310
|
-
*/
|
|
311
|
-
mode?: 'merge' | 'replace';
|
|
312
|
-
};
|
|
265
|
+
type Theme = never;
|
|
266
|
+
|
|
313
267
|
/**
|
|
314
|
-
*
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
268
|
+
* Minimum structure for a theme
|
|
269
|
+
* Allows any extensions while preserving type safety
|
|
270
|
+
*/
|
|
271
|
+
type ThemeStructure = {
|
|
272
|
+
colors: Record<string, string>;
|
|
273
|
+
spacing: Record<string, string>;
|
|
274
|
+
radius: Record<string, string>;
|
|
275
|
+
shadows: Record<string, string>;
|
|
276
|
+
fontSize: Record<string, string>;
|
|
277
|
+
fontWeight: Record<string, number>;
|
|
278
|
+
lineHeight: Record<string, number>;
|
|
279
|
+
zIndex: Record<string, number>;
|
|
280
|
+
transition: Record<string, string>;
|
|
281
|
+
opacity: Record<string, number>;
|
|
282
|
+
breakpoints: Record<string, string>;
|
|
328
283
|
};
|
|
329
284
|
|
|
330
285
|
/**
|
|
@@ -345,218 +300,132 @@ type ColorScale = {
|
|
|
345
300
|
950: string;
|
|
346
301
|
};
|
|
347
302
|
|
|
348
|
-
/**
|
|
349
|
-
* Available color scale names
|
|
350
|
-
*/
|
|
351
|
-
type ColorName = 'gray' | 'slate' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose';
|
|
352
|
-
|
|
353
303
|
/**
|
|
354
304
|
* Available shade values (keys of ColorScale)
|
|
355
305
|
*/
|
|
356
306
|
type ColorShade = keyof ColorScale;
|
|
357
307
|
|
|
358
|
-
type ThemeProviderProps<
|
|
359
|
-
theme:
|
|
308
|
+
type ThemeProviderProps<TTheme extends ThemeStructure = ThemeStructure> = {
|
|
309
|
+
theme: TTheme;
|
|
360
310
|
children?: ReactNode;
|
|
361
311
|
};
|
|
362
312
|
/**
|
|
363
313
|
* Theme provider component
|
|
364
314
|
* Provides theme context to all child components
|
|
315
|
+
* Accepts any theme structure created with createTheme()
|
|
365
316
|
*
|
|
366
317
|
* @example
|
|
367
318
|
* ```tsx
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* </ThemeProvider>
|
|
319
|
+
* const myTheme = createTheme({
|
|
320
|
+
* colors: { primary: '#007bff', background: '#fff' }
|
|
321
|
+
* })
|
|
372
322
|
*
|
|
373
|
-
*
|
|
374
|
-
* <ThemeProvider theme={myCustomTheme}>
|
|
323
|
+
* <ThemeProvider theme={myTheme}>
|
|
375
324
|
* <App />
|
|
376
325
|
* </ThemeProvider>
|
|
377
326
|
* ```
|
|
378
327
|
*/
|
|
379
|
-
declare const ThemeProvider: <
|
|
328
|
+
declare const ThemeProvider: <TTheme extends ThemeStructure>({ theme, children }: ThemeProviderProps<TTheme>) => react_jsx_runtime.JSX.Element;
|
|
380
329
|
/**
|
|
381
330
|
* Hook to access the current theme
|
|
382
|
-
*
|
|
331
|
+
* Returns the theme provided by ThemeProvider with exact inferred types
|
|
383
332
|
*
|
|
384
333
|
* @example
|
|
385
334
|
* ```tsx
|
|
386
|
-
*
|
|
387
|
-
* const theme = useTheme()
|
|
335
|
+
* const myTheme = createTheme({ colors: { brand: '#000' } })
|
|
388
336
|
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
337
|
+
* function MyComponent() {
|
|
338
|
+
* const theme = useTheme() // theme.colors.brand is accessible!
|
|
339
|
+
* }
|
|
391
340
|
* ```
|
|
392
341
|
*
|
|
393
342
|
* @throws {Error} If used outside a ThemeProvider
|
|
394
343
|
*/
|
|
395
|
-
declare const useTheme: <
|
|
344
|
+
declare const useTheme: <TTheme extends ThemeStructure = ThemeStructure>() => TTheme;
|
|
396
345
|
|
|
397
346
|
/**
|
|
398
|
-
* Default
|
|
399
|
-
|
|
400
|
-
declare const defaultSpacing: Theme['spacing'];
|
|
401
|
-
/**
|
|
402
|
-
* Default border radius scale
|
|
403
|
-
*/
|
|
404
|
-
declare const defaultRadius: Theme['radius'];
|
|
405
|
-
/**
|
|
406
|
-
* Default shadow scale
|
|
407
|
-
*/
|
|
408
|
-
declare const defaultShadows: Theme['shadows'];
|
|
409
|
-
/**
|
|
410
|
-
* Default font size scale
|
|
411
|
-
*/
|
|
412
|
-
declare const defaultFontSize: Theme['fontSize'];
|
|
413
|
-
/**
|
|
414
|
-
* Default font weight scale
|
|
415
|
-
*/
|
|
416
|
-
declare const defaultFontWeight: Theme['fontWeight'];
|
|
417
|
-
/**
|
|
418
|
-
* Default line height scale
|
|
419
|
-
*/
|
|
420
|
-
declare const defaultLineHeight: Theme['lineHeight'];
|
|
421
|
-
/**
|
|
422
|
-
* Default z-index scale
|
|
423
|
-
*/
|
|
424
|
-
declare const defaultZIndex: Theme['zIndex'];
|
|
425
|
-
/**
|
|
426
|
-
* Default transition scale
|
|
427
|
-
*/
|
|
428
|
-
declare const defaultTransition: Theme['transition'];
|
|
429
|
-
/**
|
|
430
|
-
* Default opacity scale
|
|
431
|
-
*/
|
|
432
|
-
declare const defaultOpacity: Theme['opacity'];
|
|
433
|
-
/**
|
|
434
|
-
* Default responsive breakpoints
|
|
435
|
-
*/
|
|
436
|
-
declare const defaultBreakpoints: Theme['breakpoints'];
|
|
437
|
-
/**
|
|
438
|
-
* Complete default theme V2
|
|
439
|
-
*/
|
|
440
|
-
declare const defaultTheme: Theme;
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Create a theme by merging a base theme with overrides
|
|
347
|
+
* Default palette - V3
|
|
348
|
+
* A clean, modern palette using Indigo as primary and Slate as neutral
|
|
444
349
|
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
* @param options - Optional configuration
|
|
448
|
-
* @param options.mode - 'merge' (default) deep merges, 'replace' replaces entire categories
|
|
350
|
+
* This palette is optional and serves as a reference/starting point.
|
|
351
|
+
* You can use it directly, customize it, or create your own from scratch.
|
|
449
352
|
*
|
|
450
353
|
* @example
|
|
451
354
|
* ```ts
|
|
452
|
-
* //
|
|
453
|
-
* const
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
355
|
+
* // Use as-is
|
|
356
|
+
* const theme = createTheme({ colors: defaultPalette })
|
|
357
|
+
*
|
|
358
|
+
* // Customize specific colors
|
|
359
|
+
* const theme = createTheme({
|
|
360
|
+
* colors: {
|
|
361
|
+
* ...defaultPalette,
|
|
362
|
+
* primary: '#custom-color',
|
|
363
|
+
* }
|
|
458
364
|
* })
|
|
459
365
|
*
|
|
460
|
-
* //
|
|
461
|
-
* const
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
* brand: '#ff0000',
|
|
465
|
-
* surface: '#ffffff',
|
|
466
|
-
* text: '#000000',
|
|
467
|
-
* },
|
|
468
|
-
* }, { mode: 'replace' })
|
|
366
|
+
* // Or create your own from scratch
|
|
367
|
+
* const theme = createTheme({
|
|
368
|
+
* colors: { primary: '#...', background: '#...' }
|
|
369
|
+
* })
|
|
469
370
|
* ```
|
|
470
371
|
*/
|
|
471
|
-
declare const
|
|
372
|
+
declare const defaultPalette: BaseColors;
|
|
373
|
+
|
|
472
374
|
/**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
375
|
+
* Create a theme with custom color tokens - V3
|
|
376
|
+
* Colors are optional - if not provided, defaultPalette is used
|
|
377
|
+
* All other tokens use defaults and can be optionally overridden
|
|
475
378
|
*
|
|
476
|
-
* @
|
|
477
|
-
* ```ts
|
|
478
|
-
* const theme = mergeThemes(
|
|
479
|
-
* baseTheme,
|
|
480
|
-
* brandOverrides,
|
|
481
|
-
* darkModeOverrides,
|
|
482
|
-
* userPreferences
|
|
483
|
-
* )
|
|
484
|
-
* ```
|
|
485
|
-
*/
|
|
486
|
-
declare const mergeThemes: <T extends Theme>(baseTheme: T, ...overrides: DeepPartial<T>[]) => T;
|
|
487
|
-
/**
|
|
488
|
-
* Create a theme extension factory
|
|
489
|
-
* Useful for creating theme variants (dark mode, high contrast, etc.)
|
|
379
|
+
* @param config - Theme configuration (all optional)
|
|
490
380
|
*
|
|
491
381
|
* @example
|
|
492
382
|
* ```ts
|
|
493
|
-
*
|
|
383
|
+
* // Use defaultPalette (quickest way to start)
|
|
384
|
+
* const theme = createTheme()
|
|
385
|
+
*
|
|
386
|
+
* // Customize defaultPalette
|
|
387
|
+
* const theme = createTheme({
|
|
494
388
|
* colors: {
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
* }
|
|
389
|
+
* ...defaultPalette,
|
|
390
|
+
* primary: '#custom'
|
|
391
|
+
* }
|
|
498
392
|
* })
|
|
499
393
|
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*/
|
|
503
|
-
declare const createThemeVariant: <T extends Theme>(variantOverrides: DeepPartial<T>) => (baseTheme: T) => T;
|
|
504
|
-
/**
|
|
505
|
-
* Create a fully custom theme with your own color tokens
|
|
506
|
-
* This allows you to define a completely different color token structure
|
|
507
|
-
* without being constrained by BaseColors
|
|
508
|
-
*
|
|
509
|
-
* @param config - Full theme configuration with custom colors
|
|
510
|
-
*
|
|
511
|
-
* @example
|
|
512
|
-
* ```ts
|
|
513
|
-
* // Define your custom color tokens
|
|
514
|
-
* type MyBrandColors = {
|
|
515
|
-
* brand: string
|
|
516
|
-
* brandHover: string
|
|
517
|
-
* brandActive: string
|
|
518
|
-
* surface: string
|
|
519
|
-
* surfaceElevated: string
|
|
520
|
-
* textPrimary: string
|
|
521
|
-
* textSecondary: string
|
|
522
|
-
* border: string
|
|
523
|
-
* }
|
|
524
|
-
*
|
|
525
|
-
* // Create a theme with ONLY your color tokens
|
|
526
|
-
* const myTheme = createCustomTheme<MyBrandColors>({
|
|
394
|
+
* // Or create your own colors from scratch
|
|
395
|
+
* const theme = createTheme({
|
|
527
396
|
* colors: {
|
|
528
397
|
* brand: '#007bff',
|
|
529
|
-
* brandHover: '#0056b3',
|
|
530
|
-
* brandActive: '#004085',
|
|
531
398
|
* surface: '#ffffff',
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
* textSecondary: '#6c757d',
|
|
535
|
-
* border: '#dee2e6',
|
|
536
|
-
* },
|
|
537
|
-
* // Uses defaults for other tokens, or provide your own:
|
|
538
|
-
* // spacing: { ... },
|
|
539
|
-
* // radius: { ... },
|
|
399
|
+
* text: '#212529',
|
|
400
|
+
* }
|
|
540
401
|
* })
|
|
541
|
-
*
|
|
542
|
-
* // TypeScript knows your theme has only YOUR color tokens:
|
|
543
|
-
* myTheme.colors.brand // ✅ OK
|
|
544
|
-
* myTheme.colors.primary // ❌ Error - doesn't exist
|
|
545
402
|
* ```
|
|
546
403
|
*/
|
|
547
|
-
declare const
|
|
548
|
-
colors
|
|
549
|
-
spacing?:
|
|
550
|
-
radius?:
|
|
551
|
-
shadows?:
|
|
552
|
-
fontSize?:
|
|
553
|
-
fontWeight?:
|
|
554
|
-
lineHeight?:
|
|
555
|
-
zIndex?:
|
|
556
|
-
transition?:
|
|
557
|
-
opacity?:
|
|
558
|
-
breakpoints?:
|
|
559
|
-
}
|
|
404
|
+
declare const createTheme: <const TConfig extends {
|
|
405
|
+
colors?: Record<string, string>;
|
|
406
|
+
spacing?: Record<string, string>;
|
|
407
|
+
radius?: Record<string, string>;
|
|
408
|
+
shadows?: Record<string, string>;
|
|
409
|
+
fontSize?: Record<string, string>;
|
|
410
|
+
fontWeight?: Record<string, number>;
|
|
411
|
+
lineHeight?: Record<string, number>;
|
|
412
|
+
zIndex?: Record<string, number>;
|
|
413
|
+
transition?: Record<string, string>;
|
|
414
|
+
opacity?: Record<string, number>;
|
|
415
|
+
breakpoints?: Record<string, string>;
|
|
416
|
+
} = object>(config?: TConfig) => {
|
|
417
|
+
readonly colors: TConfig["colors"] extends Record<string, string> ? TConfig["colors"] : typeof defaultPalette;
|
|
418
|
+
readonly spacing: TConfig["spacing"] extends Record<string, string> ? TConfig["spacing"] : typeof defaultSpacing;
|
|
419
|
+
readonly radius: TConfig["radius"] extends Record<string, string> ? TConfig["radius"] : typeof defaultRadius;
|
|
420
|
+
readonly shadows: TConfig["shadows"] extends Record<string, string> ? TConfig["shadows"] : typeof defaultShadows;
|
|
421
|
+
readonly fontSize: TConfig["fontSize"] extends Record<string, string> ? TConfig["fontSize"] : typeof defaultFontSize;
|
|
422
|
+
readonly fontWeight: TConfig["fontWeight"] extends Record<string, number> ? TConfig["fontWeight"] : typeof defaultFontWeight;
|
|
423
|
+
readonly lineHeight: TConfig["lineHeight"] extends Record<string, number> ? TConfig["lineHeight"] : typeof defaultLineHeight;
|
|
424
|
+
readonly zIndex: TConfig["zIndex"] extends Record<string, number> ? TConfig["zIndex"] : typeof defaultZIndex;
|
|
425
|
+
readonly transition: TConfig["transition"] extends Record<string, string> ? TConfig["transition"] : typeof defaultTransition;
|
|
426
|
+
readonly opacity: TConfig["opacity"] extends Record<string, number> ? TConfig["opacity"] : typeof defaultOpacity;
|
|
427
|
+
readonly breakpoints: TConfig["breakpoints"] extends Record<string, string> ? TConfig["breakpoints"] : typeof defaultBreakpoints;
|
|
428
|
+
};
|
|
560
429
|
|
|
561
430
|
/**
|
|
562
431
|
* Color Scales - Modern color palettes with shades from 25 to 950
|
|
@@ -589,7 +458,6 @@ declare const colors: {
|
|
|
589
458
|
readonly emerald: ColorScale;
|
|
590
459
|
readonly teal: ColorScale;
|
|
591
460
|
readonly cyan: ColorScale;
|
|
592
|
-
readonly sky: ColorScale;
|
|
593
461
|
readonly blue: ColorScale;
|
|
594
462
|
readonly indigo: ColorScale;
|
|
595
463
|
readonly violet: ColorScale;
|
|
@@ -603,12 +471,6 @@ declare const colors: {
|
|
|
603
471
|
readonly current: "currentColor";
|
|
604
472
|
};
|
|
605
473
|
|
|
606
|
-
/**
|
|
607
|
-
* Default light theme palette - V2
|
|
608
|
-
* A clean, modern palette using Indigo as primary and Slate as neutral
|
|
609
|
-
*/
|
|
610
|
-
declare const defaultPalette: BaseColors;
|
|
611
|
-
|
|
612
474
|
/**
|
|
613
475
|
* Extended type to support pseudo-classes, media queries, container queries, supports and complex selectors
|
|
614
476
|
*/
|
|
@@ -644,56 +506,56 @@ type FontFaceOptions = {
|
|
|
644
506
|
/**
|
|
645
507
|
* Create typed styles with support for pseudo-classes, media queries, container queries, feature queries and complex selectors
|
|
646
508
|
*
|
|
647
|
-
* Supports custom
|
|
509
|
+
* Supports custom themes via generic parameter.
|
|
648
510
|
*
|
|
649
511
|
* @example
|
|
650
512
|
* ```ts
|
|
651
|
-
* // Basic usage
|
|
513
|
+
* // Basic usage
|
|
652
514
|
* const STYLES = createStyles((theme) => ({
|
|
653
515
|
* root: {
|
|
654
516
|
* display: 'flex',
|
|
655
517
|
* padding: theme.spacing.md,
|
|
656
|
-
* ':hover': { backgroundColor: theme.colors.
|
|
518
|
+
* ':hover': { backgroundColor: theme.colors.primary },
|
|
657
519
|
* }
|
|
658
520
|
* }))
|
|
659
521
|
*
|
|
660
|
-
* // With
|
|
661
|
-
*
|
|
522
|
+
* // With explicit theme type
|
|
523
|
+
* const myTheme = createTheme({ colors: { brand: '#007bff' } })
|
|
662
524
|
*
|
|
663
|
-
* const STYLES = createStyles
|
|
525
|
+
* const STYLES = createStyles((theme) => ({
|
|
664
526
|
* root: {
|
|
665
|
-
* backgroundColor: theme.colors.
|
|
527
|
+
* backgroundColor: theme.colors.primary, // TypeScript knows the structure!
|
|
666
528
|
* }
|
|
667
529
|
* }))
|
|
668
530
|
* ```
|
|
669
531
|
*/
|
|
670
|
-
declare const createStyles: <
|
|
532
|
+
declare const createStyles: <T extends Record<string, StyleWithPseudos | StyleFunction> = Record<string, StyleWithPseudos | StyleFunction>>(stylesOrCreator: T | ((theme: ThemeStructure) => T)) => { [K in keyof T]: T[K] extends (...args: infer TArgs) => StyleWithPseudos ? (...args: TArgs) => string : string; };
|
|
671
533
|
/**
|
|
672
534
|
* Create a typed createStyles function pre-configured with your custom theme type.
|
|
673
535
|
* This eliminates the need to specify the theme type on every createStyles call.
|
|
674
536
|
*
|
|
675
537
|
* @example
|
|
676
538
|
* ```ts
|
|
677
|
-
* // 1. Define your
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
539
|
+
* // 1. Define your theme
|
|
540
|
+
* const myTheme = createTheme({
|
|
541
|
+
* colors: {
|
|
542
|
+
* brand: '#007bff',
|
|
543
|
+
* surface: '#ffffff',
|
|
544
|
+
* }
|
|
545
|
+
* })
|
|
683
546
|
*
|
|
684
547
|
* // 2. Create a pre-typed createStyles function (do this once)
|
|
685
|
-
* export const createStyles = createTypedStyles<
|
|
548
|
+
* export const createStyles = createTypedStyles<typeof myTheme>()
|
|
686
549
|
*
|
|
687
550
|
* // 3. Use it everywhere without specifying the type!
|
|
688
551
|
* const STYLES = createStyles((theme) => ({
|
|
689
552
|
* button: {
|
|
690
|
-
* backgroundColor: theme.colors.
|
|
691
|
-
* // backgroundColor: theme.colors.primary, // ❌ Error - doesn't exist
|
|
553
|
+
* backgroundColor: theme.colors.primary, // ✅ TypeScript knows!
|
|
692
554
|
* },
|
|
693
555
|
* }))
|
|
694
556
|
* ```
|
|
695
557
|
*/
|
|
696
|
-
declare const createTypedStyles: <TTheme extends
|
|
558
|
+
declare const createTypedStyles: <TTheme extends ThemeStructure = ThemeStructure>() => <T extends Record<string, StyleWithPseudos | StyleFunction>>(stylesOrCreator: T | ((theme: TTheme) => T)) => { [K in keyof T]: T[K] extends (...args: infer TArgs) => StyleWithPseudos ? (...args: TArgs) => string : string; };
|
|
697
559
|
|
|
698
560
|
/**
|
|
699
561
|
* Create and inject keyframes
|
|
@@ -739,7 +601,7 @@ declare const fontFace: (options: FontFaceOptions) => string;
|
|
|
739
601
|
* // Generates: :root { --aurora-colors-primary: #2563EB; ... }
|
|
740
602
|
* ```
|
|
741
603
|
*/
|
|
742
|
-
declare const injectCssVariables: (theme:
|
|
604
|
+
declare const injectCssVariables: (theme: ThemeStructure, prefix?: string) => void;
|
|
743
605
|
/**
|
|
744
606
|
* Helper to use a CSS variable from the theme
|
|
745
607
|
*
|
|
@@ -794,11 +656,11 @@ declare const getSSRRulesArray: () => string[];
|
|
|
794
656
|
/**
|
|
795
657
|
* Set the theme getter
|
|
796
658
|
*/
|
|
797
|
-
declare const setThemeContextGetter: (getter: (() =>
|
|
659
|
+
declare const setThemeContextGetter: (getter: (() => ThemeStructure | undefined) | null) => (() => ThemeStructure | undefined) | null;
|
|
798
660
|
/**
|
|
799
661
|
* Get the current theme
|
|
800
662
|
*/
|
|
801
|
-
declare const getTheme: () =>
|
|
663
|
+
declare const getTheme: () => ThemeStructure | undefined;
|
|
802
664
|
/**
|
|
803
665
|
* Insert a CSS rule
|
|
804
666
|
*/
|
|
@@ -809,4 +671,4 @@ declare const insertRule: (rule: string) => void;
|
|
|
809
671
|
*/
|
|
810
672
|
declare const sanitizeCssValue: (value: string) => string;
|
|
811
673
|
|
|
812
|
-
export { type BaseBreakpoints, type BaseColors, type BaseFontSize, type BaseFontWeight, type BaseLineHeight, type BaseOpacity, type BaseRadius, type BaseShadows, type BaseSpacing, type BaseTransition, type BaseZIndex, type
|
|
674
|
+
export { type BaseBreakpoints, type BaseColors, type BaseFontSize, type BaseFontWeight, type BaseLineHeight, type BaseOpacity, type BaseRadius, type BaseShadows, type BaseSpacing, type BaseTransition, type BaseZIndex, type ColorScale, type ColorShade, type FontFaceOptions, type StyleFunction, type StyleWithPseudos, type Theme, ThemeProvider, type ThemeProviderProps, clearSSRRules, colors, createStyles, createTheme, createTypedStyles, cssVar, cssVariables, defaultBreakpoints, defaultFontSize, defaultFontWeight, defaultLineHeight, defaultOpacity, defaultPalette, defaultRadius, defaultShadows, defaultSpacing, defaultTransition, defaultZIndex, fontFace, getSSRRulesArray, getSSRStyleTag, getSSRStyles, getTheme, injectCssVariables, insertRule, keyframes, sanitizeCssValue, setThemeContextGetter, useTheme };
|