@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
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ const ITEMS_KEYS = ['itemsStart', 'itemsEnd', 'itemsCenter', 'itemsBaseline', 'i
|
|
|
40
40
|
const JUSTIFY_KEYS = ['justifyStart', 'justifyEnd', 'justifyCenter', 'justifyBetween', 'justifyAround', 'justifyEvenly', 'justifyStretch', 'justifyBaseline'];
|
|
41
41
|
const WRAP_KEYS = ['flexWrap', 'flexNoWrap', 'flexWrapReverse'];
|
|
42
42
|
const DISPLAY_KEYS = ['inline', 'block', 'inlineBlock', 'flex', 'inlineFlex', 'grid', 'inlineGrid', 'contents', 'table', 'tableCell', 'hidden'];
|
|
43
|
+
const OVERFLOW_KEYS = ['overflowAuto', 'overflowHidden', 'overflowClip', 'overflowVisible', 'overflowScroll', 'overflowXAuto', 'overflowYAuto', 'overflowXHidden', 'overflowYHidden', 'overflowXClip', 'overflowYClip', 'overflowXVisible', 'overflowYVisible', 'overflowXScroll', 'overflowYScroll'];
|
|
43
44
|
// A master list of all groups where only one key can be 'true' at a time.
|
|
44
45
|
const EXCLUSIVE_KEY_GROUPS = [
|
|
45
46
|
MODE_KEYS,
|
|
@@ -76,7 +77,8 @@ const BASE_COMPONENT_KEYS = [
|
|
|
76
77
|
...ITEMS_KEYS,
|
|
77
78
|
...JUSTIFY_KEYS,
|
|
78
79
|
...POSITION_KEYS,
|
|
79
|
-
...DISPLAY_KEYS
|
|
80
|
+
...DISPLAY_KEYS,
|
|
81
|
+
...OVERFLOW_KEYS,
|
|
80
82
|
];
|
|
81
83
|
// Font keys
|
|
82
84
|
const FONT_KEYS = [
|
|
@@ -439,75 +441,6 @@ TextAlignTheme.defaultClasses = {
|
|
|
439
441
|
textJustify: "text-justify",
|
|
440
442
|
};
|
|
441
443
|
|
|
442
|
-
const isObject = (item) => {
|
|
443
|
-
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
444
|
-
};
|
|
445
|
-
const deepMerge = (target, source) => {
|
|
446
|
-
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
447
|
-
for (const key in source) {
|
|
448
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
449
|
-
const sourceValue = source[key];
|
|
450
|
-
const targetValue = output[key];
|
|
451
|
-
if (sourceValue === undefined) {
|
|
452
|
-
continue;
|
|
453
|
-
}
|
|
454
|
-
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
455
|
-
if (key === 'defaults' &&
|
|
456
|
-
isObject(targetValue) &&
|
|
457
|
-
isObject(sourceValue)) {
|
|
458
|
-
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
459
|
-
}
|
|
460
|
-
// For all other objects, use the standard recursive deep merge.
|
|
461
|
-
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
462
|
-
output[key] = deepMerge(targetValue, sourceValue);
|
|
463
|
-
}
|
|
464
|
-
// For non-object values, just assign the value from the source.
|
|
465
|
-
else {
|
|
466
|
-
output[key] = sourceValue;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
return output;
|
|
471
|
-
};
|
|
472
|
-
const deepClone = (source) => {
|
|
473
|
-
if (!isObject(source)) {
|
|
474
|
-
return source;
|
|
475
|
-
}
|
|
476
|
-
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
477
|
-
for (const key in output) {
|
|
478
|
-
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
479
|
-
output[key] = deepClone(output[key]);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
return output;
|
|
483
|
-
};
|
|
484
|
-
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
485
|
-
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
486
|
-
const finalDefaults = { ...baseDefaults };
|
|
487
|
-
// Iterate over the override keys to apply them.
|
|
488
|
-
for (const key in overrideDefaults) {
|
|
489
|
-
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
490
|
-
const overrideValue = overrideDefaults[key];
|
|
491
|
-
// If the override is setting a key to true...
|
|
492
|
-
if (overrideValue) {
|
|
493
|
-
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
494
|
-
const group = findGroup(key);
|
|
495
|
-
// If the key is part of an exclusive group...
|
|
496
|
-
if (group) {
|
|
497
|
-
// ...set all other keys in that group to false.
|
|
498
|
-
group.forEach(groupKey => {
|
|
499
|
-
if (groupKey !== key) {
|
|
500
|
-
finalDefaults[groupKey] = false;
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
finalDefaults[key] = overrideValue;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
return finalDefaults;
|
|
509
|
-
};
|
|
510
|
-
|
|
511
444
|
class DisplayTheme extends BaseTheme {
|
|
512
445
|
constructor(initialConfig) {
|
|
513
446
|
super();
|
|
@@ -517,8 +450,8 @@ class DisplayTheme extends BaseTheme {
|
|
|
517
450
|
});
|
|
518
451
|
}
|
|
519
452
|
getClasses(props, defaults) {
|
|
520
|
-
const
|
|
521
|
-
return [
|
|
453
|
+
const key = pickFirstTruthyKey(props, defaults, DISPLAY_KEYS);
|
|
454
|
+
return [key && this[key] ? this[key] : ''];
|
|
522
455
|
}
|
|
523
456
|
}
|
|
524
457
|
DisplayTheme.defaultClasses = {
|
|
@@ -3246,29 +3179,59 @@ const getDefaultConfig = () => {
|
|
|
3246
3179
|
};
|
|
3247
3180
|
const twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
|
|
3248
3181
|
|
|
3182
|
+
class OverflowTheme extends BaseTheme {
|
|
3183
|
+
constructor(initialConfig) {
|
|
3184
|
+
super();
|
|
3185
|
+
OVERFLOW_KEYS.forEach((key) => {
|
|
3186
|
+
var _a;
|
|
3187
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : OverflowTheme.defaultClasses[key];
|
|
3188
|
+
});
|
|
3189
|
+
}
|
|
3190
|
+
getClasses(props, defaults) {
|
|
3191
|
+
const key = pickFirstTruthyKey(props, defaults, OVERFLOW_KEYS);
|
|
3192
|
+
return [key && this[key] ? this[key] : ''];
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
OverflowTheme.defaultClasses = {
|
|
3196
|
+
overflowAuto: 'overflow-auto',
|
|
3197
|
+
overflowHidden: 'overflow-hidden',
|
|
3198
|
+
overflowClip: 'overflow-clip',
|
|
3199
|
+
overflowVisible: 'overflow-visible',
|
|
3200
|
+
overflowScroll: 'overflow-scroll',
|
|
3201
|
+
overflowXAuto: 'overflow-x-auto',
|
|
3202
|
+
overflowYAuto: 'overflow-y-auto',
|
|
3203
|
+
overflowXHidden: 'overflow-x-hidden',
|
|
3204
|
+
overflowYHidden: 'overflow-y-hidden',
|
|
3205
|
+
overflowXClip: 'overflow-x-clip',
|
|
3206
|
+
overflowYClip: 'overflow-y-clip',
|
|
3207
|
+
overflowXVisible: 'overflow-x-visible',
|
|
3208
|
+
overflowYVisible: 'overflow-y-visible',
|
|
3209
|
+
overflowXScroll: 'overflow-x-scroll',
|
|
3210
|
+
overflowYScroll: 'overflow-y-scroll',
|
|
3211
|
+
};
|
|
3212
|
+
|
|
3213
|
+
const defaultLayoutTheme = {
|
|
3214
|
+
hide: new HideTheme(),
|
|
3215
|
+
items: new ItemsTheme(),
|
|
3216
|
+
justify: new JustifyTheme(),
|
|
3217
|
+
position: new PositionTheme(),
|
|
3218
|
+
display: new DisplayTheme(),
|
|
3219
|
+
overflow: new OverflowTheme(),
|
|
3220
|
+
};
|
|
3221
|
+
const defaultTypographyTheme = {
|
|
3222
|
+
fontFamily: new FontFamilyTheme(),
|
|
3223
|
+
fontWeight: new FontWeightTheme(),
|
|
3224
|
+
fontStyle: new FontStyleTheme(),
|
|
3225
|
+
textDecoration: new TextDecorationTheme(),
|
|
3226
|
+
textTransform: new TextTransformTheme(),
|
|
3227
|
+
textAlign: new TextAlignTheme()
|
|
3228
|
+
};
|
|
3249
3229
|
class ComponentTheme {
|
|
3250
3230
|
constructor(tag, base, subThemes, defaults = {}) {
|
|
3251
3231
|
this.tag = tag;
|
|
3252
3232
|
this.base = base;
|
|
3253
3233
|
this.defaults = defaults;
|
|
3254
|
-
|
|
3255
|
-
layout: {
|
|
3256
|
-
hide: new HideTheme(),
|
|
3257
|
-
items: new ItemsTheme(),
|
|
3258
|
-
justify: new JustifyTheme(),
|
|
3259
|
-
position: new PositionTheme(),
|
|
3260
|
-
display: new DisplayTheme()
|
|
3261
|
-
},
|
|
3262
|
-
typography: {
|
|
3263
|
-
fontFamily: new FontFamilyTheme(),
|
|
3264
|
-
fontWeight: new FontWeightTheme(),
|
|
3265
|
-
fontStyle: new FontStyleTheme(),
|
|
3266
|
-
textDecoration: new TextDecorationTheme(),
|
|
3267
|
-
textTransform: new TextTransformTheme(),
|
|
3268
|
-
textAlign: new TextAlignTheme()
|
|
3269
|
-
}
|
|
3270
|
-
};
|
|
3271
|
-
this.themes = deepMerge(defaultInternalThemes, subThemes);
|
|
3234
|
+
this.themes = subThemes;
|
|
3272
3235
|
}
|
|
3273
3236
|
getClasses(props, defaults = this.defaults) {
|
|
3274
3237
|
const user = props;
|
|
@@ -3381,57 +3344,6 @@ RadiusTheme.defaultClasses = {
|
|
|
3381
3344
|
}
|
|
3382
3345
|
};
|
|
3383
3346
|
|
|
3384
|
-
class ShadowTheme extends BaseTheme {
|
|
3385
|
-
constructor(initial) {
|
|
3386
|
-
super();
|
|
3387
|
-
SHADOW_KEYS.forEach((key) => {
|
|
3388
|
-
var _a;
|
|
3389
|
-
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : ShadowTheme.defaultClasses[key];
|
|
3390
|
-
});
|
|
3391
|
-
}
|
|
3392
|
-
getClasses(props, defaults) {
|
|
3393
|
-
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3394
|
-
const key = pickFirstTruthyKey(props, defaults, SHADOW_KEYS);
|
|
3395
|
-
if (key === undefined) {
|
|
3396
|
-
return [];
|
|
3397
|
-
}
|
|
3398
|
-
const isModeStringMap = MODE_KEYS.every(m => typeof this[key][m] === "string");
|
|
3399
|
-
return MODE_KEYS.map(mode => isModeStringMap
|
|
3400
|
-
? this[key][mode]
|
|
3401
|
-
: this[key][mode][size]);
|
|
3402
|
-
}
|
|
3403
|
-
}
|
|
3404
|
-
ShadowTheme.defaultClasses = {
|
|
3405
|
-
shadow: {
|
|
3406
|
-
base: {
|
|
3407
|
-
xs: "shadow-2xs",
|
|
3408
|
-
sm: "shadow-xs",
|
|
3409
|
-
md: "shadow-sm",
|
|
3410
|
-
lg: "shadow-md",
|
|
3411
|
-
xl: "shadow-lg"
|
|
3412
|
-
},
|
|
3413
|
-
hover: {
|
|
3414
|
-
xs: "hover:shadow-xs",
|
|
3415
|
-
sm: "hover:shadow-sm",
|
|
3416
|
-
md: "hover:shadow-md",
|
|
3417
|
-
lg: "hover:shadow-lg",
|
|
3418
|
-
xl: "hover:shadow-xl"
|
|
3419
|
-
},
|
|
3420
|
-
active: {
|
|
3421
|
-
xs: "active:shadow-xs",
|
|
3422
|
-
sm: "active:shadow-sm",
|
|
3423
|
-
md: "active:shadow-md",
|
|
3424
|
-
lg: "active:shadow-lg",
|
|
3425
|
-
xl: "active:shadow-xl"
|
|
3426
|
-
},
|
|
3427
|
-
},
|
|
3428
|
-
noShadow: {
|
|
3429
|
-
base: "shadow-none",
|
|
3430
|
-
hover: "hover:shadow-none",
|
|
3431
|
-
active: "active:shadow-none",
|
|
3432
|
-
}
|
|
3433
|
-
};
|
|
3434
|
-
|
|
3435
3347
|
class BorderTheme extends BaseTheme {
|
|
3436
3348
|
constructor(initial) {
|
|
3437
3349
|
super();
|
|
@@ -3768,6 +3680,35 @@ const filledRingAppearanceClasses = {
|
|
|
3768
3680
|
transparent: "ring-transparent",
|
|
3769
3681
|
};
|
|
3770
3682
|
|
|
3683
|
+
class ShadowAppearanceTheme extends BaseTheme {
|
|
3684
|
+
constructor(initial) {
|
|
3685
|
+
super();
|
|
3686
|
+
TEXT_APPEARANCE_KEYS.forEach((key) => {
|
|
3687
|
+
var _a;
|
|
3688
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : ShadowAppearanceTheme.defaultShadow;
|
|
3689
|
+
});
|
|
3690
|
+
}
|
|
3691
|
+
getClasses(props, defaults) {
|
|
3692
|
+
const appearance = pickFirstTruthyKey(props, defaults, TEXT_APPEARANCE_KEYS) || 'default';
|
|
3693
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3694
|
+
const key = pickFirstTruthyKey(props, defaults, SHADOW_KEYS);
|
|
3695
|
+
if (key === undefined || key === 'noShadow') {
|
|
3696
|
+
return [];
|
|
3697
|
+
}
|
|
3698
|
+
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 : ""; });
|
|
3699
|
+
}
|
|
3700
|
+
static createTheme(src = {}) {
|
|
3701
|
+
return new ShadowAppearanceTheme(src);
|
|
3702
|
+
}
|
|
3703
|
+
}
|
|
3704
|
+
ShadowAppearanceTheme.defaultShadow = {
|
|
3705
|
+
xs: { base: "shadow-2xs", hover: "hover:shadow-xs", active: "" },
|
|
3706
|
+
sm: { base: "shadow-xs", hover: "hover:shadow-sm", active: "" },
|
|
3707
|
+
md: { base: "shadow-sm", hover: "hover:shadow-md", active: "" },
|
|
3708
|
+
lg: { base: "shadow-md", hover: "hover:shadow-lg", active: "" },
|
|
3709
|
+
xl: { base: "shadow-lg", hover: "hover:shadow-xl", active: "" }
|
|
3710
|
+
};
|
|
3711
|
+
|
|
3771
3712
|
class GenericVariantTheme extends BaseTheme {
|
|
3772
3713
|
constructor(variantInstances) {
|
|
3773
3714
|
super();
|
|
@@ -3795,6 +3736,13 @@ class GenericVariantTheme extends BaseTheme {
|
|
|
3795
3736
|
})
|
|
3796
3737
|
});
|
|
3797
3738
|
}
|
|
3739
|
+
static createUIElementShadowTheme() {
|
|
3740
|
+
//transparent UI elements won't have a shadow
|
|
3741
|
+
return new GenericVariantTheme({
|
|
3742
|
+
outline: ShadowAppearanceTheme.createTheme({ transparent: undefined, link: undefined }),
|
|
3743
|
+
filled: ShadowAppearanceTheme.createTheme({ transparent: undefined, link: undefined })
|
|
3744
|
+
});
|
|
3745
|
+
}
|
|
3798
3746
|
static createBorderAppearanceTheme() {
|
|
3799
3747
|
return new GenericVariantTheme({
|
|
3800
3748
|
outline: TextAppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
@@ -3869,15 +3817,16 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
3869
3817
|
lg: 'text-lg',
|
|
3870
3818
|
xl: 'text-xl',
|
|
3871
3819
|
}),
|
|
3872
|
-
shadow: new ShadowTheme(),
|
|
3873
3820
|
},
|
|
3874
3821
|
appearance: {
|
|
3875
3822
|
background: GenericVariantTheme.createBgAppearanceTheme(),
|
|
3876
3823
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
3877
3824
|
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
3878
3825
|
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
3826
|
+
shadow: GenericVariantTheme.createUIElementShadowTheme()
|
|
3879
3827
|
},
|
|
3880
3828
|
layout: {
|
|
3829
|
+
...defaultLayoutTheme,
|
|
3881
3830
|
border: new BorderTheme(),
|
|
3882
3831
|
ring: new RingTheme(),
|
|
3883
3832
|
radius: new RadiusTheme({
|
|
@@ -3890,6 +3839,7 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
3890
3839
|
}
|
|
3891
3840
|
}),
|
|
3892
3841
|
},
|
|
3842
|
+
typography: defaultTypographyTheme,
|
|
3893
3843
|
}, {
|
|
3894
3844
|
md: true,
|
|
3895
3845
|
inlineFlex: true,
|
|
@@ -3943,16 +3893,17 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
3943
3893
|
md: 'text-base',
|
|
3944
3894
|
lg: 'text-lg',
|
|
3945
3895
|
xl: 'text-xl',
|
|
3946
|
-
})
|
|
3947
|
-
shadow: new ShadowTheme(),
|
|
3896
|
+
})
|
|
3948
3897
|
},
|
|
3949
3898
|
appearance: {
|
|
3950
3899
|
background: GenericVariantTheme.createSimpleBgAppearanceTheme(),
|
|
3951
3900
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
3952
3901
|
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
3953
3902
|
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
3903
|
+
shadow: GenericVariantTheme.createUIElementShadowTheme()
|
|
3954
3904
|
},
|
|
3955
3905
|
layout: {
|
|
3906
|
+
...defaultLayoutTheme,
|
|
3956
3907
|
border: new BorderTheme(),
|
|
3957
3908
|
ring: new RingTheme(),
|
|
3958
3909
|
radius: new RadiusTheme({
|
|
@@ -3965,6 +3916,7 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
3965
3916
|
}
|
|
3966
3917
|
}),
|
|
3967
3918
|
},
|
|
3919
|
+
typography: defaultTypographyTheme,
|
|
3968
3920
|
}, {
|
|
3969
3921
|
md: true,
|
|
3970
3922
|
inlineFlex: true,
|
|
@@ -4015,16 +3967,17 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4015
3967
|
lg: 'gap-2.5',
|
|
4016
3968
|
xl: 'gap-3',
|
|
4017
3969
|
}
|
|
4018
|
-
})
|
|
4019
|
-
shadow: new ShadowTheme(),
|
|
3970
|
+
})
|
|
4020
3971
|
},
|
|
4021
3972
|
appearance: {
|
|
4022
3973
|
background: GenericVariantTheme.createSimpleBgAppearanceTheme(),
|
|
4023
3974
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4024
3975
|
border: GenericVariantTheme.createBorderAppearanceTheme(),
|
|
4025
3976
|
ring: GenericVariantTheme.createRingAppearanceTheme(),
|
|
3977
|
+
shadow: GenericVariantTheme.createUIElementShadowTheme()
|
|
4026
3978
|
},
|
|
4027
3979
|
layout: {
|
|
3980
|
+
...defaultLayoutTheme,
|
|
4028
3981
|
radius: new RadiusTheme({
|
|
4029
3982
|
rounded: {
|
|
4030
3983
|
xs: 'rounded-sm',
|
|
@@ -4037,6 +3990,7 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4037
3990
|
border: new BorderTheme(),
|
|
4038
3991
|
ring: new RingTheme(),
|
|
4039
3992
|
},
|
|
3993
|
+
typography: defaultTypographyTheme,
|
|
4040
3994
|
}, {
|
|
4041
3995
|
md: true,
|
|
4042
3996
|
inlineFlex: true,
|
|
@@ -4052,6 +4006,75 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4052
4006
|
ring: true,
|
|
4053
4007
|
});
|
|
4054
4008
|
|
|
4009
|
+
const isObject = (item) => {
|
|
4010
|
+
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
4011
|
+
};
|
|
4012
|
+
const deepMerge = (target, source) => {
|
|
4013
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
4014
|
+
for (const key in source) {
|
|
4015
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4016
|
+
const sourceValue = source[key];
|
|
4017
|
+
const targetValue = output[key];
|
|
4018
|
+
if (sourceValue === undefined) {
|
|
4019
|
+
continue;
|
|
4020
|
+
}
|
|
4021
|
+
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
4022
|
+
if (key === 'defaults' &&
|
|
4023
|
+
isObject(targetValue) &&
|
|
4024
|
+
isObject(sourceValue)) {
|
|
4025
|
+
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
4026
|
+
}
|
|
4027
|
+
// For all other objects, use the standard recursive deep merge.
|
|
4028
|
+
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
4029
|
+
output[key] = deepMerge(targetValue, sourceValue);
|
|
4030
|
+
}
|
|
4031
|
+
// For non-object values, just assign the value from the source.
|
|
4032
|
+
else {
|
|
4033
|
+
output[key] = sourceValue;
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
return output;
|
|
4038
|
+
};
|
|
4039
|
+
const deepClone = (source) => {
|
|
4040
|
+
if (!isObject(source)) {
|
|
4041
|
+
return source;
|
|
4042
|
+
}
|
|
4043
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
4044
|
+
for (const key in output) {
|
|
4045
|
+
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
4046
|
+
output[key] = deepClone(output[key]);
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
return output;
|
|
4050
|
+
};
|
|
4051
|
+
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
4052
|
+
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
4053
|
+
const finalDefaults = { ...baseDefaults };
|
|
4054
|
+
// Iterate over the override keys to apply them.
|
|
4055
|
+
for (const key in overrideDefaults) {
|
|
4056
|
+
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
4057
|
+
const overrideValue = overrideDefaults[key];
|
|
4058
|
+
// If the override is setting a key to true...
|
|
4059
|
+
if (overrideValue) {
|
|
4060
|
+
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
4061
|
+
const group = findGroup(key);
|
|
4062
|
+
// If the key is part of an exclusive group...
|
|
4063
|
+
if (group) {
|
|
4064
|
+
// ...set all other keys in that group to false.
|
|
4065
|
+
group.forEach(groupKey => {
|
|
4066
|
+
if (groupKey !== key) {
|
|
4067
|
+
finalDefaults[groupKey] = false;
|
|
4068
|
+
}
|
|
4069
|
+
});
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
finalDefaults[key] = overrideValue;
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
return finalDefaults;
|
|
4076
|
+
};
|
|
4077
|
+
|
|
4055
4078
|
const typographyThemeDefaults = {
|
|
4056
4079
|
md: true,
|
|
4057
4080
|
default: true,
|
|
@@ -4065,7 +4088,8 @@ const createTypographyComponentTheme = (tag, base = "text-balance", textSizeMap
|
|
|
4065
4088
|
},
|
|
4066
4089
|
appearance: {
|
|
4067
4090
|
text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4068
|
-
}
|
|
4091
|
+
},
|
|
4092
|
+
typography: defaultTypographyTheme,
|
|
4069
4093
|
}, defaults);
|
|
4070
4094
|
};
|
|
4071
4095
|
// Page title specific theme
|
|
@@ -4202,30 +4226,30 @@ BreakpointTheme.defaultClasses = {
|
|
|
4202
4226
|
xlCol: "max-xl:flex-col"
|
|
4203
4227
|
};
|
|
4204
4228
|
|
|
4205
|
-
const defaultCardTheme = new ComponentTheme("div", "
|
|
4229
|
+
const defaultCardTheme = new ComponentTheme("div", "", {
|
|
4206
4230
|
size: {
|
|
4207
4231
|
px: new PxTheme({
|
|
4208
4232
|
padding: {
|
|
4209
|
-
xs:
|
|
4210
|
-
sm:
|
|
4211
|
-
md:
|
|
4212
|
-
lg:
|
|
4213
|
-
xl:
|
|
4233
|
+
xs: "px-2",
|
|
4234
|
+
sm: "px-3 max-lg:px-2",
|
|
4235
|
+
md: "px-4 max-lg:px-3",
|
|
4236
|
+
lg: "px-5 max-lg:px-4 max-md:px-3",
|
|
4237
|
+
xl: "px-6 max-lg:px-5 max-md:px-4"
|
|
4214
4238
|
}
|
|
4215
4239
|
}),
|
|
4216
4240
|
py: new PyTheme({
|
|
4217
4241
|
padding: {
|
|
4218
|
-
xs:
|
|
4219
|
-
sm:
|
|
4220
|
-
md:
|
|
4221
|
-
lg:
|
|
4222
|
-
xl:
|
|
4242
|
+
xs: "py-2",
|
|
4243
|
+
sm: "py-3 max-lg:py-2",
|
|
4244
|
+
md: "py-4 max-lg:py-3",
|
|
4245
|
+
lg: "py-5 max-lg:py-4 max-md:py-3",
|
|
4246
|
+
xl: "py-6 max-lg:py-5 max-md:py-4"
|
|
4223
4247
|
}
|
|
4224
4248
|
}),
|
|
4225
4249
|
gap: new GapTheme({ gap: commonGaps }),
|
|
4226
|
-
shadow: new ShadowTheme(),
|
|
4227
4250
|
},
|
|
4228
4251
|
layout: {
|
|
4252
|
+
...defaultLayoutTheme,
|
|
4229
4253
|
border: new BorderTheme(),
|
|
4230
4254
|
ring: new RingTheme(),
|
|
4231
4255
|
radius: new RadiusTheme({
|
|
@@ -4240,6 +4264,7 @@ const defaultCardTheme = new ComponentTheme("div", "overflow-hidden", {
|
|
|
4240
4264
|
wrap: new WrapTheme(),
|
|
4241
4265
|
direction: new DirectionTheme(),
|
|
4242
4266
|
breakpoint: new BreakpointTheme(),
|
|
4267
|
+
shadow: ShadowAppearanceTheme.createTheme(),
|
|
4243
4268
|
},
|
|
4244
4269
|
appearance: {
|
|
4245
4270
|
background: new BgAppearanceTheme(),
|
|
@@ -4265,6 +4290,7 @@ const defaultRowTheme = new ComponentTheme("div", "flex-row", {
|
|
|
4265
4290
|
breakpoint: new BreakpointTheme(),
|
|
4266
4291
|
},
|
|
4267
4292
|
layout: {
|
|
4293
|
+
...defaultLayoutTheme,
|
|
4268
4294
|
wrap: new WrapTheme(),
|
|
4269
4295
|
},
|
|
4270
4296
|
}, {
|
|
@@ -4306,6 +4332,7 @@ const defaultContainerTheme = new ComponentTheme("div", "flex-col mx-auto w-full
|
|
|
4306
4332
|
}),
|
|
4307
4333
|
},
|
|
4308
4334
|
layout: {
|
|
4335
|
+
...defaultLayoutTheme,
|
|
4309
4336
|
border: new BorderTheme(),
|
|
4310
4337
|
ring: new RingTheme(),
|
|
4311
4338
|
wrap: new WrapTheme(),
|
|
@@ -4341,6 +4368,7 @@ const defaultColTheme = new ComponentTheme("div", "flex-col", {
|
|
|
4341
4368
|
gap: new GapTheme({ gap: commonGaps }),
|
|
4342
4369
|
},
|
|
4343
4370
|
layout: {
|
|
4371
|
+
...defaultLayoutTheme,
|
|
4344
4372
|
wrap: new WrapTheme(),
|
|
4345
4373
|
direction: new DirectionTheme(),
|
|
4346
4374
|
},
|
|
@@ -4376,6 +4404,7 @@ const defaultStackTheme = new ComponentTheme("div", "", {
|
|
|
4376
4404
|
}),
|
|
4377
4405
|
},
|
|
4378
4406
|
layout: {
|
|
4407
|
+
...defaultLayoutTheme,
|
|
4379
4408
|
wrap: new WrapTheme(),
|
|
4380
4409
|
direction: new DirectionTheme(),
|
|
4381
4410
|
},
|
|
@@ -4418,15 +4447,16 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
|
|
|
4418
4447
|
xl: 'gap-16',
|
|
4419
4448
|
}
|
|
4420
4449
|
}),
|
|
4421
|
-
shadow: new ShadowTheme(),
|
|
4422
4450
|
},
|
|
4423
4451
|
appearance: {
|
|
4424
4452
|
background: new BgAppearanceTheme(),
|
|
4425
4453
|
text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4426
4454
|
border: TextAppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4427
4455
|
ring: TextAppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4456
|
+
shadow: ShadowAppearanceTheme.createTheme(),
|
|
4428
4457
|
},
|
|
4429
4458
|
layout: {
|
|
4459
|
+
...defaultLayoutTheme,
|
|
4430
4460
|
wrap: new WrapTheme(),
|
|
4431
4461
|
direction: new DirectionTheme(),
|
|
4432
4462
|
border: new BorderTheme(),
|
|
@@ -4471,6 +4501,7 @@ const gridSubThemes = {
|
|
|
4471
4501
|
}
|
|
4472
4502
|
}),
|
|
4473
4503
|
},
|
|
4504
|
+
layout: defaultLayoutTheme,
|
|
4474
4505
|
};
|
|
4475
4506
|
const defaultGrid3Theme = new ComponentTheme("div", "grid-cols-1 md:grid-cols-3", gridSubThemes, gridDefaults);
|
|
4476
4507
|
const defaultGrid4Theme = new ComponentTheme("div", "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4", gridSubThemes, gridDefaults);
|
|
@@ -4661,6 +4692,7 @@ exports.Link = Link;
|
|
|
4661
4692
|
exports.List = List;
|
|
4662
4693
|
exports.ListItem = ListItem;
|
|
4663
4694
|
exports.MODE_KEYS = MODE_KEYS;
|
|
4695
|
+
exports.OVERFLOW_KEYS = OVERFLOW_KEYS;
|
|
4664
4696
|
exports.PADDING_KEYS = PADDING_KEYS;
|
|
4665
4697
|
exports.PILL_KEYS = PILL_KEYS;
|
|
4666
4698
|
exports.POSITION_KEYS = POSITION_KEYS;
|