@vaneui/ui 0.1.5 → 0.1.7
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/themeContext.d.ts +19 -19
- package/dist/components/ui/props/keys.d.ts +15 -14
- package/dist/components/ui/theme/appearance/genericVariantTheme.d.ts +2 -0
- package/dist/components/ui/theme/appearance/shadowAppearanceTheme.d.ts +10 -0
- package/dist/components/ui/theme/badgeTheme.d.ts +6 -6
- package/dist/components/ui/theme/buttonTheme.d.ts +6 -6
- package/dist/components/ui/theme/cardTheme.d.ts +5 -5
- package/dist/components/ui/theme/chipTheme.d.ts +6 -6
- package/dist/components/ui/theme/colTheme.d.ts +3 -3
- package/dist/components/ui/theme/common/ComponentTheme.d.ts +12 -6
- package/dist/components/ui/theme/containerTheme.d.ts +3 -3
- package/dist/components/ui/theme/dividerTheme.d.ts +2 -2
- package/dist/components/ui/theme/gridTheme.d.ts +3 -3
- package/dist/components/ui/theme/layout/displayTheme.d.ts +1 -1
- package/dist/components/ui/theme/layout/overflowTheme.d.ts +9 -0
- package/dist/components/ui/theme/rowTheme.d.ts +3 -3
- package/dist/components/ui/theme/sectionTheme.d.ts +5 -5
- package/dist/components/ui/theme/stackTheme.d.ts +3 -3
- package/dist/components/ui/theme/typographyComponentTheme.d.ts +11 -11
- package/dist/index.esm.js +192 -161
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +192 -160
- package/dist/index.js.map +1 -1
- package/dist/ui.css +77 -48
- package/package.json +2 -2
- package/dist/components/ui/theme/layout/shadowTheme.d.ts +0 -9
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SizeKey } from "../props/keys";
|
|
2
1
|
import { TypographyComponentProps } from "../props/props";
|
|
3
2
|
import React from "react";
|
|
4
|
-
import {
|
|
3
|
+
import { BaseTypographyComponentTheme, ComponentTheme } from "./common/ComponentTheme";
|
|
5
4
|
import { SizeTheme } from "./size/sizeTheme";
|
|
6
5
|
import { TextAppearanceTheme } from "./appearance/textAppearanceTheme";
|
|
7
|
-
|
|
6
|
+
import { SizeKey } from "../props";
|
|
7
|
+
export interface TypographyComponentTheme extends BaseTypographyComponentTheme {
|
|
8
8
|
size: {
|
|
9
9
|
text: SizeTheme;
|
|
10
10
|
};
|
|
@@ -12,11 +12,11 @@ export interface TypographyComponentTheme<P> extends BaseComponentTheme<P> {
|
|
|
12
12
|
text: TextAppearanceTheme;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
export declare const createTypographyComponentTheme: (tag: React.ReactNode | string | any, base?: string, textSizeMap?: Record<SizeKey, string>, defaults?: Partial<TypographyComponentProps>) => ComponentTheme<TypographyComponentProps, TypographyComponentTheme
|
|
16
|
-
export declare const pageTitleTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme
|
|
17
|
-
export declare const sectionTitleTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme
|
|
18
|
-
export declare const titleTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme
|
|
19
|
-
export declare const textTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme
|
|
20
|
-
export declare const linkTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme
|
|
21
|
-
export declare const listItemTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme
|
|
22
|
-
export declare const listTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme
|
|
15
|
+
export declare const createTypographyComponentTheme: (tag: React.ReactNode | string | any, base?: string, textSizeMap?: Record<SizeKey, string>, defaults?: Partial<TypographyComponentProps>) => ComponentTheme<TypographyComponentProps, TypographyComponentTheme>;
|
|
16
|
+
export declare const pageTitleTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme>;
|
|
17
|
+
export declare const sectionTitleTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme>;
|
|
18
|
+
export declare const titleTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme>;
|
|
19
|
+
export declare const textTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme>;
|
|
20
|
+
export declare const linkTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme>;
|
|
21
|
+
export declare const listItemTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme>;
|
|
22
|
+
export declare const listTheme: ComponentTheme<TypographyComponentProps, TypographyComponentTheme>;
|
package/dist/index.esm.js
CHANGED
|
@@ -38,6 +38,7 @@ const ITEMS_KEYS = ['itemsStart', 'itemsEnd', 'itemsCenter', 'itemsBaseline', 'i
|
|
|
38
38
|
const JUSTIFY_KEYS = ['justifyStart', 'justifyEnd', 'justifyCenter', 'justifyBetween', 'justifyAround', 'justifyEvenly', 'justifyStretch', 'justifyBaseline'];
|
|
39
39
|
const WRAP_KEYS = ['flexWrap', 'flexNoWrap', 'flexWrapReverse'];
|
|
40
40
|
const DISPLAY_KEYS = ['inline', 'block', 'inlineBlock', 'flex', 'inlineFlex', 'grid', 'inlineGrid', 'contents', 'table', 'tableCell', 'hidden'];
|
|
41
|
+
const OVERFLOW_KEYS = ['overflowAuto', 'overflowHidden', 'overflowClip', 'overflowVisible', 'overflowScroll', 'overflowXAuto', 'overflowYAuto', 'overflowXHidden', 'overflowYHidden', 'overflowXClip', 'overflowYClip', 'overflowXVisible', 'overflowYVisible', 'overflowXScroll', 'overflowYScroll'];
|
|
41
42
|
// A master list of all groups where only one key can be 'true' at a time.
|
|
42
43
|
const EXCLUSIVE_KEY_GROUPS = [
|
|
43
44
|
MODE_KEYS,
|
|
@@ -74,7 +75,8 @@ const BASE_COMPONENT_KEYS = [
|
|
|
74
75
|
...ITEMS_KEYS,
|
|
75
76
|
...JUSTIFY_KEYS,
|
|
76
77
|
...POSITION_KEYS,
|
|
77
|
-
...DISPLAY_KEYS
|
|
78
|
+
...DISPLAY_KEYS,
|
|
79
|
+
...OVERFLOW_KEYS,
|
|
78
80
|
];
|
|
79
81
|
// Font keys
|
|
80
82
|
const FONT_KEYS = [
|
|
@@ -437,75 +439,6 @@ TextAlignTheme.defaultClasses = {
|
|
|
437
439
|
textJustify: "text-justify",
|
|
438
440
|
};
|
|
439
441
|
|
|
440
|
-
const isObject = (item) => {
|
|
441
|
-
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
442
|
-
};
|
|
443
|
-
const deepMerge = (target, source) => {
|
|
444
|
-
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
445
|
-
for (const key in source) {
|
|
446
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
447
|
-
const sourceValue = source[key];
|
|
448
|
-
const targetValue = output[key];
|
|
449
|
-
if (sourceValue === undefined) {
|
|
450
|
-
continue;
|
|
451
|
-
}
|
|
452
|
-
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
453
|
-
if (key === 'defaults' &&
|
|
454
|
-
isObject(targetValue) &&
|
|
455
|
-
isObject(sourceValue)) {
|
|
456
|
-
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
457
|
-
}
|
|
458
|
-
// For all other objects, use the standard recursive deep merge.
|
|
459
|
-
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
460
|
-
output[key] = deepMerge(targetValue, sourceValue);
|
|
461
|
-
}
|
|
462
|
-
// For non-object values, just assign the value from the source.
|
|
463
|
-
else {
|
|
464
|
-
output[key] = sourceValue;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return output;
|
|
469
|
-
};
|
|
470
|
-
const deepClone = (source) => {
|
|
471
|
-
if (!isObject(source)) {
|
|
472
|
-
return source;
|
|
473
|
-
}
|
|
474
|
-
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
475
|
-
for (const key in output) {
|
|
476
|
-
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
477
|
-
output[key] = deepClone(output[key]);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return output;
|
|
481
|
-
};
|
|
482
|
-
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
483
|
-
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
484
|
-
const finalDefaults = { ...baseDefaults };
|
|
485
|
-
// Iterate over the override keys to apply them.
|
|
486
|
-
for (const key in overrideDefaults) {
|
|
487
|
-
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
488
|
-
const overrideValue = overrideDefaults[key];
|
|
489
|
-
// If the override is setting a key to true...
|
|
490
|
-
if (overrideValue) {
|
|
491
|
-
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
492
|
-
const group = findGroup(key);
|
|
493
|
-
// If the key is part of an exclusive group...
|
|
494
|
-
if (group) {
|
|
495
|
-
// ...set all other keys in that group to false.
|
|
496
|
-
group.forEach(groupKey => {
|
|
497
|
-
if (groupKey !== key) {
|
|
498
|
-
finalDefaults[groupKey] = false;
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
finalDefaults[key] = overrideValue;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return finalDefaults;
|
|
507
|
-
};
|
|
508
|
-
|
|
509
442
|
class DisplayTheme extends BaseTheme {
|
|
510
443
|
constructor(initialConfig) {
|
|
511
444
|
super();
|
|
@@ -515,8 +448,8 @@ class DisplayTheme extends BaseTheme {
|
|
|
515
448
|
});
|
|
516
449
|
}
|
|
517
450
|
getClasses(props, defaults) {
|
|
518
|
-
const
|
|
519
|
-
return [
|
|
451
|
+
const key = pickFirstTruthyKey(props, defaults, DISPLAY_KEYS);
|
|
452
|
+
return [key && this[key] ? this[key] : ''];
|
|
520
453
|
}
|
|
521
454
|
}
|
|
522
455
|
DisplayTheme.defaultClasses = {
|
|
@@ -3244,29 +3177,59 @@ const getDefaultConfig = () => {
|
|
|
3244
3177
|
};
|
|
3245
3178
|
const twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
|
|
3246
3179
|
|
|
3180
|
+
class OverflowTheme extends BaseTheme {
|
|
3181
|
+
constructor(initialConfig) {
|
|
3182
|
+
super();
|
|
3183
|
+
OVERFLOW_KEYS.forEach((key) => {
|
|
3184
|
+
var _a;
|
|
3185
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : OverflowTheme.defaultClasses[key];
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
getClasses(props, defaults) {
|
|
3189
|
+
const key = pickFirstTruthyKey(props, defaults, OVERFLOW_KEYS);
|
|
3190
|
+
return [key && this[key] ? this[key] : ''];
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
OverflowTheme.defaultClasses = {
|
|
3194
|
+
overflowAuto: 'overflow-auto',
|
|
3195
|
+
overflowHidden: 'overflow-hidden',
|
|
3196
|
+
overflowClip: 'overflow-clip',
|
|
3197
|
+
overflowVisible: 'overflow-visible',
|
|
3198
|
+
overflowScroll: 'overflow-scroll',
|
|
3199
|
+
overflowXAuto: 'overflow-x-auto',
|
|
3200
|
+
overflowYAuto: 'overflow-y-auto',
|
|
3201
|
+
overflowXHidden: 'overflow-x-hidden',
|
|
3202
|
+
overflowYHidden: 'overflow-y-hidden',
|
|
3203
|
+
overflowXClip: 'overflow-x-clip',
|
|
3204
|
+
overflowYClip: 'overflow-y-clip',
|
|
3205
|
+
overflowXVisible: 'overflow-x-visible',
|
|
3206
|
+
overflowYVisible: 'overflow-y-visible',
|
|
3207
|
+
overflowXScroll: 'overflow-x-scroll',
|
|
3208
|
+
overflowYScroll: 'overflow-y-scroll',
|
|
3209
|
+
};
|
|
3210
|
+
|
|
3211
|
+
const defaultLayoutTheme = {
|
|
3212
|
+
hide: new HideTheme(),
|
|
3213
|
+
items: new ItemsTheme(),
|
|
3214
|
+
justify: new JustifyTheme(),
|
|
3215
|
+
position: new PositionTheme(),
|
|
3216
|
+
display: new DisplayTheme(),
|
|
3217
|
+
overflow: new OverflowTheme(),
|
|
3218
|
+
};
|
|
3219
|
+
const defaultTypographyTheme = {
|
|
3220
|
+
fontFamily: new FontFamilyTheme(),
|
|
3221
|
+
fontWeight: new FontWeightTheme(),
|
|
3222
|
+
fontStyle: new FontStyleTheme(),
|
|
3223
|
+
textDecoration: new TextDecorationTheme(),
|
|
3224
|
+
textTransform: new TextTransformTheme(),
|
|
3225
|
+
textAlign: new TextAlignTheme()
|
|
3226
|
+
};
|
|
3247
3227
|
class ComponentTheme {
|
|
3248
3228
|
constructor(tag, base, subThemes, defaults = {}) {
|
|
3249
3229
|
this.tag = tag;
|
|
3250
3230
|
this.base = base;
|
|
3251
3231
|
this.defaults = defaults;
|
|
3252
|
-
|
|
3253
|
-
layout: {
|
|
3254
|
-
hide: new HideTheme(),
|
|
3255
|
-
items: new ItemsTheme(),
|
|
3256
|
-
justify: new JustifyTheme(),
|
|
3257
|
-
position: new PositionTheme(),
|
|
3258
|
-
display: new DisplayTheme()
|
|
3259
|
-
},
|
|
3260
|
-
typography: {
|
|
3261
|
-
fontFamily: new FontFamilyTheme(),
|
|
3262
|
-
fontWeight: new FontWeightTheme(),
|
|
3263
|
-
fontStyle: new FontStyleTheme(),
|
|
3264
|
-
textDecoration: new TextDecorationTheme(),
|
|
3265
|
-
textTransform: new TextTransformTheme(),
|
|
3266
|
-
textAlign: new TextAlignTheme()
|
|
3267
|
-
}
|
|
3268
|
-
};
|
|
3269
|
-
this.themes = deepMerge(defaultInternalThemes, subThemes);
|
|
3232
|
+
this.themes = subThemes;
|
|
3270
3233
|
}
|
|
3271
3234
|
getClasses(props, defaults = this.defaults) {
|
|
3272
3235
|
const user = props;
|
|
@@ -3379,57 +3342,6 @@ RadiusTheme.defaultClasses = {
|
|
|
3379
3342
|
}
|
|
3380
3343
|
};
|
|
3381
3344
|
|
|
3382
|
-
class ShadowTheme extends BaseTheme {
|
|
3383
|
-
constructor(initial) {
|
|
3384
|
-
super();
|
|
3385
|
-
SHADOW_KEYS.forEach((key) => {
|
|
3386
|
-
var _a;
|
|
3387
|
-
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : ShadowTheme.defaultClasses[key];
|
|
3388
|
-
});
|
|
3389
|
-
}
|
|
3390
|
-
getClasses(props, defaults) {
|
|
3391
|
-
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3392
|
-
const key = pickFirstTruthyKey(props, defaults, SHADOW_KEYS);
|
|
3393
|
-
if (key === undefined) {
|
|
3394
|
-
return [];
|
|
3395
|
-
}
|
|
3396
|
-
const isModeStringMap = MODE_KEYS.every(m => typeof this[key][m] === "string");
|
|
3397
|
-
return MODE_KEYS.map(mode => isModeStringMap
|
|
3398
|
-
? this[key][mode]
|
|
3399
|
-
: this[key][mode][size]);
|
|
3400
|
-
}
|
|
3401
|
-
}
|
|
3402
|
-
ShadowTheme.defaultClasses = {
|
|
3403
|
-
shadow: {
|
|
3404
|
-
base: {
|
|
3405
|
-
xs: "shadow-2xs",
|
|
3406
|
-
sm: "shadow-xs",
|
|
3407
|
-
md: "shadow-sm",
|
|
3408
|
-
lg: "shadow-md",
|
|
3409
|
-
xl: "shadow-lg"
|
|
3410
|
-
},
|
|
3411
|
-
hover: {
|
|
3412
|
-
xs: "hover:shadow-xs",
|
|
3413
|
-
sm: "hover:shadow-sm",
|
|
3414
|
-
md: "hover:shadow-md",
|
|
3415
|
-
lg: "hover:shadow-lg",
|
|
3416
|
-
xl: "hover:shadow-xl"
|
|
3417
|
-
},
|
|
3418
|
-
active: {
|
|
3419
|
-
xs: "active:shadow-xs",
|
|
3420
|
-
sm: "active:shadow-sm",
|
|
3421
|
-
md: "active:shadow-md",
|
|
3422
|
-
lg: "active:shadow-lg",
|
|
3423
|
-
xl: "active:shadow-xl"
|
|
3424
|
-
},
|
|
3425
|
-
},
|
|
3426
|
-
noShadow: {
|
|
3427
|
-
base: "shadow-none",
|
|
3428
|
-
hover: "hover:shadow-none",
|
|
3429
|
-
active: "active:shadow-none",
|
|
3430
|
-
}
|
|
3431
|
-
};
|
|
3432
|
-
|
|
3433
3345
|
class BorderTheme extends BaseTheme {
|
|
3434
3346
|
constructor(initial) {
|
|
3435
3347
|
super();
|
|
@@ -3766,6 +3678,35 @@ const filledRingAppearanceClasses = {
|
|
|
3766
3678
|
transparent: "ring-transparent",
|
|
3767
3679
|
};
|
|
3768
3680
|
|
|
3681
|
+
class ShadowAppearanceTheme extends BaseTheme {
|
|
3682
|
+
constructor(initial) {
|
|
3683
|
+
super();
|
|
3684
|
+
TEXT_APPEARANCE_KEYS.forEach((key) => {
|
|
3685
|
+
var _a;
|
|
3686
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : ShadowAppearanceTheme.defaultShadow;
|
|
3687
|
+
});
|
|
3688
|
+
}
|
|
3689
|
+
getClasses(props, defaults) {
|
|
3690
|
+
const appearance = pickFirstTruthyKey(props, defaults, TEXT_APPEARANCE_KEYS) || 'default';
|
|
3691
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3692
|
+
const key = pickFirstTruthyKey(props, defaults, SHADOW_KEYS);
|
|
3693
|
+
if (key === undefined || key === 'noShadow') {
|
|
3694
|
+
return [];
|
|
3695
|
+
}
|
|
3696
|
+
return MODE_KEYS.map(mode => { var _a, _b, _c; return (_c = (_b = (_a = this[appearance]) === null || _a === void 0 ? void 0 : _a[size]) === null || _b === void 0 ? void 0 : _b[mode]) !== null && _c !== void 0 ? _c : ""; });
|
|
3697
|
+
}
|
|
3698
|
+
static createTheme(src = {}) {
|
|
3699
|
+
return new ShadowAppearanceTheme(src);
|
|
3700
|
+
}
|
|
3701
|
+
}
|
|
3702
|
+
ShadowAppearanceTheme.defaultShadow = {
|
|
3703
|
+
xs: { base: "shadow-2xs", hover: "hover:shadow-xs", active: "" },
|
|
3704
|
+
sm: { base: "shadow-xs", hover: "hover:shadow-sm", active: "" },
|
|
3705
|
+
md: { base: "shadow-sm", hover: "hover:shadow-md", active: "" },
|
|
3706
|
+
lg: { base: "shadow-md", hover: "hover:shadow-lg", active: "" },
|
|
3707
|
+
xl: { base: "shadow-lg", hover: "hover:shadow-xl", active: "" }
|
|
3708
|
+
};
|
|
3709
|
+
|
|
3769
3710
|
class GenericVariantTheme extends BaseTheme {
|
|
3770
3711
|
constructor(variantInstances) {
|
|
3771
3712
|
super();
|
|
@@ -3793,6 +3734,13 @@ class GenericVariantTheme extends BaseTheme {
|
|
|
3793
3734
|
})
|
|
3794
3735
|
});
|
|
3795
3736
|
}
|
|
3737
|
+
static createUIElementShadowTheme() {
|
|
3738
|
+
//transparent UI elements won't have a shadow
|
|
3739
|
+
return new GenericVariantTheme({
|
|
3740
|
+
outline: ShadowAppearanceTheme.createTheme({ transparent: undefined, link: undefined }),
|
|
3741
|
+
filled: ShadowAppearanceTheme.createTheme({ transparent: undefined, link: undefined })
|
|
3742
|
+
});
|
|
3743
|
+
}
|
|
3796
3744
|
static createBorderAppearanceTheme() {
|
|
3797
3745
|
return new GenericVariantTheme({
|
|
3798
3746
|
outline: TextAppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
@@ -3867,15 +3815,16 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
3867
3815
|
lg: 'text-lg',
|
|
3868
3816
|
xl: 'text-xl',
|
|
3869
3817
|
}),
|
|
3870
|
-
shadow: new ShadowTheme(),
|
|
3871
3818
|
},
|
|
3872
3819
|
appearance: {
|
|
3873
3820
|
background: GenericVariantTheme.createBgAppearanceTheme(),
|
|
3874
3821
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
3875
3822
|
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
3876
3823
|
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
3824
|
+
shadow: GenericVariantTheme.createUIElementShadowTheme()
|
|
3877
3825
|
},
|
|
3878
3826
|
layout: {
|
|
3827
|
+
...defaultLayoutTheme,
|
|
3879
3828
|
border: new BorderTheme(),
|
|
3880
3829
|
ring: new RingTheme(),
|
|
3881
3830
|
radius: new RadiusTheme({
|
|
@@ -3888,6 +3837,7 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
3888
3837
|
}
|
|
3889
3838
|
}),
|
|
3890
3839
|
},
|
|
3840
|
+
typography: defaultTypographyTheme,
|
|
3891
3841
|
}, {
|
|
3892
3842
|
md: true,
|
|
3893
3843
|
inlineFlex: true,
|
|
@@ -3941,16 +3891,17 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
3941
3891
|
md: 'text-base',
|
|
3942
3892
|
lg: 'text-lg',
|
|
3943
3893
|
xl: 'text-xl',
|
|
3944
|
-
})
|
|
3945
|
-
shadow: new ShadowTheme(),
|
|
3894
|
+
})
|
|
3946
3895
|
},
|
|
3947
3896
|
appearance: {
|
|
3948
3897
|
background: GenericVariantTheme.createSimpleBgAppearanceTheme(),
|
|
3949
3898
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
3950
3899
|
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
3951
3900
|
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
3901
|
+
shadow: GenericVariantTheme.createUIElementShadowTheme()
|
|
3952
3902
|
},
|
|
3953
3903
|
layout: {
|
|
3904
|
+
...defaultLayoutTheme,
|
|
3954
3905
|
border: new BorderTheme(),
|
|
3955
3906
|
ring: new RingTheme(),
|
|
3956
3907
|
radius: new RadiusTheme({
|
|
@@ -3963,6 +3914,7 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
3963
3914
|
}
|
|
3964
3915
|
}),
|
|
3965
3916
|
},
|
|
3917
|
+
typography: defaultTypographyTheme,
|
|
3966
3918
|
}, {
|
|
3967
3919
|
md: true,
|
|
3968
3920
|
inlineFlex: true,
|
|
@@ -4013,16 +3965,17 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4013
3965
|
lg: 'gap-2.5',
|
|
4014
3966
|
xl: 'gap-3',
|
|
4015
3967
|
}
|
|
4016
|
-
})
|
|
4017
|
-
shadow: new ShadowTheme(),
|
|
3968
|
+
})
|
|
4018
3969
|
},
|
|
4019
3970
|
appearance: {
|
|
4020
3971
|
background: GenericVariantTheme.createSimpleBgAppearanceTheme(),
|
|
4021
3972
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4022
3973
|
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
4023
3974
|
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
3975
|
+
shadow: GenericVariantTheme.createUIElementShadowTheme()
|
|
4024
3976
|
},
|
|
4025
3977
|
layout: {
|
|
3978
|
+
...defaultLayoutTheme,
|
|
4026
3979
|
radius: new RadiusTheme({
|
|
4027
3980
|
rounded: {
|
|
4028
3981
|
xs: 'rounded-sm',
|
|
@@ -4035,6 +3988,7 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4035
3988
|
border: new BorderTheme(),
|
|
4036
3989
|
ring: new RingTheme(),
|
|
4037
3990
|
},
|
|
3991
|
+
typography: defaultTypographyTheme,
|
|
4038
3992
|
}, {
|
|
4039
3993
|
md: true,
|
|
4040
3994
|
inlineFlex: true,
|
|
@@ -4050,6 +4004,75 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4050
4004
|
ring: true,
|
|
4051
4005
|
});
|
|
4052
4006
|
|
|
4007
|
+
const isObject = (item) => {
|
|
4008
|
+
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
4009
|
+
};
|
|
4010
|
+
const deepMerge = (target, source) => {
|
|
4011
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
4012
|
+
for (const key in source) {
|
|
4013
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4014
|
+
const sourceValue = source[key];
|
|
4015
|
+
const targetValue = output[key];
|
|
4016
|
+
if (sourceValue === undefined) {
|
|
4017
|
+
continue;
|
|
4018
|
+
}
|
|
4019
|
+
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
4020
|
+
if (key === 'defaults' &&
|
|
4021
|
+
isObject(targetValue) &&
|
|
4022
|
+
isObject(sourceValue)) {
|
|
4023
|
+
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
4024
|
+
}
|
|
4025
|
+
// For all other objects, use the standard recursive deep merge.
|
|
4026
|
+
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
4027
|
+
output[key] = deepMerge(targetValue, sourceValue);
|
|
4028
|
+
}
|
|
4029
|
+
// For non-object values, just assign the value from the source.
|
|
4030
|
+
else {
|
|
4031
|
+
output[key] = sourceValue;
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
return output;
|
|
4036
|
+
};
|
|
4037
|
+
const deepClone = (source) => {
|
|
4038
|
+
if (!isObject(source)) {
|
|
4039
|
+
return source;
|
|
4040
|
+
}
|
|
4041
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
4042
|
+
for (const key in output) {
|
|
4043
|
+
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
4044
|
+
output[key] = deepClone(output[key]);
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
return output;
|
|
4048
|
+
};
|
|
4049
|
+
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
4050
|
+
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
4051
|
+
const finalDefaults = { ...baseDefaults };
|
|
4052
|
+
// Iterate over the override keys to apply them.
|
|
4053
|
+
for (const key in overrideDefaults) {
|
|
4054
|
+
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
4055
|
+
const overrideValue = overrideDefaults[key];
|
|
4056
|
+
// If the override is setting a key to true...
|
|
4057
|
+
if (overrideValue) {
|
|
4058
|
+
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
4059
|
+
const group = findGroup(key);
|
|
4060
|
+
// If the key is part of an exclusive group...
|
|
4061
|
+
if (group) {
|
|
4062
|
+
// ...set all other keys in that group to false.
|
|
4063
|
+
group.forEach(groupKey => {
|
|
4064
|
+
if (groupKey !== key) {
|
|
4065
|
+
finalDefaults[groupKey] = false;
|
|
4066
|
+
}
|
|
4067
|
+
});
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
finalDefaults[key] = overrideValue;
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
return finalDefaults;
|
|
4074
|
+
};
|
|
4075
|
+
|
|
4053
4076
|
const typographyThemeDefaults = {
|
|
4054
4077
|
md: true,
|
|
4055
4078
|
default: true,
|
|
@@ -4063,7 +4086,8 @@ const createTypographyComponentTheme = (tag, base = "text-balance", textSizeMap
|
|
|
4063
4086
|
},
|
|
4064
4087
|
appearance: {
|
|
4065
4088
|
text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4066
|
-
}
|
|
4089
|
+
},
|
|
4090
|
+
typography: defaultTypographyTheme,
|
|
4067
4091
|
}, defaults);
|
|
4068
4092
|
};
|
|
4069
4093
|
// Page title specific theme
|
|
@@ -4200,30 +4224,30 @@ BreakpointTheme.defaultClasses = {
|
|
|
4200
4224
|
xlCol: "max-xl:flex-col"
|
|
4201
4225
|
};
|
|
4202
4226
|
|
|
4203
|
-
const defaultCardTheme = new ComponentTheme("div", "
|
|
4227
|
+
const defaultCardTheme = new ComponentTheme("div", "", {
|
|
4204
4228
|
size: {
|
|
4205
4229
|
px: new PxTheme({
|
|
4206
4230
|
padding: {
|
|
4207
|
-
xs:
|
|
4208
|
-
sm:
|
|
4209
|
-
md:
|
|
4210
|
-
lg:
|
|
4211
|
-
xl:
|
|
4231
|
+
xs: "px-2",
|
|
4232
|
+
sm: "px-3 max-lg:px-2",
|
|
4233
|
+
md: "px-4 max-lg:px-3",
|
|
4234
|
+
lg: "px-5 max-lg:px-4 max-md:px-3",
|
|
4235
|
+
xl: "px-6 max-lg:px-5 max-md:px-4"
|
|
4212
4236
|
}
|
|
4213
4237
|
}),
|
|
4214
4238
|
py: new PyTheme({
|
|
4215
4239
|
padding: {
|
|
4216
|
-
xs:
|
|
4217
|
-
sm:
|
|
4218
|
-
md:
|
|
4219
|
-
lg:
|
|
4220
|
-
xl:
|
|
4240
|
+
xs: "py-2",
|
|
4241
|
+
sm: "py-3 max-lg:py-2",
|
|
4242
|
+
md: "py-4 max-lg:py-3",
|
|
4243
|
+
lg: "py-5 max-lg:py-4 max-md:py-3",
|
|
4244
|
+
xl: "py-6 max-lg:py-5 max-md:py-4"
|
|
4221
4245
|
}
|
|
4222
4246
|
}),
|
|
4223
4247
|
gap: new GapTheme({ gap: commonGaps }),
|
|
4224
|
-
shadow: new ShadowTheme(),
|
|
4225
4248
|
},
|
|
4226
4249
|
layout: {
|
|
4250
|
+
...defaultLayoutTheme,
|
|
4227
4251
|
border: new BorderTheme(),
|
|
4228
4252
|
ring: new RingTheme(),
|
|
4229
4253
|
radius: new RadiusTheme({
|
|
@@ -4238,6 +4262,7 @@ const defaultCardTheme = new ComponentTheme("div", "overflow-hidden", {
|
|
|
4238
4262
|
wrap: new WrapTheme(),
|
|
4239
4263
|
direction: new DirectionTheme(),
|
|
4240
4264
|
breakpoint: new BreakpointTheme(),
|
|
4265
|
+
shadow: ShadowAppearanceTheme.createTheme(),
|
|
4241
4266
|
},
|
|
4242
4267
|
appearance: {
|
|
4243
4268
|
background: new BgAppearanceTheme(),
|
|
@@ -4263,6 +4288,7 @@ const defaultRowTheme = new ComponentTheme("div", "flex-row", {
|
|
|
4263
4288
|
breakpoint: new BreakpointTheme(),
|
|
4264
4289
|
},
|
|
4265
4290
|
layout: {
|
|
4291
|
+
...defaultLayoutTheme,
|
|
4266
4292
|
wrap: new WrapTheme(),
|
|
4267
4293
|
},
|
|
4268
4294
|
}, {
|
|
@@ -4304,6 +4330,7 @@ const defaultContainerTheme = new ComponentTheme("div", "flex-col mx-auto w-full
|
|
|
4304
4330
|
}),
|
|
4305
4331
|
},
|
|
4306
4332
|
layout: {
|
|
4333
|
+
...defaultLayoutTheme,
|
|
4307
4334
|
border: new BorderTheme(),
|
|
4308
4335
|
ring: new RingTheme(),
|
|
4309
4336
|
wrap: new WrapTheme(),
|
|
@@ -4339,6 +4366,7 @@ const defaultColTheme = new ComponentTheme("div", "flex-col", {
|
|
|
4339
4366
|
gap: new GapTheme({ gap: commonGaps }),
|
|
4340
4367
|
},
|
|
4341
4368
|
layout: {
|
|
4369
|
+
...defaultLayoutTheme,
|
|
4342
4370
|
wrap: new WrapTheme(),
|
|
4343
4371
|
direction: new DirectionTheme(),
|
|
4344
4372
|
},
|
|
@@ -4374,6 +4402,7 @@ const defaultStackTheme = new ComponentTheme("div", "", {
|
|
|
4374
4402
|
}),
|
|
4375
4403
|
},
|
|
4376
4404
|
layout: {
|
|
4405
|
+
...defaultLayoutTheme,
|
|
4377
4406
|
wrap: new WrapTheme(),
|
|
4378
4407
|
direction: new DirectionTheme(),
|
|
4379
4408
|
},
|
|
@@ -4416,15 +4445,16 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
|
|
|
4416
4445
|
xl: 'gap-16',
|
|
4417
4446
|
}
|
|
4418
4447
|
}),
|
|
4419
|
-
shadow: new ShadowTheme(),
|
|
4420
4448
|
},
|
|
4421
4449
|
appearance: {
|
|
4422
4450
|
background: new BgAppearanceTheme(),
|
|
4423
4451
|
text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4424
4452
|
border: TextAppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4425
4453
|
ring: TextAppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4454
|
+
shadow: ShadowAppearanceTheme.createTheme(),
|
|
4426
4455
|
},
|
|
4427
4456
|
layout: {
|
|
4457
|
+
...defaultLayoutTheme,
|
|
4428
4458
|
wrap: new WrapTheme(),
|
|
4429
4459
|
direction: new DirectionTheme(),
|
|
4430
4460
|
border: new BorderTheme(),
|
|
@@ -4469,6 +4499,7 @@ const gridSubThemes = {
|
|
|
4469
4499
|
}
|
|
4470
4500
|
}),
|
|
4471
4501
|
},
|
|
4502
|
+
layout: defaultLayoutTheme,
|
|
4472
4503
|
};
|
|
4473
4504
|
const defaultGrid3Theme = new ComponentTheme("div", "grid-cols-1 md:grid-cols-3", gridSubThemes, gridDefaults);
|
|
4474
4505
|
const defaultGrid4Theme = new ComponentTheme("div", "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4", gridSubThemes, gridDefaults);
|
|
@@ -4621,5 +4652,5 @@ const List = (props) => {
|
|
|
4621
4652
|
return jsx(ThemedComponent, { theme: theme.list, propsToOmit: TYPOGRAPHY_COMPONENT_KEYS, ...props });
|
|
4622
4653
|
};
|
|
4623
4654
|
|
|
4624
|
-
export { BADGE_KEYS, BASE_COMPONENT_KEYS, BG_APPEARANCE_KEYS, BORDER_KEYS, BREAKPOINT_KEYS, BUTTON_KEYS, Badge, Button, CARD_KEYS, CHIP_KEYS, COL_KEYS, COMPONENT_KEYS, CONTAINER_KEYS, Card, Chip, Col, Container, DIRECTION_REVERSE_KEYS, DISPLAY_KEYS, DIVIDER_KEYS, Divider, EXCLUSIVE_KEY_GROUPS, FLEX_DIRECTION_KEYS, FONT_FAMILY_KEYS, FONT_KEYS, FONT_STYLE_KEYS, FONT_WEIGHT_KEYS, GAP_KEYS, GRID_KEYS, Grid3, Grid4, HIDE_KEYS, ITEMS_KEYS, JUSTIFY_KEYS, Link, List, ListItem, MODE_KEYS, PADDING_KEYS, PILL_KEYS, POSITION_KEYS, PageTitle, RING_KEYS, ROUNDED_KEYS, ROW_KEYS, Row, SECTION_KEYS, SHADOW_KEYS, SHAPE_KEYS, SHARP_KEYS, SIZE_KEYS, STACK_KEYS, Section, SectionTitle, Stack, TEXT_ALIGN_KEYS, TEXT_APPEARANCE_KEYS, TEXT_DECORATION_KEYS, TEXT_TRANSFORM_KEYS, TYPOGRAPHY_COMPONENT_KEYS, Text, ThemeProvider, Title, VARIANT_KEYS, WRAP_KEYS, defaultTheme, useTheme };
|
|
4655
|
+
export { BADGE_KEYS, BASE_COMPONENT_KEYS, BG_APPEARANCE_KEYS, BORDER_KEYS, BREAKPOINT_KEYS, BUTTON_KEYS, Badge, Button, CARD_KEYS, CHIP_KEYS, COL_KEYS, COMPONENT_KEYS, CONTAINER_KEYS, Card, Chip, Col, Container, DIRECTION_REVERSE_KEYS, DISPLAY_KEYS, DIVIDER_KEYS, Divider, EXCLUSIVE_KEY_GROUPS, FLEX_DIRECTION_KEYS, FONT_FAMILY_KEYS, FONT_KEYS, FONT_STYLE_KEYS, FONT_WEIGHT_KEYS, GAP_KEYS, GRID_KEYS, Grid3, Grid4, HIDE_KEYS, ITEMS_KEYS, JUSTIFY_KEYS, Link, List, ListItem, MODE_KEYS, OVERFLOW_KEYS, PADDING_KEYS, PILL_KEYS, POSITION_KEYS, PageTitle, RING_KEYS, ROUNDED_KEYS, ROW_KEYS, Row, SECTION_KEYS, SHADOW_KEYS, SHAPE_KEYS, SHARP_KEYS, SIZE_KEYS, STACK_KEYS, Section, SectionTitle, Stack, TEXT_ALIGN_KEYS, TEXT_APPEARANCE_KEYS, TEXT_DECORATION_KEYS, TEXT_TRANSFORM_KEYS, TYPOGRAPHY_COMPONENT_KEYS, Text, ThemeProvider, Title, VARIANT_KEYS, WRAP_KEYS, defaultTheme, useTheme };
|
|
4625
4656
|
//# sourceMappingURL=index.esm.js.map
|