@glasshome/ui 1.6.0 → 1.8.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 (83) hide show
  1. package/README.md +3 -3
  2. package/SPEC.md +30 -0
  3. package/dist/index.d.ts +13 -5
  4. package/dist/index.js +2 -13
  5. package/dist/lib/alert-tones.d.ts +2 -1
  6. package/dist/lib/badge-tone.d.ts +3 -1
  7. package/dist/lib/button-variants.d.ts +2 -1
  8. package/dist/lib/card-classes.d.ts +9 -7
  9. package/dist/lib/glass-tone.d.ts +2 -0
  10. package/dist/lib/input-classes.d.ts +10 -1
  11. package/dist/lib/layers.d.ts +8 -0
  12. package/dist/lib/menu-classes.d.ts +5 -0
  13. package/dist/lib/motion-classes.d.ts +8 -0
  14. package/dist/lib/overlay-classes.d.ts +12 -5
  15. package/dist/lib/picker-classes.d.ts +3 -0
  16. package/dist/lib/pill-classes.d.ts +3 -0
  17. package/dist/lib/position-bar-classes.d.ts +2 -0
  18. package/dist/lib/section-tokens.d.ts +3 -2
  19. package/dist/lib/segment-classes.d.ts +1 -0
  20. package/dist/lib/thumb-classes.d.ts +5 -0
  21. package/dist/lib/use-is-mobile.d.ts +2 -1
  22. package/dist/solid/alert-dialog.d.ts +16 -17
  23. package/dist/solid/area-picker.d.ts +3 -0
  24. package/dist/solid/bottom-sheet/bottom-sheet.d.ts +9 -6
  25. package/dist/solid/bottom-sheet/constants.d.ts +0 -1
  26. package/dist/solid/charts.d.ts +10 -5
  27. package/dist/solid/checkbox.d.ts +16 -1
  28. package/dist/solid/context-menu.d.ts +3 -1
  29. package/dist/solid/count-pill.d.ts +5 -3
  30. package/dist/solid/data-table.d.ts +4 -3
  31. package/dist/solid/dialog-parts.d.ts +55 -0
  32. package/dist/solid/dialog.d.ts +17 -14
  33. package/dist/solid/dropdown-menu.d.ts +19 -25
  34. package/dist/solid/empty.d.ts +5 -28
  35. package/dist/solid/entity-selector.d.ts +2 -0
  36. package/dist/solid/form.d.ts +27 -7
  37. package/dist/solid/hero-action.d.ts +0 -24
  38. package/dist/solid/icon-picker.d.ts +2 -0
  39. package/dist/solid/index.d.ts +14 -10
  40. package/dist/solid/index.js +8533 -7766
  41. package/dist/solid/input-group.d.ts +14 -2
  42. package/dist/solid/item.d.ts +6 -30
  43. package/dist/solid/menu-parts.d.ts +47 -0
  44. package/dist/solid/option-card.d.ts +22 -0
  45. package/dist/solid/ornament.d.ts +3 -0
  46. package/dist/solid/page-header.d.ts +11 -1
  47. package/dist/solid/picker-row.d.ts +14 -0
  48. package/dist/solid/picker-search.d.ts +15 -0
  49. package/dist/solid/popover.d.ts +9 -18
  50. package/dist/solid/progress.d.ts +1 -0
  51. package/dist/solid/responsive-dialog.d.ts +16 -6
  52. package/dist/solid/schema-form.d.ts +4 -0
  53. package/dist/solid/scroll-area.d.ts +1 -0
  54. package/dist/solid/section-card.d.ts +30 -7
  55. package/dist/solid/sheet.d.ts +24 -16
  56. package/dist/solid/step-indicator.d.ts +2 -2
  57. package/dist/solid/table.d.ts +3 -0
  58. package/dist/solid/tabs.d.ts +7 -5
  59. package/dist/solid/tooltip.d.ts +1 -1
  60. package/dist/solid/widget-identity.d.ts +4 -1
  61. package/dist/tokens/index.js +7 -7
  62. package/dist/{utils-8e8QCynI.js → utils-CIwpbaOd.js} +550 -513
  63. package/package.json +5 -3
  64. package/src/lib/alert-tones.ts +8 -3
  65. package/src/lib/badge-tone.ts +9 -2
  66. package/src/lib/button-variants.ts +8 -4
  67. package/src/lib/card-classes.ts +18 -7
  68. package/src/lib/carousel-classes.ts +2 -3
  69. package/src/lib/glass-tone.ts +8 -0
  70. package/src/lib/input-classes.ts +23 -1
  71. package/src/lib/layers.ts +12 -0
  72. package/src/lib/menu-classes.ts +21 -0
  73. package/src/lib/motion-classes.ts +40 -0
  74. package/src/lib/overlay-classes.ts +26 -8
  75. package/src/lib/picker-classes.ts +17 -0
  76. package/src/lib/pill-classes.ts +13 -0
  77. package/src/lib/position-bar-classes.ts +10 -0
  78. package/src/lib/section-tokens.ts +9 -4
  79. package/src/lib/segment-classes.ts +7 -0
  80. package/src/lib/thumb-classes.ts +21 -0
  81. package/src/lib/use-is-mobile.ts +10 -6
  82. package/src/styles/globals.css +90 -19
  83. package/src/styles/theme.css +106 -25
