@sdxc/ui 2026.11.1 → 2026.11.3

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 (190) 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 +1 -1
  162. package/dist/docs/docs-nav-tools.js +2 -2
  163. package/dist/docs/docs-nav.d.ts +6 -2
  164. package/dist/docs/docs-nav.js +2 -2
  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 +2 -2
  168. package/dist/docs/mixins/docs-nav-tools.js +32 -5
  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/mixins/confirm-phrase.d.ts +19 -0
  175. package/dist/mixins/confirm-phrase.js +56 -0
  176. package/dist/mixins/index.d.ts +2 -0
  177. package/dist/mixins/index.js +2 -0
  178. package/dist/mixins/viewer-time.d.ts +20 -0
  179. package/dist/mixins/viewer-time.js +40 -0
  180. package/dist/styles/index.d.ts +1 -0
  181. package/dist/styles/index.js +1 -0
  182. package/dist/styles/segmented-control.d.ts +49 -0
  183. package/dist/styles/segmented-control.js +71 -0
  184. package/dist/test/table.d.ts +65 -0
  185. package/dist/test/table.js +108 -0
  186. package/dist/utils/index.d.ts +1 -0
  187. package/dist/utils/index.js +1 -0
  188. package/dist/utils/relative-time.d.ts +44 -0
  189. package/dist/utils/relative-time.js +69 -0
  190. package/package.json +6 -6
