@valiify/dashboard-ui 0.1.2 → 0.2.1

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +493 -4
  2. package/CLAUDE.md +884 -768
  3. package/COMPONENTS.md +520 -520
  4. package/GETTING_STARTED.md +63 -14
  5. package/QUICK_REFERENCE.md +22 -22
  6. package/README.md +45 -6
  7. package/TROUBLESHOOTING.md +46 -6
  8. package/class-manifest.json +664 -0
  9. package/design-methodology/dashboard.md +496 -0
  10. package/dist/dashboard-ui.css +4891 -0
  11. package/dist/index.css +502 -502
  12. package/examples/README.md +42 -0
  13. package/examples/basic/index.html +8 -8
  14. package/examples/daisyui-starter/README.md +58 -0
  15. package/examples/daisyui-starter/check-no-bleed.mjs +249 -0
  16. package/examples/daisyui-starter/index.html +72 -0
  17. package/examples/daisyui-starter/linked.html +74 -0
  18. package/examples/daisyui-starter/package-lock.json +2221 -0
  19. package/examples/daisyui-starter/package.json +22 -0
  20. package/examples/daisyui-starter/postcss.config.js +1 -0
  21. package/examples/daisyui-starter/src/host.css +14 -0
  22. package/examples/daisyui-starter/src/only-import.css +4 -0
  23. package/examples/daisyui-starter/src/styles.css +36 -0
  24. package/examples/daisyui-starter/tailwind.config.js +13 -0
  25. package/examples/postcss-starter/index.html +8 -8
  26. package/examples/postcss-starter/package.json +1 -1
  27. package/examples/sveltekit-starter/README.md +32 -0
  28. package/examples/sveltekit-starter/check-scoped-styles.mjs +103 -0
  29. package/examples/sveltekit-starter/package-lock.json +1300 -0
  30. package/examples/sveltekit-starter/package.json +24 -0
  31. package/examples/sveltekit-starter/src/app.css +17 -0
  32. package/examples/sveltekit-starter/src/app.html +11 -0
  33. package/examples/sveltekit-starter/src/lib/GlobalReset.svelte +20 -0
  34. package/examples/sveltekit-starter/src/lib/ScopedRemedy.svelte +27 -0
  35. package/examples/sveltekit-starter/src/lib/ScopedReset.svelte +22 -0
  36. package/examples/sveltekit-starter/src/routes/+layout.svelte +6 -0
  37. package/examples/sveltekit-starter/src/routes/+page.svelte +10 -0
  38. package/examples/sveltekit-starter/svelte.config.js +4 -0
  39. package/examples/sveltekit-starter/vite.config.js +6 -0
  40. package/examples/vite-starter/README.md +4 -4
  41. package/examples/vite-starter/package.json +1 -1
  42. package/examples/vite-starter/src/main.js +41 -41
  43. package/package.json +21 -4
  44. package/src/build/components.css +35 -0
  45. package/src/build/utilities.css +46 -0
  46. package/src/components/ICON-SYSTEM.md +39 -39
  47. package/src/components/alert.css +26 -26
  48. package/src/components/avatar.css +9 -9
  49. package/src/components/breadcrumbs.css +15 -15
  50. package/src/components/button.css +21 -21
  51. package/src/components/card.css +10 -10
  52. package/src/components/checkbox.css +21 -21
  53. package/src/components/chip.css +43 -43
  54. package/src/components/data-row.css +19 -19
  55. package/src/components/divider.css +23 -23
  56. package/src/components/dropdown-field.css +34 -34
  57. package/src/components/dropdown-menu.css +12 -12
  58. package/src/components/field-verification.css +25 -25
  59. package/src/components/filter-segment.css +20 -20
  60. package/src/components/icon-button.css +11 -11
  61. package/src/components/icon.css +18 -18
  62. package/src/components/input.css +29 -29
  63. package/src/components/link.css +28 -28
  64. package/src/components/loading-indicator.css +20 -20
  65. package/src/components/loading-inline.css +8 -8
  66. package/src/components/menu-item.css +28 -28
  67. package/src/components/modal.css +36 -36
  68. package/src/components/navigation-rail.css +95 -95
  69. package/src/components/pagination-item.css +22 -22
  70. package/src/components/pagination.css +24 -24
  71. package/src/components/pill.css +14 -14
  72. package/src/components/progress-bar.css +28 -28
  73. package/src/components/radio-select.css +13 -13
  74. package/src/components/section-marker.css +12 -12
  75. package/src/components/segment-selector.css +9 -9
  76. package/src/components/sensitive-data.css +8 -8
  77. package/src/components/skeleton.css +29 -29
  78. package/src/components/step.css +14 -14
  79. package/src/components/stepper.css +15 -15
  80. package/src/components/switch.css +12 -12
  81. package/src/components/tabs.css +40 -40
  82. package/src/components/tag.css +20 -20
  83. package/src/components/text-button.css +24 -24
  84. package/src/components/textarea.css +23 -23
  85. package/src/components/toast.css +29 -29
  86. package/src/components/tooltip.css +11 -11
  87. package/src/icons/README.md +16 -10
  88. package/src/icons/sprite.svg +1 -1
  89. package/src/themes/valiify-tokens.css +285 -0
  90. package/src/themes/valiify-type-prefixed.css +37 -0
  91. package/src/utilities/index.css +1 -1
  92. package/src/utility-surface.css +321 -0
  93. package/types/components.d.ts +235 -236
