@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
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { visuallyHidden } from "@sdxc/u/a11y";
2
3
  import { bg, border, fg, outline } from "@sdxc/u/color";
3
4
  import { rounded } from "@sdxc/u/effects";
4
- import { mergeMix } from "@sdxc/u/general";
5
+ import { cursor, mergeMix } from "@sdxc/u/general";
5
6
  import { flex, flexCol, gap, items, justify } from "@sdxc/u/layout";
6
7
  import { minBs, pb, pi } from "@sdxc/u/size";
7
8
  import { when } from "@sdxc/u/state";
@@ -10,7 +11,8 @@ import { interactiveTransition } from "../styles/interactive-transition.js";
10
11
  import { warnIfNoAccessibleName } from "../utils/warn-if-no-accessible-name.js";
11
12
  /**
12
13
  * Renders a native `<input type="file">` wrapped in a `<label>` styled as a
13
- * dashed, centered drop surface; a paired drag-and-drop mixin toggles the
14
+ * dashed, centered drop surface, children stacked top to bottom; the input stays visually hidden
15
+ * and focusable, so the whole surface is the control; a paired drag-and-drop mixin toggles the
14
16
  * `data-drop-target` attribute this surface's styling reacts to.
15
17
  *
16
18
  * @param handle Runtime handle carrying the host `<label>`'s props.
@@ -45,10 +47,11 @@ export function DropZone(handle) {
45
47
  pi(6),
46
48
  pb(6),
47
49
  textAlign("center"),
50
+ cursor("pointer"),
48
51
  bg("neutral.tint"),
49
52
  fg("neutral"),
50
53
  when("&[data-drop-target]", [border("brand.ring"), bg("brand.tint")]),
51
54
  interactiveTransition(),
52
- ], mix), children: [children, _jsx("input", { type: "file", name: name, accept: accept, multiple: multiple, capture: capture, required: required, disabled: disabled, mix: parts?.input })] }));
55
+ ], mix), children: [children, _jsx("input", { type: "file", name: name, accept: accept, multiple: multiple, capture: capture, required: required, disabled: disabled, mix: mergeMix([visuallyHidden()], parts?.input) })] }));
53
56
  };
54
57
  }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The frame of a document editor: a sticky action bar (back, title, save status, Preview,
3
+ * the primary action), a main column held to a ~680px writing measure, and a properties
4
+ * sidebar that becomes a full-screen sheet behind a "Settings" button on a narrow screen.
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 EditorLayout}.
12
+ */
13
+ export declare namespace EditorLayout {
14
+ /** Every string the layout shows or announces. */
15
+ interface Labels {
16
+ /** The button that opens the sidebar on a narrow screen, such as "Settings". */
17
+ settings: string;
18
+ /** The sheet's close button, such as "Close settings". */
19
+ closeSettings: string;
20
+ /** The sidebar's landmark name and sheet heading, such as "Post settings". */
21
+ sidebar: string;
22
+ }
23
+ /** Props accepted by {@link EditorLayout}. */
24
+ interface Props extends Omit<TagProps<"div">, "title"> {
25
+ /** Where the back arrow leads, and its accessible name, such as "Posts". */
26
+ back?: {
27
+ href: string;
28
+ label: string;
29
+ };
30
+ /** The document's name in the bar, such as its title and type. */
31
+ title: RemixNode;
32
+ /** The persistence signal, usually a `SaveStatus`. */
33
+ status?: RemixNode;
34
+ /** A Preview link or button, before the primary action. */
35
+ preview?: RemixNode;
36
+ /** The publication action, such as a Publish button whose label carries its state. */
37
+ primary?: RemixNode;
38
+ /** The document's properties: status, slug, author, tags. */
39
+ sidebar?: RemixNode;
40
+ /**
41
+ * The `id` of the document's form, which ⌘S/Ctrl+S submits while focus is in it or in no
42
+ * other form, saving the way the form's own submit does.
43
+ */
44
+ form?: string;
45
+ labels: Labels;
46
+ }
47
+ }
48
+ /**
49
+ * Renders the bar, the writing column and the sidebar. The sidebar is one `popover`
50
+ * element: beside the column on a wide container and a full-screen sheet when narrow,
51
+ * so the sheet opens and closes with no script.
52
+ *
53
+ * @param handle Runtime handle carrying the layout's props.
54
+ * @returns The render function producing the layout's markup.
55
+ * @example
56
+ * <EditorLayout
57
+ * back={{ href: "/posts", label: "Posts" }}
58
+ * title="Designing a calmer editor"
59
+ * status={<SaveStatus id="post-status" labels={…} />}
60
+ * preview={<LinkButton href={previewUrl} variant="ghost" size="sm">Preview</LinkButton>}
61
+ * primary={<Button size="sm" disabled={!hasChanges}>Publish</Button>}
62
+ * sidebar={<PropertyList>…</PropertyList>}
63
+ * form="post-form"
64
+ * labels={{ settings: "Settings", closeSettings: "Close settings", sidebar: "Post settings" }}
65
+ * >
66
+ * <PostBody />
67
+ * </EditorLayout>
68
+ */
69
+ export declare function EditorLayout(handle: Handle<EditorLayout.Props>): () => import("remix/component").RemixElement;
@@ -0,0 +1,143 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { ArrowLeftIcon, SlidersHorizontalIcon, XIcon } from "@sdxc/icons";
3
+ import { bg, borderEdge, fg, outline } from "@sdxc/u/color";
4
+ import { rounded } from "@sdxc/u/effects";
5
+ import { mergeMix, raw } from "@sdxc/u/general";
6
+ import { container, hstack, inlineFlex, items, justify, shrink, vstack } from "@sdxc/u/layout";
7
+ import { bs, is, m, minIs, p } from "@sdxc/u/size";
8
+ import { hover, when } from "@sdxc/u/state";
9
+ import { text, truncate, weight } from "@sdxc/u/typography";
10
+ import { Button } from "../components/button.js";
11
+ import { SaveShortcut } from "./save-bar.js";
12
+ /** Container the layout measures, so the sheet follows the editor's own width. */
13
+ const LAYOUT_CONTAINER = "ui-editor-layout";
14
+ /** Width at which the sidebar sits beside the writing column. */
15
+ const WIDE = `@container ${LAYOUT_CONTAINER} (min-width: 56rem)`;
16
+ /** Width below which the sidebar is a sheet. */
17
+ const NARROW = `@container ${LAYOUT_CONTAINER} (max-width: 55.999rem)`;
18
+ /**
19
+ * Renders the bar, the writing column and the sidebar. The sidebar is one `popover`
20
+ * element: beside the column on a wide container and a full-screen sheet when narrow,
21
+ * so the sheet opens and closes with no script.
22
+ *
23
+ * @param handle Runtime handle carrying the layout's props.
24
+ * @returns The render function producing the layout's markup.
25
+ * @example
26
+ * <EditorLayout
27
+ * back={{ href: "/posts", label: "Posts" }}
28
+ * title="Designing a calmer editor"
29
+ * status={<SaveStatus id="post-status" labels={…} />}
30
+ * preview={<LinkButton href={previewUrl} variant="ghost" size="sm">Preview</LinkButton>}
31
+ * primary={<Button size="sm" disabled={!hasChanges}>Publish</Button>}
32
+ * sidebar={<PropertyList>…</PropertyList>}
33
+ * form="post-form"
34
+ * labels={{ settings: "Settings", closeSettings: "Close settings", sidebar: "Post settings" }}
35
+ * >
36
+ * <PostBody />
37
+ * </EditorLayout>
38
+ */
39
+ export function EditorLayout(handle) {
40
+ return () => {
41
+ let { back, title, status, preview, primary, sidebar, form, labels, children, mix, ...rest } = handle.props;
42
+ let sidebarId = `${handle.id}-sidebar`;
43
+ let sheetTitleId = `${handle.id}-sidebar-title`;
44
+ return (_jsxs("div", { ...rest, "data-slot": "editor-layout", mix: mergeMix([is("100%"), minIs(0), container(LAYOUT_CONTAINER)], mix), children: [_jsxs("header", { "data-slot": "editor-bar", mix: [
45
+ hstack({ gap: 2, align: "center" }),
46
+ raw({
47
+ position: "sticky",
48
+ insetBlockStart: "var(--ui-app-sticky-top, 0px)",
49
+ zIndex: 10,
50
+ flexWrap: "wrap",
51
+ minBlockSize: "var(--ui-app-header-height, 3.5rem)",
52
+ }),
53
+ p(2, 3),
54
+ bg(),
55
+ borderEdge("block-end", { color: "neutral", width: 1, style: "solid" }),
56
+ ], children: [back ? (_jsx("a", { href: back.href, "aria-label": back.label, title: back.label, "data-slot": "editor-back", mix: [
57
+ inlineFlex(),
58
+ items("center"),
59
+ justify("center"),
60
+ shrink(0),
61
+ is(8),
62
+ bs(8),
63
+ rounded("md"),
64
+ fg("neutral"),
65
+ hover([bg("neutral.bg-tint"), fg("neutral.emphasis")]),
66
+ when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
67
+ ], children: _jsx(ArrowLeftIcon, { size: 16, "aria-hidden": "true" }) })) : null, _jsx("h1", { "data-slot": "editor-title", mix: [
68
+ m(0),
69
+ minIs(0),
70
+ raw({ flex: "1 1 8rem" }),
71
+ truncate(),
72
+ text("sm"),
73
+ weight("medium"),
74
+ fg("neutral.emphasis"),
75
+ ], children: title }), _jsxs("div", { mix: [
76
+ hstack({ gap: 2, align: "center" }),
77
+ raw({ flexWrap: "wrap", marginInlineStart: "auto" }),
78
+ ], children: [status, sidebar ? (_jsxs(Button, { type: "button", popovertarget: sidebarId, popovertargetaction: "show", variant: "ghost", color: "neutral", size: "sm", "data-slot": "editor-settings-toggle", mix: [raw({ [WIDE]: { display: "none" } })], children: [_jsx(SlidersHorizontalIcon, { size: 16, "aria-hidden": "true" }), labels.settings] })) : null, preview, primary, form ? _jsx(SaveShortcut, { form: form }) : null] })] }), _jsxs("div", { mix: [
79
+ raw({
80
+ display: "grid",
81
+ gridTemplateColumns: "minmax(0, 1fr)",
82
+ [WIDE]: {
83
+ gridTemplateColumns: sidebar
84
+ ? "minmax(0, 1fr) var(--ui-editor-sidebar-width, 18rem)"
85
+ : "minmax(0, 1fr)",
86
+ },
87
+ }),
88
+ ], children: [_jsx("div", { "data-slot": "editor-main", mix: [minIs(0), p(6, 4)], children: _jsx("div", { mix: [
89
+ raw({
90
+ maxInlineSize: "var(--ui-editor-measure, 42.5rem)",
91
+ marginInline: "auto",
92
+ }),
93
+ ], children: children }) }), sidebar ? (_jsx("aside", { id: sidebarId, popover: "auto", "aria-labelledby": sheetTitleId, "data-slot": "editor-sidebar", mix: [
94
+ minIs(0),
95
+ bg(),
96
+ fg("neutral.emphasis"),
97
+ raw({
98
+ [NARROW]: {
99
+ inset: 0,
100
+ inlineSize: "100%",
101
+ blockSize: "100%",
102
+ maxInlineSize: "none",
103
+ maxBlockSize: "none",
104
+ margin: 0,
105
+ padding: 0,
106
+ border: 0,
107
+ overflowY: "auto",
108
+ overscrollBehavior: "contain",
109
+ },
110
+ [WIDE]: {
111
+ display: "block",
112
+ position: "static",
113
+ alignSelf: "stretch",
114
+ inset: "auto",
115
+ inlineSize: "auto",
116
+ blockSize: "auto",
117
+ maxBlockSize: "none",
118
+ overflow: "visible",
119
+ margin: 0,
120
+ padding: 0,
121
+ border: 0,
122
+ borderInlineStart: "1px solid var(--ui-neutral-border)",
123
+ color: "inherit",
124
+ background: "none",
125
+ },
126
+ }),
127
+ ], children: _jsxs("div", { "data-slot": "editor-sidebar-body", mix: [
128
+ raw({
129
+ [WIDE]: {
130
+ position: "sticky",
131
+ insetBlockStart: "calc(var(--ui-app-sticky-top, 0px) + var(--ui-app-header-height, 3.5rem))",
132
+ maxBlockSize: "calc(100dvh - var(--ui-app-sticky-top, 0px) - var(--ui-app-header-height, 3.5rem))",
133
+ overflowY: "auto",
134
+ },
135
+ }),
136
+ ], children: [_jsxs("div", { "data-slot": "editor-sidebar-header", mix: [
137
+ hstack({ gap: 2, align: "center", justify: "between" }),
138
+ p(2, 2, 2, 4),
139
+ borderEdge("block-end", { color: "neutral", width: 1, style: "solid" }),
140
+ raw({ [WIDE]: { display: "none" } }),
141
+ ], children: [_jsx("p", { id: sheetTitleId, mix: [m(0), text("sm"), weight("semibold")], children: labels.sidebar }), _jsx(Button, { type: "button", popovertarget: sidebarId, popovertargetaction: "hide", variant: "ghost", color: "neutral", size: "sm", "aria-label": labels.closeSettings, children: _jsx(XIcon, { size: 16, "aria-hidden": "true" }) })] }), _jsx("div", { mix: [vstack({ gap: 4, align: "stretch" }), p(4)], children: sidebar })] }) })) : null] })] }));
142
+ };
143
+ }
@@ -1,10 +1,8 @@
1
1
  /**
2
- * A placeholder for a product section that currently has nothing to show — a
3
- * dashed-bordered panel that composes an icon, a title, a description, and
4
- * an action into one empty-state layout. Landing claim cells belong on
5
- * {@link Feature} instead; {@link Empty} stays for in-app zero-data states.
6
- * The compound parts let a consumer include only the pieces a given empty
7
- * state needs.
2
+ * A placeholder for a product section that has nothing to show, typed by why:
3
+ * first run, no results, all cleared, no permission, or an error. The `kind`
4
+ * picks the icon, tone and frame; every word stays a prop, and a compact size
5
+ * fits inside a card or a table body.
8
6
  *
9
7
  * @author [Sergio Xalambrí](https://sergiodxa.com)
10
8
  * @copyright Sergio Xalambrí 2026
@@ -21,12 +19,29 @@ export declare namespace Empty {
21
19
  * root reads its own color from the inherited `currentcolor` this sets.
22
20
  */
