@vaneui/ui 0.0.17 → 0.0.19
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/complex.css +34 -706
- package/dist/components/theme/components/theme/themeContext.d.ts +8 -4
- package/dist/components/theme/components/ui/theme/common/ComponentTheme.d.ts +2 -2
- package/dist/components/theme/components/utils/componentUtils.d.ts +1 -1
- package/dist/components/theme/index.js +207 -193
- package/dist/components/theme/index.js.map +1 -1
- package/dist/components/theme/themeContext.d.ts +8 -4
- package/dist/components/ui/theme/common/ComponentTheme.d.ts +2 -2
- package/dist/components/utils/componentUtils.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +210 -194
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +211 -193
- package/dist/index.js.map +1 -1
- package/dist/ui.css +34 -706
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2988,25 +2988,25 @@ const positionClasses = {
|
|
|
2988
2988
|
static: "static"
|
|
2989
2989
|
};
|
|
2990
2990
|
const shadowClasses = {
|
|
2991
|
-
xs: "shadow-
|
|
2992
|
-
sm: "shadow-
|
|
2993
|
-
md: "shadow-
|
|
2994
|
-
lg: "shadow-
|
|
2995
|
-
xl: "shadow-
|
|
2991
|
+
xs: "shadow-2xs",
|
|
2992
|
+
sm: "shadow-xs",
|
|
2993
|
+
md: "shadow-sm",
|
|
2994
|
+
lg: "shadow-md",
|
|
2995
|
+
xl: "shadow-lg"
|
|
2996
2996
|
};
|
|
2997
2997
|
const hoverShadowClasses = {
|
|
2998
|
-
xs: "hover:shadow-
|
|
2999
|
-
sm: "hover:shadow-
|
|
3000
|
-
md: "hover:shadow-
|
|
3001
|
-
lg: "hover:shadow-
|
|
3002
|
-
xl: "hover:shadow-
|
|
2998
|
+
xs: "hover:shadow-xs",
|
|
2999
|
+
sm: "hover:shadow-sm",
|
|
3000
|
+
md: "hover:shadow-md",
|
|
3001
|
+
lg: "hover:shadow-lg",
|
|
3002
|
+
xl: "hover:shadow-xl"
|
|
3003
3003
|
};
|
|
3004
3004
|
const activeShadowClasses = {
|
|
3005
|
-
xs: "active:shadow-
|
|
3006
|
-
sm: "active:shadow-
|
|
3007
|
-
md: "active:shadow-
|
|
3008
|
-
lg: "active:shadow-
|
|
3009
|
-
xl: "active:shadow-
|
|
3005
|
+
xs: "active:shadow-xs",
|
|
3006
|
+
sm: "active:shadow-sm",
|
|
3007
|
+
md: "active:shadow-md",
|
|
3008
|
+
lg: "active:shadow-lg",
|
|
3009
|
+
xl: "active:shadow-xl"
|
|
3010
3010
|
};
|
|
3011
3011
|
const noRingModeClasses = {
|
|
3012
3012
|
base: "ring-0",
|
|
@@ -3024,27 +3024,26 @@ const noShadowModeClasses = {
|
|
|
3024
3024
|
active: "active:shadow-none",
|
|
3025
3025
|
};
|
|
3026
3026
|
|
|
3027
|
-
function
|
|
3027
|
+
function pickFirstTruthyKeyOptional(collection, keys) {
|
|
3028
3028
|
for (const k of keys) {
|
|
3029
|
-
if (
|
|
3029
|
+
if (collection[k] === true)
|
|
3030
3030
|
return k;
|
|
3031
3031
|
}
|
|
3032
|
-
return
|
|
3032
|
+
return undefined;
|
|
3033
3033
|
}
|
|
3034
3034
|
/**
|
|
3035
3035
|
* Pick the first truthy key from props, then from defaults, then fallback.
|
|
3036
3036
|
*/
|
|
3037
|
-
function
|
|
3038
|
-
//
|
|
3039
|
-
const explicit =
|
|
3037
|
+
function pickFirstTruthyKey(props, defaults, keys) {
|
|
3038
|
+
// first check explicit usage in props
|
|
3039
|
+
const explicit = pickFirstTruthyKeyOptional(props, keys);
|
|
3040
3040
|
if (explicit)
|
|
3041
3041
|
return explicit;
|
|
3042
|
-
//
|
|
3043
|
-
const def =
|
|
3042
|
+
// then check component‐level defaults
|
|
3043
|
+
const def = pickFirstTruthyKeyOptional(defaults, keys);
|
|
3044
3044
|
if (def)
|
|
3045
3045
|
return def;
|
|
3046
|
-
|
|
3047
|
-
return fallback;
|
|
3046
|
+
return undefined;
|
|
3048
3047
|
}
|
|
3049
3048
|
|
|
3050
3049
|
class HideTheme extends BaseTheme {
|
|
@@ -3056,81 +3055,12 @@ class HideTheme extends BaseTheme {
|
|
|
3056
3055
|
});
|
|
3057
3056
|
}
|
|
3058
3057
|
getClasses(props, defaults) {
|
|
3059
|
-
const key =
|
|
3058
|
+
const key = pickFirstTruthyKey(props, defaults, HIDE_KEYS);
|
|
3060
3059
|
return [key ? this[key] : ''];
|
|
3061
3060
|
}
|
|
3062
3061
|
}
|
|
3063
3062
|
HideTheme.defaultClasses = hideClasses;
|
|
3064
3063
|
|
|
3065
|
-
const isObject = (item) => {
|
|
3066
|
-
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
3067
|
-
};
|
|
3068
|
-
const deepMerge = (target, source) => {
|
|
3069
|
-
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
3070
|
-
for (const key in source) {
|
|
3071
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3072
|
-
const sourceValue = source[key];
|
|
3073
|
-
const targetValue = output[key];
|
|
3074
|
-
if (sourceValue === undefined) {
|
|
3075
|
-
continue;
|
|
3076
|
-
}
|
|
3077
|
-
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
3078
|
-
if (key === 'defaults' &&
|
|
3079
|
-
isObject(targetValue) &&
|
|
3080
|
-
isObject(sourceValue)) {
|
|
3081
|
-
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
3082
|
-
}
|
|
3083
|
-
// For all other objects, use the standard recursive deep merge.
|
|
3084
|
-
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
3085
|
-
output[key] = deepMerge(targetValue, sourceValue);
|
|
3086
|
-
}
|
|
3087
|
-
// For non-object values, just assign the value from the source.
|
|
3088
|
-
else {
|
|
3089
|
-
output[key] = sourceValue;
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
|
-
}
|
|
3093
|
-
return output;
|
|
3094
|
-
};
|
|
3095
|
-
const deepClone = (source) => {
|
|
3096
|
-
if (!isObject(source)) {
|
|
3097
|
-
return source;
|
|
3098
|
-
}
|
|
3099
|
-
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
3100
|
-
for (const key in output) {
|
|
3101
|
-
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
3102
|
-
output[key] = deepClone(output[key]);
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3105
|
-
return output;
|
|
3106
|
-
};
|
|
3107
|
-
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
3108
|
-
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
3109
|
-
const finalDefaults = { ...baseDefaults };
|
|
3110
|
-
// Iterate over the override keys to apply them.
|
|
3111
|
-
for (const key in overrideDefaults) {
|
|
3112
|
-
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
3113
|
-
const overrideValue = overrideDefaults[key];
|
|
3114
|
-
// If the override is setting a key to true...
|
|
3115
|
-
if (overrideValue) {
|
|
3116
|
-
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
3117
|
-
const group = findGroup(key);
|
|
3118
|
-
// If the key is part of an exclusive group...
|
|
3119
|
-
if (group) {
|
|
3120
|
-
// ...set all other keys in that group to false.
|
|
3121
|
-
group.forEach(groupKey => {
|
|
3122
|
-
if (groupKey !== key) {
|
|
3123
|
-
finalDefaults[groupKey] = false;
|
|
3124
|
-
}
|
|
3125
|
-
});
|
|
3126
|
-
}
|
|
3127
|
-
}
|
|
3128
|
-
finalDefaults[key] = overrideValue;
|
|
3129
|
-
}
|
|
3130
|
-
}
|
|
3131
|
-
return finalDefaults;
|
|
3132
|
-
};
|
|
3133
|
-
|
|
3134
3064
|
class ItemsTheme extends BaseTheme {
|
|
3135
3065
|
constructor(initialConfig) {
|
|
3136
3066
|
super();
|
|
@@ -3140,7 +3070,7 @@ class ItemsTheme extends BaseTheme {
|
|
|
3140
3070
|
});
|
|
3141
3071
|
}
|
|
3142
3072
|
getClasses(props, defaults) {
|
|
3143
|
-
const pickedKey =
|
|
3073
|
+
const pickedKey = pickFirstTruthyKey(props, defaults, ITEMS_KEYS);
|
|
3144
3074
|
return [pickedKey && this[pickedKey] ? this[pickedKey] : ''];
|
|
3145
3075
|
}
|
|
3146
3076
|
}
|
|
@@ -3161,7 +3091,7 @@ class JustifyTheme extends BaseTheme {
|
|
|
3161
3091
|
});
|
|
3162
3092
|
}
|
|
3163
3093
|
getClasses(props, defaults) {
|
|
3164
|
-
const key =
|
|
3094
|
+
const key = pickFirstTruthyKey(props, defaults, JUSTIFY_KEYS);
|
|
3165
3095
|
return [key ? this[key] : ''];
|
|
3166
3096
|
}
|
|
3167
3097
|
}
|
|
@@ -3176,7 +3106,7 @@ class PositionTheme extends BaseTheme {
|
|
|
3176
3106
|
});
|
|
3177
3107
|
}
|
|
3178
3108
|
getClasses(props, defaults) {
|
|
3179
|
-
const key =
|
|
3109
|
+
const key = pickFirstTruthyKey(props, defaults, POSITION_KEYS);
|
|
3180
3110
|
return [key ? this[key] : ''];
|
|
3181
3111
|
}
|
|
3182
3112
|
}
|
|
@@ -3259,6 +3189,21 @@ const textSizeClasses = {
|
|
|
3259
3189
|
xl: "text-xl",
|
|
3260
3190
|
};
|
|
3261
3191
|
|
|
3192
|
+
class FontStyleTheme extends BaseTheme {
|
|
3193
|
+
constructor(initial) {
|
|
3194
|
+
super();
|
|
3195
|
+
FONT_STYLE_KEYS.forEach((key) => {
|
|
3196
|
+
var _a;
|
|
3197
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
|
|
3198
|
+
});
|
|
3199
|
+
}
|
|
3200
|
+
getClasses(props, defaults) {
|
|
3201
|
+
const key = pickFirstTruthyKey(props, defaults, FONT_STYLE_KEYS);
|
|
3202
|
+
return [key ? this[key] : '']; // No default for font style
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
FontStyleTheme.defaultClasses = fontStyleClasses;
|
|
3206
|
+
|
|
3262
3207
|
class FontFamilyTheme extends BaseTheme {
|
|
3263
3208
|
constructor(initial) {
|
|
3264
3209
|
super();
|
|
@@ -3268,7 +3213,7 @@ class FontFamilyTheme extends BaseTheme {
|
|
|
3268
3213
|
});
|
|
3269
3214
|
}
|
|
3270
3215
|
getClasses(props, defaults) {
|
|
3271
|
-
const key =
|
|
3216
|
+
const key = pickFirstTruthyKey(props, defaults, FONT_FAMILY_KEYS);
|
|
3272
3217
|
return [this[key !== null && key !== void 0 ? key : 'sans'] || ''];
|
|
3273
3218
|
}
|
|
3274
3219
|
}
|
|
@@ -3283,27 +3228,12 @@ class FontWeightTheme extends BaseTheme {
|
|
|
3283
3228
|
});
|
|
3284
3229
|
}
|
|
3285
3230
|
getClasses(props, defaults) {
|
|
3286
|
-
const key =
|
|
3231
|
+
const key = pickFirstTruthyKey(props, defaults, FONT_WEIGHT_KEYS);
|
|
3287
3232
|
return [this[key !== null && key !== void 0 ? key : 'normal'] || '']; // Default to 'normal' if no key is provided
|
|
3288
3233
|
}
|
|
3289
3234
|
}
|
|
3290
3235
|
FontWeightTheme.defaultClasses = fontWeightClasses;
|
|
3291
3236
|
|
|
3292
|
-
class FontStyleTheme extends BaseTheme {
|
|
3293
|
-
constructor(initial) {
|
|
3294
|
-
super();
|
|
3295
|
-
FONT_STYLE_KEYS.forEach((key) => {
|
|
3296
|
-
var _a;
|
|
3297
|
-
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
|
|
3298
|
-
});
|
|
3299
|
-
}
|
|
3300
|
-
getClasses(props, defaults) {
|
|
3301
|
-
const key = pickKey(props, defaults, FONT_STYLE_KEYS);
|
|
3302
|
-
return [key ? this[key] : '']; // No default for font style
|
|
3303
|
-
}
|
|
3304
|
-
}
|
|
3305
|
-
FontStyleTheme.defaultClasses = fontStyleClasses;
|
|
3306
|
-
|
|
3307
3237
|
class TextDecorationTheme extends BaseTheme {
|
|
3308
3238
|
constructor(initial) {
|
|
3309
3239
|
super();
|
|
@@ -3313,7 +3243,7 @@ class TextDecorationTheme extends BaseTheme {
|
|
|
3313
3243
|
});
|
|
3314
3244
|
}
|
|
3315
3245
|
getClasses(props, defaults) {
|
|
3316
|
-
const key =
|
|
3246
|
+
const key = pickFirstTruthyKey(props, defaults, TEXT_DECORATION_KEYS);
|
|
3317
3247
|
return [key ? this[key] : '']; // No default for text decoration
|
|
3318
3248
|
}
|
|
3319
3249
|
}
|
|
@@ -3328,7 +3258,7 @@ class TextTransformTheme extends BaseTheme {
|
|
|
3328
3258
|
});
|
|
3329
3259
|
}
|
|
3330
3260
|
getClasses(props, defaults) {
|
|
3331
|
-
const key =
|
|
3261
|
+
const key = pickFirstTruthyKey(props, defaults, TEXT_TRANSFORM_KEYS);
|
|
3332
3262
|
return [key ? this[key] : '']; // No default for text transform
|
|
3333
3263
|
}
|
|
3334
3264
|
}
|
|
@@ -3343,12 +3273,81 @@ class TextAlignTheme extends BaseTheme {
|
|
|
3343
3273
|
});
|
|
3344
3274
|
}
|
|
3345
3275
|
getClasses(props, defaults) {
|
|
3346
|
-
const key =
|
|
3276
|
+
const key = pickFirstTruthyKey(props, defaults, TEXT_ALIGN_KEYS);
|
|
3347
3277
|
return [key ? this[key] : '']; // No default for text align
|
|
3348
3278
|
}
|
|
3349
3279
|
}
|
|
3350
3280
|
TextAlignTheme.defaultClasses = textAlignClasses;
|
|
3351
3281
|
|
|
3282
|
+
const isObject = (item) => {
|
|
3283
|
+
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
3284
|
+
};
|
|
3285
|
+
const deepMerge = (target, source) => {
|
|
3286
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
3287
|
+
for (const key in source) {
|
|
3288
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3289
|
+
const sourceValue = source[key];
|
|
3290
|
+
const targetValue = output[key];
|
|
3291
|
+
if (sourceValue === undefined) {
|
|
3292
|
+
continue;
|
|
3293
|
+
}
|
|
3294
|
+
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
3295
|
+
if (key === 'defaults' &&
|
|
3296
|
+
isObject(targetValue) &&
|
|
3297
|
+
isObject(sourceValue)) {
|
|
3298
|
+
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
3299
|
+
}
|
|
3300
|
+
// For all other objects, use the standard recursive deep merge.
|
|
3301
|
+
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
3302
|
+
output[key] = deepMerge(targetValue, sourceValue);
|
|
3303
|
+
}
|
|
3304
|
+
// For non-object values, just assign the value from the source.
|
|
3305
|
+
else {
|
|
3306
|
+
output[key] = sourceValue;
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
return output;
|
|
3311
|
+
};
|
|
3312
|
+
const deepClone = (source) => {
|
|
3313
|
+
if (!isObject(source)) {
|
|
3314
|
+
return source;
|
|
3315
|
+
}
|
|
3316
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
3317
|
+
for (const key in output) {
|
|
3318
|
+
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
3319
|
+
output[key] = deepClone(output[key]);
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
return output;
|
|
3323
|
+
};
|
|
3324
|
+
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
3325
|
+
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
3326
|
+
const finalDefaults = { ...baseDefaults };
|
|
3327
|
+
// Iterate over the override keys to apply them.
|
|
3328
|
+
for (const key in overrideDefaults) {
|
|
3329
|
+
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
3330
|
+
const overrideValue = overrideDefaults[key];
|
|
3331
|
+
// If the override is setting a key to true...
|
|
3332
|
+
if (overrideValue) {
|
|
3333
|
+
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
3334
|
+
const group = findGroup(key);
|
|
3335
|
+
// If the key is part of an exclusive group...
|
|
3336
|
+
if (group) {
|
|
3337
|
+
// ...set all other keys in that group to false.
|
|
3338
|
+
group.forEach(groupKey => {
|
|
3339
|
+
if (groupKey !== key) {
|
|
3340
|
+
finalDefaults[groupKey] = false;
|
|
3341
|
+
}
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
finalDefaults[key] = overrideValue;
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
return finalDefaults;
|
|
3349
|
+
};
|
|
3350
|
+
|
|
3352
3351
|
class ComponentTheme {
|
|
3353
3352
|
constructor(tag, base, subThemes, defaults = {}) {
|
|
3354
3353
|
this.tag = tag;
|
|
@@ -3404,7 +3403,7 @@ class SizeTheme extends BaseTheme {
|
|
|
3404
3403
|
});
|
|
3405
3404
|
}
|
|
3406
3405
|
getClasses(props, defaults) {
|
|
3407
|
-
const size =
|
|
3406
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS);
|
|
3408
3407
|
return [this[size !== null && size !== void 0 ? size : 'md'] || ''];
|
|
3409
3408
|
}
|
|
3410
3409
|
}
|
|
@@ -3425,8 +3424,8 @@ class GapTheme extends BaseTheme {
|
|
|
3425
3424
|
});
|
|
3426
3425
|
}
|
|
3427
3426
|
getClasses(props, defaults) {
|
|
3428
|
-
const size =
|
|
3429
|
-
const key =
|
|
3427
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3428
|
+
const key = pickFirstTruthyKey(props, defaults, GAP_KEYS) || 'noGap';
|
|
3430
3429
|
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3431
3430
|
}
|
|
3432
3431
|
}
|
|
@@ -3450,8 +3449,8 @@ class RadiusTheme extends BaseTheme {
|
|
|
3450
3449
|
});
|
|
3451
3450
|
}
|
|
3452
3451
|
getClasses(props, defaults) {
|
|
3453
|
-
const size =
|
|
3454
|
-
const shape =
|
|
3452
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3453
|
+
const shape = pickFirstTruthyKey(props, defaults, SHAPE_KEYS) || 'rounded';
|
|
3455
3454
|
return [typeof this[shape] === 'string' ? this[shape] : this[shape][size]];
|
|
3456
3455
|
}
|
|
3457
3456
|
}
|
|
@@ -3470,8 +3469,8 @@ class ShadowTheme extends BaseTheme {
|
|
|
3470
3469
|
});
|
|
3471
3470
|
}
|
|
3472
3471
|
getClasses(props, defaults) {
|
|
3473
|
-
const size =
|
|
3474
|
-
const key =
|
|
3472
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3473
|
+
const key = pickFirstTruthyKey(props, defaults, SHADOW_KEYS);
|
|
3475
3474
|
if (key === undefined) {
|
|
3476
3475
|
return [];
|
|
3477
3476
|
}
|
|
@@ -3501,7 +3500,7 @@ class BorderTheme extends BaseTheme {
|
|
|
3501
3500
|
});
|
|
3502
3501
|
}
|
|
3503
3502
|
getClasses(props, defaults) {
|
|
3504
|
-
const key =
|
|
3503
|
+
const key = pickFirstTruthyKey(props, defaults, BORDER_KEYS);
|
|
3505
3504
|
if (!key || !this[key]) {
|
|
3506
3505
|
return MODE_KEYS.map(() => '');
|
|
3507
3506
|
}
|
|
@@ -3515,10 +3514,15 @@ BorderTheme.defaultClasses = {
|
|
|
3515
3514
|
active: "active:border",
|
|
3516
3515
|
},
|
|
3517
3516
|
noBorder: {
|
|
3518
|
-
base: "
|
|
3519
|
-
hover: "
|
|
3520
|
-
active: "
|
|
3517
|
+
base: "",
|
|
3518
|
+
hover: "",
|
|
3519
|
+
active: "",
|
|
3521
3520
|
},
|
|
3521
|
+
//noBorder: {
|
|
3522
|
+
// base: "border-none",
|
|
3523
|
+
// hover: "hover:border-none",
|
|
3524
|
+
// active: "active:border-none",
|
|
3525
|
+
//},
|
|
3522
3526
|
};
|
|
3523
3527
|
|
|
3524
3528
|
class RingTheme extends BaseTheme {
|
|
@@ -3532,7 +3536,7 @@ class RingTheme extends BaseTheme {
|
|
|
3532
3536
|
});
|
|
3533
3537
|
}
|
|
3534
3538
|
getClasses(props, defaults) {
|
|
3535
|
-
const key =
|
|
3539
|
+
const key = pickFirstTruthyKey(props, defaults, RING_KEYS);
|
|
3536
3540
|
if (!key || !this[key]) {
|
|
3537
3541
|
return MODE_KEYS.map(() => '');
|
|
3538
3542
|
}
|
|
@@ -3553,8 +3557,8 @@ class PxTheme extends BaseTheme {
|
|
|
3553
3557
|
});
|
|
3554
3558
|
}
|
|
3555
3559
|
getClasses(props, defaults) {
|
|
3556
|
-
const size =
|
|
3557
|
-
const key =
|
|
3560
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3561
|
+
const key = pickFirstTruthyKey(props, defaults, PADDING_KEYS) || 'noPadding';
|
|
3558
3562
|
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3559
3563
|
}
|
|
3560
3564
|
}
|
|
@@ -3578,8 +3582,8 @@ class PyTheme extends BaseTheme {
|
|
|
3578
3582
|
});
|
|
3579
3583
|
}
|
|
3580
3584
|
getClasses(props, defaults) {
|
|
3581
|
-
const size =
|
|
3582
|
-
const key =
|
|
3585
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3586
|
+
const key = pickFirstTruthyKey(props, defaults, PADDING_KEYS) || 'noPadding';
|
|
3583
3587
|
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3584
3588
|
}
|
|
3585
3589
|
}
|
|
@@ -3607,7 +3611,7 @@ class TextAppearanceTheme extends BaseTheme {
|
|
|
3607
3611
|
});
|
|
3608
3612
|
}
|
|
3609
3613
|
getClasses(props, defaults) {
|
|
3610
|
-
const pickedAppearanceKey =
|
|
3614
|
+
const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, TEXT_APPEARANCE_KEYS) || 'default';
|
|
3611
3615
|
const modesForAppearance = this[pickedAppearanceKey];
|
|
3612
3616
|
if (!modesForAppearance) {
|
|
3613
3617
|
return MODE_KEYS.map(() => '');
|
|
@@ -3829,7 +3833,7 @@ class VariantTheme extends BaseTheme {
|
|
|
3829
3833
|
});
|
|
3830
3834
|
}
|
|
3831
3835
|
getClasses(props, defaults) {
|
|
3832
|
-
const activeVariantKey =
|
|
3836
|
+
const activeVariantKey = pickFirstTruthyKey(props, defaults, VARIANT_KEYS) || 'outline';
|
|
3833
3837
|
const activeTextAppearanceTheme = this[activeVariantKey];
|
|
3834
3838
|
if (!activeTextAppearanceTheme) {
|
|
3835
3839
|
return [];
|
|
@@ -3886,8 +3890,8 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
3886
3890
|
px: new PxTheme({
|
|
3887
3891
|
padding: {
|
|
3888
3892
|
xs: 'px-2',
|
|
3889
|
-
sm: 'px-
|
|
3890
|
-
md: 'px-
|
|
3893
|
+
sm: 'px-3',
|
|
3894
|
+
md: 'px-4',
|
|
3891
3895
|
lg: 'px-5',
|
|
3892
3896
|
xl: 'px-6',
|
|
3893
3897
|
}
|
|
@@ -3897,25 +3901,25 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
3897
3901
|
xs: 'py-1',
|
|
3898
3902
|
sm: 'py-1.5',
|
|
3899
3903
|
md: 'py-2',
|
|
3900
|
-
lg: 'py-
|
|
3901
|
-
xl: 'py-
|
|
3904
|
+
lg: 'py-2.5',
|
|
3905
|
+
xl: 'py-3',
|
|
3902
3906
|
}
|
|
3903
3907
|
}),
|
|
3904
3908
|
gap: new GapTheme({
|
|
3905
3909
|
gap: {
|
|
3906
|
-
xs: 'gap-1
|
|
3907
|
-
sm: 'gap-
|
|
3908
|
-
md: 'gap-
|
|
3909
|
-
lg: 'gap-
|
|
3910
|
-
xl: 'gap-
|
|
3910
|
+
xs: 'gap-1',
|
|
3911
|
+
sm: 'gap-1.5',
|
|
3912
|
+
md: 'gap-2',
|
|
3913
|
+
lg: 'gap-2.5',
|
|
3914
|
+
xl: 'gap-3',
|
|
3911
3915
|
}
|
|
3912
3916
|
}),
|
|
3913
3917
|
text: new SizeTheme({
|
|
3914
|
-
xs: 'text-xs
|
|
3915
|
-
sm: 'text-sm
|
|
3918
|
+
xs: 'text-xs',
|
|
3919
|
+
sm: 'text-sm',
|
|
3916
3920
|
md: 'text-base',
|
|
3917
|
-
lg: 'text-lg
|
|
3918
|
-
xl: 'text-xl
|
|
3921
|
+
lg: 'text-lg',
|
|
3922
|
+
xl: 'text-xl',
|
|
3919
3923
|
}),
|
|
3920
3924
|
shadow: new ShadowTheme(),
|
|
3921
3925
|
},
|
|
@@ -3958,36 +3962,36 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit inline-flex tr
|
|
|
3958
3962
|
px: new PxTheme({
|
|
3959
3963
|
padding: {
|
|
3960
3964
|
xs: "px-2",
|
|
3961
|
-
sm: "px-
|
|
3962
|
-
md: "px-
|
|
3965
|
+
sm: "px-3",
|
|
3966
|
+
md: "px-4",
|
|
3963
3967
|
lg: "px-5",
|
|
3964
3968
|
xl: "px-6"
|
|
3965
3969
|
}
|
|
3966
3970
|
}),
|
|
3967
3971
|
py: new PyTheme({
|
|
3968
3972
|
padding: {
|
|
3969
|
-
xs:
|
|
3970
|
-
sm:
|
|
3971
|
-
md:
|
|
3972
|
-
lg:
|
|
3973
|
-
xl:
|
|
3973
|
+
xs: 'py-1',
|
|
3974
|
+
sm: 'py-1.5',
|
|
3975
|
+
md: 'py-2',
|
|
3976
|
+
lg: 'py-2.5',
|
|
3977
|
+
xl: 'py-3',
|
|
3974
3978
|
}
|
|
3975
3979
|
}),
|
|
3976
3980
|
gap: new GapTheme({
|
|
3977
3981
|
gap: {
|
|
3978
|
-
xs:
|
|
3979
|
-
sm:
|
|
3980
|
-
md:
|
|
3981
|
-
lg:
|
|
3982
|
-
xl:
|
|
3982
|
+
xs: 'gap-1',
|
|
3983
|
+
sm: 'gap-1.5',
|
|
3984
|
+
md: 'gap-2',
|
|
3985
|
+
lg: 'gap-2.5',
|
|
3986
|
+
xl: 'gap-3',
|
|
3983
3987
|
}
|
|
3984
3988
|
}),
|
|
3985
3989
|
text: new SizeTheme({
|
|
3986
|
-
xs: 'text-xs
|
|
3987
|
-
sm: 'text-sm
|
|
3990
|
+
xs: 'text-xs',
|
|
3991
|
+
sm: 'text-sm',
|
|
3988
3992
|
md: 'text-base',
|
|
3989
|
-
lg: 'text-lg
|
|
3990
|
-
xl: 'text-xl
|
|
3993
|
+
lg: 'text-lg',
|
|
3994
|
+
xl: 'text-xl',
|
|
3991
3995
|
}),
|
|
3992
3996
|
shadow: new ShadowTheme(),
|
|
3993
3997
|
},
|
|
@@ -4037,26 +4041,26 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit inline-flex gap
|
|
|
4037
4041
|
padding: {
|
|
4038
4042
|
xs: 'px-2',
|
|
4039
4043
|
sm: 'px-2.5',
|
|
4040
|
-
md: 'px-3
|
|
4041
|
-
lg: 'px-5',
|
|
4042
|
-
xl: 'px-
|
|
4044
|
+
md: 'px-3',
|
|
4045
|
+
lg: 'px-3.5',
|
|
4046
|
+
xl: 'px-4',
|
|
4043
4047
|
}
|
|
4044
4048
|
}),
|
|
4045
4049
|
py: new PyTheme({
|
|
4046
4050
|
padding: {
|
|
4047
|
-
xs: 'py-
|
|
4048
|
-
sm: 'py-1
|
|
4049
|
-
md: 'py-
|
|
4050
|
-
lg: 'py-
|
|
4051
|
-
xl: 'py-
|
|
4051
|
+
xs: 'py-0.5',
|
|
4052
|
+
sm: 'py-1',
|
|
4053
|
+
md: 'py-1.5',
|
|
4054
|
+
lg: 'py-2',
|
|
4055
|
+
xl: 'py-2.5',
|
|
4052
4056
|
}
|
|
4053
4057
|
}),
|
|
4054
4058
|
text: new SizeTheme({
|
|
4055
4059
|
xs: 'text-xs',
|
|
4056
4060
|
sm: 'text-sm',
|
|
4057
|
-
md: 'text-
|
|
4058
|
-
lg: 'text-
|
|
4059
|
-
xl: 'text-
|
|
4061
|
+
md: 'text-base',
|
|
4062
|
+
lg: 'text-lg',
|
|
4063
|
+
xl: 'text-xl',
|
|
4060
4064
|
}),
|
|
4061
4065
|
gap: new GapTheme({
|
|
4062
4066
|
gap: {
|
|
@@ -4165,9 +4169,8 @@ class DirectionTheme extends BaseTheme {
|
|
|
4165
4169
|
});
|
|
4166
4170
|
}
|
|
4167
4171
|
getClasses(props, defaults) {
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
const reverse = pickKey(props, defaults, DIRECTION_REVERSE_KEYS);
|
|
4172
|
+
let direction = pickFirstTruthyKey(props, defaults, FLEX_DIRECTION_KEYS) || 'column';
|
|
4173
|
+
const reverse = pickFirstTruthyKey(props, defaults, DIRECTION_REVERSE_KEYS);
|
|
4171
4174
|
if (reverse) {
|
|
4172
4175
|
switch (direction) {
|
|
4173
4176
|
case "column":
|
|
@@ -4197,7 +4200,7 @@ class WrapTheme extends BaseTheme {
|
|
|
4197
4200
|
});
|
|
4198
4201
|
}
|
|
4199
4202
|
getClasses(props, defaults) {
|
|
4200
|
-
const key =
|
|
4203
|
+
const key = pickFirstTruthyKey(props, defaults, WRAP_KEYS);
|
|
4201
4204
|
return key ? [this[key]] : [];
|
|
4202
4205
|
}
|
|
4203
4206
|
}
|
|
@@ -4224,7 +4227,7 @@ class LayoutAppearanceTheme extends BaseTheme {
|
|
|
4224
4227
|
});
|
|
4225
4228
|
}
|
|
4226
4229
|
getClasses(props, defaults) {
|
|
4227
|
-
const pickedAppearanceKey =
|
|
4230
|
+
const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, APPEARANCE_KEYS) || 'default';
|
|
4228
4231
|
const modesForAppearance = this[pickedAppearanceKey];
|
|
4229
4232
|
if (!modesForAppearance) {
|
|
4230
4233
|
return MODE_KEYS.map(() => '');
|
|
@@ -4272,7 +4275,7 @@ class BreakpointTheme extends BaseTheme {
|
|
|
4272
4275
|
});
|
|
4273
4276
|
}
|
|
4274
4277
|
getClasses(props, defaults) {
|
|
4275
|
-
const key =
|
|
4278
|
+
const key = pickFirstTruthyKey(props, defaults, BREAKPOINT_KEYS);
|
|
4276
4279
|
if (!key)
|
|
4277
4280
|
return [];
|
|
4278
4281
|
return [this[key] || ''];
|
|
@@ -4468,18 +4471,18 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
|
|
|
4468
4471
|
}),
|
|
4469
4472
|
py: new PyTheme({
|
|
4470
4473
|
padding: {
|
|
4471
|
-
xs: 'py-3',
|
|
4472
|
-
sm: 'py-
|
|
4473
|
-
md: 'py-
|
|
4474
|
+
xs: 'py-4 max-md:py-3',
|
|
4475
|
+
sm: 'py-8 max-md:py-6',
|
|
4476
|
+
md: 'py-12 max-md:py-6',
|
|
4474
4477
|
lg: 'py-16 max-lg:py-14 max-md:py-12',
|
|
4475
4478
|
xl: 'py-20 max-lg:py-16 max-md:py-12',
|
|
4476
4479
|
}
|
|
4477
4480
|
}),
|
|
4478
4481
|
gap: new GapTheme({
|
|
4479
4482
|
gap: {
|
|
4480
|
-
xs: 'gap-
|
|
4481
|
-
sm: 'gap-
|
|
4482
|
-
md: 'gap-
|
|
4483
|
+
xs: 'gap-4',
|
|
4484
|
+
sm: 'gap-6',
|
|
4485
|
+
md: 'gap-8',
|
|
4483
4486
|
lg: 'gap-12',
|
|
4484
4487
|
xl: 'gap-16',
|
|
4485
4488
|
}
|
|
@@ -4541,6 +4544,8 @@ const gridSubThemes = {
|
|
|
4541
4544
|
const defaultGrid3Theme = new ComponentTheme("div", "grid grid-cols-1 md:grid-cols-3", gridSubThemes, gridDefaults);
|
|
4542
4545
|
const defaultGrid4Theme = new ComponentTheme("div", "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4", gridSubThemes, gridDefaults);
|
|
4543
4546
|
|
|
4547
|
+
const COMPONENT_KEYS = ['button', 'badge', 'chip', 'card', 'divider', 'row', 'col', 'stack', 'section',
|
|
4548
|
+
'grid3', 'grid4', 'pageTitle', 'sectionTitle', 'title', 'text', 'link', 'list', 'listItem'];
|
|
4544
4549
|
const defaultTheme = {
|
|
4545
4550
|
button: defaultButtonTheme,
|
|
4546
4551
|
badge: defaultBadgeTheme,
|
|
@@ -4563,16 +4568,27 @@ const defaultTheme = {
|
|
|
4563
4568
|
list: listTheme,
|
|
4564
4569
|
};
|
|
4565
4570
|
const ThemeContext = createContext(defaultTheme);
|
|
4566
|
-
function ThemeProvider({ children, theme: themeObject = {}, themeOverride }) {
|
|
4571
|
+
function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, themeOverride }) {
|
|
4567
4572
|
const mergedTheme = useMemo(() => {
|
|
4568
|
-
let
|
|
4573
|
+
let finalTheme = themeObject
|
|
4569
4574
|
? deepMerge(defaultTheme, themeObject)
|
|
4570
4575
|
: defaultTheme;
|
|
4571
4576
|
if (typeof themeOverride === 'function') {
|
|
4572
|
-
const themeToModify = deepClone(
|
|
4573
|
-
|
|
4577
|
+
const themeToModify = deepClone(finalTheme);
|
|
4578
|
+
finalTheme = themeOverride(themeToModify);
|
|
4579
|
+
}
|
|
4580
|
+
if (themeDefaults !== undefined) {
|
|
4581
|
+
for (const key in themeDefaults) {
|
|
4582
|
+
const componentKey = key;
|
|
4583
|
+
const componentTheme = finalTheme[componentKey];
|
|
4584
|
+
const themeDefault = themeDefaults[componentKey];
|
|
4585
|
+
if (themeDefault !== undefined) {
|
|
4586
|
+
finalTheme[componentKey].defaults =
|
|
4587
|
+
mergeDefaults(componentTheme.defaults, themeDefaults[componentKey]);
|
|
4588
|
+
}
|
|
4589
|
+
}
|
|
4574
4590
|
}
|
|
4575
|
-
return
|
|
4591
|
+
return finalTheme;
|
|
4576
4592
|
}, [themeObject, themeOverride]);
|
|
4577
4593
|
return (jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
|
|
4578
4594
|
}
|
|
@@ -4687,5 +4703,5 @@ const List = (props) => {
|
|
|
4687
4703
|
return buildComponent(props, theme.list, TYPOGRAPHY_COMPONENT_KEYS);
|
|
4688
4704
|
};
|
|
4689
4705
|
|
|
4690
|
-
export { Badge, Button, Card, Chip, Col, Container, Divider, Grid3, Grid4, Link, List, ListItem, PageTitle, Row, Section, SectionTitle, Stack, Text, ThemeProvider, Title, useTheme };
|
|
4706
|
+
export { Badge, Button, COMPONENT_KEYS, Card, Chip, Col, Container, Divider, Grid3, Grid4, Link, List, ListItem, PageTitle, Row, Section, SectionTitle, Stack, Text, ThemeProvider, Title, defaultTheme, useTheme };
|
|
4691
4707
|
//# sourceMappingURL=index.esm.js.map
|