@lanfermann/ui 0.5.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 (186) 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 +60 -0
  4. package/dist/components/action-bar/action-bar.js +117 -0
  5. package/dist/components/alert/alert.d.ts +1 -1
  6. package/dist/components/alert/alert.js +3 -17
  7. package/dist/components/alert-dialog/alert-dialog.d.ts +1 -1
  8. package/dist/components/app-shell/app-shell.d.ts +33 -0
  9. package/dist/components/app-shell/app-shell.js +93 -0
  10. package/dist/components/attachment/attachment.d.ts +51 -0
  11. package/dist/components/attachment/attachment.js +255 -0
  12. package/dist/components/attachment/kinds.d.ts +7 -0
  13. package/dist/components/attachment/kinds.js +142 -0
  14. package/dist/components/avatar/avatar.d.ts +14 -4
  15. package/dist/components/avatar/avatar.js +57 -13
  16. package/dist/components/avatar-group/avatar-group.d.ts +33 -0
  17. package/dist/components/avatar-group/avatar-group.js +110 -0
  18. package/dist/components/avatar-group/people.d.ts +12 -0
  19. package/dist/components/avatar-group/people.js +24 -0
  20. package/dist/components/badge/badge.d.ts +9 -3
  21. package/dist/components/badge/badge.js +21 -6
  22. package/dist/components/banner/banner.d.ts +39 -0
  23. package/dist/components/banner/banner.js +149 -0
  24. package/dist/components/button-group/button-group-variants.d.ts +4 -3
  25. package/dist/components/button-group/button-group-variants.js +13 -12
  26. package/dist/components/button-group/button-group.d.ts +3 -3
  27. package/dist/components/button-group/button-group.js +3 -3
  28. package/dist/components/card/card.d.ts +20 -4
  29. package/dist/components/card/card.js +32 -6
  30. package/dist/components/checkbox-card/checkbox-card.d.ts +21 -0
  31. package/dist/components/checkbox-card/checkbox-card.js +50 -0
  32. package/dist/components/chip/chip-group.d.ts +15 -0
  33. package/dist/components/chip/chip-group.js +44 -0
  34. package/dist/components/chip/chip-variants.d.ts +6 -0
  35. package/dist/components/chip/chip-variants.js +28 -0
  36. package/dist/components/chip/chip.d.ts +39 -0
  37. package/dist/components/chip/chip.js +71 -0
  38. package/dist/components/code-block/code-copy.d.ts +3 -11
  39. package/dist/components/code-block/code-copy.js +15 -62
  40. package/dist/components/code-block/code-keys.js +10 -22
  41. package/dist/components/collapsible/collapsible.js +7 -3
  42. package/dist/components/combobox/combobox.d.ts +53 -3
  43. package/dist/components/combobox/combobox.js +204 -20
  44. package/dist/components/command/command.d.ts +131 -0
  45. package/dist/components/command/command.js +335 -0
  46. package/dist/components/consent/consent-card.js +365 -0
  47. package/dist/components/consent/consent-embed.d.ts +21 -0
  48. package/dist/components/consent/consent-embed.js +111 -0
  49. package/dist/components/consent/consent-labels.d.ts +70 -0
  50. package/dist/components/consent/consent-labels.js +61 -0
  51. package/dist/components/consent/consent-record.d.ts +95 -0
  52. package/dist/components/consent/consent-record.js +112 -0
  53. package/dist/components/consent/consent-store.d.ts +26 -0
  54. package/dist/components/consent/consent-store.js +240 -0
  55. package/dist/components/consent/consent.d.ts +86 -0
  56. package/dist/components/consent/consent.js +306 -0
  57. package/dist/components/container/container.d.ts +1 -1
  58. package/dist/components/context-menu/context-menu.d.ts +23 -0
  59. package/dist/components/context-menu/context-menu.js +50 -0
  60. package/dist/components/conversation/conversation.d.ts +45 -0
  61. package/dist/components/conversation/conversation.js +295 -0
  62. package/dist/components/conversation/stick.js +23 -0
  63. package/dist/components/copy-button/copy-button.d.ts +50 -0
  64. package/dist/components/copy-button/copy-button.js +65 -0
  65. package/dist/components/copy-page/copy-page.d.ts +4 -4
  66. package/dist/components/copy-page/copy-page.js +16 -36
  67. package/dist/components/copy-pill/copy-pill.js +1 -1
  68. package/dist/components/description-list/description-list.d.ts +32 -0
  69. package/dist/components/description-list/description-list.js +51 -0
  70. package/dist/components/empty/empty.d.ts +38 -0
  71. package/dist/components/empty/empty.js +57 -0
  72. package/dist/components/field/field.js +1 -1
  73. package/dist/components/file-upload/file-upload.d.ts +96 -0
  74. package/dist/components/file-upload/file-upload.js +347 -0
  75. package/dist/components/file-upload/files.d.ts +39 -0
  76. package/dist/components/file-upload/files.js +74 -0
  77. package/dist/components/grow/grow.d.ts +15 -3
  78. package/dist/components/grow/grow.js +24 -9
  79. package/dist/components/heading/heading.d.ts +1 -1
  80. package/dist/components/icon/icon.d.ts +1 -1
  81. package/dist/components/input/input.js +1 -1
  82. package/dist/components/menu/menu.d.ts +20 -8
  83. package/dist/components/menu/menu.js +51 -29
  84. package/dist/components/message/message.d.ts +81 -0
  85. package/dist/components/message/message.js +208 -0
  86. package/dist/components/navigation-menu/navigation-menu.d.ts +7 -1
  87. package/dist/components/navigation-menu/navigation-menu.js +11 -4
  88. package/dist/components/otp-field/otp-field.d.ts +37 -0
  89. package/dist/components/otp-field/otp-field.js +161 -0
  90. package/dist/components/pagination/pagination.d.ts +50 -0
  91. package/dist/components/pagination/pagination.js +188 -0
  92. package/dist/components/prompt-input/keys.js +15 -0
  93. package/dist/components/prompt-input/prompt-input.d.ts +89 -0
  94. package/dist/components/prompt-input/prompt-input.js +331 -0
  95. package/dist/components/radio-card/radio-card.d.ts +23 -0
  96. package/dist/components/radio-card/radio-card.js +49 -0
  97. package/dist/components/rolling-number/rolling-number.d.ts +30 -0
  98. package/dist/components/rolling-number/rolling-number.js +149 -0
  99. package/dist/components/seam/seam.d.ts +1 -1
  100. package/dist/components/secret-field/secret-field.d.ts +53 -0
  101. package/dist/components/secret-field/secret-field.js +121 -0
  102. package/dist/components/section/section.d.ts +1 -1
  103. package/dist/components/segmented-control/segmented-control.js +29 -16
  104. package/dist/components/select/select.d.ts +5 -4
  105. package/dist/components/select/select.js +16 -11
  106. package/dist/components/shortcut/shortcut.d.ts +46 -0
  107. package/dist/components/shortcut/shortcut.js +87 -0
  108. package/dist/components/sidebar/sidebar-context.js +16 -0
  109. package/dist/components/sidebar/sidebar.d.ts +161 -0
  110. package/dist/components/sidebar/sidebar.js +588 -0
  111. package/dist/components/site-header/site-header.js +1 -1
  112. package/dist/components/skeleton/loaded.d.ts +21 -0
  113. package/dist/components/skeleton/loaded.js +57 -0
  114. package/dist/components/skeleton/skeleton.d.ts +43 -0
  115. package/dist/components/skeleton/skeleton.js +48 -0
  116. package/dist/components/sources/source-list.d.ts +17 -0
  117. package/dist/components/sources/source-list.js +26 -0
  118. package/dist/components/sources/sources.d.ts +45 -0
  119. package/dist/components/sources/sources.js +167 -0
  120. package/dist/components/stat/stat.d.ts +59 -0
  121. package/dist/components/stat/stat.js +112 -0
  122. package/dist/components/steps/steps.d.ts +57 -0
  123. package/dist/components/steps/steps.js +134 -0
  124. package/dist/components/table/table.d.ts +18 -9
  125. package/dist/components/table/table.js +21 -13
  126. package/dist/components/text/text.d.ts +1 -1
  127. package/dist/components/theme-switch/theme-switch.js +1 -1
  128. package/dist/components/time-field/time-field.js +7 -6
  129. package/dist/components/timeline/timeline.d.ts +45 -0
  130. package/dist/components/timeline/timeline.js +86 -0
  131. package/dist/components/toast/toast.js +10 -26
  132. package/dist/components/toggle/toggle.d.ts +27 -0
  133. package/dist/components/toggle/toggle.js +61 -0
  134. package/dist/components/toggle-group/toggle-group.d.ts +27 -0
  135. package/dist/components/toggle-group/toggle-group.js +38 -0
  136. package/dist/components/toolbar/toolbar-context.js +12 -0
  137. package/dist/components/toolbar/toolbar.d.ts +52 -0
  138. package/dist/components/toolbar/toolbar.js +105 -0
  139. package/dist/components/trace/trace.d.ts +2 -1
  140. package/dist/components/trace/trace.js +15 -27
  141. package/dist/index.d.ts +46 -3
  142. package/dist/index.js +44 -3
  143. package/dist/internal/arriving-pieces.js +56 -0
  144. package/dist/internal/arriving.js +171 -0
  145. package/dist/internal/avatar-cut.d.ts +15 -0
  146. package/dist/internal/avatar-cut.js +83 -0
  147. package/dist/internal/choice-card.d.ts +15 -0
  148. package/dist/internal/choice-card.js +81 -0
  149. package/dist/internal/clipboard.js +37 -0
  150. package/dist/internal/copy.js +58 -0
  151. package/dist/internal/disclosure.js +15 -3
  152. package/dist/internal/field.js +24 -4
  153. package/dist/internal/glyphs.js +26 -1
  154. package/dist/internal/key-tip.js +18 -0
  155. package/dist/internal/list-mark.js +39 -0
  156. package/dist/internal/live-list.js +41 -0
  157. package/dist/internal/number-places.js +157 -0
  158. package/dist/internal/picker-sheet.js +1 -1
  159. package/dist/internal/presence-dot.js +24 -0
  160. package/dist/internal/presence.js +104 -0
  161. package/dist/internal/rail-mark.d.ts +3 -0
  162. package/dist/internal/rail-mark.js +33 -0
  163. package/dist/internal/rule.js +2 -1
  164. package/dist/internal/status-icon.js +22 -0
  165. package/dist/internal/tile.js +23 -0
  166. package/dist/internal/travelling-mark.js +204 -0
  167. package/dist/lib/cn.js +10 -0
  168. package/dist/lib/shortcut.d.ts +11 -0
  169. package/dist/lib/shortcut.js +165 -0
  170. package/package.json +1 -1
  171. package/src/styles/accordion.css +176 -0
  172. package/src/styles/action-bar.css +28 -0
  173. package/src/styles/assistant.css +83 -0
  174. package/src/styles/avatar.css +24 -0
  175. package/src/styles/consent.css +65 -0
  176. package/src/styles/copy.css +12 -11
  177. package/src/styles/depth.css +120 -4
  178. package/src/styles/marks.css +20 -2
  179. package/src/styles/motion.css +3 -0
  180. package/src/styles/rail.css +49 -0
  181. package/src/styles/rolling-number.css +94 -0
  182. package/src/styles/segmented.css +14 -7
  183. package/src/styles/steps.css +98 -0
  184. package/src/styles/timeline.css +48 -0
  185. package/src/styles/travel.css +36 -0
  186. package/src/styles.css +10 -0
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { Icon } from "../components/icon/icon.js";
3
+ import { selectContents, writeClipboard } from "./clipboard.js";
4
+ import { TickGlyph } from "./glyphs.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useEffect, useRef, useState } from "react";
7
+ import { Copy01Icon } from "@hugeicons/core-free-icons";
8
+ // src/internal/copy.tsx
9
+ /** How long a copy stays confirmed before the symbol comes back, in ms. */
10
+ const COPY_SHOWN_MS = 1600;
11
+ /**
12
+ * The copy every control performs: write the text, hold the confirmation for a moment, and when
13
+ * the browser refuses, select what was to be copied instead. Draw the state with `CopyMarks`.
14
+ */
15
+ function useCopy({ text, selectTarget, onCopied, onRefused }) {
16
+ const [state, setState] = useState("idle");
17
+ const timer = useRef(void 0);
18
+ useEffect(() => () => clearTimeout(timer.current), []);
19
+ async function copy() {
20
+ clearTimeout(timer.current);
21
+ try {
22
+ await writeClipboard(typeof text === "function" ? text() : text);
23
+ setState("copied");
24
+ onCopied?.();
25
+ } catch {
26
+ onRefused?.();
27
+ selectContents(selectTarget?.current);
28
+ setState("failed");
29
+ }
30
+ timer.current = setTimeout(() => setState("idle"), COPY_SHOWN_MS);
31
+ }
32
+ return {
33
+ state,
34
+ copy
35
+ };
36
+ }
37
+ /**
38
+ * The two marks of a key that confirms: its symbol, and the tick that is drawn in its place
39
+ * (copy.css). The tick keeps the weight of the symbol's stroke at every size.
40
+ */
41
+ function CopyMarks({ copied, icon = Copy01Icon, size = 14 }) {
42
+ return /* @__PURE__ */ jsxs("span", {
43
+ "data-slot": "copy-marks",
44
+ "data-copied": copied ? "" : void 0,
45
+ className: "grid place-items-center *:col-start-1 *:row-start-1",
46
+ children: [/* @__PURE__ */ jsx(Icon, {
47
+ "data-slot": "copy-symbol",
48
+ icon,
49
+ size
50
+ }), /* @__PURE__ */ jsx(TickGlyph, {
51
+ "data-slot": "copy-tick",
52
+ width: size,
53
+ height: size,
54
+ strokeWidth: 21 / size
55
+ })]
56
+ });
57
+ }
58
+ export { COPY_SHOWN_MS, CopyMarks, useCopy };
@@ -15,6 +15,18 @@ const disclosurePanel = [
15
15
  "data-starting-style:h-0 data-starting-style:opacity-0",
16
16
  "data-ending-style:h-0 data-ending-style:opacity-0 data-ending-style:spring-leave"
17
17
  ].join(" ");