@@ -18,6 +18,7 @@
18
18
  --color-border: var(--border);
19
19
  --color-input: var(--input);
20
20
  --color-ring: var(--ring);
21
+ --color-scrim: var(--scrim);
21
22
  --color-success: var(--success);
22
23
  --color-warning: var(--warning);
23
24
  --color-primary-tint-foreground: var(--primary-tint-foreground);
@@ -31,6 +32,10 @@
31
32
  --font-mono: var(--font-mono);
32
33
  --font-serif: var(--font-serif);
33
34
 
35
+ /* Below --radius-sm: a box small enough that the theme's smallest token would
36
+ round it into a circle (checkbox, OTP slot). Clamped, so a tiny --radius
37
+ theme never grows it. */
38
+ --radius-xs: min(5px, var(--radius-sm));
34
39
  --radius-sm: calc(var(--radius) - 4px);
35
40
  --radius-md: calc(var(--radius) - 2px);
36
41
  --radius-lg: var(--radius);
@@ -54,8 +59,15 @@
54
59
  * exposes no data-side, only --kb-select-content-transform-origin (set to the
55
60
  * trigger edge per placement), so a scaleY from that origin grows the panel
56
61
  * down when it opens below and up when above, no direction class needed. */
57
- --animate-select-in: select-in 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
58
- --animate-select-out: select-out 0.12s ease-in both;
62
+ --animate-select-in: select-in var(--duration-expand) var(--ease-expand) both;
63
+ --animate-select-out: select-out var(--duration-micro) var(--ease-contract) both;
64
+
65
+ /* Trigger morph: the panel is anchored over the trigger's top edge and starts
66
+ * clipped to the trigger's own box and radius (--morph-w/h/radius, written by
67
+ * the content from its trigger), then unrolls into its own box. The pill
68
+ * becomes the panel; nothing scales, so no row or radius distorts. */
69
+ --animate-morph-in: morph-in var(--duration-morph) var(--ease-morph) both;
70
+ --animate-morph-out: morph-out calc(var(--duration-morph) / 2) var(--ease-contract) both;
59
71
  }
60
72
 
61
73
  @keyframes collapsible-down {
@@ -100,6 +112,40 @@
100
112
  pointer-events: auto;
101
113
  }
102
114
  }
