@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.
- package/README.md +1 -1
- package/dist/app/app-shell-toggle.d.ts +31 -0
- package/dist/app/app-shell-toggle.js +43 -0
- package/dist/app/app-shell.d.ts +131 -0
- package/dist/app/app-shell.js +542 -0
- package/dist/app/auto-refresh.d.ts +104 -0
- package/dist/app/auto-refresh.js +126 -0
- package/dist/app/behaviors/refresh-schedule.d.ts +53 -0
- package/dist/app/behaviors/refresh-schedule.js +95 -0
- package/dist/app/behaviors/shortcuts.d.ts +175 -0
- package/dist/app/behaviors/shortcuts.js +401 -0
- package/dist/app/behaviors/toaster.d.ts +31 -2
- package/dist/app/behaviors/toaster.js +62 -5
- package/dist/app/chart.d.ts +62 -8
- package/dist/app/chart.js +207 -9
- package/dist/app/command-palette.d.ts +132 -0
- package/dist/app/command-palette.js +181 -0
- package/dist/app/danger-zone.d.ts +66 -0
- package/dist/app/danger-zone.js +66 -0
- package/dist/app/detail-sheet.d.ts +119 -0
- package/dist/app/detail-sheet.js +173 -0
- package/dist/app/drop-zone.d.ts +2 -1
- package/dist/app/drop-zone.js +6 -3
- package/dist/app/editor-layout.d.ts +69 -0
- package/dist/app/editor-layout.js +143 -0
- package/dist/app/empty.d.ts +56 -19
- package/dist/app/empty.js +129 -22
- package/dist/app/filter-bar.d.ts +169 -0
- package/dist/app/filter-bar.js +346 -0
- package/dist/app/index.d.ts +51 -0
- package/dist/app/index.js +51 -0
- package/dist/app/keyboard-help.d.ts +66 -0
- package/dist/app/keyboard-help.js +56 -0
- package/dist/app/mixins/app-shell-controls.d.ts +46 -0
- package/dist/app/mixins/app-shell-controls.js +131 -0
- package/dist/app/mixins/auto-refresh.d.ts +29 -0
- package/dist/app/mixins/auto-refresh.js +66 -0
- package/dist/app/mixins/command-palette.d.ts +56 -0
- package/dist/app/mixins/command-palette.js +297 -0
- package/dist/app/mixins/copy-permalink.d.ts +26 -0
- package/dist/app/mixins/copy-permalink.js +54 -0
- package/dist/app/mixins/detail-sheet-keys.d.ts +28 -0
- package/dist/app/mixins/detail-sheet-keys.js +88 -0
- package/dist/app/mixins/escape-link.d.ts +17 -0
- package/dist/app/mixins/escape-link.js +35 -0
- package/dist/app/mixins/keyboard-help.d.ts +38 -0
- package/dist/app/mixins/keyboard-help.js +51 -0
- package/dist/app/mixins/optimistic-toggle-sync.d.ts +80 -0
- package/dist/app/mixins/optimistic-toggle-sync.js +153 -0
- package/dist/app/mixins/range-picker-keys.d.ts +18 -0
- package/dist/app/mixins/range-picker-keys.js +94 -0
- package/dist/app/mixins/row-navigation.d.ts +85 -0
- package/dist/app/mixins/row-navigation.js +208 -0
- package/dist/app/mixins/save-bar-sync.d.ts +27 -0
- package/dist/app/mixins/save-bar-sync.js +106 -0
- package/dist/app/mixins/save-shortcut.d.ts +47 -0
- package/dist/app/mixins/save-shortcut.js +101 -0
- package/dist/app/mixins/save-status-sync.d.ts +77 -0
- package/dist/app/mixins/save-status-sync.js +159 -0
- package/dist/app/mixins/selection-bar-sync.d.ts +32 -0
- package/dist/app/mixins/selection-bar-sync.js +151 -0
- package/dist/app/mixins/split-view.d.ts +66 -0
- package/dist/app/mixins/split-view.js +319 -0
- package/dist/app/mixins/status-strip-keys.d.ts +17 -0
- package/dist/app/mixins/status-strip-keys.js +79 -0
- package/dist/app/mixins/submit-on-change.d.ts +16 -0
- package/dist/app/mixins/submit-on-change.js +28 -0
- package/dist/app/mixins/table-selection.d.ts +39 -0
- package/dist/app/mixins/table-selection.js +272 -0
- package/dist/app/mixins/toast-queue.d.ts +36 -0
- package/dist/app/mixins/toast-queue.js +77 -0
- package/dist/app/mixins/toast-stack.d.ts +20 -0
- package/dist/app/mixins/toast-stack.js +55 -0
- package/dist/app/optimistic-toggle.d.ts +48 -0
- package/dist/app/optimistic-toggle.js +38 -0
- package/dist/app/page-header.d.ts +71 -0
- package/dist/app/page-header.js +249 -0
- package/dist/app/range-picker.d.ts +102 -0
- package/dist/app/range-picker.js +118 -0
- package/dist/app/save-bar.d.ts +54 -0
- package/dist/app/save-bar.js +64 -0
- package/dist/app/save-status.d.ts +50 -0
- package/dist/app/save-status.js +54 -0
- package/dist/app/selection-bar.d.ts +101 -0
- package/dist/app/selection-bar.js +157 -0
- package/dist/app/settings-layout.d.ts +70 -0
- package/dist/app/settings-layout.js +112 -0
- package/dist/app/settings-section.d.ts +140 -0
- package/dist/app/settings-section.js +182 -0
- package/dist/app/skeleton.d.ts +47 -4
- package/dist/app/skeleton.js +149 -2
- package/dist/app/sparkline.d.ts +61 -0
- package/dist/app/sparkline.js +145 -0
- package/dist/app/split-view.d.ts +154 -0
- package/dist/app/split-view.js +272 -0
- package/dist/app/stat-card.d.ts +109 -0
- package/dist/app/stat-card.js +379 -0
- package/dist/app/status-strip.d.ts +70 -0
- package/dist/app/status-strip.js +155 -0
- package/dist/app/styles/action-row.d.ts +41 -0
- package/dist/app/styles/action-row.js +59 -0
- package/dist/app/styles/stat-delta.d.ts +29 -0
- package/dist/app/styles/stat-delta.js +36 -0
- package/dist/app/styles/toast-stack.d.ts +21 -0
- package/dist/app/styles/toast-stack.js +54 -0
- package/dist/app/table.d.ts +199 -24
- package/dist/app/table.js +640 -36
- package/dist/app/toast.d.ts +105 -5
- package/dist/app/toast.js +89 -17
- package/dist/app/toasts.d.ts +49 -0
- package/dist/app/toasts.js +103 -0
- package/dist/app/utils/app-shell-cookie.d.ts +21 -0
- package/dist/app/utils/app-shell-cookie.js +33 -0
- package/dist/app/utils/chart-marker-indices.d.ts +9 -5
- package/dist/app/utils/chart-marker-indices.js +9 -8
- package/dist/app/utils/chart-path.d.ts +14 -10
- package/dist/app/utils/chart-path.js +46 -18
- package/dist/app/utils/edited-time.d.ts +19 -0
- package/dist/app/utils/edited-time.js +35 -0
- package/dist/app/utils/key-target.d.ts +23 -0
- package/dist/app/utils/key-target.js +48 -0
- package/dist/app/utils/search-params.d.ts +69 -0
- package/dist/app/utils/search-params.js +132 -0
- package/dist/app/utils/shortcut-groups.d.ts +21 -0
- package/dist/app/utils/shortcut-groups.js +53 -0
- package/dist/app/utils/split-view-layout.d.ts +48 -0
- package/dist/app/utils/split-view-layout.js +71 -0
- package/dist/app/view-options.d.ts +99 -0
- package/dist/app/view-options.js +182 -0
- package/dist/components/banner.d.ts +61 -0
- package/dist/components/banner.js +101 -0
- package/dist/components/confirm.d.ts +54 -5
- package/dist/components/confirm.js +44 -5
- package/dist/components/group.d.ts +14 -0
- package/dist/components/group.js +66 -11
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +5 -0
- package/dist/components/input.js +9 -3
- package/dist/components/link-button.js +8 -2
- package/dist/components/property-list.d.ts +76 -0
- package/dist/components/property-list.js +175 -0
- package/dist/components/relative-time.d.ts +72 -0
- package/dist/components/relative-time.js +45 -0
- package/dist/components/status-dot.d.ts +62 -0
- package/dist/components/status-dot.js +99 -0
- package/dist/components/text-field.d.ts +17 -2
- package/dist/components/text-field.js +13 -4
- package/dist/components/timeline.d.ts +67 -0
- package/dist/components/timeline.js +159 -0
- package/dist/components/typeset.d.ts +2 -1
- package/dist/components/typeset.js +4 -1
- package/dist/docs/code-tabs-sync.d.ts +1 -1
- package/dist/docs/code-tabs-sync.js +2 -2
- package/dist/docs/copy-button.d.ts +1 -1
- package/dist/docs/copy-button.js +2 -2
- package/dist/docs/docs-feedback.d.ts +12 -0
- package/dist/docs/docs-feedback.js +4 -2
- package/dist/docs/docs-hub.js +4 -4
- package/dist/docs/docs-layout.d.ts +1 -1
- package/dist/docs/docs-layout.js +1 -1
- package/dist/docs/docs-nav-tools.d.ts +11 -5
- package/dist/docs/docs-nav-tools.js +5 -4
- package/dist/docs/docs-nav.d.ts +12 -5
- package/dist/docs/docs-nav.js +20 -8
- package/dist/docs/docs-pager.d.ts +5 -1
- package/dist/docs/docs-pager.js +7 -6
- package/dist/docs/mixins/docs-nav-tools.d.ts +3 -3
- package/dist/docs/mixins/docs-nav-tools.js +42 -17
- package/dist/docs/next-steps.js +3 -2
- package/dist/docs/page-actions.d.ts +1 -1
- package/dist/docs/page-actions.js +2 -2
- package/dist/docs/table-of-contents.d.ts +1 -1
- package/dist/docs/table-of-contents.js +2 -2
- package/dist/docs/utils/docs-filter.d.ts +26 -0
- package/dist/docs/utils/docs-filter.js +53 -0
- package/dist/mixins/confirm-phrase.d.ts +19 -0
- package/dist/mixins/confirm-phrase.js +56 -0
- package/dist/mixins/index.d.ts +2 -0
- package/dist/mixins/index.js +2 -0
- package/dist/mixins/viewer-time.d.ts +20 -0
- package/dist/mixins/viewer-time.js +40 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/index.js +1 -0
- package/dist/styles/segmented-control.d.ts +49 -0
- package/dist/styles/segmented-control.js +71 -0
- package/dist/test/table.d.ts +65 -0
- package/dist/test/table.js +108 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/relative-time.d.ts +44 -0
- package/dist/utils/relative-time.js +69 -0
- package/package.json +6 -6
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sidebar | list | detail` on one screen, built on Resizable: the selected record lives in
|
|
3
|
+
* the URL, the split and collapsed panes persist in a cookie, the sidebar becomes a sheet
|
|
4
|
+
* below 64rem and one pane per route shows below 48rem. Without a sidebar it is list + detail.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { EntryComponent, Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
import type { SplitViewKeyScope } from "./mixins/split-view.js";
|
|
11
|
+
import type { SplitViewLayout, SplitViewPane } from "./utils/split-view-layout.js";
|
|
12
|
+
export { SPLIT_VIEW_ITEM_ATTRIBUTE } from "./mixins/split-view.js";
|
|
13
|
+
export { SPLIT_VIEW_COOKIE, parseSplitViewLayout, readSplitViewLayout, serializeSplitViewLayout, } from "./utils/split-view-layout.js";
|
|
14
|
+
/**
|
|
15
|
+
* Prop types for {@link SplitView}.
|
|
16
|
+
*/
|
|
17
|
+
export declare namespace SplitView {
|
|
18
|
+
/** A pane of the view. */
|
|
19
|
+
type Pane = SplitViewPane;
|
|
20
|
+
/** The remembered layout {@link readSplitViewLayout} reads from the request's cookie. */
|
|
21
|
+
type Layout = SplitViewLayout;
|
|
22
|
+
/** Every string the view announces. */
|
|
23
|
+
interface Labels {
|
|
24
|
+
/** The sidebar divider's name, such as "Resize folders". */
|
|
25
|
+
resizeSidebar?: string;
|
|
26
|
+
/** The list divider's name, such as "Resize conversations". */
|
|
27
|
+
resizeList: string;
|
|
28
|
+
/** The detail's back link below 48rem, such as "Conversations". */
|
|
29
|
+
back: string;
|
|
30
|
+
}
|
|
31
|
+
/** Every native `<div>` attribute, plus the panes and how they are laid out. */
|
|
32
|
+
interface Props extends Omit<TagProps<"div">, "id"> {
|
|
33
|
+
/** The view's id; its panes take `${id}-sidebar`, `${id}-list` and `${id}-detail`. */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Folders, views, filters: omit it for a two-pane list + detail. */
|
|
36
|
+
sidebar?: RemixNode;
|
|
37
|
+
/** What the sidebar shows collapsed to its rail, such as its icons alone. */
|
|
38
|
+
rail?: RemixNode;
|
|
39
|
+
/** The list of records, each link carrying `data-split-view-item`. */
|
|
40
|
+
list: RemixNode;
|
|
41
|
+
/** The selected record, or nothing while none is selected. */
|
|
42
|
+
detail?: RemixNode;
|
|
43
|
+
/** Shown in the detail pane while nothing is selected. */
|
|
44
|
+
empty?: RemixNode;
|
|
45
|
+
/**
|
|
46
|
+
* The pane this route shows below 48rem.
|
|
47
|
+
*
|
|
48
|
+
* @default detail ? "detail" : "list"
|
|
49
|
+
*/
|
|
50
|
+
active?: Pane;
|
|
51
|
+
/** The list's URL; below 48rem the detail links back to it. */
|
|
52
|
+
backHref?: string;
|
|
53
|
+
/** The remembered split, from {@link readSplitViewLayout}. */
|
|
54
|
+
layout?: Layout;
|
|
55
|
+
/**
|
|
56
|
+
* The cookie the layout persists in; give each view on a site its own.
|
|
57
|
+
*
|
|
58
|
+
* @default "ui-split-view"
|
|
59
|
+
*/
|
|
60
|
+
cookie?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Where j/k answer: `"page"` anywhere, `"view"` only while focus is inside the view.
|
|
63
|
+
*
|
|
64
|
+
* @default "page"
|
|
65
|
+
*/
|
|
66
|
+
keys?: SplitViewKeyScope;
|
|
67
|
+
labels: Labels;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Props {@link SplitViewHandle} serializes into the page for hydration, which is why they
|
|
72
|
+
* are a `type`: `SerializableProps` rejects an interface.
|
|
73
|
+
*/
|
|
74
|
+
export type SplitViewHandleProps = {
|
|
75
|
+
/** The pane before the divider, which Enter collapses. */
|
|
76
|
+
pane: "sidebar" | "list";
|
|
77
|
+
/** The divider's accessible name. */
|
|
78
|
+
label: string;
|
|
79
|
+
/** Ids of the panes on either side. */
|
|
80
|
+
controls: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* A divider between two panes as an island: drag or ←/→ to resize, Enter to collapse the
|
|
84
|
+
* pane before it; the settled layout is written to the view's cookie. Loads from
|
|
85
|
+
* `@sdxc/ui/app/split-view#SplitViewHandle`; until then the panes keep their layout.
|
|
86
|
+
*
|
|
87
|
+
* @example <SplitViewHandle pane="list" label="Resize conversations" controls="inbox-list inbox-detail" />
|
|
88
|
+
*/
|
|
89
|
+
export declare const SplitViewHandle: EntryComponent<SplitViewHandleProps>;
|
|
90
|
+
/**
|
|
91
|
+
* Props {@link SplitViewToggle} serializes into the page for hydration, which is why they
|
|
92
|
+
* are a `type`: `SerializableProps` rejects an interface.
|
|
93
|
+
*/
|
|
94
|
+
export type SplitViewToggleProps = {
|
|
95
|
+
/** The split view's id. */
|
|
96
|
+
viewId: string;
|
|
97
|
+
/** The pane the button collapses and restores. */
|
|
98
|
+
pane: SplitViewPane;
|
|
99
|
+
/** The button's accessible name, such as "Toggle folders". */
|
|
100
|
+
label: string;
|
|
101
|
+
/** Whether the pane renders collapsed, from the remembered layout. */
|
|
102
|
+
collapsed?: boolean;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* A button collapsing or restoring one pane, placed anywhere in the app's own headers.
|
|
106
|
+
* For the sidebar below 64rem it opens the sidebar as a sheet instead, through the
|
|
107
|
+
* Popover API, which also works before the island loads from
|
|
108
|
+
* `@sdxc/ui/app/split-view#SplitViewToggle`.
|
|
109
|
+
*
|
|
110
|
+
* @example <SplitViewToggle viewId="inbox" pane="sidebar" label="Toggle folders" />
|
|
111
|
+
*/
|
|
112
|
+
export declare const SplitViewToggle: EntryComponent<SplitViewToggleProps>;
|
|
113
|
+
/**
|
|
114
|
+
* Props {@link SplitViewKeys} serializes into the page for hydration, which is why they
|
|
115
|
+
* are a `type`: `SerializableProps` rejects an interface.
|
|
116
|
+
*/
|
|
117
|
+
export type SplitViewKeysProps = {
|
|
118
|
+
/** The list pane's id. */
|
|
119
|
+
listId: string;
|
|
120
|
+
/** The sidebar pane's id, when the view has one. */
|
|
121
|
+
sidebarId?: string;
|
|
122
|
+
/** Where j/k answer. */
|
|
123
|
+
keys?: SplitViewKeyScope;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* The view's keys as an island with no visible markup: j/k step through the list's
|
|
127
|
+
* `data-split-view-item` links, the list keeps its scroll across loads, and following a
|
|
128
|
+
* link closes the sidebar sheet. Loads from `@sdxc/ui/app/split-view#SplitViewKeys`.
|
|
129
|
+
*
|
|
130
|
+
* @example <SplitViewKeys listId="inbox-list" />
|
|
131
|
+
*/
|
|
132
|
+
export declare const SplitViewKeys: EntryComponent<SplitViewKeysProps>;
|
|
133
|
+
/**
|
|
134
|
+
* Renders the view. From 64rem the panes sit side by side; below it the sidebar is a sheet
|
|
135
|
+
* opened by a {@link SplitViewToggle}; below 48rem only the `active` pane shows, and the
|
|
136
|
+
* detail gains a back link. Each pane scrolls on its own and keeps its id for a frame.
|
|
137
|
+
*
|
|
138
|
+
* @param handle Runtime handle carrying the root `<div>`'s props.
|
|
139
|
+
* @returns The render function producing the view's markup.
|
|
140
|
+
* @example
|
|
141
|
+
* <SplitView
|
|
142
|
+
* id="inbox"
|
|
143
|
+
* sidebar={<FolderNav />}
|
|
144
|
+
* list={<ConversationList />}
|
|
145
|
+
* detail={selected ? <Conversation id={selected} /> : null}
|
|
146
|
+
* empty={<Empty title="No conversation selected" />}
|
|
147
|
+
* backHref="/inbox"
|
|
148
|
+
* layout={readSplitViewLayout(request.headers.get("Cookie"))}
|
|
149
|
+
* labels={{ resizeSidebar: "Resize folders", resizeList: "Resize conversations", back: "Inbox" }}
|
|
150
|
+
* />
|
|
151
|
+
* @example
|
|
152
|
+
* <SplitView id="customers" list={<CustomerList />} detail={<Customer />} labels={labels} />
|
|
153
|
+
*/
|
|
154
|
+
export declare function SplitView(handle: Handle<SplitView.Props>): () => import("remix/component").RemixElement;
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ArrowLeftIcon, PanelLeftIcon, PanelRightIcon } from "@sdxc/icons";
|
|
3
|
+
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
4
|
+
import { rounded, transition } from "@sdxc/u/effects";
|
|
5
|
+
import { cursor, pseudoContent, raw, touchAction, userSelect, mergeMix } from "@sdxc/u/general";
|
|
6
|
+
import { container, flex, gap, inlineFlex, items, justify, relative, shrink } from "@sdxc/u/layout";
|
|
7
|
+
import { bs, is, m, p, pi } from "@sdxc/u/size";
|
|
8
|
+
import { before, focusVisible, hover, when } from "@sdxc/u/state";
|
|
9
|
+
import { text, weight } from "@sdxc/u/typography";
|
|
10
|
+
import { clientEntry } from "remix/component";
|
|
11
|
+
import { hitArea } from "../styles/hit-area.js";
|
|
12
|
+
import { ResizeSession } from "./behaviors/resize-session.js";
|
|
13
|
+
import { resizeHandle } from "./mixins/resize-handle.js";
|
|
14
|
+
import { splitViewHandle, splitViewKeys, splitViewToggle } from "./mixins/split-view.js";
|
|
15
|
+
import { Resizable } from "./resizable.js";
|
|
16
|
+
import { SPLIT_VIEW_COOKIE } from "./utils/split-view-layout.js";
|
|
17
|
+
export { SPLIT_VIEW_ITEM_ATTRIBUTE } from "./mixins/split-view.js";
|
|
18
|
+
export { SPLIT_VIEW_COOKIE, parseSplitViewLayout, readSplitViewLayout, serializeSplitViewLayout, } from "./utils/split-view-layout.js";
|
|
19
|
+
/** Container the view names; every pane's layout answers its width. */
|
|
20
|
+
const CONTAINER = "ui-split-view";
|
|
21
|
+
/** Where j/k answer when `keys` is left unset. */
|
|
22
|
+
const DEFAULT_KEY_SCOPE = "page";
|
|
23
|
+
/** Below this container width the sidebar is a sheet. */
|
|
24
|
+
const SHEET_QUERY = `@container ${CONTAINER} (width < 64rem)`;
|
|
25
|
+
/** Below this container width the view shows one pane per route. */
|
|
26
|
+
const SINGLE_QUERY = `@container ${CONTAINER} (width < 48rem)`;
|
|
27
|
+
/** Builds the selector matching a pane while the view carries `attribute`. */
|
|
28
|
+
function whileRoot(attribute) {
|
|
29
|
+
return `:where([data-split-view]${attribute}) > [data-resizable-group] > &`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A divider between two panes as an island: drag or ←/→ to resize, Enter to collapse the
|
|
33
|
+
* pane before it; the settled layout is written to the view's cookie. Loads from
|
|
34
|
+
* `@sdxc/ui/app/split-view#SplitViewHandle`; until then the panes keep their layout.
|
|
35
|
+
*
|
|
36
|
+
* @example <SplitViewHandle pane="list" label="Resize conversations" controls="inbox-list inbox-detail" />
|
|
37
|
+
*/
|
|
38
|
+
export const SplitViewHandle = clientEntry("@sdxc/ui/app/split-view#SplitViewHandle", function SplitViewHandle(handle) {
|
|
39
|
+
let session = new ResizeSession();
|
|
40
|
+
return () => {
|
|
41
|
+
let { pane, label, controls } = handle.props;
|
|
42
|
+
return (_jsx("div", { role: "separator", tabIndex: 0, "aria-orientation": "vertical", "aria-label": label, "aria-controls": controls, "aria-keyshortcuts": "ArrowLeft ArrowRight Enter", "data-resizable-handle": true, "data-pane": pane, mix: [
|
|
43
|
+
splitViewHandle(pane),
|
|
44
|
+
resizeHandle("horizontal", session),
|
|
45
|
+
relative(),
|
|
46
|
+
flex(),
|
|
47
|
+
shrink(0),
|
|
48
|
+
items("center"),
|
|
49
|
+
justify("center"),
|
|
50
|
+
userSelect(),
|
|
51
|
+
touchAction(),
|
|
52
|
+
cursor("col-resize"),
|
|
53
|
+
before(pseudoContent('""')),
|
|
54
|
+
before([bs("full"), is("1px")]),
|
|
55
|
+
when("&::before", bg("neutral.border")),
|
|
56
|
+
hover(when("&::before", bg("neutral.strong"))),
|
|
57
|
+
when("&[data-resizing]::before", bg("brand.solid")),
|
|
58
|
+
focusVisible(when("&::before", [bg("brand.solid"), raw({ inlineSize: "2px" })])),
|
|
59
|
+
outline("none"),
|
|
60
|
+
hitArea(),
|
|
61
|
+
raw(pane === "sidebar"
|
|
62
|
+
? {
|
|
63
|
+
flex: "0 0 1px",
|
|
64
|
+
zIndex: 1,
|
|
65
|
+
[whileRoot('[data-collapsed~="sidebar"]')]: { display: "none" },
|
|
66
|
+
[SHEET_QUERY]: { display: "none" },
|
|
67
|
+
}
|
|
68
|
+
: {
|
|
69
|
+
flex: "0 0 1px",
|
|
70
|
+
zIndex: 1,
|
|
71
|
+
[whileRoot('[data-collapsed~="list"]')]: { display: "none" },
|
|
72
|
+
[whileRoot('[data-collapsed~="detail"]')]: { display: "none" },
|
|
73
|
+
[SINGLE_QUERY]: { display: "none" },
|
|
74
|
+
}),
|
|
75
|
+
] }));
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* A button collapsing or restoring one pane, placed anywhere in the app's own headers.
|
|
80
|
+
* For the sidebar below 64rem it opens the sidebar as a sheet instead, through the
|
|
81
|
+
* Popover API, which also works before the island loads from
|
|
82
|
+
* `@sdxc/ui/app/split-view#SplitViewToggle`.
|
|
83
|
+
*
|
|
84
|
+
* @example <SplitViewToggle viewId="inbox" pane="sidebar" label="Toggle folders" />
|
|
85
|
+
*/
|
|
86
|
+
export const SplitViewToggle = clientEntry("@sdxc/ui/app/split-view#SplitViewToggle", function SplitViewToggle(handle) {
|
|
87
|
+
return () => {
|
|
88
|
+
let { viewId, pane, label, collapsed } = handle.props;
|
|
89
|
+
let Icon = pane === "detail" ? PanelRightIcon : PanelLeftIcon;
|
|
90
|
+
return (_jsx("button", { type: "button", "aria-label": label, title: label, "aria-expanded": collapsed ? "false" : "true", "aria-controls": `${viewId}-${pane}`, popovertarget: pane === "sidebar" ? `${viewId}-sidebar` : undefined, "data-split-view-toggle": viewId, "data-pane": pane, mix: [
|
|
91
|
+
splitViewToggle(viewId, pane),
|
|
92
|
+
inlineFlex(),
|
|
93
|
+
items("center"),
|
|
94
|
+
justify("center"),
|
|
95
|
+
shrink(0),
|
|
96
|
+
is("2rem"),
|
|
97
|
+
bs("2rem"),
|
|
98
|
+
rounded("md"),
|
|
99
|
+
border({ color: "transparent", width: 0 }),
|
|
100
|
+
bg("transparent"),
|
|
101
|
+
fg("neutral.muted"),
|
|
102
|
+
cursor("pointer"),
|
|
103
|
+
transition("color, background-color"),
|
|
104
|
+
hover([fg("neutral.emphasis"), bg("neutral.tint")]),
|
|
105
|
+
focusVisible(outline({ color: "brand.ring", width: 2, offset: -2 })),
|
|
106
|
+
], children: _jsx(Icon, { size: 16, "aria-hidden": "true" }) }));
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* The view's keys as an island with no visible markup: j/k step through the list's
|
|
111
|
+
* `data-split-view-item` links, the list keeps its scroll across loads, and following a
|
|
112
|
+
* link closes the sidebar sheet. Loads from `@sdxc/ui/app/split-view#SplitViewKeys`.
|
|
113
|
+
*
|
|
114
|
+
* @example <SplitViewKeys listId="inbox-list" />
|
|
115
|
+
*/
|
|
116
|
+
export const SplitViewKeys = clientEntry("@sdxc/ui/app/split-view#SplitViewKeys", function SplitViewKeys(handle) {
|
|
117
|
+
return () => {
|
|
118
|
+
let { listId, sidebarId, keys } = handle.props;
|
|
119
|
+
return _jsx("span", { hidden: true, mix: [splitViewKeys(listId, sidebarId, keys ?? DEFAULT_KEY_SCOPE)] });
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* Renders the view. From 64rem the panes sit side by side; below it the sidebar is a sheet
|
|
124
|
+
* opened by a {@link SplitViewToggle}; below 48rem only the `active` pane shows, and the
|
|
125
|
+
* detail gains a back link. Each pane scrolls on its own and keeps its id for a frame.
|
|
126
|
+
*
|
|
127
|
+
* @param handle Runtime handle carrying the root `<div>`'s props.
|
|
128
|
+
* @returns The render function producing the view's markup.
|
|
129
|
+
* @example
|
|
130
|
+
* <SplitView
|
|
131
|
+
* id="inbox"
|
|
132
|
+
* sidebar={<FolderNav />}
|
|
133
|
+
* list={<ConversationList />}
|
|
134
|
+
* detail={selected ? <Conversation id={selected} /> : null}
|
|
135
|
+
* empty={<Empty title="No conversation selected" />}
|
|
136
|
+
* backHref="/inbox"
|
|
137
|
+
* layout={readSplitViewLayout(request.headers.get("Cookie"))}
|
|
138
|
+
* labels={{ resizeSidebar: "Resize folders", resizeList: "Resize conversations", back: "Inbox" }}
|
|
139
|
+
* />
|
|
140
|
+
* @example
|
|
141
|
+
* <SplitView id="customers" list={<CustomerList />} detail={<Customer />} labels={labels} />
|
|
142
|
+
*/
|
|
143
|
+
export function SplitView(handle) {
|
|
144
|
+
return () => {
|
|
145
|
+
let { id, sidebar, rail, list, detail, empty, active, backHref, layout, cookie, keys, labels, mix, ...rest } = handle.props;
|
|
146
|
+
let hasDetail = detail !== null && detail !== undefined && detail !== false;
|
|
147
|
+
let ids = { sidebar: `${id}-sidebar`, list: `${id}-list`, detail: `${id}-detail` };
|
|
148
|
+
return (_jsxs("div", { id: id, "data-split-view": true, "data-slot": "split-view", "data-cookie": cookie ?? SPLIT_VIEW_COOKIE, "data-collapsed": (layout?.collapsed ?? []).join(" "), "data-active": active ?? (hasDetail ? "detail" : "list"), ...rest, mix: mergeMix([container(CONTAINER), is("full"), bs("full"), raw({ minBlockSize: 0 })], mix), children: [_jsxs(Resizable, { "data-resizable-group": true, mix: [
|
|
149
|
+
bs("full"),
|
|
150
|
+
rounded("none"),
|
|
151
|
+
border({ color: "transparent", width: 0 }),
|
|
152
|
+
bg("transparent"),
|
|
153
|
+
], children: [sidebar ? (_jsx(SidebarPane, { id: ids.sidebar, size: layout?.sidebar, rail: rail, children: sidebar })) : null, sidebar ? (_jsx(SplitViewHandle, { pane: "sidebar", label: labels.resizeSidebar ?? labels.resizeList, controls: `${ids.sidebar} ${ids.list}` })) : null, _jsx(Resizable.Panel, { id: ids.list, "data-pane": "list", "data-resizable-panel": true, "data-resizable-min": "15", "data-resizable-max": "60", defaultSize: layout?.list, mix: [
|
|
154
|
+
raw({
|
|
155
|
+
flex: "0 0 var(--ui-resizable-panel-size, var(--ui-app-list-width, 20rem))",
|
|
156
|
+
minInlineSize: "min(16rem, 40%)",
|
|
157
|
+
maxInlineSize: "none",
|
|
158
|
+
overscrollBehavior: "contain",
|
|
159
|
+
[whileRoot('[data-collapsed~="list"]')]: { display: "none" },
|
|
160
|
+
[whileRoot('[data-collapsed~="detail"]')]: { flex: "1 1 auto" },
|
|
161
|
+
[SINGLE_QUERY]: {
|
|
162
|
+
display: "none",
|
|
163
|
+
flex: "1 1 auto",
|
|
164
|
+
[whileRoot('[data-active="list"]')]: { display: "block" },
|
|
165
|
+
},
|
|
166
|
+
}),
|
|
167
|
+
], children: list }), _jsx(SplitViewHandle, { pane: "list", label: labels.resizeList, controls: `${ids.list} ${ids.detail}` }), _jsxs(Resizable.Panel, { id: ids.detail, "data-pane": "detail", "data-resizable-panel": true, mix: [
|
|
168
|
+
raw({
|
|
169
|
+
display: "flex",
|
|
170
|
+
flexDirection: "column",
|
|
171
|
+
flex: "1 1 0",
|
|
172
|
+
minInlineSize: 0,
|
|
173
|
+
maxInlineSize: "none",
|
|
174
|
+
[whileRoot('[data-collapsed~="detail"]')]: { display: "none" },
|
|
175
|
+
[SINGLE_QUERY]: {
|
|
176
|
+
display: "none",
|
|
177
|
+
[whileRoot('[data-active="detail"]')]: { display: "flex" },
|
|
178
|
+
},
|
|
179
|
+
}),
|
|
180
|
+
], children: [backHref ? (_jsxs("a", { href: backHref, "data-slot": "split-view-back", mix: [
|
|
181
|
+
inlineFlex(),
|
|
182
|
+
items("center"),
|
|
183
|
+
gap(1.5),
|
|
184
|
+
m(2),
|
|
185
|
+
pi(2),
|
|
186
|
+
bs("2rem"),
|
|
187
|
+
raw({ alignSelf: "start" }),
|
|
188
|
+
rounded("md"),
|
|
189
|
+
text("sm"),
|
|
190
|
+
weight("medium"),
|
|
191
|
+
fg("neutral.muted"),
|
|
192
|
+
hover([fg("neutral.emphasis"), bg("neutral.tint")]),
|
|
193
|
+
focusVisible(outline({ color: "brand.ring", width: 2, offset: -2 })),
|
|
194
|
+
raw({ display: "none", [SINGLE_QUERY]: { display: "inline-flex" } }),
|
|
195
|
+
], children: [_jsx(ArrowLeftIcon, { size: 16, "aria-hidden": "true" }), labels.back] })) : null, hasDetail ? (detail) : (_jsx("div", { "data-slot": "split-view-empty", mix: [
|
|
196
|
+
flex(),
|
|
197
|
+
items("center"),
|
|
198
|
+
justify("center"),
|
|
199
|
+
p(6),
|
|
200
|
+
fg("neutral.muted"),
|
|
201
|
+
text("sm"),
|
|
202
|
+
raw({ flex: "1 1 auto", textAlign: "center" }),
|
|
203
|
+
], children: empty }))] })] }), _jsx(SplitViewKeys, { listId: ids.list, sidebarId: sidebar ? ids.sidebar : undefined, keys: keys })] }));
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The sidebar pane: a column from 64rem that snaps to `--ui-app-rail-width` when collapsed,
|
|
208
|
+
* and a `popover` sheet `--ui-app-sheet-width` wide below it, which a
|
|
209
|
+
* {@link SplitViewToggle} opens and light dismiss closes.
|
|
210
|
+
*
|
|
211
|
+
* @param handle Runtime handle carrying the pane's id, remembered size, rail and content.
|
|
212
|
+
* @returns The render function producing the pane's markup.
|
|
213
|
+
*/
|
|
214
|
+
function SidebarPane(handle) {
|
|
215
|
+
return () => {
|
|
216
|
+
let { id, size, rail, children } = handle.props;
|
|
217
|
+
return (_jsx(Resizable.Panel, { id: id, popover: "auto", "data-pane": "sidebar", "data-resizable-panel": true, "data-resizable-min": "10", "data-resizable-max": "35", defaultSize: size, mix: [
|
|
218
|
+
raw({
|
|
219
|
+
display: "flex",
|
|
220
|
+
flexDirection: "column",
|
|
221
|
+
position: "static",
|
|
222
|
+
inset: "auto",
|
|
223
|
+
margin: 0,
|
|
224
|
+
padding: 0,
|
|
225
|
+
border: 0,
|
|
226
|
+
color: "inherit",
|
|
227
|
+
background: "transparent",
|
|
228
|
+
blockSize: "auto",
|
|
229
|
+
inlineSize: "auto",
|
|
230
|
+
flex: "0 0 var(--ui-resizable-panel-size, var(--ui-app-sidebar-width, 16rem))",
|
|
231
|
+
minInlineSize: "min(12rem, 30%)",
|
|
232
|
+
maxInlineSize: "none",
|
|
233
|
+
maxBlockSize: "none",
|
|
234
|
+
"& > [data-split-rail]": { display: "none" },
|
|
235
|
+
[whileRoot('[data-collapsed~="sidebar"]')]: {
|
|
236
|
+
flexBasis: "var(--ui-app-rail-width, 3.25rem)",
|
|
237
|
+
minInlineSize: 0,
|
|
238
|
+
overflow: "hidden",
|
|
239
|
+
},
|
|
240
|
+
':where([data-split-view][data-collapsed~="sidebar"]) > [data-resizable-group] > & > [data-split-full]': rail ? { display: "none" } : {},
|
|
241
|
+
':where([data-split-view][data-collapsed~="sidebar"]) > [data-resizable-group] > & > [data-split-rail]': {
|
|
242
|
+
display: "block",
|
|
243
|
+
},
|
|
244
|
+
[SHEET_QUERY]: {
|
|
245
|
+
"&:not(:popover-open)": { display: "none" },
|
|
246
|
+
"&:popover-open": {
|
|
247
|
+
position: "fixed",
|
|
248
|
+
insetBlock: 0,
|
|
249
|
+
insetInlineStart: 0,
|
|
250
|
+
insetInlineEnd: "auto",
|
|
251
|
+
inlineSize: "min(var(--ui-app-sheet-width, 18rem), calc(100vw - 3rem))",
|
|
252
|
+
minInlineSize: 0,
|
|
253
|
+
blockSize: "100dvh",
|
|
254
|
+
overflow: "auto",
|
|
255
|
+
background: "var(--ui-bg, Canvas)",
|
|
256
|
+
borderInlineEnd: "1px solid var(--ui-neutral-border)",
|
|
257
|
+
boxShadow: "var(--ui-shadow-xl, 0 20px 25px -5px rgb(0 0 0 / 0.1))",
|
|
258
|
+
},
|
|
259
|
+
"&::backdrop": { background: "rgb(0 0 0 / 0.3)" },
|
|
260
|
+
"& > [data-split-full]": { display: "block" },
|
|
261
|
+
"& > [data-split-rail]": { display: "none" },
|
|
262
|
+
},
|
|
263
|
+
[SINGLE_QUERY]: {
|
|
264
|
+
':where([data-split-view][data-active="sidebar"]) > [data-resizable-group] > &:not(:popover-open)': {
|
|
265
|
+
display: "flex",
|
|
266
|
+
flex: "1 1 auto",
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
}),
|
|
270
|
+
], children: rail ? (_jsxs(_Fragment, { children: [_jsx("div", { "data-split-full": true, children: children }), _jsx("div", { "data-split-rail": true, children: rail })] })) : (children) }));
|
|
271
|
+
};
|
|
272
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stat cards for a dashboard: a muted label, the value in tabular figures, a delta pill toned
|
|
3
|
+
* by meaning with its comparison, an optional trend and a sentence explaining the number,
|
|
4
|
+
* laid out by a group as cards, ruled columns, or link tabs that switch the chart below.
|
|
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 StatCard} and its parts.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace StatCard {
|
|
14
|
+
/**
|
|
15
|
+
* How a group sets its stats: `cards` boxes each one, `ruled` sets columns under a 1px rule,
|
|
16
|
+
* and `tabs` joins link cards into one divided strip whose current card underlines.
|
|
17
|
+
*/
|
|
18
|
+
type Variant = "cards" | "ruled" | "tabs";
|
|
19
|
+
/** Direction the number moved since the comparison period. */
|
|
20
|
+
type Trend = "up" | "down" | "flat";
|
|
21
|
+
/** Props accepted by {@link StatCard}. */
|
|
22
|
+
interface Props extends Omit<TagProps<"div">, "children"> {
|
|
23
|
+
/** Makes the whole card a link, such as the metric's chart tab or its detail page. */
|
|
24
|
+
href?: string;
|
|
25
|
+
/** Marks a link card as the metric the page shows, through `aria-current="true"`. */
|
|
26
|
+
current?: boolean;
|
|
27
|
+
children: RemixNode;
|
|
28
|
+
}
|
|
29
|
+
/** Props accepted by {@link StatCard.Group}. */
|
|
30
|
+
interface GroupProps extends TagProps<"div"> {
|
|
31
|
+
/** @default {@link DEFAULT_VARIANT} */
|
|
32
|
+
variant?: Variant;
|
|
33
|
+
/** Columns at full width; a narrower container shows at most two, compact, then one. */
|
|
34
|
+
columns?: number;
|
|
35
|
+
}
|
|
36
|
+
/** Props accepted by {@link StatCard.Delta}. */
|
|
37
|
+
interface DeltaProps extends TagProps<"span"> {
|
|
38
|
+
trend: Trend;
|
|
39
|
+
/** Tones a fall as good and a rise as bad, for numbers such as latency or error rate. */
|
|
40
|
+
invert?: boolean;
|
|
41
|
+
/** Spoken before the change, since the arrow is decorative ("Increased by"). */
|
|
42
|
+
trendLabel?: string;
|
|
43
|
+
/** The period it compares with, set after the pill ("vs last week"). */
|
|
44
|
+
comparison?: RemixNode;
|
|
45
|
+
}
|
|
46
|
+
/** Props accepted by {@link StatCard.Skeleton}. */
|
|
47
|
+
interface SkeletonProps extends Omit<TagProps<"div">, "children"> {
|
|
48
|
+
/**
|
|
49
|
+
* Reserves a delta pill.
|
|
50
|
+
*
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
delta?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Reserves the comparison set after the delta pill, which wraps under the pill in a
|
|
56
|
+
* narrow card just as the real comparison does.
|
|
57
|
+
*
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
comparison?: boolean;
|
|
61
|
+
/** Reserves the trend slot. */
|
|
62
|
+
chart?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Reserves a sentence-long footer, which wraps to a second line in a narrow card. Given the
|
|
65
|
+
* real footer text, draws it invisibly so it wraps to the card's lines at every width; text
|
|
66
|
+
* wins over `footerLines`.
|
|
67
|
+
*
|
|
68
|
+
* @default true
|
|
69
|
+
*/
|
|
70
|
+
footer?: boolean | string;
|
|
71
|
+
/**
|
|
72
|
+
* Reserves exactly this many footer lines at every width (ignored when `footer` is text), for footers whose real sentences
|
|
73
|
+
* wrap even in a wide card. Unset, the footer wraps where a 40-character sentence does.
|
|
74
|
+
*/
|
|
75
|
+
footerLines?: 1 | 2;
|
|
76
|
+
/**
|
|
77
|
+
* The real card's label, drawn as invisible text on a placeholder bar, so the skeleton's
|
|
78
|
+
* label wraps to the same lines as the card's at every width.
|
|
79
|
+
*/
|
|
80
|
+
label?: string;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Renders one stat: a grid that sets the label and delta on one line, the value under them,
|
|
85
|
+
* then the trend and the footer, in that order whatever order the parts are written in. With
|
|
86
|
+
* `href` the whole card is one link, and `current` marks it as the metric being shown.
|
|
87
|
+
*
|
|
88
|
+
* @param handle Runtime handle carrying the card's props.
|
|
89
|
+
* @returns The render function producing the card's markup.
|
|
90
|
+
* @example
|
|
91
|
+
* <StatCard>
|
|
92
|
+
* <StatCard.Label>{t("stats.uptime")}</StatCard.Label>
|
|
93
|
+
* <StatCard.Value>99.98%</StatCard.Value>
|
|
94
|
+
* <StatCard.Delta trend="up" comparison={t("stats.vsLastWeek")}>+0.02%</StatCard.Delta>
|
|
95
|
+
* <StatCard.Footer>{t("stats.uptimeFooter")}</StatCard.Footer>
|
|
96
|
+
* </StatCard>
|
|
97
|
+
* @example
|
|
98
|
+
* <StatCard href="?metric=latency" current={metric === "latency"}>…</StatCard>
|
|
99
|
+
*/
|
|
100
|
+
export declare function StatCard(handle: Handle<StatCard.Props>): () => import("remix/component").RemixElement;
|
|
101
|
+
export declare namespace StatCard {
|
|
102
|
+
var Group: (handle: Handle<StatCard.GroupProps>) => () => import("remix/component").RemixElement;
|
|
103
|
+
var Label: (handle: Handle<TagProps<"div">>) => () => import("remix/component").RemixElement;
|
|
104
|
+
var Value: (handle: Handle<TagProps<"div">>) => () => import("remix/component").RemixElement;
|
|
105
|
+
var Delta: (handle: Handle<StatCard.DeltaProps>) => () => import("remix/component").RemixElement;
|
|
106
|
+
var Chart: (handle: Handle<TagProps<"div">>) => () => import("remix/component").RemixElement;
|
|
107
|
+
var Footer: (handle: Handle<TagProps<"div">>) => () => import("remix/component").RemixElement;
|
|
108
|
+
var Skeleton: (handle: Handle<StatCard.SkeletonProps>) => () => import("remix/component").RemixElement;
|
|
109
|
+
}
|