@sdxc/ui 2026.11.1 → 2026.11.4

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 (192) hide show
  1. package/README.md +1 -1
  2. package/dist/app/app-shell-toggle.d.ts +31 -0
  3. package/dist/app/app-shell-toggle.js +43 -0
  4. package/dist/app/app-shell.d.ts +131 -0
  5. package/dist/app/app-shell.js +542 -0
  6. package/dist/app/auto-refresh.d.ts +104 -0
  7. package/dist/app/auto-refresh.js +126 -0
  8. package/dist/app/behaviors/refresh-schedule.d.ts +53 -0
  9. package/dist/app/behaviors/refresh-schedule.js +95 -0
  10. package/dist/app/behaviors/shortcuts.d.ts +175 -0
  11. package/dist/app/behaviors/shortcuts.js +401 -0
  12. package/dist/app/behaviors/toaster.d.ts +31 -2
  13. package/dist/app/behaviors/toaster.js +62 -5
  14. package/dist/app/chart.d.ts +62 -8
  15. package/dist/app/chart.js +207 -9
  16. package/dist/app/command-palette.d.ts +132 -0
  17. package/dist/app/command-palette.js +181 -0
  18. package/dist/app/danger-zone.d.ts +66 -0
  19. package/dist/app/danger-zone.js +66 -0
  20. package/dist/app/detail-sheet.d.ts +119 -0
  21. package/dist/app/detail-sheet.js +173 -0
  22. package/dist/app/drop-zone.d.ts +2 -1
  23. package/dist/app/drop-zone.js +6 -3
  24. package/dist/app/editor-layout.d.ts +69 -0
  25. package/dist/app/editor-layout.js +143 -0
  26. package/dist/app/empty.d.ts +56 -19
  27. package/dist/app/empty.js +129 -22
  28. package/dist/app/filter-bar.d.ts +169 -0
  29. package/dist/app/filter-bar.js +346 -0
  30. package/dist/app/index.d.ts +51 -0
  31. package/dist/app/index.js +51 -0
  32. package/dist/app/keyboard-help.d.ts +66 -0
  33. package/dist/app/keyboard-help.js +56 -0
  34. package/dist/app/mixins/app-shell-controls.d.ts +46 -0
  35. package/dist/app/mixins/app-shell-controls.js +131 -0
  36. package/dist/app/mixins/auto-refresh.d.ts +29 -0
  37. package/dist/app/mixins/auto-refresh.js +66 -0
  38. package/dist/app/mixins/command-palette.d.ts +56 -0
  39. package/dist/app/mixins/command-palette.js +297 -0
  40. package/dist/app/mixins/copy-permalink.d.ts +26 -0
  41. package/dist/app/mixins/copy-permalink.js +54 -0
  42. package/dist/app/mixins/detail-sheet-keys.d.ts +28 -0
  43. package/dist/app/mixins/detail-sheet-keys.js +88 -0
  44. package/dist/app/mixins/escape-link.d.ts +17 -0
  45. package/dist/app/mixins/escape-link.js +35 -0
  46. package/dist/app/mixins/keyboard-help.d.ts +38 -0
  47. package/dist/app/mixins/keyboard-help.js +51 -0
  48. package/dist/app/mixins/optimistic-toggle-sync.d.ts +80 -0
  49. package/dist/app/mixins/optimistic-toggle-sync.js +153 -0
  50. package/dist/app/mixins/range-picker-keys.d.ts +18 -0
  51. package/dist/app/mixins/range-picker-keys.js +94 -0
  52. package/dist/app/mixins/row-navigation.d.ts +85 -0
  53. package/dist/app/mixins/row-navigation.js +208 -0
  54. package/dist/app/mixins/save-bar-sync.d.ts +27 -0
  55. package/dist/app/mixins/save-bar-sync.js +106 -0
  56. package/dist/app/mixins/save-shortcut.d.ts +47 -0
  57. package/dist/app/mixins/save-shortcut.js +101 -0
  58. package/dist/app/mixins/save-status-sync.d.ts +77 -0
  59. package/dist/app/mixins/save-status-sync.js +159 -0
  60. package/dist/app/mixins/selection-bar-sync.d.ts +32 -0
  61. package/dist/app/mixins/selection-bar-sync.js +151 -0
  62. package/dist/app/mixins/split-view.d.ts +66 -0
  63. package/dist/app/mixins/split-view.js +319 -0
  64. package/dist/app/mixins/status-strip-keys.d.ts +17 -0
  65. package/dist/app/mixins/status-strip-keys.js +79 -0
  66. package/dist/app/mixins/submit-on-change.d.ts +16 -0
  67. package/dist/app/mixins/submit-on-change.js +28 -0
  68. package/dist/app/mixins/table-selection.d.ts +39 -0
  69. package/dist/app/mixins/table-selection.js +272 -0
  70. package/dist/app/mixins/toast-queue.d.ts +36 -0
  71. package/dist/app/mixins/toast-queue.js +77 -0
  72. package/dist/app/mixins/toast-stack.d.ts +20 -0
  73. package/dist/app/mixins/toast-stack.js +55 -0
  74. package/dist/app/optimistic-toggle.d.ts +48 -0
  75. package/dist/app/optimistic-toggle.js +38 -0
  76. package/dist/app/page-header.d.ts +71 -0
  77. package/dist/app/page-header.js +249 -0
  78. package/dist/app/range-picker.d.ts +102 -0
  79. package/dist/app/range-picker.js +118 -0
  80. package/dist/app/save-bar.d.ts +54 -0
  81. package/dist/app/save-bar.js +64 -0
  82. package/dist/app/save-status.d.ts +50 -0
  83. package/dist/app/save-status.js +54 -0
  84. package/dist/app/selection-bar.d.ts +101 -0
  85. package/dist/app/selection-bar.js +157 -0
  86. package/dist/app/settings-layout.d.ts +70 -0
  87. package/dist/app/settings-layout.js +112 -0
  88. package/dist/app/settings-section.d.ts +140 -0
  89. package/dist/app/settings-section.js +182 -0
  90. package/dist/app/skeleton.d.ts +47 -4
  91. package/dist/app/skeleton.js +149 -2
  92. package/dist/app/sparkline.d.ts +61 -0
  93. package/dist/app/sparkline.js +145 -0
  94. package/dist/app/split-view.d.ts +154 -0
  95. package/dist/app/split-view.js +272 -0
  96. package/dist/app/stat-card.d.ts +109 -0
  97. package/dist/app/stat-card.js +379 -0
  98. package/dist/app/status-strip.d.ts +70 -0
  99. package/dist/app/status-strip.js +155 -0
  100. package/dist/app/styles/action-row.d.ts +41 -0
  101. package/dist/app/styles/action-row.js +59 -0
  102. package/dist/app/styles/stat-delta.d.ts +29 -0
  103. package/dist/app/styles/stat-delta.js +36 -0
  104. package/dist/app/styles/toast-stack.d.ts +21 -0
  105. package/dist/app/styles/toast-stack.js +54 -0
  106. package/dist/app/table.d.ts +199 -24
  107. package/dist/app/table.js +640 -36
  108. package/dist/app/toast.d.ts +105 -5
  109. package/dist/app/toast.js +89 -17
  110. package/dist/app/toasts.d.ts +49 -0
  111. package/dist/app/toasts.js +103 -0
  112. package/dist/app/utils/app-shell-cookie.d.ts +21 -0
  113. package/dist/app/utils/app-shell-cookie.js +33 -0
  114. package/dist/app/utils/chart-marker-indices.d.ts +9 -5
  115. package/dist/app/utils/chart-marker-indices.js +9 -8
  116. package/dist/app/utils/chart-path.d.ts +14 -10
  117. package/dist/app/utils/chart-path.js +46 -18
  118. package/dist/app/utils/edited-time.d.ts +19 -0
  119. package/dist/app/utils/edited-time.js +35 -0
  120. package/dist/app/utils/key-target.d.ts +23 -0
  121. package/dist/app/utils/key-target.js +48 -0
  122. package/dist/app/utils/search-params.d.ts +69 -0
  123. package/dist/app/utils/search-params.js +132 -0
  124. package/dist/app/utils/shortcut-groups.d.ts +21 -0
  125. package/dist/app/utils/shortcut-groups.js +53 -0
  126. package/dist/app/utils/split-view-layout.d.ts +48 -0
  127. package/dist/app/utils/split-view-layout.js +71 -0
  128. package/dist/app/view-options.d.ts +99 -0
  129. package/dist/app/view-options.js +182 -0
  130. package/dist/components/banner.d.ts +61 -0
  131. package/dist/components/banner.js +101 -0
  132. package/dist/components/confirm.d.ts +54 -5
  133. package/dist/components/confirm.js +44 -5
  134. package/dist/components/group.d.ts +14 -0
  135. package/dist/components/group.js +66 -11
  136. package/dist/components/index.d.ts +5 -0
  137. package/dist/components/index.js +5 -0
  138. package/dist/components/input.js +9 -3
  139. package/dist/components/link-button.js +8 -2
  140. package/dist/components/property-list.d.ts +76 -0
  141. package/dist/components/property-list.js +175 -0
  142. package/dist/components/relative-time.d.ts +72 -0
  143. package/dist/components/relative-time.js +45 -0
  144. package/dist/components/status-dot.d.ts +62 -0
  145. package/dist/components/status-dot.js +99 -0
  146. package/dist/components/text-field.d.ts +17 -2
  147. package/dist/components/text-field.js +13 -4
  148. package/dist/components/timeline.d.ts +67 -0
  149. package/dist/components/timeline.js +159 -0
  150. package/dist/components/typeset.d.ts +2 -1
  151. package/dist/components/typeset.js +4 -1
  152. package/dist/docs/code-tabs-sync.d.ts +1 -1
  153. package/dist/docs/code-tabs-sync.js +2 -2
  154. package/dist/docs/copy-button.d.ts +1 -1
  155. package/dist/docs/copy-button.js +2 -2
  156. package/dist/docs/docs-feedback.d.ts +12 -0
  157. package/dist/docs/docs-feedback.js +4 -2
  158. package/dist/docs/docs-hub.js +4 -4
  159. package/dist/docs/docs-layout.d.ts +1 -1
  160. package/dist/docs/docs-layout.js +1 -1
  161. package/dist/docs/docs-nav-tools.d.ts +11 -5
  162. package/dist/docs/docs-nav-tools.js +5 -4
  163. package/dist/docs/docs-nav.d.ts +12 -5
  164. package/dist/docs/docs-nav.js +20 -8
  165. package/dist/docs/docs-pager.d.ts +5 -1
  166. package/dist/docs/docs-pager.js +7 -6
  167. package/dist/docs/mixins/docs-nav-tools.d.ts +3 -3
  168. package/dist/docs/mixins/docs-nav-tools.js +42 -17
  169. package/dist/docs/next-steps.js +3 -2
  170. package/dist/docs/page-actions.d.ts +1 -1
  171. package/dist/docs/page-actions.js +2 -2
  172. package/dist/docs/table-of-contents.d.ts +1 -1
  173. package/dist/docs/table-of-contents.js +2 -2
  174. package/dist/docs/utils/docs-filter.d.ts +26 -0
  175. package/dist/docs/utils/docs-filter.js +53 -0
  176. package/dist/mixins/confirm-phrase.d.ts +19 -0
  177. package/dist/mixins/confirm-phrase.js +56 -0
  178. package/dist/mixins/index.d.ts +2 -0
  179. package/dist/mixins/index.js +2 -0
  180. package/dist/mixins/viewer-time.d.ts +20 -0
  181. package/dist/mixins/viewer-time.js +40 -0
  182. package/dist/styles/index.d.ts +1 -0
  183. package/dist/styles/index.js +1 -0
  184. package/dist/styles/segmented-control.d.ts +49 -0
  185. package/dist/styles/segmented-control.js +71 -0
  186. package/dist/test/table.d.ts +65 -0
  187. package/dist/test/table.js +108 -0
  188. package/dist/utils/index.d.ts +1 -0
  189. package/dist/utils/index.js +1 -0
  190. package/dist/utils/relative-time.d.ts +44 -0
  191. package/dist/utils/relative-time.js +69 -0
  192. package/package.json +6 -6
