@vaneui/ui 0.0.17 → 0.0.18

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/index.js CHANGED
@@ -2990,25 +2990,25 @@ const positionClasses = {
2990
2990
  static: "static"
2991
2991
  };
2992
2992
  const shadowClasses = {
2993
- xs: "shadow-xs",
2994
- sm: "shadow-sm",
2995
- md: "shadow-md",
2996
- lg: "shadow-lg",
2997
- xl: "shadow-xl"
2993
+ xs: "shadow-2xs",
2994
+ sm: "shadow-xs",
2995
+ md: "shadow-sm",
2996
+ lg: "shadow-md",
2997
+ xl: "shadow-lg"
2998
2998
  };
2999
2999
  const hoverShadowClasses = {
3000
- xs: "hover:shadow-sm",
3001
- sm: "hover:shadow-md",
3002
- md: "hover:shadow-lg",
3003
- lg: "hover:shadow-xl",
3004
- xl: "hover:shadow-2xl"
3000
+ xs: "hover:shadow-xs",
3001
+ sm: "hover:shadow-sm",
3002
+ md: "hover:shadow-md",
3003
+ lg: "hover:shadow-lg",
3004
+ xl: "hover:shadow-xl"
3005
3005
  };
3006
3006
  const activeShadowClasses = {
3007
- xs: "active:shadow-sm",
3008
- sm: "active:shadow-md",
3009
- md: "active:shadow-lg",
3010
- lg: "active:shadow-xl",
3011
- xl: "active:shadow-2xl"
3007
+ xs: "active:shadow-xs",
3008
+ sm: "active:shadow-sm",
3009
+ md: "active:shadow-md",
3010
+ lg: "active:shadow-lg",
3011
+ xl: "active:shadow-xl"
3012
3012
  };
