@vaneui/ui 0.1.3 → 0.1.5
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/components/ui/classes/appearanceClasses.d.ts +8 -8
- package/dist/components/ui/classes/typographyClasses.d.ts +1 -1
- package/dist/components/ui/props/keys.d.ts +6 -6
- package/dist/components/ui/theme/appearance/bgAppearanceTheme.d.ts +8 -0
- package/dist/components/ui/theme/appearance/genericVariantTheme.d.ts +14 -0
- package/dist/components/ui/theme/appearance/textAppearanceTheme.d.ts +3 -4
- package/dist/components/ui/theme/badgeTheme.d.ts +6 -5
- package/dist/components/ui/theme/buttonTheme.d.ts +6 -5
- package/dist/components/ui/theme/cardTheme.d.ts +2 -2
- package/dist/components/ui/theme/chipTheme.d.ts +6 -5
- package/dist/components/ui/theme/containerTheme.d.ts +2 -2
- package/dist/components/ui/theme/sectionTheme.d.ts +7 -5
- package/dist/index.esm.js +122 -214
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +122 -214
- package/dist/index.js.map +1 -1
- package/dist/ui.css +0 -72
- package/package.json +1 -1
- package/dist/components/ui/theme/appearance/layoutAppearanceTheme.d.ts +0 -10
- package/dist/components/ui/theme/appearance/variantTheme.d.ts +0 -15
package/dist/index.js
CHANGED
|
@@ -14,8 +14,8 @@ class BaseTheme {
|
|
|
14
14
|
const MODE_KEYS = ['base', 'hover', 'active'];
|
|
15
15
|
const SIZE_KEYS = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
16
16
|
const VARIANT_KEYS = ['filled', 'outline'];
|
|
17
|
-
const
|
|
18
|
-
const TEXT_APPEARANCE_KEYS = [...
|
|
17
|
+
const BG_APPEARANCE_KEYS = ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info', 'transparent'];
|
|
18
|
+
const TEXT_APPEARANCE_KEYS = [...BG_APPEARANCE_KEYS, 'muted', 'link'];
|
|
19
19
|
const FONT_FAMILY_KEYS = ['sans', 'serif', 'mono'];
|
|
20
20
|
const FONT_WEIGHT_KEYS = ['thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black'];
|
|
21
21
|
const FONT_STYLE_KEYS = ['italic', 'notItalic'];
|
|
@@ -45,6 +45,7 @@ const EXCLUSIVE_KEY_GROUPS = [
|
|
|
45
45
|
MODE_KEYS,
|
|
46
46
|
SIZE_KEYS,
|
|
47
47
|
TEXT_APPEARANCE_KEYS,
|
|
48
|
+
BG_APPEARANCE_KEYS,
|
|
48
49
|
VARIANT_KEYS,
|
|
49
50
|
FONT_FAMILY_KEYS,
|
|
50
51
|
FONT_WEIGHT_KEYS,
|
|
@@ -102,13 +103,13 @@ const BUTTON_KEYS = [
|
|
|
102
103
|
...GAP_KEYS,
|
|
103
104
|
...PADDING_KEYS,
|
|
104
105
|
...VARIANT_KEYS,
|
|
105
|
-
...
|
|
106
|
+
...TEXT_APPEARANCE_KEYS
|
|
106
107
|
];
|
|
107
108
|
// Grid keys
|
|
108
109
|
const GRID_KEYS = [
|
|
109
110
|
...BASE_COMPONENT_KEYS,
|
|
110
111
|
...GAP_KEYS,
|
|
111
|
-
...
|
|
112
|
+
...BG_APPEARANCE_KEYS
|
|
112
113
|
];
|
|
113
114
|
// Row keys
|
|
114
115
|
const ROW_KEYS = [
|
|
@@ -117,7 +118,7 @@ const ROW_KEYS = [
|
|
|
117
118
|
...GAP_KEYS,
|
|
118
119
|
...DIRECTION_REVERSE_KEYS,
|
|
119
120
|
...BREAKPOINT_KEYS,
|
|
120
|
-
...
|
|
121
|
+
...BG_APPEARANCE_KEYS
|
|
121
122
|
];
|
|
122
123
|
// Col keys
|
|
123
124
|
const COL_KEYS = [
|
|
@@ -125,7 +126,7 @@ const COL_KEYS = [
|
|
|
125
126
|
...WRAP_KEYS,
|
|
126
127
|
...GAP_KEYS,
|
|
127
128
|
...DIRECTION_REVERSE_KEYS,
|
|
128
|
-
...
|
|
129
|
+
...BG_APPEARANCE_KEYS
|
|
129
130
|
];
|
|
130
131
|
// Card keys
|
|
131
132
|
const CARD_KEYS = [
|
|
@@ -134,7 +135,7 @@ const CARD_KEYS = [
|
|
|
134
135
|
...SHARP_KEYS,
|
|
135
136
|
...ROUNDED_KEYS,
|
|
136
137
|
...BREAKPOINT_KEYS,
|
|
137
|
-
...
|
|
138
|
+
...BG_APPEARANCE_KEYS,
|
|
138
139
|
...BORDER_KEYS,
|
|
139
140
|
...RING_KEYS,
|
|
140
141
|
...SHADOW_KEYS,
|
|
@@ -150,7 +151,7 @@ const STACK_KEYS = [
|
|
|
150
151
|
...GAP_KEYS,
|
|
151
152
|
...DIRECTION_REVERSE_KEYS,
|
|
152
153
|
...BREAKPOINT_KEYS,
|
|
153
|
-
...
|
|
154
|
+
...BG_APPEARANCE_KEYS,
|
|
154
155
|
...FLEX_DIRECTION_KEYS,
|
|
155
156
|
...PADDING_KEYS
|
|
156
157
|
];
|
|
@@ -164,7 +165,7 @@ const BADGE_KEYS = [
|
|
|
164
165
|
...RING_KEYS,
|
|
165
166
|
...GAP_KEYS,
|
|
166
167
|
...PADDING_KEYS,
|
|
167
|
-
...
|
|
168
|
+
...TEXT_APPEARANCE_KEYS
|
|
168
169
|
];
|
|
169
170
|
// Chip keys
|
|
170
171
|
const CHIP_KEYS = [
|
|
@@ -176,17 +177,17 @@ const CHIP_KEYS = [
|
|
|
176
177
|
...RING_KEYS,
|
|
177
178
|
...GAP_KEYS,
|
|
178
179
|
...PADDING_KEYS,
|
|
179
|
-
...
|
|
180
|
+
...TEXT_APPEARANCE_KEYS
|
|
180
181
|
];
|
|
181
182
|
// Divider keys
|
|
182
183
|
const DIVIDER_KEYS = [
|
|
183
184
|
...BASE_COMPONENT_KEYS,
|
|
184
|
-
...
|
|
185
|
+
...BG_APPEARANCE_KEYS
|
|
185
186
|
];
|
|
186
187
|
// Container keys
|
|
187
188
|
const CONTAINER_KEYS = [
|
|
188
189
|
...BASE_COMPONENT_KEYS,
|
|
189
|
-
...
|
|
190
|
+
...BG_APPEARANCE_KEYS,
|
|
190
191
|
...BORDER_KEYS,
|
|
191
192
|
...SHADOW_KEYS,
|
|
192
193
|
...RING_KEYS,
|
|
@@ -197,7 +198,7 @@ const CONTAINER_KEYS = [
|
|
|
197
198
|
const SECTION_KEYS = [
|
|
198
199
|
...BASE_COMPONENT_KEYS,
|
|
199
200
|
...FLEX_DIRECTION_KEYS,
|
|
200
|
-
...
|
|
201
|
+
...BG_APPEARANCE_KEYS,
|
|
201
202
|
...PADDING_KEYS,
|
|
202
203
|
...DIRECTION_REVERSE_KEYS,
|
|
203
204
|
...WRAP_KEYS,
|
|
@@ -3548,7 +3549,34 @@ PyTheme.defaultClasses = {
|
|
|
3548
3549
|
noPadding: "py-0"
|
|
3549
3550
|
};
|
|
3550
3551
|
|
|
3551
|
-
|
|
3552
|
+
class TextAppearanceTheme extends BaseTheme {
|
|
3553
|
+
constructor(config) {
|
|
3554
|
+
super();
|
|
3555
|
+
Object.assign(this, config);
|
|
3556
|
+
}
|
|
3557
|
+
getClasses(props, defaults) {
|
|
3558
|
+
const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, TEXT_APPEARANCE_KEYS) || 'default';
|
|
3559
|
+
const modesForAppearance = this[pickedAppearanceKey];
|
|
3560
|
+
if (!modesForAppearance) {
|
|
3561
|
+
return MODE_KEYS.map(() => '');
|
|
3562
|
+
}
|
|
3563
|
+
return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
|
|
3564
|
+
}
|
|
3565
|
+
static createTheme(src = {}) {
|
|
3566
|
+
const finalConfig = Object.fromEntries(TEXT_APPEARANCE_KEYS.map(textKey => [
|
|
3567
|
+
textKey,
|
|
3568
|
+
Object.fromEntries(MODE_KEYS.map(modeKey => {
|
|
3569
|
+
var _a;
|
|
3570
|
+
return [
|
|
3571
|
+
modeKey,
|
|
3572
|
+
((_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey]) || ''
|
|
3573
|
+
];
|
|
3574
|
+
})),
|
|
3575
|
+
]));
|
|
3576
|
+
return new TextAppearanceTheme(finalConfig);
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3552
3580
|
const filledTextAppearanceClasses = {
|
|
3553
3581
|
default: "text-white",
|
|
3554
3582
|
primary: "text-white",
|
|
@@ -3563,7 +3591,6 @@ const filledTextAppearanceClasses = {
|
|
|
3563
3591
|
info: "text-white",
|
|
3564
3592
|
transparent: "text-transparent",
|
|
3565
3593
|
};
|
|
3566
|
-
// Default text appearance classes (for non-button components)
|
|
3567
3594
|
const textAppearanceClasses = {
|
|
3568
3595
|
default: "text-(--text-color-default)",
|
|
3569
3596
|
primary: "text-(--text-color-primary)",
|
|
@@ -3578,7 +3605,6 @@ const textAppearanceClasses = {
|
|
|
3578
3605
|
info: "text-(--text-color-info)",
|
|
3579
3606
|
transparent: "text-transparent",
|
|
3580
3607
|
};
|
|
3581
|
-
// Text size classes
|
|
3582
3608
|
const textSizeClasses = {
|
|
3583
3609
|
xs: "text-xs",
|
|
3584
3610
|
sm: "text-sm",
|
|
@@ -3587,59 +3613,6 @@ const textSizeClasses = {
|
|
|
3587
3613
|
xl: "text-xl",
|
|
3588
3614
|
};
|
|
3589
3615
|
|
|
3590
|
-
class TextAppearanceTheme extends BaseTheme {
|
|
3591
|
-
constructor(initialOverrides) {
|
|
3592
|
-
super();
|
|
3593
|
-
TEXT_APPEARANCE_KEYS.forEach((textKey) => {
|
|
3594
|
-
const defaultModesForKey = TextAppearanceTheme.defaultFullConfig[textKey];
|
|
3595
|
-
const overrideModesForKey = initialOverrides === null || initialOverrides === void 0 ? void 0 : initialOverrides[textKey];
|
|
3596
|
-
this[textKey] = {
|
|
3597
|
-
...defaultModesForKey,
|
|
3598
|
-
...(overrideModesForKey || {}),
|
|
3599
|
-
};
|
|
3600
|
-
});
|
|
3601
|
-
}
|
|
3602
|
-
getClasses(props, defaults) {
|
|
3603
|
-
const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, TEXT_APPEARANCE_KEYS) || 'default';
|
|
3604
|
-
const modesForAppearance = this[pickedAppearanceKey];
|
|
3605
|
-
if (!modesForAppearance) {
|
|
3606
|
-
return MODE_KEYS.map(() => '');
|
|
3607
|
-
}
|
|
3608
|
-
return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
|
|
3609
|
-
}
|
|
3610
|
-
static createDefaultStyle(src = {}) {
|
|
3611
|
-
const initialOverridesForConstructor = {};
|
|
3612
|
-
TEXT_APPEARANCE_KEYS.forEach((textKey) => {
|
|
3613
|
-
const modesForCurrentTextKey = {};
|
|
3614
|
-
let keyHasDataInSrc = false;
|
|
3615
|
-
MODE_KEYS.forEach((modeKey) => {
|
|
3616
|
-
var _a;
|
|
3617
|
-
const classValue = (_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey];
|
|
3618
|
-
if (classValue !== undefined) {
|
|
3619
|
-
modesForCurrentTextKey[modeKey] = classValue;
|
|
3620
|
-
keyHasDataInSrc = true;
|
|
3621
|
-
}
|
|
3622
|
-
});
|
|
3623
|
-
if (keyHasDataInSrc) {
|
|
3624
|
-
initialOverridesForConstructor[textKey] = modesForCurrentTextKey;
|
|
3625
|
-
}
|
|
3626
|
-
});
|
|
3627
|
-
return new TextAppearanceTheme(initialOverridesForConstructor);
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
TextAppearanceTheme.defaultFullConfig = (() => {
|
|
3631
|
-
const config = {};
|
|
3632
|
-
TEXT_APPEARANCE_KEYS.forEach((key) => {
|
|
3633
|
-
config[key] = {
|
|
3634
|
-
base: textAppearanceClasses[key] || '',
|
|
3635
|
-
hover: '',
|
|
3636
|
-
active: '',
|
|
3637
|
-
};
|
|
3638
|
-
});
|
|
3639
|
-
return config;
|
|
3640
|
-
})();
|
|
3641
|
-
|
|
3642
|
-
// Background classes for filled buttons
|
|
3643
3616
|
const filledBackgroundAppearanceClasses = {
|
|
3644
3617
|
default: "bg-(--filled-background-color-default)",
|
|
3645
3618
|
primary: "bg-(--filled-background-color-primary)",
|
|
@@ -3651,10 +3624,7 @@ const filledBackgroundAppearanceClasses = {
|
|
|
3651
3624
|
warning: "bg-(--filled-background-color-warning)",
|
|
3652
3625
|
info: "bg-(--filled-background-color-info)",
|
|
3653
3626
|
transparent: "bg-transparent",
|
|
3654
|
-
muted: "bg-(--filled-background-color-muted)",
|
|
3655
|
-
link: "bg-(--filled-background-color-link)",
|
|
3656
3627
|
};
|
|
3657
|
-
// Hover background classes for filled buttons
|
|
3658
3628
|
const filledHoverBackgroundAppearanceClasses = {
|
|
3659
3629
|
default: "hover:bg-(--filled-background-color-hover-default)",
|
|
3660
3630
|
primary: "hover:bg-(--filled-background-color-hover-primary)",
|
|
@@ -3666,10 +3636,7 @@ const filledHoverBackgroundAppearanceClasses = {
|
|
|
3666
3636
|
warning: "hover:bg-(--filled-background-color-hover-warning)",
|
|
3667
3637
|
info: "hover:bg-(--filled-background-color-hover-info)",
|
|
3668
3638
|
transparent: "hover:bg-transparent",
|
|
3669
|
-
muted: "hover:bg-(--filled-background-color-hover-muted)",
|
|
3670
|
-
link: "hover:bg-(--filled-background-color-hover-link)",
|
|
3671
3639
|
};
|
|
3672
|
-
// Active background classes for filled buttons
|
|
3673
3640
|
const filledActiveBackgroundAppearanceClasses = {
|
|
3674
3641
|
default: "active:bg-(--filled-background-color-active-default)",
|
|
3675
3642
|
primary: "active:bg-(--filled-background-color-active-primary)",
|
|
@@ -3681,10 +3648,7 @@ const filledActiveBackgroundAppearanceClasses = {
|
|
|
3681
3648
|
warning: "active:bg-(--filled-background-color-active-warning)",
|
|
3682
3649
|
info: "active:bg-(--filled-background-color-active-info)",
|
|
3683
3650
|
transparent: "active:bg-transparent",
|
|
3684
|
-
muted: "active:bg-(--filled-background-color-active-muted)",
|
|
3685
|
-
link: "active:bg-(--filled-background-color-active-link)",
|
|
3686
3651
|
};
|
|
3687
|
-
// Default background appearance classes (for non-button components)
|
|
3688
3652
|
const backgroundAppearanceClasses = {
|
|
3689
3653
|
default: "bg-(--background-color-default)",
|
|
3690
3654
|
primary: "bg-(--background-color-primary)",
|
|
@@ -3696,10 +3660,7 @@ const backgroundAppearanceClasses = {
|
|
|
3696
3660
|
warning: "bg-(--background-color-warning)",
|
|
3697
3661
|
info: "bg-(--background-color-info)",
|
|
3698
3662
|
transparent: "bg-transparent",
|
|
3699
|
-
muted: "bg-(--background-color-muted)",
|
|
3700
|
-
link: "bg-(--background-color-link)",
|
|
3701
3663
|
};
|
|
3702
|
-
// Hover background appearance classes for outline buttons
|
|
3703
3664
|
const hoverBackgroundAppearanceClasses = {
|
|
3704
3665
|
default: "hover:bg-(--background-color-hover-default)",
|
|
3705
3666
|
primary: "hover:bg-(--background-color-hover-primary)",
|
|
@@ -3711,10 +3672,7 @@ const hoverBackgroundAppearanceClasses = {
|
|
|
3711
3672
|
warning: "hover:bg-(--background-color-hover-warning)",
|
|
3712
3673
|
info: "hover:bg-(--background-color-hover-info)",
|
|
3713
3674
|
transparent: "hover:bg-transparent",
|
|
3714
|
-
muted: "hover:bg-(--background-color-hover-muted)",
|
|
3715
|
-
link: "hover:bg-(--background-color-hover-link)",
|
|
3716
3675
|
};
|
|
3717
|
-
// Active background appearance classes for outline buttons
|
|
3718
3676
|
const activeBackgroundAppearanceClasses = {
|
|
3719
3677
|
default: "active:bg-(--background-color-active-default)",
|
|
3720
3678
|
primary: "active:bg-(--background-color-active-primary)",
|
|
@@ -3726,8 +3684,6 @@ const activeBackgroundAppearanceClasses = {
|
|
|
3726
3684
|
warning: "active:bg-(--background-color-active-warning)",
|
|
3727
3685
|
info: "active:bg-(--background-color-active-info)",
|
|
3728
3686
|
transparent: "active:bg-transparent",
|
|
3729
|
-
muted: "active:bg-(--background-color-active-muted)",
|
|
3730
|
-
link: "active:bg-(--background-color-active-link)",
|
|
3731
3687
|
};
|
|
3732
3688
|
const layoutBackgroundAppearanceClasses = {
|
|
3733
3689
|
default: "bg-(--layout-background-default)",
|
|
@@ -3751,9 +3707,9 @@ const bgBorderAppearanceClasses = {
|
|
|
3751
3707
|
danger: "bg-(--border-color-danger)",
|
|
3752
3708
|
warning: "bg-(--border-color-warning)",
|
|
3753
3709
|
info: "bg-(--border-color-info)",
|
|
3754
|
-
transparent: "bg-transparent",
|
|
3755
3710
|
muted: "bg-(--border-color-muted)",
|
|
3756
3711
|
link: "bg-(--border-color-link)",
|
|
3712
|
+
transparent: "bg-transparent",
|
|
3757
3713
|
};
|
|
3758
3714
|
const borderAppearanceClasses = {
|
|
3759
3715
|
default: "border-(--border-color-default)",
|
|
@@ -3765,11 +3721,10 @@ const borderAppearanceClasses = {
|
|
|
3765
3721
|
danger: "border-(--border-color-danger)",
|
|
3766
3722
|
warning: "border-(--border-color-warning)",
|
|
3767
3723
|
info: "border-(--border-color-info)",
|
|
3768
|
-
transparent: "border-transparent",
|
|
3769
3724
|
muted: "border-(--border-color-muted)",
|
|
3770
3725
|
link: "border-(--border-color-link)",
|
|
3726
|
+
transparent: "border-transparent",
|
|
3771
3727
|
};
|
|
3772
|
-
// Border classes for filled elements
|
|
3773
3728
|
const filledBorderAppearanceClasses = {
|
|
3774
3729
|
default: "border-(--filled-border-color-default)",
|
|
3775
3730
|
primary: "border-(--filled-border-color-primary)",
|
|
@@ -3780,9 +3735,9 @@ const filledBorderAppearanceClasses = {
|
|
|
3780
3735
|
danger: "border-(--filled-border-color-danger)",
|
|
3781
3736
|
warning: "border-(--filled-border-color-warning)",
|
|
3782
3737
|
info: "border-(--filled-border-color-info)",
|
|
3783
|
-
transparent: "border-transparent",
|
|
3784
3738
|
muted: "border-(--filled-border-color-muted)",
|
|
3785
3739
|
link: "border-(--filled-border-color-link)",
|
|
3740
|
+
transparent: "border-transparent",
|
|
3786
3741
|
};
|
|
3787
3742
|
const ringAppearanceClasses = {
|
|
3788
3743
|
default: "ring-(--border-color-default)",
|
|
@@ -3794,11 +3749,10 @@ const ringAppearanceClasses = {
|
|
|
3794
3749
|
danger: "ring-(--border-color-danger)",
|
|
3795
3750
|
warning: "ring-(--border-color-warning)",
|
|
3796
3751
|
info: "ring-(--border-color-info)",
|
|
3797
|
-
transparent: "ring-transparent",
|
|
3798
3752
|
muted: "ring-(--border-color-muted)",
|
|
3799
3753
|
link: "ring-(--border-color-link)",
|
|
3754
|
+
transparent: "ring-transparent",
|
|
3800
3755
|
};
|
|
3801
|
-
// Ring classes for filled elements
|
|
3802
3756
|
const filledRingAppearanceClasses = {
|
|
3803
3757
|
default: "ring-(--filled-border-color-default)",
|
|
3804
3758
|
primary: "ring-(--filled-border-color-primary)",
|
|
@@ -3809,70 +3763,75 @@ const filledRingAppearanceClasses = {
|
|
|
3809
3763
|
danger: "ring-(--filled-border-color-danger)",
|
|
3810
3764
|
warning: "ring-(--filled-border-color-warning)",
|
|
3811
3765
|
info: "ring-(--filled-border-color-info)",
|
|
3812
|
-
transparent: "ring-transparent",
|
|
3813
3766
|
muted: "ring-(--filled-border-color-muted)",
|
|
3814
3767
|
link: "ring-(--filled-border-color-link)",
|
|
3768
|
+
transparent: "ring-transparent",
|
|
3815
3769
|
};
|
|
3816
3770
|
|
|
3817
|
-
class
|
|
3818
|
-
constructor(variantInstances
|
|
3771
|
+
class GenericVariantTheme extends BaseTheme {
|
|
3772
|
+
constructor(variantInstances) {
|
|
3819
3773
|
super();
|
|
3820
3774
|
VARIANT_KEYS.forEach((variantKey) => {
|
|
3821
|
-
this[variantKey] = variantInstances[variantKey]
|
|
3775
|
+
this[variantKey] = variantInstances[variantKey];
|
|
3822
3776
|
});
|
|
3823
3777
|
}
|
|
3824
3778
|
getClasses(props, defaults) {
|
|
3825
|
-
const
|
|
3826
|
-
const activeTextAppearanceTheme = this[
|
|
3779
|
+
const variantKey = pickFirstTruthyKey(props, defaults, VARIANT_KEYS) || 'outline';
|
|
3780
|
+
const activeTextAppearanceTheme = this[variantKey];
|
|
3827
3781
|
if (!activeTextAppearanceTheme) {
|
|
3828
3782
|
return [];
|
|
3829
3783
|
}
|
|
3830
3784
|
return activeTextAppearanceTheme.getClasses(props, defaults);
|
|
3831
3785
|
}
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3786
|
+
// used for button, bages, chips, etc
|
|
3787
|
+
static createUIElementTextTheme() {
|
|
3788
|
+
//transparent UI elements have a default text color
|
|
3789
|
+
return new GenericVariantTheme({
|
|
3790
|
+
outline: TextAppearanceTheme.createTheme({
|
|
3791
|
+
base: { ...textAppearanceClasses, transparent: textAppearanceClasses.default }
|
|
3792
|
+
}),
|
|
3793
|
+
filled: TextAppearanceTheme.createTheme({
|
|
3794
|
+
base: { ...filledTextAppearanceClasses, transparent: textAppearanceClasses.default }
|
|
3795
|
+
})
|
|
3796
|
+
});
|
|
3797
|
+
}
|
|
3798
|
+
static createBorderAppearanceTheme() {
|
|
3799
|
+
return new GenericVariantTheme({
|
|
3800
|
+
outline: TextAppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
3801
|
+
filled: TextAppearanceTheme.createTheme({ base: filledBorderAppearanceClasses })
|
|
3802
|
+
});
|
|
3838
3803
|
}
|
|
3839
|
-
static
|
|
3840
|
-
return
|
|
3841
|
-
outline: TextAppearanceTheme.
|
|
3804
|
+
static createRingAppearanceTheme() {
|
|
3805
|
+
return new GenericVariantTheme({
|
|
3806
|
+
outline: TextAppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
3807
|
+
filled: TextAppearanceTheme.createTheme({ base: filledRingAppearanceClasses })
|
|
3808
|
+
});
|
|
3809
|
+
}
|
|
3810
|
+
static createBgAppearanceTheme() {
|
|
3811
|
+
return new GenericVariantTheme({
|
|
3812
|
+
outline: TextAppearanceTheme.createTheme({
|
|
3842
3813
|
base: backgroundAppearanceClasses,
|
|
3843
3814
|
hover: hoverBackgroundAppearanceClasses,
|
|
3844
3815
|
active: activeBackgroundAppearanceClasses
|
|
3845
3816
|
}),
|
|
3846
|
-
filled: TextAppearanceTheme.
|
|
3817
|
+
filled: TextAppearanceTheme.createTheme({
|
|
3847
3818
|
base: filledBackgroundAppearanceClasses,
|
|
3848
3819
|
hover: filledHoverBackgroundAppearanceClasses,
|
|
3849
3820
|
active: filledActiveBackgroundAppearanceClasses
|
|
3850
3821
|
})
|
|
3851
3822
|
});
|
|
3852
3823
|
}
|
|
3853
|
-
static
|
|
3854
|
-
return
|
|
3855
|
-
outline: TextAppearanceTheme.
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
outline: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
3862
|
-
filled: TextAppearanceTheme.createDefaultStyle({ base: filledBorderAppearanceClasses })
|
|
3863
|
-
});
|
|
3864
|
-
}
|
|
3865
|
-
static createDefaultRing() {
|
|
3866
|
-
return this.createDefault({
|
|
3867
|
-
outline: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
3868
|
-
filled: TextAppearanceTheme.createDefaultStyle({ base: filledRingAppearanceClasses })
|
|
3824
|
+
static createSimpleBgAppearanceTheme() {
|
|
3825
|
+
return new GenericVariantTheme({
|
|
3826
|
+
outline: TextAppearanceTheme.createTheme({
|
|
3827
|
+
base: backgroundAppearanceClasses,
|
|
3828
|
+
}),
|
|
3829
|
+
filled: TextAppearanceTheme.createTheme({
|
|
3830
|
+
base: filledBackgroundAppearanceClasses,
|
|
3831
|
+
})
|
|
3869
3832
|
});
|
|
3870
3833
|
}
|
|
3871
3834
|
}
|
|
3872
|
-
VariantTheme.defaultInstances = Object.fromEntries(VARIANT_KEYS.map(variantKey => [
|
|
3873
|
-
variantKey,
|
|
3874
|
-
new TextAppearanceTheme()
|
|
3875
|
-
]));
|
|
3876
3835
|
|
|
3877
3836
|
const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-pointer transition-all duration-200 whitespace-nowrap", {
|
|
3878
3837
|
size: {
|
|
@@ -3913,10 +3872,10 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
3913
3872
|
shadow: new ShadowTheme(),
|
|
3914
3873
|
},
|
|
3915
3874
|
appearance: {
|
|
3916
|
-
background:
|
|
3917
|
-
text:
|
|
3918
|
-
border:
|
|
3919
|
-
ring:
|
|
3875
|
+
background: GenericVariantTheme.createBgAppearanceTheme(),
|
|
3876
|
+
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
3877
|
+
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
3878
|
+
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
3920
3879
|
},
|
|
3921
3880
|
layout: {
|
|
3922
3881
|
border: new BorderTheme(),
|
|
@@ -3988,17 +3947,10 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
3988
3947
|
shadow: new ShadowTheme(),
|
|
3989
3948
|
},
|
|
3990
3949
|
appearance: {
|
|
3991
|
-
background:
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
filled: TextAppearanceTheme.createDefaultStyle({
|
|
3996
|
-
base: filledBackgroundAppearanceClasses,
|
|
3997
|
-
})
|
|
3998
|
-
}),
|
|
3999
|
-
text: VariantTheme.createDefaultText(),
|
|
4000
|
-
border: VariantTheme.createDefaultBorder(),
|
|
4001
|
-
ring: VariantTheme.createDefaultRing(),
|
|
3950
|
+
background: GenericVariantTheme.createSimpleBgAppearanceTheme(),
|
|
3951
|
+
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
3952
|
+
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
3953
|
+
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
4002
3954
|
},
|
|
4003
3955
|
layout: {
|
|
4004
3956
|
border: new BorderTheme(),
|
|
@@ -4067,17 +4019,10 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4067
4019
|
shadow: new ShadowTheme(),
|
|
4068
4020
|
},
|
|
4069
4021
|
appearance: {
|
|
4070
|
-
background:
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
filled: TextAppearanceTheme.createDefaultStyle({
|
|
4075
|
-
base: filledBackgroundAppearanceClasses,
|
|
4076
|
-
})
|
|
4077
|
-
}),
|
|
4078
|
-
text: VariantTheme.createDefaultText(),
|
|
4079
|
-
border: VariantTheme.createDefaultBorder(),
|
|
4080
|
-
ring: VariantTheme.createDefaultRing(),
|
|
4022
|
+
background: GenericVariantTheme.createSimpleBgAppearanceTheme(),
|
|
4023
|
+
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4024
|
+
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
4025
|
+
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
4081
4026
|
},
|
|
4082
4027
|
layout: {
|
|
4083
4028
|
radius: new RadiusTheme({
|
|
@@ -4119,7 +4064,7 @@ const createTypographyComponentTheme = (tag, base = "text-balance", textSizeMap
|
|
|
4119
4064
|
text: new SizeTheme(textSizeMap),
|
|
4120
4065
|
},
|
|
4121
4066
|
appearance: {
|
|
4122
|
-
text: TextAppearanceTheme.
|
|
4067
|
+
text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4123
4068
|
}
|
|
4124
4069
|
}, defaults);
|
|
4125
4070
|
};
|
|
@@ -4213,57 +4158,26 @@ const commonGaps = {
|
|
|
4213
4158
|
xl: 'gap-6',
|
|
4214
4159
|
};
|
|
4215
4160
|
|
|
4216
|
-
class
|
|
4217
|
-
constructor(
|
|
4161
|
+
class BgAppearanceTheme extends BaseTheme {
|
|
4162
|
+
constructor() {
|
|
4218
4163
|
super();
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
...(overrideModesForKey || {}),
|
|
4164
|
+
BG_APPEARANCE_KEYS.forEach(key => {
|
|
4165
|
+
this[key] = {
|
|
4166
|
+
base: layoutBackgroundAppearanceClasses[key] || '',
|
|
4167
|
+
hover: '',
|
|
4168
|
+
active: '',
|
|
4225
4169
|
};
|
|
4226
4170
|
});
|
|
4227
4171
|
}
|
|
4228
4172
|
getClasses(props, defaults) {
|
|
4229
|
-
const pickedAppearanceKey = pickFirstTruthyKey(props, defaults,
|
|
4173
|
+
const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, BG_APPEARANCE_KEYS) || 'default';
|
|
4230
4174
|
const modesForAppearance = this[pickedAppearanceKey];
|
|
4231
4175
|
if (!modesForAppearance) {
|
|
4232
4176
|
return MODE_KEYS.map(() => '');
|
|
4233
4177
|
}
|
|
4234
4178
|
return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
|
|
4235
4179
|
}
|
|
4236
|
-
static createDefaultStyle(src = {}) {
|
|
4237
|
-
const initialOverridesForConstructor = {};
|
|
4238
|
-
APPEARANCE_KEYS.forEach((textKey) => {
|
|
4239
|
-
const modesForCurrentTextKey = {};
|
|
4240
|
-
let keyHasDataInSrc = false;
|
|
4241
|
-
MODE_KEYS.forEach((modeKey) => {
|
|
4242
|
-
var _a;
|
|
4243
|
-
const classValue = (_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey];
|
|
4244
|
-
if (classValue !== undefined) {
|
|
4245
|
-
modesForCurrentTextKey[modeKey] = classValue;
|
|
4246
|
-
keyHasDataInSrc = true;
|
|
4247
|
-
}
|
|
4248
|
-
});
|
|
4249
|
-
if (keyHasDataInSrc) {
|
|
4250
|
-
initialOverridesForConstructor[textKey] = modesForCurrentTextKey;
|
|
4251
|
-
}
|
|
4252
|
-
});
|
|
4253
|
-
return new LayoutAppearanceTheme(initialOverridesForConstructor);
|
|
4254
|
-
}
|
|
4255
4180
|
}
|
|
4256
|
-
LayoutAppearanceTheme.defaultFullConfig = (() => {
|
|
4257
|
-
const config = {};
|
|
4258
|
-
APPEARANCE_KEYS.forEach((key) => {
|
|
4259
|
-
config[key] = {
|
|
4260
|
-
base: textAppearanceClasses[key] || '',
|
|
4261
|
-
hover: '',
|
|
4262
|
-
active: '',
|
|
4263
|
-
};
|
|
4264
|
-
});
|
|
4265
|
-
return config;
|
|
4266
|
-
})();
|
|
4267
4181
|
|
|
4268
4182
|
class BreakpointTheme extends BaseTheme {
|
|
4269
4183
|
constructor(initial) {
|
|
@@ -4328,12 +4242,10 @@ const defaultCardTheme = new ComponentTheme("div", "overflow-hidden", {
|
|
|
4328
4242
|
breakpoint: new BreakpointTheme(),
|
|
4329
4243
|
},
|
|
4330
4244
|
appearance: {
|
|
4331
|
-
background:
|
|
4332
|
-
|
|
4333
|
-
}),
|
|
4334
|
-
|
|
4335
|
-
border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
4336
|
-
ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
4245
|
+
background: new BgAppearanceTheme(),
|
|
4246
|
+
text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4247
|
+
border: TextAppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4248
|
+
ring: TextAppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4337
4249
|
}
|
|
4338
4250
|
}, {
|
|
4339
4251
|
md: true,
|
|
@@ -4365,7 +4277,7 @@ const defaultRowTheme = new ComponentTheme("div", "flex-row", {
|
|
|
4365
4277
|
|
|
4366
4278
|
const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
|
|
4367
4279
|
appearance: {
|
|
4368
|
-
background: TextAppearanceTheme.
|
|
4280
|
+
background: TextAppearanceTheme.createTheme({
|
|
4369
4281
|
base: bgBorderAppearanceClasses,
|
|
4370
4282
|
}),
|
|
4371
4283
|
}
|
|
@@ -4409,12 +4321,10 @@ const defaultContainerTheme = new ComponentTheme("div", "flex-col mx-auto w-full
|
|
|
4409
4321
|
}),
|
|
4410
4322
|
},
|
|
4411
4323
|
appearance: {
|
|
4412
|
-
background:
|
|
4413
|
-
|
|
4414
|
-
}),
|
|
4415
|
-
|
|
4416
|
-
border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
4417
|
-
ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
4324
|
+
background: new BgAppearanceTheme(),
|
|
4325
|
+
text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4326
|
+
border: TextAppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4327
|
+
ring: TextAppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4418
4328
|
}
|
|
4419
4329
|
}, {
|
|
4420
4330
|
transparent: true,
|
|
@@ -4511,12 +4421,10 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
|
|
|
4511
4421
|
shadow: new ShadowTheme(),
|
|
4512
4422
|
},
|
|
4513
4423
|
appearance: {
|
|
4514
|
-
background:
|
|
4515
|
-
|
|
4516
|
-
}),
|
|
4517
|
-
|
|
4518
|
-
border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
4519
|
-
ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
4424
|
+
background: new BgAppearanceTheme(),
|
|
4425
|
+
text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4426
|
+
border: TextAppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4427
|
+
ring: TextAppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4520
4428
|
},
|
|
4521
4429
|
layout: {
|
|
4522
4430
|
wrap: new WrapTheme(),
|
|
@@ -4715,9 +4623,9 @@ const List = (props) => {
|
|
|
4715
4623
|
return jsxRuntime.jsx(ThemedComponent, { theme: theme.list, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
|
|
4716
4624
|
};
|
|
4717
4625
|
|
|
4718
|
-
exports.APPEARANCE_KEYS = APPEARANCE_KEYS;
|
|
4719
4626
|
exports.BADGE_KEYS = BADGE_KEYS;
|
|
4720
4627
|
exports.BASE_COMPONENT_KEYS = BASE_COMPONENT_KEYS;
|
|
4628
|
+
exports.BG_APPEARANCE_KEYS = BG_APPEARANCE_KEYS;
|
|
4721
4629
|
exports.BORDER_KEYS = BORDER_KEYS;
|
|
4722
4630
|
exports.BREAKPOINT_KEYS = BREAKPOINT_KEYS;
|
|
4723
4631
|
exports.BUTTON_KEYS = BUTTON_KEYS;
|