@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.esm.js CHANGED
@@ -9,35 +9,28 @@ import { createContext, useMemo, useContext } from 'react';
9
9
  class BaseTheme {
10
10
  }
11
11
 
12
+ const LAYOUT_CORE = ['size', 'hide', 'items', 'justify', 'position', 'display', 'overflow'];
13
+ const LAYOUT_FLEX = ['wrap', 'gap', 'flexDirection', 'reverse'];
14
+ const PADDING = ['padding'];
15
+ const BREAKPOINT = ['breakpoint'];
16
+ const VISUAL_CORE = ['appearance', 'transparent'];
17
+ const VISUAL_DECORATION = ['border', 'shadow', 'ring'];
18
+ const SHAPE = ['shape'];
19
+ const TYPOGRAPHY_STYLE = ['fontWeight', 'fontStyle', 'textDecoration', 'textTransform', 'fontFamily', 'textAlign'];
20
+ const LINK = ['link'];
21
+ const VARIANT = ['variant'];
12
22
  const COMPONENT_PROPS_CATEGORY = [
13
- 'appearance',
14
- 'border',
15
- 'breakpoint',
16
- 'display',
17
- 'flexDirection',
18
- 'fontFamily',
19
- 'fontStyle',
20
- 'fontWeight',
21
- 'gap',
22
- 'hide',
23
- 'items',
24
- 'justify',
25
- 'link',
23
+ ...VISUAL_CORE,
24
+ ...LAYOUT_FLEX,
25
+ ...TYPOGRAPHY_STYLE,
26
+ ...LAYOUT_CORE,
27
+ ...BREAKPOINT,
28
+ ...LINK,
29
+ ...PADDING,
30
+ ...VISUAL_DECORATION,
31
+ ...SHAPE,
32
+ ...VARIANT,
26
33
  'mode',
27
- 'overflow',
28
- 'padding',
29
- 'position',
30
- 'reverse',
31
- 'ring',
32
- 'shadow',
33
- 'shape',
34
- 'size',
35
- 'textAlign',
36
- 'textDecoration',
37
- 'textTransform',
38
- 'transparent',
39
- 'variant',
40
- 'wrap'
41
34
  ];