23
21
  type Color = SemanticColor;
22
+ /**
23
+ * Why the section is empty: `first-run` (welcome, one create action), `no-results`
24
+ * (quote the query, offer Clear filters), `cleared` ("All caught up"), `permission`
25
+ * (name who grants access), `error` (Retry and the request id).
26
+ */
27
+ type Kind = "first-run" | "no-results" | "cleared" | "permission" | "error";
28
+ /** `"compact"` tightens the panel and drops its frame, so it sits flush inside a card or a table body. */
29
+ type Size = "default" | "compact";
24
30
  /**
25
31
  * Props accepted by {@link Empty}.
26
32
  */
27
33
  interface Props extends TagProps<"div"> {
28
- /** Semantic tone of the panel. Default: `"neutral"`. */
34
+ /** Semantic tone of the panel. Default: the kind's tone, else `"neutral"`. */
29
35
  color?: Color;
36
+ /** Why it is empty; draws that cause's icon, tone and frame. */
37
+ kind?: Kind;
38
+ /**
39
+ * Icon a `kind` draws in place of its default, or `null` for none. Leave
40
+ * it unset and pass {@link Empty.Icon} yourself when `kind` is unset.
41
+ */
42
+ icon?: RemixNode;
43
+ /** Default: `"default"`. */
44
+ size?: Size;
30
45
  /** The panel's compound parts: {@link Empty.Icon}, {@link Empty.Title}, {@link Empty.Description}, {@link Empty.Action}, or any other content. */
31
46
  children: RemixNode;
32
47
  }