package/dist/app/table.js CHANGED
@@ -1,10 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
- import { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon } from "@sdxc/icons";
3
- import { bg, borderEdge, center, container, cursor, fg, flex, fontSize, gap, hover, is, items, justify, opacity, outline, overflow, p, pb, pi, raw, relative, shrink, tabularNums, textAlign, textDecoration, userSelect, virtualize, weight, when, } from "@sdxc/u";
2
+ import { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon, EllipsisIcon } from "@sdxc/icons";
3
+ import { bg, center, container, cursor, fg, flex, font, fontSize, gap, hidden, hover, is, items, justify, keyframes, nowrap, opacity, outline, overflow, p, pb, pi, raw, relative, shrink, tabularNums, textAlign, textDecoration, truncate, userSelect, virtualize, weight, when, } from "@sdxc/u";
4
+ import { visuallyHidden } from "@sdxc/u/a11y";
4
5
  import { mergeMix } from "@sdxc/u/general";
5
- import { attrs } from "remix/component";
6
+ import { attrs, clientEntry } from "remix/component";
7
+ import { Button } from "../components/button.js";
8
+ import { Checkbox } from "../components/checkbox.js";
9
+ import { LinkButton } from "../components/link-button.js";
10
+ import { Menu } from "../components/menu.js";
11
+ import { RelativeTime } from "../components/relative-time.js";
12
+ import { StatusDot } from "../components/status-dot.js";
13
+ import { floatingSurface, SURFACE_PADDING } from "../styles/floating-surface.js";
6
14
  import { interactiveTransition } from "../styles/interactive-transition.js";
7
15
  import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
16
+ import { ROW_NAVIGATION_ATTRIBUTE, rowNavigation } from "./mixins/row-navigation.js";
17
+ import { tableSelection } from "./mixins/table-selection.js";
8
18
  /**
9
19
  * Named container {@link Table.Container} declares on its own host, so a
10
20
  * consumer's own descendant styles can query the wrapper's width instead of
@@ -23,38 +33,139 @@ const DEFAULT_NUMERIC_ALIGN = "end";
23
33
  * link fills the whole cell and still places its label where `align` puts it.
24
34
  */
25
35
  const JUSTIFY_BY_ALIGN = { start: "start", center: "center", end: "end" };
