@@ -32,7 +32,9 @@ export interface CSSProperties
32
32
/**
33
33
* Map of all CSS pseudo selectors (`:hover`, `:focus`, ...)
34
34
*/
35
- export type CSSPseudoSelectorProps = { [ K in CSS . Pseudos ] ?: ThemeUIStyleObject }
35
+ export type CSSPseudoSelectorProps < TTheme > = {
36
+ [ K in CSS . Pseudos ] ?: ThemeUIStyleObject < TTheme >
37
+ }
36
38
37
39
interface AliasesCSSProperties {
38
40
/**
@@ -437,10 +439,10 @@ export interface ThemeUIExtendedCSSProperties
437
439
438
440
type ThemeUIStyleValue < T > = ResponsiveStyleValue < T | ObjectWithDefault < T > | T [ ] >
439
441
440
- export type StylePropertyValue < T > =
442
+ export type StylePropertyValue < T , TTheme extends Theme = Theme > =
441
443
| ThemeUIStyleValue < Exclude < T , undefined > >
442
- | ( ( theme : Theme ) => ThemeUIStyleValue < Exclude < T , undefined > > | undefined )
443
- | ThemeUIStyleObject
444
+ | ( ( theme : TTheme ) => ThemeUIStyleValue < Exclude < T , undefined > > | undefined )
445
+ | ThemeUIStyleObject < TTheme >
444
446
| ThemeUIEmpty
445
447
446
448
export type ThemeUICSSProperties = {
@@ -474,8 +476,8 @@ export interface VariantProperty {
474
476
variant ?: string
475
477
}
476
478
477
- export interface ThemeDerivedStyles {
478
- ( theme : Theme ) : ThemeUICSSObject
479
+ export interface ThemeDerivedStyles < TTheme = Theme > {
480
+ ( theme : TTheme ) : ThemeUICSSObject
479
481
}
480
482
481
483
export interface Label {
@@ -497,7 +499,7 @@ export interface CSSOthersObject {
497
499
498
500
export interface ThemeUICSSObject
499
501
extends ThemeUICSSProperties ,
500
- CSSPseudoSelectorProps ,
502
+ CSSPseudoSelectorProps < Theme > ,
501
503
CSSOthersObject ,
502
504
VariantProperty ,
503
505
Label { }
@@ -507,7 +509,9 @@ export interface ThemeUICSSObject
507
509
* such that properties that are part of the `Theme` will be transformed to
508
510
* their corresponding values. Other valid CSS properties are also allowed.
509
511
*/
510
- export type ThemeUIStyleObject = ThemeUICSSObject | ThemeDerivedStyles
512
+ export type ThemeUIStyleObject < TTheme = Theme > =
513
+ | ThemeUICSSObject
514
+ | ThemeDerivedStyles < TTheme >
511
515
512
516
export type TLengthStyledSystem = string | 0 | number
513
517
@@ -565,7 +569,7 @@ export interface ColorMode extends ScaleDict<CSS.Property.Color> {
565
569
text ?: ColorOrNestedColorScale
566
570
567
571
/**
568
- * Primary brand color for links, buttons, etc.
572
+ * Primary brand coloThr for links, buttons, etc.
569
573
*/
570
574
primary ?: ColorOrNestedColorScale
571
575
@@ -601,40 +605,40 @@ export type ColorModesScale = ColorMode & {
601
605
}
602
606
}
603
607
604
- export interface ThemeStyles {
605
- tr ?: ThemeUIStyleObject
606
- th ?: ThemeUIStyleObject
607
- td ?: ThemeUIStyleObject
608
- em ?: ThemeUIStyleObject
609
- strong ?: ThemeUIStyleObject
610
- div ?: ThemeUIStyleObject
611
- p ?: ThemeUIStyleObject
612
- b ?: ThemeUIStyleObject
613
- i ?: ThemeUIStyleObject
614
- a ?: ThemeUIStyleObject
615
- h1 ?: ThemeUIStyleObject
616
- h2 ?: ThemeUIStyleObject
617
- h3 ?: ThemeUIStyleObject
618
- h4 ?: ThemeUIStyleObject
619
- h5 ?: ThemeUIStyleObject
620
- h6 ?: ThemeUIStyleObject
621
- img ?: ThemeUIStyleObject
622
- pre ?: ThemeUIStyleObject
623
- code ?: ThemeUIStyleObject
624
- ol ?: ThemeUIStyleObject
625
- ul ?: ThemeUIStyleObject
626
- li ?: ThemeUIStyleObject
627
- blockquote ?: ThemeUIStyleObject
628
- hr ?: ThemeUIStyleObject
629
- table ?: ThemeUIStyleObject
630
- delete ?: ThemeUIStyleObject
631
- inlineCode ?: ThemeUIStyleObject
632
- thematicBreak ?: ThemeUIStyleObject
633
- root ?: ThemeUIStyleObject
634
- [ key : string ] : ThemeUIStyleObject | undefined
608
+ export interface ThemeStyles < TTheme = Theme > {
609
+ tr ?: ThemeUIStyleObject < TTheme >
610
+ th ?: ThemeUIStyleObject < TTheme >
611
+ td ?: ThemeUIStyleObject < TTheme >
612
+ em ?: ThemeUIStyleObject < TTheme >
613
+ strong ?: ThemeUIStyleObject < TTheme >
614
+ div ?: ThemeUIStyleObject < TTheme >
615
+ p ?: ThemeUIStyleObject < TTheme >
616
+ b ?: ThemeUIStyleObject < TTheme >
617
+ i ?: ThemeUIStyleObject < TTheme >
618
+ a ?: ThemeUIStyleObject < TTheme >
619
+ h1 ?: ThemeUIStyleObject < TTheme >
620
+ h2 ?: ThemeUIStyleObject < TTheme >
621
+ h3 ?: ThemeUIStyleObject < TTheme >
622
+ h4 ?: ThemeUIStyleObject < TTheme >
623
+ h5 ?: ThemeUIStyleObject < TTheme >
624
+ h6 ?: ThemeUIStyleObject < TTheme >
625
+ img ?: ThemeUIStyleObject < TTheme >
626
+ pre ?: ThemeUIStyleObject < TTheme >
627
+ code ?: ThemeUIStyleObject < TTheme >
628
+ ol ?: ThemeUIStyleObject < TTheme >
629
+ ul ?: ThemeUIStyleObject < TTheme >
630
+ li ?: ThemeUIStyleObject < TTheme >
631
+ blockquote ?: ThemeUIStyleObject < TTheme >
632
+ hr ?: ThemeUIStyleObject < TTheme >
633
+ table ?: ThemeUIStyleObject < TTheme >
634
+ delete ?: ThemeUIStyleObject < TTheme >
635
+ inlineCode ?: ThemeUIStyleObject < TTheme >
636
+ thematicBreak ?: ThemeUIStyleObject < TTheme >
637
+ root ?: ThemeUIStyleObject < TTheme >
638
+ [ key : string ] : ThemeUIStyleObject < TTheme > | undefined
635
639
}
636
640
637
- export interface Theme {
641
+ export interface Theme < TTheme = { } > {
638
642
breakpoints ?: Array < string >
639
643
mediaQueries ?: { [ size : string ] : string }
640
644
space ?: Scale < CSS . Property . Margin < number | string > >
@@ -742,7 +746,7 @@ export interface Theme {
742
746
* @see https://theme-ui.com/components/variants
743
747
* @see https://theme-ui.com/components/grid#variants
744
748
*/
745
- grids ?: Record < string , ThemeUIStyleObject >
749
+ grids ?: Record < string , ThemeUIStyleObject < TTheme > >
746
750
747
751
/**
748
752
* Button variants can be defined in the `theme.buttons` object. The `Button`
@@ -752,7 +756,7 @@ export interface Theme {
752
756
* @see https://theme-ui.com/components/variants
753
757
* @see https://theme-ui.com/components/button#variants
754
758
*/
755
- buttons ?: Record < string , ThemeUIStyleObject >
759
+ buttons ?: Record < string , ThemeUIStyleObject < TTheme > >
756
760
757
761
/**
758
762
* Text style variants can be defined in the `theme.text` object. The `Text`
@@ -762,7 +766,7 @@ export interface Theme {
762
766
* @see https://theme-ui.com/components/variants
763
767
* @see https://theme-ui.com/components/text#variants
764
768
*/
765
- text ?: Record < string , ThemeUIStyleObject >
769
+ text ?: Record < string , ThemeUIStyleObject < TTheme > >
766
770
767
771
/**
768
772
* Link variants can be defined in the `theme.links` object. By default the
@@ -772,7 +776,7 @@ export interface Theme {
772
776
* @see https://theme-ui.com/components/variants
773
777
* @see https://theme-ui.com/components/link#variants
774
778
*/
775
- links ?: Record < string , ThemeUIStyleObject >
779
+ links ?: Record < string , ThemeUIStyleObject < TTheme > >
776
780
777
781
/**
778
782
* Image style variants can be defined in the `theme.images` object.
@@ -781,7 +785,7 @@ export interface Theme {
781
785
* @see https://theme-ui.com/components/variants
782
786
* @see https://theme-ui.com/components/image#variants
783
787
*/
784
- images ?: Record < string , ThemeUIStyleObject >
788
+ images ?: Record < string , ThemeUIStyleObject < TTheme > >
785
789
786
790
/**
787
791
* Card style variants can be defined in `the theme.cards` object. By default
@@ -791,7 +795,7 @@ export interface Theme {
791
795
* @see https://theme-ui.com/components/variants
792
796
* @see https://theme-ui.com/components/card#variants
793
797
*/
794
- cards ?: Record < string , ThemeUIStyleObject >
798
+ cards ?: Record < string , ThemeUIStyleObject < TTheme > >
795
799
796
800
/**
797
801
* Container variants can be defined in the `theme.layout` object. The
@@ -802,7 +806,7 @@ export interface Theme {
802
806
* @see https://theme-ui.com/components/variants
803
807
* @see https://theme-ui.com/components/container#variants
804
808
*/
805
- layout ?: Record < string , ThemeUIStyleObject >
809
+ layout ?: Record < string , ThemeUIStyleObject < TTheme > >
806
810
807
811
/**
808
812
* Label variants can be defined in `theme.forms` and the component uses the
@@ -836,7 +840,7 @@ export interface Theme {
836
840
* @see https://theme-ui.com/components/checkbox#variants
837
841
* @see https://theme-ui.com/components/slider#variants
838
842
*/
839
- forms ?: Record < string , ThemeUIStyleObject >
843
+ forms ?: Record < string , ThemeUIStyleObject < TTheme > >
840
844
841
845
/**
842
846
* Badge variants can be defined in `theme.badges`. The `Badge` component uses
@@ -846,7 +850,7 @@ export interface Theme {
846
850
* @see https://theme-ui.com/components/variants
847
851
* @see https://theme-ui.com/components/badge#variants
848
852
*/
849
- badges ?: Record < string , ThemeUIStyleObject >
853
+ badges ?: Record < string , ThemeUIStyleObject < TTheme > >
850
854
851
855
/**
852
856
* Alert variants can be defined in `theme.alerts`. The `Alert` component uses
@@ -856,7 +860,7 @@ export interface Theme {
856
860
* @see https://theme-ui.com/components/variants
857
861
* @see https://theme-ui.com/components/alert#variants
858
862
*/
859
- alerts ?: Record < string , ThemeUIStyleObject >
863
+ alerts ?: Record < string , ThemeUIStyleObject < TTheme > >
860
864
861
865
/**
862
866
* Message variants can be defined in the `theme.messages` object.
@@ -865,5 +869,5 @@ export interface Theme {
865
869
* @see https://theme-ui.com/components/variants
866
870
* @see https://theme-ui.com/components/message#variants
867
871
*/
868
- messages ?: Record < string , ThemeUIStyleObject >
872
+ messages ?: Record < string , ThemeUIStyleObject < TTheme > >
869
873
}
0 commit comments