@vaneui/ui 0.3.1-alpha.20250921204254.9cfeae4 → 0.3.1-alpha.20250926201820.1b8c4ca

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
@@ -3687,11 +3687,11 @@ const layoutGapClasses = {
3687
3687
  xl: "[--gap-unit:6]",
3688
3688
  };
3689
3689
  const layoutPaddingClasses = {
3690
- xs: "[--h-unit:2]",
3691
- sm: "[--h-unit:3]",
3692
- md: "[--h-unit:4]",
3693
- lg: "[--h-unit:5]",
3694
- xl: "[--h-unit:6]",
3690
+ xs: "[--py-unit:2]",
3691
+ sm: "[--py-unit:3]",
3692
+ md: "[--py-unit:4]",
3693
+ lg: "[--py-unit:5]",
3694
+ xl: "[--py-unit:6]",
3695
3695
  };
3696
3696
  const sectionAspectRatioClasses = {
3697
3697
  xs: "[--aspect-ratio:2.5]",
@@ -3700,9 +3700,71 @@ const sectionAspectRatioClasses = {
3700
3700
  lg: "[--aspect-ratio:1.6]",
3701
3701
  xl: "[--aspect-ratio:1.5]",
3702
3702
  };
3703
+ // UI component classes
3704
+ const uiPaddingClasses = {
3705
+ xs: "[--py-unit:1]",
3706
+ sm: "[--py-unit:1.5]",
3707
+ md: "[--py-unit:2]",
3708
+ lg: "[--py-unit:2.5]",
3709
+ xl: "[--py-unit:3]",
3710
+ };
3711
+ // Button-specific aspect ratios (px-2,3,4,5,6 vs py-1,1.5,2,2.5,3)
3712
+ const buttonAspectRatioClasses = {
3713
+ xs: "[--aspect-ratio:2]", // px-2 vs py-1 = 2
3714
+ sm: "[--aspect-ratio:2]", // px-3 vs py-1.5 = 2
3715
+ md: "[--aspect-ratio:2]", // px-4 vs py-2 = 2
3716
+ lg: "[--aspect-ratio:2]", // px-5 vs py-2.5 = 2
3717
+ xl: "[--aspect-ratio:2]", // px-6 vs py-3 = 2
3718
+ };
3719
+ // Badge aspect ratios (same as button)
3720
+ const badgeAspectRatioClasses = {
3721
+ xs: "[--aspect-ratio:2]",
3722
+ sm: "[--aspect-ratio:2]",
3723
+ md: "[--aspect-ratio:2]",
3724
+ lg: "[--aspect-ratio:2]",
3725
+ xl: "[--aspect-ratio:2]",
3726
+ };
3727
+ // Input aspect ratios (same as button)
3728
+ const inputAspectRatioClasses = {
3729
+ xs: "[--aspect-ratio:2]",
3730
+ sm: "[--aspect-ratio:2]",
3731
+ md: "[--aspect-ratio:2]",
3732
+ lg: "[--aspect-ratio:2]",
3733
+ xl: "[--aspect-ratio:2]",
3734
+ };
3735
+ // Code-specific classes (px-1,1.5,1.5,2,2 vs py-0,0.5,1,1,1)
3736
+ const codeAspectRatioClasses = {
3737
+ xs: "[--aspect-ratio:1]", // px-1 vs py-0 (but py-0 is 0, so use py-unit but ratio for px)
3738
+ sm: "[--aspect-ratio:3]", // px-1.5 vs py-0.5 = 3
3739
+ md: "[--aspect-ratio:1.5]", // px-1.5 vs py-1 = 1.5
3740
+ lg: "[--aspect-ratio:2]", // px-2 vs py-1 = 2
3741
+ xl: "[--aspect-ratio:2]", // px-2 vs py-1 = 2
3742
+ };
3743
+ const codePyClasses = {
3744
+ xs: "[--py-unit:0]",
3745
+ sm: "[--py-unit:0.5]",
3746
+ md: "[--py-unit:1]",
3747
+ lg: "[--py-unit:1]",
3748
+ xl: "[--py-unit:1]",
3749
+ };
3750
+ // Chip-specific classes (px-2,2.5,3,3.5,4 vs py-0.5,1,1.5,2,2.5)
3751
+ const chipAspectRatioClasses = {
3752
+ xs: "[--aspect-ratio:4]", // px-2 vs py-0.5 = 4
3753
+ sm: "[--aspect-ratio:2.5]", // px-2.5 vs py-1 = 2.5
3754
+ md: "[--aspect-ratio:2]", // px-3 vs py-1.5 = 2
3755
+ lg: "[--aspect-ratio:1.75]", // px-3.5 vs py-2 = 1.75
3756
+ xl: "[--aspect-ratio:1.6]", // px-4 vs py-2.5 = 1.6
3757
+ };
3758
+ const chipPyClasses = {
3759
+ xs: "[--py-unit:0.5]",
3760
+ sm: "[--py-unit:1]",
3761
+ md: "[--py-unit:1.5]",
3762
+ lg: "[--py-unit:2]",
3763
+ xl: "[--py-unit:2.5]",
3764
+ };
3703
3765
 
3704
3766
  class GapTheme extends BaseTheme {
3705
- constructor(sizeMap) {
3767
+ constructor(sizeMap, isUIComponent = false) {
3706
3768
  super();
3707
3769
  /** Extra-small gap - uses CSS variable --layout-gap-xs */
3708
3770
  this.xs = layoutGapClasses.xs;
@@ -3714,6 +3776,7 @@ class GapTheme extends BaseTheme {
3714
3776
  this.lg = layoutGapClasses.lg;
3715
3777
  /** Extra-large gap - uses CSS variable --layout-gap-xl */
3716
3778
  this.xl = layoutGapClasses.xl;
3779
+ this.isUIComponent = isUIComponent;
3717
3780
  if (sizeMap) {
3718
3781
  ComponentKeys.size.forEach((key) => {
3719
3782
  if (sizeMap[key] !== undefined) {
@@ -3726,41 +3789,42 @@ class GapTheme extends BaseTheme {
3726
3789
  var _a;
3727
3790
  if ((extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.gap) === 'gap') {
3728
3791
  const gapClass = this[(_a = extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.size) !== null && _a !== void 0 ? _a : 'md'];
3729
- return gapClass ? [gapClass, "gap-(--gap)"] : [];
3792
+ const gapVar = this.isUIComponent ? "gap-(--ui-gap)" : "gap-(--gap)";
3793
+ return gapClass ? [gapClass, gapVar] : [];
3730
3794
  }
3731
3795
  return [];
3732
3796
  }
3733
3797
  }
3734
3798
 
3735
- const uiBorderRadiusClasses = {
3736
- xs: "rounded-(--ui-br-xs)",
3737
- sm: "rounded-(--ui-br-sm)",
3738
- md: "rounded-(--ui-br-md)",
3739
- lg: "rounded-(--ui-br-lg)",
3740
- xl: "rounded-(--ui-br-xl)",
3741
- };
3742
- const layoutBorderRadiusClasses = {
3743
- xs: "rounded-(--layout-br-xs)",
3744
- sm: "rounded-(--layout-br-sm)",
3745
- md: "rounded-(--layout-br-md)",
3746
- lg: "rounded-(--layout-br-lg)",
3747
- xl: "rounded-(--layout-br-xl)",
3748
- };
3749
-
3750
3799
  class RadiusTheme extends BaseTheme {
3751
- constructor(roundedClasses) {
3800
+ constructor(roundedClasses, isUIComponent = false) {
3752
3801
  super();
3753
3802
  /** Pill shape - fully rounded corners */
3754
3803
  this.pill = "rounded-full";
3755
3804
  /** Sharp shape - no rounded corners */
3756
3805
  this.sharp = "rounded-none";
3757
3806
  this.rounded = roundedClasses;
3807
+ this.isUIComponent = isUIComponent;
3758
3808
  }
3759
3809
  static createUITheme(customRounded) {
3760
- return new RadiusTheme(customRounded || uiBorderRadiusClasses);
3810
+ const brUnitClasses = {
3811
+ xs: '[--br-unit:1]',
3812
+ sm: '[--br-unit:2]',
3813
+ md: '[--br-unit:3]',
3814
+ lg: '[--br-unit:4]',
3815
+ xl: '[--br-unit:5]'
3816
+ };
3817
+ return new RadiusTheme(customRounded || brUnitClasses, true);
3761
3818
  }
3762
3819
  static createLayoutTheme() {
3763
- return new RadiusTheme(layoutBorderRadiusClasses);
3820
+ const brUnitClasses = {
3821
+ xs: '[--br-unit:3]',
3822
+ sm: '[--br-unit:4]',
3823
+ md: '[--br-unit:5]',
3824
+ lg: '[--br-unit:6]',
3825
+ xl: '[--br-unit:7]'
3826
+ };
3827
+ return new RadiusTheme(brUnitClasses, false);
3764
3828
  }
3765
3829
  getClasses(extractedKeys) {
3766
3830
  var _a, _b;
@@ -3772,8 +3836,9 @@ class RadiusTheme extends BaseTheme {
3772
3836
  case 'sharp':
3773
3837
  return [this.sharp];
3774
3838
  case 'rounded': {
3775
- const roundedClass = this.rounded[size];
3776
- return roundedClass ? [roundedClass] : [];
3839
+ const brUnitClass = this.rounded[size];
3840
+ const roundedVar = this.isUIComponent ? "rounded-(--ui-br)" : "rounded-(--br)";
3841
+ return brUnitClass ? [brUnitClass, roundedVar] : [];
3777
3842
  }
3778
3843
  default:
3779
3844
  return [];
@@ -3890,29 +3955,26 @@ class PaddingTheme extends BaseTheme {
3890
3955
 
3891
3956
  /** Horizontal padding theme - controls left and right padding */
3892
3957
  class PxTheme extends PaddingTheme {
3893
- constructor(sizeMap, aspectRatioMap) {
3894
- super(sizeMap);
3958
+ constructor(aspectRatioMap, isUIComponent = false) {
3959
+ super();
3895
3960
  this.aspectRatioMap = aspectRatioMap;
3896
- // Override with PxTheme's default classes if no custom sizeMap provided
3897
- if (!sizeMap) {
3898
- ComponentKeys.size.forEach((key) => {
3899
- this[key] = layoutPaddingClasses[key];
3900
- });
3901
- }
3961
+ this.isUIComponent = isUIComponent;
3962
+ // PxTheme should not set any padding classes - that's PyTheme's job
3963
+ // PxTheme only handles aspect-ratio
3902
3964
  }
3903
3965
  getClasses(extractedKeys) {
3904
3966
  var _a, _b;
3905
3967
  if ((extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.padding) === 'padding' || (extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.padding) === undefined) {
3906
3968
  const size = (_a = extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.size) !== null && _a !== void 0 ? _a : 'md';
3907
- const paddingClass = this[size];
3908
3969
  const aspectRatioClass = (_b = this.aspectRatioMap) === null || _b === void 0 ? void 0 : _b[size];
3909
3970
  const classes = [];
3910
- if (paddingClass)
3911
- classes.push(paddingClass);
3971
+ // Only add aspect-ratio class - no padding classes
3912
3972
  if (aspectRatioClass)
3913
3973
  classes.push(aspectRatioClass);
3914
- classes.push("px-(--px)");
3915
- return classes.length > 1 ? classes : [];
3974
+ // Use UI or layout CSS variables based on component type
3975
+ const cssVar = this.isUIComponent ? "px-(--ui-px)" : "px-(--px)";
3976
+ classes.push(cssVar);
3977
+ return classes;
3916
3978
  }
3917
3979
  return [];
3918
3980
  }
@@ -3920,8 +3982,9 @@ class PxTheme extends PaddingTheme {
3920
3982
 
3921
3983
  /** Vertical padding theme - controls top and bottom padding */
3922
3984
  class PyTheme extends PaddingTheme {
3923
- constructor(sizeMap) {
3985
+ constructor(sizeMap, isUIComponent = false) {
3924
3986
  super(sizeMap);
3987
+ this.isUIComponent = isUIComponent;
3925
3988
  // Override with PyTheme's default classes if no custom sizeMap provided
3926
3989
  if (!sizeMap) {
3927
3990
  ComponentKeys.size.forEach((key) => {
@@ -3933,7 +3996,11 @@ class PyTheme extends PaddingTheme {
3933
3996
  var _a;
3934
3997
  if ((extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.padding) === 'padding' || (extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.padding) === undefined) {
3935
3998
  const paddingClass = this[(_a = extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.size) !== null && _a !== void 0 ? _a : 'md'];
3936
- return paddingClass ? [paddingClass, "py-(--py)"] : [];
3999
+ if (!paddingClass)
4000
+ return [];
4001
+ // Use UI or layout CSS variables based on component type
4002
+ const cssVar = this.isUIComponent ? "py-(--ui-py)" : "py-(--py)";
4003
+ return [paddingClass, cssVar];
3937
4004
  }
3938
4005
  return [];
3939
4006
  }
@@ -4609,6 +4676,7 @@ const themeDefaults = {
4609
4676
  section: {
4610
4677
  md: true,
4611
4678
  flex: true,
4679
+ column: true,
4612
4680
  default: true,
4613
4681
  itemsStart: true,
4614
4682
  gap: true,
@@ -4776,9 +4844,9 @@ const themeDefaults = {
4776
4844
 
4777
4845
  const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-pointer transition-all duration-200 whitespace-nowrap", {
4778
4846
  size: {
4779
- px: new PxTheme({ xs: 'px-2', sm: 'px-3', md: 'px-4', lg: 'px-5', xl: 'px-6', }),
4780
- py: new PyTheme({ xs: 'py-1', sm: 'py-1.5', md: 'py-2', lg: 'py-2.5', xl: 'py-3' }),
4781
- gap: new GapTheme({ xs: 'gap-1', sm: 'gap-1.5', md: 'gap-2', lg: 'gap-2.5', xl: 'gap-3' }),
4847
+ px: new PxTheme(buttonAspectRatioClasses, true),
4848
+ py: new PyTheme(uiPaddingClasses, true),
4849
+ gap: new GapTheme({ xs: '[--gap-unit:1]', sm: '[--gap-unit:1.5]', md: '[--gap-unit:2]', lg: '[--gap-unit:2.5]', xl: '[--gap-unit:3]' }, true),
4782
4850
  text: new SizeTheme({ xs: 'text-xs', sm: 'text-sm', md: 'text-base', lg: 'text-lg', xl: 'text-xl' }),
4783
4851
  },
4784
4852
  appearance: {
@@ -4806,9 +4874,9 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
4806
4874
 
4807
4875
  const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all duration-200 whitespace-nowrap", {
4808
4876
  size: {
4809
- px: new PxTheme({ xs: "px-2", sm: "px-3", md: "px-4", lg: "px-5", xl: "px-6" }),
4810
- py: new PyTheme({ xs: 'py-1', sm: 'py-1.5', md: 'py-2', lg: 'py-2.5', xl: 'py-3' }),
4811
- gap: new GapTheme({ xs: 'gap-1', sm: 'gap-1.5', md: 'gap-2', lg: 'gap-2.5', xl: 'gap-3' }),
4877
+ px: new PxTheme(badgeAspectRatioClasses, true),
4878
+ py: new PyTheme(uiPaddingClasses, true),
4879
+ gap: new GapTheme({ xs: '[--gap-unit:1]', sm: '[--gap-unit:1.5]', md: '[--gap-unit:2]', lg: '[--gap-unit:2.5]', xl: '[--gap-unit:3]' }, true),
4812
4880
  text: new SizeTheme({ xs: 'text-xs', sm: 'text-sm', md: 'text-base', lg: 'text-lg', xl: 'text-xl' })
4813
4881
  },
4814
4882
  appearance: {
@@ -4835,10 +4903,10 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all
4835
4903
 
4836
4904
  const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all duration-200 whitespace-nowrap", {
4837
4905
  size: {
4838
- px: new PxTheme({ xs: 'px-2', sm: 'px-2.5', md: 'px-3', lg: 'px-3.5', xl: 'px-4' }),
4839
- py: new PyTheme({ xs: 'py-0.5', sm: 'py-1', md: 'py-1.5', lg: 'py-2', xl: 'py-2.5' }),
4906
+ px: new PxTheme(chipAspectRatioClasses, true),
4907
+ py: new PyTheme(chipPyClasses, true),
4840
4908
  text: new SizeTheme({ xs: 'text-xs', sm: 'text-sm', md: 'text-base', lg: 'text-lg', xl: 'text-xl' }),
4841
- gap: new GapTheme({ xs: 'gap-1', sm: 'gap-1.5', md: 'gap-2', lg: 'gap-2.5', xl: 'gap-3' })
4909
+ gap: new GapTheme({ xs: '[--gap-unit:1]', sm: '[--gap-unit:1.5]', md: '[--gap-unit:2]', lg: '[--gap-unit:2.5]', xl: '[--gap-unit:3]' }, true)
4842
4910
  },
4843
4911
  appearance: {
4844
4912
  background: GenericVariantTheme.createSimpleUIElementBgAppearanceTheme(),
@@ -4864,10 +4932,10 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
4864
4932
 
4865
4933
  const defaultCodeTheme = new ComponentTheme("code", "", {
4866
4934
  size: {
4867
- px: new PxTheme({ xs: 'px-1', sm: 'px-1.5', md: 'px-1.5', lg: 'px-2', xl: 'px-2' }),
4868
- py: new PyTheme({ xs: 'py-0', sm: 'py-0.5', md: 'py-1', lg: 'py-1', xl: 'py-1' }),
4935
+ px: new PxTheme(codeAspectRatioClasses, true),
4936
+ py: new PyTheme(codePyClasses, true),
4869
4937
  text: new SizeTheme({ xs: 'text-xs', sm: 'text-sm', md: 'text-sm', lg: 'text-base', xl: 'text-lg' }),
4870
- gap: new GapTheme({ xs: 'gap-0.5', sm: 'gap-1', md: 'gap-1.5', lg: 'gap-2', xl: 'gap-2.5' })
4938
+ gap: new GapTheme({ xs: '[--gap-unit:0.5]', sm: '[--gap-unit:1]', md: '[--gap-unit:1.5]', lg: '[--gap-unit:2]', xl: '[--gap-unit:2.5]' }, true)
4871
4939
  },
4872
4940
  appearance: {
4873
4941
  background: GenericVariantTheme.createSimpleUIElementBgAppearanceTheme(),
@@ -5155,7 +5223,7 @@ const defaultRowTheme = new ComponentTheme("div", "", {
5155
5223
 
5156
5224
  const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
5157
5225
  size: {
5158
- py: new PyTheme(),
5226
+ py: new PyTheme(), // Uses layout spacing by default
5159
5227
  },
5160
5228
  appearance: {
5161
5229
  background: AppearanceTheme.createTheme({
@@ -5250,15 +5318,15 @@ const defaultStackTheme = new ComponentTheme("div", "", {
5250
5318
  }
5251
5319
  }, themeDefaults.stack, STACK_CATEGORIES);
5252
5320
 
5253
- const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
5321
+ const defaultSectionTheme = new ComponentTheme("div", "w-full", {
5254
5322
  size: {
5255
- px: new PxTheme(layoutPaddingClasses, sectionAspectRatioClasses),
5323
+ px: new PxTheme(sectionAspectRatioClasses),
5256
5324
  py: new PyTheme({
5257
- xs: "[--h-unit:4]",
5258
- sm: "[--h-unit:8]",
5259
- md: "[--h-unit:12]",
5260
- lg: "[--h-unit:16]",
5261
- xl: "[--h-unit:20]",
5325
+ xs: "[--py-unit:4]",
5326
+ sm: "[--py-unit:8]",
5327
+ md: "[--py-unit:12]",
5328
+ lg: "[--py-unit:16]",
5329
+ xl: "[--py-unit:20]",
5262
5330
  }),
5263
5331
  gap: new GapTheme({
5264
5332
  xs: "[--gap-unit:2]",
@@ -5381,7 +5449,7 @@ const defaultCheckboxWrapperTheme = new ComponentTheme("span", "", {
5381
5449
  const defaultLabelTheme = new ComponentTheme("label", "has-[input]:cursor-pointer cursor-default", {
5382
5450
  size: {
5383
5451
  text: new SizeTheme(textSizeClasses),
5384
- gap: new GapTheme({ xs: 'gap-1.5', sm: 'gap-2', md: 'gap-2.5', lg: 'gap-3', xl: 'gap-3' }),
5452
+ gap: new GapTheme({ xs: '[--gap-unit:1.5]', sm: '[--gap-unit:2]', md: '[--gap-unit:2.5]', lg: '[--gap-unit:3]', xl: '[--gap-unit:3]' }, true),
5385
5453
  },
5386
5454
  appearance: {
5387
5455
  text: GenericVariantTheme.createTypographyTextTheme(),
@@ -5414,9 +5482,9 @@ const defaultImgTheme = new ComponentTheme("img", "object-cover", // Default to
5414
5482
 
5415
5483
  const defaultInputTheme = new ComponentTheme("input", "w-full transition-all duration-200", {
5416
5484
  size: {
5417
- px: new PxTheme({ xs: 'px-2', sm: 'px-3', md: 'px-4', lg: 'px-5', xl: 'px-6', }),
5418
- py: new PyTheme({ xs: 'py-1', sm: 'py-1.5', md: 'py-2', lg: 'py-2.5', xl: 'py-3' }),
5419
- gap: new GapTheme({ xs: 'gap-1', sm: 'gap-1.5', md: 'gap-2', lg: 'gap-2.5', xl: 'gap-3' }),
5485
+ px: new PxTheme(inputAspectRatioClasses, true),
5486
+ py: new PyTheme(uiPaddingClasses, true),
5487
+ gap: new GapTheme({ xs: '[--gap-unit:1]', sm: '[--gap-unit:1.5]', md: '[--gap-unit:2]', lg: '[--gap-unit:2.5]', xl: '[--gap-unit:3]' }, true),
5420
5488
  text: new SizeTheme({ xs: 'text-xs', sm: 'text-sm', md: 'text-base', lg: 'text-lg', xl: 'text-xl' }),
5421
5489
  },
5422
5490
  appearance: {