@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
@@ -0,0 +1,182 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "remix/component/jsx-runtime";
2
+ import { bg, border, borderEdge, fg } from "@sdxc/u/color";
3
+ import { rounded } from "@sdxc/u/effects";
4
+ import { mergeMix, raw } from "@sdxc/u/general";
5
+ import { container, hstack, vstack } from "@sdxc/u/layout";
6
+ import { divide, overflow } from "@sdxc/u/overflow";
7
+ import { m, minIs, p } from "@sdxc/u/size";
8
+ import { balance, pretty, text, weight } from "@sdxc/u/typography";
9
+ import { clientEntry } from "remix/component";
10
+ import { Button } from "../components/button.js";
11
+ import { submitOnChange } from "./mixins/submit-on-change.js";
12
+ import { SaveShortcut } from "./save-bar.js";
13
+ import { actionRowGrid, onTitleLine } from "./styles/action-row.js";
14
+ /** Container the card measures, so a row stacks in a narrow pane as well as on a phone. */
15
+ const CARD_CONTAINER = "ui-settings-card";
16
+ /** Container the section measures to put its heading beside the card. */
17
+ const SECTION_CONTAINER = "ui-settings-section";
18
+ /** Card width below which a split row stacks its label over its control. */
19
+ const SPLIT_MIN = "32rem";
20
+ /** HTTP method a section's form falls back to, since saving changes state. */
21
+ const DEFAULT_METHOD = "post";
22
+ /** How a section saves when `save` is omitted. */
23
+ const DEFAULT_SAVE = "explicit";
24
+ /** Where the heading sits when `heading` is omitted. */
25
+ const DEFAULT_HEADING = "above";
26
+ /** How a row lays out when `layout` is omitted. */
27
+ const DEFAULT_ROW_LAYOUT = "split";
28
+ /** Gap between a row's text and its control, stacked or side by side. */
29
+ const ROW_GAP = "0.5rem 1.5rem";
30
+ /** Where an action row's control sits when `actionPlacement` is omitted. */
31
+ const DEFAULT_ACTION_PLACEMENT = "end";
32
+ /**
33
+ * Renders the section. The card is a `<form>` when `form` is set; an explicit section ends
34
+ * in a footer holding its own Save, which ⌘S presses while focus is in the section, an
35
+ * instant one submits whenever a control changes, and a `"none"` one is a plain card.
36
+ *
37
+ * @param handle Runtime handle carrying the section's props.
38
+ * @returns The render function producing the section's markup.
39
+ * @example
40
+ * <SettingsSection title="Monitor defaults" save="explicit" form={{ action: "/settings/monitors" }} labels={{ save: "Save" }}>
41
+ * <SettingsSection.Row label="Check interval" htmlFor="interval"><Select id="interval" name="interval">…</Select></SettingsSection.Row>
42
+ * </SettingsSection>
43
+ * @example
44
+ * <SettingsSection title="Notifications" save="instant" form={{ action: "/settings/notifications" }} labels={{ save: "Save" }}>
45
+ * <SettingsSection.Row layout="inline-switch" label="Email me when a monitor goes down" labelId="down-label">
46
+ * <Switch name="emailOnDown" aria-labelledby="down-label" />
47
+ * </SettingsSection.Row>
48
+ * </SettingsSection>
49
+ * @example
50
+ * <SettingsSection title="Members" save="none" actions={<Button commandfor="invite" command="show-modal">Invite member</Button>}>
51
+ * <Table.Container>…</Table.Container>
52
+ * </SettingsSection>
53
+ */
54
+ export function SettingsSection(handle) {
55
+ return () => {
56
+ let props = handle.props;
57
+ let saveLabel = props.save === "none" ? null : props.labels.save;
58
+ let { title, description, actions, save: saveProp, form, heading: headingProp, footer, labels: _labels, children, mix, ...rest } = props;
59
+ let save = saveProp ?? DEFAULT_SAVE;
60
+ let heading = headingProp ?? DEFAULT_HEADING;
61
+ let titleId = `${handle.id}-title`;
62
+ let isExplicit = save === "explicit";
63
+ let cardMix = [
64
+ container(CARD_CONTAINER),
65
+ minIs(0),
66
+ rounded("lg"),
67
+ border({ color: "neutral", width: 1 }),
68
+ bg(),
69
+ overflow("hidden"),
70
+ ];
71
+ let rows = (_jsx("div", { "data-slot": "settings-rows", mix: [vstack({ gap: 0, align: "stretch" }), divide("block", "neutral")], children: children }));
72
+ let saveFooter = isExplicit ? (_jsxs("footer", { "data-slot": "settings-footer", mix: [
73
+ hstack({ gap: 3, align: "center" }),
74
+ raw({ flexWrap: "wrap" }),
75
+ p(3, 4),
76
+ borderEdge("block-start", { color: "neutral", width: 1, style: "solid" }),
77
+ bg("neutral.bg-tint"),
78
+ ], children: [_jsx(Button, { type: "submit", color: "brand", variant: "solid", size: "sm", children: saveLabel }), footer] })) : null;
79
+ /**
80
+ * An instant section saves through script, so a browser running none gets the Save
81
+ * button an explicit section shows.
82
+ */
83
+ let instantSave = save !== "instant" ? null : (_jsxs(_Fragment, { children: [_jsx("noscript", { children: _jsx("div", { mix: [
84
+ p(3, 4),
85
+ borderEdge("block-start", { color: "neutral", width: 1, style: "solid" }),
86
+ ], children: _jsx(Button, { type: "submit", color: "brand", variant: "solid", size: "sm", children: saveLabel }) }) }), _jsx(SettingsInstantSave, {})] }));
87
+ return (_jsx("section", { ...rest, "aria-labelledby": titleId, "data-slot": "settings-section", "data-save": save, mix: mergeMix([container(SECTION_CONTAINER)], mix), children: _jsxs("div", { mix: [
88
+ raw({
89
+ display: "grid",
90
+ gridTemplateColumns: "minmax(0, 1fr)",
91
+ gap: "0.75rem",
92
+ ...(heading === "beside"
93
+ ? {
94
+ [`@container ${SECTION_CONTAINER} (min-width: 48rem)`]: {
95
+ gridTemplateColumns: "minmax(0, 16rem) minmax(0, 1fr)",
96
+ gap: "2rem",
97
+ },
98
+ }
99
+ : {}),
100
+ }),
101
+ ], children: [_jsxs("header", { mix: [vstack({ gap: 1, align: "stretch" }), minIs(0)], children: [_jsxs("div", { "data-slot": "settings-title-row", mix: [
102
+ hstack({ gap: 2, align: "center" }),
103
+ raw({ flexWrap: "wrap", columnGap: "1rem" }),
104
+ ], children: [_jsx("h2", { id: titleId, mix: [
105
+ m(0),
106
+ raw({ flex: "1 1 auto" }),
107
+ minIs(0),
108
+ text("base"),
109
+ weight("semibold"),
110
+ fg("neutral.emphasis"),
111
+ balance(),
112
+ ], children: title }), actions ? (_jsx("div", { "data-slot": "settings-actions", mix: [
113
+ hstack({ gap: 2, align: "center" }),
114
+ raw({ flexWrap: "wrap", flex: "0 1 auto" }),
115
+ minIs(0),
116
+ ], children: actions })) : null] }), description ? (_jsx("p", { mix: [m(0), text("sm"), fg("neutral.muted"), pretty()], children: description })) : null] }), form ? (_jsxs("form", { action: form.action, method: form.method ?? DEFAULT_METHOD, "data-slot": "settings-card", mix: cardMix, children: [form.fields, rows, saveFooter, isExplicit ? _jsx(SaveShortcut, {}) : null, instantSave] })) : (_jsxs("div", { "data-slot": "settings-card", mix: cardMix, children: [rows, saveFooter] }))] }) }));
117
+ };
118
+ }
119
+ /**
120
+ * Renders one setting as a label and help beside or above its control. A split row reads
121
+ * its card's width, so it stacks in a narrow pane as well as on a phone.
122
+ *
123
+ * @param handle Runtime handle carrying the row's props.
124
+ * @returns The render function producing the row's markup.
125
+ * @example
126
+ * <SettingsSection.Row label="Alert email" description="Where down alerts go." htmlFor="alert-email">
127
+ * <Input id="alert-email" name="alertEmail" type="email" />
128
+ * </SettingsSection.Row>
129
+ * @example
130
+ * <SettingsSection.Row layout="action" label="Subscription" description="Plan, card and invoices.">
131
+ * <LinkButton href="/billing/portal" size="sm" variant="outline">Open billing portal</LinkButton>
132
+ * </SettingsSection.Row>
133
+ */
134
+ SettingsSection.Row = function SettingsSectionRow(handle) {
135
+ return () => {
136
+ let { label, description, htmlFor, labelId, descriptionId, layout: layoutProp, actionPlacement: actionPlacementProp, children, mix, ...rest } = handle.props;
137
+ let layout = layoutProp ?? DEFAULT_ROW_LAYOUT;
138
+ let actionPlacement = actionPlacementProp ?? DEFAULT_ACTION_PLACEMENT;
139
+ let isEndAction = layout === "action" && actionPlacement === "end";
140
+ let labelMix = [text("sm"), weight("medium"), fg("neutral.emphasis")];
141
+ return (_jsxs("div", { ...rest, "data-slot": "settings-row", "data-layout": layout, "data-action-placement": layout === "action" ? actionPlacement : undefined, mix: mergeMix([
142
+ p(4),
143
+ layout === "action"
144
+ ? actionRowGrid(CARD_CONTAINER, actionPlacement, ROW_GAP)
145
+ : raw({
146
+ display: "grid",
147
+ gap: ROW_GAP,
148
+ alignItems: rowAlign(layout, Boolean(description)),
149
+ gridTemplateColumns: layout === "inline-switch" ? "minmax(0, 1fr) auto" : "minmax(0, 1fr)",
150
+ ...(layout === "split"
151
+ ? {
152
+ [`@container ${CARD_CONTAINER} (min-width: ${SPLIT_MIN})`]: {
153
+ gridTemplateColumns: "minmax(0, 1fr) minmax(0, 1fr)",
154
+ },
155
+ }
156
+ : {}),
157
+ }),
158
+ ], mix), children: [_jsxs("div", { "data-slot": "settings-row-text", mix: [vstack({ gap: 0.5, align: "stretch" }), minIs(0)], children: [htmlFor ? (_jsx("label", { id: labelId, for: htmlFor, mix: labelMix, children: label })) : (_jsx("div", { id: labelId, mix: labelMix, children: label })), description ? (_jsx("p", { id: descriptionId, mix: [m(0), text("sm"), fg("neutral.muted"), pretty()], children: description })) : null] }), _jsx("div", { "data-slot": "settings-row-control", mix: [minIs(0), isEndAction ? onTitleLine(CARD_CONTAINER) : undefined], children: children })] }));
159
+ };
160
+ };
161
+ /**
162
+ * Where a row's label meets its control: a lone label centres on the control's text line,
163
+ * while a label carrying a description keeps its top on the control's top so the help reads
164
+ * down from it. An inline switch centres on the whole text block.
165
+ */
166
+ function rowAlign(layout, hasDescription) {
167
+ if (layout === "inline-switch")
168
+ return "center";
169
+ if (layout === "split" && !hasDescription)
170
+ return "center";
171
+ return "start";
172
+ }
173
+ /**
174
+ * Client island: what makes an instant section save as it changes, attaching
175
+ * `submitOnChange()` to the enclosing form so every flipped control submits it.
176
+ *
177
+ * @example
178
+ * <form method="post"><Switch name="weekly" /><SettingsInstantSave /></form>
179
+ */
180
+ export const SettingsInstantSave = clientEntry("@sdxc/ui/app/settings-section#SettingsInstantSave", function SettingsInstantSave() {
181
+ return () => _jsx("span", { hidden: true, "data-slot": "settings-instant-save", mix: [submitOnChange()] });
182
+ });
@@ -1,14 +1,14 @@
1
1
  /**
2
- * A decorative loading placeholder rendered as a single static block,
3
- * sized to stand in for the content it precedes and showing a still,
4
- * inert silhouette while data loads.
2
+ * Loading placeholders: a single static block, plus presets that keep the real
3
+ * height of what they stand in for (a table row, a stat card, a table body, a
4
+ * list), so content lands without the page shifting.
5
5
  *
6
6
  * @author [Sergio Xalambrí](https://sergiodxa.com)
7
7
  * @copyright Sergio Xalambrí 2026
8
8
  */
