@vaneui/ui 0.2.0 → 0.2.1-alpha.20250802172458.e2b9257

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
@@ -11,35 +11,28 @@ var react = require('react');
11
11
  class BaseTheme {
12
12
  }
13
13
 
14
+ const LAYOUT_CORE = ['size', 'hide', 'items', 'justify', 'position', 'display', 'overflow'];
15
+ const LAYOUT_FLEX = ['wrap', 'gap', 'flexDirection', 'reverse'];
16
+ const PADDING = ['padding'];
17
+ const BREAKPOINT = ['breakpoint'];
18
+ const VISUAL_CORE = ['appearance', 'transparent'];
19
+ const VISUAL_DECORATION = ['border', 'shadow', 'ring'];
20
+ const SHAPE = ['shape'];
21
+ const TYPOGRAPHY_STYLE = ['fontWeight', 'fontStyle', 'textDecoration', 'textTransform', 'fontFamily', 'textAlign'];
22
+ const LINK = ['link'];
23
+ const VARIANT = ['variant'];
14
24
  const COMPONENT_PROPS_CATEGORY = [
15
- 'appearance',
16
- 'border',
17
- 'breakpoint',
18
- 'display',
19
- 'flexDirection',
20
- 'fontFamily',
21
- 'fontStyle',
22
- 'fontWeight',
23
- 'gap',
24
- 'hide',
25
- 'items',
26
- 'justify',
27
- 'link',
25
+ ...VISUAL_CORE,
26
+ ...LAYOUT_FLEX,
27
+ ...TYPOGRAPHY_STYLE,
28
+ ...LAYOUT_CORE,
29
+ ...BREAKPOINT,
30
+ ...LINK,
31
+ ...PADDING,
32
+ ...VISUAL_DECORATION,
33
+ ...SHAPE,
34
+ ...VARIANT,
28
35
  'mode',
29
- 'overflow',
30
- 'padding',
31
- 'position',
32
- 'reverse',
33
- 'ring',
34
- 'shadow',
35
- 'shape',
36
- 'size',
37
- 'textAlign',
38
- 'textDecoration',
39
- 'textTransform',
40
- 'transparent',
41
- 'variant',
42
- 'wrap'
43
36
  ];
44
37
  const ComponentKeys = {
45
38
  appearance: ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info'],
@@ -61,7 +54,6 @@ const ComponentKeys = {
61
54
  position: ['relative', 'absolute', 'fixed', 'sticky', 'static'],
62
55
  reverse: ['reverse'],
63
56
  ring: ['ring', 'noRing'],
64
- rounded: ['rounded'],
65
57
  shadow: ['shadow', 'noShadow'],
66
58
  shape: ['pill', 'sharp', 'rounded'],
67
59
  size: ['xs', 'sm', 'md', 'lg', 'xl'],
@@ -72,38 +64,26 @@ const ComponentKeys = {
72
64
  variant: ['filled', 'outline'],
73
65
  wrap: ['flexWrap', 'flexNoWrap', 'flexWrapReverse'],
74
66
  };
75
- // Core building blocks - fundamental categories
76
- const LAYOUT_CORE = ['size', 'hide', 'items', 'justify', 'position', 'display', 'overflow'];
77
- const LAYOUT_FLEX = ['wrap', 'gap', 'flexDirection', 'reverse'];
78
- const LAYOUT_SPACING = ['padding'];
79
- const LAYOUT_RESPONSIVE = ['breakpoint'];
80
- const VISUAL_CORE = ['appearance', 'transparent'];
81
- const VISUAL_DECORATION = ['border', 'shadow', 'ring'];
82
- const VISUAL_SHAPE = ['shape'];
83
- const TYPOGRAPHY_STYLE = ['fontWeight', 'fontStyle', 'textDecoration', 'textTransform', 'fontFamily', 'textAlign'];
84
- const TYPOGRAPHY_SEMANTIC = ['link'];
85
- const INTERACTION_FORM = ['variant'];
86
67
  // Composite categories built from core blocks
87
68
  const LAYOUT_FULL = [...LAYOUT_CORE, ...LAYOUT_FLEX];
88
- const VISUAL_FULL = [...VISUAL_CORE, ...VISUAL_DECORATION, ...VISUAL_SHAPE];
89
- const TYPOGRAPHY_FULL = [...TYPOGRAPHY_STYLE, ...TYPOGRAPHY_SEMANTIC];
90
- // Component-specific category combinations
91
- const BASE_COMPONENT_CATEGORIES = LAYOUT_CORE;
92
- const TYPOGRAPHY_CATEGORIES = [...LAYOUT_CORE, ...VISUAL_CORE, ...TYPOGRAPHY_FULL];
93
- const LIST_CATEGORIES = [...TYPOGRAPHY_CATEGORIES, ...LAYOUT_SPACING];
94
- const INTERACTIVE_CATEGORIES = [...LAYOUT_CORE, ...VISUAL_FULL, ...TYPOGRAPHY_STYLE, ...LAYOUT_SPACING, ...LAYOUT_FLEX, ...INTERACTION_FORM];
69
+ const VISUAL_FULL = [...VISUAL_CORE, ...VISUAL_DECORATION, ...SHAPE];
70
+ const TYPOGRAPHY_FULL = [...TYPOGRAPHY_STYLE, ...LINK];
71
+ const INTERACTIVE_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL, ...TYPOGRAPHY_STYLE, ...PADDING, ...VARIANT];
95
72
  const BUTTON_CATEGORIES = INTERACTIVE_CATEGORIES;
96
73
  const BADGE_CATEGORIES = INTERACTIVE_CATEGORIES;
97
74
  const CHIP_CATEGORIES = INTERACTIVE_CATEGORIES;
75
+ //typography:
76
+ const TYPOGRAPHY_CATEGORIES = [...TYPOGRAPHY_FULL, ...LAYOUT_CORE, ...VISUAL_CORE];
77
+ const LIST_CATEGORIES = [...TYPOGRAPHY_FULL, ...LAYOUT_CORE, ...VISUAL_CORE, ...PADDING];
78
+ //layout:
79
+ const GRID_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_CORE];
98
80
  const CONTAINER_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL];