18
- /** The chevron of a disclosure: muted until the row is pointed at, and it turns on `seat`. */
19
- const disclosureChevron = "text-fg-muted transition-[rotate,color] spring-seat group-hover:text-fg group-data-disabled:text-on-disabled";
20
- export { disclosureChevron, disclosurePanel };
18
+ /**
19
+ * Added to a `disclosurePanel` whose one child is its content (`Accordion`, `Collapsible`): the
20
+ * content comes down with the opening edge from `--motion-enter-offset` above, so the answer
21
+ * unfolds instead of being uncovered. Closing only fades: exits do not travel. Not on a panel
22
+ * whose entries something else measures while they move (a `Sidebar`'s travelling tint).
23
+ */
24
+ const disclosureUnfold = ["*:transition-[translate] *:spring-settle", "data-starting-style:*:-translate-y-(--motion-enter-offset)"].join(" ");
25
+ /**
26
+ * The chevron of a disclosure: muted until the row is pointed at, and it turns on `seat`. While
27
+ * the row is pointed at it also leans `--motion-lean` the way it points; each part sets that way
28
+ * as `--lean` (an x and a y), since a chevron that has turned points elsewhere. Without `--lean`
29
+ * it stays in place (`Sidebar`, `Trace`).
30
+ */
31
+ const disclosureChevron = "text-fg-muted transition-[rotate,translate,color] spring-seat group-hover:text-fg group-hover:[translate:var(--lean)] group-data-disabled:text-on-disabled";
32
+ export { disclosureChevron, disclosurePanel, disclosureUnfold };
@@ -7,13 +7,33 @@ const fieldText = ["pointer-coarse:text-base", "placeholder:text-fg-muted placeh
7
7
  * The wrapper that wears the field. The halo follows the control only: a button inside the shell
8
8
  * shows its own focus outline, and the field stays quiet. Invalid beats focus, as on `Input`.
9
9
  */
10
- const fieldShell = [
11
- "group/field relative flex w-full min-w-0 cursor-text items-center pointer-coarse:text-base",
12
- fieldFace,
10
+ const fieldShellStates = [
13
11
  "has-[[data-field-control]:focus]:depth-field-focus",
14
12
  "has-[[data-field-control][data-invalid]]:depth-field-invalid has-[[data-field-control][data-invalid]:focus]:depth-field-invalid",
15
13
  "has-[[data-field-control][data-disabled]]:cursor-default has-[[data-field-control][data-disabled]]:bg-disabled has-[[data-field-control][data-disabled]]:depth-flat has-[[data-field-control][data-disabled]]:text-on-disabled"
16
14
  ].join(" ");
15
+ const fieldShell = [
16
+ "group/field relative flex w-full min-w-0 cursor-text items-center pointer-coarse:text-base",
17
+ fieldFace,
18
+ fieldShellStates
19
+ ].join(" ");
20
+ /**
21
+ * The shell of a field that grows by a line (a multi-select whose chips wrap), for the box of a
22
+ * `Grow`: the face and the states, no height and no layout. What the field holds is laid out on
23
+ * the `Grow`'s inner box, which is the one that is measured. The halo keeps its own transition
24
+ * beside the height's (`--grow-also`).
25
+ */
26
+ const fieldShellGrowing = [
27
+ "group/field relative block w-full min-w-0 cursor-text bg-surface text-control text-fg depth-field pointer-coarse:text-base",
28
+ "[--grow-also:box-shadow_var(--transition-duration-spring-snap)_var(--ease-spring-snap),background-color_var(--transition-duration-spring-snap)_var(--ease-spring-snap)]",
29
+ fieldShellStates
30
+ ].join(" ");
31
+ /** Corner and the field's variables by size, without the fixed height of `fieldShellSize`. */
32
+ const fieldShellGrowingSize = {
33
+ sm: "rounded-sm [--field-height:var(--control-sm)] [--field-pad:var(--field-pad-sm)] [--field-radius:var(--radius-sm)]",
34
+ md: "rounded-md [--field-height:var(--control-md)] [--field-pad:var(--field-pad-md)] [--field-radius:var(--radius-md)]",
35
+ lg: "rounded-lg [--field-height:var(--control-lg)] [--field-pad:var(--field-pad-lg)] [--field-radius:var(--radius-lg)]"
36
+ };
17
37
  /**
18
38
  * Height, corner and inline padding by size, handed to the parts inside as variables:
19
39
  * `--field-pad` (where text starts), `--field-height` and `--field-radius` (for a button that
@@ -46,4 +66,4 @@ function focusFieldControl(event) {
46
66
  event.preventDefault();
47
67
  control.focus();
48
68
  }
49
- export { bareControl, fieldFace, fieldShell, fieldShellSize, fieldText, focusFieldControl };
69
+ export { bareControl, fieldFace, fieldShell, fieldShellGrowing, fieldShellGrowingSize, fieldShellSize, fieldText, focusFieldControl };
@@ -74,6 +74,31 @@ function MinusGlyph(props) {
74
74
  children: /* @__PURE__ */ jsx("path", { d: "M2.5 6h7" })
75
75
  });