@@ -60,26 +75,46 @@ export declare namespace Empty {
60
75
  /** Call-to-action content, typically a button or link. */
61
76
  children: RemixNode;
62
77
  }
78
+ /**
79
+ * Props accepted by {@link Empty.Query}.
80
+ */
81
+ interface QueryProps extends TagProps<"q"> {
82
+ /** The search text or filter the reader typed, verbatim. */
83
+ children: RemixNode;
84
+ }
85
+ /**
86
+ * Props accepted by {@link Empty.RequestId}.
87
+ */
88
+ interface RequestIdProps extends TagProps<"p"> {
89
+ /** Visible label before the id, such as "Request ID". */
90
+ label: string;
91
+ /** The id support needs to find the failed request. */
92
+ children: RemixNode;
93
+ }
63
94
  }
64
95
  /**
65
- * Renders the empty-state panel: a dashed-bordered column tinted to the
66
- * color role in {@link Empty.Props.color}. Its compound parts inherit that
67
- * color through `currentcolor`.
96
+ * Renders the empty-state panel, a column tinted to its color role. A `kind`
97
+ * leads with its own icon and frame: a dashed outline for a first run, no
98
+ * frame for no results or a cleared list, a solid one for permission or error.
68
99
  *
69
100
  * @param handle Runtime handle carrying the host `<div>`'s props.
70
101
  * @returns The render function producing the panel's markup.
71
102
  * @example
72
- * <Empty>
73
- * <Empty.Icon><InboxIcon /></Empty.Icon>
74
- * <Empty.Title>{t("inbox.empty.title")}</Empty.Title>
75
- * <Empty.Description>{t("inbox.empty.description")}</Empty.Description>
76
- * <Empty.Action>
77
- * <Button>{t("inbox.empty.action")}</Button>
78
- * </Empty.Action>
103
+ * <Empty kind="first-run">
104
+ * <Empty.Title>{t("monitors.empty.title")}</Empty.Title>
105
+ * <Empty.Description>{t("monitors.empty.description")}</Empty.Description>
106
+ * <Empty.Action><Button>{t("monitors.empty.create")}</Button></Empty.Action>
107
+ * </Empty>
108
+ * @example
109
+ * <Empty kind="no-results" size="compact">
110
+ * <Empty.Title>{t("search.none")}</Empty.Title>
111
+ * <Empty.Description>{t("search.noMatch")} <Empty.Query>{query}</Empty.Query></Empty.Description>
112
+ * <Empty.Action><Button href="?">{t("filters.clear")}</Button></Empty.Action>
79
113
  * </Empty>
80
114
  * @example
81
- * <Empty color="danger">
82
- * <Empty.Title>{t("errors.notFound.title")}</Empty.Title>
115
+ * <Empty kind="error">
116
+ * <Empty.Title>{t("errors.load")}</Empty.Title>
117
+ * <Empty.RequestId label={t("errors.requestId")}>{requestId}</Empty.RequestId>
83
118
  * </Empty>
84
119
  */