36
+ /** Row block size for each density; compact leaves the variable to an app-wide setting. */
37
+ const ROW_BLOCK_SIZE = "var(--ui-table-row-block-size, 2.5rem)";
38
+ /** Surface behind sticky headers and pinned cells, which must be opaque to cover what scrolls under them. */
39
+ const TABLE_BG = "var(--ui-table-bg, var(--ui-bg, Canvas))";
40
+ /** The row's tint as an image, layered over {@link TABLE_BG} by a surface that covers the row. */
41
+ const ROW_TINT_IMAGE = "linear-gradient(var(--ui-table-row-tint, transparent), var(--ui-table-row-tint, transparent))";
42
+ /** Edge shadow a pinned first column casts once the table scrolls sideways. */
43
+ const PIN_SHADOW_KEYFRAMES = "ui-table-pin-shadow";
44
+ /** Characters an id cell keeps visible after the ellipsis, where ids differ most. */
45
+ const DEFAULT_ID_TAIL = 4;
46
+ /** Upper bound a data bar's value is measured against when `max` is omitted: a proportion. */
47
+ const DEFAULT_BAR_MAX = 1;
48
+ /** What a typed cell shows for a value that is unknown or missing. */
49
+ const EMPTY_VALUE = "—";
26
50
  /**
27
- * Renders the table's `<table>` host: a full-width, border-collapsed grid
28
- * with a small base font size, ready to hold {@link Table.Header} and
29
- * {@link Table.Body}. Dev mode warns when it lacks an accessible name.
51
+ * Width of the `ui-table` container at or below which {@link Table.Actions} shows one menu
52
+ * button in place of its inline actions, so a phone's narrow columns keep their own space.
53
+ */
54
+ const ACTIONS_OVERFLOW_QUERY = "@container ui-table (max-width: 40rem)";
55
+ /**
56
+ * Pointers precise enough to hover a row, where {@link Table.Actions} hide until wanted and
57
+ * reveal over the row's end; a coarse pointer gets them in place even when it reports hover.
58
+ */
59
+ const FINE_HOVER_QUERY = "@media (hover: hover) and (pointer: fine)";
60
+ /** Size of the ⋯ button, a fingertip's target under a coarse pointer. */
61
+ const MENU_BUTTON_SIZE = {
62
+ minInlineSize: "var(--ui-target-size, 1.5rem)",
63
+ minBlockSize: "var(--ui-target-size, 1.5rem)",
64
+ "@media (pointer: coarse)": {
65
+ minInlineSize: "var(--ui-target-size, 2.75rem)",
66
+ minBlockSize: "var(--ui-target-size, 2.75rem)",
67
+ },
68
+ };
69
+ /**
70
+ * How far the overlay of hover-revealed {@link Table.Actions} fades in ahead of its own box, and
71
+ * how long that fade is: text of the last visible cell running under the overlay fades out
72
+ * across it, reaching full cover only where the first action's label starts.
73
+ */
74
+ const ACTIONS_FADE_LEAD = "1rem";
75
+ /** Length of the overlay's leading fade, from fully clear to the row's opaque surface. */
76
+ const ACTIONS_FADE_LENGTH = "2rem";
77
+ /**
78
+ * Hover and press fills for ghost controls in the actions overlay, mixed from each color's own
79
+ * foreground so they read as a step on the row's tint in light and dark. They paint as a
80
+ * background image, which no control style sets, so they show over whatever fill the control
81
+ * keeps; controls inside a dialog or popover a row action opens keep their own.
82
+ */
83
+ const ACTIONS_HOVER_FILLS = Object.fromEntries(["brand", "neutral", "success", "warning", "danger"].flatMap((color) => {
84
+ let fg = color === "neutral" ? "var(--ui-neutral-fg-emphasis)" : `var(--ui-${color}-fg)`;
85
+ let control = `& :is(a, button)[data-variant="ghost"][data-color="${color}"]:not(:is(dialog, [popover]:not([data-slot="row-actions-inline"])) *)`;
86
+ let fill = (share) => {
87
+ let tone = `color-mix(in srgb, ${fg} ${share}%, transparent)`;
88
+ return { backgroundImage: `linear-gradient(${tone}, ${tone})` };
89
+ };
90
+ return [
91
+ [`${control}:hover`, fill(10)],
92
+ [`${control}:active`, fill(16)],
93
+ ];
94
+ }));
95
+ /** Interactive elements that sit above a whole-row link, so they keep their own clicks. */
96
+ const ROW_CONTROLS = ':is(a, button, label, select, textarea, summary, [role="button"])';
97
+ /**
98
+ * Renders the `<table>` host: full width, border-collapsed, small text. `density` sets the row
99
+ * height, `pinFirstColumn` keeps the first column in view with a scroll-driven edge shadow,
100
+ * and `aria-busy="true"` dims the body while it refetches. Dev mode warns without a name.
30
101
  *
31
102
  * @param handle Runtime handle carrying the host `<table>`'s props.
32
103
  * @returns The render function producing the table's markup.
33
104
  * @example
34
- * <Table aria-label={t("subjects.title")}>
35
- * <Table.Header>
36
- * <Table.Row>
37
- * <Table.Column>{t("subjects.name")}</Table.Column>
38
- * </Table.Row>
39
- * </Table.Header>
40
- * <Table.Body>
41
- * <Table.Row>
42
- * <Table.Cell>{subject.name}</Table.Cell>
43
- * </Table.Row>
44
- * </Table.Body>
105
+ * <Table aria-label={t("monitors.title")} density="comfortable" pinFirstColumn>
106
+ * <Table.Header>…</Table.Header>
107
+ * <Table.Body>…</Table.Body>
45
108
  * </Table>
109
+ * @example <Table aria-label={t("monitors.title")} aria-busy={refreshing ? "true" : undefined}>…</Table>
46
110
  */