99
- const FLEX_CONTAINER_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_CORE];
100
- const GRID_CATEGORIES = [...LAYOUT_CORE, ...LAYOUT_FLEX, ...VISUAL_CORE];
101
- const ROW_CATEGORIES = [...FLEX_CONTAINER_CATEGORIES, ...LAYOUT_RESPONSIVE];
102
- const COL_CATEGORIES = FLEX_CONTAINER_CATEGORIES;
103
- const STACK_CATEGORIES = [...FLEX_CONTAINER_CATEGORIES, ...LAYOUT_RESPONSIVE, ...LAYOUT_SPACING];
104
- const CARD_CATEGORIES = [...TYPOGRAPHY_CATEGORIES, ...LAYOUT_FLEX, ...LAYOUT_RESPONSIVE, ...VISUAL_DECORATION, ...VISUAL_SHAPE, ...LAYOUT_SPACING];
105
- const DIVIDER_CATEGORIES = [...BASE_COMPONENT_CATEGORIES, ...VISUAL_CORE, ...LAYOUT_SPACING];
106
- const SECTION_CATEGORIES = [...BASE_COMPONENT_CATEGORIES, ...VISUAL_CORE, ...LAYOUT_SPACING, ...LAYOUT_FLEX, ...LAYOUT_RESPONSIVE, ...VISUAL_DECORATION, ...VISUAL_SHAPE];
81
+ const COL_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL];
82
+ const ROW_CATEGORIES = [...LAYOUT_FULL, ...BREAKPOINT, ...VISUAL_FULL];
83
+ const STACK_CATEGORIES = [...LAYOUT_FULL, ...BREAKPOINT, ...PADDING, ...VISUAL_FULL];
84
+ const CARD_CATEGORIES = [...TYPOGRAPHY_FULL, ...LAYOUT_FULL, ...BREAKPOINT, ...VISUAL_FULL, ...PADDING];
85
+ const DIVIDER_CATEGORIES = [...LAYOUT_CORE, ...VISUAL_CORE, ...PADDING];
86
+ const SECTION_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL, ...PADDING, ...BREAKPOINT];
107
87
 
