@lanfermann/ui 0.6.0 → 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.
Files changed (53) hide show
  1. package/dist/components/accordion/accordion.d.ts +11 -3
  2. package/dist/components/accordion/accordion.js +15 -10
  3. package/dist/components/action-bar/action-bar.d.ts +2 -1
  4. package/dist/components/action-bar/action-bar.js +3 -2
  5. package/dist/components/attachment/attachment.d.ts +6 -1
  6. package/dist/components/attachment/attachment.js +64 -31
  7. package/dist/components/attachment/kinds.js +44 -2
  8. package/dist/components/button-group/button-group-variants.d.ts +4 -3
  9. package/dist/components/button-group/button-group-variants.js +13 -12
  10. package/dist/components/button-group/button-group.d.ts +3 -3
  11. package/dist/components/button-group/button-group.js +3 -3
  12. package/dist/components/card/card.d.ts +9 -1
  13. package/dist/components/card/card.js +14 -2
  14. package/dist/components/checkbox-card/checkbox-card.js +3 -2
  15. package/dist/components/collapsible/collapsible.js +7 -3
  16. package/dist/components/combobox/combobox.d.ts +3 -1
  17. package/dist/components/combobox/combobox.js +45 -30
  18. package/dist/components/copy-page/copy-page.d.ts +4 -4
  19. package/dist/components/copy-page/copy-page.js +9 -19
  20. package/dist/components/menu/menu.d.ts +20 -8
  21. package/dist/components/menu/menu.js +51 -29
  22. package/dist/components/message/message.d.ts +10 -2
  23. package/dist/components/message/message.js +20 -8
  24. package/dist/components/navigation-menu/navigation-menu.d.ts +7 -1
  25. package/dist/components/navigation-menu/navigation-menu.js +11 -4
  26. package/dist/components/otp-field/otp-field.js +46 -11
  27. package/dist/components/radio-card/radio-card.js +3 -2
  28. package/dist/components/segmented-control/segmented-control.js +29 -16
  29. package/dist/components/select/select.d.ts +4 -3
  30. package/dist/components/select/select.js +15 -10
  31. package/dist/components/stat/stat.d.ts +3 -1
  32. package/dist/components/stat/stat.js +3 -1
  33. package/dist/components/steps/steps.js +5 -2
  34. package/dist/components/time-field/time-field.js +6 -5
  35. package/dist/components/toggle/toggle.d.ts +5 -2
  36. package/dist/components/toggle/toggle.js +13 -5
  37. package/dist/components/toolbar/toolbar.d.ts +9 -2
  38. package/dist/components/toolbar/toolbar.js +18 -5
  39. package/dist/components/trace/trace.js +1 -1
  40. package/dist/internal/choice-card.js +27 -11
  41. package/dist/internal/disclosure.js +15 -3
  42. package/dist/internal/key-tip.js +18 -0
  43. package/dist/internal/list-mark.js +39 -0
  44. package/dist/internal/number-places.js +4 -3
  45. package/dist/internal/rule.js +2 -1
  46. package/dist/internal/tile.js +23 -0
  47. package/dist/lib/cn.js +10 -4
  48. package/package.json +1 -1
  49. package/src/styles/accordion.css +176 -0
  50. package/src/styles/depth.css +104 -32
  51. package/src/styles/motion.css +3 -0
  52. package/src/styles/segmented.css +14 -7
  53. package/src/styles.css +1 -0
@@ -6,7 +6,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Fragment as Fragment$1, useEffect, useRef, useState } from "react";
7
7
  import { OTPField } from "@base-ui/react/otp-field";
8
8
  // src/components/otp-field/otp-field.tsx
9
- /** How long a halo takes to open (`snap`), after which it hops between slots at once. */
9
+ /**
10
+ * In separate slots, how long a slot's own halo takes to open (`snap`), after which it hops
11
+ * between them at once. A joined field's one halo glides instead (`otp-field-halo`).
12
+ */
10
13
  const ENTERED_MS = 140;
11
14
  /** How long the slots count as filled in one go, so the digits of a paste seat one by one. */
12
15
  const BURST_MS = 480;
@@ -28,12 +31,8 @@ const joinedGroup = [
28
31
  "has-[input[data-invalid]]:[--depth-field-edge:var(--lf-danger)]",
29
32
  "has-[input[data-disabled]]:bg-disabled has-[input[data-disabled]]:depth-flat"
30
33
  ].join(" ");
