@zonsh/ui 0.2.0 → 0.5.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 (200) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +19 -13
  3. package/dist/components/accordion.js +1 -1
  4. package/dist/components/alert-dialog.js +1 -1
  5. package/dist/components/ascii-field.d.ts +1 -1
  6. package/dist/components/ascii-field.js +2 -1
  7. package/dist/components/bottom-nav.d.ts +86 -0
  8. package/dist/components/bottom-nav.js +175 -0
  9. package/dist/components/breadcrumb.d.ts +9 -0
  10. package/dist/components/breadcrumb.js +6 -1
  11. package/dist/components/button-group.d.ts +1 -1
  12. package/dist/components/button-group.js +2 -2
  13. package/dist/components/button.js +1 -1
  14. package/dist/components/calendar.d.ts +1 -1
  15. package/dist/components/calendar.js +18 -3
  16. package/dist/components/carousel.d.ts +22 -3
  17. package/dist/components/carousel.js +25 -7
  18. package/dist/components/chart.d.ts +20 -0
  19. package/dist/components/chart.js +52 -3
  20. package/dist/components/code-block.d.ts +20 -10
  21. package/dist/components/code-block.js +54 -12
  22. package/dist/components/collapsible.js +3 -3
  23. package/dist/components/color-picker.d.ts +30 -8
  24. package/dist/components/color-picker.js +48 -27
  25. package/dist/components/combobox.d.ts +21 -3
  26. package/dist/components/combobox.js +79 -7
  27. package/dist/components/command.d.ts +23 -3
  28. package/dist/components/command.js +63 -18
  29. package/dist/components/conversation.d.ts +10 -1
  30. package/dist/components/conversation.js +24 -7
  31. package/dist/components/copy-button.d.ts +15 -6
  32. package/dist/components/copy-button.js +27 -10
  33. package/dist/components/data-table.d.ts +66 -6
  34. package/dist/components/data-table.js +376 -23
  35. package/dist/components/date-picker.d.ts +73 -4
  36. package/dist/components/date-picker.js +138 -7
  37. package/dist/components/dialog.d.ts +10 -1
  38. package/dist/components/dialog.js +6 -3
  39. package/dist/components/drawer.d.ts +10 -1
  40. package/dist/components/drawer.js +6 -3
  41. package/dist/components/feature-list.js +2 -2
  42. package/dist/components/field.d.ts +27 -8
  43. package/dist/components/field.js +49 -4
  44. package/dist/components/file-drop.d.ts +26 -4
  45. package/dist/components/file-drop.js +125 -64
  46. package/dist/components/filter-bar.d.ts +50 -3
  47. package/dist/components/filter-bar.js +71 -33
  48. package/dist/components/form.d.ts +4 -2
  49. package/dist/components/form.js +24 -2
  50. package/dist/components/graph.d.ts +41 -0
  51. package/dist/components/graph.js +106 -50
  52. package/dist/components/illustration.js +51 -4
  53. package/dist/components/input-group.d.ts +18 -7
  54. package/dist/components/input-group.js +41 -19
  55. package/dist/components/input.d.ts +2 -2
  56. package/dist/components/input.js +3 -3
  57. package/dist/components/kbd.d.ts +17 -0
  58. package/dist/components/kbd.js +8 -1
  59. package/dist/components/layout.d.ts +2 -1
  60. package/dist/components/layout.js +55 -11
  61. package/dist/components/lightbox.d.ts +100 -0
  62. package/dist/components/lightbox.js +457 -0
  63. package/dist/components/locale.d.ts +44 -0
  64. package/dist/components/locale.js +37 -0
  65. package/dist/components/logo.js +1 -1
  66. package/dist/components/menu.js +3 -1
  67. package/dist/components/menubar.js +60 -13
  68. package/dist/components/message.d.ts +3 -3
  69. package/dist/components/message.js +12 -8
  70. package/dist/components/meter.js +3 -1
  71. package/dist/components/money-input.d.ts +80 -0
  72. package/dist/components/money-input.js +253 -0
  73. package/dist/components/navigation-menu.js +4 -2
  74. package/dist/components/number-field.d.ts +21 -2
  75. package/dist/components/number-field.js +53 -28
  76. package/dist/components/otp-field.d.ts +14 -1
  77. package/dist/components/otp-field.js +10 -2
  78. package/dist/components/pagination.d.ts +13 -7
  79. package/dist/components/pagination.js +18 -7
  80. package/dist/components/pdf-viewer.d.ts +67 -2
  81. package/dist/components/pdf-viewer.js +88 -21
  82. package/dist/components/phone-input.d.ts +79 -0
  83. package/dist/components/phone-input.js +282 -0
  84. package/dist/components/popover.js +1 -1
  85. package/dist/components/progress.js +3 -1
  86. package/dist/components/prompt-input.d.ts +34 -9
  87. package/dist/components/prompt-input.js +37 -17
  88. package/dist/components/radio-group.js +7 -2
  89. package/dist/components/rating.d.ts +73 -0
  90. package/dist/components/rating.js +124 -0
  91. package/dist/components/reasoning.d.ts +16 -1
  92. package/dist/components/reasoning.js +10 -7
  93. package/dist/components/resizable.d.ts +10 -1
  94. package/dist/components/resizable.js +4 -1
  95. package/dist/components/response.d.ts +17 -5
  96. package/dist/components/response.js +58 -18
  97. package/dist/components/scroll-area.d.ts +1 -1
  98. package/dist/components/select.js +14 -3
  99. package/dist/components/separator.js +1 -1
  100. package/dist/components/sidebar.d.ts +20 -4
  101. package/dist/components/sidebar.js +70 -35
  102. package/dist/components/site-header.d.ts +46 -12
  103. package/dist/components/site-header.js +78 -19
  104. package/dist/components/skeleton.d.ts +1 -1
  105. package/dist/components/skeleton.js +1 -1
  106. package/dist/components/slider.js +3 -1
  107. package/dist/components/sortable.d.ts +178 -0
  108. package/dist/components/sortable.js +1282 -0
  109. package/dist/components/sources.d.ts +17 -2
  110. package/dist/components/sources.js +11 -4
  111. package/dist/components/spinner.d.ts +13 -1
  112. package/dist/components/spinner.js +5 -2
  113. package/dist/components/stat.d.ts +91 -0
  114. package/dist/components/stat.js +141 -0
  115. package/dist/components/stepper.d.ts +71 -0
  116. package/dist/components/stepper.js +101 -0
  117. package/dist/components/switch.d.ts +2 -2
  118. package/dist/components/switch.js +2 -2
  119. package/dist/components/table.d.ts +13 -3
  120. package/dist/components/table.js +231 -41
  121. package/dist/components/tabs.js +8 -4
  122. package/dist/components/tags-input.d.ts +18 -2
  123. package/dist/components/tags-input.js +66 -34
  124. package/dist/components/theme.d.ts +16 -2
  125. package/dist/components/theme.js +34 -8
  126. package/dist/components/time-field.d.ts +24 -4
  127. package/dist/components/time-field.js +32 -9
  128. package/dist/components/timeline.d.ts +18 -2
  129. package/dist/components/timeline.js +13 -4
  130. package/dist/components/tippy.d.ts +48 -0
  131. package/dist/components/tippy.js +648 -0
  132. package/dist/components/toast.d.ts +18 -2
  133. package/dist/components/toast.js +12 -3
  134. package/dist/components/toggle-group.js +1 -0
  135. package/dist/components/tool-call.d.ts +19 -8
  136. package/dist/components/tool-call.js +23 -7
  137. package/dist/components/toolbar.d.ts +1 -1
  138. package/dist/components/toolbar.js +10 -2
  139. package/dist/components/tooltip.d.ts +4 -2
  140. package/dist/components/tooltip.js +10 -4
  141. package/dist/components/tour.d.ts +127 -0
  142. package/dist/components/tour.js +673 -0
  143. package/dist/components/tree.js +45 -9
  144. package/dist/components/video-player.d.ts +10 -2
  145. package/dist/components/video-player.js +134 -38
  146. package/dist/illustration.d.ts +2 -0
  147. package/dist/illustration.js +7 -0
  148. package/dist/index.d.ts +11 -3
  149. package/dist/index.js +11 -3
  150. package/dist/lib/code-highlight.d.ts +3 -16
  151. package/dist/lib/code-highlight.js +160 -10
  152. package/dist/lib/code-theme.js +3 -3
  153. package/dist/lib/digit-roll.js +8 -8
  154. package/dist/lib/field-errors.d.ts +28 -0
  155. package/dist/lib/field-errors.js +24 -0
  156. package/dist/lib/field-value.d.ts +13 -0
  157. package/dist/lib/field-value.js +44 -0
  158. package/dist/lib/glide.d.ts +5 -4
  159. package/dist/lib/glide.js +5 -4
  160. package/dist/lib/graph-layout.js +11 -2
  161. package/dist/lib/money.d.ts +73 -0
  162. package/dist/lib/money.js +343 -0
  163. package/dist/lib/phone-countries.d.ts +1 -0
  164. package/dist/lib/phone-countries.js +281 -0
  165. package/dist/lib/phone.d.ts +90 -0
  166. package/dist/lib/phone.js +286 -0
  167. package/dist/lib/platform.d.ts +8 -3
  168. package/dist/lib/platform.js +13 -6
  169. package/dist/lib/row-index.d.ts +15 -0
  170. package/dist/lib/row-index.js +136 -0
  171. package/dist/lib/table-fit.d.ts +3 -2
  172. package/dist/lib/table-fit.js +52 -23
  173. package/dist/lib/theme-script.d.ts +15 -2
  174. package/dist/lib/theme-script.js +23 -3
  175. package/dist/lib/tippy/pixels.d.ts +47 -0
  176. package/dist/lib/tippy/pixels.js +187 -0
  177. package/dist/lib/tippy/sprite.d.ts +86 -0
  178. package/dist/lib/tippy/sprite.js +753 -0
  179. package/dist/messages/de.d.ts +12 -0
  180. package/dist/messages/de.js +326 -0
  181. package/dist/styles/expressive.css +60 -26
  182. package/dist/styles/index.css +11 -2
  183. package/dist/styles/material.css +47 -23
  184. package/dist/styles/parts/ai.css +4 -2
  185. package/dist/styles/parts/controls.css +85 -32
  186. package/dist/styles/parts/data.css +33 -5
  187. package/dist/styles/parts/feedback.css +110 -13
  188. package/dist/styles/parts/foundations.css +1 -1
  189. package/dist/styles/parts/navigation.css +230 -5
  190. package/dist/styles/parts/overlays.css +98 -11
  191. package/dist/styles/parts/pdf.css +13 -7
  192. package/dist/styles/tokens.css +28 -4
  193. package/dist/vite.d.ts +0 -50
  194. package/dist/vite.js +0 -100
  195. package/package.json +28 -33
  196. package/dist/components/code-highlight.d.ts +0 -13
  197. package/dist/components/code-highlight.js +0 -107
  198. package/dist/components/whiteboard.d.ts +0 -80
  199. package/dist/components/whiteboard.js +0 -389
  200. package/dist/styles/parts/whiteboard.css +0 -855
