@zonsh/ui 0.6.1 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zonsh/ui
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a74f94f: Toast: a status toast (`success`, `warning`, `info`, `error`) now carries its colour as light — a 1px edge tinted toward it and a soft glow that fills the start side, top to bottom, and fades out before the text. Every toast now sits on its own ground, a step above the page (near black in dark), with the menu's drop shadow and no inset highlight, in place of `material-menu`. Default and loading toasts get the same light in the foreground ink, at half the strength. New token `--status-glow` sets the glow's strength (11% light, 18% dark).
8
+
3
9
  ## 0.6.1
4
10
 
5
11
  No changes in this release.
@@ -25,7 +25,7 @@ export interface ToastOptions extends Omit<ToastManagerAddOptions<object>, "type
25
25
  /** The `toast` API: call it for a default toast, or use a typed shortcut. */
26
26
  export interface ToastApi {
27
27
  (title: React.ReactNode, options?: ToastOptions): string;
28
- /** A green check. The surface stays the menu material. */
28
+ /** A green check, a green-tinted edge and a soft glow behind it, on the toast's own ground. */
29
29
  success: (title: React.ReactNode, options?: ToastOptions) => string;
30
30
  /** An amber triangle: done, but something needs a look ("Saved, 2 images were too large"). */
31
31
  warning: (title: React.ReactNode, options?: ToastOptions) => string;
@@ -157,7 +157,7 @@ function useIsPrimaryToaster(manager) {
157
157
  /* ── Rendering ─────────────────────────────────────────────────────────────── */
158
158
  const icons = {
159
159
  default: null,
160
- /* Status colour shows on the icon only: the title says what happened. */
160
+ /* Status colour on the icon, the edge and the glow behind the icon (parts/overlays.css); the title says what happened. */
161
161
  success: _jsx(CircleCheckIcon, { "aria-hidden": true, className: "size-4 text-success" }),
162
162
  warning: _jsx(TriangleAlertIcon, { "aria-hidden": true, className: "size-4 text-warning" }),
163
163
  info: _jsx(InfoIcon, { "aria-hidden": true, className: "size-4 text-info" }),
@@ -170,7 +170,7 @@ function ToastItem({ toast: item, closeLabel, rtl }) {
170
170
  const icon = icons[type] ?? null;
171
171
  return (_jsx(BaseToast.Root, { toast: item, "data-slot": "toast", "data-type": type,
172
172
  // Away from the page, toward the corner's edge: the left one in a right-to-left page.
173
- swipeDirection: rtl ? ["down", "left"] : ["down", "right"], className: "rounded-button material-menu font-body outline-none", children: _jsxs(BaseToast.Content, { "data-slot": "toast-content", className: "flex items-start gap-3 overflow-hidden p-4 pe-11", children: [icon && _jsx("span", { className: "flex h-5 shrink-0 items-center", children: icon }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 break-words", children: [_jsx(BaseToast.Title, { "data-slot": "toast-title", className: "font-body text-sm leading-5 font-medium tracking-normal text-foreground" }), _jsx(BaseToast.Description, { "data-slot": "toast-description", className: "text-13 leading-normal text-muted-foreground first:text-sm first:leading-5 first:text-foreground" }), _jsx(BaseToast.Action, { "data-slot": "toast-action", className: "mt-2.5 inline-flex min-h-(--control-h-sm) cursor-pointer items-center self-start rounded-button material-raised px-3 text-13 font-medium focus-ring" })] }), _jsx(BaseToast.Close, { "data-slot": "toast-close", "aria-label": closeLabel, className: "absolute end-3 top-3 inline-flex size-6 cursor-pointer items-center justify-center rounded-full material-row text-muted-foreground focus-ring", children: _jsx(XIcon, { "aria-hidden": true, className: "size-3.5" }) })] }) }));
173
+ swipeDirection: rtl ? ["down", "left"] : ["down", "right"], className: "rounded-button font-body outline-none", children: _jsxs(BaseToast.Content, { "data-slot": "toast-content", className: "relative flex items-start gap-3 overflow-hidden p-4 pe-11", children: [icon && _jsx("span", { className: "flex h-5 shrink-0 items-center", children: icon }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 break-words", children: [_jsx(BaseToast.Title, { "data-slot": "toast-title", className: "font-body text-sm leading-5 font-medium tracking-normal text-foreground" }), _jsx(BaseToast.Description, { "data-slot": "toast-description", className: "text-13 leading-normal text-muted-foreground first:text-sm first:leading-5 first:text-foreground" }), _jsx(BaseToast.Action, { "data-slot": "toast-action", className: "mt-2.5 inline-flex min-h-(--control-h-sm) cursor-pointer items-center self-start rounded-button material-raised px-3 text-13 font-medium focus-ring" })] }), _jsx(BaseToast.Close, { "data-slot": "toast-close", "aria-label": closeLabel, className: "absolute end-3 top-3 inline-flex size-6 cursor-pointer items-center justify-center rounded-full material-row text-muted-foreground focus-ring", children: _jsx(XIcon, { "aria-hidden": true, className: "size-3.5" }) })] }) }));
174
174
  }
175
175
  function ToastList({ manager, closeLabel, rtl }) {
176
176
  const { toasts } = BaseToast.useToastManager();
@@ -7,7 +7,7 @@ description: Build interfaces with the zon design system (@zonsh/ui) — Base UI
7
7
 
8
8
  The zon component library: React 19 + Base UI 1.x + Tailwind v4, styled in the
9
9
  zon material (layered primary, raised secondary, recessed fields, hairline structure).
10
- Version 0.6.1. 124 components.
10
+ Version 0.7.0. 124 components.
11
11
 
12
12
  > **Building a landing page, marketing site, waitlist, shop front or product page?** Read
13
13
  > `references/marketing.md` first. It has the hero variants, a library of section patterns
@@ -53,7 +53,7 @@ export function Types() {
53
53
  }
54
54
  ```
55
55
 
56
- A brief message about something that just happened. Toasts stack bottom-right (full width on mobile), expand on hover or focus, and swipe away. Every type is neutral `material-menu` at 12px; status is the icon alone, in `--success`, `--warning`, `--info` or `--destructive`. `loading` has a spinner and stays until updated.
56
+ A brief message about something that just happened. Toasts stack bottom-right (full width on mobile), expand on hover or focus, and swipe away. Every type sits on its own ground at 12px: a step above the page, near black in dark and near white in light, with the menu's drop shadow and no inset highlight. A status toast (`success`, `warning`, `info`, `error`) carries its colour, `--success`, `--warning`, `--info` or `--destructive`, as light: the icon, a 1px edge tinted toward it and a soft glow that fills the start side, top to bottom, and fades out before the text (its strength is `--status-glow`, 11% light and 18% dark). A default or loading toast gets the same light in the foreground ink at half the strength: lit, but saying nothing. `loading` has a spinner and stays until updated.
57
57
 
58
58
  ## Usage
59
59
 
@@ -204,7 +204,7 @@ Only the first `Toaster` per manager renders, so toasts never double. Right to l
204
204
 
205
205
  - **Do** write the outcome as a sentence: "Your changes are saved."; in an error, what to do next.
206
206
  - **Do** use each type only for its status, never for emphasis.
207
- - **Don't** colour the surface, border or text.
207
+ - **Don't** colour the surface or the text, or give a default toast a status colour: colour is the status, nothing else.
208
208
  - **Don't** toast every click, stack more than three, or put the only path to something in a toast.
209
209
 
210
210
  ## Accessibility
@@ -43,6 +43,7 @@ Use utilities generated from these tokens (`bg-control-hover`, `text-foreground-
43
43
  hue at the edge of sRGB, the most chroma an sRGB screen shows at this lightness. */
44
44
  --destructive: oklch(0.55 0.224 27.325); /* errors, failed, destructive actions */
45
45
  --success: oklch(0.505 0.133 152); /* saved, sent, connected, complete */
46
+ --status-glow: 11%; /* how strongly a status colour tints the light it casts (a status toast's glow) */
46
47
  --warning: oklch(0.53 0.12 65); /* needs attention soon: nearly full, partial, expiring */
47
48
  --info: oklch(0.52 0.15 250); /* neutral news: selected, unsaved, in progress, new */
48
49
 
@@ -175,7 +176,6 @@ Use utilities generated from these tokens (`bg-control-hover`, `text-foreground-
175
176
  --card-space-md: 40px; /* and from 48rem */
176
177
  --drag-lift: 1.02; /* the scale of a dragged item */
177
178
 
178
-
179
179
  --container: 80rem;
180
180
  --gutter: 24px;
181
181
  --section-pad: clamp(3.5rem, 7vw, 7rem);
@@ -262,6 +262,7 @@ Use utilities generated from these tokens (`bg-control-hover`, `text-foreground-
262
262
  --accent-foreground: oklch(0.985 0 0);
263
263
  --destructive: oklch(0.704 0.191 22.216);
264
264
  --success: oklch(0.76 0.16 152);
265
+ --status-glow: 18%;
265
266
  --warning: oklch(0.78 0.15 75);
266
267
  --info: oklch(0.74 0.14 245);
267
268
  --tone-blue: oklch(0.74 0.14 245);
@@ -333,11 +334,14 @@ Use utilities generated from these tokens (`bg-control-hover`, `text-foreground-
333
334
  .theme-dark,
334
335
  .theme-night {
335
336
  --primary-shadow:
336
- 0 4px 4px #00000073, 0 0 0 1px #000000, inset 0 4px 7px oklch(from var(--primary-fill) calc(l + 0.17) calc(c * 0.8) h),
337
- inset 0 0 0 1px oklch(from var(--primary-fill) calc(l + 0.17) calc(c * 0.8) h / 0.9), inset 0 -8px 14px #0000000b;
337
+ 0 4px 4px #00000073, 0 0 0 1px #000000,
338
+ inset 0 4px 7px oklch(from var(--primary-fill) calc(l + 0.17) calc(c * 0.8) h),
339
+ inset 0 0 0 1px oklch(from var(--primary-fill) calc(l + 0.17) calc(c * 0.8) h / 0.9),
340
+ inset 0 -8px 14px #0000000b;
338
341
  --primary-shadow-pressed:
339
342
  0 0 0 #00000000, 0 0 0 1px #000000, inset 0 2px 6px #00000059,
340
- inset 0 0 0 1px oklch(from var(--primary-fill-pressed) calc(l + 0.1) calc(c * 0.8) h), inset 0 -8px 14px #00000000;
343
+ inset 0 0 0 1px oklch(from var(--primary-fill-pressed) calc(l + 0.1) calc(c * 0.8) h),
344
+ inset 0 -8px 14px #00000000;
341
345
  }
342
346
  }
343
347
 
@@ -161,6 +161,53 @@
161
161
  opacity calc(var(--duration) * 2) var(--ease),
162
162
  height var(--duration) var(--ease);
163
163
 
164
+ /*
165
+ * The toast is its own material: a ground a step above the page (near black in dark, near
166
+ * white in light), a 1px edge tinted toward its tone, the menu's drop shadow and no inset
167
+ * highlight, and a light that fills the start side, top to bottom, behind the icon and fades
168
+ * out before the text. A status toast's tone is its status colour (colour for meaning in its small forms:
169
+ * an edge, a 10–20% tint, never a coloured card); a default or loading toast's is the
170
+ * foreground ink, at half the strength, so it is lit without saying anything. --status-glow is
171
+ * the tint's strength in each theme (tokens.css).
172
+ */
173
+ --toast-tone: var(--foreground);
174
+ --toast-glow: calc(var(--status-glow) * 0.5);
175
+ --toast-edge: 14%;
176
+ --toast-ground: color-mix(in oklab, var(--control-menu) 40%, var(--background));
177
+ --toast-glow-to: right;
178
+ &:dir(rtl) {
179
+ --toast-glow-to: left;
180
+ }
181
+ &[data-type="success"] {
182
+ --toast-tone: var(--success);
183
+ }
184
+ &[data-type="warning"] {
185
+ --toast-tone: var(--warning);
186
+ }
187
+ &[data-type="info"] {
188
+ --toast-tone: var(--info);
189
+ }
190
+ &[data-type="error"] {
191
+ --toast-tone: var(--destructive);
192
+ }
193
+ &:is([data-type="success"], [data-type="warning"], [data-type="info"], [data-type="error"]) {
194
+ --toast-glow: var(--status-glow);
195
+ --toast-edge: 32%;
196
+ }
197
+ color: var(--foreground);
198
+ border: 1px solid color-mix(in oklab, var(--toast-tone) var(--toast-edge), var(--field-edge));
199
+ background:
200
+ linear-gradient(
201
+ to var(--toast-glow-to),
202
+ color-mix(in oklab, var(--toast-tone) var(--toast-glow), transparent),
203
+ color-mix(in oklab, var(--toast-tone) calc(var(--toast-glow) * 0.4), transparent) 4rem,
204
+ transparent 10rem
205
+ ),
206
+ var(--toast-ground);
207
+ box-shadow:
208
+ 0 12px 32px #0003,
209
+ 0 2px 6px #0000001a;
210
+
164
211
  /* Bridges the gap between expanded toasts so hover doesn't flicker. */
165
212
  &::after {
166
213
  content: "";
@@ -223,7 +270,7 @@
223
270
  */
224
271
  @media (prefers-reduced-motion: reduce) {
225
272
  [data-slot="drawer-backdrop"],
226
- [data-slot="action-sheet-backdrop"][data-presentation="sheet"] {
273
+ [data-slot="action-sheet-backdrop"][data-presentation="sheet"] {
227
274
  transition: opacity var(--duration-fade) var(--ease);
228
275
 
229
276
  &[data-ending-style],
@@ -236,7 +283,7 @@
236
283
  }
237
284
 
238
285
  [data-slot="drawer-content"],
239
- [data-slot="action-sheet-content"][data-presentation="sheet"] {
286
+ [data-slot="action-sheet-content"][data-presentation="sheet"] {
240
287
  transition:
241
288
  opacity var(--duration-fade) var(--ease),
242
289
  transform 0s,
@@ -35,6 +35,7 @@
35
35
  hue at the edge of sRGB, the most chroma an sRGB screen shows at this lightness. */
36
36
  --destructive: oklch(0.55 0.224 27.325); /* errors, failed, destructive actions */
37
37
  --success: oklch(0.505 0.133 152); /* saved, sent, connected, complete */
38
+ --status-glow: 11%; /* how strongly a status colour tints the light it casts (a status toast's glow) */
38
39
  --warning: oklch(0.53 0.12 65); /* needs attention soon: nearly full, partial, expiring */
39
40
  --info: oklch(0.52 0.15 250); /* neutral news: selected, unsaved, in progress, new */
40
41
 
@@ -167,7 +168,6 @@
167
168
  --card-space-md: 40px; /* and from 48rem */
168
169
  --drag-lift: 1.02; /* the scale of a dragged item */
169
170
 
170
-
171
171
  --container: 80rem;
172
172
  --gutter: 24px;
173
173
  --section-pad: clamp(3.5rem, 7vw, 7rem);
@@ -254,6 +254,7 @@
254
254
  --accent-foreground: oklch(0.985 0 0);
255
255
  --destructive: oklch(0.704 0.191 22.216);
256
256
  --success: oklch(0.76 0.16 152);
257
+ --status-glow: 18%;
257
258
  --warning: oklch(0.78 0.15 75);
258
259
  --info: oklch(0.74 0.14 245);
259
260
  --tone-blue: oklch(0.74 0.14 245);
@@ -325,11 +326,14 @@
325
326
  .theme-dark,
326
327
  .theme-night {
327
328
  --primary-shadow:
328
- 0 4px 4px #00000073, 0 0 0 1px #000000, inset 0 4px 7px oklch(from var(--primary-fill) calc(l + 0.17) calc(c * 0.8) h),
329
- inset 0 0 0 1px oklch(from var(--primary-fill) calc(l + 0.17) calc(c * 0.8) h / 0.9), inset 0 -8px 14px #0000000b;
329
+ 0 4px 4px #00000073, 0 0 0 1px #000000,
330
+ inset 0 4px 7px oklch(from var(--primary-fill) calc(l + 0.17) calc(c * 0.8) h),
331
+ inset 0 0 0 1px oklch(from var(--primary-fill) calc(l + 0.17) calc(c * 0.8) h / 0.9),
332
+ inset 0 -8px 14px #0000000b;
330
333
  --primary-shadow-pressed:
331
334
  0 0 0 #00000000, 0 0 0 1px #000000, inset 0 2px 6px #00000059,
332
- inset 0 0 0 1px oklch(from var(--primary-fill-pressed) calc(l + 0.1) calc(c * 0.8) h), inset 0 -8px 14px #00000000;
335
+ inset 0 0 0 1px oklch(from var(--primary-fill-pressed) calc(l + 0.1) calc(c * 0.8) h),
336
+ inset 0 -8px 14px #00000000;
333
337
  }
334
338
  }
335
339
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonsh/ui",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "zon component library — Base UI primitives in the zon material.",
5
5
  "license": "MIT",
6
6
  "repository": {