@vaneui/ui 0.2.1-alpha.20250813170000.4050860 → 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/checkbox.d.ts +1 -0
- package/dist/components/ui/code.d.ts +1 -0
- package/dist/components/ui/divider.d.ts +1 -0
- package/dist/components/ui/img.d.ts +1 -0
- package/dist/components/ui/label.d.ts +1 -1
- package/dist/components/ui/props/keys.d.ts +8 -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/buttonTheme.d.ts +1 -1
- package/dist/index.esm.js +44 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +43 -31
- 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
|
|
|
@@ -16,6 +16,7 @@ export declare const Checkbox: React.ForwardRefExoticComponent<{
|
|
|
16
16
|
danger?: boolean | undefined;
|
|
17
17
|
warning?: boolean | undefined;
|
|
18
18
|
info?: boolean | undefined;
|
|
19
|
+
link?: boolean | undefined;
|
|
19
20
|
noBorder?: boolean | undefined;
|
|
20
21
|
inline?: boolean | undefined;
|
|
21
22
|
block?: boolean | undefined;
|
|
@@ -19,6 +19,7 @@ export declare const Code: React.ForwardRefExoticComponent<{
|
|
|
19
19
|
danger?: boolean | undefined;
|
|
20
20
|
warning?: boolean | undefined;
|
|
21
21
|
info?: boolean | undefined;
|
|
22
|
+
link?: boolean | undefined;
|
|
22
23
|
noBorder?: boolean | undefined;
|
|
23
24
|
inline?: boolean | undefined;
|
|
24
25
|
block?: boolean | undefined;
|
|
@@ -14,6 +14,7 @@ export declare const Divider: React.ForwardRefExoticComponent<{
|
|
|
14
14
|
danger?: boolean | undefined;
|
|
15
15
|
warning?: boolean | undefined;
|
|
16
16
|
info?: boolean | undefined;
|
|
17
|
+
link?: boolean | undefined;
|
|
17
18
|
inline?: boolean | undefined;
|
|
18
19
|
block?: boolean | undefined;
|
|
19
20
|
inlineBlock?: boolean | undefined;
|
|
@@ -16,6 +16,7 @@ export declare const Img: React.ForwardRefExoticComponent<{
|
|
|
16
16
|
danger?: boolean | undefined;
|
|
17
17
|
warning?: boolean | undefined;
|
|
18
18
|
info?: boolean | undefined;
|
|
19
|
+
link?: boolean | undefined;
|
|
19
20
|
noBorder?: boolean | undefined;
|
|
20
21
|
inline?: boolean | undefined;
|
|
21
22
|
block?: boolean | undefined;
|
|
@@ -6,7 +6,6 @@ export declare const Label: React.ForwardRefExoticComponent<{
|
|
|
6
6
|
transparent?: boolean | undefined;
|
|
7
7
|
gap?: boolean | undefined;
|
|
8
8
|
reverse?: boolean | undefined;
|
|
9
|
-
link?: boolean | undefined;
|
|
10
9
|
default?: boolean | undefined;
|
|
11
10
|
accent?: boolean | undefined;
|
|
12
11
|
primary?: boolean | undefined;
|
|
@@ -16,6 +15,7 @@ export declare const Label: React.ForwardRefExoticComponent<{
|
|
|
16
15
|
danger?: boolean | undefined;
|
|
17
16
|
warning?: boolean | undefined;
|
|
18
17
|
info?: boolean | undefined;
|
|
18
|
+
link?: boolean | undefined;
|
|
19
19
|
inline?: boolean | undefined;
|
|
20
20
|
block?: boolean | undefined;
|
|
21
21
|
inlineBlock?: boolean | undefined;
|
|
@@ -7,12 +7,11 @@ export declare const VISUAL_DECORATION: readonly ["border", "shadow", "ring"];
|
|
|
7
7
|
export declare const SHAPE: readonly ["shape"];
|
|
8
8
|
export declare const TYPOGRAPHY_STYLE: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign"];
|
|
9
9
|
export declare const LIST_STYLE: readonly ["listStyle"];
|
|
10
|
-
export declare const LINK: readonly ["link"];
|
|
11
10
|
export declare const VARIANT: readonly ["variant"];
|
|
12
|
-
export declare const COMPONENT_PROPS_CATEGORY: readonly ["appearance", "transparent", "wrap", "gap", "flexDirection", "reverse", "fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "listStyle", "size", "hide", "items", "justify", "position", "display", "overflow", "breakpoint", "
|
|
11
|
+
export declare const COMPONENT_PROPS_CATEGORY: readonly ["appearance", "transparent", "wrap", "gap", "flexDirection", "reverse", "fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "listStyle", "size", "hide", "items", "justify", "position", "display", "overflow", "breakpoint", "padding", "border", "shadow", "ring", "shape", "variant", "mode"];
|
|
13
12
|
export type ComponentCategoryKey = typeof COMPONENT_PROPS_CATEGORY[number];
|
|
14
13
|
export declare const ComponentKeys: {
|
|
15
|
-
readonly appearance: readonly ["default", "accent", "primary", "secondary", "tertiary", "success", "danger", "warning", "info"];
|
|
14
|
+
readonly appearance: readonly ["default", "accent", "primary", "secondary", "tertiary", "success", "danger", "warning", "info", "link"];
|
|
16
15
|
readonly border: readonly ["border", "noBorder"];
|
|
17
16
|
readonly breakpoint: readonly ["xsCol", "smCol", "mdCol", "lgCol", "xlCol"];
|
|
18
17
|
readonly display: readonly ["inline", "block", "inlineBlock", "flex", "inlineFlex", "grid", "inlineGrid", "contents", "table", "tableCell", "hidden"];
|
|
@@ -24,7 +23,6 @@ export declare const ComponentKeys: {
|
|
|
24
23
|
readonly hide: readonly ["xsHide", "smHide", "mdHide", "lgHide", "xlHide"];
|
|
25
24
|
readonly items: readonly ["itemsStart", "itemsEnd", "itemsCenter", "itemsBaseline", "itemsStretch"];
|
|
26
25
|
readonly justify: readonly ["justifyStart", "justifyEnd", "justifyCenter", "justifyBetween", "justifyAround", "justifyEvenly", "justifyStretch", "justifyBaseline"];
|
|
27
|
-
readonly link: readonly ["link"];
|
|
28
26
|
readonly listStyle: readonly ["disc", "decimal"];
|
|
29
27
|
readonly mode: readonly ["base", "hover", "active"];
|
|
30
28
|
readonly overflow: readonly ["overflowAuto", "overflowHidden", "overflowClip", "overflowVisible", "overflowScroll", "overflowXAuto", "overflowYAuto", "overflowXHidden", "overflowYHidden", "overflowXClip", "overflowYClip", "overflowXVisible", "overflowYVisible", "overflowXScroll", "overflowYScroll"];
|
|
@@ -52,7 +50,7 @@ export type GapKey = typeof ComponentKeys.gap[number];
|
|
|
52
50
|
export type VariantKey = typeof ComponentKeys.variant[number];
|
|
53
51
|
export type AppearanceKey = typeof ComponentKeys.appearance[number];
|
|
54
52
|
export type TransparentKey = typeof ComponentKeys.transparent[number];
|
|
55
|
-
export type LinkKey =
|
|
53
|
+
export type LinkKey = 'link';
|
|
56
54
|
export type ListStyleKey = typeof ComponentKeys.listStyle[number];
|
|
57
55
|
export type FontFamilyKey = typeof ComponentKeys.fontFamily[number];
|
|
58
56
|
export type FontWeightKey = typeof ComponentKeys.fontWeight[number];
|
|
@@ -71,24 +69,24 @@ export type DisplayKey = typeof ComponentKeys.display[number];
|
|
|
71
69
|
export type OverflowKey = typeof ComponentKeys.overflow[number];
|
|
72
70
|
export declare const LAYOUT_FULL: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse"];
|
|
73
71
|
export declare const VISUAL_FULL: readonly ["appearance", "transparent", "border", "shadow", "ring", "shape"];
|
|
74
|
-
export declare const TYPOGRAPHY_FULL: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign"
|
|
72
|
+
export declare const TYPOGRAPHY_FULL: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign"];
|
|
75
73
|
export declare const INTERACTIVE_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent", "border", "shadow", "ring", "shape", "fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "padding", "variant"];
|
|
76
74
|
export declare const BUTTON_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent", "border", "shadow", "ring", "shape", "fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "padding", "variant"];
|
|
77
75
|
export declare const BADGE_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent", "border", "shadow", "ring", "shape", "fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "padding", "variant"];
|
|
78
76
|
export declare const CHIP_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent", "border", "shadow", "ring", "shape", "fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "padding", "variant"];
|
|
79
77
|
export declare const CODE_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent", "border", "shadow", "ring", "shape", "fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "padding", "variant"];
|
|
80
|
-
export declare const TYPOGRAPHY_CATEGORIES: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "
|
|
81
|
-
export declare const LIST_CATEGORIES: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "
|
|
78
|
+
export declare const TYPOGRAPHY_CATEGORIES: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "size", "hide", "items", "justify", "position", "display", "overflow", "appearance", "transparent"];
|
|
79
|
+
export declare const LIST_CATEGORIES: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "listStyle", "size", "hide", "items", "justify", "position", "display", "overflow", "appearance", "transparent", "padding"];
|
|
82
80
|
export declare const GRID_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent"];
|
|
83
81
|
export declare const CONTAINER_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent", "border", "shadow", "ring", "shape"];
|
|
84
82
|
export declare const COL_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent", "border", "shadow", "ring", "shape"];
|
|
85
83
|
export declare const ROW_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "breakpoint", "appearance", "transparent", "border", "shadow", "ring", "shape"];
|
|
86
84
|
export declare const STACK_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "breakpoint", "padding", "appearance", "transparent", "border", "shadow", "ring", "shape"];
|
|
87
|
-
export declare const CARD_CATEGORIES: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "
|
|
85
|
+
export declare const CARD_CATEGORIES: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "breakpoint", "appearance", "transparent", "border", "shadow", "ring", "shape", "padding"];
|
|
88
86
|
export declare const DIVIDER_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "appearance", "transparent", "padding"];
|
|
89
87
|
export declare const SECTION_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent", "border", "shadow", "ring", "shape", "padding", "breakpoint"];
|
|
90
88
|
export declare const CHECKBOX_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "appearance", "transparent", "border", "shadow", "ring", "shape", "variant"];
|
|
91
|
-
export declare const LABEL_CATEGORIES: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "
|
|
89
|
+
export declare const LABEL_CATEGORIES: readonly ["fontWeight", "fontStyle", "textDecoration", "textTransform", "fontFamily", "textAlign", "size", "hide", "items", "justify", "position", "display", "overflow", "wrap", "gap", "flexDirection", "reverse", "appearance", "transparent"];
|
|
92
90
|
export declare const IMG_CATEGORIES: readonly ["size", "hide", "items", "justify", "position", "display", "overflow", "appearance", "transparent", "border", "shadow", "ring", "shape"];
|
|
93
91
|
export type CategoryProps = {
|
|
94
92
|
[K in ComponentCategoryKey]?: (typeof ComponentKeys)[K][number];
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import { BaseTypographyComponentTheme, ComponentTheme, DefaultLayoutThemes } from "./common/ComponentTheme";
|
|
2
|
-
import { ButtonProps } from "../props
|
|
2
|
+
import { ButtonProps } from "../props";
|
|
3
3
|
import { SizeTheme } from "./size/sizeTheme";
|
|
4
4
|
import { GapTheme } from "./size/gapTheme";
|
|
5
5
|
import { RadiusTheme } from "./layout/radiusTheme";
|
package/dist/index.esm.js
CHANGED
|
@@ -18,7 +18,6 @@ const VISUAL_DECORATION = ['border', 'shadow', 'ring'];
|
|
|
18
18
|
const SHAPE = ['shape'];
|
|
19
19
|
const TYPOGRAPHY_STYLE = ['fontWeight', 'fontStyle', 'textDecoration', 'textTransform', 'fontFamily', 'textAlign'];
|
|
20
20
|
const LIST_STYLE = ['listStyle'];
|
|
21
|
-
const LINK = ['link'];
|
|
22
21
|
const VARIANT = ['variant'];
|
|
23
22
|
const COMPONENT_PROPS_CATEGORY = [
|
|
24
23
|
...VISUAL_CORE,
|
|
@@ -27,7 +26,6 @@ const COMPONENT_PROPS_CATEGORY = [
|
|
|
27
26
|
...LIST_STYLE,
|
|
28
27
|
...LAYOUT_CORE,
|
|
29
28
|
...BREAKPOINT,
|
|
30
|
-
...LINK,
|
|
31
29
|
...PADDING,
|
|
32
30
|
...VISUAL_DECORATION,
|
|
33
31
|
...SHAPE,
|
|
@@ -35,7 +33,7 @@ const COMPONENT_PROPS_CATEGORY = [
|
|
|
35
33
|
'mode',
|
|
36
34
|
];
|
|
37
35
|
const ComponentKeys = {
|
|
38
|
-
appearance: ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info'],
|
|
36
|
+
appearance: ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info', 'link'],
|
|
39
37
|
border: ['border', 'noBorder'],
|
|
40
38
|
breakpoint: ['xsCol', 'smCol', 'mdCol', 'lgCol', 'xlCol'],
|
|
41
39
|
display: ['inline', 'block', 'inlineBlock', 'flex', 'inlineFlex', 'grid', 'inlineGrid', 'contents', 'table', 'tableCell', 'hidden'],
|
|
@@ -47,7 +45,6 @@ const ComponentKeys = {
|
|
|
47
45
|
hide: ['xsHide', 'smHide', 'mdHide', 'lgHide', 'xlHide'],
|
|
48
46
|
items: ['itemsStart', 'itemsEnd', 'itemsCenter', 'itemsBaseline', 'itemsStretch'],
|
|
49
47
|
justify: ['justifyStart', 'justifyEnd', 'justifyCenter', 'justifyBetween', 'justifyAround', 'justifyEvenly', 'justifyStretch', 'justifyBaseline'],
|
|
50
|
-
link: ['link'],
|
|
51
48
|
listStyle: ['disc', 'decimal'],
|
|
52
49
|
mode: ['base', 'hover', 'active'],
|
|
53
50
|
overflow: ['overflowAuto', 'overflowHidden', 'overflowClip', 'overflowVisible', 'overflowScroll', 'overflowXAuto', 'overflowYAuto', 'overflowXHidden', 'overflowYHidden', 'overflowXClip', 'overflowYClip', 'overflowXVisible', 'overflowYVisible', 'overflowXScroll', 'overflowYScroll'],
|
|
@@ -68,7 +65,7 @@ const ComponentKeys = {
|
|
|
68
65
|
// Composite categories built from core blocks
|
|
69
66
|
const LAYOUT_FULL = [...LAYOUT_CORE, ...LAYOUT_FLEX];
|
|
70
67
|
const VISUAL_FULL = [...VISUAL_CORE, ...VISUAL_DECORATION, ...SHAPE];
|
|
71
|
-
const TYPOGRAPHY_FULL = [...TYPOGRAPHY_STYLE
|
|
68
|
+
const TYPOGRAPHY_FULL = [...TYPOGRAPHY_STYLE];
|
|
72
69
|
const INTERACTIVE_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL, ...TYPOGRAPHY_STYLE, ...PADDING, ...VARIANT];
|
|
73
70
|
const BUTTON_CATEGORIES = INTERACTIVE_CATEGORIES;
|
|
74
71
|
const BADGE_CATEGORIES = INTERACTIVE_CATEGORIES;
|
|
@@ -3665,26 +3662,21 @@ class AppearanceTheme extends BaseTheme {
|
|
|
3665
3662
|
this.linkClassSource = options === null || options === void 0 ? void 0 : options.linkClassSource;
|
|
3666
3663
|
}
|
|
3667
3664
|
getClasses(extractedKeys) {
|
|
3668
|
-
var _a
|
|
3669
|
-
// Check for specific transparent
|
|
3665
|
+
var _a;
|
|
3666
|
+
// Check for specific transparent styles first
|
|
3670
3667
|
if (extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.transparent) {
|
|
3671
3668
|
const transparentClass = ((_a = this.transparentClassSource) === null || _a === void 0 ? void 0 : _a[extractedKeys.transparent]) || '';
|
|
3672
3669
|
return [transparentClass];
|
|
3673
3670
|
}
|
|
3674
|
-
|
|
3675
|
-
const linkClass = ((_b = this.linkClassSource) === null || _b === void 0 ? void 0 : _b[extractedKeys.link]) || '';
|
|
3676
|
-
return [linkClass];
|
|
3677
|
-
}
|
|
3678
|
-
// Use regular appearance
|
|
3671
|
+
// Use appearance (now includes link as an appearance option)
|
|
3679
3672
|
const pickedAppearanceKey = extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.appearance;
|
|
3680
|
-
if (
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
return [];
|
|
3673
|
+
if (pickedAppearanceKey) {
|
|
3674
|
+
const modes = this[pickedAppearanceKey];
|
|
3675
|
+
if (modes) {
|
|
3676
|
+
return ComponentKeys.mode.map(mode => modes[mode] || '');
|
|
3677
|
+
}
|
|
3686
3678
|
}
|
|
3687
|
-
return
|
|
3679
|
+
return [];
|
|
3688
3680
|
}
|
|
3689
3681
|
static createTheme(src = {}, options) {
|
|
3690
3682
|
const finalConfig = Object.fromEntries(ComponentKeys.appearance.map(textKey => [
|
|
@@ -3777,6 +3769,15 @@ class ShadowAppearanceTheme extends BaseTheme {
|
|
|
3777
3769
|
static createTheme(src = {}) {
|
|
3778
3770
|
return new ShadowAppearanceTheme(src);
|
|
3779
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
|
+
}
|
|
3780
3781
|
}
|
|
3781
3782
|
ShadowAppearanceTheme.defaultShadow = {
|
|
3782
3783
|
xs: { base: "shadow-2xs", hover: "hover:shadow-xs", active: "" },
|
|
@@ -3785,6 +3786,13 @@ ShadowAppearanceTheme.defaultShadow = {
|
|
|
3785
3786
|
lg: { base: "shadow-md", hover: "hover:shadow-lg", active: "" },
|
|
3786
3787
|
xl: { base: "shadow-lg", hover: "hover:shadow-xl", active: "" }
|
|
3787
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
|
+
};
|
|
3788
3796
|
|
|
3789
3797
|
class GenericVariantTheme extends BaseTheme {
|
|
3790
3798
|
constructor(variantInstances) {
|
|
@@ -3819,6 +3827,12 @@ class GenericVariantTheme extends BaseTheme {
|
|
|
3819
3827
|
filled: ShadowAppearanceTheme.createTheme({})
|
|
3820
3828
|
});
|
|
3821
3829
|
}
|
|
3830
|
+
static createLayoutShadowTheme() {
|
|
3831
|
+
return new GenericVariantTheme({
|
|
3832
|
+
outline: ShadowAppearanceTheme.createLayoutTheme({}),
|
|
3833
|
+
filled: ShadowAppearanceTheme.createLayoutTheme({})
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3822
3836
|
static createBorderAppearanceTheme() {
|
|
3823
3837
|
return new GenericVariantTheme({
|
|
3824
3838
|
outline: AppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
@@ -4032,7 +4046,7 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4032
4046
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4033
4047
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4034
4048
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4035
|
-
shadow: GenericVariantTheme.
|
|
4049
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme()
|
|
4036
4050
|
},
|
|
4037
4051
|
layout: {
|
|
4038
4052
|
...defaultLayoutTheme,
|
|
@@ -4073,7 +4087,7 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
|
|
|
4073
4087
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4074
4088
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4075
4089
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4076
|
-
shadow: GenericVariantTheme.
|
|
4090
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme()
|
|
4077
4091
|
},
|
|
4078
4092
|
layout: {
|
|
4079
4093
|
...defaultLayoutTheme,
|
|
@@ -4113,7 +4127,7 @@ const defaultCodeTheme = new ComponentTheme("code", "", {
|
|
|
4113
4127
|
text: GenericVariantTheme.createUIElementTextTheme(),
|
|
4114
4128
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4115
4129
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4116
|
-
shadow: GenericVariantTheme.
|
|
4130
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme()
|
|
4117
4131
|
},
|
|
4118
4132
|
layout: {
|
|
4119
4133
|
...defaultLayoutTheme,
|
|
@@ -4304,7 +4318,6 @@ const linkTheme = new ComponentTheme("a", "hover:underline w-fit cursor-pointer"
|
|
|
4304
4318
|
layout: defaultLayoutTheme,
|
|
4305
4319
|
}, {
|
|
4306
4320
|
link: true,
|
|
4307
|
-
default: true,
|
|
4308
4321
|
sans: true,
|
|
4309
4322
|
}, TYPOGRAPHY_CATEGORIES);
|
|
4310
4323
|
// List specific theme
|
|
@@ -4395,7 +4408,7 @@ const defaultCardTheme = new ComponentTheme("div", "", {
|
|
|
4395
4408
|
wrap: new WrapTheme(),
|
|
4396
4409
|
direction: new DirectionTheme(),
|
|
4397
4410
|
breakpoint: new BreakpointTheme(),
|
|
4398
|
-
shadow: ShadowAppearanceTheme.
|
|
4411
|
+
shadow: ShadowAppearanceTheme.createLayoutTheme(),
|
|
4399
4412
|
},
|
|
4400
4413
|
appearance: {
|
|
4401
4414
|
background: AppearanceTheme.createLayoutBgTheme(),
|
|
@@ -4435,7 +4448,7 @@ const defaultRowTheme = new ComponentTheme("div", "", {
|
|
|
4435
4448
|
background: AppearanceTheme.createLayoutBgTheme(),
|
|
4436
4449
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4437
4450
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4438
|
-
shadow: GenericVariantTheme.
|
|
4451
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme(),
|
|
4439
4452
|
}
|
|
4440
4453
|
}, {
|
|
4441
4454
|
row: true,
|
|
@@ -4491,7 +4504,7 @@ const defaultContainerTheme = new ComponentTheme("div", "flex-col mx-auto w-full
|
|
|
4491
4504
|
text: AppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4492
4505
|
border: AppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4493
4506
|
ring: AppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4494
|
-
shadow: GenericVariantTheme.
|
|
4507
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme(),
|
|
4495
4508
|
}
|
|
4496
4509
|
}, {
|
|
4497
4510
|
noRing: true,
|
|
@@ -4520,7 +4533,7 @@ const defaultColTheme = new ComponentTheme("div", "", {
|
|
|
4520
4533
|
background: AppearanceTheme.createLayoutBgTheme(),
|
|
4521
4534
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4522
4535
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4523
|
-
shadow: GenericVariantTheme.
|
|
4536
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme(),
|
|
4524
4537
|
}
|
|
4525
4538
|
}, {
|
|
4526
4539
|
column: true,
|
|
@@ -4553,7 +4566,7 @@ const defaultStackTheme = new ComponentTheme("div", "", {
|
|
|
4553
4566
|
background: AppearanceTheme.createLayoutBgTheme(),
|
|
4554
4567
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4555
4568
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4556
|
-
shadow: GenericVariantTheme.
|
|
4569
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme(),
|
|
4557
4570
|
}
|
|
4558
4571
|
}, {
|
|
4559
4572
|
md: true,
|
|
@@ -4593,7 +4606,7 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex-col", {
|
|
|
4593
4606
|
text: AppearanceTheme.createTheme({ base: textAppearanceClasses }),
|
|
4594
4607
|
border: AppearanceTheme.createTheme({ base: borderAppearanceClasses }),
|
|
4595
4608
|
ring: AppearanceTheme.createTheme({ base: ringAppearanceClasses }),
|
|
4596
|
-
shadow: ShadowAppearanceTheme.
|
|
4609
|
+
shadow: ShadowAppearanceTheme.createLayoutTheme(),
|
|
4597
4610
|
},
|
|
4598
4611
|
layout: {
|
|
4599
4612
|
...defaultLayoutTheme,
|
|
@@ -4754,7 +4767,7 @@ const defaultImgTheme = new ComponentTheme("img", "object-cover", // Default to
|
|
|
4754
4767
|
appearance: {
|
|
4755
4768
|
border: GenericVariantTheme.createUIElementBorderTheme(),
|
|
4756
4769
|
ring: GenericVariantTheme.createUIElementRingTheme(),
|
|
4757
|
-
shadow: GenericVariantTheme.
|
|
4770
|
+
shadow: GenericVariantTheme.createLayoutShadowTheme()
|
|
4758
4771
|
}
|
|
4759
4772
|
}, {
|
|
4760
4773
|
rounded: true,
|
|
@@ -5030,5 +5043,5 @@ const List = forwardRef(function List(props, ref) {
|
|
|
5030
5043
|
return jsx(ThemedComponent, { ref: ref, theme: theme.list, ...props });
|
|
5031
5044
|
});
|
|
5032
5045
|
|
|
5033
|
-
export { BADGE_CATEGORIES, BREAKPOINT, BUTTON_CATEGORIES, Badge, Button, CARD_CATEGORIES, CHECKBOX_CATEGORIES, CHIP_CATEGORIES, CODE_CATEGORIES, COL_CATEGORIES, COMPONENT, COMPONENT_PROPS_CATEGORY, CONTAINER_CATEGORIES, Card, Checkbox, Chip, Code, Col, ComponentCategories, ComponentKeys, Container, DIVIDER_CATEGORIES, Divider, GRID_CATEGORIES, Grid2, Grid3, Grid4, IMG_CATEGORIES, INTERACTIVE_CATEGORIES, Img, LABEL_CATEGORIES, LAYOUT_CORE, LAYOUT_FLEX, LAYOUT_FULL,
|
|
5046
|
+
export { BADGE_CATEGORIES, BREAKPOINT, BUTTON_CATEGORIES, Badge, Button, CARD_CATEGORIES, CHECKBOX_CATEGORIES, CHIP_CATEGORIES, CODE_CATEGORIES, COL_CATEGORIES, COMPONENT, COMPONENT_PROPS_CATEGORY, CONTAINER_CATEGORIES, Card, Checkbox, Chip, Code, Col, ComponentCategories, ComponentKeys, Container, DIVIDER_CATEGORIES, Divider, GRID_CATEGORIES, Grid2, Grid3, Grid4, IMG_CATEGORIES, INTERACTIVE_CATEGORIES, Img, LABEL_CATEGORIES, LAYOUT_CORE, LAYOUT_FLEX, LAYOUT_FULL, LIST_CATEGORIES, LIST_STYLE, Label, 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 };
|
|
5034
5047
|
//# sourceMappingURL=index.esm.js.map
|