108
88
  class HideTheme extends BaseTheme {
109
89
  constructor(initialConfig) {
@@ -3164,7 +3144,6 @@ class ComponentTheme {
3164
3144
  var _a;
3165
3145
  const cleanProps = { ...props };
3166
3146
  const keysToOmit = this.categories.flatMap(category => ComponentKeys[category]);
3167
- // Remove the component-specific keys
3168
3147
  for (const k of keysToOmit) {
3169
3148
  delete cleanProps[k];
3170
3149
  }
@@ -3469,36 +3448,6 @@ class TextAppearanceTheme extends BaseTheme {
3469
3448
  return new TextAppearanceTheme(finalConfig);
3470
3449
  }
3471
3450
  }
3472
- class UIElementTextAppearanceTheme extends BaseTheme {
3473
- constructor(config) {
3474
- super();
3475
- Object.assign(this, config);
3476
- }
3477
- getClasses(extractedKeys) {
3478
- const appearance = extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.appearance;
3479
- if (!appearance) {
3480
- return [];
3481
- }
3482
- const modes = this[appearance];
3483
- if (!modes) {
3484
- return [];
3485
- }
3486
- return ComponentKeys.mode.map(mode => modes[mode] || '');
3487
- }
3488
- static createTheme(src = {}) {
3489
- const finalConfig = Object.fromEntries(ComponentKeys.appearance.map(textKey => [
3490
- textKey,
3491
- Object.fromEntries(ComponentKeys.mode.map(modeKey => {
3492
- var _a;
3493
- return [
3494
- modeKey,
3495
- ((_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey]) || ''
3496
- ];
3497
- })),
3498
- ]));
3499
- return new UIElementTextAppearanceTheme(finalConfig);
3500
- }
3501
- }
3502
3451
 
3503
3452
  const filledBackgroundAppearanceClasses = {
3504
3453
  default: "bg-(--filled-background-color-default)",
@@ -3716,10 +3665,10 @@ class GenericVariantTheme extends BaseTheme {
3716
3665
  // used for button, bages, chips, etc
3717
3666
  static createUIElementTextTheme() {
3718
3667
  return new GenericVariantTheme({
3719
- outline: UIElementTextAppearanceTheme.createTheme({
3668
+ outline: TextAppearanceTheme.createTheme({
3720
3669
  base: this.filterToUIElementKeys(textAppearanceClasses)
3721
3670
  }),
3722
- filled: UIElementTextAppearanceTheme.createTheme({
3671
+ filled: TextAppearanceTheme.createTheme({
3723
3672
  base: this.filterToUIElementKeys(filledTextAppearanceClasses)
3724
3673
  })
3725
3674
  });
@@ -3738,10 +3687,10 @@ class GenericVariantTheme extends BaseTheme {
3738
3687
  }
3739
3688
  static createUIElementBorderTheme() {
3740
3689
  return new GenericVariantTheme({
3741
- outline: UIElementTextAppearanceTheme.createTheme({
3690
+ outline: TextAppearanceTheme.createTheme({
3742
3691
  base: this.filterToUIElementKeys(borderAppearanceClasses)
3743
3692
  }),
3744
- filled: UIElementTextAppearanceTheme.createTheme({
3693
+ filled: TextAppearanceTheme.createTheme({
3745
3694
  base: this.filterToUIElementKeys(filledBorderAppearanceClasses)
3746
3695
  })
3747
3696
  });
@@ -3754,10 +3703,10 @@ class GenericVariantTheme extends BaseTheme {
3754
3703
  }
3755
3704
  static createUIElementRingTheme() {
3756
3705
  return new GenericVariantTheme({
3757
- outline: UIElementTextAppearanceTheme.createTheme({
3706
+ outline: TextAppearanceTheme.createTheme({
3758
3707
  base: this.filterToUIElementKeys(ringAppearanceClasses)
3759
3708
  }),
3760
- filled: UIElementTextAppearanceTheme.createTheme({
3709
+ filled: TextAppearanceTheme.createTheme({
3761
3710
  base: this.filterToUIElementKeys(filledRingAppearanceClasses)
3762
3711
  })
3763
3712
  });
@@ -3778,12 +3727,12 @@ class GenericVariantTheme extends BaseTheme {
3778
3727
  }
3779
3728
  static createUIElementBgAppearanceTheme() {
3780
3729
  return new GenericVariantTheme({
3781
- outline: UIElementTextAppearanceTheme.createTheme({
3730
+ outline: TextAppearanceTheme.createTheme({
3782
3731
  base: this.filterToUIElementKeys(backgroundAppearanceClasses),
3783
3732
  hover: this.filterToUIElementKeys(hoverBackgroundAppearanceClasses),
3784
3733
  active: this.filterToUIElementKeys(activeBackgroundAppearanceClasses)
3785
3734
  }),
3786
- filled: UIElementTextAppearanceTheme.createTheme({
3735
+ filled: TextAppearanceTheme.createTheme({
3787
3736
  base: this.filterToUIElementKeys(filledBackgroundAppearanceClasses),
3788
3737
  hover: this.filterToUIElementKeys(filledHoverBackgroundAppearanceClasses),
3789
3738
  active: this.filterToUIElementKeys(filledActiveBackgroundAppearanceClasses)
@@ -3802,10 +3751,10 @@ class GenericVariantTheme extends BaseTheme {
3802
3751
  }
3803
3752
  static createSimpleUIElementBgAppearanceTheme() {
3804
3753
  return new GenericVariantTheme({
3805
- outline: UIElementTextAppearanceTheme.createTheme({
3754
+ outline: TextAppearanceTheme.createTheme({
3806
3755
  base: this.filterToUIElementKeys(backgroundAppearanceClasses),
3807
3756
  }),
3808
- filled: UIElementTextAppearanceTheme.createTheme({
3757
+ filled: TextAppearanceTheme.createTheme({
3809
3758
  base: this.filterToUIElementKeys(filledBackgroundAppearanceClasses),
3810
3759
  })
3811
3760
  });
@@ -3815,13 +3764,7 @@ class GenericVariantTheme extends BaseTheme {
3815
3764
  const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-pointer transition-all duration-200 whitespace-nowrap", {
3816
3765
  size: {
3817
3766
  px: new PxTheme({
3818
- padding: {
3819
- xs: 'px-2',
3820
- sm: 'px-3',
3821
- md: 'px-4',
3822
- lg: 'px-5',
3823
- xl: 'px-6',
3824
- }
3767
+ padding: { xs: 'px-2', sm: 'px-3', md: 'px-4', lg: 'px-5', xl: 'px-6', }
3825
3768
  }),
3826
3769
  py: new PyTheme({
3827
3770
  padding: {
@@ -4181,7 +4124,21 @@ const titleTheme = createTypographyComponentTheme("h3", "text-balance w-fit", {
4181
4124
  // Text specific theme
4182
4125
  const textTheme = createTypographyComponentTheme("p", "p-0 m-0 w-fit", textSizeClasses);
4183
4126
  // Link specific theme
4184
- const linkTheme = createTypographyComponentTheme("a", "hover:underline w-fit", textSizeClasses, mergeDefaults(typographyThemeDefaults, { link: true }));
4127
+ const linkTheme = new ComponentTheme("a", "hover:underline w-fit", {
4128
+ size: {
4129
+ text: new SizeTheme(textSizeClasses, false),
4130
+ },
4131
+ appearance: {
4132
+ text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
4133
+ },
4134
+ typography: defaultTypographyTheme,
4135
+ layout: defaultLayoutTheme,
4136
+ }, {
4137
+ link: true,
4138
+ default: true,
4139
+ sans: true,
4140
+ normal: true,
4141
+ }, TYPOGRAPHY_CATEGORIES);
4185
4142
  // List specific theme
4186
4143
  const listItemTheme = new ComponentTheme("li", "", {
4187
4144
  size: {
@@ -4387,9 +4344,14 @@ const defaultRowTheme = new ComponentTheme("div", "", {
4387
4344
  ...defaultLayoutTheme,
4388
4345
  wrap: new WrapTheme(),
4389
4346
  direction: new DirectionTheme(),
4347
+ border: new BorderTheme(),
4348
+ ring: new RingTheme(),
4349
+ radius: new RadiusTheme(),
4390
4350
  },
4391
4351
  appearance: {
4392
4352
  background: new BgAppearanceTheme(),
4353
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4354
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4393
4355
  }
4394
4356
  }, {
4395
4357
  row: true,
@@ -4397,6 +4359,9 @@ const defaultRowTheme = new ComponentTheme("div", "", {
4397
4359
  flex: true,
4398
4360
  itemsCenter: true,
4399
4361
  gap: true,
4362
+ noBorder: true,
4363
+ noRing: true,
4364
+ sharp: true,
4400
4365
  }, ROW_CATEGORIES);
4401
4366
 
4402
4367
  const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
@@ -4472,15 +4437,23 @@ const defaultColTheme = new ComponentTheme("div", "", {
4472
4437
  ...defaultLayoutTheme,
4473
4438
  wrap: new WrapTheme(),
4474
4439
  direction: new DirectionTheme(),
4440
+ border: new BorderTheme(),
4441
+ ring: new RingTheme(),
4442
+ radius: new RadiusTheme(),
4475
4443
  },
4476
4444
  appearance: {
4477
4445
  background: new BgAppearanceTheme(),
4446
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4447
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4478
4448
  }
4479
4449
  }, {
4480
4450
  column: true,
4481
4451
  md: true,
4482
4452
  flex: true,
4483
4453
  gap: true,
4454
+ noBorder: true,
4455
+ noRing: true,
4456
+ sharp: true,
4484
4457
  }, COL_CATEGORIES);
4485
4458
 
4486
4459
  const defaultStackTheme = new ComponentTheme("div", "", {
@@ -4509,9 +4482,14 @@ const defaultStackTheme = new ComponentTheme("div", "", {
4509
4482
  ...defaultLayoutTheme,
4510
4483
  wrap: new WrapTheme(),
4511
4484
  direction: new DirectionTheme(),
4485
+ border: new BorderTheme(),
4486
+ ring: new RingTheme(),
4487
+ radius: new RadiusTheme(),
4512
4488
  },
4513
4489
  appearance: {
4514
4490
  background: new BgAppearanceTheme(),
4491
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4492
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4515
4493
  }
4516
4494
  }, {
4517
4495
  md: true,
@@ -4520,6 +4498,9 @@ const defaultStackTheme = new ComponentTheme("div", "", {
4520
4498
  flexWrap: true,
4521
4499
  gap: true,
4522
4500
  padding: true,
4501
+ noBorder: true,
4502
+ noRing: true,
4503
+ sharp: true,
4523
4504
  }, STACK_CATEGORIES);
4524
4505
 
4525
4506
  const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
@@ -4761,7 +4742,7 @@ const List = (props) => {
4761
4742
  };
4762
4743
 
4763
4744
  exports.BADGE_CATEGORIES = BADGE_CATEGORIES;
4764
- exports.BASE_COMPONENT_CATEGORIES = BASE_COMPONENT_CATEGORIES;
4745
+ exports.BREAKPOINT = BREAKPOINT;
4765
4746
  exports.BUTTON_CATEGORIES = BUTTON_CATEGORIES;
4766
4747
  exports.Badge = Badge;
4767
4748
  exports.Button = Button;
@@ -4778,27 +4759,38 @@ exports.ComponentKeys = ComponentKeys;
4778
4759
  exports.Container = Container;
4779
4760
  exports.DIVIDER_CATEGORIES = DIVIDER_CATEGORIES;
4780
4761
  exports.Divider = Divider;
4781
- exports.FLEX_CONTAINER_CATEGORIES = FLEX_CONTAINER_CATEGORIES;
4782
4762
  exports.GRID_CATEGORIES = GRID_CATEGORIES;
4783
4763
  exports.Grid3 = Grid3;
4784
4764
  exports.Grid4 = Grid4;
4785
4765
  exports.INTERACTIVE_CATEGORIES = INTERACTIVE_CATEGORIES;
4766
+ exports.LAYOUT_CORE = LAYOUT_CORE;
4767
+ exports.LAYOUT_FLEX = LAYOUT_FLEX;
4768
+ exports.LAYOUT_FULL = LAYOUT_FULL;
4769
+ exports.LINK = LINK;
4786
4770
  exports.LIST_CATEGORIES = LIST_CATEGORIES;
4787
4771
  exports.Link = Link;
4788
4772
  exports.List = List;
4789
4773
  exports.ListItem = ListItem;
4774
+ exports.PADDING = PADDING;
4790
4775
  exports.PageTitle = PageTitle;
4791
4776
  exports.ROW_CATEGORIES = ROW_CATEGORIES;
4792
4777
  exports.Row = Row;
4793
4778
  exports.SECTION_CATEGORIES = SECTION_CATEGORIES;
4779
+ exports.SHAPE = SHAPE;
4794
4780
  exports.STACK_CATEGORIES = STACK_CATEGORIES;
4795
4781
  exports.Section = Section;
4796
4782
  exports.SectionTitle = SectionTitle;
4797
4783
  exports.Stack = Stack;
4798
4784
  exports.TYPOGRAPHY_CATEGORIES = TYPOGRAPHY_CATEGORIES;
4785
+ exports.TYPOGRAPHY_FULL = TYPOGRAPHY_FULL;
4786
+ exports.TYPOGRAPHY_STYLE = TYPOGRAPHY_STYLE;
4799
4787
  exports.Text = Text;
4800
4788
  exports.ThemeProvider = ThemeProvider;
4801
4789
  exports.Title = Title;
4790
+ exports.VARIANT = VARIANT;
4791
+ exports.VISUAL_CORE = VISUAL_CORE;
4792
+ exports.VISUAL_DECORATION = VISUAL_DECORATION;
4793
+ exports.VISUAL_FULL = VISUAL_FULL;
4802
4794
  exports.defaultTheme = defaultTheme;
4803
4795
  exports.useTheme = useTheme;
4804
4796
  //# sourceMappingURL=index.js.map