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