3013
3013
  const noRingModeClasses = {
3014
3014
  base: "ring-0",
@@ -3064,75 +3064,6 @@ class HideTheme extends BaseTheme {
3064
3064
  }
3065
3065
  HideTheme.defaultClasses = hideClasses;
3066
3066
 
3067
- const isObject = (item) => {
3068
- return item !== null && typeof item === 'object' && !Array.isArray(item);
3069
- };
3070
- const deepMerge = (target, source) => {
3071
- const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
3072
- for (const key in source) {
3073
- if (Object.prototype.hasOwnProperty.call(source, key)) {
3074
- const sourceValue = source[key];
3075
- const targetValue = output[key];
3076
- if (sourceValue === undefined) {
3077
- continue;
3078
- }
3079
- // Special case: If the key is 'defaults', use the contextual mergeDefaults function.
3080
- if (key === 'defaults' &&
3081
- isObject(targetValue) &&
3082
- isObject(sourceValue)) {
3083
- output[key] = mergeDefaults(targetValue, sourceValue);
3084
- }
3085
- // For all other objects, use the standard recursive deep merge.
3086
- else if (isObject(targetValue) && isObject(sourceValue)) {
3087
- output[key] = deepMerge(targetValue, sourceValue);
3088
- }
3089
- // For non-object values, just assign the value from the source.
3090
- else {
3091
- output[key] = sourceValue;
3092
- }
3093
- }
3094
- }
3095
- return output;
3096
- };
3097
- const deepClone = (source) => {
3098
- if (!isObject(source)) {
3099
- return source;
3100
- }
3101
- const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
3102
- for (const key in output) {
3103
- if (Object.prototype.hasOwnProperty.call(output, key)) {
3104
- output[key] = deepClone(output[key]);
3105
- }
3106
- }
3107
- return output;
3108
- };
3109
- const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
3110
- const mergeDefaults = (baseDefaults, overrideDefaults) => {
3111
- const finalDefaults = { ...baseDefaults };
3112
- // Iterate over the override keys to apply them.
3113
- for (const key in overrideDefaults) {
3114
- if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
3115
- const overrideValue = overrideDefaults[key];
3116
- // If the override is setting a key to true...
3117
- if (overrideValue) {
3118
- // Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
3119
- const group = findGroup(key);
3120
- // If the key is part of an exclusive group...
3121
- if (group) {
3122
- // ...set all other keys in that group to false.
3123
- group.forEach(groupKey => {
3124
- if (groupKey !== key) {
3125
- finalDefaults[groupKey] = false;
3126
- }
3127
- });
3128
- }
3129
- }
3130
- finalDefaults[key] = overrideValue;
3131
- }
3132
- }
3133
- return finalDefaults;
3134
- };
3135
-
3136
3067
  class ItemsTheme extends BaseTheme {
3137
3068
  constructor(initialConfig) {
3138
3069
  super();
@@ -3261,6 +3192,21 @@ const textSizeClasses = {
3261
3192
  xl: "text-xl",
3262
3193
  };
3263
3194
 
3195
+ class FontStyleTheme extends BaseTheme {
3196
+ constructor(initial) {
3197
+ super();
3198
+ FONT_STYLE_KEYS.forEach((key) => {
3199
+ var _a;
3200
+ this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
3201
+ });
3202
+ }
3203
+ getClasses(props, defaults) {
3204
+ const key = pickKey(props, defaults, FONT_STYLE_KEYS);
3205
+ return [key ? this[key] : '']; // No default for font style
3206
+ }
3207
+ }
3208
+ FontStyleTheme.defaultClasses = fontStyleClasses;
3209
+
3264
3210
  class FontFamilyTheme extends BaseTheme {
3265
3211
  constructor(initial) {
3266
3212
  super();
@@ -3291,21 +3237,6 @@ class FontWeightTheme extends BaseTheme {
3291
3237
  }
3292
3238
  FontWeightTheme.defaultClasses = fontWeightClasses;
3293
3239
 
3294
- class FontStyleTheme extends BaseTheme {
3295
- constructor(initial) {
3296
- super();
3297
- FONT_STYLE_KEYS.forEach((key) => {
3298
- var _a;
3299
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
3300
- });
3301
- }
3302
- getClasses(props, defaults) {
3303
- const key = pickKey(props, defaults, FONT_STYLE_KEYS);
3304
- return [key ? this[key] : '']; // No default for font style
3305
- }
3306
- }
3307
- FontStyleTheme.defaultClasses = fontStyleClasses;
3308
-
3309
3240
  class TextDecorationTheme extends BaseTheme {
3310
3241
  constructor(initial) {
3311
3242
  super();
@@ -3351,6 +3282,75 @@ class TextAlignTheme extends BaseTheme {
3351
3282
  }
3352
3283
  TextAlignTheme.defaultClasses = textAlignClasses;
3353
3284
 
3285
+ const isObject = (item) => {
3286
+ return item !== null && typeof item === 'object' && !Array.isArray(item);
3287
+ };
3288
+ const deepMerge = (target, source) => {
3289
+ const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
3290
+ for (const key in source) {
3291
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3292
+ const sourceValue = source[key];
3293
+ const targetValue = output[key];
3294
+ if (sourceValue === undefined) {
3295
+ continue;
3296
+ }
3297
+ // Special case: If the key is 'defaults', use the contextual mergeDefaults function.
3298
+ if (key === 'defaults' &&
3299
+ isObject(targetValue) &&
3300
+ isObject(sourceValue)) {
3301
+ output[key] = mergeDefaults(targetValue, sourceValue);
3302
+ }
3303
+ // For all other objects, use the standard recursive deep merge.
3304
+ else if (isObject(targetValue) && isObject(sourceValue)) {
3305
+ output[key] = deepMerge(targetValue, sourceValue);
3306
+ }
3307
+ // For non-object values, just assign the value from the source.
3308
+ else {
3309
+ output[key] = sourceValue;
3310
+ }
3311
+ }
3312
+ }
3313
+ return output;
3314
+ };
3315
+ const deepClone = (source) => {
3316
+ if (!isObject(source)) {
3317
+ return source;
3318
+ }
3319
+ const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
3320
+ for (const key in output) {
3321
+ if (Object.prototype.hasOwnProperty.call(output, key)) {
3322
+ output[key] = deepClone(output[key]);
3323
+ }
3324
+ }
3325
+ return output;
3326
+ };
3327
+ const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
3328
+ const mergeDefaults = (baseDefaults, overrideDefaults) => {
3329
+ const finalDefaults = { ...baseDefaults };
3330
+ // Iterate over the override keys to apply them.
3331
+ for (const key in overrideDefaults) {
3332
+ if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
3333
+ const overrideValue = overrideDefaults[key];
3334
+ // If the override is setting a key to true...
3335
+ if (overrideValue) {
3336
+ // Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
3337
+ const group = findGroup(key);
3338
+ // If the key is part of an exclusive group...
3339
+ if (group) {
3340
+ // ...set all other keys in that group to false.
3341
+ group.forEach(groupKey => {
3342
+ if (groupKey !== key) {
3343
+ finalDefaults[groupKey] = false;
3344
+ }
3345
+ });
3346
+ }
3347
+ }
3348
+ finalDefaults[key] = overrideValue;
3349
+ }
3350
+ }
3351
+ return finalDefaults;
3352
+ };
3353
+
3354
3354
  class ComponentTheme {
3355
3355
  constructor(tag, base, subThemes, defaults = {}) {
3356
3356
  this.tag = tag;
@@ -3517,10 +3517,15 @@ BorderTheme.defaultClasses = {
3517
3517
  active: "active:border",
3518
3518
  },
3519
3519
  noBorder: {
3520
- base: "border-none",
3521
- hover: "hover:border-none",
3522
- active: "active:border-none",
3520
+ base: "",
3521
+ hover: "",
3522
+ active: "",
3523
3523
  },
3524
+ //noBorder: {
3525
+ // base: "border-none",
3526
+ // hover: "hover:border-none",
3527
+ // active: "active:border-none",
3528
+ //},
3524
3529
  };
3525
3530
 
3526
3531
  class RingTheme extends BaseTheme {
@@ -3888,8 +3893,8 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
3888
3893
  px: new PxTheme({
3889
3894
  padding: {
3890
3895
  xs: 'px-2',
3891
- sm: 'px-2.5',
3892
- md: 'px-3.5',
3896
+ sm: 'px-3',
3897
+ md: 'px-4',
3893
3898
  lg: 'px-5',
3894
3899
  xl: 'px-6',
3895
3900
  }
@@ -3899,25 +3904,25 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
3899
3904
  xs: 'py-1',
3900
3905
  sm: 'py-1.5',
3901
3906
  md: 'py-2',
3902
- lg: 'py-3',
3903
- xl: 'py-4',
3907
+ lg: 'py-2.5',
3908
+ xl: 'py-3',
3904
3909
  }
3905
3910
  }),
3906
3911
  gap: new GapTheme({
3907
3912
  gap: {
3908
- xs: 'gap-1.5',
3909
- sm: 'gap-2',
3910
- md: 'gap-3',
3911
- lg: 'gap-4',
3912
- xl: 'gap-5',
3913
+ xs: 'gap-1',
3914
+ sm: 'gap-1.5',
3915
+ md: 'gap-2',
3916
+ lg: 'gap-2.5',
3917
+ xl: 'gap-3',
3913
3918
  }
3914
3919
  }),
3915
3920
  text: new SizeTheme({
3916
- xs: 'text-xs/5',
3917
- sm: 'text-sm/5',
3921
+ xs: 'text-xs',
3922
+ sm: 'text-sm',
3918
3923
  md: 'text-base',
3919
- lg: 'text-lg/6',
3920
- xl: 'text-xl/6',
3924
+ lg: 'text-lg',
3925
+ xl: 'text-xl',
3921
3926
  }),
3922
3927
  shadow: new ShadowTheme(),
3923
3928
  },
@@ -3960,36 +3965,36 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit inline-flex tr
3960
3965
  px: new PxTheme({
3961
3966
  padding: {
3962
3967
  xs: "px-2",
3963
- sm: "px-2.5",
3964
- md: "px-3.5",
3968
+ sm: "px-3",
3969
+ md: "px-4",
3965
3970
  lg: "px-5",
3966
3971
  xl: "px-6"
3967
3972
  }
3968
3973
  }),
3969
3974
  py: new PyTheme({
3970
3975
  padding: {
3971
- xs: "py-1",
3972
- sm: "py-1.5",
3973
- md: "py-2",
3974
- lg: "py-3",
3975
- xl: "py-4"
3976
+ xs: 'py-1',
3977
+ sm: 'py-1.5',
3978
+ md: 'py-2',
3979
+ lg: 'py-2.5',
3980
+ xl: 'py-3',
3976
3981
  }
3977
3982
  }),
3978
3983
  gap: new GapTheme({
3979
3984
  gap: {
3980
- xs: "gap-1",
3981
- sm: "gap-1.5",
3982
- md: "gap-2",
3983
- lg: "gap-2.5",
3984
- xl: "gap-3"
3985
+ xs: 'gap-1',
3986
+ sm: 'gap-1.5',
3987
+ md: 'gap-2',
3988
+ lg: 'gap-2.5',
3989
+ xl: 'gap-3',
3985
3990
  }
3986
3991
  }),
3987
3992
  text: new SizeTheme({
3988
- xs: 'text-xs/5',
3989
- sm: 'text-sm/5',
3993
+ xs: 'text-xs',
3994
+ sm: 'text-sm',
3990
3995
  md: 'text-base',
3991
- lg: 'text-lg/6',
3992
- xl: 'text-xl/6',
3996
+ lg: 'text-lg',
3997
+ xl: 'text-xl',
3993
3998
  }),
3994
3999
  shadow: new ShadowTheme(),
3995
4000
  },
@@ -4039,26 +4044,26 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit inline-flex gap
4039
4044
  padding: {
4040
4045
  xs: 'px-2',
4041
4046
  sm: 'px-2.5',
4042
- md: 'px-3.5',
4043
- lg: 'px-5',
4044
- xl: 'px-6',
4047
+ md: 'px-3',
4048
+ lg: 'px-3.5',
4049
+ xl: 'px-4',
4045
4050
  }
4046
4051
  }),
4047
4052
  py: new PyTheme({
4048
4053
  padding: {
4049
- xs: 'py-1',
4050
- sm: 'py-1.5',
4051
- md: 'py-2',
4052
- lg: 'py-3',
4053
- xl: 'py-4',
4054
+ xs: 'py-0.5',
4055
+ sm: 'py-1',
4056
+ md: 'py-1.5',
4057
+ lg: 'py-2',
4058
+ xl: 'py-2.5',
4054
4059
  }
4055
4060
  }),
4056
4061
  text: new SizeTheme({
4057
4062
  xs: 'text-xs',
4058
4063
  sm: 'text-sm',
4059
- md: 'text-sm',
4060
- lg: 'text-base',
4061
- xl: 'text-base',
4064
+ md: 'text-base',
4065
+ lg: 'text-lg',
4066
+ xl: 'text-xl',
4062
4067
  }),
4063
4068
  gap: new GapTheme({
4064
4069
  gap: {
@@ -4470,18 +4475,18 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
4470
4475
  }),
4471
4476
  py: new PyTheme({
4472
4477
  padding: {
4473
- xs: 'py-3',
4474
- sm: 'py-5',
4475
- md: 'py-8 max-md:py-5',
4478
+ xs: 'py-4 max-md:py-3',
4479
+ sm: 'py-8 max-md:py-6',
4480
+ md: 'py-12 max-md:py-6',
4476
4481
  lg: 'py-16 max-lg:py-14 max-md:py-12',
4477
4482
  xl: 'py-20 max-lg:py-16 max-md:py-12',
4478
4483
  }
4479
4484
  }),
4480
4485
  gap: new GapTheme({
4481
4486
  gap: {
4482
- xs: 'gap-2',
4483
- sm: 'gap-4',
4484
- md: 'gap-6',
4487
+ xs: 'gap-4',
4488
+ sm: 'gap-6',
4489
+ md: 'gap-8',
4485
4490
  lg: 'gap-12',
4486
4491
  xl: 'gap-16',
4487
4492
  }
@@ -4565,16 +4570,27 @@ const defaultTheme = {
4565
4570
  list: listTheme,
4566
4571
  };
4567
4572
  const ThemeContext = react.createContext(defaultTheme);
4568
- function ThemeProvider({ children, theme: themeObject = {}, themeOverride }) {
4573
+ function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, themeOverride }) {
4569
4574
  const mergedTheme = react.useMemo(() => {
4570
- let baseTheme = themeObject
4575
+ let finalTheme = themeObject
4571
4576
  ? deepMerge(defaultTheme, themeObject)
4572
4577
  : defaultTheme;
4573
4578
  if (typeof themeOverride === 'function') {
4574
- const themeToModify = deepClone(baseTheme);
4575
- return themeOverride(themeToModify);
4579
+ const themeToModify = deepClone(finalTheme);
4580
+ finalTheme = themeOverride(themeToModify);
4581
+ }
4582
+ if (themeDefaults !== undefined) {
4583
+ for (const key in themeDefaults) {
4584
+ const componentKey = key;
4585
+ const componentTheme = finalTheme[componentKey];
4586
+ const themeDefault = themeDefaults[componentKey];
4587
+ if (themeDefault !== undefined) {
4588
+ finalTheme[componentKey].defaults =
4589
+ mergeDefaults(componentTheme.defaults, themeDefaults[componentKey]);
4590
+ }
4591
+ }
4576
4592
  }
4577
- return baseTheme;
4593
+ return finalTheme;
4578
4594
  }, [themeObject, themeOverride]);
4579
4595
  return (jsxRuntime.jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
4580
4596
  }