@valiify/dashboard-ui 0.1.0-alpha.1 → 0.1.0-alpha.2
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/CLAUDE.md +3578 -0
- package/COMPONENTS.md +1675 -0
- package/GETTING_STARTED.md +420 -0
- package/QUICK_REFERENCE.md +161 -0
- package/README.md +302 -283
- package/TROUBLESHOOTING.md +410 -0
- package/examples/README.md +156 -0
- package/examples/basic/index.html +155 -0
- package/examples/postcss-starter/README.md +45 -0
- package/examples/postcss-starter/index.html +54 -0
- package/examples/postcss-starter/package.json +19 -0
- package/examples/postcss-starter/postcss.config.js +5 -0
- package/examples/postcss-starter/src/styles.css +17 -0
- package/examples/vite-starter/README.md +123 -0
- package/examples/vite-starter/index.html +12 -0
- package/examples/vite-starter/package.json +19 -0
- package/examples/vite-starter/src/main.js +188 -0
- package/examples/vite-starter/src/styles.css +22 -0
- package/examples/vite-starter/vite.config.js +6 -0
- package/package.json +8 -2
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
# Getting Started with @valiify/dashboard-ui
|
|
2
|
+
|
|
3
|
+
Complete installation guide for all build setups.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Node.js 18+ and npm
|
|
8
|
+
- A project (or create one with `npm init`)
|
|
9
|
+
- **A bundler or build tool** - This package requires one of: Vite, webpack, PostCSS, or the Tailwind CLI
|
|
10
|
+
|
|
11
|
+
> **⚠️ IMPORTANT**: Tailwind CSS v4 requires an integration package to function. Installing only `tailwindcss` and `@valiify/dashboard-ui` will fail silently with no styles applied. You **must** install one of the integration packages listed below.
|
|
12
|
+
|
|
13
|
+
## Quick Start (Vite - Recommended)
|
|
14
|
+
|
|
15
|
+
The fastest way to get started. Use our verified starter:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Copy the starter template
|
|
19
|
+
npx degit BubbaCoop/Valiify-dashboard-ui/examples/vite-starter my-app
|
|
20
|
+
cd my-app
|
|
21
|
+
|
|
22
|
+
# Install dependencies
|
|
23
|
+
npm install
|
|
24
|
+
|
|
25
|
+
# Start dev server
|
|
26
|
+
npm run dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
That's it. Open [http://localhost:5173](http://localhost:5173) to see a working example.
|
|
30
|
+
|
|
31
|
+
## Manual Installation
|
|
32
|
+
|
|
33
|
+
### Step 1: Install Packages
|
|
34
|
+
|
|
35
|
+
**For Vite:**
|
|
36
|
+
```bash
|
|
37
|
+
npm install @valiify/dashboard-ui tailwindcss @tailwindcss/vite
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**For webpack:**
|
|
41
|
+
```bash
|
|
42
|
+
npm install @valiify/dashboard-ui tailwindcss @tailwindcss/webpack
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**For PostCSS (including Next.js):**
|
|
46
|
+
```bash
|
|
47
|
+
npm install @valiify/dashboard-ui tailwindcss @tailwindcss/postcss
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**For Tailwind standalone CLI:**
|
|
51
|
+
```bash
|
|
52
|
+
npm install @valiify/dashboard-ui tailwindcss @tailwindcss/cli
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> **Why three packages?** `tailwindcss` alone doesn't process CSS in v4. You need **both** `tailwindcss` and one of the `@tailwindcss/*` integration packages for anything to work.
|
|
56
|
+
|
|
57
|
+
### Step 2: Configure Your Build Tool
|
|
58
|
+
|
|
59
|
+
Choose your build tool:
|
|
60
|
+
|
|
61
|
+
<details>
|
|
62
|
+
<summary><strong>Vite</strong></summary>
|
|
63
|
+
|
|
64
|
+
Create or update `vite.config.js`:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { defineConfig } from "vite";
|
|
68
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
69
|
+
|
|
70
|
+
export default defineConfig({
|
|
71
|
+
plugins: [tailwindcss()],
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
</details>
|
|
76
|
+
|
|
77
|
+
<details>
|
|
78
|
+
<summary><strong>webpack</strong></summary>
|
|
79
|
+
|
|
80
|
+
Add to your webpack config:
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import tailwindcss from "@tailwindcss/webpack";
|
|
84
|
+
|
|
85
|
+
export default {
|
|
86
|
+
plugins: [tailwindcss()],
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
</details>
|
|
91
|
+
|
|
92
|
+
<details>
|
|
93
|
+
<summary><strong>PostCSS</strong></summary>
|
|
94
|
+
|
|
95
|
+
Create or update `postcss.config.js`:
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
export default {
|
|
99
|
+
plugins: {
|
|
100
|
+
"@tailwindcss/postcss": {},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
</details>
|
|
106
|
+
|
|
107
|
+
<details>
|
|
108
|
+
<summary><strong>Tailwind CLI</strong></summary>
|
|
109
|
+
|
|
110
|
+
No config file needed. Build with:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx @tailwindcss/cli -i src/styles.css -o dist/styles.css --watch
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
</details>
|
|
117
|
+
|
|
118
|
+
### Step 3: Create Your Stylesheet
|
|
119
|
+
|
|
120
|
+
Create a CSS file (e.g., `src/styles.css`):
|
|
121
|
+
|
|
122
|
+
```css
|
|
123
|
+
/* Optional: Load fonts (or self-host for better performance) */
|
|
124
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");
|
|
125
|
+
|
|
126
|
+
/* Required: Tailwind CSS */
|
|
127
|
+
@import "tailwindcss";
|
|
128
|
+
|
|
129
|
+
/* Required: Valiify Dashboard UI */
|
|
130
|
+
@import "@valiify/dashboard-ui/source";
|
|
131
|
+
|
|
132
|
+
/* Your custom styles */
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
> **⚠️ CRITICAL**: Import the library from CSS, never from JavaScript. See [Common Mistakes](#common-mistakes) below.
|
|
136
|
+
|
|
137
|
+
### Step 4: Import Your Stylesheet
|
|
138
|
+
|
|
139
|
+
In your JavaScript entry point:
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
// main.js or index.js
|
|
143
|
+
import "./styles.css"; // ✅ Import YOUR stylesheet
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**NOT like this:**
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
import "@valiify/dashboard-ui/source"; // ❌ NEVER import the library directly
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Step 5: Load the Icon Sprite
|
|
153
|
+
|
|
154
|
+
Add this to your JavaScript entry:
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
import spriteUrl from "@valiify/dashboard-ui/icons/sprite.svg?url";
|
|
158
|
+
|
|
159
|
+
fetch(spriteUrl)
|
|
160
|
+
.then((r) => r.text())
|
|
161
|
+
.then((svg) => {
|
|
162
|
+
const host = document.createElement("div");
|
|
163
|
+
host.style.display = "none";
|
|
164
|
+
host.innerHTML = svg;
|
|
165
|
+
document.body.prepend(host);
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
> **Note**: The `?url` suffix is Vite-specific. For other bundlers, you may need to copy the file or use an equivalent loader.
|
|
170
|
+
|
|
171
|
+
### Step 6: Use Components
|
|
172
|
+
|
|
173
|
+
```html
|
|
174
|
+
<button class="btn btn-primary">Click me</button>
|
|
175
|
+
|
|
176
|
+
<div class="input-container">
|
|
177
|
+
<div class="input-field">
|
|
178
|
+
<input type="text" class="input" placeholder="Enter text..." />
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<span class="chip chip-success">
|
|
183
|
+
<span class="chip-dot"></span>
|
|
184
|
+
<span>Approved</span>
|
|
185
|
+
</span>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
See [COMPONENTS.md](COMPONENTS.md) for complete markup examples of every component.
|
|
189
|
+
|
|
190
|
+
## Common Mistakes
|
|
191
|
+
|
|
192
|
+
### ❌ Importing from JavaScript
|
|
193
|
+
|
|
194
|
+
**This breaks silently:**
|
|
195
|
+
|
|
196
|
+
```js
|
|
197
|
+
// main.js
|
|
198
|
+
import "@valiify/dashboard-ui/source";
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Your dev server returns HTTP 200, the page loads, and all library styles are missing with no visible error.
|
|
202
|
+
|
|
203
|
+
**Why it fails:** Your bundler hands our stylesheet to PostCSS as its own file with no Tailwind context. Every `@apply` becomes unresolvable.
|
|
204
|
+
|
|
205
|
+
**Fix:** Import from CSS instead:
|
|
206
|
+
|
|
207
|
+
```css
|
|
208
|
+
/* styles.css */
|
|
209
|
+
@import "tailwindcss";
|
|
210
|
+
@import "@valiify/dashboard-ui/source";
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```js
|
|
214
|
+
// main.js
|
|
215
|
+
import "./styles.css";
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### ❌ Missing Integration Package
|
|
219
|
+
|
|
220
|
+
**This also breaks silently:**
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm install tailwindcss @valiify/dashboard-ui
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Without `@tailwindcss/vite` (or postcss/webpack), `@import "tailwindcss"` does nothing. No error, no styles.
|
|
227
|
+
|
|
228
|
+
**Fix:** Install the integration package for your build tool (see Step 1).
|
|
229
|
+
|
|
230
|
+
### ❌ Wrong Import Order
|
|
231
|
+
|
|
232
|
+
**This fails:**
|
|
233
|
+
|
|
234
|
+
```css
|
|
235
|
+
@import "@valiify/dashboard-ui/source";
|
|
236
|
+
@import "tailwindcss";
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Tailwind must come first. If you get "unknown at-rule" or "@apply not found" errors, check your import order.
|
|
240
|
+
|
|
241
|
+
### ❌ Using Incomplete Markup
|
|
242
|
+
|
|
243
|
+
Many components require wrapper elements:
|
|
244
|
+
|
|
245
|
+
**This looks broken:**
|
|
246
|
+
|
|
247
|
+
```html
|
|
248
|
+
<input class="input" />
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**This works:**
|
|
252
|
+
|
|
253
|
+
```html
|
|
254
|
+
<div class="input-container">
|
|
255
|
+
<div class="input-field">
|
|
256
|
+
<input class="input" />
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
See [COMPONENTS.md](COMPONENTS.md) for the required structure of each component.
|
|
262
|
+
|
|
263
|
+
## Framework-Specific Setup
|
|
264
|
+
|
|
265
|
+
### React
|
|
266
|
+
|
|
267
|
+
```jsx
|
|
268
|
+
// App.jsx
|
|
269
|
+
import "./styles.css";
|
|
270
|
+
|
|
271
|
+
function App() {
|
|
272
|
+
return (
|
|
273
|
+
<button className="btn btn-primary">
|
|
274
|
+
Click me
|
|
275
|
+
</button>
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Vue
|
|
281
|
+
|
|
282
|
+
```vue
|
|
283
|
+
<script setup>
|
|
284
|
+
import "./styles.css";
|
|
285
|
+
</script>
|
|
286
|
+
|
|
287
|
+
<template>
|
|
288
|
+
<button class="btn btn-primary">Click me</button>
|
|
289
|
+
</template>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Svelte
|
|
293
|
+
|
|
294
|
+
```svelte
|
|
295
|
+
<script>
|
|
296
|
+
import "./styles.css";
|
|
297
|
+
</script>
|
|
298
|
+
|
|
299
|
+
<button class="btn btn-primary">Click me</button>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Next.js (App Router)
|
|
303
|
+
|
|
304
|
+
In `app/layout.js`:
|
|
305
|
+
|
|
306
|
+
```js
|
|
307
|
+
import "./globals.css";
|
|
308
|
+
|
|
309
|
+
export default function RootLayout({ children }) {
|
|
310
|
+
return (
|
|
311
|
+
<html>
|
|
312
|
+
<body>{children}</body>
|
|
313
|
+
</html>
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
In `app/globals.css`:
|
|
319
|
+
|
|
320
|
+
```css
|
|
321
|
+
@import "tailwindcss";
|
|
322
|
+
@import "@valiify/dashboard-ui/source";
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Create `postcss.config.js`:
|
|
326
|
+
|
|
327
|
+
```js
|
|
328
|
+
export default {
|
|
329
|
+
plugins: {
|
|
330
|
+
"@tailwindcss/postcss": {},
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Components That Need JavaScript
|
|
336
|
+
|
|
337
|
+
These components ship **zero JavaScript** and require you to implement behavior:
|
|
338
|
+
|
|
339
|
+
### DropdownField / DropdownMenu
|
|
340
|
+
|
|
341
|
+
Needs:
|
|
342
|
+
- Click handler to toggle `aria-expanded`
|
|
343
|
+
- Hide/show the panel with the `hidden` attribute
|
|
344
|
+
- Outside-click detection to close
|
|
345
|
+
- Option selection handlers
|
|
346
|
+
|
|
347
|
+
**Minimal example:**
|
|
348
|
+
|
|
349
|
+
```js
|
|
350
|
+
const trigger = document.querySelector('[aria-haspopup="listbox"]');
|
|
351
|
+
const panel = document.querySelector(".dropdown-panel");
|
|
352
|
+
|
|
353
|
+
trigger.addEventListener("click", () => {
|
|
354
|
+
const isOpen = trigger.getAttribute("aria-expanded") === "true";
|
|
355
|
+
trigger.setAttribute("aria-expanded", !isOpen);
|
|
356
|
+
panel.hidden = isOpen;
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
// Close on outside click
|
|
360
|
+
document.addEventListener("click", (e) => {
|
|
361
|
+
if (!trigger.contains(e.target) && !panel.contains(e.target)) {
|
|
362
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
363
|
+
panel.hidden = true;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
See `examples/vite-starter/src/main.js` for a complete working implementation.
|
|
369
|
+
|
|
370
|
+
### Tabs
|
|
371
|
+
|
|
372
|
+
Needs:
|
|
373
|
+
- Click handlers on each tab
|
|
374
|
+
- Toggle `aria-selected` on clicked tab
|
|
375
|
+
- Show/hide corresponding `tabpanel`
|
|
376
|
+
|
|
377
|
+
### Modal
|
|
378
|
+
|
|
379
|
+
Either:
|
|
380
|
+
- Use native `<dialog>` element (recommended - browser handles everything)
|
|
381
|
+
- Or implement: open/close handlers, backdrop click detection, Escape key, focus trapping
|
|
382
|
+
|
|
383
|
+
**Recommended approach:**
|
|
384
|
+
|
|
385
|
+
```html
|
|
386
|
+
<dialog class="modal modal-positive">
|
|
387
|
+
<!-- modal content -->
|
|
388
|
+
</dialog>
|
|
389
|
+
|
|
390
|
+
<script>
|
|
391
|
+
const modal = document.querySelector("dialog");
|
|
392
|
+
modal.showModal(); // Opens with backdrop, Escape, focus trap for free
|
|
393
|
+
</script>
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Tooltip
|
|
397
|
+
|
|
398
|
+
Needs:
|
|
399
|
+
- Show/hide on hover/focus
|
|
400
|
+
- Positioning logic (or use a library like Floating UI)
|
|
401
|
+
|
|
402
|
+
## Verification
|
|
403
|
+
|
|
404
|
+
To verify your installation is working:
|
|
405
|
+
|
|
406
|
+
1. **Styles apply** - Buttons should have colored backgrounds and rounded corners
|
|
407
|
+
2. **Icons render** - If you see `#icon-name` text, the sprite didn't load
|
|
408
|
+
3. **Token utilities work** - Try `<div class="bg-approved">` - it should have a green background
|
|
409
|
+
4. **No console errors** - Check for 404s on sprite.svg or CSS files
|
|
410
|
+
|
|
411
|
+
## Next Steps
|
|
412
|
+
|
|
413
|
+
- Browse components in [COMPONENTS.md](COMPONENTS.md)
|
|
414
|
+
- See working examples in `examples/vite-starter/` and `examples/postcss-starter/`
|
|
415
|
+
- Read the [README](README.md) for architecture and development info
|
|
416
|
+
- Check [TROUBLESHOOTING.md](TROUBLESHOOTING.md) if you hit issues
|
|
417
|
+
|
|
418
|
+
## Still Having Issues?
|
|
419
|
+
|
|
420
|
+
See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for detailed debugging steps.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Quick Reference Card
|
|
2
|
+
|
|
3
|
+
**One-page reference for common tasks.**
|
|
4
|
+
|
|
5
|
+
## Installation (Vite)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @valiify/dashboard-ui tailwindcss @tailwindcss/vite
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**vite.config.js:**
|
|
12
|
+
```js
|
|
13
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
14
|
+
export default { plugins: [tailwindcss()] };
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**styles.css:**
|
|
18
|
+
```css
|
|
19
|
+
@import "tailwindcss";
|
|
20
|
+
@import "@valiify/dashboard-ui/source";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**main.js:**
|
|
24
|
+
```js
|
|
25
|
+
import "./styles.css";
|
|
26
|
+
|
|
27
|
+
// Load sprite
|
|
28
|
+
import spriteUrl from "@valiify/dashboard-ui/icons/sprite.svg?url";
|
|
29
|
+
fetch(spriteUrl).then(r => r.text()).then(svg => {
|
|
30
|
+
const host = document.createElement("div");
|
|
31
|
+
host.style.display = "none";
|
|
32
|
+
host.innerHTML = svg;
|
|
33
|
+
document.body.prepend(host);
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Common Components
|
|
38
|
+
|
|
39
|
+
**Button:**
|
|
40
|
+
```html
|
|
41
|
+
<button class="btn btn-primary">Save</button>
|
|
42
|
+
<button class="btn btn-outline btn-sm">Cancel</button>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Input:**
|
|
46
|
+
```html
|
|
47
|
+
<div class="input-container">
|
|
48
|
+
<div class="input-field">
|
|
49
|
+
<input type="text" class="input" placeholder="Enter text..." />
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Alert:**
|
|
55
|
+
```html
|
|
56
|
+
<div class="alert alert-warning" role="alert">
|
|
57
|
+
<div class="alert-body">
|
|
58
|
+
<svg class="alert-icon icon icon-size-18" aria-hidden="true">
|
|
59
|
+
<use href="#info" />
|
|
60
|
+
</svg>
|
|
61
|
+
<div class="alert-content">
|
|
62
|
+
<p class="alert-title">Warning</p>
|
|
63
|
+
<p class="alert-message">Message here</p>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Chip:**
|
|
70
|
+
```html
|
|
71
|
+
<span class="chip chip-success">
|
|
72
|
+
<span class="chip-dot"></span>
|
|
73
|
+
<span>Approved</span>
|
|
74
|
+
</span>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Dropdown (Minimal JS)
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<div class="dropdown">
|
|
81
|
+
<button
|
|
82
|
+
id="trigger"
|
|
83
|
+
class="dropdown-field"
|
|
84
|
+
aria-haspopup="listbox"
|
|
85
|
+
aria-expanded="false"
|
|
86
|
+
>
|
|
87
|
+
<span class="dropdown-field-placeholder">Select...</span>
|
|
88
|
+
<svg class="dropdown-field-chevron icon icon-size-14" aria-hidden="true">
|
|
89
|
+
<use href="#chevron-down" />
|
|
90
|
+
</svg>
|
|
91
|
+
</button>
|
|
92
|
+
<div id="panel" class="dropdown-panel" hidden>
|
|
93
|
+
<div class="dropdown-menu" role="listbox">
|
|
94
|
+
<button class="menu-item" role="option" data-value="1">
|
|
95
|
+
<span class="menu-item-text">
|
|
96
|
+
<span class="menu-item-title">Option 1</span>
|
|
97
|
+
</span>
|
|
98
|
+
</button>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<script>
|
|
104
|
+
const trigger = document.getElementById("trigger");
|
|
105
|
+
const panel = document.getElementById("panel");
|
|
106
|
+
|
|
107
|
+
trigger.addEventListener("click", () => {
|
|
108
|
+
const isOpen = trigger.getAttribute("aria-expanded") === "true";
|
|
109
|
+
trigger.setAttribute("aria-expanded", !isOpen);
|
|
110
|
+
panel.hidden = isOpen;
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
document.addEventListener("click", (e) => {
|
|
114
|
+
if (!trigger.contains(e.target) && !panel.contains(e.target)) {
|
|
115
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
116
|
+
panel.hidden = true;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
</script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Token Utilities
|
|
123
|
+
|
|
124
|
+
**Only with `/source` entry:**
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<div class="bg-approved text-content-contrast rounded-control">
|
|
128
|
+
Approved background
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<p class="text-content-secondary type-label-l">
|
|
132
|
+
UPPERCASE LABEL
|
|
133
|
+
</p>
|
|
134
|
+
|
|
135
|
+
<div class="shadow-panel rounded-surface">
|
|
136
|
+
Card with shadow
|
|
137
|
+
</div>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Troubleshooting
|
|
141
|
+
|
|
142
|
+
**No styles:**
|
|
143
|
+
1. Install `@tailwindcss/vite` (or postcss/webpack)
|
|
144
|
+
2. Register in config
|
|
145
|
+
3. Import from CSS, not JS
|
|
146
|
+
|
|
147
|
+
**No icons:**
|
|
148
|
+
- Add sprite loading code (see Installation above)
|
|
149
|
+
|
|
150
|
+
**No utilities:**
|
|
151
|
+
- Use `@import "@valiify/dashboard-ui/source"` not `@import "@valiify/dashboard-ui"`
|
|
152
|
+
|
|
153
|
+
**Component broken:**
|
|
154
|
+
- Check [COMPONENTS.md](COMPONENTS.md) for required wrapper elements
|
|
155
|
+
|
|
156
|
+
## Links
|
|
157
|
+
|
|
158
|
+
- [Complete Installation](GETTING_STARTED.md)
|
|
159
|
+
- [All Components](COMPONENTS.md)
|
|
160
|
+
- [Troubleshooting](TROUBLESHOOTING.md)
|
|
161
|
+
- [Examples](examples/)
|