@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,410 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Common issues and how to fix them.
|
|
4
|
+
|
|
5
|
+
## Styles Don't Apply At All
|
|
6
|
+
|
|
7
|
+
### Symptom
|
|
8
|
+
Page loads, no errors in console, but components have no styling. Buttons look like plain text, no colors, no spacing.
|
|
9
|
+
|
|
10
|
+
### Causes and Fixes
|
|
11
|
+
|
|
12
|
+
**1. Missing integration package**
|
|
13
|
+
|
|
14
|
+
You have `tailwindcss` but not `@tailwindcss/vite` (or postcss/webpack/cli).
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Check what's installed
|
|
18
|
+
npm list | grep tailwindcss
|
|
19
|
+
|
|
20
|
+
# Should see both:
|
|
21
|
+
# ├── tailwindcss@4.x.x
|
|
22
|
+
# └── @tailwindcss/vite@4.x.x (or postcss/webpack)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Fix:**
|
|
26
|
+
```bash
|
|
27
|
+
# For Vite
|
|
28
|
+
npm install @tailwindcss/vite
|
|
29
|
+
|
|
30
|
+
# For webpack
|
|
31
|
+
npm install @tailwindcss/webpack
|
|
32
|
+
|
|
33
|
+
# For PostCSS/Next.js
|
|
34
|
+
npm install @tailwindcss/postcss
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**2. Integration not registered**
|
|
38
|
+
|
|
39
|
+
The package is installed but not added to your config.
|
|
40
|
+
|
|
41
|
+
**Fix for Vite** - check `vite.config.js`:
|
|
42
|
+
```js
|
|
43
|
+
import tailwindcss from "@tailwindcss/vite"; // ← this import
|
|
44
|
+
export default defineConfig({
|
|
45
|
+
plugins: [tailwindcss()], // ← this plugin
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Fix for PostCSS** - check `postcss.config.js`:
|
|
50
|
+
```js
|
|
51
|
+
export default {
|
|
52
|
+
plugins: {
|
|
53
|
+
"@tailwindcss/postcss": {}, // ← must be present
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**3. Importing from JavaScript**
|
|
59
|
+
|
|
60
|
+
You did `import "@valiify/dashboard-ui/source"` in a `.js` file.
|
|
61
|
+
|
|
62
|
+
**Check:** Search your codebase:
|
|
63
|
+
```bash
|
|
64
|
+
grep -r "@valiify/dashboard-ui" src/**/*.{js,ts,jsx,tsx}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If you find hits, **those are wrong**. The library must be imported from CSS only.
|
|
68
|
+
|
|
69
|
+
**Fix:**
|
|
70
|
+
```diff
|
|
71
|
+
- // main.js
|
|
72
|
+
- import "@valiify/dashboard-ui/source";
|
|
73
|
+
|
|
74
|
+
+ // styles.css
|
|
75
|
+
+ @import "tailwindcss";
|
|
76
|
+
+ @import "@valiify/dashboard-ui/source";
|
|
77
|
+
|
|
78
|
+
// main.js
|
|
79
|
+
import "./styles.css";
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**4. Wrong import order**
|
|
83
|
+
|
|
84
|
+
Tailwind must come before the library.
|
|
85
|
+
|
|
86
|
+
**Check your CSS:**
|
|
87
|
+
```css
|
|
88
|
+
/* ❌ Wrong */
|
|
89
|
+
@import "@valiify/dashboard-ui/source";
|
|
90
|
+
@import "tailwindcss";
|
|
91
|
+
|
|
92
|
+
/* ✅ Correct */
|
|
93
|
+
@import "tailwindcss";
|
|
94
|
+
@import "@valiify/dashboard-ui/source";
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**5. Stylesheet not imported**
|
|
98
|
+
|
|
99
|
+
Your CSS file exists but your JavaScript never imports it.
|
|
100
|
+
|
|
101
|
+
**Fix:**
|
|
102
|
+
```js
|
|
103
|
+
// main.js or index.js
|
|
104
|
+
import "./styles.css"; // ← must be present
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Icons Don't Show
|
|
108
|
+
|
|
109
|
+
### Symptom
|
|
110
|
+
You see `#icon-name` text instead of icons, or empty boxes where icons should be.
|
|
111
|
+
|
|
112
|
+
### Cause
|
|
113
|
+
The sprite SVG didn't load.
|
|
114
|
+
|
|
115
|
+
### Fix
|
|
116
|
+
|
|
117
|
+
**1. Verify the sprite loads**
|
|
118
|
+
|
|
119
|
+
Open DevTools Network tab and search for `sprite.svg`. If it's missing or 404:
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
// Check the import path
|
|
123
|
+
import spriteUrl from "@valiify/dashboard-ui/icons/sprite.svg?url";
|
|
124
|
+
|
|
125
|
+
// Log it to see what path it resolved to
|
|
126
|
+
console.log("Sprite URL:", spriteUrl);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**2. Inline the sprite**
|
|
130
|
+
|
|
131
|
+
The sprite must be in the document:
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
fetch(spriteUrl)
|
|
135
|
+
.then((r) => r.text())
|
|
136
|
+
.then((svg) => {
|
|
137
|
+
const host = document.createElement("div");
|
|
138
|
+
host.style.display = "none";
|
|
139
|
+
host.innerHTML = svg;
|
|
140
|
+
document.body.prepend(host);
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**3. Bundler-specific fixes**
|
|
145
|
+
|
|
146
|
+
**Vite:** The `?url` suffix should work. If not, try `?raw`:
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
import spriteSvg from "@valiify/dashboard-ui/icons/sprite.svg?raw";
|
|
150
|
+
const host = document.createElement("div");
|
|
151
|
+
host.style.display = "none";
|
|
152
|
+
host.innerHTML = spriteSvg;
|
|
153
|
+
document.body.prepend(host);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**webpack:** Configure SVG loading:
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
// webpack.config.js
|
|
160
|
+
module.exports = {
|
|
161
|
+
module: {
|
|
162
|
+
rules: [
|
|
163
|
+
{
|
|
164
|
+
test: /\.svg$/,
|
|
165
|
+
type: "asset/source",
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**4. Verify the sprite is in the DOM**
|
|
173
|
+
|
|
174
|
+
Open DevTools Elements and search for `<svg`. You should see a hidden div containing the sprite with all icon definitions.
|
|
175
|
+
|
|
176
|
+
## Token Utilities Don't Work
|
|
177
|
+
|
|
178
|
+
### Symptom
|
|
179
|
+
Classes like `bg-approved`, `text-content-secondary`, `rounded-pill` have no effect. Only works with `var(--color-approved)`.
|
|
180
|
+
|
|
181
|
+
### Cause
|
|
182
|
+
You're using the prebuilt `/` entry instead of `/source`.
|
|
183
|
+
|
|
184
|
+
### How to Check
|
|
185
|
+
```css
|
|
186
|
+
/* If your CSS looks like this: */
|
|
187
|
+
@import "@valiify/dashboard-ui"; /* ← no /source */
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Fix
|
|
191
|
+
```css
|
|
192
|
+
/* Change to: */
|
|
193
|
+
@import "@valiify/dashboard-ui/source";
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The prebuilt entry is already compiled, so Tailwind can't generate utilities from it. Only `/source` exposes the `@theme` tokens that generate utilities.
|
|
197
|
+
|
|
198
|
+
## Components Look Broken or Partially Styled
|
|
199
|
+
|
|
200
|
+
### Symptom
|
|
201
|
+
Button has a background but wrong size. Input has no border. Alert has no left rail.
|
|
202
|
+
|
|
203
|
+
### Cause
|
|
204
|
+
Missing wrapper elements or incorrect markup structure.
|
|
205
|
+
|
|
206
|
+
### Fix
|
|
207
|
+
|
|
208
|
+
**Many components require specific nesting:**
|
|
209
|
+
|
|
210
|
+
❌ **Wrong:**
|
|
211
|
+
```html
|
|
212
|
+
<input class="input" />
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
✅ **Correct:**
|
|
216
|
+
```html
|
|
217
|
+
<div class="input-container">
|
|
218
|
+
<div class="input-field">
|
|
219
|
+
<input class="input" />
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Check the component reference:**
|
|
225
|
+
|
|
226
|
+
See [COMPONENTS.md](COMPONENTS.md) for the required markup structure of every component, or [CLAUDE.md](CLAUDE.md) for the complete technical reference.
|
|
227
|
+
|
|
228
|
+
**Quick verification:**
|
|
229
|
+
|
|
230
|
+
1. Find your component in COMPONENTS.md
|
|
231
|
+
2. Copy the example markup exactly
|
|
232
|
+
3. If that works, compare it to your code to find what's missing
|
|
233
|
+
|
|
234
|
+
## Dropdown / Tabs / Modal Don't Work
|
|
235
|
+
|
|
236
|
+
### Symptom
|
|
237
|
+
Clicking a dropdown trigger does nothing. Tabs don't switch. Modal doesn't open.
|
|
238
|
+
|
|
239
|
+
### Cause
|
|
240
|
+
These components ship **zero JavaScript**. They're styled shells that require you to implement behavior.
|
|
241
|
+
|
|
242
|
+
### Fix
|
|
243
|
+
|
|
244
|
+
**Dropdowns need:**
|
|
245
|
+
- Click handler to toggle `aria-expanded`
|
|
246
|
+
- Logic to show/hide the panel
|
|
247
|
+
- Outside-click detection
|
|
248
|
+
|
|
249
|
+
**Minimal example:**
|
|
250
|
+
```js
|
|
251
|
+
const trigger = document.querySelector('[aria-haspopup="listbox"]');
|
|
252
|
+
const panel = document.querySelector(".dropdown-panel");
|
|
253
|
+
|
|
254
|
+
trigger.addEventListener("click", () => {
|
|
255
|
+
const isOpen = trigger.getAttribute("aria-expanded") === "true";
|
|
256
|
+
trigger.setAttribute("aria-expanded", !isOpen);
|
|
257
|
+
panel.hidden = isOpen;
|
|
258
|
+
});
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
See `examples/vite-starter/src/main.js` for a complete working dropdown implementation.
|
|
262
|
+
|
|
263
|
+
**For modals:** Use native `<dialog>` instead:
|
|
264
|
+
|
|
265
|
+
```html
|
|
266
|
+
<dialog class="modal modal-positive">
|
|
267
|
+
<!-- content -->
|
|
268
|
+
</dialog>
|
|
269
|
+
|
|
270
|
+
<script>
|
|
271
|
+
const modal = document.querySelector("dialog");
|
|
272
|
+
modal.showModal(); // Browser handles backdrop, Escape, focus trap
|
|
273
|
+
</script>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Build Errors
|
|
277
|
+
|
|
278
|
+
### "Unknown at-rule @apply"
|
|
279
|
+
|
|
280
|
+
**Cause:** PostCSS is processing the library's CSS without Tailwind context.
|
|
281
|
+
|
|
282
|
+
**Common scenario:** You imported from JavaScript instead of CSS.
|
|
283
|
+
|
|
284
|
+
**Fix:**
|
|
285
|
+
```diff
|
|
286
|
+
- // main.js
|
|
287
|
+
- import "@valiify/dashboard-ui/source";
|
|
288
|
+
|
|
289
|
+
+ // styles.css
|
|
290
|
+
+ @import "tailwindcss";
|
|
291
|
+
+ @import "@valiify/dashboard-ui/source";
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### "Cannot find module '@valiify/dashboard-ui'"
|
|
295
|
+
|
|
296
|
+
**Cause:** Package not installed, or bad import path.
|
|
297
|
+
|
|
298
|
+
**Fix:**
|
|
299
|
+
```bash
|
|
300
|
+
npm install @valiify/dashboard-ui
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Check your import:**
|
|
304
|
+
```css
|
|
305
|
+
/* ✅ Correct */
|
|
306
|
+
@import "@valiify/dashboard-ui/source";
|
|
307
|
+
@import "@valiify/dashboard-ui"; /* also valid for prebuilt */
|
|
308
|
+
|
|
309
|
+
/* ❌ Wrong */
|
|
310
|
+
@import "@valiify/dashboard-ui/src/library.css";
|
|
311
|
+
@import "valiify-dashboard-ui/source";
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### "postcss-cli: Error: Cannot find module @tailwindcss/postcss"
|
|
315
|
+
|
|
316
|
+
**Cause:** You're using PostCSS but didn't install the integration.
|
|
317
|
+
|
|
318
|
+
**Fix:**
|
|
319
|
+
```bash
|
|
320
|
+
npm install @tailwindcss/postcss
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
And create `postcss.config.js`:
|
|
324
|
+
```js
|
|
325
|
+
export default {
|
|
326
|
+
plugins: {
|
|
327
|
+
"@tailwindcss/postcss": {},
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Production Build Issues
|
|
333
|
+
|
|
334
|
+
### Styles work in dev but not in production
|
|
335
|
+
|
|
336
|
+
**Cause 1:** Forgot to rebuild before deploying.
|
|
337
|
+
|
|
338
|
+
**Fix:**
|
|
339
|
+
```bash
|
|
340
|
+
npm run build
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
**Cause 2:** Build output not included in deployment.
|
|
344
|
+
|
|
345
|
+
**Fix:** Verify your `dist/` folder (or equivalent) is in the deployment and your HTML links to the built CSS, not the source.
|
|
346
|
+
|
|
347
|
+
### Bundle size is huge
|
|
348
|
+
|
|
349
|
+
**Cause:** You're importing the prebuilt entry (`@valiify/dashboard-ui`) which includes all of Tailwind's base styles.
|
|
350
|
+
|
|
351
|
+
**Fix:** Use `/source` instead and let your own Tailwind build handle it:
|
|
352
|
+
|
|
353
|
+
```css
|
|
354
|
+
@import "tailwindcss";
|
|
355
|
+
@import "@valiify/dashboard-ui/source";
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Also verify your production build is minifying CSS.
|
|
359
|
+
|
|
360
|
+
## Type Errors
|
|
361
|
+
|
|
362
|
+
### "Module has no exported member 'ButtonProps'"
|
|
363
|
+
|
|
364
|
+
**Cause:** This package is CSS-only with minimal TypeScript definitions.
|
|
365
|
+
|
|
366
|
+
**Fix:** Component props are not typed. Use basic HTML element types:
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
// Instead of ButtonProps (doesn't exist)
|
|
370
|
+
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
371
|
+
variant?: "primary" | "outline" | "empty";
|
|
372
|
+
};
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## Contrast / Accessibility Warnings
|
|
376
|
+
|
|
377
|
+
### Symptom
|
|
378
|
+
axe or Lighthouse flags color contrast issues on labels, placeholders, or tertiary text.
|
|
379
|
+
|
|
380
|
+
### Cause
|
|
381
|
+
Known issue: `Content/Tertiary` (#727280) fails WCAG AA (4.5:1) on `Surface/Neutral` and `Surface/Frame` backgrounds. Ratios are 4.20 and 4.26 (need 4.5:1).
|
|
382
|
+
|
|
383
|
+
### Status
|
|
384
|
+
Designer-blocked. This is a token-level issue, not a CSS bug. See `docs/accessibility-audit.md` for details.
|
|
385
|
+
|
|
386
|
+
### Workaround
|
|
387
|
+
For critical labels that must pass AA, override with a darker color:
|
|
388
|
+
|
|
389
|
+
```html
|
|
390
|
+
<span class="input-label" style="color: var(--color-content-secondary);">
|
|
391
|
+
Required Field
|
|
392
|
+
</span>
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
`Content/Secondary` (#5b5b68) passes at 4.54:1 on all four surfaces.
|
|
396
|
+
|
|
397
|
+
## Still Stuck?
|
|
398
|
+
|
|
399
|
+
1. **Check the examples** - `examples/vite-starter/` and `examples/postcss-starter/` are verified working setups. If those work and yours doesn't, compare the differences.
|
|
400
|
+
|
|
401
|
+
2. **Search issues** - https://github.com/BubbaCoop/Valiify-dashboard-ui/issues
|
|
402
|
+
|
|
403
|
+
3. **Open an issue** - Include:
|
|
404
|
+
- Your build tool and versions (`npm list`)
|
|
405
|
+
- Your config files (`vite.config.js`, `postcss.config.js`, etc.)
|
|
406
|
+
- Your CSS import
|
|
407
|
+
- What component you're trying to use
|
|
408
|
+
- Whether examples work for you
|
|
409
|
+
|
|
410
|
+
4. **Check the Tailwind v4 docs** - Many issues are Tailwind v4 setup problems, not library-specific: https://tailwindcss.com/docs/v4-beta
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Working reference implementations for different build setups.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
**New project?** Copy the Vite starter:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx degit BubbaCoop/Valiify-dashboard-ui/examples/vite-starter my-app
|
|
11
|
+
cd my-app
|
|
12
|
+
npm install
|
|
13
|
+
npm run dev
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Open [http://localhost:5173](http://localhost:5173) - you should see styled components with working icons.
|
|
17
|
+
|
|
18
|
+
## Available Examples
|
|
19
|
+
|
|
20
|
+
### [vite-starter/](vite-starter/) - Recommended
|
|
21
|
+
|
|
22
|
+
**Best for:** New projects, React/Vue/Svelte apps, any modern frontend.
|
|
23
|
+
|
|
24
|
+
- ✅ Complete working setup
|
|
25
|
+
- ✅ Shows all critical setup steps
|
|
26
|
+
- ✅ Includes interactive dropdown with minimal JavaScript
|
|
27
|
+
- ✅ Demonstrates icon sprite loading
|
|
28
|
+
- ✅ Examples of common components
|
|
29
|
+
|
|
30
|
+
**Includes:**
|
|
31
|
+
- Vite configuration with `@tailwindcss/vite`
|
|
32
|
+
- Correct CSS import structure
|
|
33
|
+
- Icon sprite loading
|
|
34
|
+
- Component examples
|
|
35
|
+
- Minimal dropdown behavior implementation
|
|
36
|
+
|
|
37
|
+
### [postcss-starter/](postcss-starter/)
|
|
38
|
+
|
|
39
|
+
**Best for:** PostCSS CLI users, webpack projects, minimal setups.
|
|
40
|
+
|
|
41
|
+
- ✅ PostCSS configuration
|
|
42
|
+
- ✅ Works without a bundler
|
|
43
|
+
- ✅ Shows manual build process
|
|
44
|
+
|
|
45
|
+
**Includes:**
|
|
46
|
+
- PostCSS config with `@tailwindcss/postcss`
|
|
47
|
+
- Build scripts
|
|
48
|
+
- Static HTML output
|
|
49
|
+
|
|
50
|
+
### [basic/](basic/)
|
|
51
|
+
|
|
52
|
+
**Best for:** Standalone HTML pages, email previews, static prototypes.
|
|
53
|
+
|
|
54
|
+
Uses the **prebuilt** entry (`dist/index.css`), not `/source`.
|
|
55
|
+
|
|
56
|
+
- ✅ No build process required
|
|
57
|
+
- ❌ No token utilities (`bg-approved`, etc. don't work)
|
|
58
|
+
- ❌ Includes Tailwind Preflight (CSS reset)
|
|
59
|
+
|
|
60
|
+
**When to use:** Only when you have no build tool at all.
|
|
61
|
+
|
|
62
|
+
## How to Choose
|
|
63
|
+
|
|
64
|
+
| You have... | Use... |
|
|
65
|
+
| ------------------------------- | -------------------------------------------------- |
|
|
66
|
+
| Vite project | [vite-starter/](vite-starter/) |
|
|
67
|
+
| React/Vue/Svelte/Next.js app | [vite-starter/](vite-starter/) |
|
|
68
|
+
| webpack project | [postcss-starter/](postcss-starter/) (adapt config) |
|
|
69
|
+
| PostCSS CLI setup | [postcss-starter/](postcss-starter/) |
|
|
70
|
+
| Plain HTML, no build | [basic/](basic/) |
|
|
71
|
+
| Email template or static export | [basic/](basic/) |
|
|
72
|
+
|
|
73
|
+
## Testing an Example Locally
|
|
74
|
+
|
|
75
|
+
All examples reference the library via `file:../..` (the parent repo), so you can test against local changes.
|
|
76
|
+
|
|
77
|
+
**Vite starter:**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd examples/vite-starter
|
|
81
|
+
npm install
|
|
82
|
+
npm run dev
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**PostCSS starter:**
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
cd examples/postcss-starter
|
|
89
|
+
npm install
|
|
90
|
+
npm run build
|
|
91
|
+
npm run serve # or open index.html directly
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Basic:**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# From repo root
|
|
98
|
+
npm run build # Build dist/index.css first
|
|
99
|
+
|
|
100
|
+
# Then open in browser
|
|
101
|
+
open examples/basic/index.html
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## What Each Example Shows
|
|
105
|
+
|
|
106
|
+
### vite-starter
|
|
107
|
+
|
|
108
|
+
- **Vite config** - `@tailwindcss/vite` plugin
|
|
109
|
+
- **CSS imports** - Correct order, no import from JS
|
|
110
|
+
- **Icon sprite** - How to load and inline
|
|
111
|
+
- **Interactive component** - Minimal dropdown with JavaScript
|
|
112
|
+
- **Token utilities** - Uses `bg-approved`, `text-content-secondary`, etc.
|
|
113
|
+
- **All component categories** - Buttons, inputs, alerts, chips, dropdown
|
|
114
|
+
|
|
115
|
+
### postcss-starter
|
|
116
|
+
|
|
117
|
+
- **PostCSS config** - `@tailwindcss/postcss` plugin
|
|
118
|
+
- **Build scripts** - Manual build vs watch
|
|
119
|
+
- **No bundler** - Shows PostCSS CLI approach
|
|
120
|
+
- **Static output** - index.html links to built CSS
|
|
121
|
+
|
|
122
|
+
### basic
|
|
123
|
+
|
|
124
|
+
- **Prebuilt entry** - `dist/index.css` directly
|
|
125
|
+
- **No build** - Plain HTML, open in browser
|
|
126
|
+
- **CSS custom properties** - Uses `var(--color-*)` instead of utilities
|
|
127
|
+
- **Inline styles** - Since no utilities, layout uses inline styles
|
|
128
|
+
|
|
129
|
+
## Common Issues
|
|
130
|
+
|
|
131
|
+
### "npm install" fails in an example
|
|
132
|
+
|
|
133
|
+
The examples reference `@valiify/dashboard-ui` via `file:../..`, which expects the parent repo to exist. Make sure you've cloned/downloaded the full repo, not just the examples folder.
|
|
134
|
+
|
|
135
|
+
### Styles don't apply in vite-starter
|
|
136
|
+
|
|
137
|
+
1. Check `vite.config.js` has `@tailwindcss/vite` registered
|
|
138
|
+
2. Check `src/styles.css` imports in correct order (Tailwind first, then library)
|
|
139
|
+
3. Check `src/main.js` imports `./styles.css`, not the library directly
|
|
140
|
+
|
|
141
|
+
### Icons don't show
|
|
142
|
+
|
|
143
|
+
The sprite needs to load. Check:
|
|
144
|
+
1. `src/main.js` has the sprite loading code
|
|
145
|
+
2. Browser DevTools Network tab shows `sprite.svg` loaded (not 404)
|
|
146
|
+
3. Inspect `<body>` - you should see a hidden `<div>` with `<svg>` inside
|
|
147
|
+
|
|
148
|
+
### postcss-starter build fails
|
|
149
|
+
|
|
150
|
+
Make sure you ran `npm install` in the example directory, not just the parent repo. The example needs its own `@tailwindcss/postcss` dependency.
|
|
151
|
+
|
|
152
|
+
## Need More Help?
|
|
153
|
+
|
|
154
|
+
- [GETTING_STARTED.md](../GETTING_STARTED.md) - Complete installation guide
|
|
155
|
+
- [TROUBLESHOOTING.md](../TROUBLESHOOTING.md) - Debug common issues
|
|
156
|
+
- [COMPONENTS.md](../COMPONENTS.md) - Full component markup reference
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Valiify Dashboard UI - Basic Example</title>
|
|
7
|
+
|
|
8
|
+
<!--
|
|
9
|
+
Loads only the built library. dist/index.css is self-contained: it carries
|
|
10
|
+
the design tokens and every component class.
|
|
11
|
+
|
|
12
|
+
Two things this example deliberately does NOT do:
|
|
13
|
+
* No Tailwind CDN. The CDN ships v3, this library is built with v4, and
|
|
14
|
+
mixing them produces conflicting output.
|
|
15
|
+
* No Tailwind utility classes for layout. dist/index.css intentionally
|
|
16
|
+
ships no utilities (see CLAUDE.md), so layout below uses plain inline
|
|
17
|
+
styles. A real app generates utilities from its own Tailwind build.
|
|
18
|
+
|
|
19
|
+
Run `npm run build` first, or this page will be unstyled.
|
|
20
|
+
-->
|
|
21
|
+
<!-- Fonts are not bundled into dist/index.css; load them yourself. -->
|
|
22
|
+
<link
|
|
23
|
+
rel="stylesheet"
|
|
24
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap"
|
|
25
|
+
/>
|
|
26
|
+
<link rel="stylesheet" href="../../dist/index.css" />
|
|
27
|
+
|
|
28
|
+
<style>
|
|
29
|
+
body {
|
|
30
|
+
min-height: 100vh;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
padding: 2rem;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
</head>
|
|
38
|
+
<body>
|
|
39
|
+
<!-- Example: Sign-in Form Card -->
|
|
40
|
+
<div class="card" style="max-width: 400px; width: 100%">
|
|
41
|
+
<h1 class="card-title" style="font-size: 24px; margin-bottom: 8px">
|
|
42
|
+
Welcome Back
|
|
43
|
+
</h1>
|
|
44
|
+
<p class="card-body" style="margin-bottom: 24px">
|
|
45
|
+
Sign in to your Valiify Dashboard account.
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
<div style="display: flex; flex-direction: column; gap: 16px">
|
|
49
|
+
<!-- Email Input -->
|
|
50
|
+
<div>
|
|
51
|
+
<label
|
|
52
|
+
style="
|
|
53
|
+
display: block;
|
|
54
|
+
margin-bottom: 4px;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
color: var(--color-content-primary);
|
|
58
|
+
"
|
|
59
|
+
>
|
|
60
|
+
Email
|
|
61
|
+
</label>
|
|
62
|
+
<input
|
|
63
|
+
type="email"
|
|
64
|
+
class="input"
|
|
65
|
+
placeholder="Enter your email"
|
|
66
|
+
value="user@valiify.com"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<!-- Password Input -->
|
|
71
|
+
<div>
|
|
72
|
+
<label
|
|
73
|
+
style="
|
|
74
|
+
display: block;
|
|
75
|
+
margin-bottom: 4px;
|
|
76
|
+
font-size: 14px;
|
|
77
|
+
font-weight: 500;
|
|
78
|
+
color: var(--color-content-primary);
|
|
79
|
+
"
|
|
80
|
+
>
|
|
81
|
+
Password
|
|
82
|
+
</label>
|
|
83
|
+
<input
|
|
84
|
+
type="password"
|
|
85
|
+
class="input"
|
|
86
|
+
placeholder="Enter your password"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<!-- Remember Me Checkbox (using HTML checkbox with custom label) -->
|
|
91
|
+
<div style="display: flex; align-items: center; gap: 8px">
|
|
92
|
+
<input
|
|
93
|
+
type="checkbox"
|
|
94
|
+
id="remember"
|
|
95
|
+
style="width: 16px; height: 16px"
|
|
96
|
+
/>
|
|
97
|
+
<label
|
|
98
|
+
for="remember"
|
|
99
|
+
style="
|
|
100
|
+
font-size: 14px;
|
|
101
|
+
color: var(--color-content-secondary);
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
"
|
|
104
|
+
>
|
|
105
|
+
Remember me
|
|
106
|
+
</label>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<!-- Action Buttons -->
|
|
110
|
+
<div style="display: flex; gap: 8px; margin-top: 8px">
|
|
111
|
+
<button
|
|
112
|
+
class="btn btn-primary"
|
|
113
|
+
style="flex: 1"
|
|
114
|
+
onclick="alert('Sign in clicked')"
|
|
115
|
+
>
|
|
116
|
+
Sign In
|
|
117
|
+
</button>
|
|
118
|
+
<button class="btn btn-outline" onclick="alert('Cancel clicked')">
|
|
119
|
+
Cancel
|
|
120
|
+
</button>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<!-- Forgot Password Link -->
|
|
124
|
+
<div style="text-align: center; margin-top: 8px">
|
|
125
|
+
<a
|
|
126
|
+
href="#"
|
|
127
|
+
style="
|
|
128
|
+
font-size: 14px;
|
|
129
|
+
color: var(--color-primary);
|
|
130
|
+
text-decoration: none;
|
|
131
|
+
"
|
|
132
|
+
>
|
|
133
|
+
Forgot password?
|
|
134
|
+
</a>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<!-- Demo Controls -->
|
|
140
|
+
<div
|
|
141
|
+
style="
|
|
142
|
+
position: fixed;
|
|
143
|
+
bottom: 20px;
|
|
144
|
+
right: 20px;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
gap: 8px;
|
|
148
|
+
"
|
|
149
|
+
>
|
|
150
|
+
<button class="btn btn-sm btn-outline" onclick="alert('This is a demo!')">
|
|
151
|
+
View Demo Info
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
</body>
|
|
155
|
+
</html>
|