42
35
  const ComponentKeys = {
43
36
  appearance: ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info'],
@@ -59,7 +52,6 @@ const ComponentKeys = {
59
52
  position: ['relative', 'absolute', 'fixed', 'sticky', 'static'],
60
53
  reverse: ['reverse'],
61
54
  ring: ['ring', 'noRing'],
62
- rounded: ['rounded'],
63
55
  shadow: ['shadow', 'noShadow'],
64
56
  shape: ['pill', 'sharp', 'rounded'],
65
57
  size: ['xs', 'sm', 'md', 'lg', 'xl'],
@@ -70,38 +62,26 @@ const ComponentKeys = {
70
62
  variant: ['filled', 'outline'],
71
63
  wrap: ['flexWrap', 'flexNoWrap', 'flexWrapReverse'],
72
64
  };
73
- // Core building blocks - fundamental categories
74
- const LAYOUT_CORE = ['size', 'hide', 'items', 'justify', 'position', 'display', 'overflow'];
75
- const LAYOUT_FLEX = ['wrap', 'gap', 'flexDirection', 'reverse'];
76
- const LAYOUT_SPACING = ['padding'];
77
- const LAYOUT_RESPONSIVE = ['breakpoint'];
78
- const VISUAL_CORE = ['appearance', 'transparent'];
79
- const VISUAL_DECORATION = ['border', 'shadow', 'ring'];
80
- const VISUAL_SHAPE = ['shape'];
81
- const TYPOGRAPHY_STYLE = ['fontWeight', 'fontStyle', 'textDecoration', 'textTransform', 'fontFamily', 'textAlign'];
82
- const TYPOGRAPHY_SEMANTIC = ['link'];
83
- const INTERACTION_FORM = ['variant'];
84
65
  // Composite categories built from core blocks
85
66
  const LAYOUT_FULL = [...LAYOUT_CORE, ...LAYOUT_FLEX];
86
- const VISUAL_FULL = [...VISUAL_CORE, ...VISUAL_DECORATION, ...VISUAL_SHAPE];
87
- const TYPOGRAPHY_FULL = [...TYPOGRAPHY_STYLE, ...TYPOGRAPHY_SEMANTIC];
88
- // Component-specific category combinations
89
- const BASE_COMPONENT_CATEGORIES = LAYOUT_CORE;
90
- const TYPOGRAPHY_CATEGORIES = [...LAYOUT_CORE, ...VISUAL_CORE, ...TYPOGRAPHY_FULL];
91
- const LIST_CATEGORIES = [...TYPOGRAPHY_CATEGORIES, ...LAYOUT_SPACING];
92
- const INTERACTIVE_CATEGORIES = [...LAYOUT_CORE, ...VISUAL_FULL, ...TYPOGRAPHY_STYLE, ...LAYOUT_SPACING, ...LAYOUT_FLEX, ...INTERACTION_FORM];
67
+ const VISUAL_FULL = [...VISUAL_CORE, ...VISUAL_DECORATION, ...SHAPE];
68
+ const TYPOGRAPHY_FULL = [...TYPOGRAPHY_STYLE, ...LINK];
69
+ const INTERACTIVE_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL, ...TYPOGRAPHY_STYLE, ...PADDING, ...VARIANT];
93
70
  const BUTTON_CATEGORIES = INTERACTIVE_CATEGORIES;
94
71
  const BADGE_CATEGORIES = INTERACTIVE_CATEGORIES;
95
72
  const CHIP_CATEGORIES = INTERACTIVE_CATEGORIES;
73
+ //typography:
74
+ const TYPOGRAPHY_CATEGORIES = [...TYPOGRAPHY_FULL, ...LAYOUT_CORE, ...VISUAL_CORE];
75
+ const LIST_CATEGORIES = [...TYPOGRAPHY_FULL, ...LAYOUT_CORE, ...VISUAL_CORE, ...PADDING];
76
+ //layout:
77
+ const GRID_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_CORE];
96
78
  const CONTAINER_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL];
97
- const FLEX_CONTAINER_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_CORE];
98
- const GRID_CATEGORIES = [...LAYOUT_CORE, ...LAYOUT_FLEX, ...VISUAL_CORE];
99
- const ROW_CATEGORIES = [...FLEX_CONTAINER_CATEGORIES, ...LAYOUT_RESPONSIVE];
100
- const COL_CATEGORIES = FLEX_CONTAINER_CATEGORIES;
101
- const STACK_CATEGORIES = [...FLEX_CONTAINER_CATEGORIES, ...LAYOUT_RESPONSIVE, ...LAYOUT_SPACING];
102
- const CARD_CATEGORIES = [...TYPOGRAPHY_CATEGORIES, ...LAYOUT_FLEX, ...LAYOUT_RESPONSIVE, ...VISUAL_DECORATION, ...VISUAL_SHAPE, ...LAYOUT_SPACING];
103
- const DIVIDER_CATEGORIES = [...BASE_COMPONENT_CATEGORIES, ...VISUAL_CORE, ...LAYOUT_SPACING];
104
- const SECTION_CATEGORIES = [...BASE_COMPONENT_CATEGORIES, ...VISUAL_CORE, ...LAYOUT_SPACING, ...LAYOUT_FLEX, ...LAYOUT_RESPONSIVE, ...VISUAL_DECORATION, ...VISUAL_SHAPE];
79
+ const COL_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL];
80
+ const ROW_CATEGORIES = [...LAYOUT_FULL, ...BREAKPOINT, ...VISUAL_FULL];
81
+ const STACK_CATEGORIES = [...LAYOUT_FULL, ...BREAKPOINT, ...PADDING, ...VISUAL_FULL];
82
+ const CARD_CATEGORIES = [...TYPOGRAPHY_FULL, ...LAYOUT_FULL, ...BREAKPOINT, ...VISUAL_FULL, ...PADDING];
83
+ const DIVIDER_CATEGORIES = [...LAYOUT_CORE, ...VISUAL_CORE, ...PADDING];
84
+ const SECTION_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL, ...PADDING, ...BREAKPOINT];
105
85
 
