@aurora-ds/theme 1.5.0 → 2.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.dev.md +84 -2
- package/README.md +382 -90
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +262 -464
- package/dist/index.d.ts +262 -464
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23,69 +23,45 @@ type BaseBreakpoints = {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Base color tokens following modern design system semantics
|
|
26
|
+
* Base color tokens following modern design system semantics - V2
|
|
27
27
|
*/
|
|
28
28
|
type BaseColors = {
|
|
29
|
+
background: string;
|
|
30
|
+
surface: string;
|
|
31
|
+
surfaceHover: string;
|
|
32
|
+
surfaceActive: string;
|
|
33
|
+
text: string;
|
|
34
|
+
textSecondary: string;
|
|
35
|
+
textTertiary: string;
|
|
29
36
|
primary: string;
|
|
30
|
-
onPrimary: string;
|
|
31
37
|
primaryHover: string;
|
|
32
38
|
primaryActive: string;
|
|
33
39
|
primarySubtle: string;
|
|
34
40
|
primaryDisabled: string;
|
|
41
|
+
onPrimary: string;
|
|
35
42
|
secondary: string;
|
|
36
|
-
onSecondary: string;
|
|
37
43
|
secondaryHover: string;
|
|
38
44
|
secondaryActive: string;
|
|
39
45
|
secondarySubtle: string;
|
|
40
46
|
secondaryDisabled: string;
|
|
41
|
-
|
|
42
|
-
onAccent: string;
|
|
43
|
-
accentHover: string;
|
|
44
|
-
accentActive: string;
|
|
45
|
-
accentSubtle: string;
|
|
46
|
-
tertiary: string;
|
|
47
|
-
onTertiary: string;
|
|
48
|
-
tertiaryHover: string;
|
|
49
|
-
tertiaryActive: string;
|
|
50
|
-
tertiarySubtle: string;
|
|
51
|
-
tertiaryDisabled: string;
|
|
52
|
-
background: string;
|
|
53
|
-
surface: string;
|
|
54
|
-
surfaceHover: string;
|
|
55
|
-
surfaceActive: string;
|
|
56
|
-
elevated: string;
|
|
57
|
-
overlay: string;
|
|
58
|
-
text: string;
|
|
59
|
-
textSecondary: string;
|
|
60
|
-
textTertiary: string;
|
|
61
|
-
textInverse: string;
|
|
47
|
+
onSecondary: string;
|
|
62
48
|
border: string;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
borderSubtle: string;
|
|
49
|
+
disabled: string;
|
|
50
|
+
disabledText: string;
|
|
66
51
|
success: string;
|
|
67
|
-
onSuccess: string;
|
|
68
|
-
successHover: string;
|
|
69
52
|
successSubtle: string;
|
|
70
53
|
warning: string;
|
|
71
|
-
onWarning: string;
|
|
72
|
-
warningHover: string;
|
|
73
54
|
warningSubtle: string;
|
|
74
55
|
error: string;
|
|
75
|
-
onError: string;
|
|
76
56
|
errorHover: string;
|
|
77
57
|
errorSubtle: string;
|
|
58
|
+
onError: string;
|
|
78
59
|
info: string;
|
|
79
|
-
onInfo: string;
|
|
80
|
-
infoHover: string;
|
|
81
60
|
infoSubtle: string;
|
|
82
61
|
link: string;
|
|
83
62
|
linkHover: string;
|
|
84
63
|
linkActive: string;
|
|
85
|
-
|
|
86
|
-
focus: string;
|
|
87
|
-
disabled: string;
|
|
88
|
-
disabledText: string;
|
|
64
|
+
linkDisabled: string;
|
|
89
65
|
};
|
|
90
66
|
|
|
91
67
|
/**
|
|
@@ -262,6 +238,94 @@ type DeepPartial<T> = {
|
|
|
262
238
|
* Type for theme overrides
|
|
263
239
|
*/
|
|
264
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
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
264
|
+
* // Define your own color tokens
|
|
265
|
+
* type MyColors = {
|
|
266
|
+
* brand: string
|
|
267
|
+
* brandHover: string
|
|
268
|
+
* surface: string
|
|
269
|
+
* textPrimary: string
|
|
270
|
+
* textSecondary: string
|
|
271
|
+
* }
|
|
272
|
+
*
|
|
273
|
+
* // Create your theme type
|
|
274
|
+
* type MyTheme = CustomTheme<MyColors>
|
|
275
|
+
*
|
|
276
|
+
* // Use with createCustomTheme()
|
|
277
|
+
* const myTheme = createCustomTheme<MyColors>({
|
|
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
|
+
* })
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
type CustomTheme<TColors extends Record<string, string> = Record<string, string>, TSpacing extends Record<string, string> = BaseSpacing, TRadius extends Record<string, string> = BaseRadius, TShadows extends Record<string, string> = BaseShadows, TFontSize extends Record<string, string> = BaseFontSize, TFontWeight extends Record<string, number> = BaseFontWeight, TLineHeight extends Record<string, number> = BaseLineHeight, TZIndex extends Record<string, number> = BaseZIndex, TTransition extends Record<string, string> = BaseTransition, TOpacity extends Record<string, number> = BaseOpacity, TBreakpoints extends Record<string, string> = BaseBreakpoints> = {
|
|
290
|
+
colors: TColors;
|
|
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
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Options for custom theme creation
|
|
315
|
+
*/
|
|
316
|
+
type CreateCustomThemeOptions<T> = {
|
|
317
|
+
/**
|
|
318
|
+
* Use defaults from the standard theme for non-color tokens
|
|
319
|
+
* If false, you must provide all tokens
|
|
320
|
+
* @default true
|
|
321
|
+
*/
|
|
322
|
+
useDefaults?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Partial overrides for non-color tokens
|
|
325
|
+
* Only used when useDefaults is true
|
|
326
|
+
*/
|
|
327
|
+
overrides?: Partial<Omit<T, 'colors'>>;
|
|
328
|
+
};
|
|
265
329
|
|
|
266
330
|
/**
|
|
267
331
|
* Color scale type - 12 shades from 25 to 950
|
|
@@ -291,11 +355,6 @@ type ColorName = 'gray' | 'slate' | 'stone' | 'red' | 'orange' | 'amber' | 'yell
|
|
|
291
355
|
*/
|
|
292
356
|
type ColorShade = keyof ColorScale;
|
|
293
357
|
|
|
294
|
-
/**
|
|
295
|
-
* Available palette preset names
|
|
296
|
-
*/
|
|
297
|
-
type PaletteName = 'indigo' | 'blue' | 'rose' | 'emerald' | 'teal' | 'violet' | 'amber' | 'cyan' | 'slate' | 'gray';
|
|
298
|
-
|
|
299
358
|
type ThemeProviderProps<T extends Theme = Theme> = {
|
|
300
359
|
theme: T;
|
|
301
360
|
children?: ReactNode;
|
|
@@ -335,56 +394,6 @@ declare const ThemeProvider: <T extends Theme>({ theme, children }: ThemeProvide
|
|
|
335
394
|
*/
|
|
336
395
|
declare const useTheme: <T extends Theme = Theme>() => T;
|
|
337
396
|
|
|
338
|
-
/**
|
|
339
|
-
* Create a theme by merging a base theme with overrides
|
|
340
|
-
*
|
|
341
|
-
* @example
|
|
342
|
-
* ```ts
|
|
343
|
-
* const myTheme = createTheme(defaultTheme, {
|
|
344
|
-
* colors: {
|
|
345
|
-
* primary: '#ff0000',
|
|
346
|
-
* // Only override what you need
|
|
347
|
-
* },
|
|
348
|
-
* spacing: {
|
|
349
|
-
* md: '1.5rem',
|
|
350
|
-
* },
|
|
351
|
-
* })
|
|
352
|
-
* ```
|
|
353
|
-
*/
|
|
354
|
-
declare const createTheme: <T extends Theme>(baseTheme: T, overrides: DeepPartial<T>) => T;
|
|
355
|
-
/**
|
|
356
|
-
* Merge multiple theme overrides into one
|
|
357
|
-
* Later overrides take precedence
|
|
358
|
-
*
|
|
359
|
-
* @example
|
|
360
|
-
* ```ts
|
|
361
|
-
* const theme = mergeThemes(
|
|
362
|
-
* baseTheme,
|
|
363
|
-
* brandOverrides,
|
|
364
|
-
* darkModeOverrides,
|
|
365
|
-
* userPreferences
|
|
366
|
-
* )
|
|
367
|
-
* ```
|
|
368
|
-
*/
|
|
369
|
-
declare const mergeThemes: <T extends Theme>(baseTheme: T, ...overrides: DeepPartial<T>[]) => T;
|
|
370
|
-
/**
|
|
371
|
-
* Create a theme extension factory
|
|
372
|
-
* Useful for creating theme variants (dark mode, high contrast, etc.)
|
|
373
|
-
*
|
|
374
|
-
* @example
|
|
375
|
-
* ```ts
|
|
376
|
-
* const createDarkVariant = createThemeVariant({
|
|
377
|
-
* colors: {
|
|
378
|
-
* background: '#1a1a1a',
|
|
379
|
-
* text: '#ffffff',
|
|
380
|
-
* },
|
|
381
|
-
* })
|
|
382
|
-
*
|
|
383
|
-
* const darkTheme = createDarkVariant(lightTheme)
|
|
384
|
-
* ```
|
|
385
|
-
*/
|
|
386
|
-
declare const createThemeVariant: <T extends Theme>(variantOverrides: DeepPartial<T>) => (baseTheme: T) => T;
|
|
387
|
-
|
|
388
397
|
/**
|
|
389
398
|
* Default spacing scale
|
|
390
399
|
*/
|
|
@@ -426,68 +435,146 @@ declare const defaultOpacity: Theme['opacity'];
|
|
|
426
435
|
*/
|
|
427
436
|
declare const defaultBreakpoints: Theme['breakpoints'];
|
|
428
437
|
/**
|
|
429
|
-
*
|
|
438
|
+
* Complete default theme V2
|
|
430
439
|
*/
|
|
431
|
-
declare const
|
|
440
|
+
declare const defaultTheme: Theme;
|
|
441
|
+
|
|
432
442
|
/**
|
|
433
|
-
*
|
|
443
|
+
* Create a theme by merging a base theme with overrides
|
|
444
|
+
*
|
|
445
|
+
* @param baseTheme - The base theme to extend
|
|
446
|
+
* @param overrides - Partial overrides to apply
|
|
447
|
+
* @param options - Optional configuration
|
|
448
|
+
* @param options.mode - 'merge' (default) deep merges, 'replace' replaces entire categories
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
* ```ts
|
|
452
|
+
* // Default behavior: deep merge (extends existing tokens)
|
|
453
|
+
* const myTheme = createTheme(defaultTheme, {
|
|
454
|
+
* colors: {
|
|
455
|
+
* primary: '#ff0000',
|
|
456
|
+
* // Other color tokens from defaultTheme are preserved
|
|
457
|
+
* },
|
|
458
|
+
* })
|
|
459
|
+
*
|
|
460
|
+
* // Replace mode: completely replace categories
|
|
461
|
+
* const myTheme = createTheme(defaultTheme, {
|
|
462
|
+
* colors: {
|
|
463
|
+
* // This becomes the ENTIRE colors object
|
|
464
|
+
* brand: '#ff0000',
|
|
465
|
+
* surface: '#ffffff',
|
|
466
|
+
* text: '#000000',
|
|
467
|
+
* },
|
|
468
|
+
* }, { mode: 'replace' })
|
|
469
|
+
* ```
|
|
434
470
|
*/
|
|
435
|
-
declare const
|
|
471
|
+
declare const createTheme: <T extends Theme>(baseTheme: T, overrides: DeepPartial<T>, options?: CreateThemeOptions) => T;
|
|
436
472
|
/**
|
|
437
|
-
*
|
|
473
|
+
* Merge multiple theme overrides into one
|
|
474
|
+
* Later overrides take precedence
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```ts
|
|
478
|
+
* const theme = mergeThemes(
|
|
479
|
+
* baseTheme,
|
|
480
|
+
* brandOverrides,
|
|
481
|
+
* darkModeOverrides,
|
|
482
|
+
* userPreferences
|
|
483
|
+
* )
|
|
484
|
+
* ```
|
|
438
485
|
*/
|
|
439
|
-
declare const
|
|
486
|
+
declare const mergeThemes: <T extends Theme>(baseTheme: T, ...overrides: DeepPartial<T>[]) => T;
|
|
440
487
|
/**
|
|
441
|
-
*
|
|
488
|
+
* Create a theme extension factory
|
|
489
|
+
* Useful for creating theme variants (dark mode, high contrast, etc.)
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```ts
|
|
493
|
+
* const createDarkVariant = createThemeVariant({
|
|
494
|
+
* colors: {
|
|
495
|
+
* background: '#1a1a1a',
|
|
496
|
+
* text: '#ffffff',
|
|
497
|
+
* },
|
|
498
|
+
* })
|
|
499
|
+
*
|
|
500
|
+
* const darkTheme = createDarkVariant(lightTheme)
|
|
501
|
+
* ```
|
|
442
502
|
*/
|
|
443
|
-
declare const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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>({
|
|
527
|
+
* colors: {
|
|
528
|
+
* brand: '#007bff',
|
|
529
|
+
* brandHover: '#0056b3',
|
|
530
|
+
* brandActive: '#004085',
|
|
531
|
+
* surface: '#ffffff',
|
|
532
|
+
* surfaceElevated: '#f8f9fa',
|
|
533
|
+
* textPrimary: '#212529',
|
|
534
|
+
* textSecondary: '#6c757d',
|
|
535
|
+
* border: '#dee2e6',
|
|
536
|
+
* },
|
|
537
|
+
* // Uses defaults for other tokens, or provide your own:
|
|
538
|
+
* // spacing: { ... },
|
|
539
|
+
* // radius: { ... },
|
|
540
|
+
* })
|
|
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
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
declare const createCustomTheme: <TColors extends Record<string, string>, TSpacing extends Record<string, string> = typeof defaultSpacing, TRadius extends Record<string, string> = typeof defaultRadius, TShadows extends Record<string, string> = typeof defaultShadows, TFontSize extends Record<string, string> = typeof defaultFontSize, TFontWeight extends Record<string, number> = typeof defaultFontWeight, TLineHeight extends Record<string, number> = typeof defaultLineHeight, TZIndex extends Record<string, number> = typeof defaultZIndex, TTransition extends Record<string, string> = typeof defaultTransition, TOpacity extends Record<string, number> = typeof defaultOpacity, TBreakpoints extends Record<string, string> = typeof defaultBreakpoints>(config: {
|
|
548
|
+
colors: TColors;
|
|
549
|
+
spacing?: TSpacing;
|
|
550
|
+
radius?: TRadius;
|
|
551
|
+
shadows?: TShadows;
|
|
552
|
+
fontSize?: TFontSize;
|
|
553
|
+
fontWeight?: TFontWeight;
|
|
554
|
+
lineHeight?: TLineHeight;
|
|
555
|
+
zIndex?: TZIndex;
|
|
556
|
+
transition?: TTransition;
|
|
557
|
+
opacity?: TOpacity;
|
|
558
|
+
breakpoints?: TBreakpoints;
|
|
559
|
+
}) => CustomTheme<TColors, TSpacing, TRadius, TShadows, TFontSize, TFontWeight, TLineHeight, TZIndex, TTransition, TOpacity, TBreakpoints>;
|
|
484
560
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
561
|
+
/**
|
|
562
|
+
* Color Scales - Modern color palettes with shades from 25 to 950
|
|
563
|
+
*
|
|
564
|
+
* Scales are only accessible via the colors object to maintain consistency
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```ts
|
|
568
|
+
* import { colors } from '@aurora-ui/theme'
|
|
569
|
+
*
|
|
570
|
+
* colors.indigo[500] // '#6366f1'
|
|
571
|
+
* colors.emerald[400] // '#34d399'
|
|
572
|
+
* colors.gray[900] // '#18181b'
|
|
573
|
+
* ```
|
|
574
|
+
*/
|
|
489
575
|
/**
|
|
490
576
|
* All color scales organized by name
|
|
577
|
+
* All scales and special values are only accessible via this object
|
|
491
578
|
*/
|
|
492
579
|
declare const colors: {
|
|
493
580
|
readonly gray: ColorScale;
|
|
@@ -516,171 +603,11 @@ declare const colors: {
|
|
|
516
603
|
readonly current: "currentColor";
|
|
517
604
|
};
|
|
518
605
|
|
|
519
|
-
type ColorPalette$9 = Theme['colors'];
|
|
520
|
-
/**
|
|
521
|
-
* Indigo light palette - Modern, accessible color scheme
|
|
522
|
-
* Follows WCAG AA contrast guidelines
|
|
523
|
-
*/
|
|
524
|
-
declare const indigoLight: ColorPalette$9;
|
|
525
|
-
/**
|
|
526
|
-
* Indigo dark palette - Modern, accessible color scheme
|
|
527
|
-
* Follows WCAG AA contrast guidelines
|
|
528
|
-
*/
|
|
529
|
-
declare const indigoDark: ColorPalette$9;
|
|
530
|
-
|
|
531
|
-
type ColorPalette$8 = Theme['colors'];
|
|
532
|
-
/**
|
|
533
|
-
* Blue light palette - Classic, accessible color scheme
|
|
534
|
-
* Follows WCAG AA contrast guidelines
|
|
535
|
-
*/
|
|
536
|
-
declare const blueLight: ColorPalette$8;
|
|
537
|
-
/**
|
|
538
|
-
* Blue dark palette - Classic, accessible color scheme
|
|
539
|
-
* Follows WCAG AA contrast guidelines
|
|
540
|
-
*/
|
|
541
|
-
declare const blueDark: ColorPalette$8;
|
|
542
|
-
|
|
543
|
-
type ColorPalette$7 = Theme['colors'];
|
|
544
|
-
/**
|
|
545
|
-
* Rose light palette - Elegant, accessible color scheme
|
|
546
|
-
* Follows WCAG AA contrast guidelines
|
|
547
|
-
*/
|
|
548
|
-
declare const roseLight: ColorPalette$7;
|
|
549
|
-
/**
|
|
550
|
-
* Rose dark palette - Elegant, accessible color scheme
|
|
551
|
-
* Follows WCAG AA contrast guidelines
|
|
552
|
-
*/
|
|
553
|
-
declare const roseDark: ColorPalette$7;
|
|
554
|
-
|
|
555
|
-
type ColorPalette$6 = Theme['colors'];
|
|
556
|
-
/**
|
|
557
|
-
* Emerald light palette - Fresh, accessible color scheme
|
|
558
|
-
* Follows WCAG AA contrast guidelines
|
|
559
|
-
*/
|
|
560
|
-
declare const emeraldLight: ColorPalette$6;
|
|
561
|
-
/**
|
|
562
|
-
* Emerald dark palette - Fresh, accessible color scheme
|
|
563
|
-
* Follows WCAG AA contrast guidelines
|
|
564
|
-
*/
|
|
565
|
-
declare const emeraldDark: ColorPalette$6;
|
|
566
|
-
|
|
567
|
-
type ColorPalette$5 = Theme['colors'];
|
|
568
|
-
/**
|
|
569
|
-
* Teal light palette - Cool, accessible color scheme
|
|
570
|
-
* Follows WCAG AA contrast guidelines
|
|
571
|
-
*/
|
|
572
|
-
declare const tealLight: ColorPalette$5;
|
|
573
|
-
/**
|
|
574
|
-
* Teal dark palette - Cool, accessible color scheme
|
|
575
|
-
* Follows WCAG AA contrast guidelines
|
|
576
|
-
*/
|
|
577
|
-
declare const tealDark: ColorPalette$5;
|
|
578
|
-
|
|
579
|
-
type ColorPalette$4 = Theme['colors'];
|
|
580
|
-
/**
|
|
581
|
-
* Violet light palette - Creative, accessible color scheme
|
|
582
|
-
* Follows WCAG AA contrast guidelines
|
|
583
|
-
*/
|
|
584
|
-
declare const violetLight: ColorPalette$4;
|
|
585
|
-
/**
|
|
586
|
-
* Violet dark palette - Creative, accessible color scheme
|
|
587
|
-
* Follows WCAG AA contrast guidelines
|
|
588
|
-
*/
|
|
589
|
-
declare const violetDark: ColorPalette$4;
|
|
590
|
-
|
|
591
|
-
type ColorPalette$3 = Theme['colors'];
|
|
592
|
-
/**
|
|
593
|
-
* Amber light palette - Warm, accessible color scheme
|
|
594
|
-
* Follows WCAG AA contrast guidelines
|
|
595
|
-
*/
|
|
596
|
-
declare const amberLight: ColorPalette$3;
|
|
597
|
-
/**
|
|
598
|
-
* Amber dark palette - Warm, accessible color scheme
|
|
599
|
-
* Follows WCAG AA contrast guidelines
|
|
600
|
-
*/
|
|
601
|
-
declare const amberDark: ColorPalette$3;
|
|
602
|
-
|
|
603
|
-
type ColorPalette$2 = Theme['colors'];
|
|
604
|
-
/**
|
|
605
|
-
* Cyan light palette - Fresh, accessible color scheme
|
|
606
|
-
* Follows WCAG AA contrast guidelines
|
|
607
|
-
*/
|
|
608
|
-
declare const cyanLight: ColorPalette$2;
|
|
609
606
|
/**
|
|
610
|
-
*
|
|
611
|
-
*
|
|
607
|
+
* Default light theme palette - V2
|
|
608
|
+
* A clean, modern palette using Indigo as primary and Slate as neutral
|
|
612
609
|
*/
|
|
613
|
-
declare const
|
|
614
|
-
|
|
615
|
-
type ColorPalette$1 = Theme['colors'];
|
|
616
|
-
/**
|
|
617
|
-
* Slate light palette - Professional, accessible color scheme
|
|
618
|
-
* Follows WCAG AA contrast guidelines
|
|
619
|
-
*/
|
|
620
|
-
declare const slateLight: ColorPalette$1;
|
|
621
|
-
/**
|
|
622
|
-
* Slate dark palette - Professional, accessible color scheme
|
|
623
|
-
* Follows WCAG AA contrast guidelines
|
|
624
|
-
*/
|
|
625
|
-
declare const slateDark: ColorPalette$1;
|
|
626
|
-
|
|
627
|
-
type ColorPalette = Theme['colors'];
|
|
628
|
-
/**
|
|
629
|
-
* Gray light palette - Clean, accessible color scheme
|
|
630
|
-
* Follows WCAG AA contrast guidelines
|
|
631
|
-
*/
|
|
632
|
-
declare const grayLight: ColorPalette;
|
|
633
|
-
/**
|
|
634
|
-
* Gray dark palette - Clean, accessible color scheme
|
|
635
|
-
* Follows WCAG AA contrast guidelines
|
|
636
|
-
*/
|
|
637
|
-
declare const grayDark: ColorPalette;
|
|
638
|
-
|
|
639
|
-
/**
|
|
640
|
-
* All available color palettes organized by name
|
|
641
|
-
*/
|
|
642
|
-
declare const palettes: {
|
|
643
|
-
readonly indigo: {
|
|
644
|
-
readonly light: BaseColors;
|
|
645
|
-
readonly dark: BaseColors;
|
|
646
|
-
};
|
|
647
|
-
readonly blue: {
|
|
648
|
-
readonly light: BaseColors;
|
|
649
|
-
readonly dark: BaseColors;
|
|
650
|
-
};
|
|
651
|
-
readonly rose: {
|
|
652
|
-
readonly light: BaseColors;
|
|
653
|
-
readonly dark: BaseColors;
|
|
654
|
-
};
|
|
655
|
-
readonly emerald: {
|
|
656
|
-
readonly light: BaseColors;
|
|
657
|
-
readonly dark: BaseColors;
|
|
658
|
-
};
|
|
659
|
-
readonly teal: {
|
|
660
|
-
readonly light: BaseColors;
|
|
661
|
-
readonly dark: BaseColors;
|
|
662
|
-
};
|
|
663
|
-
readonly violet: {
|
|
664
|
-
readonly light: BaseColors;
|
|
665
|
-
readonly dark: BaseColors;
|
|
666
|
-
};
|
|
667
|
-
readonly amber: {
|
|
668
|
-
readonly light: BaseColors;
|
|
669
|
-
readonly dark: BaseColors;
|
|
670
|
-
};
|
|
671
|
-
readonly cyan: {
|
|
672
|
-
readonly light: BaseColors;
|
|
673
|
-
readonly dark: BaseColors;
|
|
674
|
-
};
|
|
675
|
-
readonly slate: {
|
|
676
|
-
readonly light: BaseColors;
|
|
677
|
-
readonly dark: BaseColors;
|
|
678
|
-
};
|
|
679
|
-
readonly gray: {
|
|
680
|
-
readonly light: BaseColors;
|
|
681
|
-
readonly dark: BaseColors;
|
|
682
|
-
};
|
|
683
|
-
};
|
|
610
|
+
declare const defaultPalette: BaseColors;
|
|
684
611
|
|
|
685
612
|
/**
|
|
686
613
|
* Extended type to support pseudo-classes, media queries, container queries, supports and complex selectors
|
|
@@ -741,6 +668,32 @@ type FontFaceOptions = {
|
|
|
741
668
|
* ```
|
|
742
669
|
*/
|
|
743
670
|
declare const createStyles: <TTheme extends Theme = Theme, T extends Record<string, StyleWithPseudos | StyleFunction> = Record<string, StyleWithPseudos | StyleFunction>>(stylesOrCreator: T | ((theme: TTheme) => T)) => { [K in keyof T]: T[K] extends (...args: infer TArgs) => StyleWithPseudos ? (...args: TArgs) => string : string; };
|
|
671
|
+
/**
|
|
672
|
+
* Create a typed createStyles function pre-configured with your custom theme type.
|
|
673
|
+
* This eliminates the need to specify the theme type on every createStyles call.
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```ts
|
|
677
|
+
* // 1. Define your custom theme
|
|
678
|
+
* type MyTheme = CustomTheme<{
|
|
679
|
+
* brand: string
|
|
680
|
+
* brandHover: string
|
|
681
|
+
* surface: string
|
|
682
|
+
* }>
|
|
683
|
+
*
|
|
684
|
+
* // 2. Create a pre-typed createStyles function (do this once)
|
|
685
|
+
* export const createStyles = createTypedStyles<MyTheme>()
|
|
686
|
+
*
|
|
687
|
+
* // 3. Use it everywhere without specifying the type!
|
|
688
|
+
* const STYLES = createStyles((theme) => ({
|
|
689
|
+
* button: {
|
|
690
|
+
* backgroundColor: theme.colors.brand, // ✅ TypeScript knows!
|
|
691
|
+
* // backgroundColor: theme.colors.primary, // ❌ Error - doesn't exist
|
|
692
|
+
* },
|
|
693
|
+
* }))
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
696
|
+
declare const createTypedStyles: <TTheme extends Record<string, unknown>>() => <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; };
|
|
744
697
|
|
|
745
698
|
/**
|
|
746
699
|
* Create and inject keyframes
|
|
@@ -856,159 +809,4 @@ declare const insertRule: (rule: string) => void;
|
|
|
856
809
|
*/
|
|
857
810
|
declare const sanitizeCssValue: (value: string) => string;
|
|
858
811
|
|
|
859
|
-
|
|
860
|
-
* WCAG Contrast Utilities
|
|
861
|
-
*
|
|
862
|
-
* Utilities for checking color contrast ratios according to WCAG 2.1 guidelines.
|
|
863
|
-
*
|
|
864
|
-
* @example
|
|
865
|
-
* ```ts
|
|
866
|
-
* import { getContrastRatio, meetsWCAG, checkThemeContrast } from '@aurora-ds/theme'
|
|
867
|
-
*
|
|
868
|
-
* // Check contrast between two colors
|
|
869
|
-
* const ratio = getContrastRatio('#ffffff', '#000000') // 21
|
|
870
|
-
*
|
|
871
|
-
* // Check if colors meet WCAG standards
|
|
872
|
-
* meetsWCAG('#ffffff', '#767676', 'AA') // true for large text
|
|
873
|
-
* meetsWCAG('#ffffff', '#767676', 'AAA') // false
|
|
874
|
-
*
|
|
875
|
-
* // Check all theme color pairs
|
|
876
|
-
* const issues = checkThemeContrast(myTheme)
|
|
877
|
-
* ```
|
|
878
|
-
*/
|
|
879
|
-
/**
|
|
880
|
-
* WCAG contrast level requirements
|
|
881
|
-
* - AA: 4.5:1 for normal text, 3:1 for large text
|
|
882
|
-
* - AAA: 7:1 for normal text, 4.5:1 for large text
|
|
883
|
-
*/
|
|
884
|
-
type WCAGLevel = 'AA' | 'AAA';
|
|
885
|
-
/**
|
|
886
|
-
* Result of a contrast check
|
|
887
|
-
*/
|
|
888
|
-
type ContrastResult = {
|
|
889
|
-
/** The two colors being compared */
|
|
890
|
-
colors: [string, string];
|
|
891
|
-
/** The contrast ratio (1-21) */
|
|
892
|
-
ratio: number;
|
|
893
|
-
/** Whether it passes WCAG AA for normal text (4.5:1) */
|
|
894
|
-
passesAA: boolean;
|
|
895
|
-
/** Whether it passes WCAG AA for large text (3:1) */
|
|
896
|
-
passesAALarge: boolean;
|
|
897
|
-
/** Whether it passes WCAG AAA for normal text (7:1) */
|
|
898
|
-
passesAAA: boolean;
|
|
899
|
-
/** Whether it passes WCAG AAA for large text (4.5:1) */
|
|
900
|
-
passesAAALarge: boolean;
|
|
901
|
-
};
|
|
902
|
-
/**
|
|
903
|
-
* Theme contrast check result
|
|
904
|
-
*/
|
|
905
|
-
type ThemeContrastIssue = {
|
|
906
|
-
/** Name of the color pair (e.g., "primary/onPrimary") */
|
|
907
|
-
pair: string;
|
|
908
|
-
/** Foreground color name */
|
|
909
|
-
foreground: string;
|
|
910
|
-
/** Background color name */
|
|
911
|
-
background: string;
|
|
912
|
-
/** The contrast ratio */
|
|
913
|
-
ratio: number;
|
|
914
|
-
/** Required minimum ratio */
|
|
915
|
-
required: number;
|
|
916
|
-
/** WCAG level that failed */
|
|
917
|
-
level: 'AA' | 'AALarge';
|
|
918
|
-
};
|
|
919
|
-
/**
|
|
920
|
-
* Calculate the contrast ratio between two colors
|
|
921
|
-
* @see https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio
|
|
922
|
-
*
|
|
923
|
-
* @param foreground - Foreground color (hex)
|
|
924
|
-
* @param background - Background color (hex)
|
|
925
|
-
* @returns Contrast ratio (1-21), or null if colors are invalid
|
|
926
|
-
*
|
|
927
|
-
* @example
|
|
928
|
-
* ```ts
|
|
929
|
-
* getContrastRatio('#ffffff', '#000000') // 21
|
|
930
|
-
* getContrastRatio('#ffffff', '#ffffff') // 1
|
|
931
|
-
* getContrastRatio('#6366f1', '#ffffff') // ~4.5
|
|
932
|
-
* ```
|
|
933
|
-
*/
|
|
934
|
-
declare const getContrastRatio: (foreground: string, background: string) => number | null;
|
|
935
|
-
/**
|
|
936
|
-
* Check if two colors meet WCAG contrast requirements
|
|
937
|
-
*
|
|
938
|
-
* @param foreground - Foreground color (hex)
|
|
939
|
-
* @param background - Background color (hex)
|
|
940
|
-
* @param level - WCAG level to check ('AA' or 'AAA')
|
|
941
|
-
* @param largeText - Whether this is for large text (14pt bold or 18pt+)
|
|
942
|
-
* @returns Whether the contrast meets the specified WCAG level
|
|
943
|
-
*
|
|
944
|
-
* @example
|
|
945
|
-
* ```ts
|
|
946
|
-
* meetsWCAG('#ffffff', '#6366f1', 'AA') // true
|
|
947
|
-
* meetsWCAG('#ffffff', '#6366f1', 'AAA') // false
|
|
948
|
-
* meetsWCAG('#ffffff', '#94a3b8', 'AA', true) // true (large text)
|
|
949
|
-
* ```
|
|
950
|
-
*/
|
|
951
|
-
declare const meetsWCAG: (foreground: string, background: string, level?: WCAGLevel, largeText?: boolean) => boolean;
|
|
952
|
-
/**
|
|
953
|
-
* Get detailed contrast information between two colors
|
|
954
|
-
*
|
|
955
|
-
* @param foreground - Foreground color (hex)
|
|
956
|
-
* @param background - Background color (hex)
|
|
957
|
-
* @returns Detailed contrast result or null if colors are invalid
|
|
958
|
-
*
|
|
959
|
-
* @example
|
|
960
|
-
* ```ts
|
|
961
|
-
* const result = checkContrast('#ffffff', '#6366f1')
|
|
962
|
-
* // {
|
|
963
|
-
* // colors: ['#ffffff', '#6366f1'],
|
|
964
|
-
* // ratio: 4.54,
|
|
965
|
-
* // passesAA: true,
|
|
966
|
-
* // passesAALarge: true,
|
|
967
|
-
* // passesAAA: false,
|
|
968
|
-
* // passesAAALarge: true
|
|
969
|
-
* // }
|
|
970
|
-
* ```
|
|
971
|
-
*/
|
|
972
|
-
declare const checkContrast: (foreground: string, background: string) => ContrastResult | null;
|
|
973
|
-
/**
|
|
974
|
-
* Check all important color pairs in a theme for WCAG compliance
|
|
975
|
-
*
|
|
976
|
-
* @param theme - The theme to check
|
|
977
|
-
* @param level - Minimum WCAG level to require ('AA' or 'AAA')
|
|
978
|
-
* @returns Array of contrast issues found
|
|
979
|
-
*
|
|
980
|
-
* @example
|
|
981
|
-
* ```ts
|
|
982
|
-
* import { checkThemeContrast, defaultTheme } from '@aurora-ds/theme'
|
|
983
|
-
*
|
|
984
|
-
* const issues = checkThemeContrast(defaultTheme)
|
|
985
|
-
* if (issues.length > 0) {
|
|
986
|
-
* console.warn('Theme has contrast issues:', issues)
|
|
987
|
-
* }
|
|
988
|
-
*
|
|
989
|
-
* // Check for AAA compliance
|
|
990
|
-
* const strictIssues = checkThemeContrast(defaultTheme, 'AAA')
|
|
991
|
-
* ```
|
|
992
|
-
*/
|
|
993
|
-
declare const checkThemeContrast: (theme: {
|
|
994
|
-
colors: Record<string, string>;
|
|
995
|
-
}, level?: WCAGLevel) => ThemeContrastIssue[];
|
|
996
|
-
/**
|
|
997
|
-
* Get a suggested color that meets WCAG contrast requirements
|
|
998
|
-
* Adjusts the lightness of the foreground color to meet the target ratio
|
|
999
|
-
*
|
|
1000
|
-
* @param foreground - Current foreground color (hex)
|
|
1001
|
-
* @param background - Background color (hex)
|
|
1002
|
-
* @param targetRatio - Desired contrast ratio (default 4.5 for AA)
|
|
1003
|
-
* @returns Adjusted foreground color or null if adjustment isn't possible
|
|
1004
|
-
*
|
|
1005
|
-
* @example
|
|
1006
|
-
* ```ts
|
|
1007
|
-
* // If #94a3b8 on #ffffff doesn't meet AA
|
|
1008
|
-
* const suggested = suggestContrastColor('#94a3b8', '#ffffff', 4.5)
|
|
1009
|
-
* // Returns a darker shade that meets the requirement
|
|
1010
|
-
* ```
|
|
1011
|
-
*/
|
|
1012
|
-
declare const suggestContrastColor: (foreground: string, background: string, targetRatio?: number) => string | null;
|
|
1013
|
-
|
|
1014
|
-
export { type BaseBreakpoints, type BaseColors, type BaseFontSize, type BaseFontWeight, type BaseLineHeight, type BaseOpacity, type BaseRadius, type BaseShadows, type BaseSpacing, type BaseTransition, type BaseZIndex, type ColorName, type ColorScale, type ColorShade, type ContrastResult, type DeepPartial, type ExtendTheme, type ExtendedTheme, type FontFaceOptions, type PaletteName, type StyleFunction, type StyleWithPseudos, type Theme, type ThemeContrastIssue, type ThemeOverride, ThemeProvider, type ThemeProviderProps, type WCAGLevel, amber, amberDark, amberLight, black, blue, blueDark, blueLight, checkContrast, checkThemeContrast, clearSSRRules, colors, createStyles, createTheme, createThemeVariant, cssVar, cssVariables, current, cyan, cyanDark, cyanLight, defaultBreakpoints, defaultColors, defaultDarkColors, defaultDarkTheme, defaultFontSize, defaultFontWeight, defaultLineHeight, defaultOpacity, defaultRadius, defaultShadows, defaultSpacing, defaultTheme, defaultTransition, defaultZIndex, emerald, emeraldDark, emeraldLight, fontFace, fuchsia, getContrastRatio, getSSRRulesArray, getSSRStyleTag, getSSRStyles, getTheme, gray, grayDark, grayLight, green, indigo, indigoDark, indigoLight, injectCssVariables, insertRule, keyframes, lime, meetsWCAG, mergeThemes, orange, palettes, pink, purple, red, rose, roseDark, roseLight, sanitizeCssValue, setThemeContextGetter, sky, slate, slateDark, slateLight, stone, suggestContrastColor, teal, tealDark, tealLight, transparent, useTheme, violet, violetDark, violetLight, white, yellow };
|
|
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 ColorName, type ColorScale, type ColorShade, type CreateCustomThemeOptions, type CreateThemeOptions, type CustomTheme, type CustomThemeBase, type DeepPartial, type ExtendTheme, type ExtendedTheme, type FontFaceOptions, type StyleFunction, type StyleWithPseudos, type Theme, type ThemeOverride, ThemeProvider, type ThemeProviderProps, clearSSRRules, colors, createCustomTheme, createStyles, createTheme, createThemeVariant, createTypedStyles, cssVar, cssVariables, defaultBreakpoints, defaultFontSize, defaultFontWeight, defaultLineHeight, defaultOpacity, defaultPalette, defaultRadius, defaultShadows, defaultSpacing, defaultTheme, defaultTransition, defaultZIndex, fontFace, getSSRRulesArray, getSSRStyleTag, getSSRStyles, getTheme, injectCssVariables, insertRule, keyframes, mergeThemes, sanitizeCssValue, setThemeContextGetter, useTheme };
|