47
111
  export function Table(handle) {
112
+ handle.context.set({ actionsLabelId: `${handle.id}-actions` });
48
113
  return () => {
49
- let { mix, ...rest } = handle.props;
114
+ let { density, pinFirstColumn, mix, ...rest } = handle.props;
50
115
  warnIfNoAccessibleLabel(handle.props, 'Table: needs an "aria-label" or "aria-labelledby" describing its contents for assistive technology.');
51
- return (_jsx("table", { ...rest, "data-slot": "table", mix: mergeMix([is("100%"), raw({ borderCollapse: "collapse" }), fontSize("sm")], mix) }));
116
+ return (_jsx("table", { ...rest, "data-slot": "table", "data-density": density, "data-pin-first": pinFirstColumn ? "" : undefined, mix: mergeMix([
117
+ is("100%"),
118
+ fontSize("sm"),
119
+ keyframes(PIN_SHADOW_KEYFRAMES, { from: { opacity: 0 }, to: { opacity: 1 } }),
120
+ raw({
121
+ borderCollapse: "collapse",
122
+ '&[data-density="compact"]': { "--ui-table-row-block-size": "2.5rem" },
123
+ '&[data-density="comfortable"]': { "--ui-table-row-block-size": "3.5rem" },
124
+ /**
125
+ * Compact rows keep one line per cell, so every row stays the same height and a
126
+ * long value widens its column, scrolling the table inside its container.
127
+ */
128
+ '&:not([data-density="comfortable"]) > * > tr > *': { whiteSpace: "nowrap" },
129
+ "& > tbody": { transition: "opacity 200ms ease-out" },
130
+ '&[aria-busy="true"] > tbody': { opacity: 0.5 },
131
+ "@media (prefers-reduced-motion: reduce)": { "& > tbody": { transition: "none" } },
132
+ "&[data-pin-first] > tbody > tr > :first-child": {
133
+ position: "sticky",
134
+ insetInlineStart: 0,
135
+ zIndex: 1,
136
+ backgroundColor: TABLE_BG,
137
+ backgroundImage: ROW_TINT_IMAGE,
138
+ },
139
+ "&[data-pin-first] > * > tr > :first-child::after": {
140
+ content: '""',
141
+ position: "absolute",
142
+ insetBlock: 0,
143
+ insetInlineStart: "100%",
144
+ inlineSize: "0.75rem",
145
+ pointerEvents: "none",
146
+ opacity: 0,
147
+ backgroundImage: "linear-gradient(to var(--ui-table-pin-shadow-direction, right), color-mix(in oklab, var(--ui-fg, CanvasText) 14%, transparent), transparent)",
148
+ },
149
+ "&[data-pin-first]:dir(rtl)": { "--ui-table-pin-shadow-direction": "left" },
150
+ "@supports (animation-timeline: scroll())": {
151
+ "&[data-pin-first] > * > tr > :first-child::after": {
152
+ animationName: PIN_SHADOW_KEYFRAMES,
153
+ animationDuration: "auto",
154
+ animationTimingFunction: "linear",
155
+ animationFillMode: "both",
156
+ animationTimeline: "scroll(nearest inline)",
157
+ animationRange: "0 1rem",
158
+ },
159
+ },
160
+ }),
161
+ ], mix) }));
52
162
  };
53
163
  }