106
86
  class HideTheme extends BaseTheme {
107
87
  constructor(initialConfig) {
@@ -3162,7 +3142,6 @@ class ComponentTheme {
3162
3142
  var _a;
3163
3143
  const cleanProps = { ...props };
3164
3144
  const keysToOmit = this.categories.flatMap(category => ComponentKeys[category]);
3165
- // Remove the component-specific keys
3166
3145
  for (const k of keysToOmit) {
3167
3146
  delete cleanProps[k];
3168
3147
  }
@@ -3467,36 +3446,6 @@ class TextAppearanceTheme extends BaseTheme {
3467
3446
  return new TextAppearanceTheme(finalConfig);
3468
3447
  }
3469
3448
  }
3470
- class UIElementTextAppearanceTheme extends BaseTheme {
3471
- constructor(config) {
3472
- super();
3473
- Object.assign(this, config);
3474
- }
3475
- getClasses(extractedKeys) {
3476
- const appearance = extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.appearance;
3477
- if (!appearance) {
3478
- return [];
3479
- }
3480
- const modes = this[appearance];
3481
- if (!modes) {
3482
- return [];
3483
- }
3484
- return ComponentKeys.mode.map(mode => modes[mode] || '');
3485
- }
3486
- static createTheme(src = {}) {
3487
- const finalConfig = Object.fromEntries(ComponentKeys.appearance.map(textKey => [
3488
- textKey,
3489
- Object.fromEntries(ComponentKeys.mode.map(modeKey => {
3490
- var _a;
3491
- return [
3492
- modeKey,
3493
- ((_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey]) || ''
3494
- ];
3495
- })),
3496
- ]));
3497
- return new UIElementTextAppearanceTheme(finalConfig);
3498
- }
3499
- }
3500
3449
 
3501
3450
  const filledBackgroundAppearanceClasses = {
3502
3451
  default: "bg-(--filled-background-color-default)",
@@ -3714,10 +3663,10 @@ class GenericVariantTheme extends BaseTheme {
3714
3663
  // used for button, bages, chips, etc
3715
3664
  static createUIElementTextTheme() {
3716
3665
  return new GenericVariantTheme({
3717
- outline: UIElementTextAppearanceTheme.createTheme({
3666
+ outline: TextAppearanceTheme.createTheme({
3718
3667
  base: this.filterToUIElementKeys(textAppearanceClasses)
3719
3668
  }),
3720
- filled: UIElementTextAppearanceTheme.createTheme({
3669
+ filled: TextAppearanceTheme.createTheme({
3721
3670
  base: this.filterToUIElementKeys(filledTextAppearanceClasses)
3722
3671
  })
3723
3672
  });
@@ -3736,10 +3685,10 @@ class GenericVariantTheme extends BaseTheme {
3736
3685
  }
3737
3686
  static createUIElementBorderTheme() {
3738
3687
  return new GenericVariantTheme({
3739
- outline: UIElementTextAppearanceTheme.createTheme({
3688
+ outline: TextAppearanceTheme.createTheme({
3740
3689
  base: this.filterToUIElementKeys(borderAppearanceClasses)
3741
3690
  }),
3742
- filled: UIElementTextAppearanceTheme.createTheme({
3691
+ filled: TextAppearanceTheme.createTheme({
3743
3692
  base: this.filterToUIElementKeys(filledBorderAppearanceClasses)
3744
3693
  })
3745
3694
  });
@@ -3752,10 +3701,10 @@ class GenericVariantTheme extends BaseTheme {
3752
3701
  }
3753
3702
  static createUIElementRingTheme() {
3754
3703
  return new GenericVariantTheme({
3755
- outline: UIElementTextAppearanceTheme.createTheme({
3704
+ outline: TextAppearanceTheme.createTheme({
3756
3705
  base: this.filterToUIElementKeys(ringAppearanceClasses)
3757
3706
  }),
3758
- filled: UIElementTextAppearanceTheme.createTheme({
3707
+ filled: TextAppearanceTheme.createTheme({
3759
3708
  base: this.filterToUIElementKeys(filledRingAppearanceClasses)
3760
3709
  })
3761
3710
  });
@@ -3776,12 +3725,12 @@ class GenericVariantTheme extends BaseTheme {
3776
3725
  }
3777
3726
  static createUIElementBgAppearanceTheme() {
3778
3727
  return new GenericVariantTheme({
3779
- outline: UIElementTextAppearanceTheme.createTheme({
3728
+ outline: TextAppearanceTheme.createTheme({
3780
3729
  base: this.filterToUIElementKeys(backgroundAppearanceClasses),
3781
3730
  hover: this.filterToUIElementKeys(hoverBackgroundAppearanceClasses),
3782
3731
  active: this.filterToUIElementKeys(activeBackgroundAppearanceClasses)
3783
3732
  }),
3784
- filled: UIElementTextAppearanceTheme.createTheme({
3733
+ filled: TextAppearanceTheme.createTheme({
3785
3734
  base: this.filterToUIElementKeys(filledBackgroundAppearanceClasses),
3786
3735
  hover: this.filterToUIElementKeys(filledHoverBackgroundAppearanceClasses),
3787
3736
  active: this.filterToUIElementKeys(filledActiveBackgroundAppearanceClasses)
@@ -3800,10 +3749,10 @@ class GenericVariantTheme extends BaseTheme {
3800
3749
  }
3801
3750
  static createSimpleUIElementBgAppearanceTheme() {
3802
3751
  return new GenericVariantTheme({
3803
- outline: UIElementTextAppearanceTheme.createTheme({
3752
+ outline: TextAppearanceTheme.createTheme({
3804
3753
  base: this.filterToUIElementKeys(backgroundAppearanceClasses),
3805
3754
  }),
3806
- filled: UIElementTextAppearanceTheme.createTheme({
3755
+ filled: TextAppearanceTheme.createTheme({
3807
3756
  base: this.filterToUIElementKeys(filledBackgroundAppearanceClasses),
3808
3757
  })
3809
3758
  });
@@ -3813,13 +3762,7 @@ class GenericVariantTheme extends BaseTheme {
3813
3762
  const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-pointer transition-all duration-200 whitespace-nowrap", {
3814
3763
  size: {
3815
3764
  px: new PxTheme({
3816
- padding: {
3817
- xs: 'px-2',
3818
- sm: 'px-3',
3819
- md: 'px-4',
3820
- lg: 'px-5',
3821
- xl: 'px-6',
3822
- }
3765
+ padding: { xs: 'px-2', sm: 'px-3', md: 'px-4', lg: 'px-5', xl: 'px-6', }
3823
3766
  }),
3824
3767
  py: new PyTheme({
3825
3768
  padding: {
@@ -4385,9 +4328,14 @@ const defaultRowTheme = new ComponentTheme("div", "", {
4385
4328
  ...defaultLayoutTheme,
4386
4329
  wrap: new WrapTheme(),
4387
4330
  direction: new DirectionTheme(),
4331
+ border: new BorderTheme(),
4332
+ ring: new RingTheme(),
4333
+ radius: new RadiusTheme(),
4388
4334
  },
4389
4335
  appearance: {
4390
4336
  background: new BgAppearanceTheme(),
4337
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4338
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4391
4339
  }
4392
4340
  }, {
4393
4341
  row: true,
@@ -4395,6 +4343,9 @@ const defaultRowTheme = new ComponentTheme("div", "", {
4395
4343
  flex: true,
4396
4344
  itemsCenter: true,
4397
4345
  gap: true,
4346
+ noBorder: true,
4347
+ noRing: true,
4348
+ sharp: true,
4398
4349
  }, ROW_CATEGORIES);
4399
4350
 
4400
4351
  const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
@@ -4470,15 +4421,23 @@ const defaultColTheme = new ComponentTheme("div", "", {
4470
4421
  ...defaultLayoutTheme,
4471
4422
  wrap: new WrapTheme(),
4472
4423
  direction: new DirectionTheme(),
4424
+ border: new BorderTheme(),
4425
+ ring: new RingTheme(),
4426
+ radius: new RadiusTheme(),
4473
4427
  },
4474
4428
  appearance: {
4475
4429
  background: new BgAppearanceTheme(),
4430
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4431
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4476
4432
  }
4477
4433
  }, {
4478
4434
  column: true,
4479
4435
  md: true,
4480
4436
  flex: true,
4481
4437
  gap: true,
4438
+ noBorder: true,
4439
+ noRing: true,
4440
+ sharp: true,
4482
4441
  }, COL_CATEGORIES);
4483
4442
 
4484
4443
  const defaultStackTheme = new ComponentTheme("div", "", {
@@ -4507,9 +4466,14 @@ const defaultStackTheme = new ComponentTheme("div", "", {
4507
4466
  ...defaultLayoutTheme,
4508
4467
  wrap: new WrapTheme(),
4509
4468
  direction: new DirectionTheme(),
4469
+ border: new BorderTheme(),
4470
+ ring: new RingTheme(),
4471
+ radius: new RadiusTheme(),
4510
4472
  },
4511
4473
  appearance: {
4512
4474
  background: new BgAppearanceTheme(),
4475
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4476
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4513
4477
  }
4514
4478
  }, {
4515
4479
  md: true,
@@ -4518,6 +4482,9 @@ const defaultStackTheme = new ComponentTheme("div", "", {
4518
4482
  flexWrap: true,
4519
4483
  gap: true,
4520
4484
  padding: true,
4485
+ noBorder: true,
4486
+ noRing: true,
4487
+ sharp: true,
4521
4488
  }, STACK_CATEGORIES);
4522
4489
 
4523
4490
  const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
@@ -4758,5 +4725,5 @@ const List = (props) => {
4758
4725
  return jsx(ThemedComponent, { theme: theme.list, ...props });
4759
4726
  };
4760
4727
 
4761
- export { BADGE_CATEGORIES, BASE_COMPONENT_CATEGORIES, BUTTON_CATEGORIES, Badge, Button, CARD_CATEGORIES, CHIP_CATEGORIES, COL_CATEGORIES, COMPONENT, COMPONENT_PROPS_CATEGORY, CONTAINER_CATEGORIES, Card, Chip, Col, ComponentKeys, Container, DIVIDER_CATEGORIES, Divider, FLEX_CONTAINER_CATEGORIES, GRID_CATEGORIES, Grid3, Grid4, INTERACTIVE_CATEGORIES, LIST_CATEGORIES, Link, List, ListItem, PageTitle, ROW_CATEGORIES, Row, SECTION_CATEGORIES, STACK_CATEGORIES, Section, SectionTitle, Stack, TYPOGRAPHY_CATEGORIES, Text, ThemeProvider, Title, defaultTheme, useTheme };
4728
+ export { BADGE_CATEGORIES, BREAKPOINT, BUTTON_CATEGORIES, Badge, Button, CARD_CATEGORIES, CHIP_CATEGORIES, COL_CATEGORIES, COMPONENT, COMPONENT_PROPS_CATEGORY, CONTAINER_CATEGORIES, Card, Chip, Col, ComponentKeys, Container, DIVIDER_CATEGORIES, Divider, GRID_CATEGORIES, Grid3, Grid4, INTERACTIVE_CATEGORIES, LAYOUT_CORE, LAYOUT_FLEX, LAYOUT_FULL, LINK, LIST_CATEGORIES, Link, List, ListItem, PADDING, PageTitle, ROW_CATEGORIES, Row, SECTION_CATEGORIES, SHAPE, STACK_CATEGORIES, Section, SectionTitle, Stack, TYPOGRAPHY_CATEGORIES, TYPOGRAPHY_FULL, TYPOGRAPHY_STYLE, Text, ThemeProvider, Title, VARIANT, VISUAL_CORE, VISUAL_DECORATION, VISUAL_FULL, defaultTheme, useTheme };
4762
4729
  //# sourceMappingURL=index.esm.js.map