@vaneui/ui 0.2.1-alpha.20250813194307.2bb87da → 0.2.1-alpha.20250820170702.e0272da
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/components/ui/theme/common/ComponentTheme.d.ts +2 -2
- package/dist/components/ui/theme/defaults.d.ts +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +287 -200
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +287 -199
- 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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BaseTheme } from "./baseTheme";
|
|
3
|
-
import
|
|
3
|
+
import { ComponentCategoryKey } from "../../props";
|
|
4
4
|
import { HideTheme } from "../layout/hideTheme";
|
|
5
5
|
import { ItemsTheme } from "../layout/itemsTheme";
|
|
6
6
|
import { JustifyTheme } from "../layout/justifyTheme";
|
|
@@ -52,7 +52,7 @@ export declare class ComponentTheme<P extends ComponentProps, TTheme extends obj
|
|
|
52
52
|
readonly base: string;
|
|
53
53
|
readonly themes: TTheme;
|
|
54
54
|
defaults: Partial<P>;
|
|
55
|
-
extraClasses: Record<
|
|
55
|
+
extraClasses: Partial<Record<keyof P, string>>;
|
|
56
56
|
private readonly categories;
|
|
57
57
|
private readonly tagFunction?;
|
|
58
58
|
constructor(tag: React.ElementType, base: string, themes: DeepPartial<TTheme>, defaults: Partial<P> | undefined, categories: readonly ComponentCategoryKey[], tagFunction?: (props: P, defaults: Partial<P>) => React.ElementType);
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export { Section, Container, Col, Row, Stack, Grid2, Grid3, Grid4, Card } from "
|
|
|
10
10
|
export { Text, Title, Link, List, ListItem, SectionTitle, PageTitle } from "./components/ui/typography";
|
|
11
11
|
export { COMPONENT, ComponentKeys, ComponentCategories, type ComponentKey, } from "./components/ui/props/keys";
|
|
12
12
|
export { ThemeProvider, useTheme, defaultTheme, type ThemeProps, type ThemeDefaults, type ThemeExtraClasses, type ThemeProviderProps, type PartialTheme, } from './components/themeContext';
|
|
13
|
+
export { themeDefaults } from './components/ui/theme/defaults';
|
|
13
14
|
export * from "./components/ui/props/index";
|