@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.esm.js CHANGED
@@ -2988,25 +2988,25 @@ const positionClasses = {
2988
2988
  static: "static"
2989
2989
  };
2990
2990
  const shadowClasses = {
2991
- xs: "shadow-xs",
2992
- sm: "shadow-sm",
2993
- md: "shadow-md",
2994
- lg: "shadow-lg",
2995
- xl: "shadow-xl"
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-sm",
2999
- sm: "hover:shadow-md",
3000
- md: "hover:shadow-lg",
3001
- lg: "hover:shadow-xl",
3002
- xl: "hover:shadow-2xl"
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-sm",
3006
- sm: "active:shadow-md",
3007
- md: "active:shadow-lg",
3008
- lg: "active:shadow-xl",
3009
- xl: "active:shadow-2xl"
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",
@@ -3062,75 +3062,6 @@ class HideTheme extends BaseTheme {
3062
3062
  }
3063
3063
  HideTheme.defaultClasses = hideClasses;
3064
3064
 
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
3065
  class ItemsTheme extends BaseTheme {
3135
3066
  constructor(initialConfig) {
3136
3067
  super();
@@ -3259,6 +3190,21 @@ const textSizeClasses = {
3259
3190
  xl: "text-xl",
3260
3191
  };
3261
3192
 
3193
+ class FontStyleTheme extends BaseTheme {
3194
+ constructor(initial) {
3195
+ super();
3196
+ FONT_STYLE_KEYS.forEach((key) => {
3197
+ var _a;
3198
+ this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
3199
+ });
3200
+ }
3201
+ getClasses(props, defaults) {
3202
+ const key = pickKey(props, defaults, FONT_STYLE_KEYS);
3203
+ return [key ? this[key] : '']; // No default for font style
3204
+ }
3205
+ }
3206
+ FontStyleTheme.defaultClasses = fontStyleClasses;
3207
+
3262
3208
  class FontFamilyTheme extends BaseTheme {
3263
3209
  constructor(initial) {
3264
3210
  super();
@@ -3289,21 +3235,6 @@ class FontWeightTheme extends BaseTheme {
3289
3235
  }
3290
3236
  FontWeightTheme.defaultClasses = fontWeightClasses;
3291
3237
 
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
3238
  class TextDecorationTheme extends BaseTheme {
3308
3239
  constructor(initial) {
3309
3240
  super();
@@ -3349,6 +3280,75 @@ class TextAlignTheme extends BaseTheme {
3349
3280
  }
3350
3281
  TextAlignTheme.defaultClasses = textAlignClasses;
3351
3282
 
3283
+ const isObject = (item) => {
3284
+ return item !== null && typeof item === 'object' && !Array.isArray(item);
3285
+ };
3286
+ const deepMerge = (target, source) => {
3287
+ const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
3288
+ for (const key in source) {
3289
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3290
+ const sourceValue = source[key];
3291
+ const targetValue = output[key];
3292
+ if (sourceValue === undefined) {
3293
+ continue;
3294
+ }
3295
+ // Special case: If the key is 'defaults', use the contextual mergeDefaults function.
3296
+ if (key === 'defaults' &&
3297
+ isObject(targetValue) &&
3298
+ isObject(sourceValue)) {
3299
+ output[key] = mergeDefaults(targetValue, sourceValue);
3300
+ }
3301
+ // For all other objects, use the standard recursive deep merge.
3302
+ else if (isObject(targetValue) && isObject(sourceValue)) {
3303
+ output[key] = deepMerge(targetValue, sourceValue);
3304
+ }
3305
+ // For non-object values, just assign the value from the source.
3306
+ else {
3307
+ output[key] = sourceValue;
3308
+ }
3309
+ }
3310
+ }
3311
+ return output;
3312
+ };
3313
+ const deepClone = (source) => {
3314
+ if (!isObject(source)) {
3315
+ return source;
3316
+ }
3317
+ const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
3318
+ for (const key in output) {
3319
+ if (Object.prototype.hasOwnProperty.call(output, key)) {
3320
+ output[key] = deepClone(output[key]);
3321
+ }
3322
+ }
3323
+ return output;
3324
+ };
3325
+ const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
3326
+ const mergeDefaults = (baseDefaults, overrideDefaults) => {
3327
+ const finalDefaults = { ...baseDefaults };
3328
+ // Iterate over the override keys to apply them.
3329
+ for (const key in overrideDefaults) {
3330
+ if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
3331
+ const overrideValue = overrideDefaults[key];
3332
+ // If the override is setting a key to true...
3333
+ if (overrideValue) {
3334
+ // Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
3335
+ const group = findGroup(key);
3336
+ // If the key is part of an exclusive group...
3337
+ if (group) {
3338
+ // ...set all other keys in that group to false.
3339
+ group.forEach(groupKey => {
3340
+ if (groupKey !== key) {
3341
+ finalDefaults[groupKey] = false;
3342
+ }
3343
+ });
3344
+ }
3345
+ }
3346
+ finalDefaults[key] = overrideValue;
3347
+ }
3348
+ }
3349
+ return finalDefaults;
3350
+ };
3351
+
3352
3352
  class ComponentTheme {
3353
3353
  constructor(tag, base, subThemes, defaults = {}) {
3354
3354
  this.tag = tag;
@@ -3515,10 +3515,15 @@ BorderTheme.defaultClasses = {
3515
3515
  active: "active:border",
3516
3516
  },
3517
3517
  noBorder: {
3518
- base: "border-none",
3519
- hover: "hover:border-none",
3520
- active: "active:border-none",
3518
+ base: "",
3519
+ hover: "",
3520
+ active: "",
3521
3521
  },
3522
+ //noBorder: {
3523
+ // base: "border-none",
3524
+ // hover: "hover:border-none",
3525
+ // active: "active:border-none",
3526
+ //},
3522
3527
  };
3523
3528
 
3524
3529
  class RingTheme extends BaseTheme {
@@ -3886,8 +3891,8 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
3886
3891
  px: new PxTheme({
3887
3892
  padding: {
3888
3893
  xs: 'px-2',
3889
- sm: 'px-2.5',
3890
- md: 'px-3.5',
3894
+ sm: 'px-3',
3895
+ md: 'px-4',
3891
3896
  lg: 'px-5',
3892
3897
  xl: 'px-6',
3893
3898
  }
@@ -3897,25 +3902,25 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
3897
3902
  xs: 'py-1',
3898
3903
  sm: 'py-1.5',
3899
3904
  md: 'py-2',
3900
- lg: 'py-3',
3901
- xl: 'py-4',
3905
+ lg: 'py-2.5',
3906
+ xl: 'py-3',
3902
3907
  }
3903
3908
  }),
3904
3909
  gap: new GapTheme({
3905
3910
  gap: {
3906
- xs: 'gap-1.5',
3907
- sm: 'gap-2',
3908
- md: 'gap-3',
3909
- lg: 'gap-4',
3910
- xl: 'gap-5',
3911
+ xs: 'gap-1',
3912
+ sm: 'gap-1.5',
3913
+ md: 'gap-2',
3914
+ lg: 'gap-2.5',
3915
+ xl: 'gap-3',
3911
3916
  }
3912
3917
  }),
3913
3918
  text: new SizeTheme({
3914
- xs: 'text-xs/5',
3915
- sm: 'text-sm/5',
3919
+ xs: 'text-xs',
3920
+ sm: 'text-sm',
3916
3921
  md: 'text-base',
3917
- lg: 'text-lg/6',
3918
- xl: 'text-xl/6',
3922
+ lg: 'text-lg',
3923
+ xl: 'text-xl',
3919
3924
  }),
3920
3925
  shadow: new ShadowTheme(),
3921
3926
  },
@@ -3958,36 +3963,36 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit inline-flex tr
3958
3963
  px: new PxTheme({
3959
3964
  padding: {
3960
3965
  xs: "px-2",
3961
- sm: "px-2.5",
3962
- md: "px-3.5",
3966
+ sm: "px-3",
3967
+ md: "px-4",
3963
3968
  lg: "px-5",
3964
3969
  xl: "px-6"
3965
3970
  }
3966
3971
  }),
3967
3972
  py: new PyTheme({
3968
3973
  padding: {
3969
- xs: "py-1",
3970
- sm: "py-1.5",
3971
- md: "py-2",
3972
- lg: "py-3",
3973
- xl: "py-4"
3974
+ xs: 'py-1',
3975
+ sm: 'py-1.5',
3976
+ md: 'py-2',
3977
+ lg: 'py-2.5',
3978
+ xl: 'py-3',
3974
3979
  }
3975
3980
  }),
3976
3981
  gap: new GapTheme({
3977
3982
  gap: {
3978
- xs: "gap-1",
3979
- sm: "gap-1.5",
3980
- md: "gap-2",
3981
- lg: "gap-2.5",
3982
- xl: "gap-3"
3983
+ xs: 'gap-1',
3984
+ sm: 'gap-1.5',
3985
+ md: 'gap-2',
3986
+ lg: 'gap-2.5',
3987
+ xl: 'gap-3',
3983
3988
  }
3984
3989
  }),
3985
3990
  text: new SizeTheme({
3986
- xs: 'text-xs/5',
3987
- sm: 'text-sm/5',
3991
+ xs: 'text-xs',
3992
+ sm: 'text-sm',
3988
3993
  md: 'text-base',
3989
- lg: 'text-lg/6',
3990
- xl: 'text-xl/6',
3994
+ lg: 'text-lg',
3995
+ xl: 'text-xl',
3991
3996
  }),
3992
3997
  shadow: new ShadowTheme(),
3993
3998
  },
@@ -4037,26 +4042,26 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit inline-flex gap
4037
4042
  padding: {
4038
4043
  xs: 'px-2',
4039
4044
  sm: 'px-2.5',
4040
- md: 'px-3.5',
4041
- lg: 'px-5',
4042
- xl: 'px-6',
4045
+ md: 'px-3',
4046
+ lg: 'px-3.5',
4047
+ xl: 'px-4',
4043
4048
  }
4044
4049
  }),
4045
4050
  py: new PyTheme({
4046
4051
  padding: {
4047
- xs: 'py-1',
4048
- sm: 'py-1.5',
4049
- md: 'py-2',
4050
- lg: 'py-3',
4051
- xl: 'py-4',
4052
+ xs: 'py-0.5',
4053
+ sm: 'py-1',
4054
+ md: 'py-1.5',
4055
+ lg: 'py-2',
4056
+ xl: 'py-2.5',
4052
4057
  }
4053
4058
  }),
4054
4059
  text: new SizeTheme({
4055
4060
  xs: 'text-xs',
4056
4061
  sm: 'text-sm',
4057
- md: 'text-sm',
4058
- lg: 'text-base',
4059
- xl: 'text-base',
4062
+ md: 'text-base',
4063
+ lg: 'text-lg',
4064
+ xl: 'text-xl',
4060
4065
  }),
4061
4066
  gap: new GapTheme({
4062
4067
  gap: {
@@ -4468,18 +4473,18 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
4468
4473
  }),
4469
4474
  py: new PyTheme({
4470
4475
  padding: {
4471
- xs: 'py-3',
4472
- sm: 'py-5',
4473
- md: 'py-8 max-md:py-5',
4476
+ xs: 'py-4 max-md:py-3',
4477
+ sm: 'py-8 max-md:py-6',
4478
+ md: 'py-12 max-md:py-6',
4474
4479
  lg: 'py-16 max-lg:py-14 max-md:py-12',
4475
4480
  xl: 'py-20 max-lg:py-16 max-md:py-12',
4476
4481
  }
4477
4482
  }),
4478
4483
  gap: new GapTheme({
4479
4484
  gap: {
4480
- xs: 'gap-2',
4481
- sm: 'gap-4',
4482
- md: 'gap-6',
4485
+ xs: 'gap-4',
4486
+ sm: 'gap-6',
4487
+ md: 'gap-8',
4483
4488
  lg: 'gap-12',
4484
4489
  xl: 'gap-16',
4485
4490
  }
@@ -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 baseTheme = themeObject
4573
+ let finalTheme = themeObject
4569
4574
  ? deepMerge(defaultTheme, themeObject)
4570
4575
  : defaultTheme;
4571
4576
  if (typeof themeOverride === 'function') {
4572
- const themeToModify = deepClone(baseTheme);
4573
- return themeOverride(themeToModify);
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 baseTheme;
4591
+ return finalTheme;
4576
4592
  }, [themeObject, themeOverride]);
4577
4593
  return (jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
4578
4594
  }