85
120
  export declare function Empty(handle: Handle<Empty.Props>): () => import("remix/component").RemixElement;
@@ -88,4 +123,6 @@ export declare namespace Empty {
88
123
  var Title: (handle: Handle<Empty.TitleProps>) => () => import("remix/component").RemixElement;
89
124
  var Description: (handle: Handle<Empty.DescriptionProps>) => () => import("remix/component").RemixElement;
90
125
  var Action: (handle: Handle<Empty.ActionProps>) => () => import("remix/component").RemixElement;
126
+ var Query: (handle: Handle<Empty.QueryProps>) => () => import("remix/component").RemixElement;
127
+ var RequestId: (handle: Handle<Empty.RequestIdProps>) => () => import("remix/component").RemixElement;
91
128
  }
package/dist/app/empty.js CHANGED
@@ -1,10 +1,12 @@
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 { CheckCheckIcon, CircleAlertIcon, InboxIcon, LockKeyholeIcon, SearchXIcon, } from "@sdxc/icons";
2
3
  import { bg, border, colorMix, fg } from "@sdxc/u/color";
3
4
  import { rounded } from "@sdxc/u/effects";
4
- import { mergeMix } from "@sdxc/u/general";
5
+ import { mergeMix, raw, userSelect } from "@sdxc/u/general";
5
6
  import { flex, flexCol, flexWrap, gap, items, justify } from "@sdxc/u/layout";