@@ -1,5 +1,16 @@
1
1
  import type * as React from "react";
2
2
  import { Collapsible, type CollapsibleTriggerProps } from "./collapsible.js";
3
+ export interface SourcesMessages {
4
+ /** SourcesTrigger's label: "Used 3 sources". */
5
+ used: (count: number) => string;
6
+ /** Read after each Source's title. */
7
+ newTab: string;
8
+ }
9
+ declare module "./locale" {
10
+ interface Messages {
11
+ sources: SourcesMessages;
12
+ }
13
+ }
3
14
  /**
4
15
  * Sources — the pages an answer drew on, folded under a mono trigger ("Used 3 sources").
5
16
  * Each `Source` is a row with the site in mono and the page title, opening in a new tab.
@@ -11,15 +22,19 @@ export declare function Sources({ className, ...props }: React.ComponentProps<ty
11
22
  export interface SourcesTriggerProps extends CollapsibleTriggerProps {
12
23
  /** How many sources there are; the default label reads "Used n sources". */
13
24
  count: number;
25
+ /** The label (`used`); a LocaleProvider sets it for every SourcesTrigger. */
26
+ labels?: Partial<SourcesMessages>;
14
27
  }
15
28
  /** "Used n sources", with a chevron. Children replace the label. */
16
- export declare function SourcesTrigger({ count, children, ...props }: SourcesTriggerProps): React.JSX.Element;
29
+ export declare function SourcesTrigger({ count, labels, children, ...props }: SourcesTriggerProps): React.JSX.Element;
17
30
  /** The list of `Source`s. */