76
76
  }
77
+ /** Three square dots on the middle line: something was left out here (pages, in a `Pagination`). */
78
+ function GapGlyph(props) {
79
+ return /* @__PURE__ */ jsx(Glyph, {
80
+ ...props,
81
+ children: /* @__PURE__ */ jsx("path", { d: "M1.5 6h1.75M5.125 6h1.75M8.75 6h1.75" })
82
+ });
83
+ }
84
+ /**
85
+ * Stop, on the key that halts an answer being written: a filled square with the corner of a
86
+ * small key, so it reads as a solid mark where the send arrow stood.
87
+ */
88
+ function StopGlyph(props) {
89
+ return /* @__PURE__ */ jsx(Glyph, {
90
+ ...props,
91
+ children: /* @__PURE__ */ jsx("rect", {
92
+ x: "2.5",
93
+ y: "2.5",
94
+ width: "7",
95
+ height: "7",
96
+ rx: "1.25",
97
+ fill: "currentColor",
98
+ stroke: "none"
99
+ })
100
+ });
101
+ }
77
102
  /** The direction mark of a sortable column: up is ascending; turned, descending. */
78
103
  function ArrowUpGlyph(props) {
79
104
  return /* @__PURE__ */ jsx(Glyph, {
@@ -81,4 +106,4 @@ function ArrowUpGlyph(props) {
81
106
  children: /* @__PURE__ */ jsx("path", { d: "M6 10V2.75M2.5 6 6 2.5 9.5 6" })
82
107
  });
83
108
  }
84
- export { ArrowUpGlyph, ChevronDownGlyph, ChevronLeftGlyph, ChevronRightGlyph, CloseGlyph, DashGlyph, MinusGlyph, PlusGlyph, TickGlyph };
109
+ export { ArrowUpGlyph, ChevronDownGlyph, ChevronLeftGlyph, ChevronRightGlyph, CloseGlyph, DashGlyph, GapGlyph, MinusGlyph, PlusGlyph, StopGlyph, TickGlyph };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { Shortcut } from "../components/shortcut/shortcut.js";
3
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../components/tooltip/tooltip.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/internal/key-tip.tsx
6
+ /**
7
+ * The name of a key that shows only a symbol, said above it under the pointer, with its shortcut
8
+ * when it has one. A toolbar gives one to each of its symbol keys: in a row of symbols the name
9
+ * is what the reader is missing. It shows nothing on a touch screen; the key's `aria-label`
10
+ * still names it there.
11
+ */
12
+ function KeyTip({ label, shortcut, trigger }) {
13
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: trigger }), /* @__PURE__ */ jsxs(TooltipContent, {
14
+ className: "flex items-center gap-2",
15
+ children: [label, shortcut !== void 0 && /* @__PURE__ */ jsx(Shortcut, { keys: shortcut })]
16
+ })] });
17
+ }
18
+ export { KeyTip };
@@ -0,0 +1,39 @@
1
+ import { TickGlyph } from "./glyphs.js";
2
+ import { cn } from "../lib/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/internal/list-mark.tsx
5
+ /**
6
+ * The mark of a chosen row, at the row's right end: every row keeps its slot and only the chosen
7
+ * one shows its mark. The row must be a `group` that says it is chosen with `data-selected`
8
+ * (a select, a combobox) or `data-checked` (a menu), or pass `on`. Put `ml-auto` on it where
9
+ * nothing before it pushes it to the end.
10
+ */
11
+ function ListMark({ kind = "single", on, className }) {
12
+ return /* @__PURE__ */ jsx("span", {
13
+ "aria-hidden": true,
14
+ "data-slot": "list-mark",
15
+ className: cn("flex size-4 shrink-0 items-center justify-center text-accent group-data-disabled:text-on-disabled", className),
16
+ children: kind === "single" ? /* @__PURE__ */ jsx("span", { className: cn("mark", on === void 0 ? "mark-quiet group-data-checked:mark-on group-data-selected:mark-on" : on ? "mark-on" : "mark-quiet") }) : /* @__PURE__ */ jsx(TickGlyph, { className: on === void 0 ? "opacity-0 group-data-checked:opacity-100 group-data-selected:opacity-100" : on ? "" : "opacity-0" })
17
+ });
18
+ }
19
+ /**
20
+ * A row with a detail at its right, chosen: it stands on the tint. The tint is a layer of its
21
+ * own under the row's words, so it can fade in and out (`settle`) while the highlight under the
22
+ * pointer and the arrow keys stays instant. Chosen rows that touch are one shape: where a chosen
23
+ * row meets another, both give up their corners there, so only the block's outer corners are
24
+ * round, and a corner eases square or round as a neighbour is taken or given up. Under the
25
+ * pointer a chosen row's tint deepens at once. The muted detail reads below 4.5:1 on the tint,
26
+ * so on a chosen row it takes the body's colour.
27
+ */
28
+ const listTint = [
29
+ "relative isolate",
30
+ "before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:bg-tint before:opacity-0",
31
+ "before:transition-[opacity,border-radius] before:spring-settle motion-reduce:before:transition-opacity",
32
+ "data-selected:before:opacity-100",
33
+ "data-highlighted:before:bg-[color-mix(in_srgb,var(--color-tint),var(--color-fg)_5%)]",
34
+ "data-selected:[&:has(+[data-selected])]:before:rounded-b-none",
35
+ "data-selected:[[data-selected]+&]:before:rounded-t-none",
36
+ "data-selected:[&_[data-slot$=-detail]]:text-fg-body",
37
+ "forced-colors:data-selected:outline forced-colors:data-selected:-outline-offset-1"
38
+ ].join(" ");
39
+ export { ListMark, listTint };
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { mergeRefs } from "../lib/merge-refs.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useEffect, useRef, useState } from "react";
5
+ // src/internal/live-list.tsx
6
+ /**
7
+ * A list that says when it has stood on screen for a frame (`data-live`), so only what joins it
8
+ * afterwards animates its entrance. The one piece of script a server-safe list (a `Timeline`)
9
+ * needs: the list stays markup the server writes, and this part marks it.
10
+ *
11
+ * Hidden (`display: none`, a closed tab) it is not live again until a frame after it shows, so
12
+ * a list that is revealed stands still like one that loads.
13
+ */
14
+ function LiveList({ ref, ...props }) {
15
+ const list = useRef(null);
16
+ const [live, setLive] = useState(false);
17
+ useEffect(() => {
18
+ const element = list.current;
19
+ if (!element) return;
20
+ let frame = 0;
21
+ const observer = new ResizeObserver(() => {
22
+ cancelAnimationFrame(frame);
23
+ if (!element.checkVisibility()) {
24
+ setLive(false);
25
+ return;
26
+ }
27
+ frame = requestAnimationFrame(() => setLive(true));
28
+ });
29
+ observer.observe(element);
30
+ return () => {
31
+ observer.disconnect();
32
+ cancelAnimationFrame(frame);
33
+ };
34
+ }, []);
35
+ return /* @__PURE__ */ jsx("ol", {
36
+ ref: mergeRefs(list, ref),
37
+ "data-live": live ? "" : void 0,
38
+ ...props
39
+ });
40
+ }
41
+ export { LiveList };
@@ -0,0 +1,157 @@
1
+ // src/internal/number-places.ts
2
+ const BODY = /* @__PURE__ */ new Set([
3
+ "integer",
4
+ "group",
5
+ "decimal",
6
+ "fraction"
7
+ ]);
8
+ /**
9
+ * The number format for a `RollingNumber`: German by default, and a minus only where there is
10
+ * something below zero (`signDisplay: "negative"`), so a value rounding to zero is never "-0".
11
+ */
12
+ function numberFormat(locale = "de-DE", options) {
13
+ return new Intl.NumberFormat(locale, {
14
+ signDisplay: "negative",
15
+ ...options
16
+ });
17
+ }
18
+ function toPlaces(format, value) {
19
+ const parts = format.formatToParts(value);
20
+ const text = parts.map((part) => part.value).join("");
21
+ const first = parts.findIndex((part) => BODY.has(part.type));
22
+ if (first === -1) return {
23
+ text,
24
+ places: [{
25
+ key: "pre",
26
+ kind: "symbol",
27
+ text
28
+ }],
29
+ unit: text
30
+ };
31
+ let last = first;
32
+ for (let index = first; index < parts.length; index++) if (BODY.has(parts[index].type)) last = index;
33
+ const places = [];
34
+ let unit = "";
35
+ let run = "";
36
+ let runs = 0;
37
+ const flush = () => {
38
+ if (run) places.push({
39
+ key: runs++ === 0 ? "pre" : "pre2",
40
+ kind: "symbol",
41
+ text: run
42
+ });
43
+ unit += run;
44
+ run = "";
45
+ };
46
+ for (const part of parts.slice(0, first)) if (part.type === "minusSign" || part.type === "plusSign") {
47
+ flush();
48
+ const key = part.type === "minusSign" ? "minus" : "plus";
49
+ places.push({
50
+ key,
51
+ kind: "symbol",
52
+ text: part.value
53
+ });
54
+ } else run += part.value;
55
+ flush();
56
+ const zero = zeroOf(format);
57
+ const digitOf = (character) => (character.codePointAt(0) ?? zero) - zero;
58
+ const body = parts.slice(first, last + 1);
59
+ let integers = body.filter((part) => part.type === "integer").reduce((count, part) => count + part.value.length, 0);
60
+ let fractions = 0;
61
+ for (const part of body) if (part.type === "integer") for (const character of part.value) {
62
+ integers -= 1;
63
+ places.push({
64
+ key: `i${integers}`,
65
+ kind: "digit",
66
+ digit: digitOf(character)
67
+ });
68
+ }
69
+ else if (part.type === "group") places.push({
70
+ key: `g${integers}`,
71
+ kind: "symbol",
72
+ text: part.value
73
+ });
74
+ else if (part.type === "decimal") places.push({
75
+ key: "decimal",
76
+ kind: "symbol",
77
+ text: part.value
78
+ });
79
+ else if (part.type === "fraction") for (const character of part.value) {
80
+ fractions += 1;
81
+ places.push({
82
+ key: `f${fractions}`,
83
+ kind: "digit",
84
+ digit: digitOf(character)
85
+ });
86
+ }
87
+ const after = parts.slice(last + 1).map((part) => part.value).join("");
88
+ if (after) places.push({
89
+ key: "post",
90
+ kind: "symbol",
91
+ text: after
92
+ });
93
+ unit += `|${after}`;
94
+ return {
95
+ text,
96
+ places,
97
+ unit
98
+ };
99
+ }
100
+ /** The code point of the format's zero: digits of every numbering system run on from it. */
101
+ function zeroOf(format) {
102
+ return (format.formatToParts(0).find((part) => part.type === "integer")?.value)?.codePointAt(0) ?? 48;
103
+ }
104
+ /**
105
+ * Where each digit place's column stands after a change: a position that only ever grows when
106
+ * the number grows and shrinks when it shrinks, so every column rolls the way the number moves
107
+ * (an odometer: 19 → 20 rolls the ones forward through 0). The digit shown is the position
108
+ * modulo ten. A place that is new starts at its digit; it fades in and does not roll.
109
+ *
110
+ * Worked out from the last target, never from what is on screen, so a change that arrives
111
+ * while the columns still move simply sets a new target.
112
+ */
113
+ function nextRolls(rolls, places, direction) {
114
+ const next = {};
115
+ for (const place of places) {
116
+ if (place.kind !== "digit") continue;
117
+ const before = rolls[place.key];
118
+ if (before === void 0) {
119
+ next[place.key] = place.digit;
120
+ continue;
121
+ }
122
+ const shown = (before % 10 + 10) % 10;
123
+ const step = direction < 0 ? -((shown - place.digit + 10) % 10) : (place.digit - shown + 10) % 10;
124
+ next[place.key] = before + step;
125
+ }
126
+ return next;
127
+ }
128
+ /** Left to right: what comes before, the integer places from the highest, the fraction. */
129
+ function rank(key) {
130
+ if (key === "pre") return 0;
131
+ if (key === "minus" || key === "plus") return 1;
132
+ if (key === "pre2") return 2;
133
+ if (key === "decimal") return 5e4;
134
+ if (key === "post") return 9e4;
135
+ const n = Number(key.slice(1));
136
+ if (key[0] === "i") return 10 + (1e4 - n) * 2;
137
+ if (key[0] === "g") return 10 + (1e4 - n) * 2 + 1;
138
+ return 5e4 + n;
139
+ }
140
+ /**
141
+ * The places to draw: the value's own, and those of the previous drawing that the value no
142
+ * longer has, kept where they stood and marked as leaving. A leaving place that the value has
143
+ * again comes back as it is (it reverses instead of entering anew).
144
+ */
145
+ function mergePlaces(shown, places) {
146
+ const keys = new Set(places.map((place) => place.key));
147
+ const merged = places.map((place) => ({
148
+ ...place,
149
+ leaving: false
150
+ }));
151
+ for (const place of shown) if (!keys.has(place.key)) merged.push({
152
+ ...place,
153
+ leaving: true
154
+ });
155
+ return merged.sort((a, b) => rank(a.key) - rank(b.key));
156
+ }
157
+ export { mergePlaces, nextRolls, numberFormat, toPlaces };
@@ -7,8 +7,8 @@ import { PopoverClose, PopoverContent, PopoverTrigger } from "../components/popo
7
7
  import { TimeField } from "../components/time-field/time-field.js";
