@stll/ui 0.68.0 → 0.71.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 (65) hide show
  1. package/dist/calendar/day-calendar.d.ts +22 -6
  2. package/dist/calendar/day-calendar.js +97 -26
  3. package/dist/calendar/resource-calendar.js +7 -9
  4. package/dist/calendar/topic-colors.d.ts +3 -0
  5. package/dist/calendar/topic-colors.js +19 -0
  6. package/dist/components/button.d.ts +13 -1
  7. package/dist/components/button.js +18 -9
  8. package/dist/components/composer-tokens.d.ts +6 -2
  9. package/dist/components/composer-tokens.js +6 -2
  10. package/dist/components/composer.d.ts +13 -0
  11. package/dist/components/composer.js +19 -3
  12. package/dist/components/court-filter.js +4 -4
  13. package/dist/components/date-picker-popover.js +11 -4
  14. package/dist/components/document-identity-badge.js +15 -4
  15. package/dist/components/file-input.js +3 -2
  16. package/dist/components/horizontal-scroller.d.ts +6 -0
  17. package/dist/components/horizontal-scroller.js +59 -33
  18. package/dist/components/identity-text.js +5 -2
  19. package/dist/components/input-group.js +3 -2
  20. package/dist/components/landing.js +6 -5
  21. package/dist/components/list.d.ts +11 -5
  22. package/dist/components/list.js +28 -9
  23. package/dist/components/loader.js +4 -2
  24. package/dist/components/outline-rail.js +6 -4
  25. package/dist/components/run-state-mark.d.ts +8 -0
  26. package/dist/components/run-state-mark.js +30 -0
  27. package/dist/components/run-state-mark.native.d.ts +9 -0
  28. package/dist/components/run-state-mark.native.js +98 -0
  29. package/dist/components/run-state-mark.shared.d.ts +53 -0
  30. package/dist/components/run-state-mark.shared.js +45 -0
  31. package/dist/components/split-button.d.ts +6 -1
  32. package/dist/components/split-button.js +8 -3
  33. package/dist/components/status-mark.js +6 -6
  34. package/dist/components/status-mark.shared.d.ts +12 -0
  35. package/dist/components/status-mark.shared.js +14 -0
  36. package/dist/components/table.d.ts +1 -1
  37. package/dist/components/table.js +13 -7
  38. package/dist/components/text.native.d.ts +3 -1
  39. package/dist/components/text.native.js +4 -2
  40. package/dist/components/truncated-text.d.ts +14 -3
  41. package/dist/components/truncated-text.js +21 -5
  42. package/dist/components/view-toolbar.d.ts +11 -3
  43. package/dist/components/view-toolbar.js +16 -5
  44. package/dist/icons.d.ts +2 -2
  45. package/dist/icons.js +1 -1
  46. package/dist/index.d.ts +2 -2
  47. package/dist/index.js +2 -2
  48. package/dist/inspector/chrome.d.ts +3 -3
  49. package/dist/inspector/chrome.js +28 -17
  50. package/dist/kanban/column-band-header.js +3 -2
  51. package/dist/kanban/column-header.js +3 -2
  52. package/dist/kanban/sticky-lane.js +3 -2
  53. package/dist/lib/file-size.d.ts +16 -0
  54. package/dist/lib/file-size.js +30 -0
  55. package/dist/lib/matter-colors.js +2 -5
  56. package/dist/lib/stable-hash.d.ts +2 -0
  57. package/dist/lib/stable-hash.js +8 -0
  58. package/dist/review/review-comment-card.js +7 -6
  59. package/dist/review/review-decision-actions.d.ts +8 -1
  60. package/dist/review/review-decision-actions.js +13 -4
  61. package/dist/review/review-out-of-date-notice.d.ts +7 -1
  62. package/dist/review/review-out-of-date-notice.js +4 -1
  63. package/dist/styles/inline-rename.css +9 -0
  64. package/dist/styles/theme.css +24 -0
  65. package/package.json +15 -3
@@ -13,6 +13,12 @@ type ScrollState = {
13
13
  };
14
14
  export declare const HorizontalScroller: ({ children, className, nextLabel, previousLabel, contentClassName, viewportClassName, ...props }: HorizontalScrollerProps) => import("react").JSX.Element;
15
15
  export declare const scrollState: (scrollLeft: number, scrollWidth: number, clientWidth: number, direction: ScrollDirection) => ScrollState;
16
+ /**
17
+ * Whether the content needs the controls at all, decided from `rowWidth`, the
18
+ * whole width the scroller has: the controls take room from the viewport once
19
+ * they show, and content that fits the row without them needs none.
20
+ */
21
+ export declare const fitsRow: (scrollWidth: number, rowWidth: number) => boolean;
16
22
  /** Wheel deltas arrive in pixels, lines or pages; scrollBy takes pixels. */