@@ -171,22 +171,66 @@ fetch(spriteUrl)
171
171
  ### Step 6: Use Components
172
172
 
173
173
  ```html
174
- <button class="btn btn-primary">Click me</button>
174
+ <button class="vd-btn vd-btn-primary">Click me</button>
175
175
 
176
- <div class="input-container">
177
- <div class="input-field">
178
- <input type="text" class="input" placeholder="Enter text..." />
176
+ <div class="vd-input-container">
177
+ <div class="vd-input-field">
178
+ <input type="text" class="vd-input" placeholder="Enter text..." />
179
179
  </div>
180
180
  </div>
181
181
 
182
- <span class="chip chip-success">
183
- <span class="chip-dot"></span>
182
+ <span class="vd-chip vd-chip-success">
183
+ <span class="vd-chip-dot"></span>
184
184
  <span>Approved</span>
185
185
  </span>
186
186
  ```
187
187
 
188
188
  See [COMPONENTS.md](COMPONENTS.md) for complete markup examples of every component.
189
189
 
190
+ ## Without Tailwind v4: the prebuilt bundle
191
+
192
+ If your host has no Tailwind v4 pipeline — the dashboard app is Tailwind 3 +
193
+ daisyUI 4 — import the prebuilt bundle instead of `/source`, and **not**
194
+ `@valiify/dashboard-ui` (`dist/index.css`), which ships Tailwind 4's Preflight and
195
+ an `html` rule and fights your reset:
196
+
197
+ ```css
198
+ /* app.css — inside the file that carries your @tailwind directives */
199
+ @import "@valiify/dashboard-ui/styles.css"; /* MUST be the first line */
200
+
201
+ @tailwind base;
202
+ @tailwind components;
203
+ @tailwind utilities;
204
+ ```
205
+
206
+ A plain `<link>` to the file after your own stylesheet works too, and so does a
207
+ lone `@import` in its own file through your PostCSS. Import exactly one of `.`,
208
+ `./index.css`, `./styles.css`. Never two.
209
+
210
+ The bundle does not render "identically" to `/source`. Its contract is narrower and
211
+ checkable, in two clauses:
212
+
213
+ 1. **What it defends against.** The bundle is **unlayered** and must load **after**
214
+ your reset. Its component rules then beat any host rule of *lower* specificity,
215
+ wherever that rule sits in source order: Tailwind 3 preflight (`* { border-width:
216
+ 0 }`, `button { background-color: transparent }`, `input, textarea { color:
217
+ inherit }`), daisyUI's base, a `:global(button)` reset in a Svelte component.
218
+ Version 0.2.0 did **not** hold this — its rules sat in `@layer components` and
219
+ lost to every unlayered host rule. The fingerprint: a control whose focus ring
220
+ survives while its border, fill and padding do not.
221
+ 2. **What it cannot defend against.** A host rule of *higher* specificity still wins,
222
+ and a Svelte scoped element selector is exactly that — `button { border: 0 }` in a
223
+ component's `<style>` compiles to `button.svelte-<hash>` (0,1,1), which outranks
224
+ our single-class rules (0,1,0). A host that wraps its own CSS in a cascade layer
225
+ changes the arithmetic too. **Instead:** scope element resets by class (`.plain {
226
+ }`) or exclude library controls — `button:not([class*="vd-"]) { border: 0 }` —
227
+ and never write a bare `button` / `input` / `textarea` selector inside a
228
+ component that renders a `vd-` control.
229
+
230
+ Both clauses are measured, not asserted: `examples/daisyui-starter` (Tailwind 3 +
231
+ daisyUI, three load paths) and `examples/sveltekit-starter` (scoped styles, including
232
+ clause 2 asserted as a loss) — `npm run check` in each.
233
+
190
234
  ## Common Mistakes