8
8
  import { FieldDisabledContext } from "./field-context.js";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
- import { Calendar03Icon } from "@hugeicons/core-free-icons";
11
10
  import { useContext, useRef } from "react";
11
+ import { Calendar03Icon } from "@hugeicons/core-free-icons";
12
12
  // src/internal/picker-sheet.tsx
13
13
  /**
14
14
  * The button at the end of a date field that opens its calendar. A field that cannot be changed
@@ -0,0 +1,24 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ // src/internal/presence-dot.tsx
4
+ const look = {
5
+ online: "bg-success-solid forced-colors:bg-[CanvasText]",
6
+ away: "bg-warning-solid forced-colors:bg-[CanvasText]",
7
+ offline: "inset-ring-[1.5px] inset-ring-fg-muted forced-colors:outline forced-colors:outline-1 forced-colors:-outline-offset-1 forced-colors:outline-[CanvasText]"
8
+ };
9
+ /**
10
+ * The dot on the edge of an avatar, at the bottom end, that says whether the person is there. It stands
11
+ * beside the avatar, not in it (the avatar is masked, and a dot inside would be cut out with
12
+ * it), and the avatar has a hole cut for it the gap larger (`avatar-cut.ts`). Its words are
13
+ * said elsewhere: the dot alone never carries the status. Server-safe.
14
+ */
15
+ function PresenceDot({ presence, diameter, slot, className }) {
16
+ return /* @__PURE__ */ jsx("span", {
17
+ "aria-hidden": true,
18
+ "data-slot": slot,
19
+ "data-presence": presence,
20
+ style: { "--dot": `${diameter / 16}rem` },
21
+ className: cn("pointer-events-none absolute end-0 bottom-0 size-(--dot) rounded-full transition-[background-color,box-shadow] spring-settle", look[presence], className)
22
+ });
23
+ }
24
+ export { PresenceDot };
@@ -0,0 +1,104 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ // src/internal/presence.tsx
4
+ /**
5
+ * Whether a list has stood for a frame. Page load does not animate: what is there when a list
6
+ * first shows stands still, and only what joins afterwards comes in. Put the result on the list
7
+ * as `data-live` and gate the entrance with `in-data-live:starting:*`.
8
+ */
9
+ function useLive() {
10
+ const [live, setLive] = useState(false);
11
+ useEffect(() => {
12
+ const frame = requestAnimationFrame(() => setLive(true));
13
+ return () => cancelAnimationFrame(frame);
14
+ }, []);
15
+ return live;
16
+ }
17
+ /**
18
+ * The items of a row, and with them those that were just taken out of it: what its owner removes
19
+ * is kept where it stood until it has left, so it can fade and its place can close. The owner's
20
+ * list is already without it; only the picture lags.
21
+ *
22
+ * Draw every place with `placeProps`, inside the box of `boxRef`: a place says when its
23
+ * transition has ended, and the hook finds the places that never started one.
24
+ *
25
+ * Hand it the same array for as long as nothing changed: memoise a list made from `children`
26
+ * on `children`. The hook keeps the list as it was last drawn, so what leaves goes as it last
27
+ * looked (a file removed mid-upload, not as it stood when the list last gained or lost one),
28
+ * and a new array every render would never let it settle.
29
+ */
30
+ function usePresence(items, keyOf, boxRef) {
31
+ const [before, setBefore] = useState(items);
32
+ const [leavers, setLeavers] = useState([]);
33
+ const keys = items.map(keyOf);
34
+ if (before !== items) {
35
+ if (before.map(keyOf).join("\n") !== keys.join("\n")) {
36
+ const stays = new Set(keys);
37
+ const gone = before.map((item, index) => ({
38
+ item,
39
+ key: keyOf(item),
40
+ index
41
+ })).filter(({ key }) => !stays.has(key));
42
+ setLeavers((old) => [...old.filter(({ key }) => !stays.has(key)), ...gone]);
43
+ }
44
+ setBefore(items);
45
+ }
46
+ useEffect(() => {
47
+ if (leavers.length === 0) return;
48
+ const frame = requestAnimationFrame(() => {
49
+ const moving = /* @__PURE__ */ new Set();
50
+ boxRef.current?.querySelectorAll("[data-leaving][data-key]").forEach((place) => {
51
+ if (place.getAnimations().length > 0) moving.add(place.dataset.key);
52
+ });
53
+ setLeavers((old) => {
54
+ const next = old.filter(({ key }) => moving.has(key));
55
+ return next.length === old.length ? old : next;
56
+ });
57
+ });
58
+ return () => cancelAnimationFrame(frame);
59
+ }, [leavers, boxRef]);
60
+ const left = (key) => setLeavers((old) => old.filter((leaver) => leaver.key !== key));
61
+ const places = items.map((item, index) => ({
62
+ item,
63
+ key: keys[index] ?? "",
64
+ leaving: false
65
+ }));
66
+ for (const { item, key, index } of leavers) places.splice(Math.min(index, places.length), 0, {
67
+ item,
68
+ key,
69
+ leaving: true
70
+ });
71
+ return {
72
+ places,
73
+ left
74
+ };
75
+ }
76
+ /**
77
+ * What every place carries: its key, whether it is leaving, and the two events that say it has
78
+ * left. What has left the owner's list can no longer be pressed or focused (`inert`).
79
+ */
80
+ function placeProps(place, left) {
81
+ const ended = (event) => {
82
+ if (place.leaving && event.target === event.currentTarget) left(place.key);
83
+ };
84
+ return {
85
+ "data-key": place.key,
86
+ "data-leaving": place.leaving ? "" : void 0,
87
+ inert: place.leaving,
88
+ onTransitionEnd: ended,
89
+ onTransitionCancel: ended
90
+ };
91
+ }
92
+ /**
93
+ * A place in a row: a grid of one column that opens from nothing and closes to nothing. What
94
+ * stands in it keeps its size all the while; only its place changes, which moves its
95
+ * neighbours. The row's gap is the variable `--chip-gap`, because a place that closes has to
96
+ * take its gap with it. What stands inside has faded before the place closes (the delay), so it
97
+ * is never seen under a neighbour.
98
+ */
99
+ const placeInRow = [
100
+ "inline-grid grid-cols-[1fr] transition-[grid-template-columns,margin] spring-settle",
101
+ "in-data-live:starting:-mr-(--chip-gap) in-data-live:starting:grid-cols-[0fr]",
102
+ "data-leaving:-mr-(--chip-gap) data-leaving:grid-cols-[0fr] data-leaving:delay-75"
103
+ ].join(" ");
104
+ export { placeInRow, placeProps, useLive, usePresence };
@@ -0,0 +1,3 @@
1
+ import "../components/icon/icon.js";
2
+ /** Where an entry on a rail stands: not begun, being worked on, finished, or failed. */
3
+ export type RailStatus = "pending" | "running" | "done" | "error";
@@ -0,0 +1,33 @@
1
+ import { Icon } from "../components/icon/icon.js";
2
+ import { Spinner } from "../components/spinner/spinner.js";
3
+ import { cn } from "../lib/cn.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Alert02Icon } from "@hugeicons/core-free-icons";
6
+ // src/internal/rail-mark.tsx
7
+ /**
8
+ * The mark in front of an entry on a rail (`rail.css`): an open ring waits, the spinner's arc
9
+ * works (it is the ring before it has closed), the disc is done, and a failure carries the danger
10
+ * symbol. Shared by `Trace` and `Timeline`, so both lists are drawn by the same hand.
11
+ *
12
+ * A 16px box, hidden from assistive tech: the entry says its state in words. Server-safe.
13
+ */
14
+ function RailMark({ slot, status, icon, enter, className }) {
15
+ return /* @__PURE__ */ jsx("span", {
16
+ "aria-hidden": true,
17
+ "data-slot": slot,
18
+ className: cn("flex size-4 shrink-0 items-center justify-center", className),
19
+ children: status === "running" ? /* @__PURE__ */ jsx(Spinner, {
20
+ size: 14,
21
+ className: "text-fg"
22
+ }) : status === "error" ? /* @__PURE__ */ jsx(Icon, {
23
+ icon: Alert02Icon,
24
+ size: 14,
25
+ className: "text-danger"
26
+ }) : icon && status === "done" ? /* @__PURE__ */ jsx(Icon, {
27
+ icon,
28
+ size: 14,
29
+ className: cn("text-fg-muted transition-opacity spring-settle", enter?.icon)
30
+ }) : /* @__PURE__ */ jsx("span", { className: cn("mark", status === "done" && cn("mark-on", enter?.disc)) })
31
+ });
32
+ }
33
+ export { RailMark };
@@ -1,6 +1,7 @@
1
1
  // src/internal/rule.ts
