@lyeve-labs/ui-kit 0.17.1 → 0.18.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.
Files changed (37) hide show
  1. package/README.md +16 -13
  2. package/dist/components/AccordionItem.svelte +1 -1
  3. package/dist/components/AccountMenu.svelte +1 -1
  4. package/dist/components/AppShell.svelte +20 -6
  5. package/dist/components/Autocomplete.svelte +10 -1
  6. package/dist/components/Card.svelte +1 -0
  7. package/dist/components/Collapsible.svelte +1 -1
  8. package/dist/components/DatePicker.svelte +1 -1
  9. package/dist/components/Drawer.svelte +6 -26
  10. package/dist/components/Dropdown.svelte +196 -10
  11. package/dist/components/Dropdown.svelte.d.ts +12 -0
  12. package/dist/components/Logo.svelte +77 -0
  13. package/dist/components/Logo.svelte.d.ts +35 -0
  14. package/dist/components/Modal.svelte +2 -15
  15. package/dist/components/MultiSelect.svelte +12 -3
  16. package/dist/components/PageHeader.svelte +23 -1
  17. package/dist/components/Panel.svelte +1 -1
  18. package/dist/components/SearchInput.svelte +10 -1
  19. package/dist/components/Table.svelte +143 -10
  20. package/dist/components/Table.svelte.d.ts +7 -0
  21. package/dist/components/ThemeToggle.svelte +75 -12
  22. package/dist/components/ThemeToggle.svelte.d.ts +9 -0
  23. package/dist/components/Toaster.svelte +3 -15
  24. package/dist/components/Tooltip.svelte +1 -1
  25. package/dist/components/dialog/Dialog.svelte +9 -4
  26. package/dist/components/dialog/dialog-manager.svelte.d.ts +20 -1
  27. package/dist/components/dialog/dialog-manager.svelte.js +13 -2
  28. package/dist/index.d.ts +4 -2
  29. package/dist/index.js +6 -2
  30. package/dist/internal/layout.js +11 -2
  31. package/dist/internal/panel.d.ts +1 -1
  32. package/dist/internal/panel.js +1 -1
  33. package/dist/styles/theme.css +235 -0
  34. package/dist/utils/theme.d.ts +68 -3
  35. package/dist/utils/theme.js +118 -3
  36. package/package.json +18 -19
  37. package/src/lib/styles/theme.css +235 -0
@@ -79,6 +79,61 @@
79
79
  --radius-xl: 16px;
80
80
  --radius-2xl: 24px;
81
81
 
82
+ /* -- Elevation - the stacking order of everything that floats --- *
83
+ * Every floating surface in the kit carried a bare z-50, so which
84
+ * one won was decided by document order: a Dropdown opened after a
85
+ * Modal painted over it, and the same two in the other order did
86
+ * not. The layer a surface belongs to is a property of the surface,
87
+ * so it is named here once and each component asks for its layer by
88
+ * name.
89
+ *
90
+ * The ramp starts at 100 and leaves everything below it to the
91
+ * consuming app. The admin's own chrome sits at z-10 and z-20
92
+ * today, and a kit layer landing on either number would tie with
93
+ * it and resolve, again, by document order.
94
+ *
95
+ * The steps are 100 apart because one of these layers holds a
96
+ * stack rather than a surface: the dialog manager offsets each
97
+ * dialog above the one it opened over, and a ramp in steps of ten
98
+ * would put the eleventh dialog through the ceiling of its own
99
+ * layer and under the tooltip above it.
100
+ *
101
+ * tooltip sits above modal because a tooltip on a control inside a
102
+ * dialog is drawn while that dialog is the topmost surface. toast
103
+ * sits above tooltip because it reports the outcome of the action
104
+ * the tooltip described. skip-link is above everything: it is the
105
+ * first focusable thing in the document and nothing may cover it.
106
+ *
107
+ * No sticky rung is declared. Nothing in the kit is sticky or
108
+ * fixed below the dropdown layer, and a token no rule reads is the
109
+ * defect this scale was written to end. */
110
+ --z-index-dropdown: 100; /* a panel anchored to its trigger */
111
+ --z-index-overlay: 200; /* the scrim behind a drawer or modal */
112
+ --z-index-drawer: 300; /* a panel docked to a viewport edge */
113
+ --z-index-modal: 400; /* a centred dialog, and the stack */
114
+ --z-index-tooltip: 500; /* a label attached to a control */
115
+ --z-index-toast: 600; /* transient status */
116
+ --z-index-skip-link: 700; /* the first tab stop in the document */
117
+
118
+ /* -- Motion - how long a transition or an entrance runs -------- *
119
+ * Four durations shipped as literals inside the animate-[...]
120
+ * utility of the component that used them, so the only way to
121
+ * read the kit's motion was to grep four components. They are
122
+ * stated here at the values they already ran at.
123
+ *
124
+ * Tailwind builds no utility from a --duration-* token: there is
125
+ * no such theme namespace, and `duration-collapse` compiles to
126
+ * nothing at all. Each one is read through var() from an
127
+ * arbitrary utility instead, which is why they are listed in
128
+ * VAR_ONLY in theme-tokens.test.ts.
129
+ *
130
+ * The reduced-motion block at the foot of this file overrides
131
+ * every one of them and stays the authority on whether they run. */
132
+ --duration-modal-in: 120ms; /* Modal, the centred entrance */
133
+ --duration-toast-in: 140ms; /* Toaster, one toast arriving */
134
+ --duration-drawer-in: 150ms; /* Drawer, either edge */
135
+ --duration-collapse: 200ms; /* Accordion and Collapsible */
136
+
82
137
  /* ── Typography · families ───────────────────────────────────── */