115
+ @keyframes morph-in {
116
+ from {
117
+ opacity: 0;
118
+ clip-path: inset(
119
+ 0 calc(100% - var(--morph-w, 100%)) calc(100% - var(--morph-h, 2.5rem)) 0 round
120
+ var(--morph-radius, 9999px)
121
+ );
122
+ pointer-events: none;
123
+ }
124
+ 35% {
125
+ opacity: 1;
126
+ }
127
+ 90% {
128
+ pointer-events: none;
129
+ }
130
+ to {
131
+ opacity: 1;
132
+ clip-path: inset(0 0 0 0 round var(--radius-md));
133
+ pointer-events: auto;
134
+ }
135
+ }
136
+ @keyframes morph-out {
137
+ from {
138
+ opacity: 1;
139
+ clip-path: inset(0 0 0 0 round var(--radius-md));
140
+ }
141
+ to {
142
+ opacity: 0;
143
+ clip-path: inset(
144
+ 0 calc(100% - var(--morph-w, 100%)) calc(100% - var(--morph-h, 2.5rem)) 0 round
145
+ var(--morph-radius, 9999px)
146
+ );
147
+ }
148
+ }
103
149
  @keyframes select-out {
104
150
  from {
105
151
  opacity: 1;
@@ -112,11 +158,15 @@
112
158
  }
113
159
 
114
160
  :root {
115
- --background: oklch(0.975 0.003 250);
161
+ --background: oklch(0.995 0.003 250);
116
162
  --foreground: oklch(0 0 0);
117
- --card: oklch(0.995 0.004 250);
163
+ /* Light glass scatters light away from the eye, so a pane sits BELOW its
164
+ * ground here, the opposite of dark: the page is the lightest thing on
165
+ * screen, the card steps down, the popover down again. Ratios 1.11 and 1.07,
166
+ * and --popover is the floor the semantic roles below can still sit on. */
167
+ --card: oklch(0.96 0.005 250);
118
168
  --card-foreground: oklch(0 0 0);
119
- --popover: oklch(0.995 0.003 250);
169
+ --popover: oklch(0.937 0.006 250);
120
170
  --popover-foreground: oklch(0 0 0);
121
171
  --primary: oklch(0.48 0.2 215.221);
122
172
  --primary-foreground: oklch(1 0 0);
@@ -126,31 +176,41 @@
126
176
  --muted-foreground: oklch(0.34 0 0);
127
177
  --accent: oklch(0.6 0.2 195);
128
178
  --accent-foreground: oklch(1 0 0);
129
- /* Semantic roles are one value per role, used as fill AND as text, so on this
130
- * L=0.975 ground they have to clear 4.5:1 (3:1 for --ring, a focus indicator)
131
- * against --background and --card. The dark theme's high-lightness versions
132
- * measure 2.1-3.6:1 here, so the light theme drops lightness and holds hue;
133
- * chroma comes down only as far as staying near the sRGB gamut edge needs.
134
- * Measured vs --background / --card / white-on-fill:
135
- * success 5.24 / 5.56 / 5.63, warning 5.17 / 5.49 / 5.55,
136
- * destructive 5.21 / 5.53 / 5.59, ring 4.68 / 4.97 / 5.03. */
179
+ /* Semantic roles are one value per role, used as fill AND as text, so they
180
+ * clear 4.5:1 on every ground they land on. --popover is the darkest of them
181
+ * and therefore the binding one: it is what stops the ladder above sinking
182
+ * further. Chroma comes down only as far as the sRGB gamut edge needs.
183
+ * Measured vs --background / --card / --popover / white-on-fill:
184
+ * success 5.56 / 5.01 / 4.66 / 5.63, warning 5.49 / 4.94 / 4.60 / 5.55,
185
+ * destructive 5.53 / 4.98 / 4.63 / 5.59. */
137
186
  --success: oklch(0.5 0.15 145);
138
187
  --warning: oklch(0.52 0.13 85);
139
188
  --primary-tint-foreground: oklch(0.42 0.2 215.221);
140
189
  --accent-tint-foreground: oklch(0.46 0.16 195);
141
190
  --destructive: oklch(0.54 0.19 23.0704);
142
191
  --destructive-foreground: oklch(1 0 0);
143
- --border: oklch(0.9 0.01 250);
144
- --input: oklch(0.9 0.012 250);
145
- --ring: oklch(0.53 0.18 195);
192
+ --border: oklch(0.855 0.014 250);
193
+ /* Toggle wells (FIELD_CHROME), not text fields: the whole job is to read as
194
+ * empty, and the off knob has to show against it. 2.50:1 to the off thumb,
195
+ * 1.40:1 to the card. */
196
+ --input: oklch(0.85 0.016 250);
197
+ /* The focus ring wears --primary, not --accent: the two are different hues,
198
+ * so an accent ring landed teal on blue controls. */
199
+ --ring: oklch(0.48 0.2 215.221);
200
+ /* Modal scrim: a wash darker than the page. A scrim keyed to --background is
201
+ * the page colour at alpha, which computes to no darkening at all. */
202
+ --scrim: oklch(0.2 0.012 250 / 0.45);
146
203
  /* Field material (INPUT_SURFACE). The recess is the .glass-sink rim, not a
147
- * darker fill: on a card of L=0.995 an --input fill of L=0.9 is a nine-point
148
- * drop, the same cue this library spends on `disabled`, so a form of light
149
- * fields reads switched off. Light fields sit AT the card and get a solid
150
- * --border edge instead — the boundary still measures 1.33:1 against the
151
- * card, exactly what the fill drop used to carry, at 1px instead of a slab. */
204
+ * darker fill: on a light ground an --input-deep fill reads as the `disabled`
205
+ * cue, so a form of light fields would read switched off. Light fields sit AT
206
+ * the card and carry a solid --border edge, 1.39:1, at 1px instead of a slab. */
152
207
  --field: var(--card);
153
208
  --field-edge: var(--border);
209
+ /* The knob says the state too: on wears --primary's hue, off stays inert
210
+ * metal in the recessed well. Light reads lit by going darker than its pale
211
+ * track, dark by going lighter; the hue is what carries across both. */
212
+ --thumb-face-on: oklch(0.55 0.16 215);
213
+ --thumb-face-off: oklch(0.62 0.015 250);
154
214
  --chart-1: oklch(0.7459 0.1483 156.4499);
155
215
  --chart-2: oklch(0.48 0.2 215.221);
156
216
  --chart-3: oklch(0.7336 0.1758 50.5517);
@@ -181,6 +241,13 @@
181
241
  * border change, state a tone or chip swap, expand an open/close. Theme
182
242
  * independent, so declared once; zeroed under prefers-reduced-motion. */
183
243
  --ease-emphasis: cubic-bezier(0.22, 1, 0.36, 1);
244
+ /* Arrivals overshoot-free and quick to settle; departures fall away. */
245
+ --ease-expand: cubic-bezier(0.16, 1, 0.3, 1);
246
+ --ease-contract: cubic-bezier(0.4, 0, 1, 1);
247
+ /* A morph is a shape becoming another shape: slower than an arrival, and it
248
+ * leaves the start shape gently instead of snapping out of it. */
249
+ --duration-morph: 400ms;
250
+ --ease-morph: cubic-bezier(0.32, 0.72, 0, 1);
184
251
  --duration-micro: 120ms;
185
252
  --duration-state: 160ms;
186
253
  --duration-expand: 200ms;
@@ -191,7 +258,7 @@
191
258
  --foreground: oklch(0.9551 0 0);
192
259
  --card: oklch(0.17 0.01 250);
193
260
  --card-foreground: oklch(0.9551 0 0);
194
- --popover: oklch(0.19 0.008 250);
261
+ --popover: oklch(0.11 0.005 250);
195
262
  --popover-foreground: oklch(0.9551 0 0);
196
263
  --primary: oklch(0.48 0.2 215.221);
197
264
  --primary-foreground: oklch(1 0 0);
@@ -214,10 +281,15 @@
214
281
  * 0.01) keeps it from going flat gray. Same rail color as the slider track. */
215
282
  --input: oklch(0.19 0.01 250);
216
283
  --ring: oklch(0.6 0.2 195);
284
+ --scrim: color-mix(in oklab, var(--background) 70%, transparent);
217
285
  /* Dark fields keep the dug-out fill (it reads as depth here, not as disabled)
218
286
  * and the glass formula's own soft edge. See the light block. */
219
287
  --field: var(--input);
220
288
  --field-edge: color-mix(in srgb, var(--border) 60%, transparent);
289
+ /* Lit through hue, not brightness: a neutral knob this light read as the
290
+ * loudest pixel in the row. Carries --primary's hue, so on ties to the rim. */
291
+ --thumb-face-on: oklch(0.78 0.1 215);
292
+ --thumb-face-off: oklch(0.45 0.015 250);
221
293
  --chart-1: oklch(0.8003 0.1821 151.711);
222
294
  --chart-2: oklch(0.48 0.2 215.221);
223
295
  --chart-3: oklch(0.8077 0.1035 19.5706);
@@ -453,6 +525,12 @@
453
525
  --duration-micro: 0ms;
454
526
  --duration-state: 0ms;
455
527
  --duration-expand: 0ms;
528
+ --duration-morph: 0ms;
529
+ }
530
+ /* tw-animate enter/exit classes carry their own fallback duration. */
531
+ .animate-in,
532
+ .animate-out {
533
+ --tw-animation-duration: 1ms;
456
534
  }