31
- /** A slot inside that socket: a hairline to its left, and the halo is its own. */
32
- const joinedSlot = [
33
- "border-hairline not-first:border-l first:rounded-l-md last:rounded-r-md",
34
- "transition-[box-shadow] spring-snap has-[input:focus]:z-1 has-[input:focus]:shadow-field-focus",
35
- "has-[input[data-invalid]:focus]:shadow-field-invalid"
36
- ].join(" ");
34
+ /** A slot inside that socket: a hairline to its left. The halo is the field's own piece. */
35
+ const joinedSlot = "border-hairline not-first:border-l first:rounded-l-md last:rounded-r-md";
37
36
  /**
38
37
  * A one-time code: the six digits from a text message or an authenticator app. Every character
39
38
  * has a slot, in threes, the way a code is read out. The slot that is being typed wears the
@@ -58,12 +57,38 @@ function OtpField({ length = 6, groupSize = 3, variant = "joined", fill = false,
58
57
  clearTimeout(entering.current);
59
58
  clearTimeout(bursting.current);
60
59
  }, []);
60
+ const halo = useRef(null);
61
+ const joined = variant === "joined";
62
+ const placeHalo = (slot, arriving) => {
63
+ const piece = halo.current;
64
+ if (!piece || !slot) return;
65
+ if (arriving) piece.dataset.instant = "";
66
+ piece.style.setProperty("--halo-x", String(slot.offsetLeft));
67
+ piece.style.setProperty("--halo-y", String(slot.offsetTop));
68
+ piece.style.setProperty("--halo-w", String(slot.offsetWidth));
69
+ piece.style.setProperty("--halo-h", String(slot.offsetHeight));
70
+ piece.dataset.shown = "";
71
+ if (arriving) requestAnimationFrame(() => delete piece.dataset.instant);
72
+ };
73
+ const slotOf = (target) => target instanceof HTMLElement ? target.closest("[data-slot=\"otp-field-slot\"]") : null;
74
+ const root = useRef(null);
75
+ useEffect(() => {
76
+ const box = root.current;
77
+ if (!joined || !box) return;
78
+ const observer = new ResizeObserver(() => {
79
+ if (halo.current?.dataset.shown === void 0) return;
80
+ placeHalo(slotOf(document.activeElement), true);
81
+ });
82
+ observer.observe(box);
83
+ return () => observer.disconnect();
84
+ }, [joined]);
61
85
  const groups = [];
62
86
  for (let index = 0; index < length; index++) {
63
87
  const group = groupSize > 0 ? Math.floor(index / groupSize) : 0;
64
88
  (groups[group] ??= []).push(index);
65
89
  }
66
- return /* @__PURE__ */ jsx(OTPField.Root, {
90
+ return /* @__PURE__ */ jsxs(OTPField.Root, {
91
+ ref: root,
67
92
  "data-slot": "otp-field",
68
93
  "data-variant": variant,
69
94
  "data-live": live ? "" : void 0,
@@ -72,7 +97,7 @@ function OtpField({ length = 6, groupSize = 3, variant = "joined", fill = false,
72
97
  length,
73
98
  mask,
74
99
  "data-fill": fill ? "" : void 0,
75
- className: cn("group/otp items-center gap-2", fill ? "flex w-full" : "inline-flex w-fit", className),
100
+ className: cn("group/otp relative items-center gap-2", fill ? "flex w-full" : "inline-flex w-fit", className),
76
101
  onValueChange: (value, details) => {
77
102
  if (value.length - lastLength.current > 1) {
78
103
  clearTimeout(bursting.current);
@@ -85,17 +110,22 @@ function OtpField({ length = 6, groupSize = 3, variant = "joined", fill = false,
85
110
  onFocus: (event) => {
86
111
  clearTimeout(entering.current);
87
112
  entering.current = setTimeout(() => setEntered(true), ENTERED_MS);
113
+ if (joined) {
114
+ const from = event.relatedTarget;
115
+ placeHalo(slotOf(event.target), !(from instanceof Node && event.currentTarget.contains(from)));
116
+ }
88
117
  onFocus?.(event);
89
118
  },
90
119
  onBlur: (event) => {
91
120
  if (!event.currentTarget.contains(event.relatedTarget)) {
92
121
  clearTimeout(entering.current);
93
122
  setEntered(false);
123
+ if (halo.current) delete halo.current.dataset.shown;
94
124
  }
95
125
  onBlur?.(event);
96
126
  },
97
127
  ...props,
98
- children: groups.map((slots, group) => /* @__PURE__ */ jsxs(Fragment$1, { children: [group > 0 && /* @__PURE__ */ jsx(OTPField.Separator, {
128
+ children: [groups.map((slots, group) => /* @__PURE__ */ jsxs(Fragment$1, { children: [group > 0 && /* @__PURE__ */ jsx(OTPField.Separator, {
99
129
  "data-slot": "otp-field-separator",
100
130
  className: "h-px w-2 shrink-0 bg-line forced-colors:bg-[CanvasText]"
101
131
  }), /* @__PURE__ */ jsx("span", {
@@ -120,7 +150,12 @@ function OtpField({ length = 6, groupSize = 3, variant = "joined", fill = false,
120
150
  }, state.value)]
121
151
  })
122
152
  }, index))
123
- })] }, slots[0]))
153
+ })] }, slots[0])), joined && /* @__PURE__ */ jsx("span", {
154
+ ref: halo,
155
+ "aria-hidden": true,
156
+ "data-slot": "otp-field-halo",
157
+ className: cn("pointer-events-none absolute top-0 left-0 z-1 rounded-md opacity-0 shadow-field-focus", "h-[calc(var(--halo-h,0)*1px)] w-[calc(var(--halo-w,0)*1px)]", "[translate:calc(var(--halo-x,0)*1px)_calc(var(--halo-y,0)*1px)]", "group-has-[input[data-invalid]]/otp:shadow-field-invalid", "[transition:translate_var(--transition-duration-spring-snap)_var(--ease-spring-snap),opacity_var(--transition-duration-spring-snap)_var(--ease-spring-snap)]", "data-instant:[transition:opacity_var(--transition-duration-spring-snap)_var(--ease-spring-snap)]", "motion-reduce:[transition:opacity_var(--transition-duration-spring-snap)_var(--ease-spring-snap)]", "data-shown:opacity-100", "forced-colors:hidden")
158
+ })]
124
159
  });
125
160
  }
126
161
  export { OtpField };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { ChoiceCardBody, choiceCard, choiceControl } from "../../internal/choice-card.js";
2
+ import { ChoiceCardBody, choiceCard, choiceControl, followPointer } from "../../internal/choice-card.js";
3
3
  import { cn } from "../../lib/cn.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { useId } from "react";
@@ -21,7 +21,8 @@ function RadioCard({ title, description, detail, icon, chosen = "edge", classNam
21
21
  const descriptionId = useId();
22
22
  return /* @__PURE__ */ jsxs("label", {
23
23
  "data-slot": "radio-card",
24
- className: cn(choiceCard, chosen === "edge" && "has-[[data-slot=choice-control][data-checked]]:depth-card-chosen", className),
24
+ onPointerMove: followPointer,
25
+ className: cn(choiceCard, chosen === "edge" && "has-[[data-slot=choice-control][data-checked]]:depth-bevel-chosen", className),
25
26
  children: [/* @__PURE__ */ jsx(Radio.Root, {
26
27
  "data-slot": "choice-control",
27
28
  "aria-labelledby": titleId,
@@ -92,11 +92,11 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
92
92
  width: track.offsetWidth,
93
93
  height: track.offsetHeight
94
94
  };
95
- track.style.setProperty("--track-width", `${size.width}px`);
96
- track.style.setProperty("--track-height", `${size.height}px`);
95
+ track.style.setProperty("--track-width", String(size.width));
96
+ track.style.setProperty("--track-height", String(size.height));
97
97
  if (!box) return void 0;
98
- track.style.setProperty("--thumb-left", `${box.left}px`);
99
- track.style.setProperty("--thumb-width", `${box.width}px`);
98
+ track.style.setProperty("--thumb-left", String(box.left));
99
+ track.style.setProperty("--thumb-width", String(box.width));
100
100
  return box;
101
101
  };
102
102
  const before = lastLeft.current;
@@ -106,8 +106,11 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
106
106
  if (!wasDropped) delete track.dataset.following;
107
107
  const box = place();
108
108
  const now = box?.left;
109
+ cancelAnimationFrame(leanFrame.current);
110
+ track.style.setProperty("--thumb-lean", "0");
111
+ track.style.setProperty("--thumb-s", "1");
112
+ delete track.dataset.moving;
109
113
  if (inertia && box && now !== void 0 && before !== void 0 && now !== before && track.hasAttribute("data-placed") && !reduced) {
110
- track.style.setProperty("--thumb-lean", "0px");
111
114
  busyUntil.current = performance.now() + 320;
112
115
  if (!wasDropped) {
113
116
  track.style.setProperty("--thumb-hold", now > before ? "1" : "-1");
@@ -128,7 +131,7 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
128
131
  const observer = new ResizeObserver(() => {
129
132
  const segment = pressed();
130
133
  if (!segment || drag.current?.moved) return;
131
- if (track.style.getPropertyValue("--thumb-left") === `${segment.offsetLeft}px` && track.style.getPropertyValue("--thumb-width") === `${segment.offsetWidth}px` && track.style.getPropertyValue("--track-width") === `${track.offsetWidth}px`) return;
134
+ if (track.style.getPropertyValue("--thumb-left") === String(segment.offsetLeft) && track.style.getPropertyValue("--thumb-width") === String(segment.offsetWidth) && track.style.getPropertyValue("--track-width") === String(track.offsetWidth)) return;
132
135
  track.dataset.settling = "";
133
136
  lastLeft.current = place()?.left;
134
137
  cancelAnimationFrame(settle);
@@ -149,6 +152,15 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
149
152
  cancelAnimationFrame(leanFrame.current);
150
153
  }, []);
151
154
  const still = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches;
155
+ /**
156
+ * How many viewport pixels one of the track's layout pixels takes: more than 1 under a zoomed
157
+ * ancestor or a scaled one. Pointer positions are viewport pixels and the places written onto
158
+ * the track are layout pixels, so a pointer's way is divided by this before it is used.
159
+ */
160
+ function zoomOf(track) {
161
+ const drawn = track.getBoundingClientRect().width;
162
+ return drawn > 0 && track.offsetWidth > 0 ? drawn / track.offsetWidth : 1;
163
+ }
152
164
  /** The first and the last place the thumb can stand at, as offsets in the track. */
153
165
  function walls(track) {
154
166
  const segments = track.querySelectorAll("[data-slot=\"segment\"]");
@@ -165,12 +177,12 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
165
177
  const wall = walls(track);
166
178
  if (!segment || !wall || performance.now() < busyUntil.current || still()) return;
167
179
  const box = segment.getBoundingClientRect();
168
- const offset = x < box.left ? x - box.left : x > box.right ? x - box.right : 0;
180
+ const offset = (x < box.left ? x - box.left : x > box.right ? x - box.right : 0) / zoomOf(track);
169
181
  const room = offset > 0 ? wall.end - segment.offsetLeft - segment.offsetWidth : segment.offsetLeft - wall.start;
170
182
  const shape = leanShape(offset, segment.offsetWidth, room);
171
183
  track.dataset.following = "";
172
184
  track.dataset.moving = "";
173
- track.style.setProperty("--thumb-lean", `${shape.shift.toFixed(2)}px`);
185
+ track.style.setProperty("--thumb-lean", shape.shift.toFixed(2));
174
186
  track.style.setProperty("--thumb-s", shape.stretch.toFixed(3));
175
187
  if (shape.stretch !== 1) track.style.setProperty("--thumb-hold", String(shape.hold));
176
188
  }
@@ -185,7 +197,7 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
185
197
  const track = event.currentTarget;
186
198
  cancelAnimationFrame(leanFrame.current);
187
199
  if (!inertia || drag.current?.moved || performance.now() < busyUntil.current) return;
188
- track.style.setProperty("--thumb-lean", "0px");
200
+ track.style.setProperty("--thumb-lean", "0");
189
201
  track.style.setProperty("--thumb-s", "1");
190
202
  }
191
203
  function grab(event) {
@@ -210,6 +222,7 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
210
222
  pointer: event.pointerId,
211
223
  startX: event.clientX,
212
224
  startMiddle: left + width / 2,
225
+ zoom: zoomOf(track),
213
226
  boxes: segments.map((each) => ({
214
227
  value: each.getAttribute("data-value"),
215
228
  left: each.offsetLeft,
@@ -227,12 +240,12 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
227
240
  if (!held || held.pointer !== event.pointerId) return lean(event);
228
241
  const track = event.currentTarget;
229
242
  if (event.buttons === 0 && !track.hasPointerCapture(event.pointerId)) return drop(event);
230
- const dx = event.clientX - held.startX;
243
+ const dx = (event.clientX - held.startX) / held.zoom;
231
244
  if (!held.moved && Math.abs(dx) < DRAG_SLOP) return;
232
245
  if (!held.moved) {
233
246
  held.moved = true;
234
247
  cancelAnimationFrame(leanFrame.current);
235
- track.style.setProperty("--thumb-lean", "0px");
248
+ track.style.setProperty("--thumb-lean", "0");
236
249
  track.style.setProperty("--thumb-s", "1");
237
250
  track.dataset.following = "";
238
251
  track.dataset.dragging = "";
@@ -254,8 +267,8 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
254
267
  const left = Math.min(Math.max(wish - width / 2, first.left), last.left + last.width - width);
255
268
  held.left = left;
256
269
  held.width = width;
257
- track.style.setProperty("--thumb-width", `${width.toFixed(2)}px`);
258
- track.style.setProperty("--thumb-left", `${left.toFixed(2)}px`);
270
+ track.style.setProperty("--thumb-width", width.toFixed(2));
271
+ track.style.setProperty("--thumb-left", left.toFixed(2));
259
272
  if (still()) return;
260
273
  held.motion = trackMotion(held.motion, left + width / 2, event.timeStamp, width, pillGive(width));
261
274
  const room = held.motion.direction > 0 ? left - first.left : last.left + last.width - left - width;
@@ -294,8 +307,8 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
294
307
  } else {
295
308
  const pressed = track.querySelector("[data-slot=\"segment\"][data-pressed]");
296
309
  if (pressed) {
297
- track.style.setProperty("--thumb-left", `${pressed.offsetLeft}px`);
298
- track.style.setProperty("--thumb-width", `${pressed.offsetWidth}px`);
310
+ track.style.setProperty("--thumb-left", String(pressed.offsetLeft));
311
+ track.style.setProperty("--thumb-width", String(pressed.offsetWidth));
299
312
  }
300
313
  lastLeft.current = pressed?.offsetLeft;
301
314
  }
@@ -357,7 +370,7 @@ function SegmentedControl({ value: valueProp, defaultValue, onValueChange, shape
357
370
  className: "absolute inset-0",
358
371
  children: /* @__PURE__ */ jsx("span", {
359
372
  "data-slot": "segment-lens-labels",
360
- className: cn("absolute left-[calc(var(--thumb-fit)*-1)] inline-flex h-(--track-height) w-(--track-width) items-center", round ? "top-[calc(var(--thumb-fit)*-1)]" : "top-[calc(-3px-var(--thumb-fit))] gap-0.5 p-[3px]"),
373
+ className: cn("absolute left-[calc(var(--thumb-fit)*-1)] inline-flex h-[calc(var(--track-height)*1px)] w-[calc(var(--track-width)*1px)] items-center", round ? "top-[calc(var(--thumb-fit)*-1)]" : "top-[calc(-3px-var(--thumb-fit))] gap-0.5 p-[3px]"),
361
374
  children: /* @__PURE__ */ jsx(TrackContext, {
362
375
  value: lens,
363
376
  children
@@ -62,9 +62,10 @@ export type SelectItemProps = Select$1.Item.Props & {
62
62
  detail?: ReactNode;
63
63
  };
64
64
  /**
65
- * One option. The chosen one carries the mark: a disc, where the others have nothing (ring to
66
- * disc, with the ring left out to keep a long list calm). An icon, if the option has one, stands
67
- * between the mark and the label; a detail stands at the right edge. Both are muted.
65
+ * One option. Its label starts at the row's left edge, where the group's label does. An icon,
66
+ * if the option has one, stands before the label; a detail stands at the right edge. Both are
67
+ * muted. The chosen one carries the disc at the right end; where the options have a detail, it
68
+ * stands on the tint instead (`listTint`).
68
69
  */
69
70
  export declare function SelectItem({ className, children, icon, detail, ...props }: SelectItemProps): import("react").JSX.Element;
70
71
  export declare const SelectGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -4,6 +4,7 @@ import { buttonGroupKeyDisabledLook, buttonGroupKeyVariants } from "../button-gr
4
4
  import { useGround } from "../ground/ground.js";
5
5
  import { Icon } from "../icon/icon.js";
6
6
  import { ChevronDownGlyph } from "../../internal/glyphs.js";
7
+ import { ListMark, listTint } from "../../internal/list-mark.js";
7
8
  import { listGroupLabel, listItem, listSeparator, listSheet, popupMotion } from "../../internal/popup.js";
8
9
  import { mergeClassName } from "../../lib/cn.js";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -150,36 +151,40 @@ function SelectContent({ className, side = "bottom", align = "start", sideOffset
150
151
  }) });
151
152
  }
152
153
  /**
153
- * One option. The chosen one carries the mark: a disc, where the others have nothing (ring to
154
- * disc, with the ring left out to keep a long list calm). An icon, if the option has one, stands
155
- * between the mark and the label; a detail stands at the right edge. Both are muted.
154
+ * One option. Its label starts at the row's left edge, where the group's label does. An icon,
155
+ * if the option has one, stands before the label; a detail stands at the right edge. Both are
156
+ * muted. The chosen one carries the disc at the right end; where the options have a detail, it
157
+ * stands on the tint instead (`listTint`).
156
158
  */
157
159
  function SelectItem({ className, children, icon, detail, ...props }) {
158
160
  const option = useContext(OptionsContext)?.find((candidate) => Object.is(candidate.value, props.value));
159
161
  const resolvedIcon = icon ?? option?.icon;
160
162
  const resolvedDetail = detail ?? option?.detail;
163
+ const tinted = resolvedDetail !== void 0;
161
164
  return /* @__PURE__ */ jsxs(Select$1.Item, {
162
165
  "data-slot": "select-item",
163
- className: mergeClassName(["group", listItem], className),
166
+ className: mergeClassName([
167
+ "group",
168
+ listItem,
169
+ tinted && listTint
170
+ ], className),
164
171
  ...props,
165
172
  children: [
166
- /* @__PURE__ */ jsx("span", {
167
- "aria-hidden": true,
168
- className: "mark mark-quiet group-data-selected:mark-on"
169
- }),
170
173
  resolvedIcon && /* @__PURE__ */ jsx(Icon, {
171
174
  icon: resolvedIcon,
172
- className: "text-fg-muted"
175
+ className: "text-fg-muted group-data-highlighted:text-fg"
173
176
  }),
174
177
  /* @__PURE__ */ jsx(Select$1.ItemText, {
175
178
  "data-slot": "select-item-text",
179
+ className: "min-w-0 truncate",
176
180
  children
177
181
  }),
178
182
  resolvedDetail !== void 0 && /* @__PURE__ */ jsx("span", {
179
183
  "data-slot": "select-item-detail",
180
184
  className: "ml-auto shrink-0 pl-3 whitespace-nowrap text-fg-muted tabular-nums",
181
185
  children: resolvedDetail
182
- })
186
+ }),
187
+ !tinted && /* @__PURE__ */ jsx(ListMark, { className: "ml-auto" })
183
188
  ]
184
189
  });
185
190
  }
@@ -51,7 +51,9 @@ export type StatChangeProps = ComponentProps<"p"> & {
51
51
  * compared with („+12 %“ „gegenüber dem Vormonat“). The arrow and the colour never carry it
52
52
  * alone: assistive tech hears „Gestiegen“ or „Gesunken“ first, and the amount has its sign.
53
53
  *
54
- * When the trend turns, the arrow turns with it.
54
+ * When the trend turns, the arrow turns with it. Where the figure changes while it is on screen,
55
+ * give the amount as a `RollingNumber` (`{ style: "percent", signDisplay: "exceptZero" }`), as
56
+ * the `StatValue` takes one: it rolls to the new amount and its sign turns over.
55
57
  */
56
58
  export declare function StatChange({ trend, tone, context, trendLabels, className, children, ...props }: StatChangeProps): import("react").JSX.Element;
57
59
  export {};
@@ -73,7 +73,9 @@ const defaultTrendLabels = {
73
73
  * compared with („+12 %“ „gegenüber dem Vormonat“). The arrow and the colour never carry it
74
74
  * alone: assistive tech hears „Gestiegen“ or „Gesunken“ first, and the amount has its sign.
75
75
  *
76
- * When the trend turns, the arrow turns with it.
76
+ * When the trend turns, the arrow turns with it. Where the figure changes while it is on screen,
77
+ * give the amount as a `RollingNumber` (`{ style: "percent", signDisplay: "exceptZero" }`), as
78
+ * the `StatValue` takes one: it rolls to the new amount and its sign turns over.
77
79
  */
78
80
  function StatChange({ trend, tone = "neutral", context, trendLabels, className, children, ...props }) {
79
81
  const labels = {
@@ -114,8 +114,11 @@ function Step({ status = "upcoming", title, description, href, render, statusLab
114
114
  children: [linked ? renderAs("a", render, {
115
115
  href,
116
116
  "data-slot": "step-title",
117
- className: cn(linkVariants({ variant: "quiet" }), "w-fit max-w-full truncate text-control leading-5 text-fg-body"),
118
- children: name
117
+ className: cn(linkVariants({ variant: "quiet" }), "w-fit max-w-full min-w-0 text-control leading-5 text-fg-body"),
118
+ children: /* @__PURE__ */ jsx("span", {
119
+ className: "block overflow-x-clip text-ellipsis whitespace-nowrap",
120
+ children: name
121
+ })
119
122
  }) : /* @__PURE__ */ jsx("span", {
120
123
  "data-slot": "step-title",
121
124
  className: cn("max-w-full truncate text-control leading-5 text-fg-muted", "[transition:color_150ms_ease-out_var(--mark-delay),font-weight_0s_linear_var(--mark-delay)]", "group-data-[status=current]/step:font-medium group-data-[status=current]/step:text-fg group-data-[status=done]/step:text-fg-body"),
@@ -5,6 +5,7 @@ import { InputGroupAddon } from "../input-group/input-group.js";
5
5
  import { fieldShell, fieldShellSize, focusFieldControl } from "../../internal/field.js";
6
6
  import { FieldShellContext } from "../../internal/field-context.js";
7
7
  import { formatTime, parseGermanTime, timeMatches, timesOfDay } from "../../internal/iso-date.js";
8
+ import { ListMark } from "../../internal/list-mark.js";
8
9
  import { listItem, listSheet, popupMotion } from "../../internal/popup.js";
9
10
  import { TypedInput, useTypedValue } from "../../internal/typed-input.js";
10
11
  import { cn } from "../../lib/cn.js";
@@ -109,11 +110,11 @@ function TimeField({ value, defaultValue, onValueChange, min, max, step = 15, ho
109
110
  value: time,
110
111
  "data-slot": "time-field-option",
111
112
  "data-time": time,
112
- className: cn(listItem, "tabular-nums"),
113
- children: [/* @__PURE__ */ jsx("span", {
114
- "aria-hidden": true,
115
- className: cn("mark", time === typed.value ? "mark-on" : "mark-quiet")
116
- }), written(time)]
113
+ className: cn("group", listItem, "tabular-nums"),
114
+ children: [written(time), /* @__PURE__ */ jsx(ListMark, {
115
+ on: time === typed.value,
116
+ className: "ml-auto"
117
+ })]
117
118
  }, time)
118
119
  })
119
120
  })
@@ -4,6 +4,8 @@ export type ToggleProps<Value extends string = string> = Omit<Toggle$1.Props<Val
4
4
  /** `secondary` (the default): a raised key. `quiet`: no face, for a toolbar. */
5
5
  variant?: "secondary" | "quiet";
6
6
  className?: string;
7
+ /** Its keyboard shortcut (`mod+b`), said after its name in a toolbar's tooltip. */
8
+ shortcut?: string;
7
9
  } & ({
8
10
  /** A square key for a single symbol. It has no visible label, so it needs a name. */
9
11
  iconOnly: true;
@@ -19,6 +21,7 @@ export type ToggleProps<Value extends string = string> = Omit<Toggle$1.Props<Val
19
21
  * Its name does not change with its state: "Fett", not "Fett ausschalten". For a setting with
20
22
  * a label beside it, a `Switch` reads better; for one choice out of a few views, a
21
23
  * `SegmentedControl`. Several toggles that belong together go into a `ToggleGroup`, where each
22
- * needs a `value`. In a `Toolbar` it joins the bar's one tab stop by itself.
24
+ * needs a `value`. In a `Toolbar` it joins the bar's one tab stop by itself, and a toggle with
25
+ * only a symbol says its name (and its `shortcut`) in a tooltip there.
23
26
  */
24
- export declare function Toggle<Value extends string = string>({ variant, size, iconOnly, className, children, ...props }: ToggleProps<Value>): import("react").JSX.Element;
27
+ export declare function Toggle<Value extends string = string>({ variant, size, iconOnly, className, shortcut, children, ...props }: ToggleProps<Value>): import("react").JSX.Element;
@@ -2,14 +2,15 @@
2
2
  import { Button } from "../button/button.js";
3
3
  import { useButtonGroup } from "../button-group/button-group-context.js";
4
4
  import { useInToolbar } from "../toolbar/toolbar-context.js";
5
+ import { KeyTip } from "../../internal/key-tip.js";
5
6
  import { cn } from "../../lib/cn.js";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
  import { Toolbar } from "@base-ui/react/toolbar";
8
9
  import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
9
10
  // src/components/toggle/toggle.tsx
10
11
  /**
11
- * How a key shows that it is on. A key of a group keeps the inner shade of a press, so the
12
- * fitting stays rocked on it. A raised key on its own stays down: the pressed recipe without
12
+ * How a key shows that it is on. A key of a group keeps the pressed colour and the inner shade of
13
+ * a press, without its scale. A raised key on its own stays down: the pressed recipe without
13
14
  * the scale, since it has come to rest. A quiet key keeps the wash it has under the pointer and
14
15
  * its symbol stays dark; off, the symbol is muted and only darkens under the pointer.
15
16
  */
@@ -26,9 +27,10 @@ const pressedLook = {
26
27
  * Its name does not change with its state: "Fett", not "Fett ausschalten". For a setting with
27
28
  * a label beside it, a `Switch` reads better; for one choice out of a few views, a
28
29
  * `SegmentedControl`. Several toggles that belong together go into a `ToggleGroup`, where each
29
- * needs a `value`. In a `Toolbar` it joins the bar's one tab stop by itself.
30
+ * needs a `value`. In a `Toolbar` it joins the bar's one tab stop by itself, and a toggle with
31
+ * only a symbol says its name (and its `shortcut`) in a tooltip there.
30
32
  */
31
- function Toggle({ variant = "secondary", size, iconOnly, className, children, ...props }) {
33
+ function Toggle({ variant = "secondary", size, iconOnly, className, shortcut, children, ...props }) {
32
34
  const group = useButtonGroup();
33
35
  const inToolbar = useInToolbar();
34
36
  const look = cn(group ? pressedLook.key : pressedLook[variant], className);
@@ -43,11 +45,17 @@ function Toggle({ variant = "secondary", size, iconOnly, className, children, ..
43
45
  size,
44
46
  className: look
45
47
  });
46
- return /* @__PURE__ */ jsx(Toggle$1, {
48
+ const toggle = /* @__PURE__ */ jsx(Toggle$1, {
47
49
  "data-slot": "toggle",
48
50
  ...props,
49
51
  render: inToolbar ? /* @__PURE__ */ jsx(Toolbar.Button, { render: key }) : key,
50
52
  children
51
53
  });
54
+ const label = inToolbar && iconOnly ? props["aria-label"] : void 0;
55
+ return label ? /* @__PURE__ */ jsx(KeyTip, {
56
+ label,
57
+ shortcut,
58
+ trigger: toggle
59
+ }) : toggle;
52
60
  }
53
61
  export { Toggle };
@@ -13,6 +13,10 @@ export type ToolbarProps = Toolbar$1.Root.Props;
13
13
  * `ToolbarButton`s inside, `ToggleGroup`s and `Toggle`s as they are, a `ToolbarSeparator`
14
14
  * between two kinds of control, and at most one `ToolbarInput`, last, because the arrow keys
15
15
  * also move the text cursor. It is only the bar: what the keys do is the caller's.
16
+ *
17
+ * A key that shows only a symbol (`iconOnly`, a `ToolbarButton` or a `Toggle`) says its name in
18
+ * a tooltip, with its `shortcut` after it. The first waits for the pointer to rest; its
19
+ * neighbours then open at once.
16
20
  */
17
21
  export declare function Toolbar({ className, ...props }: ToolbarProps): import("react").JSX.Element;
18
22
  /** `Omit` that keeps a union a union: a key is named either by its words or by `aria-label`. */
@@ -24,12 +28,15 @@ export type ToolbarButtonProps = Without<ButtonProps, "render"> & {
24
28
  * `<MenuTrigger render={<ToolbarButton />}>`.
25
29
  */
26
30
  render?: ReactElement;
31
+ /** Its keyboard shortcut (`mod+k`), said after its name in the tooltip of a symbol key. */
32
+ shortcut?: string;
27
33
  };
28
34
  /**
29
35
  * One key of a toolbar: a quiet, small `Button` unless told otherwise. A key that cannot be
30
- * used right now stays in reach of the arrow keys and says that it is disabled.
36
+ * used right now stays in reach of the arrow keys and says that it is disabled. A key with only
37
+ * a symbol says its `aria-label` in a tooltip.
31
38
  */
32
- export declare function ToolbarButton({ render, size, variant, className, disabled, focusableWhenDisabled, ...props }: ToolbarButtonProps): import("react").JSX.Element;
39
+ export declare function ToolbarButton({ render, size, variant, className, disabled, focusableWhenDisabled, shortcut, ...props }: ToolbarButtonProps): import("react").JSX.Element;
33
40
  /** A link among the keys. It keeps link semantics and wears a quiet key. */
34
41
  export declare function ToolbarLink({ className, ...props }: Toolbar$1.Link.Props): import("react").JSX.Element;
35
42
  /** Keys that belong together inside the bar, and can be disabled together. Name the group. */
@@ -2,6 +2,8 @@
2
2
  import { Button } from "../button/button.js";
3
3
  import { buttonVariants } from "../button/button-variants.js";
4
4
  import { Input } from "../input/input.js";
5
+ import { TooltipProvider } from "../tooltip/tooltip.js";
6
+ import { KeyTip } from "../../internal/key-tip.js";
5
7
  import { cn, mergeClassName } from "../../lib/cn.js";
6
8
  import { ToolbarContext } from "./toolbar-context.js";
7
9
  import { jsx } from "react/jsx-runtime";
@@ -17,23 +19,28 @@ import { Toolbar as Toolbar$1 } from "@base-ui/react/toolbar";
17
19
  * `ToolbarButton`s inside, `ToggleGroup`s and `Toggle`s as they are, a `ToolbarSeparator`
18
20
  * between two kinds of control, and at most one `ToolbarInput`, last, because the arrow keys
19
21
  * also move the text cursor. It is only the bar: what the keys do is the caller's.
22
+ *
23
+ * A key that shows only a symbol (`iconOnly`, a `ToolbarButton` or a `Toggle`) says its name in
24
+ * a tooltip, with its `shortcut` after it. The first waits for the pointer to rest; its
25
+ * neighbours then open at once.
20
26
  */
21
27
  function Toolbar({ className, ...props }) {
22
28
  return /* @__PURE__ */ jsx(ToolbarContext, {
23
29
  value: true,
24
- children: /* @__PURE__ */ jsx(Toolbar$1.Root, {
30
+ children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(Toolbar$1.Root, {
25
31
  "data-slot": "toolbar",
26
32
  className: mergeClassName("flex flex-wrap items-center gap-1 data-[orientation=vertical]:flex-col data-[orientation=vertical]:flex-nowrap", className),
27
33
  ...props
28
- })
34
+ }) })
29
35
  });
30
36
  }
31
37
  /**
32
38
  * One key of a toolbar: a quiet, small `Button` unless told otherwise. A key that cannot be
33
- * used right now stays in reach of the arrow keys and says that it is disabled.
39
+ * used right now stays in reach of the arrow keys and says that it is disabled. A key with only
40
+ * a symbol says its `aria-label` in a tooltip.
34
41
  */
35
- function ToolbarButton({ render, size = "sm", variant = "quiet", className, disabled, focusableWhenDisabled, ...props }) {
36
- return /* @__PURE__ */ jsx(Toolbar$1.Button, {
42
+ function ToolbarButton({ render, size = "sm", variant = "quiet", className, disabled, focusableWhenDisabled, shortcut, ...props }) {
43
+ const key = /* @__PURE__ */ jsx(Toolbar$1.Button, {
37
44
  "data-slot": "toolbar-button",
38
45
  disabled,
39
46
  focusableWhenDisabled,
@@ -44,6 +51,12 @@ function ToolbarButton({ render, size = "sm", variant = "quiet", className, disa
44
51
  className: cn("shrink-0", className)
45
52
  })
46
53
  });
54
+ const label = props.iconOnly && !render ? props["aria-label"] : void 0;
55
+ return label ? /* @__PURE__ */ jsx(KeyTip, {
56
+ label,
57
+ shortcut,
58
+ trigger: key
59
+ }) : key;
47
60
  }
48
61
  /** A link among the keys. It keeps link semantics and wears a quiet key. */
49
62
  function ToolbarLink({ className, ...props }) {
@@ -94,7 +94,7 @@ function TraceLine({ status, title, meta, icon, opens }) {
94
94
  "data-slot": "trace-chevron",
95
95
  width: 10,
96
96
  height: 10,
97
- className: cn("text-fg-muted transition-[rotate,color] spring-seat group-hover:text-fg group-data-disabled:text-on-disabled", "group-data-panel-open:rotate-90")
97
+ className: cn("text-fg-muted transition-[rotate,translate,color] spring-seat group-hover:text-fg group-hover:[translate:var(--lean)] group-data-disabled:text-on-disabled", "group-data-panel-open:rotate-90")
98
98
  })
99
99
  ] });
100
100
  }
@@ -3,23 +3,39 @@ import { cn } from "../lib/cn.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  // src/internal/choice-card.tsx
5
5
  /**
6
- * The card around a radio or a checkbox: a softly raised sheet that is the control's label, so
7
- * the whole of it is the target. The sheet keeps its size and answers with its shadow: a
8
- * little higher under the pointer, down on the page under a press, while its mark dips as a
9
- * plain `Radio` or `Checkbox` does. (The whole card going down to the press scale moved a wide
10
- * sheet by ten pixels and was too heavy: Justin, 2026-11-19.) It takes the accent outline when
11
- * the keyboard is on its control, and lies flat when the control is disabled. State is read
12
- * from the control inside, which carries `data-slot="choice-control"`.
6
+ * The card around a radio or a checkbox: a bevelled card (`depth-bevel`) that is the control's
7
+ * label, so the whole of it is the target. It keeps its size and place. Under the pointer a soft
8
+ * light follows the pointer across its face (`followPointer`); edge and shadow stay. Under a
9
+ * press its shadow goes down to the page while its mark dips as a plain `Radio` or `Checkbox`
10
+ * does. (The whole card going down to the press scale was too heavy: Justin, 2026-11-19. A wide
11
+ * shadow rising under the pointer was "odd"; the light was chosen over a firmer edge and over a
12
+ * 1px lift: Justin, 2026-11-20.) It takes the accent outline when the keyboard is on its
13
+ * control, and lies flat when the control is disabled. State is read from the control inside,
14
+ * which carries `data-slot="choice-control"`.
13
15
  */
14
16
  const choiceCard = [
15
- "group/card relative flex cursor-pointer items-start gap-3 rounded-xl bg-surface p-4 text-left depth-card select-none",
17
+ "group/card relative isolate flex cursor-pointer items-start gap-3 rounded-xl bg-surface p-4 text-left depth-bevel select-none",
16
18
  "transition-[box-shadow] spring-leave not-active:has-[[data-slot=choice-control][data-checked]]:spring-settle active:spring-snap",
17
- "not-has-[[data-slot=choice-control][data-disabled]]:hover:shadow-card-hover not-has-[[data-slot=choice-control][data-disabled]]:active:shadow-card-pressed",
19
+ "not-has-[[data-slot=choice-control][data-disabled]]:active:shadow-bevel-pressed",
20
+ "before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:opacity-0",
21
+ "before:bg-[radial-gradient(240px_circle_at_var(--light-x,50%)_var(--light-y,50%),var(--depth-bevel-light),transparent_70%)]",
22
+ "before:transition-opacity before:spring-settle not-has-[[data-slot=choice-control][data-disabled]]:hover:before:opacity-100",
18
23
  "has-[[data-slot=choice-control]:focus-visible]:outline-2 has-[[data-slot=choice-control]:focus-visible]:outline-offset-2 has-[[data-slot=choice-control]:focus-visible]:outline-accent",
19
24
  "has-[[data-slot=choice-control][data-disabled]]:cursor-default has-[[data-slot=choice-control][data-disabled]]:bg-disabled has-[[data-slot=choice-control][data-disabled]]:depth-flat"
20
25
  ].join(" ");
26
+ /**
27
+ * Where the pointer is on the card, for its light: written straight onto the card as two custom
28
+ * properties, so a move never renders. Put it on the card as `onPointerMove`.
29
+ */
30
+ function followPointer(event) {
31
+ if (event.pointerType !== "mouse" && event.pointerType !== "pen") return;
32
+ const card = event.currentTarget;
33
+ const box = card.getBoundingClientRect();
34
+ card.style.setProperty("--light-x", `${event.clientX - box.left}px`);
35
+ card.style.setProperty("--light-y", `${event.clientY - box.top}px`);
36
+ }
21
37
  /** The chosen card wears the accent as its edge; it eases in on the card's own transition. */
22
- const choiceCardEdge = "has-[[data-slot=choice-control][data-checked]]:depth-card-chosen";
38
+ const choiceCardEdge = "has-[[data-slot=choice-control][data-checked]]:depth-bevel-chosen";
23
39
  /**
24
40
  * The control inside the card: a box of the check size on the title's first line. The card
25
41
  * around it takes the presses and shows the focus, so the control gives both up; it dips
@@ -62,4 +78,4 @@ function ChoiceCardBody({ slot, titleId, descriptionId, title, description, deta
62
78
  ]
63
79
  });
64
80
  }
65
- export { ChoiceCardBody, choiceCard, choiceCardEdge, choiceControl };
81
+ export { ChoiceCardBody, choiceCard, choiceCardEdge, choiceControl, followPointer };