9
9
  import type { Handle, Props as TagProps } from "remix/component";
10
10
  /**
11
- * Props accepted by {@link Skeleton}.
11
+ * Props accepted by {@link Skeleton} and its presets.
12
12
  */
13
13
  export declare namespace Skeleton {
14
14
  /**
@@ -18,6 +18,43 @@ export declare namespace Skeleton {
18
18
  */
19
19
  interface Props extends TagProps<"div"> {
20
20
  }
21
+ /**
22
+ * Names the loading cluster for assistive technology. Given, the preset's
23
+ * root becomes one busy `role="status"` named by it; left out, the whole
24
+ * preset stays hidden, for a parent that already announces the wait.
25
+ */
26
+ interface Labelled {
27
+ /** What is loading, such as "Loading monitors". */
28
+ label?: string;
29
+ }
30
+ /** Props accepted by {@link Skeleton.Row}. */
31
+ interface RowProps extends TagProps<"tr"> {
32
+ /** Cells in the row; match the real table's columns. Default: `4`. */
33
+ columns?: number;
34
+ }
35
+ /** Props accepted by {@link Skeleton.Table}. */
36
+ interface TableProps extends TagProps<"tbody">, Labelled {
37
+ /** Placeholder rows. Default: `5`. */
38
+ rows?: number;
39
+ /** Cells per row; match the real table's columns. Default: `4`. */
40
+ columns?: number;
41
+ }
42
+ /** Props accepted by {@link Skeleton.Stat}. */
43
+ interface StatProps extends Omit<TagProps<"div">, "children">, Labelled {
44
+ /** Draws the delta pill where a card with a delta sets it. */
45
+ delta?: boolean;
46
+ /** Draws the chart band under the value, as a card with a sparkline has. */
47
+ chart?: boolean;
48
+ }
49
+ /** Props accepted by {@link Skeleton.List}. */
50
+ interface ListProps extends TagProps<"div">, Labelled {
51
+ /** Placeholder rows. Default: `5`. */
52
+ rows?: number;
53
+ /** Leads each row with a round avatar placeholder. */
54
+ avatar?: boolean;
55
+ /** Text lines per row. Default: `2`. */
56
+ lines?: 1 | 2;
57
+ }
21
58
  }