@@ -0,0 +1,249 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { ChevronLeftIcon } from "@sdxc/icons";
3
+ import { bg, fg, outline } from "@sdxc/u/color";
4
+ import { mergeMix, raw } from "@sdxc/u/general";
5
+ import { focusVisible, hover, when } from "@sdxc/u/state";
6
+ import { tabularNums, text, weight } from "@sdxc/u/typography";
7
+ import { Breadcrumbs } from "../components/breadcrumbs.js";
8
+ /** The container the header measures and, when sticky, the one whose stuck state it reads. */
9
+ const CONTAINER = "ui-page-header";
10
+ /** The header's width from which the breadcrumb shows; narrower, the parent link does. */
11
+ const WIDE = `@container ${CONTAINER} (min-width: 40rem)`;
12
+ /** Every header width under {@link WIDE}. */
13
+ const NARROW = `@container ${CONTAINER} (max-width: 39.9375rem)`;
14
+ /** The sticky header once it is held at the top while motion is welcome, which is when it compacts. */
15
+ const STUCK = `@container ${CONTAINER} scroll-state(stuck: top)`;
16
+ /** Whether the header sticks and compacts when `sticky` is omitted. */
17
+ const DEFAULT_STICKY = false;
18
+ /** Motion for the compacting rows; reduced motion keeps the header full size. */
19
+ const EASE = "200ms cubic-bezier(0.2, 0, 0, 1)";
20
+ /**
21
+ * Renders the header. From 40rem the actions end the title's row, the description under both;
22
+ * narrower, they sit beside the title when they fit and after the description otherwise. A
23
+ * sticky header spans the shell's gutter (`--ui-app-gutter`) so content never shows beside it.
24
+ *
25
+ * @param handle Runtime handle carrying the header's props.
26
+ * @returns The render function producing the header's markup.
27
+ * @example
28
+ * <PageHeader crumbsLabel="Breadcrumb" crumbs={[{ label: "Monitors", href: "/monitors" }, { label: "api.acme.dev" }]} title="api.acme.dev" status={<Badge color="success">Up</Badge>} actions={<Button variant="outline">Pause</Button>} primaryAction={<Button>Edit monitor</Button>} />
29
+ */
30
+ export function PageHeader(handle) {
31
+ return () => {
32
+ let { title, crumbs = [], crumbsLabel, parent, description, status, primaryAction, actions, overflow, tabs = [], tabsLabel, sticky = DEFAULT_STICKY, mix, ...rest } = handle.props;
33
+ let back = parent ?? parentOf(crumbs);
34
+ let hasActions = primaryAction !== undefined || actions !== undefined || overflow !== undefined;
35
+ return (_jsx("header", { ...rest, "data-slot": "page-header", "data-sticky": sticky ? "" : undefined, mix: mergeMix([
36
+ raw({
37
+ display: "block",
38
+ inlineSize: "100%",
39
+ minInlineSize: "0",
40
+ containerType: sticky ? "inline-size scroll-state" : "inline-size",
41
+ containerName: CONTAINER,
42
+ overflowWrap: "anywhere",
43
+ }),
44
+ sticky
45
+ ? [
46
+ raw({
47
+ position: "sticky",
48
+ insetBlockStart: "var(--ui-app-sticky-top, 0px)",
49
+ zIndex: "2",
50
+ marginInline: "calc(-1 * var(--ui-app-gutter, 0px))",
51
+ paddingInline: "var(--ui-app-gutter, 0px)",
52
+ }),
53
+ bg(),
54
+ ]
55
+ : [],
56
+ ], mix), children: _jsxs("div", { "data-slot": "page-header-body", mix: [
57
+ raw({
58
+ display: "flex",
59
+ flexDirection: "column",
60
+ gap: "0.5rem",
61
+ paddingBlock: "0 1rem",
62
+ borderBlockEnd: "1px solid transparent",
63
+ transition: `padding ${EASE}, border-color ${EASE}`,
64
+ }),
65
+ tabs.length > 0 ? raw({ paddingBlockEnd: "0" }) : [],
66
+ sticky
67
+ ? when("@media (prefers-reduced-motion: no-preference)", when(STUCK, tabs.length > 0
68
+ ? raw({ paddingBlockStart: "0.5rem" })
69
+ : raw({
70
+ paddingBlock: "0.5rem",
71
+ borderBlockEndColor: "var(--ui-neutral-border)",
72
+ })))
73
+ : [],
74
+ when("@media (prefers-reduced-motion: reduce)", raw({ transition: "none" })),
75
+ ], children: [crumbs.length > 0 || back ? (_jsxs(Fold, { sticky: sticky, children: [crumbs.length > 0 ? (_jsx("div", { "data-slot": "page-header-crumbs", mix: [
76
+ when(NARROW, raw({ display: "none" })),
77
+ when(WIDE, raw({ display: "block" })),
78
+ ], children: _jsx(Breadcrumbs, { "aria-label": crumbsLabel, children: _jsx(Breadcrumbs.List, { mix: [raw({ flexWrap: "wrap", rowGap: "0.25rem" })], children: crumbs.map((crumb, index) => {
79
+ let isCurrent = index === crumbs.length - 1;
80
+ return (_jsx(Breadcrumbs.Item, { children: _jsx(Breadcrumbs.Link, { href: isCurrent ? undefined : crumb.href, "aria-current": isCurrent ? "page" : undefined, children: crumb.label }) }, `${index}:${crumb.label}`));
81
+ }) }) }) })) : null, back ? (_jsxs("a", { href: back.href, "data-slot": "page-header-parent", mix: [
82
+ when(WIDE, raw({ display: "none" })),
83
+ when(NARROW, raw({
84
+ display: "inline-flex",
85
+ alignItems: "center",
86
+ gap: "0.25rem",
87
+ maxInlineSize: "100%",
88
+ textDecoration: "none",
89
+ borderRadius: "0.25rem",
90
+ })),
91
+ text("sm"),
92
+ fg("neutral.muted"),
93
+ hover(fg("neutral.emphasis")),
94
+ focusVisible(outline({ color: "brand.ring", offset: 2 })),
95
+ ], children: [_jsx(ChevronLeftIcon, { size: 16, "aria-hidden": "true" }), back.label] })) : null] })) : null, _jsxs("div", { "data-slot": "page-header-main", mix: [
96
+ when(NARROW, raw({
97
+ display: "flex",
98
+ flexWrap: "wrap",
99
+ alignItems: "flex-start",
100
+ columnGap: "1rem",
101
+ rowGap: "0.75rem",
102
+ })),
103
+ when(WIDE, raw({
104
+ display: "grid",
105
+ gridTemplateColumns: "minmax(0, 1fr) auto",
106
+ gridTemplateAreas: description
107
+ ? '"title actions" "description description"'
108
+ : '"title actions"',
109
+ alignItems: "center",
110
+ columnGap: "1rem",
111
+ rowGap: "0.5rem",
112
+ })),
113
+ ], children: [_jsxs("div", { "data-slot": "page-header-heading", mix: [
114
+ when(NARROW, raw({
115
+ display: "flex",
116
+ flexDirection: "column",
117
+ gap: "0.5rem",
118
+ flex: "1 1 16rem",
119
+ minInlineSize: "0",
120
+ })),
121
+ when(WIDE, raw({ display: "contents" })),
122
+ ], children: [_jsxs("div", { "data-slot": "page-header-title-row", mix: [
123
+ raw({
124
+ display: "flex",
125
+ flexWrap: "wrap",
126
+ alignItems: "center",
127
+ gap: "0.5rem",
128
+ gridArea: "title",
129
+ minInlineSize: "0",
130
+ }),
131
+ ], children: [_jsx("h1", { "data-slot": "page-header-title", mix: [
132
+ raw({
133
+ margin: "0",
134
+ minInlineSize: "0",
135
+ fontSize: "1.25rem",
136
+ lineHeight: "1.25",
137
+ letterSpacing: "-0.01em",
138
+ textWrap: "balance",
139
+ transition: `font-size ${EASE}`,
140
+ }),
141
+ weight("semibold"),
142
+ fg("neutral.emphasis"),
143
+ when(WIDE, raw({ fontSize: "1.5rem" })),
144
+ sticky
145
+ ? when("@media (prefers-reduced-motion: no-preference)", when(STUCK, raw({ fontSize: "1rem" })))
146
+ : [],
147
+ when("@media (prefers-reduced-motion: reduce)", raw({ transition: "none" })),
148
+ ], children: title }), status ? (_jsx("span", { "data-slot": "page-header-status", mix: [raw({ display: "inline-flex" })], children: status })) : null] }), description ? (_jsx(Fold, { sticky: sticky, mix: [raw({ gridArea: "description", minInlineSize: "0" })], children: _jsx("p", { "data-slot": "page-header-description", mix: [
149
+ raw({ margin: "0", maxInlineSize: "75ch" }),
150
+ text("sm"),
151
+ fg("neutral.muted"),
152
+ ], children: description }) })) : null] }), hasActions ? (_jsxs("div", { "data-slot": "page-header-actions", mix: [
153
+ raw({
154
+ display: "flex",
155
+ flexWrap: "wrap",
156
+ alignItems: "center",
157
+ justifyContent: "flex-end",
158
+ gap: "0.5rem",
159
+ gridArea: "actions",
160
+ marginInlineStart: "auto",
161
+ maxInlineSize: "100%",
162
+ }),
163
+ ], children: [actions ? (_jsx("span", { "data-slot": "page-header-secondary", mix: [raw({ display: "contents" })], children: actions })) : null, primaryAction ? (_jsx("span", { "data-slot": "page-header-primary", mix: [raw({ display: "contents" })], children: primaryAction })) : null, overflow ? (_jsx("span", { "data-slot": "page-header-overflow", mix: [raw({ display: "contents" })], children: overflow })) : null] })) : null] }), tabs.length > 0 ? (_jsx("nav", { "aria-label": tabsLabel, "data-slot": "page-header-tabs", mix: [
164
+ raw({
165
+ marginBlockStart: "0.25rem",
166
+ overflowX: "auto",
167
+ scrollbarWidth: "none",
168
+ boxShadow: "inset 0 -1px 0 var(--ui-neutral-border)",
169
+ }),
170
+ ], children: _jsx("ul", { mix: [
171
+ raw({
172
+ display: "flex",
173
+ gap: "1rem",
174
+ margin: "0",
175
+ padding: "0",
176
+ listStyle: "none",
177
+ inlineSize: "max-content",
178
+ }),
179
+ ], children: tabs.map((tab) => (_jsx("li", { children: _jsxs("a", { href: tab.href, "aria-current": tab.current ? "page" : undefined, mix: [
180
+ raw({
181
+ position: "relative",
182
+ display: "inline-flex",
183
+ alignItems: "center",
184
+ gap: "0.375rem",
185
+ blockSize: "2.5rem",
186
+ whiteSpace: "nowrap",
187
+ textDecoration: "none",
188
+ }),
189
+ text("sm"),
190
+ fg("neutral.muted"),
191
+ hover(fg("neutral.emphasis")),
192
+ focusVisible(outline({ color: "brand.ring", offset: -2 })),
193
+ when('&[aria-current="page"]', [fg("neutral.emphasis"), weight("medium")]),
194
+ when('&[aria-current="page"]::after', raw({
195
+ content: '""',
196
+ position: "absolute",
197
+ insetInline: "0",
198
+ insetBlockEnd: "0",
199
+ blockSize: "2px",
200
+ borderRadius: "2px",
201
+ backgroundColor: "var(--ui-brand-bg-solid)",
202
+ })),
203
+ ], children: [tab.label, tab.count !== undefined ? (_jsx("span", { "data-slot": "page-header-tab-count", mix: [
204
+ raw({
205
+ minInlineSize: "1.25rem",
206
+ paddingInline: "0.375rem",
207
+ borderRadius: "999px",
208
+ fontSize: "0.75rem",
209
+ lineHeight: "1.25rem",
210
+ textAlign: "center",
211
+ boxSizing: "border-box",
212
+ }),
213
+ tabularNums(),
214
+ weight("medium"),
215
+ bg("neutral.bg-tint-hover"),
216
+ fg("neutral.emphasis"),
217
+ ], children: tab.count })) : null] }) }, tab.href))) }) })) : null] }) }));
218
+ };
219
+ }
220
+ /**
221
+ * A row the sticky header folds away once stuck, by collapsing a one-row grid to zero height,
222
+ * which animates without measuring the row. A static header draws the row as is.
223
+ */
224
+ function Fold(handle) {
225
+ return () => {
226
+ let { sticky, mix, children } = handle.props;
227
+ if (!sticky) {
228
+ return (_jsx("div", { "data-slot": "page-header-fold", mix: mix, children: children }));
229
+ }
230
+ return (_jsx("div", { "data-slot": "page-header-fold", mix: mergeMix([
231
+ raw({
232
+ display: "grid",
233
+ gridTemplateRows: "1fr",
234
+ transition: `grid-template-rows ${EASE}, opacity ${EASE}`,
235
+ }),
236
+ when("@media (prefers-reduced-motion: no-preference)", when(STUCK, raw({ gridTemplateRows: "0fr", opacity: "0", visibility: "hidden" }))),
237
+ when("@media (prefers-reduced-motion: reduce)", raw({ transition: "none" })),
238
+ ], mix), children: _jsx("div", { mix: [raw({ minBlockSize: "0", overflow: "clip", overflowClipMargin: "4px" })], children: children }) }));
239
+ };
240
+ }
241
+ /** The last crumb before this screen that links somewhere, which is where "back" goes. */
242
+ function parentOf(crumbs) {
243
+ for (let index = crumbs.length - 2; index >= 0; index--) {
244
+ let crumb = crumbs[index];
245
+ if (crumb?.href)
246
+ return { href: crumb.href, label: crumb.label };
247
+ }
248
+ return undefined;
249
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The time range for a dashboard, kept in the URL: preset ranges as a segmented control of
3
+ * GET-form buttons with letter-key hints, a Custom entry that opens a date range in a
4
+ * popover, and a native select in its place when the container is narrow.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { Handle, Props as TagProps } from "remix/component";
10
+ /** Value the custom range submits under `name`, beside its start and end dates. */
11
+ export declare const RANGE_PICKER_CUSTOM_VALUE = "custom";
12
+ /** Attribute naming the letter key that picks a preset, read by `rangePickerKeys()`. */
13
+ export declare const RANGE_PICKER_KEY_ATTRIBUTE = "data-range-key";
14
+ /** Attribute `rangePickerKeys()` sets on the picker once it submits the select on change. */
15
+ export declare const RANGE_PICKER_ENHANCED_ATTRIBUTE = "data-range-picker-enhanced";
16
+ /**
17
+ * Prop types for {@link RangePicker}.
18
+ */
19
+ export declare namespace RangePicker {
20
+ /** One preset range. */
21
+ interface Preset {
22
+ /** What the picker submits under `name` ("7d"). */
23
+ value: string;
24
+ /** The segment's short text ("7d"). */
25
+ label: string;
26
+ /** The full name, for the select option and the segment's accessible name ("Last 7 days"). */
27
+ description?: string;
28
+ /** A single letter that picks the preset once `rangePickerKeys()` is attached ("w"). */
29
+ key?: string;
30
+ }
31
+ /** The custom range's fields; the picker renders a Custom entry only when this is set. */
32
+ interface Custom {
33
+ /** Query parameter of the range's first day. */
34
+ startName: string;
35
+ /** Query parameter of the range's last day. */
36
+ endName: string;
37
+ /** First day of the range in effect, `YYYY-MM-DD`. */
38
+ start?: string;
39
+ /** Last day of the range in effect, `YYYY-MM-DD`. */
40
+ end?: string;
41
+ /** Earliest selectable day, `YYYY-MM-DD`. */
42
+ min?: string;
43
+ /** Latest selectable day, `YYYY-MM-DD`. */
44
+ max?: string;
45
+ /** Letter that opens the custom range once `rangePickerKeys()` is attached. */
46
+ key?: string;
47
+ }
48
+ /** Every string the picker shows or announces. */
49
+ interface Labels {
50
+ /** Accessible name of the preset group and the select ("Time range"). */
51
+ group: string;
52
+ /** Submits the select without script and the custom range ("Apply"). */
53
+ apply: string;
54
+ /** The Custom entry's text; required with `custom`. */
55
+ custom?: string;
56
+ /** The custom range's first-day field ("From"). */
57
+ start?: string;
58
+ /** The custom range's last-day field ("To"). */
59
+ end?: string;
60
+ }
61
+ /** Props accepted by {@link RangePicker}. */
62
+ interface Props extends Omit<TagProps<"div">, "children"> {
63
+ presets: readonly Preset[];
64
+ /** The range in effect: a preset's `value`, or {@link RANGE_PICKER_CUSTOM_VALUE}. */
65
+ value?: string;
66
+ /** @default {@link DEFAULT_NAME} */
67
+ name?: string;
68
+ /** Where the forms submit; the current URL when omitted. */
69
+ action?: string;
70
+ /** Other query parameters to keep, submitted as hidden fields (filters, the open tab). */
71
+ params?: Readonly<Record<string, string>>;
72
+ custom?: Custom;
73
+ labels: Labels;
74
+ /**
75
+ * Shows each preset's key as a hint inside its segment.
76
+ *
77
+ * @default true
78
+ */
79
+ keyHints?: boolean;
80
+ }
81
+ }
82
+ /**
83
+ * Renders the picker. Each preset is a submit button of a GET form, pressed when it is the
84
+ * range in effect; under a 24rem container the segments give way to a select with an Apply
85
+ * button. Attach `rangePickerKeys()` for letter keys and to submit the select on change.
86
+ *
87
+ * @param handle Runtime handle carrying the picker's props.
88
+ * @returns The render function producing the picker's markup.
89
+ * @example
90
+ * <RangePicker
91
+ * value={range}
92
+ * params={{ monitor: monitorId }}
93
+ * presets={[
94
+ * { value: "24h", label: "24h", description: t("range.day"), key: "d" },
95
+ * { value: "7d", label: "7d", description: t("range.week"), key: "w" },
96
+ * ]}
97
+ * custom={{ startName: "from", endName: "to", start: from, end: to, key: "c" }}
98
+ * labels={{ group: t("range.label"), apply: t("range.apply"), custom: t("range.custom"), start: t("range.from"), end: t("range.to") }}
99
+ * mix={rangePickerKeys()}
100
+ * />
101
+ */
102
+ export declare function RangePicker(handle: Handle<RangePicker.Props>): () => import("remix/component").RemixElement;
@@ -0,0 +1,118 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { CalendarIcon } from "@sdxc/icons";
3
+ import { bg, border } from "@sdxc/u/color";
4
+ import { opacity, rounded } from "@sdxc/u/effects";
5
+ import { cursor, mergeMix, raw } from "@sdxc/u/general";
6
+ import { container, hstack, inlineFlex, items, vstack } from "@sdxc/u/layout";
7
+ import { bs, is, maxIs, minIs, mis, p, pi } from "@sdxc/u/size";
8
+ import { focusVisible } from "@sdxc/u/state";
9
+ import { nowrap, tabularNums, text } from "@sdxc/u/typography";
10
+ import { Button } from "../components/button.js";
11
+ import { DateRangePicker } from "../components/date-range-picker.js";
12
+ import { Keyboard } from "../components/keyboard.js";
13
+ import { Popover } from "../components/popover.js";
14
+ import { segmentedItem, segmentedTrack } from "../styles/segmented-control.js";
15
+ /** Container the picker measures; below {@link WIDE_WIDTH} of its own width it becomes a select. */
16
+ const PICKER_CONTAINER = "ui-range-picker";
17
+ /** The picker's width in a row with room to spare, and the narrowest that still shows segments. */
18
+ const WIDE_WIDTH = "24rem";
19
+ /** Query parameter the picker writes when `name` is omitted. */
20
+ const DEFAULT_NAME = "range";
21
+ /** Value the custom range submits under `name`, beside its start and end dates. */
22
+ export const RANGE_PICKER_CUSTOM_VALUE = "custom";
23
+ /** Attribute naming the letter key that picks a preset, read by `rangePickerKeys()`. */
24
+ export const RANGE_PICKER_KEY_ATTRIBUTE = "data-range-key";
25
+ /** Attribute `rangePickerKeys()` sets on the picker once it submits the select on change. */
26
+ export const RANGE_PICKER_ENHANCED_ATTRIBUTE = "data-range-picker-enhanced";
27
+ /** The query parameters every form of the picker carries through, so a range change keeps the rest. */
28
+ function HiddenParams(handle) {
29
+ return () => Object.entries(handle.props.params ?? {}).map(([key, value]) => (_jsx("input", { type: "hidden", name: key, value: value }, key)));
30
+ }
31
+ /**
32
+ * Renders the picker. Each preset is a submit button of a GET form, pressed when it is the
33
+ * range in effect; under a 24rem container the segments give way to a select with an Apply
34
+ * button. Attach `rangePickerKeys()` for letter keys and to submit the select on change.
35
+ *
36
+ * @param handle Runtime handle carrying the picker's props.
37
+ * @returns The render function producing the picker's markup.
38
+ * @example
39
+ * <RangePicker
40
+ * value={range}
41
+ * params={{ monitor: monitorId }}
42
+ * presets={[
43
+ * { value: "24h", label: "24h", description: t("range.day"), key: "d" },
44
+ * { value: "7d", label: "7d", description: t("range.week"), key: "w" },
45
+ * ]}
46
+ * custom={{ startName: "from", endName: "to", start: from, end: to, key: "c" }}
47
+ * labels={{ group: t("range.label"), apply: t("range.apply"), custom: t("range.custom"), start: t("range.from"), end: t("range.to") }}
48
+ * mix={rangePickerKeys()}
49
+ * />
50
+ */
51
+ export function RangePicker(handle) {
52
+ return () => {
53
+ let { presets, value, name, action, params, custom, labels, keyHints, mix, ...rest } = handle.props;
54
+ let resolvedName = name ?? DEFAULT_NAME;
55
+ let popoverId = `${rest.id ?? handle.id}-custom`;
56
+ let isCustom = value === RANGE_PICKER_CUSTOM_VALUE;
57
+ let showKeys = keyHints ?? true;
58
+ let segment = [
59
+ inlineFlex(),
60
+ items("center"),
61
+ bs("100%"),
62
+ pi(2.5),
63
+ text("sm"),
64
+ nowrap(),
65
+ tabularNums(),
66
+ cursor("default"),
67
+ raw({ gap: "0.375rem" }),
68
+ segmentedItem(),
69
+ ];
70
+ return (_jsxs("div", { "data-slot": "range-picker", ...rest, mix: mergeMix([
71
+ /**
72
+ * As a size container the picker has no content width of its own, so it
73
+ * claims the wide layout's breakpoint as its intrinsic width: an auto-width
74
+ * flex item gets room for the segments and shrinks into the select.
75
+ */
76
+ raw({
77
+ display: "flex",
78
+ justifyContent: "flex-end",
79
+ flex: "0 1 auto",
80
+ containIntrinsicInlineSize: WIDE_WIDTH,
81
+ }),
82
+ maxIs("100%"),
83
+ minIs(0),
84
+ container(PICKER_CONTAINER),
85
+ ], mix), children: [_jsxs("form", { method: "get", action: action, "data-slot": "range-picker-segments", mix: [
86
+ /**
87
+ * Both displays live in one rule, so the wide layout always wins at its width
88
+ * whatever order the stylesheet layers land in.
89
+ */
90
+ raw({
91
+ display: "none",
92
+ [`@container ${PICKER_CONTAINER} (min-width: ${WIDE_WIDTH})`]: { display: "flex" },
93
+ }),
94
+ ], children: [_jsx(HiddenParams, { params: params }), _jsxs("div", { role: "group", "aria-label": labels.group, mix: [segmentedTrack(), bs("2rem")], children: [presets.map((preset) => (_jsxs("button", { type: "submit", name: resolvedName, value: preset.value, "aria-label": preset.description, "aria-pressed": preset.value === value ? "true" : "false", "aria-keyshortcuts": preset.key?.toUpperCase(), "data-range-key": preset.key?.toLowerCase(), mix: segment, children: [preset.label, showKeys && preset.key ? (_jsx(Keyboard, { "aria-hidden": "true", mix: [mis(0), bs("1.125rem"), minIs("1.125rem"), opacity(80)], children: preset.key.toUpperCase() })) : null] }, preset.value))), custom ? (_jsxs("button", { type: "button", commandfor: popoverId, command: "toggle-popover", "aria-pressed": isCustom ? "true" : "false", "aria-keyshortcuts": custom.key?.toUpperCase(), "data-range-key": custom.key?.toLowerCase(), mix: segment, children: [_jsx(CalendarIcon, { size: 14, "aria-hidden": "true" }), labels.custom, showKeys && custom.key ? (_jsx(Keyboard, { "aria-hidden": "true", mix: [mis(0), bs("1.125rem"), minIs("1.125rem"), opacity(80)], children: custom.key.toUpperCase() })) : null] })) : null] })] }), _jsxs("form", { method: "get", action: action, "data-slot": "range-picker-select", mix: [
95
+ hstack({ gap: 2, align: "center" }),
96
+ is("full"),
97
+ minIs(0),
98
+ raw({
99
+ [`@container ${PICKER_CONTAINER} (min-width: ${WIDE_WIDTH})`]: { display: "none" },
100
+ }),
101
+ ], children: [_jsx(HiddenParams, { params: params }), _jsxs("select", { name: resolvedName, "aria-label": labels.group, mix: [
102
+ raw({ flex: "1 1 auto" }),
103
+ minIs(0),
104
+ bs("2rem"),
105
+ pi(2),
106
+ rounded("md"),
107
+ bg(),
108
+ border({ color: "neutral", width: 1, style: "solid" }),
109
+ text("sm"),
110
+ focusVisible(raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "1px" })),
111
+ ], children: [presets.map((preset) => (_jsx("option", { value: preset.value, selected: preset.value === value, "data-range-key": preset.key?.toLowerCase(), children: preset.description ?? preset.label }, preset.value))), isCustom && labels.custom ? (_jsx("option", { value: RANGE_PICKER_CUSTOM_VALUE, selected: true, children: labels.custom })) : null] }), _jsx("span", { "data-slot": "range-picker-apply", mix: [
112
+ raw({
113
+ display: "contents",
114
+ [`:where([${RANGE_PICKER_ENHANCED_ATTRIBUTE}]) &`]: { display: "none" },
115
+ }),
116
+ ], children: _jsx(Button, { type: "submit", size: "sm", variant: "outline", color: "neutral", children: labels.apply }) }), custom ? (_jsx(Button, { type: "button", size: "sm", variant: "outline", color: "neutral", commandfor: popoverId, command: "toggle-popover", "aria-label": labels.custom, "data-range-key": custom.key?.toLowerCase(), children: _jsx(CalendarIcon, { size: 14, "aria-hidden": "true" }) })) : null] }), custom ? (_jsx(Popover, { id: popoverId, placement: "bottom-end", children: _jsxs("form", { method: "get", action: action, mix: [vstack({ gap: 3, align: "stretch" }), p(3)], children: [_jsx(HiddenParams, { params: params }), _jsx("input", { type: "hidden", name: resolvedName, value: RANGE_PICKER_CUSTOM_VALUE }), _jsx(DateRangePicker, { startLabel: labels.start, endLabel: labels.end, startName: custom.startName, endName: custom.endName, startDefaultValue: custom.start, endDefaultValue: custom.end, min: custom.min, max: custom.max, required: true }), _jsx(Button, { type: "submit", size: "sm", mix: [raw({ alignSelf: "flex-end" })], children: labels.apply })] }) })) : null] }));
117
+ };
118
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Client island: the sticky "Unsaved changes · Discard · Save" bar a long form shows once
3
+ * it differs from how it loaded. Discard resets the form, ⌘S or Ctrl+S submits it, and
4
+ * leaving the page asks first while changes are unsaved.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { EntryComponent } from "remix/component";
10
+ /**
11
+ * Props {@link SaveBar} serializes into the page for hydration, which is why they are a
12
+ * `type`: `SerializableProps` rejects an interface.
13
+ */
14
+ export type SaveBarProps = {
15
+ /** The `id` of the form the bar watches; omit when the bar sits inside that form. */
16
+ form?: string;
17
+ labels: {
18
+ /** The bar's message, such as "Unsaved changes". */
19
+ message: string;
20
+ discard: string;
21
+ save: string;
22
+ /** The save shortcut as the platform writes it, such as "⌘S", shown on the Save button. */
23
+ shortcut?: string;
24
+ };
25
+ };
26
+ /**
27
+ * Renders the bar, hidden until the watched form changes. Place it as the form's last
28
+ * child so it sticks to the bottom of the viewport while the form scrolls; the form keeps
29
+ * its own Save, which is what a browser without script uses.
30
+ *
31
+ * @example
32
+ * <form method="post" id="monitor-form">
33
+ * …fields…
34
+ * <SaveBar labels={{ message: "Unsaved changes", discard: "Discard", save: "Save", shortcut: "⌘S" }} />
35
+ * </form>
36
+ */
37
+ export declare const SaveBar: EntryComponent<SaveBarProps>;
38
+ /**
39
+ * Props {@link SaveShortcut} serializes into the page for hydration, which is why they are a
40
+ * `type`: `SerializableProps` rejects an interface.
41
+ */
42
+ export type SaveShortcutProps = {
43
+ /** The `id` of the form ⌘S submits; omit when the island sits inside that form. */
44
+ form?: string;
45
+ };
46
+ /**
47
+ * Client island binding ⌘S/Ctrl+S to a form's primary save: the form holding focus submits, or
48
+ * the only bound form when focus is in none, and a `SaveBar` on the same form steps aside so
49
+ * one keystroke submits once. An explicit `SettingsSection` and `EditorLayout` render it.
50
+ *
51
+ * @example
52
+ * <form method="post"><Input name="name" /><Button type="submit">Save</Button><SaveShortcut /></form>
53
+ */
54
+ export declare const SaveShortcut: EntryComponent<SaveShortcutProps>;
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { bg, border, fg } from "@sdxc/u/color";
3
+ import { opacity, rounded, shadow, transition } from "@sdxc/u/effects";
4
+ import { raw } from "@sdxc/u/general";
5
+ import { hidden, hstack, sticky } from "@sdxc/u/layout";
6
+ import { motionSafe, startingStyle } from "@sdxc/u/responsive";
7
+ import { minIs, p } from "@sdxc/u/size";
8
+ import { when } from "@sdxc/u/state";
9
+ import { translateProperty } from "@sdxc/u/transform";
10
+ import { text, weight } from "@sdxc/u/typography";
11
+ import { clientEntry } from "remix/component";
12
+ import { Button } from "../components/button.js";
13
+ import { Keyboard } from "../components/keyboard.js";
14
+ import { saveBarSync } from "./mixins/save-bar-sync.js";
15
+ import { saveShortcut } from "./mixins/save-shortcut.js";
16
+ /**
17
+ * Renders the bar, hidden until the watched form changes. Place it as the form's last
18
+ * child so it sticks to the bottom of the viewport while the form scrolls; the form keeps
19
+ * its own Save, which is what a browser without script uses.
20
+ *
21
+ * @example
22
+ * <form method="post" id="monitor-form">
23
+ * …fields…
24
+ * <SaveBar labels={{ message: "Unsaved changes", discard: "Discard", save: "Save", shortcut: "⌘S" }} />
25
+ * </form>
26
+ */
27
+ export const SaveBar = clientEntry("@sdxc/ui/app/save-bar#SaveBar", function SaveBar(handle) {
28
+ return () => {
29
+ let { form, labels } = handle.props;
30
+ return (_jsxs("div", { "data-slot": "save-bar", hidden: true, mix: [
31
+ saveBarSync({ form, message: labels.message }),
32
+ sticky(),
33
+ hstack({ gap: 3, align: "center" }),
34
+ raw({ insetBlockEnd: "1rem", flexWrap: "wrap", zIndex: 10 }),
35
+ p(2, 2, 2, 4),
36
+ rounded("lg"),
37
+ border({ color: "neutral", width: 1 }),
38
+ bg(),
39
+ shadow("lg"),
40
+ text("sm"),
41
+ when("&[hidden]", hidden()),
42
+ motionSafe([
43
+ transition("opacity, translate"),
44
+ startingStyle([opacity(0), translateProperty("0 0.5rem")]),
45
+ ]),
46
+ ], children: [_jsx("p", { role: "status", mix: [
47
+ raw({ margin: 0, flex: "1 1 auto" }),
48
+ minIs(0),
49
+ weight("medium"),
50
+ fg("neutral.emphasis"),
51
+ ] }), _jsx(Button, { type: "reset", form: form, variant: "ghost", color: "neutral", size: "sm", children: labels.discard }), _jsxs(Button, { type: "submit", form: form, size: "sm", children: [labels.save, labels.shortcut ? _jsx(Keyboard, { children: labels.shortcut }) : null] })] }));
52
+ };
53
+ });
54
+ /**
55
+ * Client island binding ⌘S/Ctrl+S to a form's primary save: the form holding focus submits, or
56
+ * the only bound form when focus is in none, and a `SaveBar` on the same form steps aside so
57
+ * one keystroke submits once. An explicit `SettingsSection` and `EditorLayout` render it.
58
+ *
59
+ * @example
60
+ * <form method="post"><Input name="name" /><Button type="submit">Save</Button><SaveShortcut /></form>
61
+ */
62
+ export const SaveShortcut = clientEntry("@sdxc/ui/app/save-bar#SaveShortcut", function SaveShortcut(handle) {
63
+ return () => (_jsx("span", { hidden: true, "data-slot": "save-shortcut", mix: [saveShortcut({ form: handle.props.form })] }));
64
+ });
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Client island: the quiet persistence signal an editor shows beside its publish button.
3
+ * "Saving…" holds at least a second, "Saved" shows for three, then the text decays to
4
+ * "Edited 2m ago" and later to a timestamp; a failure says so and offers Retry.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { EntryComponent } from "remix/component";
10
+ import type { SaveStatusSync } from "./mixins/save-status-sync.js";
11
+ /**
12
+ * Props {@link SaveStatus} serializes into the page for hydration, which is why they are a
13
+ * `type`: `SerializableProps` rejects an interface.
14
+ */
15
+ export type SaveStatusProps = {
16
+ /** The element's `id`, which `setSaveStatus` targets. */
17
+ id: string;
18
+ /** The state the server rendered, such as `"saved"` after a save redirected back. */
19
+ state?: SaveStatusSync.State;
20
+ /** When the content was last edited, as an ISO string; feeds "Edited 2m ago". */
21
+ editedAt?: string;
22
+ /** The id of the form Retry submits; without one Retry only dispatches `ui:save-status-retry`. */
23
+ form?: string;
24
+ /** Locale for the relative and absolute edit times; defaults to the runtime's. */
25
+ locale?: string;
26
+ labels: {
27
+ saving: string;
28
+ saved: string;
29
+ failed: string;
30
+ retry: string;
31
+ /** The edit time line, with `{time}` where the time goes: "Edited {time}". */
32
+ edited: string;
33
+ };
34
+ /** @default 1000 */
35
+ holdMs?: number;
36
+ /** @default 3000 */
37
+ savedMs?: number;
38
+ /** @default 86400000 */
39
+ decayMs?: number;
40
+ };
41
+ /**
42
+ * Renders the status. Saving, Saved and Failed are announced through a polite live
43
+ * region; the ticking edit time sits outside it, so a screen reader hears each outcome
44
+ * once. Pair it with a publish button whose label carries publication's own state.
45
+ *
46
+ * @example
47
+ * <SaveStatus id="post-status" editedAt={post.updatedAt} form="post-form"
48
+ * labels={{ saving: "Saving…", saved: "Saved", failed: "Failed", retry: "Retry", edited: "Edited {time}" }} />
49
+ */
50
+ export declare const SaveStatus: EntryComponent<SaveStatusProps>;