54
164
  /**
55
- * Renders an optional wrapper around {@link Table}: a relatively positioned
56
- * `<div>` that scrolls its own inline axis when the table grows wider than
57
- * the available space, and declares the `ui-table` named container.
165
+ * Renders the scrolling wrapper around {@link Table}: the table scrolls sideways inside it
166
+ * instead of widening the page, and the header sticks to its own top edge, whatever sticky offset
167
+ * the page around it sets. Give it a `max-block-size` to scroll rows inside it; the `ui-table`
168
+ * container is declared here.
58
169
  *
59
170
  * @param handle Runtime handle carrying the host `<div>`'s props.
60
171
  * @returns The render function producing the wrapper's markup.
@@ -66,12 +177,20 @@ export function Table(handle) {
66
177
  Table.Container = function TableContainer(handle) {
67
178
  return () => {
68
179
  let { mix, ...rest } = handle.props;
69
- return (_jsx("div", { ...rest, "data-slot": "container", mix: mergeMix([relative(), is("100%"), overflow("auto"), container(CONTAINER_NAME)], mix) }));
180
+ return (_jsx("div", { ...rest, "data-slot": "container", mix: mergeMix([
181
+ relative(),
182
+ is("100%"),
183
+ overflow("auto"),
184
+ container(CONTAINER_NAME),
185
+ raw({ "--ui-app-sticky-top": "0px" }),
186
+ when(`& [${ROW_NAVIGATION_ATTRIBUTE}]:focus-visible`, outline({ color: "brand.ring", width: 2, offset: -2 })),
187
+ ], mix) }));
70
188
  };
71
189
  };
72
190
  /**
73
- * Renders the table's `<thead>` host: a plain wrapper for the header
74
- * {@link Table.Row}, separated from {@link Table.Body} by a block-end border.
191
+ * Renders the `<thead>` host, whose header cells stick at `--ui-app-sticky-top` (below an app's
192
+ * own sticky bar) over an opaque surface, ruled from the body by an inset line that stays with
193
+ * them as they stick.
75
194
  *
76
195
  * @param handle Runtime handle carrying the host `<thead>`'s props.
77
196
  * @returns The render function producing the header section's markup.
@@ -85,7 +204,16 @@ Table.Container = function TableContainer(handle) {
85
204
  Table.Header = function TableHeader(handle) {
86
205
  return () => {
87
206
  let { mix, ...rest } = handle.props;
88
- return (_jsx("thead", { ...rest, "data-slot": "header", mix: mergeMix(borderEdge("block-end", { color: "neutral", width: 1 }), mix) }));
207
+ return (_jsx("thead", { ...rest, "data-slot": "header", mix: mergeMix(raw({
208
+ "& > tr > th": {
209
+ position: "sticky",
210
+ insetBlockStart: "var(--ui-app-sticky-top, 0px)",
211
+ zIndex: 2,
212
+ backgroundColor: TABLE_BG,
213
+ boxShadow: "inset 0 -1px 0 var(--ui-neutral-border)",
214
+ },
215
+ "[data-pin-first] > & > tr > th:first-child": { insetInlineStart: 0, zIndex: 3 },
216
+ }), mix) }));
89
217
  };
90
218
  };
91
219
  /**
@@ -109,7 +237,11 @@ Table.Body = function TableBody(handle) {
109
237
  let { mix, ...rest } = handle.props;
110
238
  return (_jsx("tbody", { ...rest, "data-slot": "body", mix: mergeMix([
111
239
  virtualize("auto var(--ui-table-body-intrinsic-size, 32rem)"),
112
- when("& > :not([hidden]) ~ :not([hidden])", borderEdge("block-start", { color: "neutral", width: 1 })),
240
+ raw({
241
+ "& > :not([hidden]) ~ :not([hidden])": {
242
+ borderBlockStart: "1px solid var(--ui-neutral-border)",
243
+ },
244
+ }),
113
245
  ], mix) }));
114
246
  };
115
247
  };
@@ -135,20 +267,23 @@ Table.Column = function TableColumn(handle) {
135
267
  let resolvedAlign = align ?? (numeric ? DEFAULT_NUMERIC_ALIGN : DEFAULT_ALIGN);
136
268
  return (_jsx("th", { ...rest, "data-align": resolvedAlign, "data-numeric": numeric ? "" : undefined, "aria-sort": href ? (sortDirection ?? "none") : undefined, "data-slot": "column", mix: mergeMix([
137
269
  attrs({ scope: "col" }),
138
- href ? undefined : [pi("1rem"), pb("0.75rem")],
270
+ href ? undefined : [pi("1rem"), pb("0.25rem")],
139
271
  textAlign("start"),
140
272
  weight(500),
141
273
  fg("neutral"),
274
+ raw({ whiteSpace: "nowrap" }),
142
275
  when('&[data-align="center"]', textAlign("center")),
143
276
  when('&[data-align="end"]', textAlign("end")),
144
- when("&[aria-sort]", when("&:hover", bg("neutral.tint"))),
277
+ when("&[aria-sort]:hover", bg({
278
+ image: "linear-gradient(var(--ui-neutral-bg-tint), var(--ui-neutral-bg-tint))",
279
+ })),
145
280
  when("&[aria-sort]", [cursor("pointer"), userSelect()]),
146
281
  ], mix), children: href ? (_jsxs("a", { href: href, mix: [
147
282
  when("&:focus-visible", outline({ color: "brand.ring", offset: -2 })),
148
283
  flex(),
149
284
  justify(JUSTIFY_BY_ALIGN[resolvedAlign]),
150
285
  pi("1rem"),
151
- pb("0.75rem"),
286
+ pb("0.25rem"),
152
287
  items("center"),
153
288
  gap("0.25rem"),
154
289
  fg("inherit"),
@@ -159,9 +294,9 @@ Table.Column = function TableColumn(handle) {
159
294
  };
160
295
  };
161
296
  /**
162
- * Renders a native `<tr>` host: transitions its background smoothly, tints
163
- * it on hover, and tints it more strongly when it carries
164
- * `aria-selected="true"`, set directly since selection state is native.
297
+ * Renders a native `<tr>` host at the density's block size. It tints on hover and when
298
+ * selected, through a checked selection checkbox or `aria-selected="true"`; a row holding a
299
+ * {@link Table.RowLink} positions itself so the link covers it, with its other controls above.
165
300
  *
166
301
  * @param handle Runtime handle carrying the host `<tr>`'s props.
167
302
  * @returns The render function producing the row's markup.
@@ -179,8 +314,23 @@ Table.Row = function TableRow(handle) {
179
314
  let { mix, ...rest } = handle.props;
180
315
  return (_jsx("tr", { ...rest, "data-slot": "row", mix: mergeMix([
181
316
  interactiveTransition(),
182
- hover(bg("neutral.tint")),
183
- when('&[aria-selected="true"]', bg("brand.tint")),
317
+ raw({
318
+ blockSize: ROW_BLOCK_SIZE,
319
+ backgroundColor: "var(--ui-table-row-tint, transparent)",
320
+ ":is(thead) > &": { blockSize: "var(--ui-table-header-block-size, 2.5rem)" },
321
+ ":is(tbody) > &:hover": { "--ui-table-row-tint": "var(--ui-neutral-bg-tint)" },
322
+ '&[aria-selected="true"], &:has([data-selection-item]:checked)': {
323
+ "--ui-table-row-tint": "var(--ui-brand-bg-tint)",
324
+ },
325
+ '&:has([data-slot="row-link"])': { position: "relative" },
326
+ "@media (hover: hover)": {
327
+ '&:has(> [data-slot="row-actions"])': { position: "relative" },
328
+ },
329
+ [`&:has([data-slot="row-link"]) ${ROW_CONTROLS}:not([data-slot="row-link"])`]: {
330
+ position: "relative",
331
+ zIndex: 1,
332
+ },
333
+ }),
184
334
  ], mix) }));
185
335
  };
186
336
  };
@@ -200,12 +350,466 @@ Table.Cell = function TableCell(handle) {
200
350
  let { numeric, mix, ...rest } = handle.props;
201
351
  return (_jsx("td", { ...rest, "data-numeric": numeric ? "" : undefined, "data-slot": "cell", mix: mergeMix([
202
352
  pi("1rem"),
203
- pb("0.75rem"),
353
+ pb("0.25rem"),
204
354
  fg("neutral.emphasis"),
205
355
  when("&[data-numeric]", [tabularNums(), textAlign("end")]),
206
356
  ], mix) }));
207
357
  };
208
358
  };
359
+ /**
360
+ * Client island the select-all header carries: a hidden marker whose mixin keeps the table's
361
+ * selection checkboxes in step. Loads from `@sdxc/ui/app/table#TableSelection` once the app's
362
+ * browser entry maps it; until then every row checkbox still works on its own.
363
+ */
364
+ export const TableSelection = clientEntry("@sdxc/ui/app/table#TableSelection", function TableSelection() {
365
+ return () => _jsx("span", { mix: [hidden(), tableSelection()] });
366
+ });
367
+ /** Selector for the box {@link TableKeys} walks: the table's container, or the table itself. */
368
+ const TABLE_KEYS_SCOPE = '[data-slot="container"], table';
369
+ /**
370
+ * Client island behind {@link Table.Keys}: a hidden marker whose `rowNavigation()` walks the
371
+ * rows of the container it sits in. Loads from `@sdxc/ui/app/table#TableKeys` once the app's
372
+ * browser entry maps it; until then every row link and checkbox stays reachable by Tab.
373
+ */
374
+ export const TableKeys = clientEntry("@sdxc/ui/app/table#TableKeys", function TableKeys(handle) {
375
+ return () => (_jsx("span", { mix: [hidden(), rowNavigation({ ...handle.props, within: TABLE_KEYS_SCOPE })] }));
376
+ });
377
+ /**
378
+ * Turns on keyboard row navigation for a server-rendered table: `j`/`k` and the arrows move
379
+ * through the rows with an inset ring, Enter or `o` opens the row's link, `x` toggles its
380
+ * checkbox and `/` focuses the search field. Place it inside `Table.Container`, beside the table.
381
+ *
382
+ * @param handle Runtime handle carrying the keys' options.
383
+ * @returns The render function producing the island.
384
+ * @example <Table.Container><Table.Keys search="q" labels={{ group: t("keys.list"), next: t("keys.next") }} /><Table>…</Table></Table.Container>
385
+ */
386
+ Table.Keys = function TableKeysPart(handle) {
387
+ return () => _jsx(TableKeys, { ...handle.props });
388
+ };
389
+ /**
390
+ * Renders the selection column's header: a select-all checkbox marked `data-selection-all`,
391
+ * and the {@link TableSelection} island that makes it check every row, show indeterminate
392
+ * while some are, and lets shift-click check a range.
393
+ *
394
+ * @param handle Runtime handle carrying the host `<th>`'s props.
395
+ * @returns The render function producing the header cell.
396
+ * @example <Table.SelectAll label={t("monitors.selectAll")} />
397
+ */
398
+ Table.SelectAll = function TableSelectAll(handle) {
399
+ return () => {
400
+ let { label, checked, mix, ...rest } = handle.props;
401
+ return (_jsxs("th", { ...rest, "data-slot": "selection-column", mix: mergeMix([attrs({ scope: "col" }), is("1%"), pi("1rem"), pb("0.25rem")], mix), children: [_jsx(Checkbox, { "aria-label": label, checked: checked, "data-selection-all": "" }), _jsx(TableSelection, {})] }));
402
+ };
403
+ };
404
+ /**
405
+ * Renders one row's selection checkbox, marked `data-selection-item` with the row's key as its
406
+ * value, so it submits with a form and any selection bar can count it.
407
+ *
408
+ * @param handle Runtime handle carrying the host `<td>`'s props.
409
+ * @returns The render function producing the cell.
410
+ * @example <Table.Select name="monitor" value={monitor.id} label={t("monitors.select", { name: monitor.name })} form="bulk" />
411
+ */
412
+ Table.Select = function TableSelect(handle) {
413
+ return () => {
414
+ let { value, label, name, form, checked, disabled, mix, ...rest } = handle.props;
415
+ return (_jsx("td", { ...rest, "data-slot": "selection-cell", mix: mergeMix([is("1%"), pi("1rem"), pb("0.25rem")], mix), children: _jsx(Checkbox, { "aria-label": label, name: name, value: value, form: form, checked: checked, disabled: disabled, "data-selection-item": "" }) }));
416
+ };
417
+ };
418
+ /**
419
+ * Renders the header over the row actions with its name visually hidden, since the buttons
420
+ * beneath name themselves.
421
+ *
422
+ * @param handle Runtime handle carrying the host `<th>`'s props.
423
+ * @returns The render function producing the header cell.
424
+ * @example <Table.ActionsColumn label={t("monitors.actions")} />
425
+ */
426
+ Table.ActionsColumn = function TableActionsColumn(handle) {
427
+ return () => {
428
+ let { label, mix, ...rest } = handle.props;
429
+ let table = handle.context.get(Table);
430
+ return (_jsx("th", { ...rest, "data-slot": "actions-column", mix: mergeMix([attrs({ scope: "col" }), is("1%")], mix), children: _jsx("span", { id: table?.actionsLabelId, mix: [visuallyHidden()], children: label }) }));
431
+ };
432
+ };
433
+ /**
434
+ * Marks the actions it wraps as the overflow menu's copy, so each {@link Table.Action} inside
435
+ * renders as a menu row.
436
+ *
437
+ * @param handle Runtime handle carrying the menu's actions.
438
+ * @returns The render function passing the actions through.
439
+ */
440
+ function TableActionsMenu(handle) {
441
+ handle.context.set({ menu: true });
442
+ return () => handle.props.children;
443
+ }
444
+ /**
445
+ * Renders a row's actions on one line. Under a fine hovering pointer they reserve no width: hidden
446
+ * until the row is hovered, focused within, selected or has a menu open, they fade in over the
447
+ * row's end on its tint. Under a coarse pointer they show in a cell as wide as they are. In a
448
+ * `ui-table` container 40rem wide or narrower, one ⋯ button in their place opens them in a menu.
449
+ *
450
+ * @param handle Runtime handle carrying the host `<td>`'s props.
451
+ * @returns The render function producing the cell.
452
+ * @example
453
+ * <Table.Actions overflowLabel={t("posts.moreActions")}>
454
+ * <Table.Action href={editUrl}>{t("posts.edit")}</Table.Action>
455
+ * <Table.Action danger commandfor="confirm-delete" command="show-modal">{t("posts.delete")}</Table.Action>
456
+ * </Table.Actions>
457
+ * @example
458
+ * <Table.Actions>
459
+ * <Button size="sm" variant="ghost">{t("monitors.pause")}</Button>
460
+ * </Table.Actions>
461
+ */
462
+ Table.Actions = function TableActions(handle) {
463
+ return () => {
464
+ let { overflowLabel, children, mix, ...rest } = handle.props;
465
+ let menuId = `${handle.id}-menu`;
466
+ let panelId = `${handle.id}-actions`;
467
+ /**
468
+ * Without an `overflowLabel`, the inline actions are themselves the popover the ⋯ button
469
+ * opens, named by the actions column; a row with neither name keeps its actions in place.
470
+ */
471
+ let labelledBy = overflowLabel ? undefined : handle.context.get(Table)?.actionsLabelId;
472
+ let panel = Boolean(labelledBy);
473
+ let folds = Boolean(overflowLabel) || panel;
474
+ return (_jsxs("td", { ...rest, "data-slot": "row-actions", mix: mergeMix([
475
+ is("1%"),
476
+ pi("0.5rem"),
477
+ pb("0.25rem"),
478
+ raw({
479
+ whiteSpace: "nowrap",
480
+ transition: "opacity 150ms ease-out",
481
+ [FINE_HOVER_QUERY]: {
482
+ paddingInline: 0,
483
+ opacity: 0,
484
+ ':is(tr:hover, tr:focus-within, tr[aria-selected="true"], tr:has(:popover-open)) > &': { opacity: 1 },
485
+ },
486
+ [ACTIONS_OVERFLOW_QUERY]: { paddingInline: "0.5rem", opacity: 1 },
487
+ "@media (prefers-reduced-motion: reduce)": { transition: "none" },
488
+ }),
489
+ ], mix), children: [_jsx("div", { id: panel ? panelId : undefined, popover: panel ? "auto" : undefined, "data-slot": "row-actions-inline", mix: [
490
+ raw({
491
+ position: "static",
492
+ inset: "auto",
493
+ display: "flex",
494
+ alignItems: "center",
495
+ justifyContent: "end",
496
+ gap: "0.25rem",
497
+ padding: 0,
498
+ "&:not(:popover-open)": {
499
+ margin: 0,
500
+ border: 0,
501
+ overflow: "visible",
502
+ color: "inherit",
503
+ backgroundColor: "transparent",
504
+ inlineSize: "auto",
505
+ blockSize: "auto",
506
+ },
507
+ [FINE_HOVER_QUERY]: {
508
+ position: "absolute",
509
+ insetBlock: 0,
510
+ insetInlineEnd: 0,
511
+ zIndex: 1,
512
+ paddingInline: "0.5rem",
513
+ "&::before": {
514
+ content: '""',
515
+ position: "absolute",
516
+ insetBlock: 0,
517
+ insetInlineStart: `calc(-1 * ${ACTIONS_FADE_LEAD})`,
518
+ insetInlineEnd: 0,
519
+ zIndex: -1,
520
+ pointerEvents: "none",
521
+ backgroundColor: TABLE_BG,
522
+ backgroundImage: ROW_TINT_IMAGE,
523
+ maskImage: `linear-gradient(to right, transparent, black ${ACTIONS_FADE_LENGTH})`,
524
+ },
525
+ "&:dir(rtl)::before": {
526
+ maskImage: `linear-gradient(to left, transparent, black ${ACTIONS_FADE_LENGTH})`,
527
+ },
528
+ ...ACTIONS_HOVER_FILLS,
529
+ },
530
+ [ACTIONS_OVERFLOW_QUERY]: {
531
+ position: "static",
532
+ paddingInline: 0,
533
+ "&::before": { content: "none" },
534
+ ...(folds ? { "&:not(:popover-open)": { display: "none" } } : {}),
535
+ },
536
+ /**
537
+ * Opened from the ⋯ button, the actions stack as a menu's rows under it, each
538
+ * keeping its own control and tone.
539
+ */
540
+ "&:popover-open": {
541
+ position: "fixed",
542
+ inset: "auto",
543
+ margin: 0,
544
+ marginBlockStart: "var(--ui-popover-offset, 0.5rem)",
545
+ positionArea: "bottom span-left",
546
+ positionTryFallbacks: "flip-block, flip-inline, flip-block flip-inline",
547
+ flexDirection: "column",
548
+ alignItems: "stretch",
549
+ gap: "0.125rem",
550
+ padding: SURFACE_PADDING,
551
+ minInlineSize: "10rem",
552
+ "&::before": { content: "none" },
553
+ "& > :is(a, button)": { justifyContent: "start" },
554
+ },
555
+ }),
556
+ when("&:popover-open", floatingSurface()),
557
+ ], children: children }), folds ? (_jsx("div", { "data-slot": "row-actions-overflow", mix: [
558
+ justify("end"),
559
+ raw({
560
+ display: "none",
561
+ [ACTIONS_OVERFLOW_QUERY]: {
562
+ display: "flex",
563
+ ':is(td):not(:has(> [data-slot="row-actions-inline"] > *)) > &': {
564
+ display: "none",
565
+ },
566
+ },
567
+ }),
568
+ ], children: _jsx(Button, { size: "sm", variant: "ghost", color: "neutral", commandfor: overflowLabel ? menuId : panelId, command: "toggle-popover", "aria-label": overflowLabel, "aria-labelledby": labelledBy, mix: [raw(MENU_BUTTON_SIZE)], children: _jsx(EllipsisIcon, { size: 16 }) }) })) : null, overflowLabel ? (_jsx(TableActionsMenu, { children: _jsx(Menu, { id: menuId, placement: "bottom-end", "aria-label": overflowLabel, children: children }) })) : null] }));
569
+ };
570
+ };
571
+ /**
572
+ * Renders one row action as a small neutral ghost button, or a danger one with `danger`; inside
573
+ * the overflow menu of {@link Table.Actions} it renders as a menu row instead, so an app writes
574
+ * each action once and both forms carry it.
575
+ *
576
+ * @param handle Runtime handle carrying the host `<a>`/`<button>`'s props.
577
+ * @returns The render function producing the action.
578
+ * @example <Table.Action href={href("posts.edit", { id })}>{t("posts.edit")}</Table.Action>
579
+ * @example <Table.Action danger commandfor="confirm-delete" command="show-modal">{t("posts.delete")}</Table.Action>
580
+ */
581
+ Table.Action = function TableAction(handle) {
582
+ return () => {
583
+ let inMenu = handle.context.get(TableActionsMenu);
584
+ if (inMenu)
585
+ return _jsx(Menu.Item, { ...handle.props });
586
+ let { href, target, rel, danger, mix, ...rest } = handle.props;
587
+ let color = danger ? "danger" : "neutral";
588
+ if (href) {
589
+ /**
590
+ * `rest`'s fields (aria-*, data-*, id, event props, …) are all valid on an `<a>` too;
591
+ * `type` and `role` are left to the link.
592
+ */
593
+ let { type: _type, ...anchorRest } = rest;
594
+ return (_jsx(LinkButton, { ...anchorRest, href: href, target: target, rel: rel, size: "sm", variant: "ghost", color: color, mix: mix }));
595
+ }
596
+ return (_jsx(Button, { type: "button", ...rest, size: "sm", variant: "ghost", color: color, mix: mix }));
597
+ };
598
+ };
599
+ /**
600
+ * Renders the link to a row's record, usually the name in the first cell; its hit area covers
601
+ * the whole row, and its focus ring outlines the row. In a pinned first column the target
602
+ * stays within that cell, since the pinned cell anchors the link's overlay.
603
+ *
604
+ * @param handle Runtime handle carrying the host `<a>`'s props.
605
+ * @returns The render function producing the link.
606
+ * @example <Table.Cell><Table.RowLink href={href("monitors.show", { id })}>{monitor.name}</Table.RowLink></Table.Cell>
607
+ */
608
+ Table.RowLink = function TableRowLink(handle) {
609
+ return () => {
610
+ let { mix, ...rest } = handle.props;
611
+ return (_jsx("a", { ...rest, "data-slot": "row-link", mix: mergeMix([
612
+ fg("inherit"),
613
+ weight(500),
614
+ textDecoration("none"),
615
+ hover(textDecoration("underline")),
616
+ raw({
617
+ outline: "none",
618
+ "&::after": { content: '""', position: "absolute", inset: 0 },
619
+ "&:focus-visible::after": {
620
+ outline: "2px solid var(--ui-brand-ring)",
621
+ outlineOffset: "-2px",
622
+ },
623
+ }),
624
+ ], mix) }));
625
+ };
626
+ };
627
+ /**
628
+ * Draws `—` muted, the one mark for an unknown value, so a blank never reads as zero.
629
+ *
630
+ * @returns The render function producing the dash.
631
+ */
632
+ function EmptyValue() {
633
+ return () => (_jsx("span", { "data-slot": "empty-value", mix: [fg("neutral.muted")], children: EMPTY_VALUE }));
634
+ }
635
+ /**
636
+ * Renders a number through `Intl.NumberFormat`, end-aligned in tabular figures.
637
+ *
638
+ * @param handle Runtime handle carrying the host `<td>`'s props.
639
+ * @returns The render function producing the cell.
640
+ * @example <Table.NumberCell value={monitor.p95} locale={locale} format={{ style: "unit", unit: "millisecond" }} />
641
+ * @example <Table.NumberCell value={monitor.uptime} locale={locale} format={{ style: "percent", maximumFractionDigits: 2 }} />
642
+ */
643
+ Table.NumberCell = function TableNumberCell(handle) {
644
+ return () => {
645
+ let { value, locale, format, ...rest } = handle.props;
646
+ return (_jsx(Table.Cell, { ...rest, numeric: true, "data-type": "number", children: value === null || value === undefined ? (_jsx(EmptyValue, {})) : (new Intl.NumberFormat(locale, format).format(value)) }));
647
+ };
648
+ };
649
+ /**
650
+ * Renders an amount in its currency's symbol with the ISO code muted after it ("€123.00 EUR"),
651
+ * end-aligned in tabular figures so amounts in mixed currencies still line up.
652
+ *
653
+ * @param handle Runtime handle carrying the host `<td>`'s props.
654
+ * @returns The render function producing the cell.
655
+ * @example <Table.CurrencyCell value={payment.amount / 100} currency={payment.currency} locale={locale} />
656
+ */
657
+ Table.CurrencyCell = function TableCurrencyCell(handle) {
658
+ return () => {
659
+ let { value, currency, locale, ...rest } = handle.props;
660
+ return (_jsx(Table.Cell, { ...rest, numeric: true, "data-type": "currency", children: value === null || value === undefined ? (_jsx(EmptyValue, {})) : (_jsxs("span", { mix: [raw({ whiteSpace: "nowrap" })], children: [new Intl.NumberFormat(locale, {
661
+ style: "currency",
662
+ currency,
663
+ currencyDisplay: "narrowSymbol",
664
+ }).format(value), _jsx("span", { "data-slot": "currency-code", mix: [fg("neutral.muted"), raw({ marginInlineStart: "0.375em" })], children: currency.toUpperCase() })] })) }));
665
+ };
666
+ };
667
+ /**
668
+ * Renders an id in mono, ellipsised in the middle so its last characters stay visible. The
669
+ * whole id stays in the text, so it reads aloud, copies and searches whole, and in the title.
670
+ *
671
+ * @param handle Runtime handle carrying the host `<td>`'s props.
672
+ * @returns The render function producing the cell.
673
+ * @example <Table.IdCell value={payment.id} />
674
+ */
675
+ Table.IdCell = function TableIdCell(handle) {
676
+ return () => {
677
+ let { value, tail, ...rest } = handle.props;
678
+ let keep = Math.max(0, tail ?? DEFAULT_ID_TAIL);
679
+ let kept = value && value.length > keep ? keep : 0;
680
+ return (_jsx(Table.Cell, { ...rest, "data-type": "id", children: value === null || value === undefined || value === "" ? (_jsx(EmptyValue, {})) : (_jsxs("span", { "data-slot": "id", title: value, mix: [
681
+ flex(),
682
+ font("mono"),
683
+ fontSize("xs"),
684
+ fg("neutral"),
685
+ /**
686
+ * The cap yields to the tail plus one character for the head's ellipsis,
687
+ * so a long tail stays whole and the head truncates first.
688
+ */
689
+ raw({
690
+ maxInlineSize: `max(var(--ui-table-id-max-inline-size, 14ch), ${kept + 1}ch)`,
691
+ }),
692
+ ], children: [_jsx("span", { mix: [truncate(), raw({ minInlineSize: kept > 0 ? "1ch" : 0 })], children: value.length > keep ? value.slice(0, value.length - keep) : value }), value.length > keep && keep > 0 ? (_jsx("span", { mix: [shrink(0), raw({ whiteSpace: "pre" })], children: value.slice(-keep) })) : null] })) }));
693
+ };
694
+ };
695
+ /**
696
+ * Renders a moment through `RelativeTime`: "2m ago" within a week, a date after it, the exact
697
+ * local and UTC time in its title. The cell holds one line in every density.
698
+ *
699
+ * @param handle Runtime handle carrying the host `<td>`'s props.
700
+ * @returns The render function producing the cell.
701
+ * @example <Table.DateCell date={monitor.checkedAt} now={requestTime} locale={locale} local />
702
+ */
703
+ Table.DateCell = function TableDateCell(handle) {
704
+ return () => {
705
+ let { date, now, locale, timeZone, local, mix, ...rest } = handle.props;
706
+ return (_jsx(Table.Cell, { ...rest, "data-type": "date", mix: [nowrap(), mix], children: date === null || date === undefined ? (_jsx(EmptyValue, {})) : (_jsx(RelativeTime, { date: date, now: now, locale: locale, timeZone: timeZone, local: local, mix: [fg("neutral"), raw({ whiteSpace: "nowrap" })] })) }));
707
+ };
708
+ };
709
+ /**
710
+ * Renders a state as a `StatusDot` and its label, with any `detail` muted after a middle dot,
711
+ * the whole label on one line.
712
+ *
713
+ * @param handle Runtime handle carrying the host `<td>`'s props.
714
+ * @returns The render function producing the cell.
715
+ * @example <Table.StatusCell color="success">{t("monitor.up")}</Table.StatusCell>
716
+ * @example <Table.StatusCell color="warning" detail={<RelativeTime date={post.publishAt} />}>{t("posts.scheduled")}</Table.StatusCell>
717
+ */
718
+ Table.StatusCell = function TableStatusCell(handle) {
719
+ return () => {
720
+ let { color, pulse, children, detail, ...rest } = handle.props;
721
+ let detailed = detail !== null && detail !== undefined && detail !== false;
722
+ let empty = children === null || children === undefined || children === false;
723
+ return (_jsx(Table.Cell, { ...rest, "data-type": "status", children: empty ? (_jsx(EmptyValue, {})) : (_jsxs(StatusDot, { color: color, pulse: pulse, children: [children, detailed ? (_jsxs("span", { "data-slot": "status-detail", mix: [fg("neutral.muted"), tabularNums()], children: [" · ", detail] })) : null] })) }));
724
+ };
725
+ };
726
+ /**
727
+ * Renders a figure over a bar sized to `value / max`, so the column reads as a bar chart
728
+ * while every figure stays exact. The bar is decorative; the figure carries the value.
729
+ *
730
+ * @param handle Runtime handle carrying the host `<td>`'s props.
731
+ * @returns The render function producing the cell.
732
+ * @example <Table.BarCell value={route.requests} max={busiest} locale={locale} />
733
+ */
734
+ Table.BarCell = function TableBarCell(handle) {
735
+ return () => {
736
+ let { value, max, locale, format, color, ...rest } = handle.props;
737
+ let share = value === null || value === undefined
738
+ ? 0
739
+ : Math.min(1, Math.max(0, value / (max ?? DEFAULT_BAR_MAX)));
740
+ return (_jsx(Table.Cell, { ...rest, numeric: true, "data-type": "bar", children: value === null || value === undefined ? (_jsx(EmptyValue, {})) : (_jsxs("span", { "data-slot": "bar", "data-color": color ?? "neutral", mix: [
741
+ relative(),
742
+ flex(),
743
+ justify("end"),
744
+ raw({
745
+ isolation: "isolate",
746
+ paddingInline: "0.375rem",
747
+ minInlineSize: "var(--ui-table-bar-min-inline-size, 6rem)",
748
+ }),
749
+ ], children: [_jsx("span", { "aria-hidden": "true", "data-slot": "bar-fill", mix: [
750
+ raw({
751
+ position: "absolute",
752
+ insetBlock: "-0.125rem",
753
+ insetInlineStart: 0,
754
+ inlineSize: `${(share * 100).toFixed(2)}%`,
755
+ zIndex: -1,
756
+ borderRadius: "var(--ui-radius-sm, 0.25rem)",
757
+ backgroundColor: "var(--ui-neutral-bg-tint)",
758
+ '[data-color="brand"] > &': { backgroundColor: "var(--ui-brand-bg-tint)" },
759
+ '[data-color="success"] > &': { backgroundColor: "var(--ui-success-bg-tint)" },
760
+ '[data-color="warning"] > &': { backgroundColor: "var(--ui-warning-bg-tint)" },
761
+ '[data-color="danger"] > &': { backgroundColor: "var(--ui-danger-bg-tint)" },
762
+ }),
763
+ ] }), new Intl.NumberFormat(locale, format).format(value)] })) }));
764
+ };
765
+ };
766
+ /**
767
+ * Renders what a table with no rows shows: any content, laid out beneath the table's header
768
+ * and outside the `<table>`, so the column names stay as context for what is missing.
769
+ *
770
+ * @param handle Runtime handle carrying the host `<div>`'s props.
771
+ * @returns The render function producing the slot.
772
+ * @example
773
+ * <Table.Container>
774
+ * <Table aria-label={t("monitors.title")}><Table.Header>…</Table.Header></Table>
775
+ * <Table.Empty><Empty>…</Empty></Table.Empty>
776
+ * </Table.Container>
777
+ */
778
+ Table.Empty = function TableEmpty(handle) {
779
+ return () => {
780
+ let { mix, ...rest } = handle.props;
781
+ return (_jsx("div", { ...rest, "data-slot": "table-empty", mix: mergeMix([raw({ paddingBlock: "2.5rem", paddingInline: "1rem" })], mix) }));
782
+ };
783
+ };
784
+ /**
785
+ * Renders a failure in place of {@link Table.Body}: the message and a Retry slot centred
786
+ * across every column, announced as an alert, so the header and the page around it stay put.
787
+ *
788
+ * @param handle Runtime handle carrying the host `<tbody>`'s props.
789
+ * @returns The render function producing the body.
790
+ * @example
791
+ * <Table.Error colSpan={6} action={<LinkButton href={currentUrl}>{t("retry")}</LinkButton>}>
792
+ * {t("monitors.loadFailed")}
793
+ * </Table.Error>
794
+ */
795
+ Table.Error = function TableError(handle) {
796
+ return () => {
797
+ let { colSpan, children, action, mix, ...rest } = handle.props;
798
+ return (_jsx("tbody", { ...rest, "data-slot": "error", mix: [mix], children: _jsx("tr", { children: _jsx("td", { colSpan: colSpan, mix: [p("0")], children: _jsxs("div", { role: "alert", mix: [
799
+ flex(),
800
+ items("center"),
801
+ justify("center"),
802
+ gap("0.75rem"),
803
+ fg("neutral"),
804
+ raw({
805
+ flexWrap: "wrap",
806
+ paddingBlock: "2rem",
807
+ paddingInline: "1rem",
808
+ textAlign: "center",
809
+ }),
810
+ ], children: [_jsx("span", { children: children }), action] }) }) }) }));
811
+ };
812
+ };
209
813
  /**
210
814
  * Renders a trailing row carrying a single link that spans every column,
211
815
  * standing in for an auto-loading "next page" trigger since fetching more