457
535
  }
458
536
 
@@ -496,15 +574,18 @@
496
574
  transform: translate3d(0, 100%, 0);
497
575
  }
498
576
  }
577
+ /* --bs-duration and --bs-ease are published inline by BottomSheetContent from
578
+ bottom-sheet/constants.ts; --modal-max-h comes from MODAL_MAX_H, the height
579
+ cap every modal panel shares. */
499
580
  .bs-content {
500
581
  transform: translate3d(0, 100%, 0);
501
582
  bottom: var(--bs-keyboard-offset, 0);
502
583
  }
503
584
  .bs-content[data-keyboard-open] {
504
- max-height: calc(85dvh - var(--bs-keyboard-offset, 0px));
585
+ max-height: calc(var(--modal-max-h) - var(--bs-keyboard-offset, 0px));
505
586
  }
506
587
  .bs-content[data-state="opening"] {
507
- animation: bs-slide-up 500ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
588
+ animation: bs-slide-up var(--bs-duration) var(--bs-ease) forwards;
508
589
  }
509
590
  .bs-content[data-state="open"],
510
591
  .bs-content[data-state="pressing"],
@@ -513,7 +594,7 @@
513
594
  transform: translate3d(0, 0, 0);
514
595
  }
515
596
  .bs-content[data-state="closing"] {
516
- animation: bs-slide-down 500ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
597
+ animation: bs-slide-down var(--bs-duration) var(--bs-ease) forwards;
517
598
  }
518
599
  .bs-content[data-reduced-motion] {
519
600
  animation-duration: 0ms !important;