22
59
  /**
23
60
  * A static loading placeholder: a rounded block filled with the neutral
@@ -34,3 +71,9 @@ export declare namespace Skeleton {
34
71
  * <Skeleton aria-hidden="false" aria-label={t("status.loadingProfile")} />
35
72
  */
36
73
  export declare function Skeleton(handle: Handle<Skeleton.Props>): () => import("remix/component").RemixElement;
74
+ export declare namespace Skeleton {
75
+ var Row: (handle: Handle<Skeleton.RowProps>) => () => import("remix/component").RemixElement;
76
+ var Table: (handle: Handle<Skeleton.TableProps>) => () => import("remix/component").RemixElement;
77
+ var Stat: (handle: Handle<Skeleton.StatProps>) => () => import("remix/component").RemixElement;
78
+ var List: (handle: Handle<Skeleton.ListProps>) => () => import("remix/component").RemixElement;
79
+ }
@@ -1,15 +1,85 @@
1
- import { jsx as _jsx } from "remix/component/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { animationHost, keyframes } from "@sdxc/u/animation";
2
3
  import { bg } from "@sdxc/u/color";
3
4
  import { rounded } from "@sdxc/u/effects";
4
- import { mergeMix } from "@sdxc/u/general";
5
+ import { combine, mergeMix, raw } from "@sdxc/u/general";
6
+ import { flex, flexCol, gap, grow, items, shrink } from "@sdxc/u/layout";
7
+ import { media } from "@sdxc/u/responsive";
5
8
  import { bs, is } from "@sdxc/u/size";
