@vaneui/ui 0.0.18 → 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 +0 -691
- package/dist/components/theme/components/utils/componentUtils.d.ts +1 -1
- package/dist/components/theme/index.js +39 -41
- package/dist/components/theme/index.js.map +1 -1
- package/dist/components/utils/componentUtils.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +42 -42
- package/dist/index.js +43 -41
- package/dist/index.js.map +1 -1
- package/dist/ui.css +0 -691
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3026,27 +3026,26 @@ const noShadowModeClasses = {
|
|
|
3026
3026
|
active: "active:shadow-none",
|
|
3027
3027
|
};
|
|
3028
3028
|
|
|
3029
|
-
function
|
|
3029
|
+
function pickFirstTruthyKeyOptional(collection, keys) {
|
|
3030
3030
|
for (const k of keys) {
|
|
3031
|
-
if (
|
|
3031
|
+
if (collection[k] === true)
|
|
3032
3032
|
return k;
|
|
3033
3033
|
}
|
|
3034
|
-
return
|
|
3034
|
+
return undefined;
|
|
3035
3035
|
}
|
|
3036
3036
|
/**
|
|
3037
3037
|
* Pick the first truthy key from props, then from defaults, then fallback.
|
|
3038
3038
|
*/
|
|
3039
|
-
function
|
|
3040
|
-
//
|
|
3041
|
-
const explicit =
|
|
3039
|
+
function pickFirstTruthyKey(props, defaults, keys) {
|
|
3040
|
+
// first check explicit usage in props
|
|
3041
|
+
const explicit = pickFirstTruthyKeyOptional(props, keys);
|
|
3042
3042
|
if (explicit)
|
|
3043
3043
|
return explicit;
|
|
3044
|
-
//
|
|
3045
|
-
const def =
|
|
3044
|
+
// then check component‐level defaults
|
|
3045
|
+
const def = pickFirstTruthyKeyOptional(defaults, keys);
|
|
3046
3046
|
if (def)
|
|
3047
3047
|
return def;
|
|
3048
|
-
|
|
3049
|
-
return fallback;
|
|
3048
|
+
return undefined;
|
|
3050
3049
|
}
|
|
3051
3050
|
|
|
3052
3051
|
class HideTheme extends BaseTheme {
|
|
@@ -3058,7 +3057,7 @@ class HideTheme extends BaseTheme {
|
|
|
3058
3057
|
});
|
|
3059
3058
|
}
|
|
3060
3059
|
getClasses(props, defaults) {
|
|
3061
|
-
const key =
|
|
3060
|
+
const key = pickFirstTruthyKey(props, defaults, HIDE_KEYS);
|
|
3062
3061
|
return [key ? this[key] : ''];
|
|
3063
3062
|
}
|
|
3064
3063
|
}
|
|
@@ -3073,7 +3072,7 @@ class ItemsTheme extends BaseTheme {
|
|
|
3073
3072
|
});
|
|
3074
3073
|
}
|
|
3075
3074
|
getClasses(props, defaults) {
|
|
3076
|
-
const pickedKey =
|
|
3075
|
+
const pickedKey = pickFirstTruthyKey(props, defaults, ITEMS_KEYS);
|
|
3077
3076
|
return [pickedKey && this[pickedKey] ? this[pickedKey] : ''];
|
|
3078
3077
|
}
|
|
3079
3078
|
}
|
|
@@ -3094,7 +3093,7 @@ class JustifyTheme extends BaseTheme {
|
|
|
3094
3093
|
});
|
|
3095
3094
|
}
|
|
3096
3095
|
getClasses(props, defaults) {
|
|
3097
|
-
const key =
|
|
3096
|
+
const key = pickFirstTruthyKey(props, defaults, JUSTIFY_KEYS);
|
|
3098
3097
|
return [key ? this[key] : ''];
|
|
3099
3098
|
}
|
|
3100
3099
|
}
|
|
@@ -3109,7 +3108,7 @@ class PositionTheme extends BaseTheme {
|
|
|
3109
3108
|
});
|
|
3110
3109
|
}
|
|
3111
3110
|
getClasses(props, defaults) {
|
|
3112
|
-
const key =
|
|
3111
|
+
const key = pickFirstTruthyKey(props, defaults, POSITION_KEYS);
|
|
3113
3112
|
return [key ? this[key] : ''];
|
|
3114
3113
|
}
|
|
3115
3114
|
}
|
|
@@ -3201,7 +3200,7 @@ class FontStyleTheme extends BaseTheme {
|
|
|
3201
3200
|
});
|
|
3202
3201
|
}
|
|
3203
3202
|
getClasses(props, defaults) {
|
|
3204
|
-
const key =
|
|
3203
|
+
const key = pickFirstTruthyKey(props, defaults, FONT_STYLE_KEYS);
|
|
3205
3204
|
return [key ? this[key] : '']; // No default for font style
|
|
3206
3205
|
}
|
|
3207
3206
|
}
|
|
@@ -3216,7 +3215,7 @@ class FontFamilyTheme extends BaseTheme {
|
|
|
3216
3215
|
});
|
|
3217
3216
|
}
|
|
3218
3217
|
getClasses(props, defaults) {
|
|
3219
|
-
const key =
|
|
3218
|
+
const key = pickFirstTruthyKey(props, defaults, FONT_FAMILY_KEYS);
|
|
3220
3219
|
return [this[key !== null && key !== void 0 ? key : 'sans'] || ''];
|
|
3221
3220
|
}
|
|
3222
3221
|
}
|
|
@@ -3231,7 +3230,7 @@ class FontWeightTheme extends BaseTheme {
|
|
|
3231
3230
|
});
|
|
3232
3231
|
}
|
|
3233
3232
|
getClasses(props, defaults) {
|
|
3234
|
-
const key =
|
|
3233
|
+
const key = pickFirstTruthyKey(props, defaults, FONT_WEIGHT_KEYS);
|
|
3235
3234
|
return [this[key !== null && key !== void 0 ? key : 'normal'] || '']; // Default to 'normal' if no key is provided
|
|
3236
3235
|
}
|
|
3237
3236
|
}
|
|
@@ -3246,7 +3245,7 @@ class TextDecorationTheme extends BaseTheme {
|
|
|
3246
3245
|
});
|
|
3247
3246
|
}
|
|
3248
3247
|
getClasses(props, defaults) {
|
|
3249
|
-
const key =
|
|
3248
|
+
const key = pickFirstTruthyKey(props, defaults, TEXT_DECORATION_KEYS);
|
|
3250
3249
|
return [key ? this[key] : '']; // No default for text decoration
|
|
3251
3250
|
}
|
|
3252
3251
|
}
|
|
@@ -3261,7 +3260,7 @@ class TextTransformTheme extends BaseTheme {
|
|
|
3261
3260
|
});
|
|
3262
3261
|
}
|
|
3263
3262
|
getClasses(props, defaults) {
|
|
3264
|
-
const key =
|
|
3263
|
+
const key = pickFirstTruthyKey(props, defaults, TEXT_TRANSFORM_KEYS);
|
|
3265
3264
|
return [key ? this[key] : '']; // No default for text transform
|
|
3266
3265
|
}
|
|
3267
3266
|
}
|
|
@@ -3276,7 +3275,7 @@ class TextAlignTheme extends BaseTheme {
|
|
|
3276
3275
|
});
|
|
3277
3276
|
}
|
|
3278
3277
|
getClasses(props, defaults) {
|
|
3279
|
-
const key =
|
|
3278
|
+
const key = pickFirstTruthyKey(props, defaults, TEXT_ALIGN_KEYS);
|
|
3280
3279
|
return [key ? this[key] : '']; // No default for text align
|
|
3281
3280
|
}
|
|
3282
3281
|
}
|
|
@@ -3406,7 +3405,7 @@ class SizeTheme extends BaseTheme {
|
|
|
3406
3405
|
});
|
|
3407
3406
|
}
|
|
3408
3407
|
getClasses(props, defaults) {
|
|
3409
|
-
const size =
|
|
3408
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS);
|
|
3410
3409
|
return [this[size !== null && size !== void 0 ? size : 'md'] || ''];
|
|
3411
3410
|
}
|
|
3412
3411
|
}
|
|
@@ -3427,8 +3426,8 @@ class GapTheme extends BaseTheme {
|
|
|
3427
3426
|
});
|
|
3428
3427
|
}
|
|
3429
3428
|
getClasses(props, defaults) {
|
|
3430
|
-
const size =
|
|
3431
|
-
const key =
|
|
3429
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3430
|
+
const key = pickFirstTruthyKey(props, defaults, GAP_KEYS) || 'noGap';
|
|
3432
3431
|
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3433
3432
|
}
|
|
3434
3433
|
}
|
|
@@ -3452,8 +3451,8 @@ class RadiusTheme extends BaseTheme {
|
|
|
3452
3451
|
});
|
|
3453
3452
|
}
|
|
3454
3453
|
getClasses(props, defaults) {
|
|
3455
|
-
const size =
|
|
3456
|
-
const shape =
|
|
3454
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3455
|
+
const shape = pickFirstTruthyKey(props, defaults, SHAPE_KEYS) || 'rounded';
|
|
3457
3456
|
return [typeof this[shape] === 'string' ? this[shape] : this[shape][size]];
|
|
3458
3457
|
}
|
|
3459
3458
|
}
|
|
@@ -3472,8 +3471,8 @@ class ShadowTheme extends BaseTheme {
|
|
|
3472
3471
|
});
|
|
3473
3472
|
}
|
|
3474
3473
|
getClasses(props, defaults) {
|
|
3475
|
-
const size =
|
|
3476
|
-
const key =
|
|
3474
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3475
|
+
const key = pickFirstTruthyKey(props, defaults, SHADOW_KEYS);
|
|
3477
3476
|
if (key === undefined) {
|
|
3478
3477
|
return [];
|
|
3479
3478
|
}
|
|
@@ -3503,7 +3502,7 @@ class BorderTheme extends BaseTheme {
|
|
|
3503
3502
|
});
|
|
3504
3503
|
}
|
|
3505
3504
|
getClasses(props, defaults) {
|
|
3506
|
-
const key =
|
|
3505
|
+
const key = pickFirstTruthyKey(props, defaults, BORDER_KEYS);
|
|
3507
3506
|
if (!key || !this[key]) {
|
|
3508
3507
|
return MODE_KEYS.map(() => '');
|
|
3509
3508
|
}
|
|
@@ -3539,7 +3538,7 @@ class RingTheme extends BaseTheme {
|
|
|
3539
3538
|
});
|
|
3540
3539
|
}
|
|
3541
3540
|
getClasses(props, defaults) {
|
|
3542
|
-
const key =
|
|
3541
|
+
const key = pickFirstTruthyKey(props, defaults, RING_KEYS);
|
|
3543
3542
|
if (!key || !this[key]) {
|
|
3544
3543
|
return MODE_KEYS.map(() => '');
|
|
3545
3544
|
}
|
|
@@ -3560,8 +3559,8 @@ class PxTheme extends BaseTheme {
|
|
|
3560
3559
|
});
|
|
3561
3560
|
}
|
|
3562
3561
|
getClasses(props, defaults) {
|
|
3563
|
-
const size =
|
|
3564
|
-
const key =
|
|
3562
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3563
|
+
const key = pickFirstTruthyKey(props, defaults, PADDING_KEYS) || 'noPadding';
|
|
3565
3564
|
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3566
3565
|
}
|
|
3567
3566
|
}
|
|
@@ -3585,8 +3584,8 @@ class PyTheme extends BaseTheme {
|
|
|
3585
3584
|
});
|
|
3586
3585
|
}
|
|
3587
3586
|
getClasses(props, defaults) {
|
|
3588
|
-
const size =
|
|
3589
|
-
const key =
|
|
3587
|
+
const size = pickFirstTruthyKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3588
|
+
const key = pickFirstTruthyKey(props, defaults, PADDING_KEYS) || 'noPadding';
|
|
3590
3589
|
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3591
3590
|
}
|
|
3592
3591
|
}
|
|
@@ -3614,7 +3613,7 @@ class TextAppearanceTheme extends BaseTheme {
|
|
|
3614
3613
|
});
|
|
3615
3614
|
}
|
|
3616
3615
|
getClasses(props, defaults) {
|
|
3617
|
-
const pickedAppearanceKey =
|
|
3616
|
+
const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, TEXT_APPEARANCE_KEYS) || 'default';
|
|
3618
3617
|
const modesForAppearance = this[pickedAppearanceKey];
|
|
3619
3618
|
if (!modesForAppearance) {
|
|
3620
3619
|
return MODE_KEYS.map(() => '');
|
|
@@ -3836,7 +3835,7 @@ class VariantTheme extends BaseTheme {
|
|
|
3836
3835
|
});
|
|
3837
3836
|
}
|
|
3838
3837
|
getClasses(props, defaults) {
|
|
3839
|
-
const activeVariantKey =
|
|
3838
|
+
const activeVariantKey = pickFirstTruthyKey(props, defaults, VARIANT_KEYS) || 'outline';
|
|
3840
3839
|
const activeTextAppearanceTheme = this[activeVariantKey];
|
|
3841
3840
|
if (!activeTextAppearanceTheme) {
|
|
3842
3841
|
return [];
|
|
@@ -4172,9 +4171,8 @@ class DirectionTheme extends BaseTheme {
|
|
|
4172
4171
|
});
|
|
4173
4172
|
}
|
|
4174
4173
|
getClasses(props, defaults) {
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
const reverse = pickKey(props, defaults, DIRECTION_REVERSE_KEYS);
|
|
4174
|
+
let direction = pickFirstTruthyKey(props, defaults, FLEX_DIRECTION_KEYS) || 'column';
|
|
4175
|
+
const reverse = pickFirstTruthyKey(props, defaults, DIRECTION_REVERSE_KEYS);
|
|
4178
4176
|
if (reverse) {
|
|
4179
4177
|
switch (direction) {
|
|
4180
4178
|
case "column":
|
|
@@ -4204,7 +4202,7 @@ class WrapTheme extends BaseTheme {
|
|
|
4204
4202
|
});
|
|
4205
4203
|
}
|
|
4206
4204
|
getClasses(props, defaults) {
|
|
4207
|
-
const key =
|
|
4205
|
+
const key = pickFirstTruthyKey(props, defaults, WRAP_KEYS);
|
|
4208
4206
|
return key ? [this[key]] : [];
|
|
4209
4207
|
}
|
|
4210
4208
|
}
|
|
@@ -4231,7 +4229,7 @@ class LayoutAppearanceTheme extends BaseTheme {
|
|
|
4231
4229
|
});
|
|
4232
4230
|
}
|
|
4233
4231
|
getClasses(props, defaults) {
|
|
4234
|
-
const pickedAppearanceKey =
|
|
4232
|
+
const pickedAppearanceKey = pickFirstTruthyKey(props, defaults, APPEARANCE_KEYS) || 'default';
|
|
4235
4233
|
const modesForAppearance = this[pickedAppearanceKey];
|
|
4236
4234
|
if (!modesForAppearance) {
|
|
4237
4235
|
return MODE_KEYS.map(() => '');
|
|
@@ -4279,7 +4277,7 @@ class BreakpointTheme extends BaseTheme {
|
|
|
4279
4277
|
});
|
|
4280
4278
|
}
|
|
4281
4279
|
getClasses(props, defaults) {
|
|
4282
|
-
const key =
|
|
4280
|
+
const key = pickFirstTruthyKey(props, defaults, BREAKPOINT_KEYS);
|
|
4283
4281
|
if (!key)
|
|
4284
4282
|
return [];
|
|
4285
4283
|
return [this[key] || ''];
|
|
@@ -4548,6 +4546,8 @@ const gridSubThemes = {
|
|
|
4548
4546
|
const defaultGrid3Theme = new ComponentTheme("div", "grid grid-cols-1 md:grid-cols-3", gridSubThemes, gridDefaults);
|
|
4549
4547
|
const defaultGrid4Theme = new ComponentTheme("div", "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4", gridSubThemes, gridDefaults);
|
|
4550
4548
|
|
|
4549
|
+
const COMPONENT_KEYS = ['button', 'badge', 'chip', 'card', 'divider', 'row', 'col', 'stack', 'section',
|
|
4550
|
+
'grid3', 'grid4', 'pageTitle', 'sectionTitle', 'title', 'text', 'link', 'list', 'listItem'];
|
|
4551
4551
|
const defaultTheme = {
|
|
4552
4552
|
button: defaultButtonTheme,
|
|
4553
4553
|
badge: defaultBadgeTheme,
|
|
@@ -4707,6 +4707,7 @@ const List = (props) => {
|
|
|
4707
4707
|
|
|
4708
4708
|
exports.Badge = Badge;
|
|
4709
4709
|
exports.Button = Button;
|
|
4710
|
+
exports.COMPONENT_KEYS = COMPONENT_KEYS;
|
|
4710
4711
|
exports.Card = Card;
|
|
4711
4712
|
exports.Chip = Chip;
|
|
4712
4713
|
exports.Col = Col;
|
|
@@ -4725,5 +4726,6 @@ exports.Stack = Stack;
|
|
|
4725
4726
|
exports.Text = Text;
|
|
4726
4727
|
exports.ThemeProvider = ThemeProvider;
|
|
4727
4728
|
exports.Title = Title;
|
|
4729
|
+
exports.defaultTheme = defaultTheme;
|
|
4728
4730
|
exports.useTheme = useTheme;
|
|
4729
4731
|
//# sourceMappingURL=index.js.map
|