@vaneui/ui 0.2.0 → 0.2.1-alpha.20250802125901.46ffce6

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: {
@@ -4387,9 +4330,14 @@ const defaultRowTheme = new ComponentTheme("div", "", {
4387
4330
  ...defaultLayoutTheme,
4388
4331
  wrap: new WrapTheme(),
4389
4332
  direction: new DirectionTheme(),
4333
+ border: new BorderTheme(),
4334
+ ring: new RingTheme(),
4335
+ radius: new RadiusTheme(),
4390
4336
  },
4391
4337
  appearance: {
4392
4338
  background: new BgAppearanceTheme(),
4339
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4340
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4393
4341
  }
4394
4342
  }, {
4395
4343
  row: true,
@@ -4397,6 +4345,9 @@ const defaultRowTheme = new ComponentTheme("div", "", {
4397
4345
  flex: true,
4398
4346
  itemsCenter: true,
4399
4347
  gap: true,
4348
+ noBorder: true,
4349
+ noRing: true,
4350
+ sharp: true,
4400
4351
  }, ROW_CATEGORIES);
4401
4352
 
4402
4353
  const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
@@ -4472,15 +4423,23 @@ const defaultColTheme = new ComponentTheme("div", "", {
4472
4423
  ...defaultLayoutTheme,
4473
4424
  wrap: new WrapTheme(),
4474
4425
  direction: new DirectionTheme(),
4426
+ border: new BorderTheme(),
4427
+ ring: new RingTheme(),
4428
+ radius: new RadiusTheme(),
4475
4429
  },
4476
4430
  appearance: {
4477
4431
  background: new BgAppearanceTheme(),
4432
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4433
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4478
4434
  }
4479
4435
  }, {
4480
4436
  column: true,
4481
4437
  md: true,
4482
4438
  flex: true,
4483
4439
  gap: true,
4440
+ noBorder: true,
4441
+ noRing: true,
4442
+ sharp: true,
4484
4443
  }, COL_CATEGORIES);
4485
4444
 
4486
4445
  const defaultStackTheme = new ComponentTheme("div", "", {
@@ -4509,9 +4468,14 @@ const defaultStackTheme = new ComponentTheme("div", "", {
4509
4468
  ...defaultLayoutTheme,
4510
4469
  wrap: new WrapTheme(),
4511
4470
  direction: new DirectionTheme(),
4471
+ border: new BorderTheme(),
4472
+ ring: new RingTheme(),
4473
+ radius: new RadiusTheme(),
4512
4474
  },
4513
4475
  appearance: {
4514
4476
  background: new BgAppearanceTheme(),
4477
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4478
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4515
4479
  }
4516
4480
  }, {
4517
4481
  md: true,
@@ -4520,6 +4484,9 @@ const defaultStackTheme = new ComponentTheme("div", "", {
4520
4484
  flexWrap: true,
4521
4485
  gap: true,
4522
4486
  padding: true,
4487
+ noBorder: true,
4488
+ noRing: true,
4489
+ sharp: true,
4523
4490
  }, STACK_CATEGORIES);
4524
4491
 
4525
4492
  const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
@@ -4761,7 +4728,7 @@ const List = (props) => {
4761
4728
  };
4762
4729
 
4763
4730
  exports.BADGE_CATEGORIES = BADGE_CATEGORIES;
4764
- exports.BASE_COMPONENT_CATEGORIES = BASE_COMPONENT_CATEGORIES;
4731
+ exports.BREAKPOINT = BREAKPOINT;
4765
4732
  exports.BUTTON_CATEGORIES = BUTTON_CATEGORIES;
4766
4733
  exports.Badge = Badge;
4767
4734
  exports.Button = Button;
@@ -4778,27 +4745,38 @@ exports.ComponentKeys = ComponentKeys;
4778
4745
  exports.Container = Container;
4779
4746
  exports.DIVIDER_CATEGORIES = DIVIDER_CATEGORIES;
4780
4747
  exports.Divider = Divider;
4781
- exports.FLEX_CONTAINER_CATEGORIES = FLEX_CONTAINER_CATEGORIES;
4782
4748
  exports.GRID_CATEGORIES = GRID_CATEGORIES;
4783
4749
  exports.Grid3 = Grid3;
4784
4750
  exports.Grid4 = Grid4;
4785
4751
  exports.INTERACTIVE_CATEGORIES = INTERACTIVE_CATEGORIES;
4752
+ exports.LAYOUT_CORE = LAYOUT_CORE;
4753
+ exports.LAYOUT_FLEX = LAYOUT_FLEX;
4754
+ exports.LAYOUT_FULL = LAYOUT_FULL;
4755
+ exports.LINK = LINK;
4786
4756
  exports.LIST_CATEGORIES = LIST_CATEGORIES;
4787
4757
  exports.Link = Link;
4788
4758
  exports.List = List;
4789
4759
  exports.ListItem = ListItem;
4760
+ exports.PADDING = PADDING;
4790
4761
  exports.PageTitle = PageTitle;
4791
4762
  exports.ROW_CATEGORIES = ROW_CATEGORIES;
4792
4763
  exports.Row = Row;
4793
4764
  exports.SECTION_CATEGORIES = SECTION_CATEGORIES;
4765
+ exports.SHAPE = SHAPE;
4794
4766
  exports.STACK_CATEGORIES = STACK_CATEGORIES;
4795
4767
  exports.Section = Section;
4796
4768
  exports.SectionTitle = SectionTitle;
4797
4769
  exports.Stack = Stack;
4798
4770
  exports.TYPOGRAPHY_CATEGORIES = TYPOGRAPHY_CATEGORIES;
4771
+ exports.TYPOGRAPHY_FULL = TYPOGRAPHY_FULL;
4772
+ exports.TYPOGRAPHY_STYLE = TYPOGRAPHY_STYLE;
4799
4773
  exports.Text = Text;
4800
4774
  exports.ThemeProvider = ThemeProvider;
4801
4775
  exports.Title = Title;
4776
+ exports.VARIANT = VARIANT;
4777
+ exports.VISUAL_CORE = VISUAL_CORE;
4778
+ exports.VISUAL_DECORATION = VISUAL_DECORATION;
4779
+ exports.VISUAL_FULL = VISUAL_FULL;
4802
4780
  exports.defaultTheme = defaultTheme;
4803
4781
  exports.useTheme = useTheme;
4804
4782
  //# sourceMappingURL=index.js.map