6
- import { bs, is, mbs, p } from "@sdxc/u/size";
7
- import { balance, fontSize, leading, pretty, textAlign, tracking, weight, } from "@sdxc/u/typography";
7
+ import { is, mbs, p } from "@sdxc/u/size";
8
+ import { when } from "@sdxc/u/state";
9
+ import { balance, font, fontSize, leading, overflowWrap, pretty, textAlign, tracking, weight, } from "@sdxc/u/typography";
8
10
  import { attrs } from "remix/component";
9
11
  import { resolveHeadingLevel, TAG_BY_LEVEL } from "../components/heading-scope.js";
10
12
  import { semanticColorPanel } from "../styles/semantic-color-panel.js";
@@ -15,30 +17,47 @@ import { DEFAULT_ICON_ARIA_HIDDEN } from "../utils/decorative-icon.js";
15
17
  */
16
18
  const DEFAULT_COLOR = "neutral";
17
19
  /**
18
- * Renders the empty-state panel: a dashed-bordered column tinted to the
19
- * color role in {@link Empty.Props.color}. Its compound parts inherit that
20
- * color through `currentcolor`.
20
+ * Tone each {@link Empty.Kind} takes unless `color` says otherwise: a cleared
21
+ * queue reads as done, an error as a failure, the rest stay quiet.
22
+ */
23
+ const COLOR_BY_KIND = {
24
+ "first-run": "neutral",
25
+ "no-results": "neutral",
26
+ cleared: "success",
27
+ permission: "neutral",
28
+ error: "danger",
29
+ };
30
+ /**
31
+ * Renders the empty-state panel, a column tinted to its color role. A `kind`
32
+ * leads with its own icon and frame: a dashed outline for a first run, no
33
+ * frame for no results or a cleared list, a solid one for permission or error.
21
34
  *
22
35
  * @param handle Runtime handle carrying the host `<div>`'s props.
23
36
  * @returns The render function producing the panel's markup.
24
37
  * @example
25
- * <Empty>
26
- * <Empty.Icon><InboxIcon /></Empty.Icon>
27
- * <Empty.Title>{t("inbox.empty.title")}</Empty.Title>
28
- * <Empty.Description>{t("inbox.empty.description")}</Empty.Description>
29
- * <Empty.Action>
30
- * <Button>{t("inbox.empty.action")}</Button>
31
- * </Empty.Action>
38
+ * <Empty kind="first-run">
39
+ * <Empty.Title>{t("monitors.empty.title")}</Empty.Title>
40
+ * <Empty.Description>{t("monitors.empty.description")}</Empty.Description>
41
+ * <Empty.Action><Button>{t("monitors.empty.create")}</Button></Empty.Action>
42
+ * </Empty>
43
+ * @example
44
+ * <Empty kind="no-results" size="compact">
45
+ * <Empty.Title>{t("search.none")}</Empty.Title>
46
+ * <Empty.Description>{t("search.noMatch")} <Empty.Query>{query}</Empty.Query></Empty.Description>
47
+ * <Empty.Action><Button href="?">{t("filters.clear")}</Button></Empty.Action>
32
48
  * </Empty>
33
49
  * @example
34
- * <Empty color="danger">
35
- * <Empty.Title>{t("errors.notFound.title")}</Empty.Title>
50
+ * <Empty kind="error">
51
+ * <Empty.Title>{t("errors.load")}</Empty.Title>
52
+ * <Empty.RequestId label={t("errors.requestId")}>{requestId}</Empty.RequestId>
36
53
  * </Empty>
37
54
  */
