@vaneui/ui 0.2.1-alpha.20250813194307.2bb87da → 0.2.1-alpha.20250820100624.167a145
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/README.md +125 -10
- package/dist/components/ui/theme/appearance/genericVariantTheme.d.ts +1 -0
- package/dist/components/ui/theme/appearance/shadowAppearanceTheme.d.ts +2 -0
- package/dist/index.esm.js +32 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/ui.css +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,11 +2,65 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/%40vaneui/ui)
|
|
4
4
|
|
|
5
|
-
VaneUI
|
|
5
|
+
VaneUI helps you build beautiful, consistent UIs faster by turning common design decisions into expressive, readable boolean props. Instead of memorizing property names and values, you compose intent: `primary`, `lg`, `outline`, `rounded`. The result is cleaner code, fewer decisions per component, and a smoother path from wireframe to production.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
## How VaneUI works
|
|
8
|
+
|
|
9
|
+
At its core, VaneUI maps boolean props to thoughtfully curated CSS classes. You write the JSX using booleans like this:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Button primary lg pill filled>
|
|
13
|
+
Get started
|
|
14
|
+
</Button>
|
|
15
|
+
```
|
|
16
|
+
The component resolves those booleans to semantic styles:
|
|
17
|
+
- `primary` → semantic color token
|
|
18
|
+
- `lg` → size scale for paddings, border radius, typography size
|
|
19
|
+
- `pill` → shape preset
|
|
20
|
+
- `filled` → variant preset
|
|
21
|
+
|
|
22
|
+
Tailwind classes and CSS variables power the final styles:
|
|
23
|
+
- Tailwind utilities for performance and composability
|
|
24
|
+
- CSS variables for theming and per-app overrides
|
|
25
|
+
- Each CSS class can be changed using ThemeProvider
|
|
26
|
+
- Each component has a customizable set of default values for boolean props
|
|
27
|
+
|
|
28
|
+
You can always mix in your own Tailwind classes via className to fine‑tune any edge case:
|
|
29
|
+
```tsx
|
|
30
|
+
<Button primary lg pill filled className="hover:opacity-80">
|
|
31
|
+
Get started
|
|
32
|
+
</Button>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Traditional approach vs VaneUI
|
|
36
|
+
|
|
37
|
+
Instead of writing verbose prop configurations, VaneUI uses intuitive boolean props that make your code cleaner and more readable:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// Traditional approach
|
|
41
|
+
<Button appearance="primary" size="lg" variant="filled" />
|
|
42
|
+
|
|
43
|
+
// VaneUI approach
|
|
44
|
+
<Button primary lg filled />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Prop combinations
|
|
48
|
+
|
|
49
|
+
Boolean props can be combined naturally to create the exact styling you need:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<Button primary lg pill shadow>
|
|
53
|
+
Large primary pill button with shadow
|
|
54
|
+
</Button>
|
|
55
|
+
|
|
56
|
+
<Card secondary padding border rounded>
|
|
57
|
+
Secondary card with padding, border and rounded corners
|
|
58
|
+
</Card>
|
|
59
|
+
|
|
60
|
+
<Stack column itemsCenter>
|
|
61
|
+
Vertical stack with gap and centered items
|
|
62
|
+
</Stack>
|
|
63
|
+
```
|
|
10
64
|
|
|
11
65
|
## Installation
|
|
12
66
|
|
|
@@ -53,6 +107,67 @@ export default function App() {
|
|
|
53
107
|
}
|
|
54
108
|
```
|
|
55
109
|
|
|
110
|
+
## Every Class is Customizable
|
|
111
|
+
|
|
112
|
+
Behind each boolean prop are carefully crafted CSS classes that you can completely override.
|
|
113
|
+
|
|
114
|
+
### CSS Variables
|
|
115
|
+
|
|
116
|
+
You can customize the VaneUI by overriding the CSS variables:
|
|
117
|
+
|
|
118
|
+
```css
|
|
119
|
+
:root {
|
|
120
|
+
--text-color-primary: #8b5cf6; /* Primary text color */
|
|
121
|
+
--ui-border-radius-md: 1rem; /* Medium UI radius */
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Tailwind Overrides
|
|
126
|
+
|
|
127
|
+
Each component can be changed by using the regular Tailwind CSS classes:
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<Button primary className="bg-purple-600 hover:bg-purple-700">
|
|
131
|
+
Custom Primary
|
|
132
|
+
</Button>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Theme Overrides
|
|
136
|
+
|
|
137
|
+
You can set up default values of all boolean props by providing `themeDefaults` in ThemeProvider:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
const defaults: ThemeDefaults = {
|
|
141
|
+
button: {
|
|
142
|
+
pill: true,
|
|
143
|
+
lg: true,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<ThemeProvider themeDefaults={defaults}>
|
|
149
|
+
<Button>This button is large and pill-shaped</Button>
|
|
150
|
+
</ThemeProvider>
|
|
151
|
+
);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
You can change default CSS classes of all components by providing `themeOverride` in ThemeProvider:
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
const overrideFunc = (theme: ThemeProps) => {
|
|
158
|
+
theme.button.themes.appearance.text.outline.default.base = 'text-blue-200';
|
|
159
|
+
theme.button.themes.appearance.text.outline.default.hover = 'hover:text-blue-700';
|
|
160
|
+
theme.button.themes.appearance.text.outline.default.active = 'active:text-blue-900';
|
|
161
|
+
return theme;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<ThemeProvider themeOverride={overrideFunc}>
|
|
166
|
+
<Button>This button has blue colors</Button>
|
|
167
|
+
</ThemeProvider>
|
|
168
|
+
);
|
|
169
|
+
```
|
|
170
|
+
|
|
56
171
|
## Theming
|
|
57
172
|
|
|
58
173
|
All components work out of the box with defaults. For deeper customization, wrap your app with ThemeProvider.
|
|
@@ -91,12 +206,12 @@ export function App() {
|
|
|
91
206
|
## Boolean Props Model
|
|
92
207
|
|
|
93
208
|
Each component exposes optional boolean props generated from category keys. Common examples:
|
|
94
|
-
- Size: xs
|
|
95
|
-
- Appearance: default
|
|
96
|
-
- Variant: filled
|
|
97
|
-
- Shape: pill
|
|
98
|
-
- Typography: sans
|
|
99
|
-
- Layout: gap
|
|
209
|
+
- Size: `xs`, `sm`, `md`, `lg`, `xl`
|
|
210
|
+
- Appearance: `default`, `primary`, `secondary`, `tertiary`, `accent`, `success`, `danger`, `warning`, `info`, `transparent`
|
|
211
|
+
- Variant: `filled`, `outline`
|
|
212
|
+
- Shape: `pill`, `rounded`, `sharp`
|
|
213
|
+
- Typography: `sans`, `serif`, `mono`, `thin`…`black`, `italic`/`notItalic`, `underline`/`lineThrough`/`overline`, `uppercase`/`lowercase`/`capitalize`
|
|
214
|
+
- Layout: `gap`/`noGap`, `inline`/`block`/`flex`/`grid`, `justify*`, `items*`, `padding`/`noPadding`, `shadow`/`noShadow`, `ring`/`noRing`
|
|
100
215
|
|
|
101
216
|
Only the categories relevant to a component are used. The theme maps these booleans to Tailwind utility classes.
|
|
102
217
|
|
|
@@ -10,6 +10,7 @@ export declare class GenericVariantTheme<T extends BaseTheme> extends BaseTheme
|
|
|
10
10
|
getClasses(extractedKeys: CategoryProps): string[];
|
|
11
11
|
static createUIElementTextTheme(): GenericVariantTheme<AppearanceTheme>;
|
|
12
12
|
static createUIElementShadowTheme(): GenericVariantTheme<ShadowAppearanceTheme>;
|
|
13
|
+
static createLayoutShadowTheme(): GenericVariantTheme<ShadowAppearanceTheme>;
|
|
13
14
|
static createBorderAppearanceTheme(): GenericVariantTheme<AppearanceTheme>;
|
|
14
15
|
static createUIElementBorderTheme(): GenericVariantTheme<AppearanceTheme>;
|
|
15
16
|
static createUIElementRingTheme(): GenericVariantTheme<AppearanceTheme>;
|
|
@@ -5,7 +5,9 @@ export interface ShadowAppearanceTheme extends Record<AppearanceKey, Record<Size
|
|
|
5
5
|
}
|
|
6
6
|
export declare class ShadowAppearanceTheme extends BaseTheme {
|
|
7
7
|
private static readonly defaultShadow;
|
|
8
|
+
private static readonly layoutShadow;
|
|
8
9
|
constructor(initial?: Partial<Record<AppearanceKey, Record<SizeKey, Record<ModeKey, string>> | null>>);
|
|
9
10
|
getClasses(extractedKeys: CategoryProps): string[];
|
|
10
11
|
static createTheme(src?: Partial<Record<AppearanceKey, Record<SizeKey, Record<ModeKey, string>> | null>>): ShadowAppearanceTheme;
|
|
12
|
+
static createLayoutTheme(src?: Partial<Record<AppearanceKey, Record<SizeKey, Record<ModeKey, string>> | null>>): ShadowAppearanceTheme;
|
|
11
13
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -3769,6 +3769,15 @@ class ShadowAppearanceTheme extends BaseTheme {
|
|
|
3769
3769
|
static createTheme(src = {}) {
|
|
3770
3770
|
return new ShadowAppearanceTheme(src);
|
|
3771
3771
|
}
|
|
3772
|
+
static createLayoutTheme(src = {}) {
|
|
3773
|
+
const theme = new ShadowAppearanceTheme(src);
|
|
3774
|
+
ComponentKeys.appearance.forEach((key) => {
|
|
3775
|
+
if (theme[key] === ShadowAppearanceTheme.defaultShadow) {
|
|
3776
|
+
theme[key] = ShadowAppearanceTheme.layoutShadow;
|
|
3777
|
+
}
|
|
3778
|
+
});
|
|
3779
|
+
return theme;
|
|
3780
|
+
}
|
|
3772
3781
|
}
|
|
3773
3782
|
ShadowAppearanceTheme.defaultShadow = {
|
|
3774
3783
|
xs: { base: "shadow-2xs", hover: "hover:shadow-xs", active: "" },
|
|
@@ -3777,6 +3786,13 @@ ShadowAppearanceTheme.defaultShadow = {
|
|
|
3777
3786
|
lg: { base: "shadow-md", hover: "hover:shadow-lg", active: "" },
|
|
3778
3787
|
xl: { base: "shadow-lg", hover: "hover:shadow-xl", active: "" }
|
|
3779
3788
|
};
|
|
3789
|
+
ShadowAppearanceTheme.layoutShadow = {
|
|
3790
|
+
xs: { base: "shadow-2xs", hover: "", active: "" },
|
|
3791
|
+
sm: { base: "shadow-xs", hover: "", active: "" },
|
|
3792
|
+
md: { base: "shadow-sm", hover: "", active: "" },
|
|
3793
|
+
lg: { base: "shadow-md", hover: "", active: "" },
|
|
3794
|
+
xl: { base: "shadow-lg", hover: "", active: "" }
|
|
3795
|
+
};
|
|
3780
3796
|
|
|
3781
3797
|
class GenericVariantTheme extends BaseTheme {
|
|
3782
3798
|
constructor(variantInstances) {
|
|
@@ -3811,6 +3827,12 @@ class GenericVariantTheme extends BaseTheme {
|
|
|
3811
3827
|
filled: ShadowAppearanceTheme.createTheme({})
|
|
3812
3828
|
});
|
|
3813
3829
|
}
|
|
3830
|
+
static createLayoutShadowTheme() {
|
|
3831
|
+
return new GenericVariantTheme({
|
|
3832
|
+
outline: ShadowAppearanceTheme.createLayoutTheme({}),
|
|
3833
|
+
filled: ShadowAppearanceTheme.createLayoutTheme({})
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3814
3836
|
static createBorderAppearanceTheme() {
|
|
3815
3837
|
return new GenericVariantTheme({
|
|
3816
3838
|
outline: AppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
@@ -4024,7 +4046,7 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4024
4046
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4025
4047
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4026
4048
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4027
|
-
shadow: GenericVariantTheme.
|
|
4049
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme()
|
|
4028
4050
|
},
|
|
4029
4051
|
layout: {
|
|
4030
4052
|
...defaultLayoutTheme,
|
|
@@ -4065,7 +4087,7 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4065
4087
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4066
4088
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4067
4089
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4068
|
-
shadow: GenericVariantTheme.
|
|
4090
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme()
|
|
4069
4091
|
},
|
|
4070
4092
|
layout: {
|
|
4071
4093
|
...defaultLayoutTheme,
|
|
@@ -4105,7 +4127,7 @@ const defaultCodeTheme = new ComponentTheme("code", "", {
|
|
|
4105
4127
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4106
4128
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4107
4129
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4108
|
-
shadow: GenericVariantTheme.
|
|
4130
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme()
|
|
4109
4131
|
},
|
|
4110
4132
|
layout: {
|
|
4111
4133
|
...defaultLayoutTheme,
|
|
@@ -4386,7 +4408,7 @@ const defaultCardTheme = new ComponentTheme("div", "", {
|
|
|
4386
4408
|
wrap: new WrapTheme(),
|
|
4387
4409
|
direction: new DirectionTheme(),
|
|
4388
4410
|
breakpoint: new BreakpointTheme(),
|
|
4389
|
-
shadow: ShadowAppearanceTheme.
|
|
4411
|
+
shadow: ShadowAppearanceTheme.createLayoutTheme(),
|
|
4390
4412
|
},
|
|
4391
4413
|
appearance: {
|
|
4392
4414
|
background: AppearanceTheme.createLayoutBgTheme(),
|
|
@@ -4426,7 +4448,7 @@ const defaultRowTheme = new ComponentTheme("div", "", {
|
|
|
4426
4448
|
background: AppearanceTheme.createLayoutBgTheme(),
|
|
4427
4449
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4428
4450
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4429
|
-
shadow: GenericVariantTheme.
|
|
4451
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme(),
|
|
4430
4452
|
}
|
|
4431
4453
|
}, {
|
|
4432
4454
|
row: true,
|
|
@@ -4482,7 +4504,7 @@ const defaultContainerTheme = new ComponentTheme("div", "flex-col mx-auto w-full
|
|
|
4482
4504
|
text: AppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4483
4505
|
border: AppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4484
4506
|
ring: AppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4485
|
-
shadow: GenericVariantTheme.
|
|
4507
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme(),
|
|
4486
4508
|
}
|
|
4487
4509
|
}, {
|
|
4488
4510
|
noRing: true,
|
|
@@ -4511,7 +4533,7 @@ const defaultColTheme = new ComponentTheme("div", "", {
|
|
|
4511
4533
|
background: AppearanceTheme.createLayoutBgTheme(),
|
|
4512
4534
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4513
4535
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4514
|
-
shadow: GenericVariantTheme.
|
|
4536
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme(),
|
|
4515
4537
|
}
|
|
4516
4538
|
}, {
|
|
4517
4539
|
column: true,
|
|
@@ -4544,7 +4566,7 @@ const defaultStackTheme = new ComponentTheme("div", "", {
|
|
|
4544
4566
|
background: AppearanceTheme.createLayoutBgTheme(),
|
|
4545
4567
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4546
4568
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4547
|
-
shadow: GenericVariantTheme.
|
|
4569
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme(),
|
|
4548
4570
|
}
|
|
4549
4571
|
}, {
|
|
4550
4572
|
md: true,
|
|
@@ -4584,7 +4606,7 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
|
|
|
4584
4606
|
text: AppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4585
4607
|
border: AppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4586
4608
|
ring: AppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4587
|
-
shadow: ShadowAppearanceTheme.
|
|
4609
|
+
shadow: ShadowAppearanceTheme.createLayoutTheme(),
|
|
4588
4610
|
},
|
|
4589
4611
|
layout: {
|
|
4590
4612
|
...defaultLayoutTheme,
|
|
@@ -4745,7 +4767,7 @@ const defaultImgTheme = new ComponentTheme("img", "object-cover", // Default to
|
|
|
4745
4767
|
appearance: {
|
|
4746
4768
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4747
4769
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4748
|
-
shadow: GenericVariantTheme.
|
|
4770
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme()
|
|
4749
4771
|
}
|
|
4750
4772
|
}, {
|
|
4751
4773
|
rounded: true,
|