zabi-components 5.0.22 → 6.0.0
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 +41 -44
- package/THEME.md +473 -0
- package/THEMING.md +248 -0
- package/dist/atoms/Card.svelte +40 -67
- package/dist/atoms/Card.svelte.d.ts +3 -3
- package/dist/atoms/CardHeader.svelte +10 -1
- package/dist/atoms/CardHeader.svelte.d.ts +3 -0
- package/dist/atoms/CodeBlock.svelte +1 -1
- package/dist/atoms/ColorPicker.svelte +1 -1
- package/dist/atoms/Input.svelte +2 -2
- package/dist/atoms/Progress.svelte +1 -1
- package/dist/atoms/Select.svelte +7 -5
- package/dist/atoms/Textarea.svelte +2 -2
- package/dist/atoms/Toast.svelte +1 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +1 -2
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/lib/showcase/components-catalog.d.ts +3 -0
- package/dist/lib/showcase/components-catalog.d.ts.map +1 -0
- package/dist/lib/showcase/components-showcase-constants.d.ts +63 -0
- package/dist/lib/showcase/components-showcase-constants.d.ts.map +1 -0
- package/dist/lib/showcase/docs-sidebar-helpers.d.ts +15 -0
- package/dist/lib/showcase/docs-sidebar-helpers.d.ts.map +1 -0
- package/dist/molecules/Alert.svelte +1 -1
- package/dist/molecules/ComponentDemo.svelte +53 -50
- package/dist/molecules/ContactForm.svelte +69 -64
- package/dist/molecules/Dropdown.svelte +2 -1
- package/dist/molecules/ImageUpload.svelte +1 -1
- package/dist/molecules/Modal.svelte +2 -2
- package/dist/molecules/NavigationMenuContent.svelte +1 -1
- package/dist/molecules/NavigationMenuLink.svelte +1 -1
- package/dist/molecules/NavigationMenuTrigger.svelte +1 -4
- package/dist/molecules/Section.svelte +12 -12
- package/dist/molecules/SlideUp.svelte +2 -2
- package/dist/molecules/Tabs.svelte +3 -3
- package/dist/organisms/Navbar.svelte +170 -53
- package/dist/organisms/Navbar.svelte.d.ts +31 -4
- package/dist/organisms/SidebarNavigation.svelte +209 -165
- package/dist/organisms/SidebarNavigation.svelte.d.ts +5 -0
- package/dist/organisms/{SidebarProjectPanel.svelte → SidebarPanel.svelte} +18 -17
- package/dist/organisms/{SidebarProjectPanel.svelte.d.ts → SidebarPanel.svelte.d.ts} +6 -6
- package/dist/organisms/index.d.ts +1 -2
- package/dist/organisms/index.js +1 -2
- package/dist/types/page.types.d.ts +32 -0
- package/dist/types/page.types.d.ts.map +1 -0
- package/dist/types/variants.ts +76 -0
- package/dist/zabi-components-colors.css +347 -324
- package/dist/zabi-components-theme-dark-only.css +159 -151
- package/dist/zabi-components-theme-dark.css +159 -151
- package/dist/zabi-components-theme-only.css +245 -230
- package/dist/zabi-components-theme.css +245 -230
- package/dist/zabi-components.css +437 -101
- package/docs/theme-imports.md +112 -0
- package/package.json +16 -6
- package/dist/organisms/Navigation.svelte +0 -119
- package/dist/organisms/Navigation.svelte.d.ts +0 -21
package/THEMING.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# Theming Guide
|
|
2
|
+
|
|
3
|
+
## 🎨 Single Source of Truth
|
|
4
|
+
|
|
5
|
+
**All theming is done in one file: `src/app.css`**
|
|
6
|
+
|
|
7
|
+
This file contains:
|
|
8
|
+
- All color scales (brand, citron, pine, iris, base)
|
|
9
|
+
- Semantic color tokens (primary, secondary, success, error, etc.)
|
|
10
|
+
- Action colors (for buttons and interactive elements)
|
|
11
|
+
- Dark mode overrides
|
|
12
|
+
- Typography settings
|
|
13
|
+
- Spacing, border radius, and z-index values
|
|
14
|
+
|
|
15
|
+
## 📍 Where to Make Changes
|
|
16
|
+
|
|
17
|
+
### Main Theme (Light Mode)
|
|
18
|
+
Edit the `@theme` block in `src/app.css`.
|
|
19
|
+
|
|
20
|
+
### Dark Mode Theme
|
|
21
|
+
Edit the `.dark` block in `src/app.css`.
|
|
22
|
+
|
|
23
|
+
## ⚠️ Important: Don't Edit These Files
|
|
24
|
+
|
|
25
|
+
### Generated Files (in `dist/` folder)
|
|
26
|
+
These files are **automatically generated** from `src/app.css` by the build script:
|
|
27
|
+
- ❌ `dist/zabi-components.css` - Full compiled CSS (generated)
|
|
28
|
+
- ❌ `dist/zabi-components-theme.css` - Theme with Tailwind import (generated)
|
|
29
|
+
- ❌ `dist/zabi-components-theme-only.css` - Theme only, no Tailwind (generated)
|
|
30
|
+
- ❌ `dist/zabi-components-theme-dark.css` - Dark mode theme (generated)
|
|
31
|
+
- ❌ `dist/zabi-components-theme-dark-only.css` - Dark mode theme only (generated)
|
|
32
|
+
- ❌ `dist/zabi-components-colors.css` - Standalone colors (generated from app.css)
|
|
33
|
+
|
|
34
|
+
**These files are overwritten every time you run `npm run build:css`**
|
|
35
|
+
|
|
36
|
+
### Example Files
|
|
37
|
+
- ❌ `examples/theme-extensions/02-custom-brand-colors.css` - Just an example, not your actual theme
|
|
38
|
+
- ❌ `examples/theme-extensions/03-custom-semantic-colors.css` - Just an example, not your actual theme
|
|
39
|
+
|
|
40
|
+
### Source Files (Edit These)
|
|
41
|
+
- ✅ `src/app.css` - **THIS IS THE ONLY FILE YOU NEED TO EDIT**
|
|
42
|
+
- ✅ Removed deprecated files (`src/styles/colors.css`, `src/styles/base.css`, `src/styles/simple.css`, `src/app-simple.css`)
|
|
43
|
+
|
|
44
|
+
## 📦 What Are the Dist Files For?
|
|
45
|
+
|
|
46
|
+
The `dist/` files are **for consumers** of your library who want to import the theme separately.
|
|
47
|
+
|
|
48
|
+
**Full import matrix, export paths, and examples:** [docs/theme-imports.md](./docs/theme-imports.md)
|
|
49
|
+
|
|
50
|
+
### For Library Developers (You)
|
|
51
|
+
- **Edit**: `src/app.css` only
|
|
52
|
+
- **Build**: Run `npm run build:css` to regenerate all dist files (or `npm run build:lib` before publish)
|
|
53
|
+
- **After token edits**: run `node scripts/verify-build.js` to confirm outputs (also runs as part of `build:lib`)
|
|
54
|
+
- **Base scale source**: use `tokens/base-scale.js`; run `npm run sync:tokens` (or `npm run build:css`) to render token blocks back into `src/app.css`
|
|
55
|
+
|
|
56
|
+
### For Library Consumers
|
|
57
|
+
|
|
58
|
+
Use **package exports** (preferred):
|
|
59
|
+
|
|
60
|
+
| Need | Import |
|
|
61
|
+
|------|--------|
|
|
62
|
+
| Tailwind + full `@theme` (app has no Tailwind yet) | `zabi-components/theme` |
|
|
63
|
+
| Tailwind already in app — merge `@theme` only | `zabi-components/theme-only` |
|
|
64
|
+
| Dark overrides (+ Tailwind import in file) | `zabi-components/theme-dark` |
|
|
65
|
+
| Dark overrides only (Tailwind already loaded) | `zabi-components/theme-dark-only` |
|
|
66
|
+
| CSS variables only, no Tailwind | `zabi-components/colors` |
|
|
67
|
+
| Full compiled CSS (utilities + everything) | `zabi-components/css` |
|
|
68
|
+
|
|
69
|
+
Examples:
|
|
70
|
+
|
|
71
|
+
```css
|
|
72
|
+
@import "zabi-components/theme-only";
|
|
73
|
+
@import "zabi-components/theme-dark-only";
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```css
|
|
77
|
+
@import "zabi-components/colors";
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```css
|
|
81
|
+
@import "zabi-components/css";
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Canonical recommendation for most apps remains:
|
|
85
|
+
|
|
86
|
+
```css
|
|
87
|
+
@import "tailwindcss";
|
|
88
|
+
@import "zabi-components/theme-only";
|
|
89
|
+
@import "zabi-components/theme-dark-only";
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Dark mapping rule reference:
|
|
93
|
+
- Physical ramp tokens are `--zabi-base-50 ... --zabi-base-950`.
|
|
94
|
+
- Semantic dark mapping is generated with `S -> 1000 - S` (for example `50 <-> 950`, `75 <-> 925`, `500` unchanged).
|
|
95
|
+
|
|
96
|
+
## 🎯 Common Customizations
|
|
97
|
+
|
|
98
|
+
### Change Brand Colors
|
|
99
|
+
|
|
100
|
+
```css
|
|
101
|
+
@theme {
|
|
102
|
+
/* Replace the brand color scale */
|
|
103
|
+
--color-brand-50: #f0f9ff;
|
|
104
|
+
--color-brand-100: #e0f2fe;
|
|
105
|
+
--color-brand-200: #bae6fd;
|
|
106
|
+
--color-brand-300: #7dd3fc;
|
|
107
|
+
--color-brand-400: #38bdf8;
|
|
108
|
+
--color-brand-500: #0ea5e9;
|
|
109
|
+
--color-brand-600: #0284c7;
|
|
110
|
+
--color-brand-700: #0369a1;
|
|
111
|
+
--color-brand-800: #075985;
|
|
112
|
+
--color-brand-900: #0c4a6e;
|
|
113
|
+
--color-brand-950: #082f49;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Change Primary Button Color
|
|
118
|
+
|
|
119
|
+
The primary button uses `--color-action-primary` which defaults to `brand-800`. To change it:
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
@theme {
|
|
123
|
+
/* Use a different brand shade */
|
|
124
|
+
--color-action-primary: theme(colors.brand.600);
|
|
125
|
+
|
|
126
|
+
/* Or use a completely custom color */
|
|
127
|
+
--color-action-primary: #your-color-here;
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Brand Scale Usage
|
|
132
|
+
|
|
133
|
+
The brand scale is used throughout the system:
|
|
134
|
+
|
|
135
|
+
- **brand-50 to brand-100**: Subtle backgrounds, hover states
|
|
136
|
+
- **brand-300 to brand-400**: Light accents, disabled states
|
|
137
|
+
- **brand-500**: Focus rings, medium emphasis
|
|
138
|
+
- **brand-600**: Primary color, links
|
|
139
|
+
- **brand-700**: Link hover, primary hover
|
|
140
|
+
- **brand-800**: **Primary buttons** (`action-primary`)
|
|
141
|
+
- **brand-900**: Primary button hover
|
|
142
|
+
- **brand-950**: Darkest brand shade
|
|
143
|
+
|
|
144
|
+
### Dark Mode
|
|
145
|
+
|
|
146
|
+
Dark mode automatically inverts the brand scale:
|
|
147
|
+
- `brand-50` becomes `brand-950` (darkest)
|
|
148
|
+
- `brand-950` becomes `brand-50` (lightest)
|
|
149
|
+
|
|
150
|
+
This happens automatically in the `.dark` block, so you typically don't need to override action colors in dark mode.
|
|
151
|
+
|
|
152
|
+
## 🌙 Dark Mode Action Colors
|
|
153
|
+
|
|
154
|
+
Dark mode action colors are handled in `src/app.css` in the `.dark` block (lines 393-404):
|
|
155
|
+
|
|
156
|
+
### Primary Actions
|
|
157
|
+
- **No explicit dark mode override needed** - Brand colors are automatically inverted
|
|
158
|
+
- `brand-800` (light mode) → `brand-200` (dark mode) automatically
|
|
159
|
+
|
|
160
|
+
### Secondary Actions
|
|
161
|
+
- **No explicit dark mode override needed** - Base colors are automatically inverted
|
|
162
|
+
- `base-600` (light mode) → `base-400` (dark mode) automatically
|
|
163
|
+
|
|
164
|
+
### Danger Actions
|
|
165
|
+
- **Has explicit dark mode overrides** (lines 399-404) because red colors aren't automatically inverted:
|
|
166
|
+
```css
|
|
167
|
+
.dark {
|
|
168
|
+
--color-action-danger: theme(colors.red.500);
|
|
169
|
+
--color-action-danger-hover: theme(colors.red.600);
|
|
170
|
+
--color-action-danger-active: theme(colors.red.700);
|
|
171
|
+
/* ... */
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### In Generated Files
|
|
176
|
+
|
|
177
|
+
- **`dist/zabi-components.css`**: Has dark mode at line 2178, danger actions at lines 2264-2269
|
|
178
|
+
- **`dist/zabi-components-theme-dark-only.css`**: Has dark mode action colors at lines 119-130 (only danger has explicit overrides)
|
|
179
|
+
- **`dist/zabi-components-theme-only.css`**: Only has light mode (@theme block), no dark mode
|
|
180
|
+
- **`dist/zabi-components-theme.css`**: Only has light mode (@theme block), no dark mode
|
|
181
|
+
|
|
182
|
+
## 📁 File Structure
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
src/
|
|
186
|
+
└── app.css ← 🎯 EDIT THIS FILE FOR ALL THEMING (single source of truth)
|
|
187
|
+
|
|
188
|
+
dist/ ← ⚠️ GENERATED FILES - DON'T EDIT
|
|
189
|
+
├── zabi-components.css (full CSS with dark mode)
|
|
190
|
+
├── zabi-components-theme.css (light mode only)
|
|
191
|
+
├── zabi-components-theme-only.css (light mode only)
|
|
192
|
+
├── zabi-components-theme-dark.css (dark mode only)
|
|
193
|
+
├── zabi-components-theme-dark-only.css (dark mode only)
|
|
194
|
+
└── zabi-components-colors.css (standalone, both modes)
|
|
195
|
+
|
|
196
|
+
examples/ ← ⚠️ EXAMPLES ONLY - DON'T EDIT
|
|
197
|
+
└── theme-extensions/
|
|
198
|
+
├── 02-custom-brand-colors.css
|
|
199
|
+
└── 03-custom-semantic-colors.css
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## ⚠️ Important Notes
|
|
203
|
+
|
|
204
|
+
1. **Never edit files in `dist/`** - These are automatically generated from `src/app.css` by `scripts/build-css.js`
|
|
205
|
+
2. **All theming is in `src/app.css`** - This is the single source of truth
|
|
206
|
+
3. **Always edit `src/app.css`** - This is your single source of truth
|
|
207
|
+
4. The `examples/` folder contains examples, not your actual theme
|
|
208
|
+
5. **Dist files are overwritten** every time you run `npm run build:css`
|
|
209
|
+
|
|
210
|
+
## 🔄 Build Process
|
|
211
|
+
|
|
212
|
+
When you edit `src/app.css`:
|
|
213
|
+
|
|
214
|
+
1. **Development**: Changes are automatically reflected (no build needed)
|
|
215
|
+
2. **Production**: Run `npm run build:css` to regenerate dist files
|
|
216
|
+
3. The build script (`scripts/build-css.js`) reads `src/app.css` and generates:
|
|
217
|
+
- `zabi-components.css` - Full compiled CSS with Tailwind processed (includes dark mode)
|
|
218
|
+
- `zabi-components-theme.css` - Theme block with Tailwind import (light mode only)
|
|
219
|
+
- `zabi-components-theme-only.css` - Theme block only (light mode only)
|
|
220
|
+
- `zabi-components-theme-dark.css` - Dark mode theme with Tailwind import
|
|
221
|
+
- `zabi-components-theme-dark-only.css` - Dark mode theme only
|
|
222
|
+
- `zabi-components-colors.css` - Standalone CSS custom properties (both light and dark)
|
|
223
|
+
|
|
224
|
+
## 🔄 After Making Changes
|
|
225
|
+
|
|
226
|
+
### For Development
|
|
227
|
+
After editing `src/app.css`, changes are automatically reflected in your app. No build needed!
|
|
228
|
+
|
|
229
|
+
### For Production/Library Build
|
|
230
|
+
If you're building the library for distribution:
|
|
231
|
+
```bash
|
|
232
|
+
npm run build:css # Regenerates all dist CSS files from src/app.css
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Optional perceptual midpoint generation (OKLCH)
|
|
236
|
+
|
|
237
|
+
Base midpoints are frozen hex by default (`fixed` mode).
|
|
238
|
+
For experimentation, you can generate midpoint steps in OKLCH interpolation and commit the resulting frozen values:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
ZABI_BASE_SCALE_MODE=oklch npm run sync:tokens
|
|
242
|
+
npm run build:css
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Notes:
|
|
246
|
+
- Primary anchors (`50, 100, 200 ... 950`) stay fixed.
|
|
247
|
+
- Midpoints (`75, 150, 250 ... 925`) are generated from adjacent anchors.
|
|
248
|
+
- Commit updated `src/app.css` and regenerated `dist/` outputs together.
|
package/dist/atoms/Card.svelte
CHANGED
|
@@ -1,70 +1,64 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
3
|
import type { CardVariant, SizeVariant } from "../../types/variants.js";
|
|
4
|
-
import CardHeader from "./CardHeader.svelte";
|
|
5
|
-
import CardContent from "./CardContent.svelte";
|
|
6
4
|
|
|
7
5
|
interface Props {
|
|
8
|
-
title?: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
image?: string;
|
|
11
6
|
onclick?: (event: MouseEvent) => void | Promise<void>;
|
|
12
7
|
size?: SizeVariant;
|
|
13
8
|
variant?: CardVariant;
|
|
14
9
|
fullWidth?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Required when card is interactive (has onclick) for accessibility */
|
|
12
|
+
ariaLabel?: string;
|
|
15
13
|
children?: Snippet;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
let {
|
|
19
|
-
title = "",
|
|
20
|
-
description = "",
|
|
21
|
-
image = "",
|
|
22
17
|
onclick,
|
|
23
18
|
size = "md",
|
|
24
19
|
variant = "default",
|
|
25
20
|
fullWidth = true,
|
|
21
|
+
className = "",
|
|
22
|
+
ariaLabel,
|
|
26
23
|
children,
|
|
27
24
|
...restProps
|
|
28
25
|
}: Props = $props();
|
|
29
26
|
|
|
30
|
-
const sizeClass = $derived(
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const variantClasses = $derived(() => {
|
|
35
|
-
switch (variant) {
|
|
36
|
-
case "elevated":
|
|
37
|
-
return "bg-card shadow-lg";
|
|
38
|
-
case "outlined":
|
|
39
|
-
return "bg-card border-2 border-base-200 shadow-none";
|
|
40
|
-
case "flat":
|
|
41
|
-
return "bg-card shadow-none border-none";
|
|
42
|
-
default:
|
|
43
|
-
return "bg-card shadow-sm";
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const useOldAPI = $derived(
|
|
48
|
-
title !== "" || description !== "" || image !== "",
|
|
27
|
+
const sizeClass = $derived(
|
|
28
|
+
size === "sm" ? "p-4" : size === "lg" ? "p-8" : "p-6",
|
|
49
29
|
);
|
|
50
30
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
: "cursor-pointer hover:shadow-lg hover:bg-card-hover"
|
|
61
|
-
: "";
|
|
62
|
-
const widthClasses = fullWidth ? "w-full" : "";
|
|
63
|
-
const minWidthClass = useOldAPI ? "min-w-64" : "";
|
|
64
|
-
const paddingClass = useOldAPI ? sizeClass() : "";
|
|
31
|
+
const variantClasses = $derived(
|
|
32
|
+
variant === "elevated"
|
|
33
|
+
? "bg-card shadow-lg"
|
|
34
|
+
: variant === "outlined"
|
|
35
|
+
? "bg-card border-2 border-base-200 shadow-none"
|
|
36
|
+
: variant === "flat"
|
|
37
|
+
? "bg-card shadow-none border-none"
|
|
38
|
+
: "bg-card shadow-sm",
|
|
39
|
+
);
|
|
65
40
|
|
|
66
|
-
|
|
67
|
-
|
|
41
|
+
const cardClasses = $derived(
|
|
42
|
+
[
|
|
43
|
+
"rounded-lg transition-all duration-200",
|
|
44
|
+
variantClasses,
|
|
45
|
+
onclick
|
|
46
|
+
? variant === "elevated"
|
|
47
|
+
? "cursor-pointer hover:shadow-xl hover:bg-card-hover"
|
|
48
|
+
: variant === "outlined"
|
|
49
|
+
? "cursor-pointer hover:border-brand-500 hover:bg-card-hover"
|
|
50
|
+
: variant === "flat"
|
|
51
|
+
? "cursor-pointer hover:bg-card-hover"
|
|
52
|
+
: "cursor-pointer hover:shadow-lg hover:bg-card-hover"
|
|
53
|
+
: "",
|
|
54
|
+
fullWidth ? "w-full" : "",
|
|
55
|
+
sizeClass,
|
|
56
|
+
className,
|
|
57
|
+
]
|
|
58
|
+
.filter(Boolean)
|
|
59
|
+
.join(" ")
|
|
60
|
+
.trim(),
|
|
61
|
+
);
|
|
68
62
|
|
|
69
63
|
function handleKeydown(event: KeyboardEvent) {
|
|
70
64
|
if (onclick && (event.key === "Enter" || event.key === " ")) {
|
|
@@ -74,37 +68,16 @@
|
|
|
74
68
|
}
|
|
75
69
|
|
|
76
70
|
const cardRole = $derived(onclick ? "button" : undefined);
|
|
77
|
-
const cardAriaLabel = $derived(onclick && title ? title : undefined);
|
|
78
71
|
</script>
|
|
79
72
|
|
|
80
73
|
<div
|
|
81
|
-
class={cardClasses
|
|
74
|
+
class={cardClasses}
|
|
82
75
|
{onclick}
|
|
83
76
|
role={cardRole}
|
|
84
77
|
{...onclick ? { tabindex: 0 } : {}}
|
|
85
|
-
aria-label={
|
|
78
|
+
aria-label={ariaLabel}
|
|
86
79
|
onkeydown={onclick ? handleKeydown : undefined}
|
|
87
80
|
{...restProps}
|
|
88
81
|
>
|
|
89
|
-
{
|
|
90
|
-
<!-- Old API: Using title/description/image props -->
|
|
91
|
-
{#if title || description}
|
|
92
|
-
<CardHeader {title} {description} />
|
|
93
|
-
{/if}
|
|
94
|
-
|
|
95
|
-
{#if image || children}
|
|
96
|
-
<CardContent {image} imageAlt={title}>
|
|
97
|
-
{#if children}
|
|
98
|
-
{@render children()}
|
|
99
|
-
{/if}
|
|
100
|
-
</CardContent>
|
|
101
|
-
{/if}
|
|
102
|
-
{:else}
|
|
103
|
-
<!-- New API: Using compound components (CardHeader, CardContent, CardFooter) -->
|
|
104
|
-
{#if children}
|
|
105
|
-
<CardContent className="pt-6">
|
|
106
|
-
{@render children()}
|
|
107
|
-
</CardContent>
|
|
108
|
-
{/if}
|
|
109
|
-
{/if}
|
|
82
|
+
{@render children?.()}
|
|
110
83
|
</div>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { CardVariant, SizeVariant } from "../../types/variants.js";
|
|
3
3
|
interface Props {
|
|
4
|
-
title?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
image?: string;
|
|
7
4
|
onclick?: (event: MouseEvent) => void | Promise<void>;
|
|
8
5
|
size?: SizeVariant;
|
|
9
6
|
variant?: CardVariant;
|
|
10
7
|
fullWidth?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Required when card is interactive (has onclick) for accessibility */
|
|
10
|
+
ariaLabel?: string;
|
|
11
11
|
children?: Snippet;
|
|
12
12
|
}
|
|
13
13
|
declare const Card: import("svelte").Component<Props, {}, "">;
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
title?: string;
|
|
6
|
+
/** Short secondary text displayed directly under the title */
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
/** Longer supporting text displayed below the subtitle */
|
|
6
9
|
description?: string;
|
|
7
10
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
8
11
|
className?: string;
|
|
@@ -11,6 +14,7 @@
|
|
|
11
14
|
|
|
12
15
|
let {
|
|
13
16
|
title = "",
|
|
17
|
+
subtitle = "",
|
|
14
18
|
description = "",
|
|
15
19
|
level = 3,
|
|
16
20
|
className = "",
|
|
@@ -24,7 +28,7 @@
|
|
|
24
28
|
});
|
|
25
29
|
</script>
|
|
26
30
|
|
|
27
|
-
<header class=
|
|
31
|
+
<header class={`flex flex-col space-y-1.5 pb-4 ${className}`.trim()} {...restProps}>
|
|
28
32
|
{#if title}
|
|
29
33
|
<svelte:element this={headingTag} class={headingClasses()}>
|
|
30
34
|
{title}
|
|
@@ -33,6 +37,11 @@
|
|
|
33
37
|
{#if children}
|
|
34
38
|
{@render children()}
|
|
35
39
|
{/if}
|
|
40
|
+
{#if subtitle}
|
|
41
|
+
<p class="text-sm text-description">
|
|
42
|
+
{subtitle}
|
|
43
|
+
</p>
|
|
44
|
+
{/if}
|
|
36
45
|
{#if description}
|
|
37
46
|
<p class="text-sm text-description">
|
|
38
47
|
{description}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
interface Props {
|
|
3
3
|
title?: string;
|
|
4
|
+
/** Short secondary text displayed directly under the title */
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
/** Longer supporting text displayed below the subtitle */
|
|
4
7
|
description?: string;
|
|
5
8
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
9
|
className?: string;
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
{#if showCopyButton}
|
|
45
45
|
<button
|
|
46
46
|
onclick={copyToClipboard}
|
|
47
|
-
class="flex items-center gap-2 px-3 py-1 text-xs text-base-300
|
|
47
|
+
class="flex cursor-pointer items-center gap-2 rounded px-3 py-1 text-xs text-base-300 transition-colors duration-200 hover:bg-base-700 hover:text-white"
|
|
48
48
|
aria-label="Copy code to clipboard"
|
|
49
49
|
>
|
|
50
50
|
{#if copied}
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
{#if isOpen}
|
|
294
294
|
<div
|
|
295
295
|
use:setPickerContainer
|
|
296
|
-
class="absolute top-12 right-0 z-50 bg-input rounded-2xl shadow-lg p-4 w-80"
|
|
296
|
+
class="absolute top-12 right-0 z-50 border border-input-border bg-input rounded-2xl shadow-lg p-4 w-80"
|
|
297
297
|
role="dialog"
|
|
298
298
|
aria-label="Color picker"
|
|
299
299
|
>
|
package/dist/atoms/Input.svelte
CHANGED
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
? "border-warning focus:border-warning focus:ring-warning"
|
|
69
69
|
: variant === "error"
|
|
70
70
|
? "border-error focus:border-error focus:ring-error"
|
|
71
|
-
: "border-
|
|
71
|
+
: "border-input-border focus:border-input-border focus:ring-2 focus:ring-brand-500";
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
const inputClasses = $derived(() => {
|
|
75
75
|
const sizeStyles = sizeClass();
|
|
76
76
|
const baseClasses =
|
|
77
|
-
"w-full min-w-48 bg-input hover:bg-input-hover focus:bg-input-focus disabled:bg-input-disabled rounded-lg transition-all duration-200 placeholder:text-description text-body focus:outline-none focus:ring-offset-0 disabled:opacity-50 disabled:cursor-not-allowed";
|
|
77
|
+
"w-full min-w-48 border bg-input hover:bg-input-hover focus:bg-input-focus disabled:bg-input-disabled rounded-lg transition-all duration-200 placeholder:text-description text-body focus:outline-none focus:ring-offset-0 disabled:opacity-50 disabled:cursor-not-allowed";
|
|
78
78
|
|
|
79
79
|
return `${baseClasses} ${sizeStyles.padding} ${sizeStyles.text} ${sizeStyles.leading} ${variantClass()} ${className}`.trim();
|
|
80
80
|
});
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
<div
|
|
41
41
|
id={progressId}
|
|
42
|
-
class="w-full bg-input rounded-full overflow-hidden {sizeClasses[size]}"
|
|
42
|
+
class="w-full border border-input-border bg-input rounded-full overflow-hidden {sizeClasses[size]}"
|
|
43
43
|
role="progressbar"
|
|
44
44
|
aria-valuenow={value}
|
|
45
45
|
aria-valuemin="0"
|
package/dist/atoms/Select.svelte
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Dropdown from "../molecules/Dropdown.svelte";
|
|
3
3
|
import Button from "./Button.svelte";
|
|
4
|
+
import Input from "./Input.svelte";
|
|
4
5
|
import {
|
|
5
6
|
ChevronDown,
|
|
6
7
|
CheckCircle,
|
|
@@ -105,13 +106,13 @@
|
|
|
105
106
|
? "border-warning focus:border-warning focus:ring-warning"
|
|
106
107
|
: variant === "error"
|
|
107
108
|
? "border-error focus:border-error focus:ring-error"
|
|
108
|
-
: "border-
|
|
109
|
+
: "border-input-border focus:ring-2 focus:ring-brand-500";
|
|
109
110
|
});
|
|
110
111
|
|
|
111
112
|
const triggerClasses = $derived(() => {
|
|
112
113
|
const sizeStyles = sizeClass();
|
|
113
114
|
const baseClasses =
|
|
114
|
-
"w-full
|
|
115
|
+
"flex w-full cursor-pointer items-center justify-between rounded-lg border bg-input text-body transition-all duration-200 hover:bg-input-hover focus:bg-input-focus focus:outline-none focus:ring-offset-0 disabled:cursor-not-allowed disabled:bg-input-disabled disabled:opacity-50";
|
|
115
116
|
|
|
116
117
|
return `${baseClasses} ${sizeStyles.padding} ${sizeStyles.text} ${sizeStyles.leading} ${variantClass()}`.trim();
|
|
117
118
|
});
|
|
@@ -277,9 +278,10 @@
|
|
|
277
278
|
<div class="px-2 pb-2 pt-1" style:width={menuWidth}>
|
|
278
279
|
{#if searchable && !isLoading}
|
|
279
280
|
<div class="px-1 pb-2">
|
|
280
|
-
<
|
|
281
|
+
<Input
|
|
281
282
|
type="text"
|
|
282
|
-
|
|
283
|
+
size="sm"
|
|
284
|
+
class="min-w-0"
|
|
283
285
|
placeholder={searchPlaceholder}
|
|
284
286
|
bind:value={searchQuery}
|
|
285
287
|
aria-label={searchPlaceholder}
|
|
@@ -328,7 +330,7 @@
|
|
|
328
330
|
{#if emptyStateActionLabel && onEmptyStateAction}
|
|
329
331
|
<button
|
|
330
332
|
type="button"
|
|
331
|
-
class="mt-3 inline-flex min-h-11 items-center rounded-lg bg-action-primary px-3 py-2 text-sm text-action-primary"
|
|
333
|
+
class="mt-3 inline-flex min-h-11 cursor-pointer items-center rounded-lg bg-action-primary px-3 py-2 text-sm text-action-primary"
|
|
332
334
|
onclick={onEmptyStateAction}
|
|
333
335
|
>
|
|
334
336
|
{emptyStateActionLabel}
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
? "border-warning focus:border-warning focus:ring-warning"
|
|
41
41
|
: variant === "error"
|
|
42
42
|
? "border-error focus:border-error focus:ring-error"
|
|
43
|
-
: "border-
|
|
43
|
+
: "border-input-border focus:ring-2 focus:ring-brand-500";
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
const textareaClasses = $derived(() => {
|
|
47
47
|
const baseClasses =
|
|
48
|
-
"w-full bg-input hover:bg-input-hover focus:bg-input-focus disabled:bg-input-disabled rounded-lg transition-all duration-200 placeholder:text-description text-body focus:outline-none focus:ring-offset-0 disabled:opacity-50 disabled:cursor-not-allowed resize-y px-4 py-2.5 text-base leading-6";
|
|
48
|
+
"w-full border bg-input hover:bg-input-hover focus:bg-input-focus disabled:bg-input-disabled rounded-lg transition-all duration-200 placeholder:text-description text-body focus:outline-none focus:ring-offset-0 disabled:opacity-50 disabled:cursor-not-allowed resize-y px-4 py-2.5 text-base leading-6";
|
|
49
49
|
|
|
50
50
|
return `${baseClasses} ${variantClass()}`.trim();
|
|
51
51
|
});
|
package/dist/atoms/Toast.svelte
CHANGED
|
@@ -20,9 +20,8 @@ export { default as Modal } from './molecules/Modal.svelte';
|
|
|
20
20
|
export { default as SlideUp } from './molecules/SlideUp.svelte';
|
|
21
21
|
export { default as Tabs } from './molecules/Tabs.svelte';
|
|
22
22
|
export { default as Navbar } from './organisms/Navbar.svelte';
|
|
23
|
-
export { default as Navigation } from './organisms/Navigation.svelte';
|
|
24
23
|
export { default as SidebarNavigation } from './organisms/SidebarNavigation.svelte';
|
|
25
|
-
export { default as
|
|
24
|
+
export { default as SidebarPanel } from './organisms/SidebarPanel.svelte';
|
|
26
25
|
export declare const createId: (prefix?: string) => string;
|
|
27
26
|
export declare const cn: (...classes: (string | undefined | null | false)[]) => string;
|
|
28
27
|
export declare const getFormData: (form: HTMLFormElement) => Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE1E,eAAO,MAAM,QAAQ,GAAI,SAAQ,MAAa,KAAG,MAA4B,CAAC;AAE9E,eAAO,MAAM,EAAE,GAAI,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,KAAG,MAClC,CAAC;AAEtC,eAAO,MAAM,WAAW,GAAI,MAAM,eAAe,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAGrE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,OAG7C,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,GAAG,KAAG,OAE7C,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,OAE5B,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,MAAM,GAAG,SAEtC,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,QAAQ,GAAG,SAE1C,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,OAAO,GAAG,SAE7C,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,SAAQ,MAAa,KAAG,MAKlD,CAAC;AAEF,OAAO,EACH,GAAG,EACH,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,WAAW,EACX,YAAY,EACZ,GAAG,EACH,SAAS,EACT,SAAS,EACT,QAAQ,EACX,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as Navbar } from './Navbar.svelte';
|
|
2
|
-
export { default as Navigation } from './Navigation.svelte';
|
|
3
2
|
export { default as SidebarNavigation } from './SidebarNavigation.svelte';
|
|
4
|
-
export { default as
|
|
3
|
+
export { default as SidebarPanel } from './SidebarPanel.svelte';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/organisms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/organisms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,9 +20,8 @@ export { default as Modal } from './molecules/Modal.svelte';
|
|
|
20
20
|
export { default as SlideUp } from './molecules/SlideUp.svelte';
|
|
21
21
|
export { default as Tabs } from './molecules/Tabs.svelte';
|
|
22
22
|
export { default as Navbar } from './organisms/Navbar.svelte';
|
|
23
|
-
export { default as Navigation } from './organisms/Navigation.svelte';
|
|
24
23
|
export { default as SidebarNavigation } from './organisms/SidebarNavigation.svelte';
|
|
25
|
-
export { default as
|
|
24
|
+
export { default as SidebarPanel } from './organisms/SidebarPanel.svelte';
|
|
26
25
|
export declare const createId: (prefix?: string) => string;
|
|
27
26
|
export declare const cn: (...classes: (string | undefined | null | false)[]) => string;
|
|
28
27
|
export declare const getFormData: (form: HTMLFormElement) => Record<string, any>;
|
package/dist/index.js
CHANGED
|
@@ -20,9 +20,8 @@ export { default as Modal } from './molecules/Modal.svelte';
|
|
|
20
20
|
export { default as SlideUp } from './molecules/SlideUp.svelte';
|
|
21
21
|
export { default as Tabs } from './molecules/Tabs.svelte';
|
|
22
22
|
export { default as Navbar } from './organisms/Navbar.svelte';
|
|
23
|
-
export { default as Navigation } from './organisms/Navigation.svelte';
|
|
24
23
|
export { default as SidebarNavigation } from './organisms/SidebarNavigation.svelte';
|
|
25
|
-
export { default as
|
|
24
|
+
export { default as SidebarPanel } from './organisms/SidebarPanel.svelte';
|
|
26
25
|
export const createId = (prefix = 'id') => generateId(prefix);
|
|
27
26
|
export const cn = (...classes) => classes.filter(Boolean).join(' ');
|
|
28
27
|
export const getFormData = (form) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-catalog.d.ts","sourceRoot":"","sources":["../../../src/lib/showcase/components-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAq1CjE,CAAC"}
|