38
55
  export function Empty(handle) {
39
56
  return () => {
40
- let { color = DEFAULT_COLOR, children, mix, ...rest } = handle.props;
41
- return (_jsx("div", { ...rest, "data-color": color, "data-slot": "empty", mix: mergeMix([
57
+ let { color, kind, icon, size = "default", children, mix, ...rest } = handle.props;
58
+ let resolvedColor = color ?? (kind ? COLOR_BY_KIND[kind] : DEFAULT_COLOR);
59
+ let leading = kind && icon !== null ? (icon ?? _jsx(EmptyKindIcon, { kind: kind })) : null;
60
+ return (_jsxs("div", { ...rest, "data-color": resolvedColor, "data-kind": kind, "data-size": size, "data-slot": "empty", mix: mergeMix([
42
61
  semanticColorPanel(),
43
62
  flex(),
44
63
  flexCol(),
@@ -49,7 +68,45 @@ export function Empty(handle) {
49
68
  border({ width: "1px", style: "dashed" }),
50
69
  p(8),
51
70
  textAlign("center"),
52
- ], mix), children: children }));
71
+ when('&[data-kind="no-results"], &[data-kind="cleared"]', raw({ borderColor: "transparent", backgroundColor: "transparent" })),
72
+ when('&[data-kind="permission"], &[data-kind="error"]', raw({ borderStyle: "solid" })),
73
+ /**
74
+ * The card around a compact state is its frame, so the state draws none of its own:
75
+ * the icon carries the tone and the copy sits flush with the card's edges.
76
+ */
77
+ when('&[data-size="compact"]', [
78
+ p(4),
79
+ gap(2),
80
+ raw({
81
+ borderColor: "transparent",
82
+ backgroundColor: "transparent",
83
+ borderRadius: "0",
84
+ "--ui-empty-icon-size": "2rem",
85
+ "--ui-empty-title-size": "var(--ui-text-sm, 0.875rem)",
86
+ }),
87
+ ]),
88
+ ], mix), children: [leading ? _jsx(Empty.Icon, { children: leading }) : null, children] }));
89
+ };
90
+ }
91
+ /**
92
+ * Draws the icon that names an {@link Empty.Kind} at a glance, so the cause
93
+ * reads before the title does.
94
+ *
95
+ * @param handle Runtime handle carrying the kind.
96
+ * @returns The render function producing the icon.
97
+ */
98
+ function EmptyKindIcon(handle) {
99
+ return () => {
100
+ let { kind } = handle.props;
101
+ if (kind === "no-results")
102
+ return _jsx(SearchXIcon, { size: 20 });
103
+ if (kind === "cleared")
104
+ return _jsx(CheckCheckIcon, { size: 20 });
105
+ if (kind === "permission")
106
+ return _jsx(LockKeyholeIcon, { size: 20 });
107
+ if (kind === "error")
108
+ return _jsx(CircleAlertIcon, { size: 20 });
109
+ return _jsx(InboxIcon, { size: 20 });
53
110
  };
54
111
  }
55
112
  /**
@@ -66,8 +123,10 @@ Empty.Icon = function EmptyIcon(handle) {
66
123
  return (_jsx("div", { ...rest, "data-slot": "icon", mix: mergeMix([
67
124
  attrs({ "aria-hidden": DEFAULT_ICON_ARIA_HIDDEN }),
68
125
  flex(),
69
- bs("3rem"),
70
- is("3rem"),
126
+ raw({
127
+ blockSize: "var(--ui-empty-icon-size, 3rem)",
128
+ inlineSize: "var(--ui-empty-icon-size, 3rem)",
129
+ }),
71
130
  items("center"),
72
131
  justify("center"),
73
132
  rounded("full"),
@@ -91,7 +150,13 @@ Empty.Title = function EmptyTitle(handle) {
91
150
  let { children, mix, ...rest } = handle.props;
92
151
  let level = resolveHeadingLevel(handle);
93
152
  let Tag = TAG_BY_LEVEL[level];
94
- return (_jsx(Tag, { ...rest, "data-slot": "title", mix: mergeMix([weight("semibold"), tracking("tight"), fontSize("base"), leading("snug"), balance()], mix), children: children }));
153
+ return (_jsx(Tag, { ...rest, "data-slot": "title", mix: mergeMix([
154
+ weight("semibold"),
155
+ tracking("tight"),
156
+ raw({ fontSize: "var(--ui-empty-title-size, var(--ui-text-base, 1rem))" }),
157
+ leading("snug"),
158
+ balance(),
159
+ ], mix), children: children }));
95
160
  };
96
161
  };
97
162
  /**
@@ -139,3 +204,45 @@ Empty.Action = function EmptyAction(handle) {
139
204
  ], mix), children: children }));
140
205
  };
141
206
  };
207
+ /**
208
+ * Renders the reader's query inside a `no-results` description as a native
209
+ * `<q>`, so the browser adds the locale's own quotation marks around it and
210
+ * the reader sees exactly what to change.
211
+ *
212
+ * @param handle Runtime handle carrying the host `<q>`'s props.
213
+ * @returns The render function producing the quotation's markup.
214
+ * @example
215
+ * <Empty.Description>No monitors match <Empty.Query>{query}</Empty.Query>.</Empty.Description>
216
+ */
217
+ Empty.Query = function EmptyQuery(handle) {
218
+ return () => {
219
+ let { children, mix, ...rest } = handle.props;
220
+ return (_jsx("q", { ...rest, "data-slot": "query", mix: mergeMix([weight("medium"), fg("currentcolor"), overflowWrap("anywhere")], mix), children: children }));
221
+ };
222
+ };
223
+ /**
224
+ * Renders an `error` state's request id under a label, in monospace that
225
+ * selects whole on one click, so the reader can copy it into a support
226
+ * message without a script.
227
+ *
228
+ * @param handle Runtime handle carrying the host `<p>`'s props.
229
+ * @returns The render function producing the request id's markup.
230
+ * @example
231
+ * <Empty.RequestId label={t("errors.requestId")}>{requestId}</Empty.RequestId>
232
+ */
233
+ Empty.RequestId = function EmptyRequestId(handle) {
234
+ return () => {
235
+ let { label, children, mix, ...rest } = handle.props;
236
+ return (_jsxs("p", { ...rest, "data-slot": "request-id", mix: mergeMix([
237
+ fontSize("xs"),
238
+ fg(colorMix("oklab", { color: "currentcolor", weight: 70 }, "transparent")),
239
+ overflowWrap("anywhere"),
240
+ ], mix), children: [label, " ", _jsx("code", { mix: [
241
+ font("mono"),
242
+ userSelect("all"),
243
+ rounded("sm"),
244
+ raw({ paddingInline: "0.25rem" }),
245
+ bg(colorMix("oklab", { color: "currentcolor", weight: 10 }, "transparent")),
246
+ ], children: children })] }));
247
+ };
248
+ };