83
138
  --font-sans:
84
139
  'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
@@ -181,6 +236,65 @@ html[data-theme='light'] {
181
236
  --color-danger: #ab1a1a;
182
237
  }
183
238
 
239
+ /*
240
+ * The entrance keyframes, declared here and not in the components that play
241
+ * them.
242
+ *
243
+ * Modal, Drawer and Toaster each held their own `@keyframes` in a scoped
244
+ * `<style>` block and started it from a Tailwind `animate-[...]` class. Svelte
245
+ * renames a scoped keyframe to `svelte-<hash>-<name>` and rewrites only the
246
+ * references inside that same style block, so the class asked the browser for
247
+ * `modal-in` while the only rule declared was `svelte-ta60gp-modal-in`. An
248
+ * animation-name that resolves to nothing is not an error: the element simply
249
+ * appears, and all four entrances had been dead in every consumer.
250
+ *
251
+ * A keyframe named from a class has to be global, and the file every consumer
252
+ * already imports is the one place it can be global from.
253
+ */
254
+ @keyframes modal-in {
255
+ from {
256
+ opacity: 0;
257
+ transform: translateY(6px) scale(0.98);
258
+ }
259
+ to {
260
+ opacity: 1;
261
+ transform: translateY(0) scale(1);
262
+ }
263
+ }
264
+
265
+ @keyframes drawer-in-right {
266
+ from {
267
+ opacity: 0;
268
+ transform: translateX(16px);
269
+ }
270
+ to {
271
+ opacity: 1;
272
+ transform: translateX(0);
273
+ }
274
+ }
275
+
276
+ @keyframes drawer-in-left {
277
+ from {
278
+ opacity: 0;
279
+ transform: translateX(-16px);
280
+ }
281
+ to {
282
+ opacity: 1;
283
+ transform: translateX(0);
284
+ }
285
+ }
286
+
287
+ @keyframes toast-in {
288
+ from {
289
+ opacity: 0;
290
+ transform: translateX(12px);
291
+ }
292
+ to {
293
+ opacity: 1;
294
+ transform: translateX(0);
295
+ }
296
+ }
297
+
184
298
  @layer base {
185
299
  html {
186
300
  background-color: var(--color-ink);
@@ -238,3 +352,124 @@ html[data-theme='light'] {
238
352
  }
239
353
  }
240
354
  }
