@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.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: {
@@ -4179,7 +4122,21 @@ const titleTheme = createTypographyComponentTheme("h3", "text-balance w-fit", {
4179
4122
  // Text specific theme
4180
4123
  const textTheme = createTypographyComponentTheme("p", "p-0 m-0 w-fit", textSizeClasses);
4181
4124
  // Link specific theme
4182
- const linkTheme = createTypographyComponentTheme("a", "hover:underline w-fit", textSizeClasses, mergeDefaults(typographyThemeDefaults, { link: true }));
4125
+ const linkTheme = new ComponentTheme("a", "hover:underline w-fit", {
4126
+ size: {
4127
+ text: new SizeTheme(textSizeClasses, false),
4128
+ },
4129
+ appearance: {
4130
+ text: TextAppearanceTheme.createTheme({ base: textAppearanceClasses }),
4131
+ },
4132
+ typography: defaultTypographyTheme,
4133
+ layout: defaultLayoutTheme,
4134
+ }, {
4135
+ link: true,
4136
+ default: true,
4137
+ sans: true,
4138
+ normal: true,
4139
+ }, TYPOGRAPHY_CATEGORIES);
4183
4140
  // List specific theme
4184
4141
  const listItemTheme = new ComponentTheme("li", "", {
4185
4142
  size: {
@@ -4385,9 +4342,14 @@ const defaultRowTheme = new ComponentTheme("div", "", {
4385
4342
  ...defaultLayoutTheme,
4386
4343
  wrap: new WrapTheme(),
4387
4344
  direction: new DirectionTheme(),
4345
+ border: new BorderTheme(),
4346
+ ring: new RingTheme(),
4347
+ radius: new RadiusTheme(),
4388
4348
  },
4389
4349
  appearance: {
4390
4350
  background: new BgAppearanceTheme(),
4351
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4352
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4391
4353
  }
4392
4354
  }, {
4393
4355
  row: true,
@@ -4395,6 +4357,9 @@ const defaultRowTheme = new ComponentTheme("div", "", {
4395
4357
  flex: true,
4396
4358
  itemsCenter: true,
4397
4359
  gap: true,
4360
+ noBorder: true,
4361
+ noRing: true,
4362
+ sharp: true,
4398
4363
  }, ROW_CATEGORIES);
4399
4364
 
4400
4365
  const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
@@ -4470,15 +4435,23 @@ const defaultColTheme = new ComponentTheme("div", "", {
4470
4435
  ...defaultLayoutTheme,
4471
4436
  wrap: new WrapTheme(),
4472
4437
  direction: new DirectionTheme(),
4438
+ border: new BorderTheme(),
4439
+ ring: new RingTheme(),
4440
+ radius: new RadiusTheme(),
4473
4441
  },
4474
4442
  appearance: {
4475
4443
  background: new BgAppearanceTheme(),
4444
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4445
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4476
4446
  }
4477
4447
  }, {
4478
4448
  column: true,
4479
4449
  md: true,
4480
4450
  flex: true,
4481
4451
  gap: true,
4452
+ noBorder: true,
4453
+ noRing: true,
4454
+ sharp: true,
4482
4455
  }, COL_CATEGORIES);
4483
4456
 
4484
4457
  const defaultStackTheme = new ComponentTheme("div", "", {
@@ -4507,9 +4480,14 @@ const defaultStackTheme = new ComponentTheme("div", "", {
4507
4480
  ...defaultLayoutTheme,
4508
4481
  wrap: new WrapTheme(),
4509
4482
  direction: new DirectionTheme(),
4483
+ border: new BorderTheme(),
4484
+ ring: new RingTheme(),
4485
+ radius: new RadiusTheme(),
4510
4486
  },
4511
4487
  appearance: {
4512
4488
  background: new BgAppearanceTheme(),
4489
+ border: GenericVariantTheme.createUIElementBorderTheme(),
4490
+ ring: GenericVariantTheme.createUIElementRingTheme(),
4513
4491
  }
4514
4492
  }, {
4515
4493
  md: true,
@@ -4518,6 +4496,9 @@ const defaultStackTheme = new ComponentTheme("div", "", {
4518
4496
  flexWrap: true,
4519
4497
  gap: true,
4520
4498
  padding: true,
4499
+ noBorder: true,
4500
+ noRing: true,
4501
+ sharp: true,
4521
4502
  }, STACK_CATEGORIES);
4522
4503
 
4523
4504
  const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
@@ -4758,5 +4739,5 @@ const List = (props) => {
4758
4739
  return jsx(ThemedComponent, { theme: theme.list, ...props });
4759
4740
  };
4760
4741
 
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 };
4742
+ 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
4743
  //# sourceMappingURL=index.esm.js.map