18
31
  export declare function SourcesContent({ className, children, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
19
32
  export interface SourceProps extends Omit<React.ComponentProps<"a">, "title"> {
20
33
  href: string;
21
34
  /** The page title. Defaults to the address. */
22
35
  title?: React.ReactNode;
36
+ /** What screen readers hear after the title (`newTab`); a LocaleProvider sets it for every Source. */
37
+ labels?: Partial<SourcesMessages>;
23
38
  }
24
39
  /** One source: the site in mono, the title, and an arrow; it opens in a new tab. */
25
- export declare function Source({ href, title, className, children, ...props }: SourceProps): React.JSX.Element;
40
+ export declare function Source({ href, title, labels, className, children, ...props }: SourceProps): React.JSX.Element;
@@ -3,6 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { ArrowUpRightIcon } from "lucide-react";
4
4
  import { cn, sx } from "../lib/cn.js";
5
5
  import { Collapsible, CollapsiblePanel, CollapsibleTrigger, } from "./collapsible.js";
6
+ import { useMessages } from "./locale.js";
7
+ const defaultMessages = {
8
+ used: (count) => `Used ${count} ${count === 1 ? "source" : "sources"}`,
9
+ newTab: "(opens in a new tab)",
10
+ };
6
11
  /**
7
12
  * Sources — the pages an answer drew on, folded under a mono trigger ("Used 3 sources").
8
13
  * Each `Source` is a row with the site in mono and the page title, opening in a new tab.
@@ -14,8 +19,9 @@ export function Sources({ className, ...props }) {
14
19
  return _jsx(Collapsible, { "data-slot": "sources", className: sx("gap-1", className), ...props });
15
20
  }
16
21
  /** "Used n sources", with a chevron. Children replace the label. */
17
- export function SourcesTrigger({ count, children, ...props }) {
18
- return (_jsx(CollapsibleTrigger, { "data-slot": "sources-trigger", ...props, children: children ?? `Used ${count} ${count === 1 ? "source" : "sources"}` }));
22
+ export function SourcesTrigger({ count, labels, children, ...props }) {
23
+ const text = useMessages("sources", defaultMessages, labels);
24
+ return (_jsx(CollapsibleTrigger, { "data-slot": "sources-trigger", ...props, children: children ?? text.used(count) }));
19
25
  }
20
26
  /** The list of `Source`s. */
21
27
  export function SourcesContent({ className, children, ...props }) {
@@ -30,6 +36,7 @@ const hostOf = (href) => {
30
36
  }
31
37
  };
32
38
  /** One source: the site in mono, the title, and an arrow; it opens in a new tab. */
33
- export function Source({ href, title, className, children, ...props }) {
34
- return (_jsx("li", { "data-slot": "source", children: _jsxs("a", { href: href, target: "_blank", rel: "noopener noreferrer", className: cn("flex min-h-(--control-h-sm) min-w-0 items-center gap-3 rounded-item material-row px-2.5 text-[13px] no-underline focus-ring", className), ...props, children: [_jsx("span", { className: "w-32 shrink-0 truncate font-mono text-[11px] text-muted-foreground", children: hostOf(href) }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: children ?? title ?? href }), _jsx(ArrowUpRightIcon, { "aria-hidden": true, className: "size-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] }) }));
39
+ export function Source({ href, title, labels, className, children, ...props }) {
40
+ const text = useMessages("sources", defaultMessages, labels);
41
+ return (_jsx("li", { "data-slot": "source", children: _jsxs("a", { href: href, target: "_blank", rel: "noopener noreferrer", className: cn("flex min-h-(--control-h-sm) min-w-0 items-center gap-3 rounded-item material-row px-2.5 text-[13px] no-underline focus-ring", className), ...props, children: [_jsx("span", { className: "w-32 shrink-0 truncate font-mono text-[11px] text-muted-foreground", children: hostOf(href) }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: children ?? title ?? href }), _jsx(ArrowUpRightIcon, { "aria-hidden": true, className: "size-3.5 shrink-0 text-muted-foreground rtl:-scale-x-100" }), _jsx("span", { className: "sr-only", children: text.newTab })] }) }));
35
42
  }
@@ -1,4 +1,13 @@
1
1
  import { type ComponentProps } from "react";
2
+ export interface SpinnerMessages {
3
+ /** The status announced when no `label` says what is loading. */
4
+ loading: string;
5
+ }
6
+ declare module "./locale" {
7
+ interface Messages {
8
+ spinner: SpinnerMessages;
9
+ }
10
+ }
2
11
  declare const spinnerSizes: {
3
12
  readonly sm: "size-3 text-[12px]";
4
13
  readonly default: "size-4 text-[16px]";
@@ -19,7 +28,10 @@ export interface SpinnerProps extends Omit<ComponentProps<"span">, "children"> {
19
28
  variant?: SpinnerVariant;
20
29
  /** `sm` 12px · `default` 16px · `lg` 20px. */
21
30
  size?: SpinnerSize;
22
- /** The accessible name announced for the status. Say what is loading: "Sending message". */
31
+ /**
32
+ * The accessible name announced for the status. Say what is loading: "Sending message".
33
+ * Default "Loading", or `messages.spinner.loading` from a LocaleProvider.
34
+ */
23
35
  label?: string;
24
36
  }
25
37
  /**
@@ -4,6 +4,8 @@ import { LoaderCircleIcon } from "lucide-react";
4
4
  import { useId } from "react";
5
5
  import { cn } from "../lib/cn.js";
6
6
  import { bracketGeometry } from "../lib/logo-geometry.js";
7
+ import { useMessages } from "./locale.js";
8
+ const defaultMessages = { loading: "Loading" };
7
9
  const spinnerSizes = {
8
10
  sm: "size-3 text-[12px]",
9
11
  default: "size-4 text-[16px]",
@@ -66,7 +68,8 @@ function Art({ variant, maskId }) {
66
68
  * under reduced motion. The rule people break: a spinner for work with a known length — use
67
69
  * `Progress` when you can say how far along it is.
68
70
  */
69
- export function Spinner({ variant = "ring", size = "default", label = "Loading", className, ...props }) {
71
+ export function Spinner({ variant = "ring", size = "default", label, className, ...props }) {
70
72
  const maskId = `ep-spinner-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
71
- return (_jsx("span", { role: "status", "aria-label": label, "data-slot": "spinner", "data-variant": variant, "data-size": size, className: cn("inline-flex shrink-0 items-center justify-center align-middle text-current", spinnerSizes[size], className), ...props, children: variant === "ring" ? (_jsx(LoaderCircleIcon, { "aria-hidden": true, className: "size-full animate-spin motion-reduce:animate-none" })) : variant === "ascii" ? (_jsxs("span", { "aria-hidden": true, className: "block h-[1em] w-[1ch] overflow-hidden text-center font-mono leading-none", children: [_jsx("span", { "data-slot": "spinner-frames", className: "flex flex-col motion-reduce:hidden", children: ASCII_FRAMES.map((frame) => (_jsx("span", { className: "block h-[1em]", children: frame }, frame))) }), _jsx("span", { className: "hidden h-[1em] motion-reduce:block", children: "\u2026" })] })) : (_jsx(Art, { variant: variant, maskId: maskId })) }));
73
+ const text = useMessages("spinner", defaultMessages);
74
+ return (_jsx("span", { role: "status", "aria-label": label ?? text.loading, "data-slot": "spinner", "data-variant": variant, "data-size": size, className: cn("inline-flex shrink-0 items-center justify-center align-middle text-current", spinnerSizes[size], className), ...props, children: variant === "ring" ? (_jsx(LoaderCircleIcon, { "aria-hidden": true, className: "size-full animate-spin motion-reduce:animate-none" })) : variant === "ascii" ? (_jsxs("span", { "aria-hidden": true, className: "block h-[1em] w-[1ch] overflow-hidden text-center font-mono leading-none", children: [_jsx("span", { "data-slot": "spinner-frames", className: "flex flex-col motion-reduce:hidden", children: ASCII_FRAMES.map((frame) => (_jsx("span", { className: "block h-[1em]", children: frame }, frame))) }), _jsx("span", { className: "hidden h-[1em] motion-reduce:block", children: "\u2026" })] })) : (_jsx(Art, { variant: variant, maskId: maskId })) }));
72
75
  }
@@ -0,0 +1,91 @@
1
+ import * as React from "react";
2
+ export interface StatMessages {
3
+ /** Read for a rise, with the change formatted: "Up 12%". */
4
+ up: (change: string) => string;
5
+ /** Read for a fall: "Down 3.4%". */
6
+ down: (change: string) => string;
7
+ /** Read when the change is zero. */
8
+ unchanged: string;
9
+ }
10
+ declare module "./locale" {
11
+ interface Messages {
12
+ stat: StatMessages;
13
+ }
14
+ }
15
+ export interface SparklineProps extends Omit<React.ComponentProps<"svg">, "children" | "fill"> {
16
+ /** The values in order, oldest first. Non-finite values are skipped. */
17
+ data: number[];
18
+ /** The soft fill under the line, fading to nothing. Default `true`. */
19
+ area?: boolean;
20
+ /** The line's colour. Default `var(--chart-1)`, the ink of the charts' first series. */
21
+ color?: string;
22
+ /** Where the vertical scale starts: the lowest value (default), or zero. */
23
+ baseline?: "data" | "zero";
24
+ /** The line's width in pixels. Default `1.25`. */
25
+ strokeWidth?: number;
26
+ }
27
+ /**
28
+ * Sparkline — the shape of a figure over its period, as one line in the ink with a soft fill
29
+ * beneath, in inline SVG: no axis, no tooltip, no colour. As wide as its column and 36px tall
30
+ * (set another height with a class).
31
+ *
32
+ * It is there to be glanced at; the figure beside it is what is read. Hidden from assistive tech
33
+ * unless you give it an `aria-label`. The rule people break: reading values off it. When the
34
+ * days matter, draw a `Chart`.
35
+ */
36
+ export declare function Sparkline({ data, area, color, baseline, strokeWidth, className, "aria-label": ariaLabel, ...props }: SparklineProps): React.JSX.Element;
37
+ export interface StatGroupProps extends React.ComponentProps<"dl"> {
38
+ }
39
+ /**
40
+ * StatGroup — a row of `Stat`s as one description list, each figure read with its label. A grid
41
+ * that fits as many 10rem columns as there is room for; set your own columns with a class
42
+ * (`grid-cols-2 @3xl:grid-cols-4`).
43
+ */
44
+ export declare function StatGroup({ className, ...props }: StatGroupProps): React.JSX.Element;
45
+ declare const valueSizes: {
46
+ readonly sm: "text-xl";
47
+ readonly default: "text-2xl";
48
+ readonly lg: "text-3xl";
49
+ };
50
+ export interface StatProps extends Omit<React.ComponentProps<"div">, "children"> {
51
+ /** What is counted, as a short eyebrow: "Orders", "Takings (sample)". */
52
+ label: React.ReactNode;
53
+ /** The figure. A number is formatted for the locale with `format`; text is shown as it is — keep the unit in it. */
54
+ value: React.ReactNode;
55
+ /** `Intl.NumberFormat` options for a number `value`: `{ style: "currency", currency: "EUR" }`. */
56
+ format?: Intl.NumberFormatOptions;
57
+ /**
58
+ * The change against the period before, signed: `0.12` is a rise of 12% with the default
59
+ * format. It shows as an arrow, the amount and, when it is good or bad, the status colour.
60
+ */
61
+ change?: number;
62
+ /** `Intl.NumberFormat` options for `change`. Default: a percent with up to one decimal. */
63
+ changeFormat?: Intl.NumberFormatOptions;
64
+ /** What the change is against, after it: "vs. previous 14 days". */
65
+ changeLabel?: React.ReactNode;
66
+ /**
67
+ * Which way is good: `up` (more orders), `down` (fewer cancellations, a faster page), or
68
+ * `neither` (no colour — a change that is only news). Default `up`.
69
+ */
70
+ better?: "up" | "down" | "neither";
71
+ /** A line under the figure: where it comes from, or what it covers. */
72
+ description?: React.ReactNode;
73
+ /** The figure over its period, oldest first, drawn as a `Sparkline` under it. */
74
+ series?: number[];
75
+ /** The figure's size: `sm` 20px, `default` 24px, `lg` 30px. */
76
+ size?: keyof typeof valueSizes;
77
+ /** Interface text; a LocaleProvider sets it for every Stat. */
78
+ labels?: Partial<StatMessages>;
79
+ }
80
+ /**
81
+ * Stat — one product figure: a mono eyebrow label, the value in large Licht Mono tabular
82
+ * figures, and under it, if you have them, the change on the period before, a line of where it
83
+ * comes from and a sparkline of its days. A top hairline, no box.
84
+ *
85
+ * The change carries an arrow and the amount in text; it takes the status colour only when its
86
+ * direction is good or bad (`better`), green for the better way and red for the worse. The rule
87
+ * people break: inventing figures to fill a row, and colouring every change. A figure that
88
+ * isn't measured stays out, and a change that is only news is `better="neither"`.
89
+ */
90
+ export declare function Stat({ label, value, format, change, changeFormat, changeLabel, better, description, series, size, labels, className, ...props }: StatProps): React.JSX.Element;
91
+ export {};
@@ -0,0 +1,141 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ArrowDownRightIcon, ArrowUpRightIcon, MinusIcon } from "lucide-react";
4
+ import * as React from "react";
5
+ import { cn } from "../lib/cn.js";
6
+ import { useLocale, useMessages } from "./locale.js";
7
+ const defaultMessages = {
8
+ up: (change) => `Up ${change}`,
9
+ down: (change) => `Down ${change}`,
10
+ unchanged: "No change",
11
+ };
12
+ const sign = (x) => (x < 0 ? -1 : 1);
13
+ /**
14
+ * A smooth line through the points that never overshoots them (monotone in x, as Recharts'
15
+ * `type="monotone"` and d3's curveMonotoneX draw it), so a sparkline here looks like the charts'.
16
+ */
17
+ function monotonePath(points) {
18
+ const n = points.length;
19
+ if (n === 0)
20
+ return "";
21
+ const [x0, y0] = points[0];
22
+ if (n === 1)
23
+ return `M${x0},${y0}`;
24
+ if (n === 2)
25
+ return `M${x0},${y0}L${points[1][0]},${points[1][1]}`;
26
+ const tangents = new Array(n);
27
+ for (let i = 1; i < n - 1; i++) {
28
+ const [xa, ya] = points[i - 1];
29
+ const [xb, yb] = points[i];
30
+ const [xc, yc] = points[i + 1];
31
+ const h0 = xb - xa;
32
+ const h1 = xc - xb;
33
+ // The x values only grow, so neither step is zero.
34
+ const s0 = (yb - ya) / h0;
35
+ const s1 = (yc - yb) / h1;
36
+ const p = (s0 * h1 + s1 * h0) / (h0 + h1);
37
+ tangents[i] = (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
38
+ }
39
+ const end = (i, j, t) => {
40
+ const h = points[j][0] - points[i][0];
41
+ return h ? ((3 * (points[j][1] - points[i][1])) / h - t) / 2 : t;
42
+ };
43
+ tangents[0] = end(0, 1, tangents[1]);
44
+ tangents[n - 1] = end(n - 2, n - 1, tangents[n - 2]);
45
+ let d = `M${x0},${y0}`;
46
+ for (let i = 0; i < n - 1; i++) {
47
+ const [xa, ya] = points[i];
48
+ const [xb, yb] = points[i + 1];
49
+ const dx = (xb - xa) / 3;
50
+ d += `C${xa + dx},${ya + dx * tangents[i]},${xb - dx},${yb - dx * tangents[i + 1]},${xb},${yb}`;
51
+ }
52
+ return d;
53
+ }
54
+ const round = (n) => Math.round(n * 100) / 100;
55
+ /**
56
+ * Sparkline — the shape of a figure over its period, as one line in the ink with a soft fill
57
+ * beneath, in inline SVG: no axis, no tooltip, no colour. As wide as its column and 36px tall
58
+ * (set another height with a class).
59
+ *
60
+ * It is there to be glanced at; the figure beside it is what is read. Hidden from assistive tech
61
+ * unless you give it an `aria-label`. The rule people break: reading values off it. When the
62
+ * days matter, draw a `Chart`.
63
+ */
64
+ export function Sparkline({ data, area = true, color = "var(--chart-1)", baseline = "data", strokeWidth = 1.25, className, "aria-label": ariaLabel, ...props }) {
65
+ const gradientId = `sparkline-${React.useId().replace(/:/g, "")}`;
66
+ const values = data.filter((v) => Number.isFinite(v));
67
+ // The viewBox is stretched to the box: 100 wide, 100 tall, with a little room top and bottom
68
+ // so the line is never cut by the edge.
69
+ const pad = 6;
70
+ let lo = Math.min(...values);
71
+ let hi = Math.max(...values);
72
+ if (baseline === "zero") {
73
+ lo = Math.min(lo, 0);
74
+ hi = Math.max(hi, 0);
75
+ }
76
+ const span = hi - lo;
77
+ const points = values.map((v, i) => [
78
+ round(values.length === 1 ? 50 : (i / (values.length - 1)) * 100),
79
+ round(span === 0 ? 50 : pad + (1 - (v - lo) / span) * (100 - pad * 2)),
80
+ ]);
81
+ const line = monotonePath(points);
82
+ const first = points[0];
83
+ const last = points[points.length - 1];
84
+ return (_jsxs("svg", { "data-slot": "sparkline", viewBox: "0 0 100 100", preserveAspectRatio: "none", overflow: "visible", role: ariaLabel ? "img" : undefined, "aria-label": ariaLabel, "aria-hidden": ariaLabel ? undefined : true, focusable: "false", className: cn("block h-9 w-full", className), ...props, children: [area && first && last && values.length > 1 && (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.16 }), _jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.02 })] }) }), _jsx("path", { "data-slot": "sparkline-area", d: `${line}L${last[0]},100L${first[0]},100Z`, fill: `url(#${gradientId})`, stroke: "none" })] })), line && (_jsx("path", { "data-slot": "sparkline-line", d: line, fill: "none", stroke: color, strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }))] }));
85
+ }
86
+ /* ── Stat ──────────────────────────────────────────────────────────────────── */
87
+ const StatGroupContext = React.createContext(false);
88
+ /**
89
+ * StatGroup — a row of `Stat`s as one description list, each figure read with its label. A grid
90
+ * that fits as many 10rem columns as there is room for; set your own columns with a class
91
+ * (`grid-cols-2 @3xl:grid-cols-4`).
92
+ */
93
+ export function StatGroup({ className, ...props }) {
94
+ return (_jsx(StatGroupContext.Provider, { value: true, children: _jsx("dl", { "data-slot": "stat-group", className: cn("m-0 grid grid-cols-[repeat(auto-fit,minmax(10rem,1fr))] gap-x-6", className), ...props }) }));
95
+ }
96
+ const valueSizes = {
97
+ sm: "text-xl",
98
+ default: "text-2xl",
99
+ lg: "text-3xl",
100
+ };
101
+ /**
102
+ * Stat — one product figure: a mono eyebrow label, the value in large Licht Mono tabular
103
+ * figures, and under it, if you have them, the change on the period before, a line of where it
104
+ * comes from and a sparkline of its days. A top hairline, no box.
105
+ *
106
+ * The change carries an arrow and the amount in text; it takes the status colour only when its
107
+ * direction is good or bad (`better`), green for the better way and red for the worse. The rule
108
+ * people break: inventing figures to fill a row, and colouring every change. A figure that
109
+ * isn't measured stays out, and a change that is only news is `better="neither"`.
110
+ */
111
+ export function Stat({ label, value, format, change, changeFormat, changeLabel, better = "up", description, series, size = "default", labels, className, ...props }) {
112
+ const inGroup = React.useContext(StatGroupContext);
113
+ const text = useMessages("stat", defaultMessages, labels);
114
+ const locale = useLocale();
115
+ const formatter = (options) => {
116
+ try {
117
+ return new Intl.NumberFormat(locale, options);
118
+ }
119
+ catch {
120
+ return new Intl.NumberFormat("en", options);
121
+ }
122
+ };
123
+ const shown = typeof value === "number" ? formatter(format ?? {}).format(value) : value;
124
+ let changeNode = null;
125
+ if (change != null && Number.isFinite(change)) {
126
+ const direction = change > 0 ? "up" : change < 0 ? "down" : "flat";
127
+ const amount = formatter(changeFormat ?? { style: "percent", maximumFractionDigits: 1 }).format(Math.abs(change));
128
+ const tone = direction === "flat" || better === "neither"
129
+ ? "neutral"
130
+ : direction === better
131
+ ? "positive"
132
+ : "negative";
133
+ const Icon = direction === "up" ? ArrowUpRightIcon : direction === "down" ? ArrowDownRightIcon : MinusIcon;
134
+ changeNode = (_jsxs("span", { "data-slot": "stat-change", "data-direction": direction, "data-tone": tone, className: cn("inline-flex items-center gap-0.5 font-mono text-xs tabular-nums [&_svg]:size-3.5 [&_svg]:shrink-0", tone === "positive" && "text-success", tone === "negative" && "text-destructive", tone === "neutral" && "text-foreground-soft"), children: [_jsx(Icon, { "aria-hidden": true }), _jsx("span", { "aria-hidden": true, children: amount }), _jsx("span", { className: "sr-only", children: direction === "up" ? text.up(amount) : direction === "down" ? text.down(amount) : text.unchanged })] }));
135
+ }
136
+ const content = (_jsxs(_Fragment, { children: [_jsx("dt", { "data-slot": "stat-label", className: "eyebrow", children: label }), _jsx("dd", { "data-slot": "stat-value", className: cn("m-0 font-mono leading-none wrap-anywhere text-foreground tabular-nums", valueSizes[size]), children: shown }), changeNode && (_jsxs("dd", { "data-slot": "stat-delta", className: "m-0 flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] leading-snug text-muted-foreground", children: [changeNode, changeLabel != null && _jsx("span", { children: changeLabel })] })), description != null && (_jsx("dd", { "data-slot": "stat-description", className: "m-0 text-[13px] leading-snug text-muted-foreground", children: description })), series && series.length > 0 && (_jsx("dd", { "data-slot": "stat-sparkline", "aria-hidden": true, className: "m-0", children: _jsx(Sparkline, { data: series }) }))] }));
137
+ const classes = cn("flex min-w-0 flex-col gap-3 border-t border-border/60 pt-4 pb-2", className);
138
+ if (inGroup)
139
+ return (_jsx("div", { "data-slot": "stat", "data-size": size, className: classes, ...props, children: content }));
140
+ return (_jsx("dl", { "data-slot": "stat", "data-size": size, className: cn("m-0", classes), ...props, children: content }));
141
+ }
@@ -0,0 +1,71 @@
1
+ import * as React from "react";
2
+ export interface StepperMessages {
3
+ /** Read after a finished step's title. */
4
+ complete: string;
5
+ /** Read after the title of a step with an error, and shown on the compact track. */
6
+ error: string;
7
+ /** The compact track's value: "Step 2 of 4". */
8
+ step: (step: number, count: number) => string;
9
+ /** The compact track's label once every step is finished. */
10
+ done: string;
11
+ }
12
+ declare module "./locale" {
13
+ interface Messages {
14
+ stepper: StepperMessages;
15
+ }
16
+ }
17
+ export type StepperStatus = "upcoming" | "current" | "complete" | "error";
18
+ export interface StepperStep {
19
+ /** A short name: "Workspace", "Shipping", "Review". */
20
+ title: React.ReactNode;
21
+ /** One line under the title. */
22
+ description?: React.ReactNode;
23
+ /**
24
+ * What is wrong with the step — a server's answer about a field on it. Marks the step as an
25
+ * error: a "!" on its marker, this text under its title, and "Needs attention" read out.
26
+ */
27
+ error?: React.ReactNode;
28
+ /** Overrides the status from `value`: `complete` for a step done out of order, say. */
29
+ status?: StepperStatus;
30
+ /** The step can't be gone back to, even when finished. */
31
+ disabled?: boolean;
32
+ /** Shown under the current step's title in a vertical stepper: the step's own form. */
33
+ content?: React.ReactNode;
34
+ }
35
+ export interface StepperProps extends Omit<React.ComponentProps<"div">, "children"> {
36
+ /** The steps, in order. */
37
+ steps: StepperStep[];
38
+ /** The current step, 0-based. Steps before it are complete; `steps.length` finishes them all. */
39
+ value: number;
40
+ /**
41
+ * Called with a step's index when a finished step (or one with an error) is picked, to go back
42
+ * to it. Without it, the steps are only read.
43
+ */
44
+ onValueChange?: (index: number) => void;
45
+ /** Steps in a row, titles under their markers; or stacked, titles beside them. */
46
+ orientation?: "horizontal" | "vertical";
47
+ /**
48
+ * The step in mono over a progress track ("02 / 04 · Team"), in place of the row. `"auto"`
49
+ * (the default for a row) switches when the stepper is narrower than about 8rem a step — a
50
+ * phone, a card; `true` always, `false` never.
51
+ */
52
+ compact?: boolean | "auto";
53
+ /** Names the list of steps (and the compact track). Default: none — pass one when there are two flows on a page. */
54
+ "aria-label"?: string;
55
+ /** Interface text; a LocaleProvider sets it for every Stepper. */
56
+ labels?: Partial<StepperMessages>;
57
+ }
58
+ /**
59
+ * Stepper — where someone is in a flow of a few steps: a checkout, a setup, an application.
60
+ *
61
+ * Each step is a mono index on a small round marker — recessed while upcoming, raised with the
62
+ * focus-grey edge while current, filled with a check once complete, and a red "!" with its error
63
+ * in words when something on it needs fixing — with a title and an optional description, joined
64
+ * by hairlines. An ordered list with `aria-current="step"`. In a narrow space a row of steps
65
+ * becomes the step in mono over a progress track: "02 / 04 · Team".
66
+ *
67
+ * With `onValueChange`, finished steps are buttons that go back to them. The rule people break:
68
+ * letting people jump ahead to steps whose answers depend on the ones before. Only finished
69
+ * steps are links back; the way forward is the step's own Continue.
70
+ */
71
+ export declare function Stepper({ steps, value, onValueChange, orientation, compact, labels, className, "aria-label": ariaLabel, ...props }: StepperProps): React.JSX.Element;
@@ -0,0 +1,101 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { CheckIcon } from "lucide-react";
4
+ import * as React from "react";
5
+ import { cn } from "../lib/cn.js";
6
+ import { useMessages } from "./locale.js";
7
+ import { Progress } from "./progress.js";
8
+ const defaultMessages = {
9
+ complete: "Completed",
10
+ error: "Needs attention",
11
+ step: (step, count) => `Step ${step} of ${count}`,
12
+ done: "Done",
13
+ };
14
+ /** The width under which a row of steps gives way to the compact track, by count (≈ 8rem a step). */
15
+ const rowHidden = {
16
+ 2: "@max-[16rem]/stepper:hidden",
17
+ 3: "@max-[24rem]/stepper:hidden",
18
+ 4: "@max-[32rem]/stepper:hidden",
19
+ 5: "@max-[40rem]/stepper:hidden",
20
+ 6: "@max-[48rem]/stepper:hidden",
21
+ 7: "@max-[56rem]/stepper:hidden",
22
+ 8: "@max-[64rem]/stepper:hidden",
23
+ };
24
+ const compactShown = {
25
+ 2: "@max-[16rem]/stepper:grid",
26
+ 3: "@max-[24rem]/stepper:grid",
27
+ 4: "@max-[32rem]/stepper:grid",
28
+ 5: "@max-[40rem]/stepper:grid",
29
+ 6: "@max-[48rem]/stepper:grid",
30
+ 7: "@max-[56rem]/stepper:grid",
31
+ 8: "@max-[64rem]/stepper:grid",
32
+ };
33
+ const pad = (n) => String(n).padStart(2, "0");
34
+ function statusOf(step, index, value) {
35
+ if (step.error)
36
+ return "error";
37
+ if (step.status)
38
+ return step.status;
39
+ return index < value ? "complete" : index === value ? "current" : "upcoming";
40
+ }
41
+ function Marker({ status, index, changed }) {
42
+ return (_jsx("span", { "aria-hidden": true, "data-slot": "stepper-marker", "data-status": status, "data-changed": changed || undefined, className: cn("relative z-1 inline-flex size-6 shrink-0 items-center justify-center rounded-full font-mono text-[11px] leading-none tabular-nums", "transition-[background-color,color,box-shadow,border-color] duration-(--duration) ease-(--ease)", status === "upcoming" && "material-field text-muted-foreground", status === "current" && "material-raised data-[status=current]:shadow-raised-current", status === "complete" &&
43
+ "border border-transparent bg-primary text-primary-foreground shadow-checked", status === "error" && "material-field text-destructive data-[status=error]:border-destructive"), children: status === "complete" ? (_jsx(CheckIcon, { className: "size-3.5", strokeWidth: 3 })) : status === "error" ? (_jsx("span", { className: "text-[13px] font-semibold", children: "!" })) : (pad(index + 1)) }));
44
+ }
45
+ /**
46
+ * Stepper — where someone is in a flow of a few steps: a checkout, a setup, an application.
47
+ *
48
+ * Each step is a mono index on a small round marker — recessed while upcoming, raised with the
49
+ * focus-grey edge while current, filled with a check once complete, and a red "!" with its error
50
+ * in words when something on it needs fixing — with a title and an optional description, joined
51
+ * by hairlines. An ordered list with `aria-current="step"`. In a narrow space a row of steps
52
+ * becomes the step in mono over a progress track: "02 / 04 · Team".
53
+ *
54
+ * With `onValueChange`, finished steps are buttons that go back to them. The rule people break:
55
+ * letting people jump ahead to steps whose answers depend on the ones before. Only finished
56
+ * steps are links back; the way forward is the step's own Continue.
57
+ */
58
+ export function Stepper({ steps, value, onValueChange, orientation = "horizontal", compact = orientation === "horizontal" ? "auto" : false, labels, className, "aria-label": ariaLabel, ...props }) {
59
+ const text = useMessages("stepper", defaultMessages, labels);
60
+ const count = steps.length;
61
+ const current = Math.min(Math.max(Math.floor(value), 0), count);
62
+ const vertical = orientation === "vertical";
63
+ const auto = compact === "auto";
64
+ const bucket = Math.min(Math.max(count, 2), 8);
65
+ const done = current >= count;
66
+ const step = steps[current];
67
+ // The steps whose status changed with the last move, kept until the next one: their markers
68
+ // animate. None on the first render, so a page doesn't open with every check popping in.
69
+ const statuses = steps.map((s, i) => statusOf(s, i, current)).join();
70
+ const moved = React.useRef(null);
71
+ if (moved.current === null)
72
+ moved.current = { statuses, changed: new Set() };
73
+ else if (moved.current.statuses !== statuses) {
74
+ const before = moved.current.statuses.split(",");
75
+ const after = statuses.split(",");
76
+ moved.current = {
77
+ statuses,
78
+ changed: new Set(after.flatMap((s, i) => (s !== before[i] ? [i] : []))),
79
+ };
80
+ }
81
+ const changed = moved.current.changed;
82
+ const list = compact !== true && (_jsx("ol", { "aria-label": ariaLabel, "data-slot": "stepper-list", className: cn("m-0 flex list-none p-0", vertical ? "flex-col" : "flex-row items-start", auto && rowHidden[bucket]), children: steps.map((s, i) => {
83
+ const status = statusOf(s, i, current);
84
+ const last = i === count - 1;
85
+ const finished = status === "complete" || status === "error";
86
+ const interactive = !!onValueChange && finished && i !== current && !s.disabled;
87
+ const body = (_jsxs(_Fragment, { children: [_jsx(Marker, { status: status, index: i, changed: changed.has(i) }), _jsxs("span", { className: cn("flex min-w-0 flex-col gap-1", vertical ? "pt-0.5 pb-1" : "pe-1"), "data-slot": "stepper-text", children: [_jsxs("span", { "data-slot": "stepper-title", className: cn("font-body text-sm leading-5 font-medium [overflow-wrap:anywhere]", "transition-colors duration-(--duration) ease-(--ease)", status === "upcoming" ? "text-muted-foreground" : "text-foreground", interactive &&
88
+ "underline-offset-4 group-hover/step:underline group-hover/step:decoration-control-focus"), children: [s.title, status === "complete" && _jsx("span", { className: "sr-only", children: `, ${text.complete}` }), status === "error" && _jsx("span", { className: "sr-only", children: `, ${text.error}` })] }), s.description != null && (_jsx("span", { "data-slot": "stepper-description", className: "text-[13px] leading-snug [overflow-wrap:anywhere] text-muted-foreground", children: s.description })), s.error != null && typeof s.error !== "boolean" && (_jsx("span", { "data-slot": "stepper-error", className: "text-[13px] leading-snug [overflow-wrap:anywhere] text-destructive", children: s.error }))] })] }));
89
+ const inner = cn("group/step relative flex min-w-0 gap-3 text-start", vertical ? "flex-row" : "flex-col items-start");
90
+ return (_jsxs("li", { "data-slot": "stepper-item", "data-status": status, "aria-current": i === current ? "step" : undefined, className: cn("relative min-w-0", vertical ? "flex flex-col pb-6 last:pb-0" : "flex-1 pe-3 last:flex-none last:pe-0"), children: [!last && (_jsx("span", { "aria-hidden": true, "data-slot": "stepper-connector", "data-complete": status === "complete" || undefined, className: cn("absolute overflow-hidden bg-border", vertical
91
+ ? "start-3 top-8 bottom-2 w-px -translate-x-1/2 rtl:translate-x-1/2"
92
+ : "start-9 end-3 top-3 h-px"), children: _jsx("span", { className: cn(
93
+ // 240ms on an ease-out milder than the brand's, which would draw it all in the first frames.
94
+ "absolute inset-0 bg-control-focus transition-transform duration-[calc(var(--duration)*1.6)] ease-[cubic-bezier(0.33,1,0.68,1)]", vertical ? "origin-top" : "origin-left rtl:origin-right", status === "complete" ? "scale-100" : vertical ? "scale-y-0" : "scale-x-0") }) })), interactive ? (_jsx("button", { type: "button", "data-slot": "stepper-trigger", onClick: () => onValueChange(i),
95
+ // Room around the content for the focus outline, without moving it.
96
+ className: cn(inner, "-m-1.5 cursor-pointer rounded-item border-0 bg-transparent p-1.5 focus-ring"), children: body })) : (_jsx("div", { className: inner, children: body })), vertical && i === current && s.content != null && (_jsx("div", { "data-slot": "stepper-content", "data-changed": changed.has(i) || undefined, className: "ps-9 pt-3", children: s.content }))] }, i));
97
+ }) }));
98
+ const errorText = step?.error ? ` · ${text.error}` : "";
99
+ const track = compact !== false && (_jsx(Progress, { "data-slot": "stepper-compact", label: done ? (text.done) : (_jsxs(_Fragment, { children: [`${pad(current + 1)} / ${pad(count)} · `, step?.title, errorText] })), value: done ? count : current + 1, max: Math.max(count, 1), getAriaValueText: () => (done ? text.done : text.step(current + 1, count)), "aria-label": ariaLabel, className: cn(auto && cn("hidden", compactShown[bucket])) }));
100
+ return (_jsxs("div", { "data-slot": "stepper", "data-orientation": orientation, "data-compact": compact === true ? "" : compact === "auto" ? "auto" : undefined, className: cn("@container/stepper w-full min-w-0", className), ...props, children: [list, track] }));
101
+ }
@@ -4,8 +4,8 @@ export interface SwitchProps extends BaseSwitch.Root.Props {
4
4
  }
5
5
  /**
6
6
  * Switch — a setting that takes effect immediately: a recessed track with a raised round thumb.
7
- * On, the track takes the primary fill. Hover stretches the thumb, a press stretches it further,
8
- * and it slides across (size and travel live in parts/controls.css).
7
+ * On, the track takes the primary fill. A press stretches the thumb toward where it will go, and
8
+ * it slides across (size and travel live in parts/controls.css).
9
9
  *
10
10
  * Use a switch when flipping it changes something right away (notifications, a preview mode).
11
11
  * The rule people break: using a switch inside a form that still needs "Save" — that is a
@@ -7,8 +7,8 @@ import { useFormReset } from "../lib/form-reset.js";
7
7
  import { mergeRefs } from "../lib/merge-refs.js";
8
8
  /**
9
9
  * Switch — a setting that takes effect immediately: a recessed track with a raised round thumb.
10
- * On, the track takes the primary fill. Hover stretches the thumb, a press stretches it further,
11
- * and it slides across (size and travel live in parts/controls.css).
10
+ * On, the track takes the primary fill. A press stretches the thumb toward where it will go, and
11
+ * it slides across (size and travel live in parts/controls.css).
12
12
  *
13
13
  * Use a switch when flipping it changes something right away (notifications, a preview mode).
14
14
  * The rule people break: using a switch inside a form that still needs "Save" — that is a
@@ -61,7 +61,12 @@ export interface TableHeadProps extends Omit<React.ComponentProps<"th">, "align"
61
61
  /** With `fit`: the column that names each row and never steps out. Defaults to the first column. */
62
62
  titleColumn?: boolean;
63
63
  }
64
- /** A column header, set as an eyebrow: 12px mono, uppercase, 0.18em tracking, muted. */
64
+ /**
65
+ * A header cell. In the `TableHeader` it is a column header, set as an eyebrow: 12px mono,
66
+ * uppercase, 0.18em tracking, muted. In a body or footer row it is that row's header — a
67
+ * `<th scope="row">` set like a cell in the foreground ink, not as an eyebrow: use it for the
68
+ * cell that names the row (a feature in a comparison, a month in a report).
69
+ */
65
70
  export declare function TableHead({ numeric, align, width, priority, inline, minWidth, titleColumn, className, style, ...props }: TableHeadProps): React.JSX.Element;
66
71
  export interface TableCellProps extends React.ComponentProps<"td"> {
67
72
  /** Numbers, amounts, dates and IDs: Licht Mono, tabular figures, right-aligned. */
@@ -86,7 +91,7 @@ export interface TableGroupProps extends React.ComponentProps<"tbody"> {
86
91
  * break: grouping by something every row shares, or into groups of one. If most groups would
87
92
  * hold a single row, sort the column instead.
88
93
  */
89
- export declare function TableGroup({ open: openProp, defaultOpen, onOpenChange, collapsible, className, ...props }: TableGroupProps): React.JSX.Element;
94
+ export declare function TableGroup({ open: openProp, defaultOpen, onOpenChange, collapsible, className, ref, ...props }: TableGroupProps): React.JSX.Element;
90
95
  export interface TableGroupHeaderProps extends Omit<React.ComponentProps<"tr">, "children"> {
91
96
  /** The group's label: the shared value ("Running"), or a `Tag` for a status. */
92
97
  children: React.ReactNode;
@@ -147,6 +152,11 @@ export interface TableVirtualBodyProps<TRow> {
147
152
  overscan?: number;
148
153
  /** When it changes, a table scrolled past its first row scrolls back to it: pass the search text. */
149
154
  scrollResetKey?: unknown;
155
+ /**
156
+ * Called with the rows rendered (in view and `overscan` beyond), as `[from, to)` indices into
157
+ * `rows`, whenever they change: load the rows there when they come from a server. Not with groups.
158
+ */
159
+ onRangeChange?: (from: number, to: number) => void;
150
160
  }
151
161
  /**
152
162
  * TableVirtualBody — the body of a table with thousands of rows, in place of `TableBody` (or the
@@ -157,6 +167,6 @@ export interface TableVirtualBodyProps<TRow> {
157
167
  * Use it from a few hundred rows on. The rule people break: reaching for it for a page of rows —
158
168
  * rows that are not rendered can't be found with the browser's search or printed.
159
169
  */
160
- export declare function TableVirtualBody<TRow>({ rows, groups, renderRow, getRowKey, sizeRows, overscan, scrollResetKey, }: TableVirtualBodyProps<TRow>): React.JSX.Element;
170
+ export declare function TableVirtualBody<TRow>({ rows, groups, renderRow, getRowKey, sizeRows, overscan, scrollResetKey, onRangeChange, }: TableVirtualBodyProps<TRow>): React.JSX.Element;
161
171
  /** A short description of the table, under it. Prefer it over a heading inside the card. */
162
172
  export declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;