2
2
  /**
3
- * The 2px rule that opens a block (`Table`, `Accordion`, `ParameterList`): a straight line with
3
+ * The 2px rule that opens a block (`Table`, `ParameterList`, `DescriptionList`, a ruled
4
+ * `StatGroup`; not an `Accordion`, which opens with a hairline): a straight line with
4
5
  * round ends. The box keeps a transparent 2px top border, so it is laid out exactly as with
5
6
  * `border-t-2`, and the line is drawn into that border as `::before`. A border cannot round its
6
7
  * own ends: with a radius it bends down at the corners instead. Where the rule stands by itself,
@@ -0,0 +1,22 @@
1
+ import { Alert02Icon, AlertCircleIcon, CheckmarkCircle02Icon, InformationCircleIcon } from "@hugeicons/core-free-icons";
2
+ // src/internal/status-icon.ts
3
+ /**
4
+ * The symbol of each status, the same in an `Alert`, a toast and a `Banner`: a status never
5
+ * relies on colour, it always has a symbol and words. Server-safe.
6
+ */
7
+ const statusIcons = {
8
+ neutral: InformationCircleIcon,
9
+ info: InformationCircleIcon,
10
+ success: CheckmarkCircle02Icon,
11
+ warning: Alert02Icon,
12
+ danger: AlertCircleIcon
13
+ };
14
+ /** The colour of each status symbol. Indigo is never spent on an icon: info stays in the text colour. */
15
+ const statusIconTone = {
16
+ neutral: "text-fg-muted",
17
+ info: "text-fg",
18
+ success: "text-success",
19
+ warning: "text-warning",
20
+ danger: "text-danger"
21
+ };
22
+ export { statusIconTone, statusIcons };
@@ -0,0 +1,23 @@
1
+ import { Icon } from "../components/icon/icon.js";
2
+ import { cn } from "../lib/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/internal/tile.tsx
5
+ /**
6
+ * The small square a row's symbol stands in, before its title and its line (the pages of a
7
+ * `NavigationMenu` panel, the rows of a `CopyPage` menu): a small raised plug, 36px with an 18px
8
+ * symbol, as in Clerk's menus (Justin, 2026-11-20, chosen over a flat square and over 32px).
9
+ * The symbol is muted and darkens with the row under the pointer or the keyboard: give the row
10
+ * `group/row`.
11
+ */
12
+ function Tile({ icon, children, className }) {
13
+ return /* @__PURE__ */ jsx("span", {
14
+ "aria-hidden": true,
15
+ "data-slot": "tile",
16
+ className: cn("flex size-9 shrink-0 items-center justify-center rounded-md bg-raised depth-plug text-fg-muted", "group-hover/row:text-fg group-data-highlighted/row:text-fg", className),
17
+ children: icon ? /* @__PURE__ */ jsx(Icon, {
18
+ icon,
19
+ size: 18
20
+ }) : children
21
+ });
22
+ }
23
+ export { Tile };