@vaneui/ui 0.0.16 → 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
@@ -2939,7 +2939,11 @@ const SECTION_KEYS = [
2939
2939
  ...JUSTIFY_KEYS,
2940
2940
  ...WRAP_KEYS,
2941
2941
  ...BREAKPOINT_KEYS,
2942
- ...GAP_KEYS
2942
+ ...GAP_KEYS,
2943
+ ...BORDER_KEYS,
2944
+ ...SHADOW_KEYS,
2945
+ ...RING_KEYS,
2946
+ ...SHAPE_KEYS,
2943
2947
  ];
2944
2948
 
2945
2949
  const rowToColumnBreakpointClasses = {
@@ -2986,25 +2990,25 @@ const positionClasses = {
2986
2990
  static: "static"
2987
2991
  };
2988
2992
  const shadowClasses = {
2989
- xs: "shadow-xs",
2990
- sm: "shadow-sm",
2991
- md: "shadow-md",
2992
- lg: "shadow-lg",
2993
- xl: "shadow-xl"
2993
+ xs: "shadow-2xs",
2994
+ sm: "shadow-xs",
2995
+ md: "shadow-sm",
2996
+ lg: "shadow-md",
2997
+ xl: "shadow-lg"
2994
2998
  };
2995
2999
  const hoverShadowClasses = {
2996
- xs: "hover:shadow-sm",
2997
- sm: "hover:shadow-md",
2998
- md: "hover:shadow-lg",
2999
- lg: "hover:shadow-xl",
3000
- 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"
3001
3005
  };
3002
3006
  const activeShadowClasses = {
3003
- xs: "active:shadow-sm",
3004
- sm: "active:shadow-md",
3005
- md: "active:shadow-lg",
3006
- lg: "active:shadow-xl",
3007
- 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"
3008
3012
  };
3009
3013
  const noRingModeClasses = {
3010
3014
  base: "ring-0",
@@ -3060,75 +3064,6 @@ class HideTheme extends BaseTheme {
3060
3064
  }
3061
3065
  HideTheme.defaultClasses = hideClasses;
3062
3066
 
3063
- const isObject = (item) => {
3064
- return item !== null && typeof item === 'object' && !Array.isArray(item);
3065
- };
3066
- const deepMerge = (target, source) => {
3067
- const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
3068
- for (const key in source) {
3069
- if (Object.prototype.hasOwnProperty.call(source, key)) {
3070
- const sourceValue = source[key];
3071
- const targetValue = output[key];
3072
- if (sourceValue === undefined) {
3073
- continue;
3074
- }
3075
- // Special case: If the key is 'defaults', use the contextual mergeDefaults function.
3076
- if (key === 'defaults' &&
3077
- isObject(targetValue) &&
3078
- isObject(sourceValue)) {
3079
- output[key] = mergeDefaults(targetValue, sourceValue);
3080
- }
3081
- // For all other objects, use the standard recursive deep merge.
3082
- else if (isObject(targetValue) && isObject(sourceValue)) {
3083
- output[key] = deepMerge(targetValue, sourceValue);
3084
- }
3085
- // For non-object values, just assign the value from the source.
3086
- else {
3087
- output[key] = sourceValue;
3088
- }
3089
- }
3090
- }
3091
- return output;
3092
- };
3093
- const deepClone = (source) => {
3094
- if (!isObject(source)) {
3095
- return source;
3096
- }
3097
- const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
3098
- for (const key in output) {
3099
- if (Object.prototype.hasOwnProperty.call(output, key)) {
3100
- output[key] = deepClone(output[key]);
3101
- }
3102
- }
3103
- return output;
3104
- };
3105
- const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
3106
- const mergeDefaults = (baseDefaults, overrideDefaults) => {
3107
- const finalDefaults = { ...baseDefaults };
3108
- // Iterate over the override keys to apply them.
3109
- for (const key in overrideDefaults) {
3110
- if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
3111
- const overrideValue = overrideDefaults[key];
3112
- // If the override is setting a key to true...
3113
- if (overrideValue) {
3114
- // Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
3115
- const group = findGroup(key);
3116
- // If the key is part of an exclusive group...
3117
- if (group) {
3118
- // ...set all other keys in that group to false.
3119
- group.forEach(groupKey => {
3120
- if (groupKey !== key) {
3121
- finalDefaults[groupKey] = false;
3122
- }
3123
- });
3124
- }
3125
- }
3126
- finalDefaults[key] = overrideValue;
3127
- }
3128
- }
3129
- return finalDefaults;
3130
- };
3131
-
3132
3067
  class ItemsTheme extends BaseTheme {
3133
3068
  constructor(initialConfig) {
3134
3069
  super();
@@ -3257,6 +3192,21 @@ const textSizeClasses = {
3257
3192
  xl: "text-xl",
3258
3193
  };
3259
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
+
3260
3210
  class FontFamilyTheme extends BaseTheme {
3261
3211
  constructor(initial) {
3262
3212
  super();
@@ -3287,21 +3237,6 @@ class FontWeightTheme extends BaseTheme {
3287
3237
  }
3288
3238
  FontWeightTheme.defaultClasses = fontWeightClasses;
3289
3239
 
3290
- class FontStyleTheme extends BaseTheme {
3291
- constructor(initial) {
3292
- super();
3293
- FONT_STYLE_KEYS.forEach((key) => {
3294
- var _a;
3295
- this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
3296
- });
3297
- }
3298
- getClasses(props, defaults) {
3299
- const key = pickKey(props, defaults, FONT_STYLE_KEYS);
3300
- return [key ? this[key] : '']; // No default for font style
3301
- }
3302
- }
3303
- FontStyleTheme.defaultClasses = fontStyleClasses;
3304
-
3305
3240
  class TextDecorationTheme extends BaseTheme {
3306
3241
  constructor(initial) {
3307
3242
  super();
@@ -3347,6 +3282,75 @@ class TextAlignTheme extends BaseTheme {
3347
3282
  }
3348
3283
  TextAlignTheme.defaultClasses = textAlignClasses;
3349
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
+
3350
3354
  class ComponentTheme {
3351
3355
  constructor(tag, base, subThemes, defaults = {}) {
3352
3356
  this.tag = tag;
@@ -3513,10 +3517,15 @@ BorderTheme.defaultClasses = {
3513
3517
  active: "active:border",
3514
3518
  },
3515
3519
  noBorder: {
3516
- base: "border-none",
3517
- hover: "hover:border-none",
3518
- active: "active:border-none",
3520
+ base: "",
3521
+ hover: "",
3522
+ active: "",
3519
3523
  },
3524
+ //noBorder: {
3525
+ // base: "border-none",
3526
+ // hover: "hover:border-none",
3527
+ // active: "active:border-none",
3528
+ //},
3520
3529
  };
3521
3530
 
3522
3531
  class RingTheme extends BaseTheme {
@@ -3884,8 +3893,8 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
3884
3893
  px: new PxTheme({
3885
3894
  padding: {
3886
3895
  xs: 'px-2',
3887
- sm: 'px-2.5',
3888
- md: 'px-3.5',
3896
+ sm: 'px-3',
3897
+ md: 'px-4',
3889
3898
  lg: 'px-5',
3890
3899
  xl: 'px-6',
3891
3900
  }
@@ -3895,25 +3904,25 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
3895
3904
  xs: 'py-1',
3896
3905
  sm: 'py-1.5',
3897
3906
  md: 'py-2',
3898
- lg: 'py-3',
3899
- xl: 'py-4',
3907
+ lg: 'py-2.5',
3908
+ xl: 'py-3',
3900
3909
  }
3901
3910
  }),
3902
3911
  gap: new GapTheme({
3903
3912
  gap: {
3904
- xs: 'gap-1.5',
3905
- sm: 'gap-2',
3906
- md: 'gap-3',
3907
- lg: 'gap-4',
3908
- 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',
3909
3918
  }
3910
3919
  }),
3911
3920
  text: new SizeTheme({
3912
- xs: 'text-xs/5',
3913
- sm: 'text-sm/5',
3921
+ xs: 'text-xs',
3922
+ sm: 'text-sm',
3914
3923
  md: 'text-base',
3915
- lg: 'text-lg/6',
3916
- xl: 'text-xl/6',
3924
+ lg: 'text-lg',
3925
+ xl: 'text-xl',
3917
3926
  }),
3918
3927
  shadow: new ShadowTheme(),
3919
3928
  },
@@ -3956,36 +3965,36 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit inline-flex tr
3956
3965
  px: new PxTheme({
3957
3966
  padding: {
3958
3967
  xs: "px-2",
3959
- sm: "px-2.5",
3960
- md: "px-3.5",
3968
+ sm: "px-3",
3969
+ md: "px-4",
3961
3970
  lg: "px-5",
3962
3971
  xl: "px-6"
3963
3972
  }
3964
3973
  }),
3965
3974
  py: new PyTheme({
3966
3975
  padding: {
3967
- xs: "py-1",
3968
- sm: "py-1.5",
3969
- md: "py-2",
3970
- lg: "py-3",
3971
- 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',
3972
3981
  }
3973
3982
  }),
3974
3983
  gap: new GapTheme({
3975
3984
  gap: {
3976
- xs: "gap-1",
3977
- sm: "gap-1.5",
3978
- md: "gap-2",
3979
- lg: "gap-2.5",
3980
- 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',
3981
3990
  }
3982
3991
  }),
3983
3992
  text: new SizeTheme({
3984
- xs: 'text-xs/5',
3985
- sm: 'text-sm/5',
3993
+ xs: 'text-xs',
3994
+ sm: 'text-sm',
3986
3995
  md: 'text-base',
3987
- lg: 'text-lg/6',
3988
- xl: 'text-xl/6',
3996
+ lg: 'text-lg',
3997
+ xl: 'text-xl',
3989
3998
  }),
3990
3999
  shadow: new ShadowTheme(),
3991
4000
  },
@@ -4035,26 +4044,26 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit inline-flex gap
4035
4044
  padding: {
4036
4045
  xs: 'px-2',
4037
4046
  sm: 'px-2.5',
4038
- md: 'px-3.5',
4039
- lg: 'px-5',
4040
- xl: 'px-6',
4047
+ md: 'px-3',
4048
+ lg: 'px-3.5',
4049
+ xl: 'px-4',
4041
4050
  }
4042
4051
  }),
4043
4052
  py: new PyTheme({
4044
4053
  padding: {
4045
- xs: 'py-1',
4046
- sm: 'py-1.5',
4047
- md: 'py-2',
4048
- lg: 'py-3',
4049
- 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',
4050
4059
  }
4051
4060
  }),
4052
4061
  text: new SizeTheme({
4053
4062
  xs: 'text-xs',
4054
4063
  sm: 'text-sm',
4055
- md: 'text-sm',
4056
- lg: 'text-base',
4057
- xl: 'text-base',
4064
+ md: 'text-base',
4065
+ lg: 'text-lg',
4066
+ xl: 'text-xl',
4058
4067
  }),
4059
4068
  gap: new GapTheme({
4060
4069
  gap: {
@@ -4466,26 +4475,46 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
4466
4475
  }),
4467
4476
  py: new PyTheme({
4468
4477
  padding: {
4469
- xs: 'py-3',
4470
- sm: 'py-5',
4471
- 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',
4472
4481
  lg: 'py-16 max-lg:py-14 max-md:py-12',
4473
4482
  xl: 'py-20 max-lg:py-16 max-md:py-12',
4474
4483
  }
4475
4484
  }),
4476
4485
  gap: new GapTheme({
4477
4486
  gap: {
4478
- xs: 'gap-2',
4479
- sm: 'gap-4',
4480
- md: 'gap-6',
4487
+ xs: 'gap-4',
4488
+ sm: 'gap-6',
4489
+ md: 'gap-8',
4481
4490
  lg: 'gap-12',
4482
4491
  xl: 'gap-16',
4483
4492
  }
4484
4493
  }),
4494
+ shadow: new ShadowTheme(),
4495
+ },
4496
+ appearance: {
4497
+ background: LayoutAppearanceTheme.createDefaultStyle({
4498
+ base: layoutBackgroundAppearanceClasses,
4499
+ }),
4500
+ text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
4501
+ border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
4502
+ ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
4485
4503
  },
4486
4504
  layout: {
4487
4505
  wrap: new WrapTheme(),
4488
4506
  direction: new DirectionTheme(),
4507
+ border: new BorderTheme(),
4508
+ ring: new RingTheme(),
4509
+ radius: new RadiusTheme({
4510
+ rounded: {
4511
+ xs: 'rounded-md',
4512
+ sm: 'rounded-lg',
4513
+ md: 'rounded-xl',
4514
+ lg: 'rounded-2xl',
4515
+ xl: 'rounded-3xl',
4516
+ }
4517
+ }),
4489
4518
  },
4490
4519
  }, {
4491
4520
  md: true,
@@ -4493,6 +4522,10 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
4493
4522
  itemsStart: true,
4494
4523
  gap: true,
4495
4524
  padding: true,
4525
+ noBorder: true,
4526
+ noRing: true,
4527
+ noShadow: true,
4528
+ sharp: true,
4496
4529
  });
4497
4530
 
4498
4531
  const gridDefaults = {
@@ -4537,16 +4570,27 @@ const defaultTheme = {
4537
4570
  list: listTheme,
4538
4571
  };
4539
4572
  const ThemeContext = react.createContext(defaultTheme);
4540
- function ThemeProvider({ children, theme: themeObject = {}, themeOverride }) {
4573
+ function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, themeOverride }) {
4541
4574
  const mergedTheme = react.useMemo(() => {
4542
- let baseTheme = themeObject
4575
+ let finalTheme = themeObject
4543
4576
  ? deepMerge(defaultTheme, themeObject)
4544
4577
  : defaultTheme;
4545
4578
  if (typeof themeOverride === 'function') {
4546
- const themeToModify = deepClone(baseTheme);
4547
- 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
+ }
4548
4592
  }
4549
- return baseTheme;
4593
+ return finalTheme;
4550
4594
  }, [themeObject, themeOverride]);
4551
4595
  return (jsxRuntime.jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
4552
4596
  }