6
9
  import { attrs } from "remix/component";
10
+ import { StatCard } from "./stat-card.js";
11
+ import { statDeltaPlacement } from "./styles/stat-delta.js";
12
+ import { Table } from "./table.js";
7
13
  /**
8
14
  * Default `aria-hidden` value applied through {@link attrs}, keeping a
9
15
  * placeholder out of the accessibility tree unless a consumer sets
10
16
  * `aria-hidden="false"` to expose a loading label to assistive tech.
11
17
  */
12
18
  const DEFAULT_ARIA_HIDDEN = "true";
19
+ /** Bar widths a preset cycles through, so placeholder rows read as text of varied length. */
20
+ const BAR_WIDTHS = ["72%", "48%", "60%", "36%", "54%"];
21
+ /**
22
+ * A sweeping highlight across a placeholder bar while motion is allowed; under
23
+ * reduced motion the bar holds still, since the wait is already visible.
24
+ *
25
+ * @returns A mixin for a placeholder bar.
26
+ */
27
+ function shimmerBar() {
28
+ return combine([
29
+ keyframes("ui-skeleton-shimmer", {
30
+ from: { backgroundPosition: "150% 0" },
31
+ to: { backgroundPosition: "-50% 0" },
32
+ }),
33
+ media("(prefers-reduced-motion: no-preference)", combine([
34
+ raw({
35
+ backgroundImage: "linear-gradient(90deg, transparent, color-mix(in oklab, var(--ui-bg, Canvas) 45%, transparent), transparent)",
36
+ backgroundSize: "50% 100%",
37
+ backgroundRepeat: "no-repeat",
38
+ }),
39
+ animationHost("ui-skeleton-shimmer", {
40
+ duration: "var(--ui-skeleton-shimmer-duration, 1.6s)",
41
+ easing: "ease-in-out",
42
+ iterationCount: "infinite",
43
+ }),
44
+ ])),
45
+ ]);
46
+ }
47
+ /**
48
+ * One shimmering placeholder bar, inline-block so it sits on a text line
49
+ * without changing the line's height.
50
+ *
51
+ * @param handle Runtime handle carrying the bar's size.
52
+ * @returns The render function producing the bar's markup.
53
+ */
54
+ function SkeletonBar(handle) {
55
+ return () => {
56
+ let { width, height = "0.75rem", round = false } = handle.props;
57
+ return (_jsx("span", { "data-slot": "skeleton-bar", mix: [
58
+ raw({
59
+ display: "inline-block",
60
+ verticalAlign: "middle",
61
+ inlineSize: width,
62
+ maxInlineSize: "100%",
63
+ blockSize: height,
64
+ borderRadius: round ? "9999px" : "var(--ui-radius-sm, 0.25rem)",
65
+ }),
66
+ bg("neutral.border"),
67
+ shimmerBar(),
68
+ ] }));
69
+ };
70
+ }
71
+ /**
72
+ * The attributes a preset root carries: one busy, named status when the
73
+ * caller labels the cluster, otherwise hidden whole.
74
+ *
75
+ * @param label What is loading, or `undefined` to hide the preset.
76
+ * @returns Attributes to spread onto the preset's root element.
77
+ */
78
+ function busyAttributes(label) {
79
+ if (label === undefined)
80
+ return { "aria-hidden": "true" };
81
+ return { role: "status", "aria-busy": "true", "aria-label": label };
82
+ }
13
83
  /**
14
84
  * A static loading placeholder: a rounded block filled with the neutral
15
85
  * border color, sized to its container and one text line tall by default.
@@ -36,3 +106,80 @@ export function Skeleton(handle) {
36
106
  ], mix) }));
37
107
  };
38
108
  }
109
+ /**
110
+ * A placeholder table row built from the real `Table.Row` and `Table.Cell`, so it
111
+ * takes `--ui-table-row-block-size` and the table's cell padding and rules; place
112
+ * it in a real table body. Hidden from assistive technology.
113
+ *
114
+ * @param handle Runtime handle carrying the host `<tr>`'s props.
115
+ * @returns The render function producing the row's markup.
116
+ * @example
117
+ * <Table.Body aria-busy="true">{rows.map((n) => <Skeleton.Row key={n} columns={4} />)}</Table.Body>
118
+ */
119
+ Skeleton.Row = function SkeletonRow(handle) {
120
+ return () => {
121
+ let { columns = 4, mix, ...rest } = handle.props;
122
+ return (_jsx(Table.Row, { "aria-hidden": "true", "data-skeleton": "row", ...rest, mix: mix, children: Array.from({ length: columns }, (_, column) => (_jsx(Table.Cell, { children: _jsx(SkeletonBar, { width: BAR_WIDTHS[column % BAR_WIDTHS.length] }) }, column))) }));
123
+ };
124
+ };
125
+ /**
126
+ * A placeholder table body of `rows` {@link Skeleton.Row}s, for under the real
127
+ * table header while the first page loads, so the header, columns and height
128
+ * hold still when the data arrives.
129
+ *
130
+ * @param handle Runtime handle carrying the host `<tbody>`'s props.
131
+ * @returns The render function producing the body's markup.
132
+ * @example
133
+ * <Table><Table.Header>…</Table.Header><Skeleton.Table rows={10} columns={5} label={t("monitors.loading")} /></Table>
134
+ */
135
+ Skeleton.Table = function SkeletonTable(handle) {
136
+ return () => {
137
+ let { rows = 5, columns = 4, label, mix, ...rest } = handle.props;
138
+ let busy = label === undefined
139
+ ? { "aria-hidden": "true" }
140
+ : { "aria-busy": "true", "aria-label": label };
141
+ return (_jsx(Table.Body, { ...busy, "data-skeleton": "table", ...rest, mix: mix, children: Array.from({ length: rows }, (_, row) => (_jsx(Skeleton.Row, { columns: columns }, row))) }));
142
+ };
143
+ };
144
+ /**
145
+ * A placeholder stat card drawn inside the real `StatCard` frame, with bars on
146
+ * the label and value lines and the delta placed as a real one is in every group
147
+ * layout, so it is as tall as the card it precedes; `delta` and `chart` add parts.
148
+ *
149
+ * @param handle Runtime handle carrying the card's props.
150
+ * @returns The render function producing the card's markup.
151
+ * @example
152
+ * <StatCard.Group>{[1, 2, 3, 4].map((n) => <Skeleton.Stat key={n} delta />)}</StatCard.Group>
153
+ */
154
+ Skeleton.Stat = function SkeletonStat(handle) {
155
+ return () => {
156
+ let { delta = false, chart = false, label, mix, ...rest } = handle.props;
157
+ return (_jsxs(StatCard, { ...busyAttributes(label), "data-skeleton": "stat", ...rest, mix: mix, children: [_jsx(StatCard.Label, { children: _jsx(SkeletonBar, { width: "6rem", height: "0.75rem" }) }), delta ? (_jsx("span", { mix: [raw({ display: "inline-flex", alignItems: "center" }), statDeltaPlacement()], children: _jsx(SkeletonBar, { width: "3.5rem", height: "var(--ui-stat-delta-block-size, 1.375rem)", round: true }) })) : null, _jsx(StatCard.Value, { children: _jsx(SkeletonBar, { width: "5ch", height: "1em" }) }), chart ? (_jsx(StatCard.Chart, { children: _jsx(SkeletonBar, { width: "100%", height: "100%" }) })) : null] }));
158
+ };
159
+ };
160
+ /**
161
+ * A placeholder list of `rows` rows at `--ui-skeleton-list-row-block-size`
162
+ * (3.5rem, a two-line row), each an optional avatar and one or two text bars;
163
+ * set the variable to the real list's row height.
164
+ *
165
+ * @param handle Runtime handle carrying the host `<div>`'s props.
166
+ * @returns The render function producing the list's markup.
167
+ * @example
168
+ * <Skeleton.List rows={8} avatar label={t("inbox.loading")} />
169
+ */
170
+ Skeleton.List = function SkeletonList(handle) {
171
+ return () => {
172
+ let { rows = 5, avatar = false, lines = 2, label, mix, ...rest } = handle.props;
173
+ return (_jsx("div", { ...busyAttributes(label), "data-slot": "skeleton-list", ...rest, mix: mergeMix([flex(), flexCol()], mix), children: Array.from({ length: rows }, (_, row) => (_jsxs("div", { "data-slot": "skeleton-list-row", mix: [
174
+ flex(),
175
+ items("center"),
176
+ gap(3),
177
+ raw({
178
+ boxSizing: "border-box",
179
+ blockSize: "var(--ui-skeleton-list-row-block-size, 3.5rem)",
180
+ paddingInline: "0.75rem",
181
+ }),
182
+ raw({ borderBlockEnd: "1px solid var(--ui-neutral-border, currentColor)" }),
183
+ ], children: [avatar ? (_jsx("span", { mix: [shrink(0), raw({ display: "inline-flex" })], children: _jsx(SkeletonBar, { width: "2rem", height: "2rem", round: true }) })) : null, _jsxs("span", { mix: [flex(), flexCol(), gap(2), grow()], children: [_jsx(SkeletonBar, { width: BAR_WIDTHS[row % BAR_WIDTHS.length] }), lines === 2 ? (_jsx(SkeletonBar, { width: BAR_WIDTHS[(row + 2) % BAR_WIDTHS.length], height: "0.625rem" })) : null] })] }, row))) }));
184
+ };
185
+ };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * A row-sized trend line with no axes: the SVG stretches to its box while the stroke keeps its
3
+ * width, an optional area and last-point dot mark where the series ends, and a one-word state
4
+ * can sit beside it, so a list row carries its own trend.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { Handle, Props as TagProps, RemixNode } from "remix/component";
10
+ /**
11
+ * Prop types for {@link Sparkline}.
12
+ */
13
+ export declare namespace Sparkline {
14
+ /** Semantic role the line, area and dot are drawn in. */
15
+ type Tone = "brand" | "neutral" | "success" | "warning" | "danger";
16
+ /** Per-part styling for the parts a sparkline composes. */
17
+ interface PartsProps {
18
+ plot?: TagProps<"span">["mix"];
19
+ line?: TagProps<"path">["mix"];
20
+ area?: TagProps<"path">["mix"];
21
+ dot?: TagProps<"span">["mix"];
22
+ state?: TagProps<"span">["mix"];
23
+ }
24
+ /** Props accepted by {@link Sparkline}. */
25
+ interface Props extends Omit<TagProps<"span">, "children"> {
26
+ /** Samples in time order; a `null` leaves a gap in the line instead of drawing a zero. */
27
+ values: readonly (number | null)[];
28
+ /** Accessible name of the graphic, summarising the trend ("p95 latency, rising"). */
29
+ label: string;
30
+ /** Longer accessible description, such as the range and the latest value. */
31
+ description?: string;
32
+ /** @default {@link DEFAULT_TONE} */
33
+ tone?: Tone;
34
+ /** Fills the region under the line. */
35
+ area?: boolean;
36
+ /**
37
+ * Marks the latest sample with a dot.
38
+ *
39
+ * @default true
40
+ */
41
+ dot?: boolean;
42
+ /** `[min, max]` the plot spans; the samples' own extremes when omitted, so rows can share a scale. */
43
+ domain?: readonly [number, number];
44
+ /** One word beside the line that reads the trend ("Stable", "Degrading"). */
45
+ state?: RemixNode;
46
+ parts?: PartsProps;
47
+ }
48
+ }
49
+ /**
50
+ * Renders the trend: a `role="img"` SVG named by `label` that fills the row's inline size at
51
+ * `--ui-sparkline-block-size`, with a stroke that stays `--ui-sparkline-line-width` wide at any
52
+ * size. The latest-point dot is a round box over the plot, so it stays round when the plot stretches.
53
+ *
54
+ * @param handle Runtime handle carrying the host `<span>`'s props.
55
+ * @returns The render function producing the sparkline's markup.
56
+ * @example
57
+ * <Sparkline values={latency} label={t("monitor.latencyTrend")} tone="warning" state={t("trend.degrading")} />
58
+ * @example
59
+ * <Sparkline values={checks} label={t("monitor.checks")} area dot={false} domain={[0, 100]} />
60
+ */
61
+ export declare function Sparkline(handle: Handle<Sparkline.Props>): () => import("remix/component").RemixElement;
@@ -0,0 +1,145 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { fg, fill, fillOpacity, stroke, strokeLinecap, strokeLinejoin } from "@sdxc/u/color";
3
+ import { strokeWidth, vectorEffect } from "@sdxc/u/color";
4
+ import { rounded } from "@sdxc/u/effects";
5
+ import { mergeMix, raw } from "@sdxc/u/general";
6
+ import { absolute, block, grow, hstack, relative, shrink } from "@sdxc/u/layout";
7
+ import { bs, is, minIs } from "@sdxc/u/size";
8
+ import { data } from "@sdxc/u/state";
9
+ import { translateProperty } from "@sdxc/u/transform";
10
+ import { nowrap, text, weight } from "@sdxc/u/typography";
11
+ import { areaPath, linePath } from "./utils/chart-path.js";
12
+ /** Tone a sparkline draws in when `tone` is omitted. */
13
+ const DEFAULT_TONE = "brand";
14
+ /**
15
+ * Height of the `viewBox`; the plot maps values onto it with a small inset, so a stroke
16
+ * at the series' minimum or maximum stays inside the box.
17
+ */
18
+ const VIEWBOX_HEIGHT = 100;
19
+ /** Distance, in `viewBox` units, kept between the series' extremes and the box edges. */
20
+ const VIEWBOX_INSET = 6;
21
+ /**
22
+ * Resolves the plotted domain: the caller's, or the samples' own extremes widened by one on
23
+ * each side when every sample is equal, so a flat series draws across the middle.
24
+ *
25
+ * @param values Samples, `null` gaps included.
26
+ * @param domain Caller's fixed domain, when given.
27
+ * @returns The `[min, max]` the plot maps onto its height.
28
+ */
29
+ function resolveDomain(values, domain) {
30
+ if (domain)
31
+ return domain;
32
+ let present = values.filter((value) => value !== null);
33
+ if (present.length === 0)
34
+ return [0, 1];
35
+ let min = Math.min(...present);
36
+ let max = Math.max(...present);
37
+ return min === max ? [min - 1, max + 1] : [min, max];
38
+ }
39
+ /**
40
+ * Splits the samples into runs of consecutive present values, each scaled into `viewBox`
41
+ * space, so a `null` sample breaks the line where the data is missing.
42
+ *
43
+ * @param values Samples, `null` gaps included.
44
+ * @param domain `[min, max]` mapped onto the plot's height.
45
+ * @returns One list of points per unbroken run.
46
+ */
47
+ function segments(values, domain) {
48
+ let [min, max] = domain;
49
+ let span = max - min || 1;
50
+ let usable = VIEWBOX_HEIGHT - VIEWBOX_INSET * 2;
51
+ let runs = [];
52
+ let current = [];
53
+ values.forEach((value, index) => {
54
+ if (value === null) {
55
+ if (current.length > 0)
56
+ runs.push(current);
57
+ current = [];
58
+ return;
59
+ }
60
+ let clamped = Math.min(Math.max(value, min), max);
61
+ current.push({ x: index, y: VIEWBOX_INSET + usable - ((clamped - min) / span) * usable });
62
+ });
63
+ if (current.length > 0)
64
+ runs.push(current);
65
+ return runs;
66
+ }
67
+ /**
68
+ * Draws one unbroken run; a lone sample becomes a zero-length stroke, which its round cap
69
+ * paints as a dot, so an isolated reading between two gaps stays visible.
70
+ *
71
+ * @param run Scaled points of one run.
72
+ * @returns The path's `d` attribute.
73
+ */
74
+ function runPath(run) {
75
+ let [only] = run;
76
+ return run.length === 1 && only ? `M ${only.x},${only.y} h 0` : linePath(run);
77
+ }
78
+ /**
79
+ * Renders the trend: a `role="img"` SVG named by `label` that fills the row's inline size at
80
+ * `--ui-sparkline-block-size`, with a stroke that stays `--ui-sparkline-line-width` wide at any
81
+ * size. The latest-point dot is a round box over the plot, so it stays round when the plot stretches.
82
+ *
83
+ * @param handle Runtime handle carrying the host `<span>`'s props.
84
+ * @returns The render function producing the sparkline's markup.
85
+ * @example
86
+ * <Sparkline values={latency} label={t("monitor.latencyTrend")} tone="warning" state={t("trend.degrading")} />
87
+ * @example
88
+ * <Sparkline values={checks} label={t("monitor.checks")} area dot={false} domain={[0, 100]} />
89
+ */
90
+ export function Sparkline(handle) {
91
+ return () => {
92
+ let { values, label, description, tone, area, dot, domain, state, parts, mix, ...rest } = handle.props;
93
+ let resolvedTone = tone ?? DEFAULT_TONE;
94
+ let descriptionId = `${handle.id}-description`;
95
+ let runs = segments(values, resolveDomain(values, domain));
96
+ let width = Math.max(values.length - 1, 1);
97
+ let lastRun = runs.at(-1);
98
+ let last = lastRun?.at(-1);
99
+ let showDot = (dot ?? true) && last !== undefined && last.x === values.length - 1;
100
+ return (_jsxs("span", { "data-slot": "sparkline", "data-tone": resolvedTone, ...rest, mix: mergeMix([
101
+ hstack({ gap: 2, align: "center" }),
102
+ is("full"),
103
+ minIs(0),
104
+ data("tone", "brand", fg("brand")),
105
+ data("tone", "neutral", fg("neutral.muted")),
106
+ data("tone", "success", fg("success")),
107
+ data("tone", "warning", fg("warning")),
108
+ data("tone", "danger", fg("danger")),
109
+ ], mix), children: [_jsxs("span", { "data-slot": "sparkline-plot", dir: "ltr", mix: [
110
+ relative(),
111
+ block(),
112
+ grow(),
113
+ minIs(0),
114
+ bs("var(--ui-sparkline-block-size, 1.5rem)"),
115
+ parts?.plot,
116
+ ], children: [_jsxs("svg", { role: "img", "aria-describedby": description ? descriptionId : undefined, viewBox: `0 0 ${width} ${VIEWBOX_HEIGHT}`, preserveAspectRatio: "none", mix: [block(), is("full"), bs("full"), raw({ overflow: "visible" })], children: [_jsx("title", { children: label }), description ? _jsx("desc", { id: descriptionId, children: description }) : null, area
117
+ ? runs.map((run, index) => (_jsx("path", { "data-slot": "sparkline-area", d: areaPath(run, VIEWBOX_HEIGHT), mix: [
118
+ fill("currentColor"),
119
+ fillOpacity("var(--ui-sparkline-area-opacity, 0.16)"),
120
+ stroke("none"),
121
+ parts?.area,
122
+ ] }, `area-${index}`)))
123
+ : null, runs.map((run, index) => (_jsx("path", { "data-slot": "sparkline-line", d: runPath(run), mix: [
124
+ fill("none"),
125
+ stroke("currentColor"),
126
+ strokeWidth("var(--ui-sparkline-line-width, 1.5px)"),
127
+ strokeLinejoin("round"),
128
+ strokeLinecap("round"),
129
+ vectorEffect("non-scaling-stroke"),
130
+ parts?.line,
131
+ ] }, `line-${index}`)))] }), showDot && last ? (_jsx("span", { "aria-hidden": "true", "data-slot": "sparkline-dot", mix: [
132
+ absolute(),
133
+ is("var(--ui-sparkline-dot-size, 0.375rem)"),
134
+ bs("var(--ui-sparkline-dot-size, 0.375rem)"),
135
+ rounded("full"),
136
+ raw({
137
+ insetInlineStart: `${(last.x / width) * 100}%`,
138
+ insetBlockStart: `${last.y}%`,
139
+ backgroundColor: "currentColor",
140
+ }),
141
+ translateProperty("-50% -50%"),
142
+ parts?.dot,
143
+ ] })) : null] }), state ? (_jsx("span", { "data-slot": "sparkline-state", mix: [shrink(0), text("xs"), weight("medium"), nowrap(), parts?.state], children: state })) : null] }));
144
+ };
145
+ }