191
235
 
192
236
  ### ❌ Importing from JavaScript
@@ -245,15 +289,15 @@ Many components require wrapper elements:
245
289
  **This looks broken:**
246
290
 
247
291
  ```html
248
- <input class="input" />
292
+ <input class="vd-input" />
249
293
  ```
250
294
 
251
295
  **This works:**
252
296
 
253
297
  ```html
254
- <div class="input-container">
255
- <div class="input-field">
256
- <input class="input" />
298
+ <div class="vd-input-container">
299
+ <div class="vd-input-field">
300
+ <input class="vd-input" />
257
301
  </div>
258
302
  </div>
259
303
  ```
@@ -270,7 +314,7 @@ import "./styles.css";
270
314
 
271
315
  function App() {
272
316
  return (
273
- <button className="btn btn-primary">
317
+ <button className="vd-btn vd-btn-primary">
274
318
  Click me
275
319
  </button>
276
320
  );
@@ -285,7 +329,7 @@ import "./styles.css";
285
329
  </script>
286
330
 
287
331
  <template>
288
- <button class="btn btn-primary">Click me</button>
332
+ <button class="vd-btn vd-btn-primary">Click me</button>
289
333
  </template>
290
334
  ```
291
335
 
@@ -296,9 +340,14 @@ import "./styles.css";
296
340
  import "./styles.css";
297
341
  </script>
298
342
 
299
- <button class="btn btn-primary">Click me</button>
343
+ <button class="vd-btn vd-btn-primary">Click me</button>
300
344
  ```
301
345
 
346
+ > **Scoped styles and library controls.** A scoped `button { }` in a Svelte
347
+ > component compiles to `button.svelte-<hash>` and outranks the library's
348
+ > single-class rules even with the prebuilt bundle. Scope resets by class or exclude
349
+ > library controls (`button:not([class*="vd-"])`) — see "Without Tailwind v4" above.
350
+
302
351
  ### Next.js (App Router)
303
352
 
304
353
  In `app/layout.js`:
@@ -383,7 +432,7 @@ Either:
383
432
  **Recommended approach:**
384
433
 
385
434
  ```html
386
- <dialog class="modal modal-positive">
435
+ <dialog class="vd-modal vd-modal-positive">
387
436
  <!-- modal content -->
388
437
  </dialog>
389
438
 
@@ -38,29 +38,29 @@ fetch(spriteUrl).then(r => r.text()).then(svg => {
38
38
 
39
39
  **Button:**
40
40
  ```html
41
- <button class="btn btn-primary">Save</button>
42
- <button class="btn btn-outline btn-sm">Cancel</button>
41
+ <button class="vd-btn vd-btn-primary">Save</button>
42
+ <button class="vd-btn vd-btn-outline vd-btn-sm">Cancel</button>
43
43
  ```
44
44
 
45
45
  **Input:**
46
46
  ```html
47
- <div class="input-container">
48
- <div class="input-field">
49
- <input type="text" class="input" placeholder="Enter text..." />
47
+ <div class="vd-input-container">
48
+ <div class="vd-input-field">
49
+ <input type="text" class="vd-input" placeholder="Enter text..." />
50
50
  </div>
51
51
  </div>
52
52
  ```
53
53
 
54
54
  **Alert:**
55
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">
56
+ <div class="vd-alert vd-alert-warning" role="alert">
57
+ <div class="vd-alert-body">
58
+ <svg class="vd-alert-icon vd-icon vd-icon-size-18" aria-hidden="true">
59
59
  <use href="#info" />
60
60
  </svg>
61
- <div class="alert-content">
62
- <p class="alert-title">Warning</p>
63
- <p class="alert-message">Message here</p>
61
+ <div class="vd-alert-content">
62
+ <p class="vd-alert-title">Warning</p>
63
+ <p class="vd-alert-message">Message here</p>
64
64
  </div>
65
65
  </div>
66
66
  </div>
@@ -68,8 +68,8 @@ fetch(spriteUrl).then(r => r.text()).then(svg => {
68
68
 
69
69
  **Chip:**
70
70
  ```html
71
- <span class="chip chip-success">
72
- <span class="chip-dot"></span>
71
+ <span class="vd-chip vd-chip-success">
72
+ <span class="vd-chip-dot"></span>
73
73
  <span>Approved</span>
74
74
  </span>
75
75
  ```
@@ -77,23 +77,23 @@ fetch(spriteUrl).then(r => r.text()).then(svg => {
77
77
  ## Dropdown (Minimal JS)
78
78
 
79
79
  ```html
80
- <div class="dropdown">
80
+ <div class="vd-dropdown">
81
81
  <button
82
82
  id="trigger"
83
- class="dropdown-field"
83
+ class="vd-dropdown-field"
84
84
  aria-haspopup="listbox"
85
85
  aria-expanded="false"
86
86
  >
87
- <span class="dropdown-field-placeholder">Select...</span>
88
- <svg class="dropdown-field-chevron icon icon-size-14" aria-hidden="true">
87
+ <span class="vd-dropdown-field-placeholder">Select...</span>
88
+ <svg class="vd-dropdown-field-chevron vd-icon vd-icon-size-14" aria-hidden="true">
89
89
  <use href="#chevron-down" />
90
90
  </svg>
91
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>
92
+ <div id="panel" class="vd-dropdown-panel" hidden>
93
+ <div class="vd-dropdown-menu" role="listbox">
94
+ <button class="vd-menu-item" role="option" data-value="1">
95
+ <span class="vd-menu-item-text">
96
+ <span class="vd-menu-item-title">Option 1</span>
97
97
  </span>
98
98
  </button>
99
99
  </div>
package/README.md CHANGED
@@ -33,6 +33,45 @@ Open [http://localhost:5173](http://localhost:5173) - if you see styled componen
33
33
 
34
34
  **Or:** See the [complete installation guide](GETTING_STARTED.md) for manual setup with any build tool.
35
35
 
36
+ ## Entry points
37
+
38
+ | Import | Use it when |
39
+ | --- | --- |
40
+ | `@valiify/dashboard-ui/styles.css` | dropping the library into a host app that already has a reset — **no Preflight, no `html` rule, unlayered**, closed `vd:` utility set |
41
+ | `@valiify/dashboard-ui` | a standalone page where our Preflight is welcome |
42
+ | `@valiify/dashboard-ui/source` | your Tailwind compiles our `@theme`, giving every token utility |
43
+
44
+ Component classes are namespaced: `.vd-btn`, `.vd-card-title`, `.vd-input-field`.
45
+ The generated list ships as `@valiify/dashboard-ui/manifest`.
46
+
47
+ ```css
48
+ /* a host app — the @import must come FIRST, CSS discards a later one */
49
+ @import "@valiify/dashboard-ui/styles.css";
50
+ @tailwind base;
51
+ @tailwind components;
52
+ @tailwind utilities;
53
+ ```
54
+
55
+ `./styles.css` does not render "identically" to `./source`. Its contract is
56
+ narrower and checkable, in two clauses:
57
+
58
+ 1. **What it defends against.** The bundle is **unlayered**. Load it after your
59
+ reset and its component rules beat any host rule of *lower* specificity,
60
+ wherever that rule sits in source order — Tailwind 3 preflight, daisyUI's base,
61
+ a `:global(button)` reset in a Svelte component. (0.2.0 did not hold this: its
62
+ rules sat in `@layer components` and lost to every unlayered host rule. The
63
+ fingerprint was a control whose focus ring survived while its border, fill and
64
+ padding did not.)
65
+ 2. **What it cannot defend against.** A host rule of *higher* specificity still
66
+ wins. A Svelte scoped `button { border: 0 }` compiles to `button.svelte-hash`
67
+ (0,1,1) and beats our single-class rules (0,1,0). A host that wraps its own CSS
68
+ in a cascade layer changes the arithmetic too. Scope element resets by class, or
69
+ exclude library controls: `button:not([class*="vd-"]) { border: 0 }`.
70
+
71
+ Both clauses are measured in `examples/daisyui-starter` (Tailwind 3 + daisyUI 4,
72
+ three load paths) and `examples/sveltekit-starter` (Svelte scoped styles, including
73
+ clause 2 asserted as a loss) — `npm run check` in each.
74
+
36
75
  ## Installation
37
76
 
38
77
  ### Step 1: Install Packages
@@ -140,16 +179,16 @@ fetch(spriteUrl)
140
179
  ### Step 6: Use Components
141
180
 
142
181
  ```html
143
- <button class="btn btn-primary">Click me</button>
182
+ <button class="vd-btn vd-btn-primary">Click me</button>
144
183
 
145
- <div class="input-container">
146
- <div class="input-field">
147
- <input type="text" class="input" placeholder="Enter text..." />
184
+ <div class="vd-input-container">
185
+ <div class="vd-input-field">
186
+ <input type="text" class="vd-input" placeholder="Enter text..." />
148
187
  </div>
149
188
  </div>
150
189
 
151
- <span class="chip chip-success">
152
- <span class="chip-dot"></span>
190
+ <span class="vd-chip vd-chip-success">
191
+ <span class="vd-chip-dot"></span>
153
192
  <span>Approved</span>
154
193
  </span>
155
194
  ```
@@ -209,14 +209,14 @@ Missing wrapper elements or incorrect markup structure.
209
209
 
210
210
  ❌ **Wrong:**
211
211
  ```html
212
- <input class="input" />
212
+ <input class="vd-input" />
213
213
  ```
214
214
 
215
215
  ✅ **Correct:**
216
216
  ```html
217
- <div class="input-container">
218
- <div class="input-field">
219
- <input class="input" />
217
+ <div class="vd-input-container">
218
+ <div class="vd-input-field">
219
+ <input class="vd-input" />
220
220
  </div>
221
221
  </div>
222
222
  ```
@@ -231,6 +231,46 @@ See [COMPONENTS.md](COMPONENTS.md) for the required markup structure of every co
231
231
  2. Copy the example markup exactly
232
232
  3. If that works, compare it to your code to find what's missing
233
233
 
234
+ ## Borders, Fills and Padding Vanish Inside a Host App
235
+
236
+ ### Symptom
237
+
238
+ Inside an app that has its own reset (Tailwind 3 preflight, daisyUI, a house
239
+ reset), buttons render transparent with the page's text colour, fields lose their
240
+ hairline, text takes the host's font-size — but the **focus ring still appears**
241
+ when you Tab to the control.
242
+
243
+ ### Cause
244
+
245
+ A cascade-layer defeat. Unlayered CSS beats layered CSS before specificity or
246
+ source order is consulted, so a component rule inside `@layer components` loses to
247
+ a bare `button { }` or `* { border-width: 0 }` from the host. Preflight never
248
+ touches `outline`, which is why the ring survives while everything else goes.
249
+
250
+ Two ways to get here:
251
+
252
+ 1. **You are on 0.2.0 of `./styles.css`.** That build wrapped every component rule
253
+ in `@layer components`. It looked fine when `@import`ed into the file carrying
254
+ your `@tailwind` directives (Tailwind 3 strips the layers by accident) and broke
255
+ on a `<link>` to the file. Upgrade; the bundle is unlayered now.
256
+ 2. **You imported `@valiify/dashboard-ui/source` or `.` into a host that wraps its
257
+ own CSS in a cascade layer**, or a host rule at *higher* specificity is winning
258
+ — a Svelte scoped `button { border: 0 }` compiles to `button.svelte-<hash>`
259
+ (0,1,1), which outranks our single-class rules (0,1,0) on any entry.
260
+
261
+ ### Fix
262
+
263
+ - Use `./styles.css` and load it **after** the host's reset.
264
+ - Never write a bare `button` / `input` / `textarea` selector in a component that
265
+ renders a `vd-` control. Scope resets by class, or exclude library controls:
266
+ `button:not([class*="vd-"]) { border: 0 }`.
267
+ - To confirm which case you have, open DevTools on the control: a rule shown as
268
+ struck through *below* a lower-specificity host rule is the layer; a
269
+ `button.svelte-…` rule winning is specificity.
270
+
271
+ `examples/daisyui-starter` and `examples/sveltekit-starter` measure both cases —
272
+ `npm run check` in each.
273
+
234
274
  ## Dropdown / Tabs / Modal Don't Work
235
275
 
236
276
  ### Symptom
@@ -263,7 +303,7 @@ See `examples/vite-starter/src/main.js` for a complete working dropdown implemen
263
303
  **For modals:** Use native `<dialog>` instead:
264
304
 
265
305
  ```html
266
- <dialog class="modal modal-positive">
306
+ <dialog class="vd-modal vd-modal-positive">
267
307
  <!-- content -->
268
308
  </dialog>
269
309
 
@@ -387,7 +427,7 @@ Designer-blocked. This is a token-level issue, not a CSS bug. See `docs/accessib
387
427
  For critical labels that must pass AA, override with a darker color:
388
428
 
389
429
  ```html
390
- <span class="input-label" style="color: var(--color-content-secondary);">
430
+ <span class="vd-input-label" style="color: var(--color-content-secondary);">
391
431
  Required Field
392
432
  </span>
393
433
  ```