@haatlabs-core/ui 0.19.0 → 0.22.0
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 +14 -3
- package/dist/client/LoginPage.d.ts +8 -2
- package/dist/client/LoginPage.js +24 -4
- package/dist/client/LoginPage.js.map +1 -1
- package/dist/client/UsagePage.d.ts +10 -1
- package/dist/client/UsagePage.js +44 -14
- package/dist/client/UsagePage.js.map +1 -1
- package/dist/client/index.d.ts +13 -1
- package/dist/client/index.js +11 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/sign-in-styles.d.ts +1 -1
- package/dist/client/sign-in-styles.js +6 -0
- package/dist/client/sign-in-styles.js.map +1 -1
- package/dist/client/usage-css.d.ts +1 -1
- package/dist/client/usage-css.js +5 -0
- package/dist/client/usage-css.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/notifications/NotificationBell.d.ts +12 -0
- package/dist/notifications/NotificationBell.js +94 -0
- package/dist/notifications/NotificationBell.js.map +1 -0
- package/dist/notifications/NotificationInbox.d.ts +23 -0
- package/dist/notifications/NotificationInbox.js +92 -0
- package/dist/notifications/NotificationInbox.js.map +1 -0
- package/dist/notifications/NotificationPreferences.d.ts +10 -0
- package/dist/notifications/NotificationPreferences.js +135 -0
- package/dist/notifications/NotificationPreferences.js.map +1 -0
- package/dist/notifications/notifications-css.d.ts +6 -0
- package/dist/notifications/notifications-css.js +62 -0
- package/dist/notifications/notifications-css.js.map +1 -0
- package/dist/notifications/types.d.ts +80 -0
- package/dist/notifications/types.js +12 -0
- package/dist/notifications/types.js.map +1 -0
- package/dist/notifications/use-notification-stream.d.ts +15 -0
- package/dist/notifications/use-notification-stream.js +123 -0
- package/dist/notifications/use-notification-stream.js.map +1 -0
- package/dist/shell/Account.d.ts +24 -0
- package/dist/shell/Account.js +48 -0
- package/dist/shell/Account.js.map +1 -0
- package/dist/shell/AppShell.d.ts +13 -7
- package/dist/shell/AppShell.js +139 -65
- package/dist/shell/AppShell.js.map +1 -1
- package/dist/shell/BottomNav.d.ts +34 -0
- package/dist/shell/BottomNav.js +40 -0
- package/dist/shell/BottomNav.js.map +1 -0
- package/dist/shell/MoreSheet.d.ts +21 -0
- package/dist/shell/MoreSheet.js +46 -0
- package/dist/shell/MoreSheet.js.map +1 -0
- package/dist/shell/ShellSearch.d.ts +6 -2
- package/dist/shell/ShellSearch.js +3 -3
- package/dist/shell/ShellSearch.js.map +1 -1
- package/dist/shell/ShortcutsDialog.d.ts +11 -0
- package/dist/shell/ShortcutsDialog.js +26 -0
- package/dist/shell/ShortcutsDialog.js.map +1 -0
- package/dist/shell/bottom-nav-css.d.ts +6 -0
- package/dist/shell/bottom-nav-css.js +40 -0
- package/dist/shell/bottom-nav-css.js.map +1 -0
- package/dist/shell/breakpoint.d.ts +12 -0
- package/dist/shell/breakpoint.js +29 -0
- package/dist/shell/breakpoint.js.map +1 -0
- package/dist/shell/focus-trap.d.ts +9 -0
- package/dist/shell/focus-trap.js +35 -0
- package/dist/shell/focus-trap.js.map +1 -0
- package/dist/shell/icons.d.ts +23 -0
- package/dist/shell/icons.js +21 -0
- package/dist/shell/icons.js.map +1 -0
- package/dist/shell/nav.d.ts +22 -0
- package/dist/shell/nav.js +22 -0
- package/dist/shell/nav.js.map +1 -1
- package/dist/shell/shell-css.d.ts +1 -1
- package/dist/shell/shell-css.js +67 -16
- package/dist/shell/shell-css.js.map +1 -1
- package/dist/shell/shortcuts.d.ts +22 -0
- package/dist/shell/shortcuts.js +48 -0
- package/dist/shell/shortcuts.js.map +1 -0
- package/dist/shell/sidebar-state.d.ts +5 -0
- package/dist/shell/sidebar-state.js +38 -0
- package/dist/shell/sidebar-state.js.map +1 -0
- package/dist/theme/ThemeStyles.js +2 -1
- package/dist/theme/ThemeStyles.js.map +1 -1
- package/dist/theme/ThemeSwitch.d.ts +12 -2
- package/dist/theme/ThemeSwitch.js +19 -3
- package/dist/theme/ThemeSwitch.js.map +1 -1
- package/dist/theme/tokens.d.ts +7 -2
- package/dist/theme/tokens.js +24 -1
- package/dist/theme/tokens.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The notification routes' shapes, as the app's API client hands them over. Local on purpose:
|
|
2
|
+
// the UI does not depend on @haatlabs-core/notifications (as BillingClient does not on nest-billing).
|
|
3
|
+
const APP_PATH = /^\/(?!\/)[^\s\\]*$/;
|
|
4
|
+
const MAX_LINK = 512;
|
|
5
|
+
/**
|
|
6
|
+
* A link is an in-app path: one leading slash, no spaces or backslashes, at most 512
|
|
7
|
+
* characters. The same rule as `@haatlabs-core/notifications`, copied so the UI does not load it.
|
|
8
|
+
*/
|
|
9
|
+
export function isAppPath(link) {
|
|
10
|
+
return link.length <= MAX_LINK && APP_PATH.test(link);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/notifications/types.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iGAAiG;AA4EjG,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AACtC,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,MAAM,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NotificationItemData, NotificationsClient } from './types.js';
|
|
2
|
+
export interface NotificationStreamState {
|
|
3
|
+
unread: number;
|
|
4
|
+
/** Items that arrived on the stream since mount, newest first. */
|
|
5
|
+
latest: NotificationItemData[];
|
|
6
|
+
/** Sets the count after the caller changed it (marking read answers with the new count). */
|
|
7
|
+
setUnread: (unread: number) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The unread count, live. Uses `client.stream` when there is one, reconnecting with backoff;
|
|
11
|
+
* polls `unreadCount` every 60 s without a stream, or after 3 unhealthy attempts in a row (the
|
|
12
|
+
* stream keeps retrying, and polling stops once an attempt stays up 30 s or gets a second event). Everything stops while
|
|
13
|
+
* the page is hidden and catches up when it is shown, and on unmount. Pass a stable client.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useNotificationStream(client: NotificationsClient): NotificationStreamState;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
/** Waits before each reconnect after the stream ends: 1 s, 2 s, 5 s, 15 s, then 30 s. */
|
|
3
|
+
const BACKOFF_MS = [1_000, 2_000, 5_000, 15_000, 30_000];
|
|
4
|
+
const POLL_MS = 60_000;
|
|
5
|
+
/** Unhealthy stream attempts in a row before the unread count is polled. */
|
|
6
|
+
const FAILURES_BEFORE_POLLING = 3;
|
|
7
|
+
/** An attempt is healthy once it stays up this long, or a second event comes. */
|
|
8
|
+
const HEALTHY_MS = 30_000;
|
|
9
|
+
/** How many streamed items are kept for the bell. */
|
|
10
|
+
const LATEST = 10;
|
|
11
|
+
const pageHidden = () => typeof document !== 'undefined' && document.hidden;
|
|
12
|
+
/**
|
|
13
|
+
* The unread count, live. Uses `client.stream` when there is one, reconnecting with backoff;
|
|
14
|
+
* polls `unreadCount` every 60 s without a stream, or after 3 unhealthy attempts in a row (the
|
|
15
|
+
* stream keeps retrying, and polling stops once an attempt stays up 30 s or gets a second event). Everything stops while
|
|
16
|
+
* the page is hidden and catches up when it is shown, and on unmount. Pass a stable client.
|
|
17
|
+
*/
|
|
18
|
+
export function useNotificationStream(client) {
|
|
19
|
+
const [unread, setUnread] = useState(0);
|
|
20
|
+
const [latest, setLatest] = useState([]);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
let stopped = false;
|
|
23
|
+
let controller;
|
|
24
|
+
let retry;
|
|
25
|
+
let poll;
|
|
26
|
+
let health;
|
|
27
|
+
let failures = 0;
|
|
28
|
+
const refresh = () => {
|
|
29
|
+
client.unreadCount().then((count) => {
|
|
30
|
+
if (!stopped)
|
|
31
|
+
setUnread(count);
|
|
32
|
+
}, () => undefined);
|
|
33
|
+
};
|
|
34
|
+
const startPolling = () => {
|
|
35
|
+
poll ??= setInterval(refresh, POLL_MS);
|
|
36
|
+
};
|
|
37
|
+
const stopPolling = () => {
|
|
38
|
+
clearInterval(poll);
|
|
39
|
+
poll = undefined;
|
|
40
|
+
};
|
|
41
|
+
const onEvent = (event) => {
|
|
42
|
+
if (event.kind === 'unread')
|
|
43
|
+
setUnread(event.unread);
|
|
44
|
+
else
|
|
45
|
+
setLatest((items) => [event.item, ...items.filter((i) => i.id !== event.item.id)].slice(0, LATEST));
|
|
46
|
+
};
|
|
47
|
+
const connect = () => {
|
|
48
|
+
const stream = client.stream?.bind(client);
|
|
49
|
+
if (stopped || pageHidden() || !stream)
|
|
50
|
+
return;
|
|
51
|
+
const attempt = new AbortController();
|
|
52
|
+
controller = attempt;
|
|
53
|
+
// A server that sends the count and drops at once is not healthy: it still backs off.
|
|
54
|
+
let healthy = false;
|
|
55
|
+
let events = 0;
|
|
56
|
+
const becomeHealthy = () => {
|
|
57
|
+
clearTimeout(health);
|
|
58
|
+
health = undefined;
|
|
59
|
+
if (healthy)
|
|
60
|
+
return;
|
|
61
|
+
healthy = true;
|
|
62
|
+
failures = 0;
|
|
63
|
+
stopPolling();
|
|
64
|
+
};
|
|
65
|
+
health = setTimeout(becomeHealthy, HEALTHY_MS);
|
|
66
|
+
const ended = () => {
|
|
67
|
+
if (stopped || attempt.signal.aborted)
|
|
68
|
+
return;
|
|
69
|
+
controller = undefined;
|
|
70
|
+
clearTimeout(health);
|
|
71
|
+
health = undefined;
|
|
72
|
+
failures = healthy ? 0 : failures + 1;
|
|
73
|
+
if (failures >= FAILURES_BEFORE_POLLING)
|
|
74
|
+
startPolling();
|
|
75
|
+
const wait = BACKOFF_MS[Math.min(Math.max(failures - 1, 0), BACKOFF_MS.length - 1)];
|
|
76
|
+
retry = setTimeout(() => {
|
|
77
|
+
retry = undefined;
|
|
78
|
+
connect();
|
|
79
|
+
}, wait);
|
|
80
|
+
};
|
|
81
|
+
stream(attempt.signal, (event) => {
|
|
82
|
+
if (stopped || attempt.signal.aborted)
|
|
83
|
+
return;
|
|
84
|
+
events += 1;
|
|
85
|
+
if (events >= 2)
|
|
86
|
+
becomeHealthy();
|
|
87
|
+
onEvent(event);
|
|
88
|
+
}).then(ended, ended);
|
|
89
|
+
};
|
|
90
|
+
const pause = () => {
|
|
91
|
+
controller?.abort();
|
|
92
|
+
controller = undefined;
|
|
93
|
+
clearTimeout(retry);
|
|
94
|
+
retry = undefined;
|
|
95
|
+
clearTimeout(health);
|
|
96
|
+
health = undefined;
|
|
97
|
+
stopPolling();
|
|
98
|
+
};
|
|
99
|
+
const resume = () => {
|
|
100
|
+
refresh();
|
|
101
|
+
if (!client.stream || failures >= FAILURES_BEFORE_POLLING)
|
|
102
|
+
startPolling();
|
|
103
|
+
if (!controller && retry === undefined)
|
|
104
|
+
connect();
|
|
105
|
+
};
|
|
106
|
+
const onVisibility = () => {
|
|
107
|
+
if (pageHidden())
|
|
108
|
+
pause();
|
|
109
|
+
else
|
|
110
|
+
resume();
|
|
111
|
+
};
|
|
112
|
+
document.addEventListener('visibilitychange', onVisibility);
|
|
113
|
+
if (!pageHidden())
|
|
114
|
+
resume();
|
|
115
|
+
return () => {
|
|
116
|
+
stopped = true;
|
|
117
|
+
document.removeEventListener('visibilitychange', onVisibility);
|
|
118
|
+
pause();
|
|
119
|
+
};
|
|
120
|
+
}, [client]);
|
|
121
|
+
return { unread, latest, setUnread };
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=use-notification-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-notification-stream.js","sourceRoot":"","sources":["../../src/notifications/use-notification-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAA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C;QAChB,CAAC,CAAC;QACF,MAAM,MAAM,GAAG,GAAS,EAAE;YACxB,OAAO,EAAE,CAAC;YACV,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ,IAAI,uBAAuB;gBAAE,YAAY,EAAE,CAAC;YAC1E,IAAI,CAAC,UAAU,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,EAAE,CAAC;QACpD,CAAC,CAAC;QACF,MAAM,YAAY,GAAG,GAAS,EAAE;YAC9B,IAAI,UAAU,EAAE;gBAAE,KAAK,EAAE,CAAC;;gBACrB,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC,UAAU,EAAE;YAAE,MAAM,EAAE,CAAC;QAC5B,OAAO,GAAG,EAAE;YACV,OAAO,GAAG,IAAI,CAAC;YACf,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;YAC/D,KAAK,EAAE,CAAC;QACV,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface ShellAccount {
|
|
3
|
+
name: string;
|
|
4
|
+
detail?: string;
|
|
5
|
+
onSignOut: () => void;
|
|
6
|
+
signingOut?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The account row's two lines. With a detail (an email under an organization's name) they
|
|
10
|
+
* are the name and the detail; a name that is itself an email splits at its last @, so the
|
|
11
|
+
* part that tells people apart is never cut off by the domain.
|
|
12
|
+
*/
|
|
13
|
+
export declare function accountLines(account: Pick<ShellAccount, 'name' | 'detail'>): {
|
|
14
|
+
first: string;
|
|
15
|
+
second: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Who is signed in, as one button that opens a menu with the whole name and email and
|
|
19
|
+
* Sign out. In the collapsed sidebar the button is the avatar alone and the menu opens beside it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Account({ account, compact, }: {
|
|
22
|
+
account: ShellAccount;
|
|
23
|
+
compact?: boolean;
|
|
24
|
+
}): ReactElement;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* The account row's two lines. With a detail (an email under an organization's name) they
|
|
5
|
+
* are the name and the detail; a name that is itself an email splits at its last @, so the
|
|
6
|
+
* part that tells people apart is never cut off by the domain.
|
|
7
|
+
*/
|
|
8
|
+
export function accountLines(account) {
|
|
9
|
+
if (account.detail)
|
|
10
|
+
return { first: account.name, second: account.detail };
|
|
11
|
+
const at = account.name.lastIndexOf('@');
|
|
12
|
+
if (at > 0 && at < account.name.length - 1)
|
|
13
|
+
return { first: account.name.slice(0, at), second: account.name.slice(at) };
|
|
14
|
+
return { first: account.name, second: undefined };
|
|
15
|
+
}
|
|
16
|
+
const CHEVRONS = (_jsx("svg", { className: "hl-account__chevron", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M8 10l4-4 4 4M8 14l4 4 4-4" }) }));
|
|
17
|
+
/**
|
|
18
|
+
* Who is signed in, as one button that opens a menu with the whole name and email and
|
|
19
|
+
* Sign out. In the collapsed sidebar the button is the avatar alone and the menu opens beside it.
|
|
20
|
+
*/
|
|
21
|
+
export function Account({ account, compact = false, }) {
|
|
22
|
+
const [open, setOpen] = useState(false);
|
|
23
|
+
const root = useRef(null);
|
|
24
|
+
const button = useRef(null);
|
|
25
|
+
const signOut = useRef(null);
|
|
26
|
+
const menuId = useId();
|
|
27
|
+
const { first, second } = accountLines(account);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!open)
|
|
30
|
+
return;
|
|
31
|
+
signOut.current?.focus();
|
|
32
|
+
const onPointer = (event) => {
|
|
33
|
+
if (!root.current?.contains(event.target))
|
|
34
|
+
setOpen(false);
|
|
35
|
+
};
|
|
36
|
+
document.addEventListener('mousedown', onPointer);
|
|
37
|
+
return () => document.removeEventListener('mousedown', onPointer);
|
|
38
|
+
}, [open]);
|
|
39
|
+
const onKeyDown = (event) => {
|
|
40
|
+
if (event.key !== 'Escape' || !open)
|
|
41
|
+
return;
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
setOpen(false);
|
|
44
|
+
button.current?.focus();
|
|
45
|
+
};
|
|
46
|
+
return (_jsxs("div", { className: "hl-account", ref: root, onKeyDown: onKeyDown, children: [open && (_jsxs("div", { id: menuId, role: "menu", "aria-label": "Account", className: "hl-account__menu", children: [_jsxs("div", { className: "hl-account__head", children: [_jsx("span", { className: "hl-account__caption", children: "Signed in as" }), _jsx("strong", { className: "hl-account__full", children: account.name }), account.detail && _jsx("span", { className: "hl-account__full", children: account.detail })] }), _jsxs("button", { ref: signOut, type: "button", role: "menuitem", className: "hl-signout", disabled: account.signingOut, onClick: account.onSignOut, children: [_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M15 4h3a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-3M10 16l-4-4 4-4M6 12h10" }) }), account.signingOut ? 'Signing out…' : 'Sign out'] })] })), _jsxs("button", { ref: button, type: "button", className: "hl-account__trigger", "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": open ? menuId : undefined, "aria-label": `Account: ${account.name}`, title: compact ? account.name : undefined, onClick: () => setOpen((was) => !was), children: [_jsx("span", { "aria-hidden": "true", className: "hl-avatar", children: account.name.charAt(0).toUpperCase() }), !compact && (_jsxs(_Fragment, { children: [_jsxs("span", { className: "hl-account__text", children: [_jsx("strong", { children: first }), second && _jsx("span", { children: second })] }), CHEVRONS] }))] })] }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=Account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../../src/shell/Account.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAU3D;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAA8C;IAIzE,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IAC3E,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;QACxC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IAC9E,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,QAAQ,GAAG,CACf,cACE,SAAS,EAAC,qBAAqB,EAC/B,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAA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AO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,aAErC,8BAAkB,MAAM,EAAC,SAAS,EAAC,WAAW,YAC3C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAChC,EACN,CAAC,OAAO,IAAI,CACX,8BACE,gBAAM,SAAS,EAAC,kBAAkB,aAChC,2BAAS,KAAK,GAAU,EACvB,MAAM,IAAI,yBAAO,MAAM,GAAQ,IAC3B,EACN,QAAQ,IACR,CACJ,IACM,IACL,CACP,CAAC;AACJ,CAAC"}
|
package/dist/shell/AppShell.d.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { ShellAccount } from './Account.js';
|
|
2
3
|
import type { SearchEntry } from './ShellSearch.js';
|
|
3
4
|
import type { NavGroup } from './nav.js';
|
|
4
|
-
export
|
|
5
|
-
name: string;
|
|
6
|
-
detail?: string;
|
|
7
|
-
onSignOut: () => void;
|
|
8
|
-
signingOut?: boolean;
|
|
9
|
-
}
|
|
5
|
+
export type { ShellAccount } from './Account.js';
|
|
10
6
|
/**
|
|
11
7
|
* The dashboards' frame: the sidebar (brand, grouped pages, the theme switch, the account),
|
|
12
|
-
* a top bar (search and a status chip) and the page. On a
|
|
8
|
+
* a top bar (search, the notifications slot and a status chip) and the page. On a computer the
|
|
9
|
+
* sidebar collapses to a strip of icons (remembered in this browser). Below 1024px (phones and
|
|
10
|
+
* tablets) there is no sidebar: a bottom bar has the pages marked `bottom` and More (the rest,
|
|
11
|
+
* the theme and the account), and the top bar is one row of the logo, a search button, the
|
|
12
|
+
* notifications slot and the status chip.
|
|
13
|
+
* Keyboard: ⌘K or / search, ⌘B the sidebar, ⇧⌘L the theme, N notifications, G then a letter
|
|
14
|
+
* a page, ? the list of them all (Ctrl for ⌘ off a Mac).
|
|
13
15
|
*/
|
|
14
16
|
export declare function AppShell(props: {
|
|
15
17
|
brand: ReactNode;
|
|
18
|
+
/** The logo alone, for the collapsed sidebar; without it the strip shows no logo. */
|
|
19
|
+
brandMark?: ReactNode;
|
|
16
20
|
nav: NavGroup[];
|
|
17
21
|
account: ShellAccount;
|
|
18
22
|
statusChip?: ReactNode;
|
|
23
|
+
/** The notification bell (or anything), in the top bar before the status chip. */
|
|
24
|
+
notifications?: ReactNode;
|
|
19
25
|
/** Pages the top bar's search finds besides the nav's own. */
|
|
20
26
|
searchEntries?: SearchEntry[];
|
|
21
27
|
children: ReactNode;
|
package/dist/shell/AppShell.js
CHANGED
|
@@ -1,96 +1,170 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { Link, useLocation } from 'react-router-dom';
|
|
4
|
-
import {
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import { ThemeCycle, ThemeSwitch, nextTheme } from '../theme/ThemeSwitch.js';
|
|
6
|
+
import { useTheme } from '../theme/theme-choice.js';
|
|
7
|
+
import { Account } from './Account.js';
|
|
5
8
|
import { ShellSearch } from './ShellSearch.js';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!list)
|
|
17
|
-
return;
|
|
18
|
-
const onChange = () => setNarrow(list.matches);
|
|
19
|
-
list.addEventListener('change', onChange);
|
|
20
|
-
return () => list.removeEventListener('change', onChange);
|
|
21
|
-
}, []);
|
|
22
|
-
return narrow;
|
|
23
|
-
}
|
|
24
|
-
function Items({ items, pathname, current, }) {
|
|
25
|
-
return (_jsx("ul", { children: items.map((item) => (_jsxs("li", { children: [_jsxs(Link, { to: item.to, "aria-current": item.to === current ? 'page' : undefined, children: [item.icon, item.label] }), item.children && isUnder(pathname, item.to) && (_jsx(Items, { items: item.children, pathname: pathname, current: current }))] }, item.to))) }));
|
|
9
|
+
import { ShortcutsDialog } from './ShortcutsDialog.js';
|
|
10
|
+
import { MobileNav } from './BottomNav.js';
|
|
11
|
+
import { useNarrow } from './breakpoint.js';
|
|
12
|
+
import { trapTab, useScrollLock } from './focus-trap.js';
|
|
13
|
+
import { currentPage, flattenNav, isUnder } from './nav.js';
|
|
14
|
+
import { useSidebarCollapsed } from './sidebar-state.js';
|
|
15
|
+
import { GO_WINDOW_MS, goKeys, isMac, isTyping, keyNames } from './shortcuts.js';
|
|
16
|
+
function Items({ items, pathname, current, collapsed, }) {
|
|
17
|
+
return (_jsx("ul", { children: items.map((item) => (_jsxs("li", { children: [_jsxs(Link, { to: item.to, "aria-current": item.to === current ? 'page' : undefined, title: collapsed ? item.label : undefined, children: [item.icon ??
|
|
18
|
+
(collapsed && (_jsx("span", { "aria-hidden": "true", className: "hl-nav__initial", children: item.label.charAt(0).toUpperCase() }))), _jsx("span", { className: collapsed ? 'hl-sr-only' : undefined, children: item.label })] }), !collapsed && item.children && isUnder(pathname, item.to) && (_jsx(Items, { items: item.children, pathname: pathname, current: current, collapsed: collapsed }))] }, item.to))) }));
|
|
26
19
|
}
|
|
27
|
-
function Nav({ groups }) {
|
|
20
|
+
function Nav({ groups, collapsed }) {
|
|
28
21
|
const { pathname } = useLocation();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.filter((item) => isUnder(pathname, item.to))
|
|
33
|
-
.sort((a, b) => b.to.length - a.to.length)[0]?.to;
|
|
34
|
-
return (_jsx("nav", { "aria-label": "Main", className: "hl-nav", children: groups.map((group, i) => (_jsxs("div", { children: [group.label && _jsx("p", { className: "hl-nav__group", children: group.label }), _jsx(Items, { items: group.items, pathname: pathname, current: current })] }, group.label ?? `group-${String(i)}`))) }));
|
|
35
|
-
}
|
|
36
|
-
/** Who is signed in, and Sign out: a plain button, always in view. */
|
|
37
|
-
function Account({ account }) {
|
|
38
|
-
return (_jsxs("div", { className: "hl-account", children: [_jsxs("div", { className: "hl-account__who", children: [_jsx("span", { "aria-hidden": "true", className: "hl-avatar", children: account.name.charAt(0).toUpperCase() }), _jsxs("span", { className: "hl-account__text", children: [_jsx("strong", { children: account.name }), account.detail && _jsx("span", { children: account.detail })] })] }), _jsx("button", { type: "button", className: "hl-signout", disabled: account.signingOut, onClick: account.onSignOut, children: "Sign out" })] }));
|
|
22
|
+
const current = currentPage(flattenNav(groups), pathname);
|
|
23
|
+
return (_jsx("nav", { "aria-label": "Main", className: "hl-nav", children: groups.map((group, i) => (_jsxs("div", { children: [group.label &&
|
|
24
|
+
(collapsed ? (i > 0 && _jsx("hr", { className: "hl-nav__divider" })) : (_jsx("p", { className: "hl-nav__group", children: group.label }))), _jsx(Items, { items: group.items, pathname: pathname, current: current, collapsed: collapsed })] }, group.label ?? `group-${String(i)}`))) }));
|
|
39
25
|
}
|
|
26
|
+
const PANEL_ICON = (opening) => (_jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "3" }), _jsx("path", { d: opening ? 'M9 4v16M14 10l2 2-2 2' : 'M9 4v16M16 10l-2 2 2 2' })] }));
|
|
40
27
|
function SidebarBody(props) {
|
|
41
|
-
|
|
28
|
+
const collapsed = props.collapse.collapsed;
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "hl-brand-row", children: [collapsed ? (props.brandMark && (_jsx(Link, { to: "/", className: "hl-brand", "aria-label": "Start page", children: props.brandMark }))) : (_jsx(Link, { to: "/", className: "hl-brand", children: props.brand })), _jsx("button", { type: "button", className: "hl-sidebar-toggle", "aria-label": collapsed ? 'Expand sidebar' : 'Collapse sidebar', "aria-keyshortcuts": "Meta+B Control+B", title: `${collapsed ? 'Expand' : 'Collapse'} sidebar (${props.collapse.mod}B)`, onClick: props.collapse.toggle, children: PANEL_ICON(collapsed) })] }), _jsx(Nav, { groups: props.nav, collapsed: collapsed }), _jsxs("div", { className: "hl-sidebar__foot", children: [collapsed ? (_jsx(ThemeCycle, {})) : (_jsxs("div", { className: "hl-theme-row", children: [_jsx("span", { children: "Theme" }), _jsx(ThemeSwitch, {})] })), _jsx(Account, { account: props.account, compact: collapsed })] })] }));
|
|
42
30
|
}
|
|
43
|
-
const
|
|
44
|
-
/**
|
|
45
|
-
|
|
31
|
+
const SEARCH_ICON = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": "true", children: [_jsx("circle", { cx: "11", cy: "11", r: "7" }), _jsx("path", { d: "M20 20l-3.5-3.5" })] }));
|
|
32
|
+
/**
|
|
33
|
+
* The phone and tablet search: the top bar's search over the page, full width, on its input.
|
|
34
|
+
* Escape, Back or the backdrop close it; picking a page closes it too (the address changes).
|
|
35
|
+
*/
|
|
36
|
+
function SearchOverlay(props) {
|
|
46
37
|
const ref = useRef(null);
|
|
38
|
+
useScrollLock();
|
|
47
39
|
useEffect(() => {
|
|
48
|
-
ref.current?.querySelector(
|
|
40
|
+
ref.current?.querySelector('input')?.focus();
|
|
49
41
|
}, []);
|
|
50
42
|
const onKeyDown = (event) => {
|
|
51
43
|
if (event.key === 'Escape') {
|
|
44
|
+
event.stopPropagation();
|
|
52
45
|
props.onClose();
|
|
53
46
|
return;
|
|
54
47
|
}
|
|
55
|
-
|
|
56
|
-
return;
|
|
57
|
-
const items = [...ref.current.querySelectorAll(FOCUSABLE)];
|
|
58
|
-
const first = items[0];
|
|
59
|
-
const last = items[items.length - 1];
|
|
60
|
-
if (!first || !last)
|
|
61
|
-
return;
|
|
62
|
-
if (!event.shiftKey && document.activeElement === last) {
|
|
63
|
-
event.preventDefault();
|
|
64
|
-
first.focus();
|
|
65
|
-
}
|
|
66
|
-
else if (event.shiftKey && document.activeElement === first) {
|
|
67
|
-
event.preventDefault();
|
|
68
|
-
last.focus();
|
|
69
|
-
}
|
|
48
|
+
trapTab(event, ref.current);
|
|
70
49
|
};
|
|
71
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "hl-
|
|
50
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "hl-search-backdrop", onClick: props.onClose, "aria-hidden": "true" }), _jsxs("div", { ref: ref, role: "dialog", "aria-modal": "true", "aria-label": "Search", className: "hl-search-overlay", onKeyDown: onKeyDown, children: [_jsx("button", { type: "button", className: "hl-search-close", "aria-label": "Close search", onClick: props.onClose, children: _jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M19 12H5M11 18l-6-6 6-6" }) }) }), _jsx(ShellSearch, { entries: props.entries, inputRef: props.inputRef })] })] }));
|
|
72
51
|
}
|
|
73
52
|
/**
|
|
74
53
|
* The dashboards' frame: the sidebar (brand, grouped pages, the theme switch, the account),
|
|
75
|
-
* a top bar (search and a status chip) and the page. On a
|
|
54
|
+
* a top bar (search, the notifications slot and a status chip) and the page. On a computer the
|
|
55
|
+
* sidebar collapses to a strip of icons (remembered in this browser). Below 1024px (phones and
|
|
56
|
+
* tablets) there is no sidebar: a bottom bar has the pages marked `bottom` and More (the rest,
|
|
57
|
+
* the theme and the account), and the top bar is one row of the logo, a search button, the
|
|
58
|
+
* notifications slot and the status chip.
|
|
59
|
+
* Keyboard: ⌘K or / search, ⌘B the sidebar, ⇧⌘L the theme, N notifications, G then a letter
|
|
60
|
+
* a page, ? the list of them all (Ctrl for ⌘ off a Mac).
|
|
76
61
|
*/
|
|
77
62
|
export function AppShell(props) {
|
|
78
63
|
const narrow = useNarrow();
|
|
79
|
-
const [
|
|
80
|
-
const
|
|
64
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
65
|
+
const [helpOpen, setHelpOpen] = useState(false);
|
|
66
|
+
const [collapsedChoice, toggleCollapsed] = useSidebarCollapsed();
|
|
67
|
+
const collapsed = !narrow && collapsedChoice;
|
|
68
|
+
const { choice, setChoice } = useTheme();
|
|
69
|
+
const navigate = useNavigate();
|
|
70
|
+
const searchButton = useRef(null);
|
|
71
|
+
const searchInput = useRef(null);
|
|
72
|
+
const topbar = useRef(null);
|
|
73
|
+
const goPressedAt = useRef(0);
|
|
74
|
+
const helpReturn = useRef(null);
|
|
75
|
+
const keys = useMemo(() => keyNames(isMac()), []);
|
|
81
76
|
const { pathname } = useLocation();
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
const closeSearch = useCallback(() => {
|
|
78
|
+
setSearchOpen(false);
|
|
79
|
+
searchButton.current?.focus();
|
|
80
|
+
}, []);
|
|
81
|
+
const closeHelp = useCallback(() => {
|
|
82
|
+
setHelpOpen(false);
|
|
83
|
+
helpReturn.current?.focus();
|
|
85
84
|
}, []);
|
|
86
85
|
useEffect(() => {
|
|
87
|
-
|
|
86
|
+
setSearchOpen(false);
|
|
88
87
|
}, [pathname]);
|
|
88
|
+
// The search box's own place changes with the layout: an open overlay goes with it.
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!narrow)
|
|
91
|
+
setSearchOpen(false);
|
|
92
|
+
}, [narrow]);
|
|
93
|
+
const pages = useMemo(() => flattenNav(props.nav), [props.nav]);
|
|
94
|
+
const go = useMemo(() => goKeys(pages), [pages]);
|
|
89
95
|
const entries = useMemo(() => [
|
|
90
|
-
...
|
|
96
|
+
...pages.map((item) => ({ label: item.label, to: item.to })),
|
|
91
97
|
...(props.searchEntries ?? []),
|
|
92
|
-
], [
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
], [pages, props.searchEntries]);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
const openHelp = () => {
|
|
101
|
+
helpReturn.current = document.activeElement;
|
|
102
|
+
setHelpOpen(true);
|
|
103
|
+
};
|
|
104
|
+
const onKeyDown = (event) => {
|
|
105
|
+
if (event.defaultPrevented || event.isComposing || helpOpen || searchOpen)
|
|
106
|
+
return;
|
|
107
|
+
const focusSearch = () => {
|
|
108
|
+
if (narrow)
|
|
109
|
+
setSearchOpen(true);
|
|
110
|
+
else
|
|
111
|
+
searchInput.current?.focus();
|
|
112
|
+
};
|
|
113
|
+
const key = event.key.toLowerCase();
|
|
114
|
+
const mod = event.metaKey || event.ctrlKey;
|
|
115
|
+
if (mod && !event.altKey) {
|
|
116
|
+
if (key === 'k' && !event.shiftKey) {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
focusSearch();
|
|
119
|
+
}
|
|
120
|
+
else if (key === 'b' && !event.shiftKey && !narrow && !isTyping(event.target)) {
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
toggleCollapsed();
|
|
123
|
+
}
|
|
124
|
+
else if (key === 'l' && event.shiftKey) {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
setChoice(nextTheme(choice));
|
|
127
|
+
}
|
|
128
|
+
else if (key === '/') {
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
openHelp();
|
|
131
|
+
}
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (event.altKey || isTyping(event.target))
|
|
135
|
+
return;
|
|
136
|
+
const pendingGo = Date.now() - goPressedAt.current < GO_WINDOW_MS;
|
|
137
|
+
goPressedAt.current = 0;
|
|
138
|
+
if (pendingGo) {
|
|
139
|
+
const target = go.find((g) => g.key === key);
|
|
140
|
+
if (target) {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
navigate(target.item.to);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (event.key === '/') {
|
|
147
|
+
event.preventDefault();
|
|
148
|
+
focusSearch();
|
|
149
|
+
}
|
|
150
|
+
else if (event.key === '?') {
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
openHelp();
|
|
153
|
+
}
|
|
154
|
+
else if (key === 'g' && !event.shiftKey) {
|
|
155
|
+
goPressedAt.current = Date.now();
|
|
156
|
+
}
|
|
157
|
+
else if (key === 'n' && !event.shiftKey) {
|
|
158
|
+
const bell = topbar.current?.querySelector('.hl-notify__bell[aria-expanded="false"]');
|
|
159
|
+
if (bell) {
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
bell.click();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
window.addEventListener('keydown', onKeyDown);
|
|
166
|
+
return () => window.removeEventListener('keydown', onKeyDown);
|
|
167
|
+
}, [helpOpen, searchOpen, narrow, toggleCollapsed, choice, setChoice, go, navigate]);
|
|
168
|
+
return (_jsxs("div", { className: "hl-shell", "data-narrow": narrow ? '' : undefined, children: [_jsx("a", { className: "hl-skip", href: "#main", children: "Skip to the page" }), !narrow && (_jsx("aside", { className: "hl-sidebar", "data-collapsed": collapsed ? '' : undefined, children: _jsx(SidebarBody, { brand: props.brand, brandMark: props.brandMark, nav: props.nav, account: props.account, collapse: { collapsed, toggle: toggleCollapsed, mod: keys.mod } }) })), _jsxs("div", { className: "hl-content", children: [_jsxs("header", { ref: topbar, className: "hl-topbar", "data-narrow": narrow ? '' : undefined, children: [narrow ? (_jsx(Link, { to: "/", className: "hl-brand", "aria-label": props.brandMark ? 'Start page' : undefined, children: props.brandMark ?? props.brand })) : (_jsx(ShellSearch, { entries: entries, inputRef: searchInput, hint: `${keys.mod === '⌘' ? '⌘' : 'Ctrl '}K` })), (narrow || props.notifications || props.statusChip) && (_jsxs("div", { className: "hl-topbar__end", children: [narrow && (_jsx("button", { ref: searchButton, type: "button", className: "hl-search-button", "aria-label": "Search", "aria-haspopup": "dialog", "aria-expanded": searchOpen, onClick: () => setSearchOpen(true), children: SEARCH_ICON })), props.notifications, props.statusChip] }))] }), _jsx("div", { id: "main", className: "hl-main", tabIndex: -1, children: props.children })] }), narrow && _jsx(MobileNav, { nav: props.nav, account: props.account }), narrow && searchOpen && (_jsx(SearchOverlay, { entries: entries, inputRef: searchInput, onClose: closeSearch })), helpOpen && (_jsx(ShortcutsDialog, { mod: keys.mod, shift: keys.shift, go: go, canCollapse: !narrow, hasNotifications: Boolean(props.notifications), onClose: closeHelp }))] }));
|
|
95
169
|
}
|
|
96
170
|
//# sourceMappingURL=AppShell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.js","sourceRoot":"","sources":["../../src/shell/AppShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,MAAM,GAAG,oBAAoB,CAAC;AAEpC,qEAAqE;AACrE,SAAS,SAAS;IAChB,MAAM,KAAK,GAAG,GAA0B,EAAE,CACxC,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;QACtE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QAC3B,CAAC,CAAC,IAAI,CAAC;IACX,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,OAAO,IAAI,KAAK,CAAC,CAAC;IACtE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,MAAM,QAAQ,GAAG,GAAS,EAA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Q,EACb,SAAS,EAAC,kBAAkB,gBACjB,QAAQ,mBACL,QAAQ,mBACP,UAAU,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,YAEjC,WAAW,GACL,CACV,EACA,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,UAAU,IACb,CACP,IACM,EAET,cAAK,EAAE,EAAC,MAAM,EAAC,SAAS,EAAC,SAAS,EAAC,QAAQ,EAAE,CAAC,CAAC,YAC5C,KAAK,CAAC,QAAQ,GACX,IACF,EACL,MAAM,IAAI,KAAC,SAAS,IAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,GAAI,EAC/D,MAAM,IAAI,UAAU,IAAI,CACvB,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAI,CACjF,EACA,QAAQ,IAAI,CACX,KAAC,eAAe,IACd,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,CAAC,MAAM,EACpB,gBAAgB,EAAE,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EAC9C,OAAO,EAAE,SAAS,GAClB,CACH,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReactElement, Ref } from 'react';
|
|
2
|
+
import type { ShellAccount } from './Account.js';
|
|
3
|
+
import type { NavGroup, NavItem } from './nav.js';
|
|
4
|
+
/**
|
|
5
|
+
* The phone and tablet bar at the bottom of the screen: up to 4 pages, each an icon over its
|
|
6
|
+
* name (a neutral square when it has no icon), then More. `current` is the page open; by
|
|
7
|
+
* default the deepest of `items` that `pathname` is under.
|
|
8
|
+
*/
|
|
9
|
+
export declare function BottomNav(props: {
|
|
10
|
+
items: NavItem[];
|
|
11
|
+
pathname: string;
|
|
12
|
+
current?: string;
|
|
13
|
+
onMore: () => void;
|
|
14
|
+
/** For giving focus back to More when the sheet it opens closes. */
|
|
15
|
+
moreRef?: Ref<HTMLButtonElement>;
|
|
16
|
+
/** Whether the sheet More opens is open. */
|
|
17
|
+
moreOpen?: boolean;
|
|
18
|
+
/** Marks More: the page open is one of those under it. */
|
|
19
|
+
moreCurrent?: boolean;
|
|
20
|
+
/** A query string every link keeps, such as Shopify's `?host=…&shop=…`. */
|
|
21
|
+
search?: string;
|
|
22
|
+
}): ReactElement;
|
|
23
|
+
/**
|
|
24
|
+
* The bottom bar and the More sheet together, as the dashboards and the embedded Shopify app
|
|
25
|
+
* use them below 1024px: the bar has the pages marked `bottom` (or the first 4), the sheet
|
|
26
|
+
* the rest, the theme switch and, given an account, who is signed in with Sign out.
|
|
27
|
+
*/
|
|
28
|
+
export declare function MobileNav(props: {
|
|
29
|
+
nav: NavGroup[];
|
|
30
|
+
/** Absent inside Shopify admin, where there is nobody to sign out. */
|
|
31
|
+
account?: ShellAccount;
|
|
32
|
+
/** A query string every link keeps, such as Shopify's `?host=…&shop=…`. */
|
|
33
|
+
search?: string;
|
|
34
|
+
}): ReactElement;
|