355
+
356
+ /*
357
+ * Print.
358
+ *
359
+ * The estate had no `@media print` rule anywhere, and three surfaces print:
360
+ * the portal prints an invoice, the ops console prints an audit log, the admin
361
+ * prints a subject-access export. All three printed the sidebar, the theme
362
+ * toggle and the nav, in a dark palette, and all three printed one screenful
363
+ * and stopped, because the shell is `h-screen` with the content column set to
364
+ * `overflow-auto` and paper has neither a viewport nor a scrollbar.
365
+ *
366
+ * These rules are deliberately outside `@layer base`. An unlayered declaration
367
+ * beats every layered one whatever its specificity, so a `bg-surface` utility
368
+ * on a card cannot put the dark surface back.
369
+ *
370
+ * Three markers, each stating what paper needs rather than what an element is:
371
+ *
372
+ * data-print="hide" chrome that exists to navigate. Paper cannot be
373
+ * navigated, so it is noise on every page.
374
+ * data-print="unclip" a box that clips on screen because the screen is a
375
+ * fixed height. On paper it must give up its height and
376
+ * its overflow or the content past the first page is
377
+ * never printed.
378
+ * data-print="keep" a block that reads as one thing and must not be split
379
+ * across a page break.
380
+ */
381
+ @media print {
382
+ /*
383
+ * The palette, not the components.
384
+ *
385
+ * Every kit component paints from these tokens, so redefining them here
386
+ * turns the whole library monochrome without a single component knowing
387
+ * about paper. Browsers drop backgrounds when printing by default, which
388
+ * left light text on the white the printer supplies; naming white here means
389
+ * the two agree either way.
390
+ *
391
+ * The status hues collapse to black rather than to a print-safe tint. A
392
+ * colour that carries meaning on screen carries none through a mono printer,
393
+ * and a legible black label beats an unreadable coloured one.
394
+ */
395
+ html,
396
+ html[data-theme='light'] {
397
+ --color-ink: #ffffff;
398
+ --color-surface: #ffffff;
399
+ --color-surface-2: #ffffff;
400
+ --color-line: #999999;
401
+ --color-line-strong: #666666;
402
+ --color-fg: #000000;
403
+ --color-muted: #000000;
404
+ --color-faint: #000000;
405
+ --color-brand: #000000;
406
+ --color-brand-light: #000000;
407
+ --color-brand-deep: #000000;
408
+ --color-violet: #000000;
409
+ --color-success: #000000;
410
+ --color-warn: #000000;
411
+ --color-danger: #000000;
412
+ color-scheme: light;
413
+ }
414
+
415
+ html,
416
+ body {
417
+ background: #ffffff;
418
+ color: #000000;
419
+ }
420
+
421
+ [data-print='hide'] {
422
+ display: none !important;
423
+ }
424
+
425
+ /*
426
+ * height as well as overflow. The shell is `h-screen`, so releasing the
427
+ * overflow alone still caps the printed document at one viewport.
428
+ */
429
+ [data-print='unclip'] {
430
+ overflow: visible !important;
431
+ height: auto !important;
432
+ max-height: none !important;
433
+ }
434
+
435
+ [data-print='keep'],
436
+ tr,
437
+ li {
438
+ break-inside: avoid;
439
+ }
440
+
441
+ /* A table running past one page repeats its own column headings. */
442
+ thead {
443
+ display: table-header-group;
444
+ }
445
+
446
+ tfoot {
447
+ display: table-footer-group;
448
+ }
449
+
450
+ /*
451
+ * A heading orphaned at the foot of a page belongs to the section on the
452
+ * next one.
453
+ */
454
+ h1,
455
+ h2,
456
+ h3 {
457
+ break-after: avoid;
458
+ }
459
+
460
+ /*
461
+ * The target of a link, for the links a reader cannot follow from paper and
462
+ * could not guess.
463
+ *
464
+ * Absolute links only. An invoice full of "(/portal/invoices/8841)" after
465
+ * every internal link is noise, and the reader holding the paper is already
466
+ * inside that application. A caller whose absolute link is decorative, or
467
+ * whose text is the URL already, opts out per link.
468
+ */
469
+ a[href^='http']:not([data-print='bare'])::after {
470
+ content: ' <' attr(href) '>';
471
+ font-size: 0.85em;
472
+ font-weight: normal;
473
+ word-break: break-all;
474
+ }
475
+ }