17
23
  export declare const wheelDeltaPixels: (event: Pick<WheelEvent, "deltaMode" | "deltaY">, node: Pick<HTMLElement, "clientWidth">) => number;
18
24
  export {};
@@ -3,10 +3,11 @@ import { containedEventHandler } from "../hooks/use-contained-handler.js";
3
3
  import { ChevronLeftIcon, ChevronRightIcon } from "../icons.js";
4
4
  import { SCROLL_EDGE_FADE_CLASS, writeScrollEdgeFade } from "../lib/scroll-edge-fade.js";
5
5
  import { cn } from "../lib/utils.js";
6
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useCallback, useState } from "react";
8
8
  // src/components/horizontal-scroller.tsx
9
- const CONTROL_CLASS = "bg-background/90 text-foreground absolute top-1/2 -translate-y-1/2 rounded-full border p-1 shadow-sm";
9
+ const CONTROL_CLASS = "bg-background text-foreground shrink-0 rounded-full border p-1 shadow-sm";
10
+ const INERT_CONTROL_CLASS = "pointer-events-none w-0 overflow-hidden border-0 p-0 opacity-0 focus-visible:w-auto focus-visible:border focus-visible:p-1 focus-visible:opacity-100";
10
11
  const HorizontalScroller = ({ children, className, nextLabel, previousLabel, contentClassName, viewportClassName, ...props }) => {
11
12
  const [viewport, setViewport] = useState(null);
12
13
  const [state, setState] = useState({
@@ -15,7 +16,11 @@ const HorizontalScroller = ({ children, className, nextLabel, previousLabel, con
15
16
  });
16
17
  const measure = useCallback((node) => {
17
18
  writeScrollEdgeFade(node);
18
- setState(scrollState(node.scrollLeft, node.scrollWidth, node.clientWidth, getComputedStyle(node).direction === "rtl" ? "rtl" : "ltr"));
19
+ const rowWidth = rowContentWidth(node.parentElement) ?? node.clientWidth;
20
+ setState(fitsRow(node.scrollWidth, rowWidth) ? {
21
+ canScrollEnd: false,
22
+ canScrollStart: false
23
+ } : scrollState(node.scrollLeft, node.scrollWidth, node.clientWidth, getComputedStyle(node).direction === "rtl" ? "rtl" : "ltr"));
19
24
  }, []);
20
25
  const viewportRef = useCallback((node) => {
21
26
  setViewport(node);
@@ -48,8 +53,9 @@ const HorizontalScroller = ({ children, className, nextLabel, previousLabel, con
48
53
  });
49
54
  };
50
55
  const onScroll = (event) => measure(event.currentTarget);
56
+ const overflows = state.canScrollStart || state.canScrollEnd;
51
57
  return /* @__PURE__ */ jsxs("div", {
52
- className: cn("relative min-w-0", className),
58
+ className: cn("flex min-w-0 items-center", className),
53
59
  onFocus: containedEventHandler(({ target }) => {
54
60
  if (target instanceof HTMLElement && target !== viewport) target.scrollIntoView({
55
61
  block: "nearest",
@@ -57,35 +63,39 @@ const HorizontalScroller = ({ children, className, nextLabel, previousLabel, con
57
63
  });
58
64
  }),
59
65
  ...props,
60
- children: [/* @__PURE__ */ jsx("div", {
61
- className: cn("scrollbar-subtle overflow-x-auto overscroll-x-contain [--fade-size:2.5rem]", SCROLL_EDGE_FADE_CLASS, viewportClassName),
62
- onScroll,
63
- ref: viewportRef,
64
- children: /* @__PURE__ */ jsx("div", {
65
- className: cn("w-max min-w-full", contentClassName),
66
- children
66
+ children: [
67
+ overflows && /* @__PURE__ */ jsx("button", {
68
+ "aria-disabled": !state.canScrollStart,
69
+ tabIndex: state.canScrollStart ? void 0 : -1,
70
+ "aria-label": previousLabel,
71
+ className: cn(CONTROL_CLASS, state.canScrollStart ? "me-1" : INERT_CONTROL_CLASS),
72
+ onClick: () => {
73
+ if (state.canScrollStart) scroll(-1);
74
+ },
75
+ type: "button",
76
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-4 rtl:rotate-180" })
77
+ }),
78
+ /* @__PURE__ */ jsx("div", {
79
+ className: cn("scrollbar-subtle min-w-0 flex-1 overflow-x-auto overscroll-x-contain [--fade-size:2.5rem]", SCROLL_EDGE_FADE_CLASS, viewportClassName),
80
+ onScroll,
81
+ ref: viewportRef,
82
+ children: /* @__PURE__ */ jsx("div", {
83
+ className: cn("w-max min-w-full", contentClassName),
84
+ children
85
+ })
86
+ }),
87
+ overflows && /* @__PURE__ */ jsx("button", {
88
+ "aria-disabled": !state.canScrollEnd,
89
+ tabIndex: state.canScrollEnd ? void 0 : -1,
90
+ "aria-label": nextLabel,
91
+ className: cn(CONTROL_CLASS, state.canScrollEnd ? "ms-1" : INERT_CONTROL_CLASS),
92
+ onClick: () => {
93
+ if (state.canScrollEnd) scroll(1);
94
+ },
95
+ type: "button",
96
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-4 rtl:rotate-180" })
67
97
  })
68
- }), (state.canScrollStart || state.canScrollEnd) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
69
- "aria-disabled": !state.canScrollStart,
70
- tabIndex: state.canScrollStart ? void 0 : -1,
71
- "aria-label": previousLabel,
72
- className: cn(CONTROL_CLASS, "start-1", !state.canScrollStart && "pointer-events-none opacity-0 focus-visible:opacity-100"),
73
- onClick: () => {
74
- if (state.canScrollStart) scroll(-1);
75
- },
76
- type: "button",
77
- children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-4 rtl:rotate-180" })
78
- }), /* @__PURE__ */ jsx("button", {
79
- "aria-disabled": !state.canScrollEnd,
80
- tabIndex: state.canScrollEnd ? void 0 : -1,
81
- "aria-label": nextLabel,
82
- className: cn(CONTROL_CLASS, "end-1", !state.canScrollEnd && "pointer-events-none opacity-0 focus-visible:opacity-100"),
83
- onClick: () => {
84
- if (state.canScrollEnd) scroll(1);
85
- },
86
- type: "button",
87
- children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-4 rtl:rotate-180" })
88
- })] })]
98
+ ]
89
99
  });
90
100
  };
91
101
  const scrollState = (scrollLeft, scrollWidth, clientWidth, direction) => {
@@ -96,6 +106,22 @@ const scrollState = (scrollLeft, scrollWidth, clientWidth, direction) => {
96
106
  canScrollEnd: maximum > 1 && position < maximum - 1
97
107
  };
98
108
  };
109
+ /**
110
+ * The width the row's children span: the room the controls and the viewport
111
+ * share, without the row's own padding, in either direction.
112
+ */
113
+ const rowContentWidth = (row) => {
114
+ const first = row?.firstElementChild?.getBoundingClientRect();
115
+ const last = row?.lastElementChild?.getBoundingClientRect();
116
+ if (first === void 0 || last === void 0) return;
117
+ return Math.max(first.right, last.right) - Math.min(first.left, last.left);
118
+ };
119
+ /**
120
+ * Whether the content needs the controls at all, decided from `rowWidth`, the
121
+ * whole width the scroller has: the controls take room from the viewport once
122
+ * they show, and content that fits the row without them needs none.
123
+ */
124
+ const fitsRow = (scrollWidth, rowWidth) => scrollWidth - rowWidth <= 1;
99
125
  const LINE_HEIGHT_PX = 16;
100
126
  /** Wheel deltas arrive in pixels, lines or pages; scrollBy takes pixels. */
101
127
  const wheelDeltaPixels = (event, node) => {
@@ -105,4 +131,4 @@ const wheelDeltaPixels = (event, node) => {
105
131
  default: return event.deltaY;
106
132
  }
107
133
  };
108
- export { HorizontalScroller, scrollState, wheelDeltaPixels };
134
+ export { HorizontalScroller, fitsRow, scrollState, wheelDeltaPixels };
@@ -2,6 +2,7 @@
2
2
  import { cn } from "../lib/utils.js";
3
3
  import { withoutDirectionalControls } from "./bidi-text.js";
4
4
  import { Tooltip, TooltipContent as TooltipPopup, TooltipTrigger } from "./tooltip.js";
5
+ import { TruncatedText } from "./truncated-text.js";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  import { useCallback, useId, useState } from "react";
7
8
  // src/components/identity-text.tsx
@@ -51,9 +52,10 @@ const IdentityText = ({ children, className }) => {
51
52
  setOpen(true);
52
53
  }
53
54
  },
54
- render: /* @__PURE__ */ jsx("span", {
55
- className: cn("focus-visible:ring-ring block min-w-0 truncate outline-none [unicode-bidi:isolate] focus-visible:ring-2", className),
55
+ render: /* @__PURE__ */ jsx(TruncatedText, {
56
+ className: cn("focus-visible:ring-ring outline-none [unicode-bidi:isolate] focus-visible:ring-2", className),
56
57
  dir: "auto",
58
+ hint: false,
57
59
  ref: textRef,
58
60
  role: overflow && !hasFocusOwner ? "button" : void 0,
59
61
  tabIndex: overflow && !hasFocusOwner ? 0 : void 0
@@ -62,6 +64,7 @@ const IdentityText = ({ children, className }) => {
62
64
  }), /* @__PURE__ */ jsx(TooltipPopup, {
63
65
  className: "max-w-sm",
64
66
  role: "tooltip",
67
+ side: "inline-end",
65
68
  children: /* @__PURE__ */ jsx("span", {
66
69
  className: "block max-w-sm wrap-break-word",
67
70
  dir: "auto",
@@ -2,6 +2,7 @@
2
2
  import { cn } from "../lib/utils.js";
3
3
  import { Input } from "./input.js";
4
4
  import { Textarea } from "./textarea.js";
5
+ import { TruncatedText } from "./truncated-text.js";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  import { cva } from "class-variance-authority";
7
8
  // src/components/input-group.tsx
@@ -35,8 +36,8 @@ const InputGroupAddon = ({ className, align = "inline-start", ...props }) => /*
35
36
  },
36
37
  ...props
37
38
  });
38
- const InputGroupText = ({ className, ...props }) => /* @__PURE__ */ jsx("span", {
39
- className: cn("text-muted-foreground flex items-center gap-2 truncate leading-none [&_svg]:pointer-events-none [&_svg]:-mx-0.5 in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4", className),
39
+ const InputGroupText = ({ className, ...props }) => /* @__PURE__ */ jsx(TruncatedText, {
40
+ className: cn("text-muted-foreground flex items-center gap-2 leading-none [&_svg]:pointer-events-none [&_svg]:-mx-0.5 in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4", className),
40
41
  ...props
41
42
  });
42
43
  const InputGroupInput = ({ className, ...props }) => /* @__PURE__ */ jsx(Input, {
@@ -2,6 +2,7 @@
2
2
  import { cn } from "../lib/utils.js";
3
3
  import { BidiText } from "./bidi-text.js";
4
4
  import { ScrollArea } from "./scroll-area.js";
5
+ import { TruncatedText } from "./truncated-text.js";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  // src/components/landing.tsx
7
8
  const LandingLayout = ({ actions, hero, children, footer }) => /* @__PURE__ */ jsxs("div", {
@@ -88,12 +89,12 @@ const LandingItemText = ({ icon, iconTone = "muted", meta, title }) => /* @__PUR
88
89
  children: icon
89
90
  }), /* @__PURE__ */ jsxs("span", {
90
91
  className: "min-w-0 flex-1",
91
- children: [/* @__PURE__ */ jsx(BidiText, {
92
- as: "span",
93
- className: "text-foreground block truncate text-sm font-medium",
92
+ children: [/* @__PURE__ */ jsx(TruncatedText, {
93
+ className: "text-foreground text-sm font-medium",
94
+ render: /* @__PURE__ */ jsx(BidiText, { as: "span" }),
94
95
  children: title
95
- }), meta !== void 0 && meta !== null ? /* @__PURE__ */ jsx("span", {
96
- className: "text-muted-foreground block truncate text-xs",
96
+ }), meta !== void 0 && meta !== null ? /* @__PURE__ */ jsx(TruncatedText, {
97
+ className: "text-muted-foreground text-xs",
97
98
  children: meta
98
99
  }) : null]
99
100
  })]
@@ -1,4 +1,5 @@
1
1
  import * as React$1 from "react";
2
+ import { TruncatedTextLines } from "./truncated-text.js";
2
3
  import { VariantProps } from "class-variance-authority";
3
4
  import { useRender } from "@base-ui/react/use-render";
4
5
  /**
@@ -39,15 +40,20 @@ declare const listItemMediaVariants: (props?: ({
39
40
  /** Fixed 32px tile for an icon, logo or initial. */
40
41
  declare const ListItemMedia: ({ className, variant, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof listItemMediaVariants>) => React$1.JSX.Element;
41
42
  declare const ListItemContent: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
42
- declare const ListItemTitle: ({ className, ...props }: React$1.ComponentProps<"span">) => React$1.JSX.Element;
43
+ declare const listItemTitleVariants: (props?: ({
44
+ variant?: "name" | "statement" | null | undefined;
45
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
46
+ declare const ListItemTitle: ({ className, variant, ...props }: React$1.ComponentProps<"span"> & VariantProps<typeof listItemTitleVariants>) => React$1.JSX.Element;
43
47
  declare const listItemDescriptionVariants: (props?: ({
44
- variant?: "code" | "text" | null | undefined;
48
+ variant?: "code" | "paragraph" | "text" | null | undefined;
45
49
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
46
50
  /**
47
- * Secondary line. Pass `line-clamp-2` when two lines are genuinely needed;
48
- * never `whitespace-nowrap`.
51
+ * Secondary line, one line by default. Use the `paragraph` variant (two
52
+ * lines) or `lines` when more is genuinely needed; never `whitespace-nowrap`.
49
53
  */
50
- declare const ListItemDescription: ({ className, variant, ...props }: React$1.ComponentProps<"span"> & VariantProps<typeof listItemDescriptionVariants>) => React$1.JSX.Element;
54
+ declare const ListItemDescription: ({ className, variant, lines, ...props }: React$1.ComponentProps<"span"> & VariantProps<typeof listItemDescriptionVariants> & {
55
+ lines?: TruncatedTextLines;
56
+ }) => React$1.JSX.Element;
51
57
  declare const ListItemActions: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
52
58
  /** Single-line empty row inside a `List`. Phrase it as the next action. */
53
59
  declare const ListEmpty: ({ className, ...props }: React$1.ComponentProps<"li">) => React$1.JSX.Element;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "../lib/utils.js";
3
3
  import { AnimatedCount } from "./animated-count.js";
4
+ import { TruncatedText } from "./truncated-text.js";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { mergeProps } from "@base-ui/react/merge-props";
6
7
  import { useRender } from "@base-ui/react/use-render";
@@ -106,29 +107,47 @@ const ListItemContent = ({ className, ...props }) => /* @__PURE__ */ jsx("div",
106
107
  "data-slot": "list-item-content",
107
108
  ...props
108
109
  });
109
- const ListItemTitle = ({ className, ...props }) => /* @__PURE__ */ jsx("span", {
110
- className: cn("text-foreground truncate text-sm font-medium", className),
110
+ const listItemTitleVariants = cva("text-foreground text-sm font-medium", {
111
+ defaultVariants: { variant: "name" },
112
+ variants: { variant: {
113
+ /** A name: one line, cut at the end. */
114
+ name: "",
115
+ /** A statement a reader must see whole to judge (a proposed fact): up
116
+ * to two lines, then cut. */
117
+ statement: "text-pretty wrap-break-word"
118
+ } }
119
+ });
120
+ const LIST_ITEM_TITLE_LINES = {
121
+ name: 1,
122
+ statement: 2
123
+ };
124
+ const ListItemTitle = ({ className, variant, ...props }) => /* @__PURE__ */ jsx(TruncatedText, {
125
+ className: cn(listItemTitleVariants({ variant }), className),
111
126
  "data-slot": "list-item-title",
112
127
  dir: "auto",
128
+ lines: LIST_ITEM_TITLE_LINES[variant ?? "name"],
113
129
  ...props
114
130
  });
115
131
  const listItemDescriptionVariants = cva("text-muted-foreground text-xs", {
116
132
  defaultVariants: { variant: "text" },
117
133
  variants: { variant: {
118
- /** Prose, clamped to one line so long provider copy cannot widen the row. */
119
- text: "line-clamp-1 wrap-break-word",
120
- /** A URL or command: monospace, left-to-right, truncated at the end. */
121
- code: "truncate font-mono"
134
+ /** Prose, cut to one line so long provider copy cannot widen the row. */
135
+ text: "wrap-break-word",
136
+ /** Prose that genuinely needs a second line (a reason, an error). */
137
+ paragraph: "wrap-break-word",
138
+ /** A URL or command: monospace, left-to-right, cut at the end. */
139
+ code: "font-mono"
122
140
  } }
123
141
  });
124
142
  /**
125
- * Secondary line. Pass `line-clamp-2` when two lines are genuinely needed;
126
- * never `whitespace-nowrap`.
143
+ * Secondary line, one line by default. Use the `paragraph` variant (two
144
+ * lines) or `lines` when more is genuinely needed; never `whitespace-nowrap`.
127
145
  */
128
- const ListItemDescription = ({ className, variant, ...props }) => /* @__PURE__ */ jsx("span", {
146
+ const ListItemDescription = ({ className, variant, lines, ...props }) => /* @__PURE__ */ jsx(TruncatedText, {
129
147
  className: cn(listItemDescriptionVariants({ variant }), className),
130
148
  "data-slot": "list-item-description",
131
149
  dir: variant === "code" ? "ltr" : "auto",
150
+ lines: lines ?? (variant === "paragraph" ? 2 : 1),
132
151
  ...props
133
152
  });
134
153
  const ListItemActions = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
@@ -1,6 +1,7 @@
1
1
  import { LoaderCircleIcon } from "../icons.js";
2
2
  import { cn } from "../lib/utils.js";
3
3
  import { StellaMark } from "./stella-mark.js";
4
+ import { TruncatedText } from "./truncated-text.js";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  // src/components/loader.tsx
6
7
  /**
@@ -41,8 +42,9 @@ const LoaderState = ({ label, detail, hint, className }) => /* @__PURE__ */ jsxs
41
42
  className: "text-foreground text-sm font-medium",
42
43
  children: label
43
44
  }),
44
- detail !== void 0 && /* @__PURE__ */ jsx("p", {
45
- className: "text-muted-foreground truncate text-xs tabular-nums",
45
+ detail !== void 0 && /* @__PURE__ */ jsx(TruncatedText, {
46
+ className: "text-muted-foreground text-xs tabular-nums",
47
+ render: /* @__PURE__ */ jsx("p", {}),
46
48
  children: detail
47
49
  }),
48
50
  hint !== void 0 && /* @__PURE__ */ jsx("p", {
@@ -7,6 +7,7 @@ import { DirectionalIcon } from "./directional-icon.js";
7
7
  import { reconcileOutlineItems, retainOutlineIdSet } from "./outline-rail.logic.js";
8
8
  import { ScrollArea } from "./scroll-area.js";
9
9
  import { Tooltip, TooltipContent as TooltipPopup, TooltipTrigger } from "./tooltip.js";
10
+ import { TruncatedText } from "./truncated-text.js";
10
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
12
  import { memo, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
12
13
  import { Temporal } from "temporal-polyfill/full";
@@ -168,14 +169,15 @@ const OutlineRowView = ({ item, hasChildren, isCollapsed, isActive, isHovered, i
168
169
  onClick: () => onJump(item.id),
169
170
  type: "button"
170
171
  }),
171
- children: item.title === void 0 ? /* @__PURE__ */ jsx("span", {
172
- className: "min-w-0 truncate",
172
+ children: item.title === void 0 ? /* @__PURE__ */ jsx(TruncatedText, {
173
+ hint: false,
173
174
  children: item.label
174
175
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
175
176
  className: "shrink-0 font-medium",
176
177
  children: item.label
177
- }), /* @__PURE__ */ jsx("span", {
178
- className: "min-w-0 truncate font-normal",
178
+ }), /* @__PURE__ */ jsx(TruncatedText, {
179
+ className: "font-normal",
180
+ hint: false,
179
181
  children: item.title
180
182
  })] })
181
183
  }), /* @__PURE__ */ jsx(TooltipPopup, { children: outlineEntryText(item) })] }),
@@ -0,0 +1,8 @@
1
+ import { RunMarkSize, RunMarkState, RunStateMarkContract } from "./run-state-mark.shared.js";
2
+ /**
3
+ * Where one run of work stands, as a glyph: a bold "!" when it waits on the
4
+ * reader, a turning ring while it works (./run-state-mark.shared.ts). Its
5
+ * meaning is named by the element around it.
6
+ */
7
+ export declare const RunStateMark: ({ size, state }: RunStateMarkContract) => import("react").JSX.Element;
8
+ export type { RunMarkSize, RunMarkState };
@@ -0,0 +1,30 @@
1
+ import { cn } from "../lib/utils.js";
2
+ import { RUN_MARK_SIZES, RUN_MARK_TONES, RUN_STATE_MARKS } from "./run-state-mark.shared.js";
3
+ import { StatusMark } from "./status-mark.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { panic } from "better-result";
6
+ // src/components/run-state-mark.tsx
7
+ /**
8
+ * Where one run of work stands, as a glyph: a bold "!" when it waits on the
9
+ * reader, a turning ring while it works (./run-state-mark.shared.ts). Its
10
+ * meaning is named by the element around it.
11
+ */
12
+ const RunStateMark = ({ size = "row", state }) => {
13
+ const { glyph, tone } = RUN_STATE_MARKS[state];
14
+ const { glyphClass, markClass } = RUN_MARK_SIZES[size];
15
+ const { textClass } = RUN_MARK_TONES[tone];
16
+ switch (glyph) {
17
+ case "attention": return /* @__PURE__ */ jsx("span", {
18
+ "aria-hidden": true,
19
+ className: cn(textClass, glyphClass, "leading-none font-bold"),
20
+ "data-slot": "run-state-mark",
21
+ children: "!"
22
+ });
23
+ case "running": return /* @__PURE__ */ jsx(StatusMark, {
24
+ className: cn(textClass, markClass),
25
+ status: "running"
26
+ });
27
+ default: return panic("Unhandled run mark glyph");
28
+ }
29
+ };
30
+ export { RunStateMark };
@@ -0,0 +1,9 @@
1
+ import { RunMarkSize, RunMarkState, RunStateMarkContract } from "./run-state-mark.shared.js";
2
+ /**
3
+ * The web's `RunStateMark` (./run-state-mark.tsx) on a phone: the bold "!"
4
+ * in the embedded bold face, or the web `StatusMark`'s running ring drawn
5
+ * with react-native-svg. Hidden from assistive technology, as on the web:
6
+ * the row or heading around it names the state.
7
+ */
8
+ export declare const RunStateMark: ({ size, state }: RunStateMarkContract) => import("react").JSX.Element;
9
+ export type { RunMarkSize, RunMarkState };
@@ -0,0 +1,98 @@
1
+ import { RUN_MARK_SIZES, RUN_MARK_TONES, RUN_STATE_MARKS } from "./run-state-mark.shared.js";
2
+ import { STATUS_MARK_RING_RADIUS, STATUS_MARK_RUNNING_ARC, STATUS_MARK_SPIN_MS, STATUS_MARK_STROKE_WIDTH, STATUS_MARK_TRACK_OPACITY, STATUS_MARK_VIEWBOX } from "./status-mark.shared.js";
3
+ import { sansFontFamily } from "./text.native.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useState } from "react";
6
+ import { panic } from "better-result";
7
+ import { Animated, Easing, Text } from "react-native";
8
+ import Svg, { Circle } from "react-native-svg";
9
+ import { useCSSVariable } from "uniwind";
10
+ // src/components/run-state-mark.native.tsx
11
+ /**
12
+ * The web's `RunStateMark` (./run-state-mark.tsx) on a phone: the bold "!"
13
+ * in the embedded bold face, or the web `StatusMark`'s running ring drawn
14
+ * with react-native-svg. Hidden from assistive technology, as on the web:
15
+ * the row or heading around it names the state.
16
+ */
17
+ const RunStateMark = ({ size = "row", state }) => {
18
+ const { glyph, tone } = RUN_STATE_MARKS[state];
19
+ const { glyphClass, px } = RUN_MARK_SIZES[size];
20
+ const { textClass, variable } = RUN_MARK_TONES[tone];
21
+ switch (glyph) {
22
+ case "attention": return /* @__PURE__ */ jsx(Text, {
23
+ accessibilityElementsHidden: true,
24
+ className: `${textClass} ${glyphClass} leading-none`,
25
+ importantForAccessibility: "no-hide-descendants",
26
+ style: { fontFamily: sansFontFamily("bold") },
27
+ children: "!"
28
+ });
29
+ case "running": return /* @__PURE__ */ jsx(RunningRing, {
30
+ colorVariable: variable,
31
+ px
32
+ });
33
+ default: return panic("Unhandled run mark glyph");
34
+ }
35
+ };
36
+ const CENTRE = 8;
37
+ const CIRCUMFERENCE = 2 * Math.PI * STATUS_MARK_RING_RADIUS;
38
+ const ARC_DASHES = [CIRCUMFERENCE * STATUS_MARK_RUNNING_ARC, CIRCUMFERENCE * (1 - STATUS_MARK_RUNNING_ARC)];
39
+ /**
40
+ * The arc turns on its faint track. It keeps turning under Reduce Motion, as
41
+ * the platform's own activity indicator does; the ring is too small to move
42
+ * anything else on screen.
43
+ */
44
+ const RunningRing = ({ colorVariable, px }) => {
45
+ const resolved = useCSSVariable(colorVariable);
46
+ const color = typeof resolved === "string" ? resolved : "currentColor";
47
+ const [turn] = useState(() => new Animated.Value(0));
48
+ useEffect(() => {
49
+ const spin = Animated.loop(Animated.timing(turn, {
50
+ duration: STATUS_MARK_SPIN_MS,
51
+ easing: (progress) => Easing.linear(progress),
52
+ isInteraction: false,
53
+ toValue: 1,
54
+ useNativeDriver: true
55
+ }));
56
+ spin.start();
57
+ return () => {
58
+ spin.stop();
59
+ };
60
+ }, [turn]);
61
+ const rotate = turn.interpolate({
62
+ inputRange: [0, 1],
63
+ outputRange: ["0deg", "360deg"]
64
+ });
65
+ return /* @__PURE__ */ jsx(Animated.View, {
66
+ accessibilityElementsHidden: true,
67
+ importantForAccessibility: "no-hide-descendants",
68
+ style: {
69
+ height: px,
70
+ transform: [{ rotate }],
71
+ width: px
72
+ },
73
+ children: /* @__PURE__ */ jsxs(Svg, {
74
+ fill: "none",
75
+ height: px,
76
+ viewBox: STATUS_MARK_VIEWBOX,
77
+ width: px,
78
+ children: [/* @__PURE__ */ jsx(Circle, {
79
+ cx: CENTRE,
80
+ cy: CENTRE,
81
+ opacity: STATUS_MARK_TRACK_OPACITY,
82
+ r: STATUS_MARK_RING_RADIUS,
83
+ stroke: color,
84
+ strokeWidth: STATUS_MARK_STROKE_WIDTH
85
+ }), /* @__PURE__ */ jsx(Circle, {
86
+ cx: CENTRE,
87
+ cy: CENTRE,
88
+ r: STATUS_MARK_RING_RADIUS,
89
+ stroke: color,
90
+ strokeDasharray: ARC_DASHES,
91
+ strokeLinecap: "round",
92
+ strokeWidth: STATUS_MARK_STROKE_WIDTH,
93
+ transform: `rotate(-90 ${CENTRE} ${CENTRE})`
94
+ })]
95
+ })
96
+ });
97
+ };
98
+ export { RunStateMark };
@@ -0,0 +1,53 @@
1
+ /** The theme colours a run mark takes, as the classes and variables naming them. */
2
+ export declare const RUN_MARK_TONES: {
3
+ readonly muted: {
4
+ readonly textClass: "text-muted-foreground";
5
+ readonly variable: "--color-muted-foreground";
6
+ };
7
+ readonly warning: {
8
+ readonly textClass: "text-warning-foreground";
9
+ readonly variable: "--color-warning-foreground";
10
+ };
11
+ };
12
+ /**
13
+ * Each run state's glyph and tone. Its keys are the states the API reports
14
+ * (`CHAT_ACTIVE_RUN_STATE` in `@stll/api-contract/chat`, which this published
15
+ * package cannot import). A surface passes the state it read, so a state the
16
+ * API adds stops compiling at every surface until it has a mark here.
17
+ */
18
+ export declare const RUN_STATE_MARKS: {
19
+ readonly "needs-you": {
20
+ readonly glyph: "attention";
21
+ readonly tone: "warning";
22
+ };
23
+ readonly working: {
24
+ readonly glyph: "running";
25
+ readonly tone: "muted";
26
+ };
27
+ };
28
+ export type RunMarkState = keyof typeof RUN_STATE_MARKS;
29
+ /**
30
+ * `row` sits in a line of text, `badge` on a small icon. The pixel size is a
31
+ * phone's; the web sets the same size with the classes.
32
+ */
33
+ export declare const RUN_MARK_SIZES: {
34
+ readonly row: {
35
+ readonly glyphClass: "text-xs";
36
+ readonly markClass: "size-3";
37
+ readonly px: 12;
38
+ };
39
+ readonly badge: {
40
+ readonly glyphClass: "text-3xs";
41
+ readonly markClass: "size-2.5";
42
+ readonly px: 10;
43
+ };
44
+ };
45
+ export type RunMarkSize = keyof typeof RUN_MARK_SIZES;
46
+ /**
47
+ * The props every run mark renderer accepts. The mark is decorative: the
48
+ * element around it names the state for assistive technology.
49
+ */
50
+ export type RunStateMarkContract = {
51
+ state: RunMarkState;
52
+ size?: RunMarkSize;
53
+ };
@@ -0,0 +1,45 @@
1
+ // src/components/run-state-mark.shared.ts
2
+ /** The theme colours a run mark takes, as the classes and variables naming them. */
3
+ const RUN_MARK_TONES = {
4
+ muted: {
5
+ textClass: "text-muted-foreground",
6
+ variable: "--color-muted-foreground"
7
+ },
8
+ warning: {
9
+ textClass: "text-warning-foreground",
10
+ variable: "--color-warning-foreground"
11
+ }
12
+ };
13
+ /**
14
+ * Each run state's glyph and tone. Its keys are the states the API reports
15
+ * (`CHAT_ACTIVE_RUN_STATE` in `@stll/api-contract/chat`, which this published
16
+ * package cannot import). A surface passes the state it read, so a state the
17
+ * API adds stops compiling at every surface until it has a mark here.
18
+ */
19
+ const RUN_STATE_MARKS = {
20
+ "needs-you": {
21
+ glyph: "attention",
22
+ tone: "warning"
23
+ },
24
+ working: {
25
+ glyph: "running",
26
+ tone: "muted"
27
+ }
28
+ };
29
+ /**
30
+ * `row` sits in a line of text, `badge` on a small icon. The pixel size is a
31
+ * phone's; the web sets the same size with the classes.
32
+ */
33
+ const RUN_MARK_SIZES = {
34
+ row: {
35
+ glyphClass: "text-xs",
36
+ markClass: "size-3",
37
+ px: 12
38
+ },
39
+ badge: {
40
+ glyphClass: "text-3xs",
41
+ markClass: "size-2.5",
42
+ px: 10
43
+ }
44
+ };
45
+ export { RUN_MARK_SIZES, RUN_MARK_TONES, RUN_STATE_MARKS };
@@ -31,6 +31,11 @@ type SplitButtonProps = SplitButtonSharedProps & SplitButtonPrimary & ({
31
31
  open?: ComponentProps<typeof Popover>["open"];
32
32
  onOpenChange?: ComponentProps<typeof Popover>["onOpenChange"];
33
33
  });
34
- /** Two independent actions share quiet chrome; only the chevron opens the secondary surface. */
34
+ /**
35
+ * Two independent actions share quiet chrome; only the chevron opens the
36
+ * secondary surface. The chrome is quiet, not the glyphs: both halves keep the
37
+ * foreground colour of every other ghost button, so an enabled split button
38
+ * never reads as disabled beside its neighbours.
39
+ */
35
40
  export declare const SplitButton: (props: SplitButtonProps) => import("react").JSX.Element;
36
41
  export {};