pixelize-design-library 3.0.0 → 3.1.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/CHANGELOG.md +64 -1
- package/COMPONENT-GOTCHAS.md +37 -13
- package/DESIGN-GUIDE.md +4 -1
- package/dist/Components/NotificationBell/NotificationBellProps.d.ts +3 -3
- package/dist/Components/NotificationBell/NotificationItem.d.ts +1 -1
- package/dist/Components/NotificationBell/NotificationItem.js +1 -1
- package/dist/Components/NotificationBell/NotificationList.d.ts +1 -1
- package/dist/Components/NotificationBell/NotificationList.js +1 -1
- package/dist/Components/NotificationBell/NotificationPanel.d.ts +1 -1
- package/dist/Components/NotificationBell/NotificationPanel.js +1 -1
- package/dist/Components/NotificationCenter/center/CenterPanel.d.ts +15 -0
- package/dist/Components/NotificationCenter/center/CenterPanel.js +87 -0
- package/dist/Components/NotificationCenter/center/NotificationCenter.d.ts +4 -0
- package/dist/Components/NotificationCenter/center/NotificationCenter.js +130 -0
- package/dist/Components/NotificationCenter/center/NotificationCenterProps.d.ts +71 -0
- package/dist/Components/NotificationCenter/center/NotificationCenterProps.js +2 -0
- package/dist/Components/NotificationCenter/center/PanelRows.d.ts +10 -0
- package/dist/Components/NotificationCenter/center/PanelRows.js +35 -0
- package/dist/Components/NotificationCenter/center/PanelStates.d.ts +17 -0
- package/dist/Components/NotificationCenter/center/PanelStates.js +21 -0
- package/dist/Components/NotificationCenter/center/centerLabels.d.ts +4 -0
- package/dist/Components/NotificationCenter/center/centerLabels.js +38 -0
- package/dist/Components/NotificationCenter/center/useArrivals.d.ts +14 -0
- package/dist/Components/NotificationCenter/center/useArrivals.js +71 -0
- package/dist/Components/NotificationCenter/center/useIsSheet.d.ts +2 -0
- package/dist/Components/NotificationCenter/center/useIsSheet.js +20 -0
- package/dist/Components/NotificationCenter/core/NotificationCenterProvider.d.ts +17 -0
- package/dist/Components/NotificationCenter/core/NotificationCenterProvider.js +46 -0
- package/dist/Components/NotificationCenter/core/NotificationEngineProps.d.ts +182 -0
- package/dist/Components/NotificationCenter/core/NotificationEngineProps.js +2 -0
- package/dist/Components/NotificationCenter/core/NotificationSourceProps.d.ts +284 -0
- package/dist/Components/NotificationCenter/core/NotificationSourceProps.js +2 -0
- package/dist/Components/NotificationCenter/core/actionError.d.ts +4 -0
- package/dist/Components/NotificationCenter/core/actionError.js +45 -0
- package/dist/Components/NotificationCenter/core/format.d.ts +4 -0
- package/dist/Components/NotificationCenter/core/format.js +91 -0
- package/dist/Components/NotificationCenter/core/grouping.d.ts +14 -0
- package/dist/Components/NotificationCenter/core/grouping.js +102 -0
- package/dist/Components/NotificationCenter/core/labels.d.ts +6 -0
- package/dist/Components/NotificationCenter/core/labels.js +94 -0
- package/dist/Components/NotificationCenter/core/overlay.d.ts +109 -0
- package/dist/Components/NotificationCenter/core/overlay.js +281 -0
- package/dist/Components/NotificationCenter/core/useNotificationEngine.d.ts +13 -0
- package/dist/Components/NotificationCenter/core/useNotificationEngine.js +415 -0
- package/dist/Components/NotificationCenter/inbox/InboxList.d.ts +17 -0
- package/dist/Components/NotificationCenter/inbox/InboxList.js +25 -0
- package/dist/Components/NotificationCenter/inbox/InboxStates.d.ts +17 -0
- package/dist/Components/NotificationCenter/inbox/InboxStates.js +27 -0
- package/dist/Components/NotificationCenter/inbox/NotificationInbox.d.ts +4 -0
- package/dist/Components/NotificationCenter/inbox/NotificationInbox.js +434 -0
- package/dist/Components/NotificationCenter/inbox/NotificationInboxProps.d.ts +106 -0
- package/dist/Components/NotificationCenter/inbox/NotificationInboxProps.js +2 -0
- package/dist/Components/NotificationCenter/inbox/ShortcutsDialog.d.ts +8 -0
- package/dist/Components/NotificationCenter/inbox/ShortcutsDialog.js +63 -0
- package/dist/Components/NotificationCenter/inbox/inboxLabels.d.ts +4 -0
- package/dist/Components/NotificationCenter/inbox/inboxLabels.js +56 -0
- package/dist/Components/NotificationCenter/inbox/inboxModel.d.ts +17 -0
- package/dist/Components/NotificationCenter/inbox/inboxModel.js +47 -0
- package/dist/Components/NotificationCenter/inbox/useControllable.d.ts +1 -0
- package/dist/Components/NotificationCenter/inbox/useControllable.js +15 -0
- package/dist/Components/NotificationCenter/index.d.ts +8 -0
- package/dist/Components/NotificationCenter/index.js +26 -0
- package/dist/Components/NotificationCenter/preferences/NotificationPreferences.d.ts +4 -0
- package/dist/Components/NotificationCenter/preferences/NotificationPreferences.js +72 -0
- package/dist/Components/NotificationCenter/preferences/NotificationPreferencesProps.d.ts +111 -0
- package/dist/Components/NotificationCenter/preferences/NotificationPreferencesProps.js +2 -0
- package/dist/Components/NotificationCenter/preferences/PreferenceCells.d.ts +16 -0
- package/dist/Components/NotificationCenter/preferences/PreferenceCells.js +35 -0
- package/dist/Components/NotificationCenter/preferences/PreferenceGroups.d.ts +15 -0
- package/dist/Components/NotificationCenter/preferences/PreferenceGroups.js +26 -0
- package/dist/Components/NotificationCenter/preferences/preferencesLabels.d.ts +2 -0
- package/dist/Components/NotificationCenter/preferences/preferencesLabels.js +28 -0
- package/dist/Components/NotificationCenter/preferences/useAutosave.d.ts +8 -0
- package/dist/Components/NotificationCenter/preferences/useAutosave.js +41 -0
- package/dist/Components/NotificationCenter/row/NotificationDetail.d.ts +4 -0
- package/dist/Components/NotificationCenter/row/NotificationDetail.js +65 -0
- package/dist/Components/NotificationCenter/row/NotificationDetailProps.d.ts +15 -0
- package/dist/Components/NotificationCenter/row/NotificationDetailProps.js +2 -0
- package/dist/Components/NotificationCenter/row/NotificationRow.d.ts +3 -0
- package/dist/Components/NotificationCenter/row/NotificationRow.js +124 -0
- package/dist/Components/NotificationCenter/row/NotificationRowProps.d.ts +33 -0
- package/dist/Components/NotificationCenter/row/NotificationRowProps.js +2 -0
- package/dist/Components/NotificationCenter/row/ReasonForm.d.ts +14 -0
- package/dist/Components/NotificationCenter/row/ReasonForm.js +59 -0
- package/dist/Components/NotificationCenter/row/RowActions.d.ts +16 -0
- package/dist/Components/NotificationCenter/row/RowActions.js +36 -0
- package/dist/Components/NotificationCenter/row/RowQuickActions.d.ts +17 -0
- package/dist/Components/NotificationCenter/row/RowQuickActions.js +57 -0
- package/dist/Components/NotificationCenter/row/RowStatus.d.ts +10 -0
- package/dist/Components/NotificationCenter/row/RowStatus.js +42 -0
- package/dist/Components/NotificationCenter/row/category.d.ts +8 -0
- package/dist/Components/NotificationCenter/row/category.js +13 -0
- package/dist/Components/NotificationCenter/row/rowMenu.d.ts +14 -0
- package/dist/Components/NotificationCenter/row/rowMenu.js +37 -0
- package/dist/Components/NotificationCenter/row/rowParts.d.ts +40 -0
- package/dist/Components/NotificationCenter/row/rowParts.js +72 -0
- package/dist/Components/NotificationCenter/row/rowStyles.d.ts +11 -0
- package/dist/Components/NotificationCenter/row/rowStyles.js +25 -0
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +4 -0
- package/dist/Components/SegmentedControl/segmentedInk.js +16 -2
- package/dist/Components/SideBar/SecondaryBar.js +2 -2
- package/dist/Components/SideBar/SideBar.js +18 -8
- package/dist/Components/SideBar/SideBarProps.d.ts +4 -2
- package/dist/Components/SideBar/components/MenuItemBox.d.ts +0 -2
- package/dist/Components/SideBar/components/MenuItemBox.js +2 -3
- package/dist/Components/SideBar/components/MenuItems.js +2 -2
- package/dist/Components/SideBar/components/PinnedSection.js +3 -4
- package/dist/Components/SideBar/sidebarScale.d.ts +0 -2
- package/dist/Components/SideBar/sidebarScale.js +0 -2
- package/dist/Components/Switch/Switch.d.ts +1 -1
- package/dist/Components/Switch/Switch.js +2 -2
- package/dist/Components/Switch/SwitchProps.d.ts +3 -0
- package/dist/Components/Toggle/TableToggle.js +4 -5
- package/dist/Components/Toggle/tableToggleInk.d.ts +7 -0
- package/dist/Components/Toggle/tableToggleInk.js +28 -0
- package/dist/esm/Components/NotificationBell/NotificationItem.js +1 -1
- package/dist/esm/Components/NotificationBell/NotificationList.js +1 -1
- package/dist/esm/Components/NotificationBell/NotificationPanel.js +1 -1
- package/dist/esm/Components/NotificationCenter/center/CenterPanel.js +81 -0
- package/dist/esm/Components/NotificationCenter/center/NotificationCenter.js +92 -0
- package/dist/esm/Components/NotificationCenter/center/NotificationCenterProps.js +1 -0
- package/dist/esm/Components/NotificationCenter/center/PanelRows.js +28 -0
- package/dist/esm/Components/NotificationCenter/center/PanelStates.js +11 -0
- package/dist/esm/Components/NotificationCenter/center/centerLabels.js +34 -0
- package/dist/esm/Components/NotificationCenter/center/useArrivals.js +67 -0
- package/dist/esm/Components/NotificationCenter/center/useIsSheet.js +16 -0
- package/dist/esm/Components/NotificationCenter/core/NotificationCenterProvider.js +35 -0
- package/dist/esm/Components/NotificationCenter/core/NotificationEngineProps.js +1 -0
- package/dist/esm/Components/NotificationCenter/core/NotificationSourceProps.js +1 -0
- package/dist/esm/Components/NotificationCenter/core/actionError.js +39 -0
- package/dist/esm/Components/NotificationCenter/core/format.js +87 -0
- package/dist/esm/Components/NotificationCenter/core/grouping.js +88 -0
- package/dist/esm/Components/NotificationCenter/core/labels.js +88 -0
- package/dist/esm/Components/NotificationCenter/core/overlay.js +274 -0
- package/dist/esm/Components/NotificationCenter/core/useNotificationEngine.js +408 -0
- package/dist/esm/Components/NotificationCenter/inbox/InboxList.js +18 -0
- package/dist/esm/Components/NotificationCenter/inbox/InboxStates.js +18 -0
- package/dist/esm/Components/NotificationCenter/inbox/NotificationInbox.js +396 -0
- package/dist/esm/Components/NotificationCenter/inbox/NotificationInboxProps.js +1 -0
- package/dist/esm/Components/NotificationCenter/inbox/ShortcutsDialog.js +23 -0
- package/dist/esm/Components/NotificationCenter/inbox/inboxLabels.js +52 -0
- package/dist/esm/Components/NotificationCenter/inbox/inboxModel.js +37 -0
- package/dist/esm/Components/NotificationCenter/inbox/useControllable.js +11 -0
- package/dist/esm/Components/NotificationCenter/index.js +8 -0
- package/dist/esm/Components/NotificationCenter/preferences/NotificationPreferences.js +67 -0
- package/dist/esm/Components/NotificationCenter/preferences/NotificationPreferencesProps.js +1 -0
- package/dist/esm/Components/NotificationCenter/preferences/PreferenceCells.js +27 -0
- package/dist/esm/Components/NotificationCenter/preferences/PreferenceGroups.js +21 -0
- package/dist/esm/Components/NotificationCenter/preferences/preferencesLabels.js +24 -0
- package/dist/esm/Components/NotificationCenter/preferences/useAutosave.js +37 -0
- package/dist/esm/Components/NotificationCenter/row/NotificationDetail.js +60 -0
- package/dist/esm/Components/NotificationCenter/row/NotificationDetailProps.js +1 -0
- package/dist/esm/Components/NotificationCenter/row/NotificationRow.js +119 -0
- package/dist/esm/Components/NotificationCenter/row/NotificationRowProps.js +1 -0
- package/dist/esm/Components/NotificationCenter/row/ReasonForm.js +52 -0
- package/dist/esm/Components/NotificationCenter/row/RowActions.js +28 -0
- package/dist/esm/Components/NotificationCenter/row/RowQuickActions.js +49 -0
- package/dist/esm/Components/NotificationCenter/row/RowStatus.js +35 -0
- package/dist/esm/Components/NotificationCenter/row/category.js +9 -0
- package/dist/esm/Components/NotificationCenter/row/rowMenu.js +30 -0
- package/dist/esm/Components/NotificationCenter/row/rowParts.js +59 -0
- package/dist/esm/Components/NotificationCenter/row/rowStyles.js +19 -0
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +15 -2
- package/dist/esm/Components/SideBar/SecondaryBar.js +3 -3
- package/dist/esm/Components/SideBar/SideBar.js +18 -8
- package/dist/esm/Components/SideBar/components/MenuItemBox.js +2 -3
- package/dist/esm/Components/SideBar/components/MenuItems.js +2 -2
- package/dist/esm/Components/SideBar/components/PinnedSection.js +3 -4
- package/dist/esm/Components/SideBar/sidebarScale.js +0 -2
- package/dist/esm/Components/Switch/Switch.js +2 -2
- package/dist/esm/Components/Toggle/TableToggle.js +4 -5
- package/dist/esm/Components/Toggle/tableToggleInk.js +24 -0
- package/dist/esm/index.js +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +16 -3
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDecision = exports.visibleActionsFor = exports.quickActionsFor = exports.rowScope = void 0;
|
|
4
|
+
const lucide_react_1 = require("lucide-react");
|
|
5
|
+
const grouping_1 = require("../core/grouping");
|
|
6
|
+
const rowScope = (item, thread, isThreadOpen) => (thread && !isThreadOpen ? (0, grouping_1.threadEntries)(thread) : [item]);
|
|
7
|
+
exports.rowScope = rowScope;
|
|
8
|
+
const quickActionsFor = (item, scope, shared) => {
|
|
9
|
+
const { features, labels, actions } = shared;
|
|
10
|
+
const { entry, state } = item;
|
|
11
|
+
const ids = scope.map((member) => member.entry.id);
|
|
12
|
+
const list = [];
|
|
13
|
+
if (features.markRead && entry.isRead !== undefined) {
|
|
14
|
+
const unread = scope.some((member) => member.entry.isRead === false);
|
|
15
|
+
list.push({
|
|
16
|
+
id: "read",
|
|
17
|
+
label: unread ? labels.markRead : labels.markUnread,
|
|
18
|
+
icon: unread ? lucide_react_1.MailOpen : lucide_react_1.Mail,
|
|
19
|
+
run: () => actions.setRead(ids, unread),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (features.archive && state.zone === "activity") {
|
|
23
|
+
list.push({ id: "archive", label: labels.archive, icon: lucide_react_1.Archive, run: () => actions.archive(ids) });
|
|
24
|
+
}
|
|
25
|
+
if (features.restore && state.zone === "archived") {
|
|
26
|
+
list.push({ id: "restore", label: labels.restore, icon: lucide_react_1.ArchiveRestore, run: () => actions.restore(ids) });
|
|
27
|
+
}
|
|
28
|
+
actions.extraActionsFor(entry).forEach((extra) => {
|
|
29
|
+
list.push({ id: extra.id, label: extra.label, icon: extra.icon, run: () => actions.runExtraAction(entry, extra) });
|
|
30
|
+
});
|
|
31
|
+
return list;
|
|
32
|
+
};
|
|
33
|
+
exports.quickActionsFor = quickActionsFor;
|
|
34
|
+
const visibleActionsFor = (entry, features) => { var _a; return ((_a = entry.actions) !== null && _a !== void 0 ? _a : []).filter((action) => action.href !== undefined || features.decide); };
|
|
35
|
+
exports.visibleActionsFor = visibleActionsFor;
|
|
36
|
+
const isDecision = (action) => action.href === undefined;
|
|
37
|
+
exports.isDecision = isDecision;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AvatarSize } from "../../Avatar/AvatarProps";
|
|
2
|
+
import type { NotificationEntry, NotificationLabels, NotificationTitlePart } from "../core/NotificationSourceProps";
|
|
3
|
+
import type { NotificationFormatter } from "../core/NotificationEngineProps";
|
|
4
|
+
import type { ResolvedCategory } from "./category";
|
|
5
|
+
export declare const ROW_PLANE_VAR = "--nc-row-bg";
|
|
6
|
+
interface TitleTextProps {
|
|
7
|
+
parts: NotificationTitlePart[];
|
|
8
|
+
isUnread: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const TitleText: ({ parts, isUnread }: TitleTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const useToneTile: (tone: ResolvedCategory["tone"]) => import("../../../Theme/tokens/builders/statusTone").StatusTone;
|
|
12
|
+
interface RowLeadingProps {
|
|
13
|
+
entry: NotificationEntry;
|
|
14
|
+
category: ResolvedCategory;
|
|
15
|
+
size: AvatarSize;
|
|
16
|
+
}
|
|
17
|
+
export declare const RowLeading: ({ entry, category, size }: RowLeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
interface RowTimeProps {
|
|
19
|
+
at: number;
|
|
20
|
+
now: number;
|
|
21
|
+
format: NotificationFormatter;
|
|
22
|
+
}
|
|
23
|
+
export declare const RowTime: ({ at, now, format }: RowTimeProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
interface RowContextProps {
|
|
25
|
+
entry: NotificationEntry;
|
|
26
|
+
waitingDays: number | null;
|
|
27
|
+
labels: NotificationLabels;
|
|
28
|
+
}
|
|
29
|
+
export declare const RowContext: ({ entry, waitingDays, labels }: RowContextProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
30
|
+
interface RowPreviewProps {
|
|
31
|
+
text: string;
|
|
32
|
+
isLarge: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const RowPreview: ({ text, isLarge }: RowPreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
interface ChangeChipsProps {
|
|
36
|
+
change: NonNullable<NotificationEntry["change"]>;
|
|
37
|
+
labels: NotificationLabels;
|
|
38
|
+
}
|
|
39
|
+
export declare const ChangeChips: ({ change, labels }: ChangeChipsProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ChangeChips = exports.RowPreview = exports.RowContext = exports.RowTime = exports.RowLeading = exports.useToneTile = exports.TitleText = exports.ROW_PLANE_VAR = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const react_2 = require("@chakra-ui/react");
|
|
10
|
+
const lucide_react_1 = require("lucide-react");
|
|
11
|
+
const Primitives_1 = require("../../Primitives/Primitives");
|
|
12
|
+
const Avatar_1 = __importDefault(require("../../Avatar/Avatar"));
|
|
13
|
+
const Tag_1 = __importDefault(require("../../Tag/Tag"));
|
|
14
|
+
const VisuallyHidden_1 = __importDefault(require("../../VisuallyHidden/VisuallyHidden"));
|
|
15
|
+
const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
16
|
+
const accentText_1 = require("../../../Theme/tokens/builders/accentText");
|
|
17
|
+
const statusTone_1 = require("../../../Theme/tokens/builders/statusTone");
|
|
18
|
+
const tone_1 = require("../../../Theme/tokens/builders/tone");
|
|
19
|
+
const planeStep_1 = require("../../../Theme/tokens/builders/planeStep");
|
|
20
|
+
const borderWidths_1 = require("../../../Theme/tokens/primitives/borderWidths");
|
|
21
|
+
const radii_1 = require("../../../Theme/tokens/primitives/radii");
|
|
22
|
+
const typography_1 = require("../../../Theme/tokens/primitives/typography");
|
|
23
|
+
exports.ROW_PLANE_VAR = "--nc-row-bg";
|
|
24
|
+
const TitleText = ({ parts, isUnread }) => {
|
|
25
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(react_2.chakra.span, { color: isUnread ? colors.text[800] : colors.text[700], children: parts.map((part, index) => typeof part === "string" ? ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: part }, index)) : ((0, jsx_runtime_1.jsx)(react_2.chakra.strong, { fontWeight: isUnread ? 600 : 500, color: isUnread ? colors.header[900] : colors.text[800], children: part.b }, index))) }));
|
|
27
|
+
};
|
|
28
|
+
exports.TitleText = TitleText;
|
|
29
|
+
const LEAD_BOX = {
|
|
30
|
+
"2xs": "1rem",
|
|
31
|
+
xs: "1.5rem",
|
|
32
|
+
sm: "2rem",
|
|
33
|
+
md: "2.5rem",
|
|
34
|
+
lg: "3rem",
|
|
35
|
+
xl: "4rem",
|
|
36
|
+
};
|
|
37
|
+
const useToneTile = (tone) => {
|
|
38
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
39
|
+
return (0, statusTone_1.resolveStatusTone)((0, tone_1.toneScale)(colors, tone), (0, accentText_1.isDarkCanvas)(colors.backgroundColor.main) ? "dark" : "light");
|
|
40
|
+
};
|
|
41
|
+
exports.useToneTile = useToneTile;
|
|
42
|
+
const RowLeading = ({ entry, category, size }) => {
|
|
43
|
+
const tile = (0, exports.useToneTile)(category.tone);
|
|
44
|
+
const iconPx = size === "md" || size === "lg" || size === "xl" ? 18 : 16;
|
|
45
|
+
if (entry.actor) {
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)(Primitives_1.Box, { position: "relative", flexShrink: 0, boxSize: LEAD_BOX[size], "aria-hidden": "true", children: [(0, jsx_runtime_1.jsx)(Avatar_1.default, { name: entry.actor.name, src: entry.actor.avatarUrl, size: size }), (0, jsx_runtime_1.jsx)(Primitives_1.Flex, { position: "absolute", right: "-0.375rem", bottom: "-0.375rem", boxSize: "1.25rem", align: "center", justify: "center", borderRadius: "full", bg: tile.bg, color: tile.fg, border: `${borderWidths_1.BORDER_WIDTHS.thick} solid var(${exports.ROW_PLANE_VAR})`, children: (0, jsx_runtime_1.jsx)(Primitives_1.Icon, { as: category.icon, boxSize: "0.625rem", strokeWidth: 2.5 }) })] }));
|
|
47
|
+
}
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(Primitives_1.Flex, { flexShrink: 0, boxSize: LEAD_BOX[size], align: "center", justify: "center", borderRadius: radii_1.RADIUS_ROLE.media, bg: tile.bg, color: tile.fg, "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)(Primitives_1.Icon, { as: category.icon, boxSize: `${iconPx / 16}rem` }) }));
|
|
49
|
+
};
|
|
50
|
+
exports.RowLeading = RowLeading;
|
|
51
|
+
const RowTime = ({ at, now, format }) => {
|
|
52
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.chakra.time, { dateTime: format.iso(at), title: format.absolute(at, now), flexShrink: 0, fontSize: "xs", color: colors.textMuted, whiteSpace: "nowrap", sx: typography_1.NUMERIC_TEXT, children: [(0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", children: format.shortAge(at, now) }), (0, jsx_runtime_1.jsx)(VisuallyHidden_1.default, { children: format.longAge(at, now) })] }));
|
|
54
|
+
};
|
|
55
|
+
exports.RowTime = RowTime;
|
|
56
|
+
const RowContext = ({ entry, waitingDays, labels }) => {
|
|
57
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
58
|
+
if (waitingDays === null && !entry.blocked && !entry.context)
|
|
59
|
+
return null;
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)(Primitives_1.Flex, { wrap: "wrap", align: "center", columnGap: 2, rowGap: 1, mt: 1, fontSize: "xs", lineHeight: "1.5", color: colors.textMuted, children: [waitingDays !== null && (0, jsx_runtime_1.jsx)(Tag_1.default, { size: "xs", tone: "warning", leadingIcon: lucide_react_1.Hourglass, label: labels.waiting(waitingDays) }), entry.blocked && (0, jsx_runtime_1.jsx)(Tag_1.default, { size: "xs", tone: "neutral", leadingIcon: lucide_react_1.Lock, label: labels.noAccess }), entry.context && (0, jsx_runtime_1.jsx)(react_2.chakra.span, { minW: 0, children: entry.context })] }));
|
|
61
|
+
};
|
|
62
|
+
exports.RowContext = RowContext;
|
|
63
|
+
const RowPreview = ({ text, isLarge }) => {
|
|
64
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(Primitives_1.Text, { mt: 1.5, pl: 2.5, borderLeft: `${borderWidths_1.BORDER_WIDTHS.thick} solid ${(0, planeStep_1.ruleOn)(colors, colors.surfaceRaised)}`, fontSize: isLarge ? "sm" : "xs-plus", lineHeight: "1.5", color: colors.text[700], noOfLines: 2, children: text }));
|
|
66
|
+
};
|
|
67
|
+
exports.RowPreview = RowPreview;
|
|
68
|
+
const ChangeChips = ({ change, labels }) => {
|
|
69
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
70
|
+
return ((0, jsx_runtime_1.jsxs)(Primitives_1.Flex, { align: "center", wrap: "wrap", gap: 1.5, color: colors.textMuted, children: [(0, jsx_runtime_1.jsx)(Tag_1.default, { size: "xs", tone: "neutral", label: change.from }), (0, jsx_runtime_1.jsx)(Primitives_1.Icon, { as: lucide_react_1.ChevronRight, boxSize: "0.75rem", "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)(VisuallyHidden_1.default, { children: labels.changedTo }), (0, jsx_runtime_1.jsx)(Tag_1.default, { size: "xs", colorScheme: "primary", label: change.to })] }));
|
|
71
|
+
};
|
|
72
|
+
exports.ChangeChips = ChangeChips;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SystemStyleObject } from "@chakra-ui/react";
|
|
2
|
+
import type { NotificationRowVariant } from "./NotificationRowProps";
|
|
3
|
+
import type { NotificationEntry } from "../core/NotificationSourceProps";
|
|
4
|
+
export type RowButtonSize = "xs" | "sm" | "md";
|
|
5
|
+
export declare const ROW_BUTTON_SIZE: Readonly<Record<NotificationRowVariant, RowButtonSize>>;
|
|
6
|
+
export declare const iconSizeFor: (size: RowButtonSize) => number;
|
|
7
|
+
export declare const WAITING_AFTER_DAYS = 3;
|
|
8
|
+
export declare const TOUCH_TARGET_SX: SystemStyleObject;
|
|
9
|
+
export declare const CHECKBOX_TOUCH_TARGET_SX: SystemStyleObject;
|
|
10
|
+
export declare const touchTargetFor: (size: RowButtonSize) => SystemStyleObject | undefined;
|
|
11
|
+
export declare const testIdFor: (entry: NotificationEntry, suffix: string) => string | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testIdFor = exports.touchTargetFor = exports.CHECKBOX_TOUCH_TARGET_SX = exports.TOUCH_TARGET_SX = exports.WAITING_AFTER_DAYS = exports.iconSizeFor = exports.ROW_BUTTON_SIZE = void 0;
|
|
4
|
+
const controlSizes_1 = require("../../../Theme/tokens/primitives/controlSizes");
|
|
5
|
+
exports.ROW_BUTTON_SIZE = {
|
|
6
|
+
panel: "xs",
|
|
7
|
+
inbox: "sm",
|
|
8
|
+
phone: "md",
|
|
9
|
+
};
|
|
10
|
+
const iconSizeFor = (size) => controlSizes_1.BUTTON_SIZES[size].iconSize;
|
|
11
|
+
exports.iconSizeFor = iconSizeFor;
|
|
12
|
+
exports.WAITING_AFTER_DAYS = 3;
|
|
13
|
+
exports.TOUCH_TARGET_SX = {
|
|
14
|
+
"&::before": { content: '""', position: "absolute", inset: "-0.125rem" },
|
|
15
|
+
};
|
|
16
|
+
exports.CHECKBOX_TOUCH_TARGET_SX = {
|
|
17
|
+
"@media (pointer: coarse)": {
|
|
18
|
+
"& label": { position: "relative" },
|
|
19
|
+
"& label::before": { content: '""', position: "absolute", inset: "-0.875rem" },
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const touchTargetFor = (size) => size === "md" ? exports.TOUCH_TARGET_SX : undefined;
|
|
23
|
+
exports.touchTargetFor = touchTargetFor;
|
|
24
|
+
const testIdFor = (entry, suffix) => entry.testId ? `${entry.testId}-${suffix}` : undefined;
|
|
25
|
+
exports.testIdFor = testIdFor;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { PaletteProps } from "../../Theme/tokens/types";
|
|
2
2
|
import type { SegmentedControlVariant } from "./SegmentedControlProps";
|
|
3
|
+
declare const TRACK_STEPS: readonly [600, 500, 400, 300, 200, 100];
|
|
4
|
+
type TrackStep = (typeof TRACK_STEPS)[number] | 50;
|
|
5
|
+
export declare const segmentedTrackStep: (colors: PaletteProps) => TrackStep;
|
|
3
6
|
/** The surface a segment's label really sits on. */
|
|
4
7
|
export declare const segmentedTrackSurface: (variant: SegmentedControlVariant, colors: PaletteProps, surface?: string) => string;
|
|
5
8
|
/** The surface the selected label sits on: the default variant lifts it onto its own plate. */
|
|
@@ -9,3 +12,4 @@ export declare const segmentedRestInk: (colors: PaletteProps, trackSurface: stri
|
|
|
9
12
|
/** The plate can match its backdrop's lightness, so its edge carries the boundary.
|
|
10
13
|
* Drawn inset by the caller: a real border consumes the content box and decentres the sliding pill. */
|
|
11
14
|
export declare const segmentedPlateEdge: (colors: PaletteProps, surface?: string) => string;
|
|
15
|
+
export {};
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.segmentedPlateEdge = exports.segmentedRestInk = exports.segmentedSelectedSurface = exports.segmentedTrackSurface = void 0;
|
|
3
|
+
exports.segmentedPlateEdge = exports.segmentedRestInk = exports.segmentedSelectedSurface = exports.segmentedTrackSurface = exports.segmentedTrackStep = void 0;
|
|
4
4
|
const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
|
|
5
5
|
const accentText_1 = require("../../Theme/tokens/builders/accentText");
|
|
6
|
+
const color_1 = require("../../Theme/tokens/builders/color");
|
|
7
|
+
const TRACK_STEPS = [600, 500, 400, 300, 200, 100];
|
|
8
|
+
// NOTE: light tracks never outweigh the outline; Zinc's full ramp makes [600] mid-grey.
|
|
9
|
+
const segmentedTrackStep = (colors) => {
|
|
10
|
+
if ((0, accentText_1.isDarkCanvas)(colors.backgroundColor.main))
|
|
11
|
+
return 600;
|
|
12
|
+
const outline = (0, color_1.relativeLuminance)(colors.boxborder[500]);
|
|
13
|
+
for (const step of TRACK_STEPS) {
|
|
14
|
+
if ((0, color_1.relativeLuminance)(colors.background[step]) >= outline)
|
|
15
|
+
return step;
|
|
16
|
+
}
|
|
17
|
+
return 50;
|
|
18
|
+
};
|
|
19
|
+
exports.segmentedTrackStep = segmentedTrackStep;
|
|
6
20
|
/** The surface a segment's label really sits on. */
|
|
7
21
|
const segmentedTrackSurface = (variant, colors, surface) => {
|
|
8
22
|
if (variant === "underlineSlide")
|
|
@@ -11,7 +25,7 @@ const segmentedTrackSurface = (variant, colors, surface) => {
|
|
|
11
25
|
// parent, so its ink was derived from a canvas the control was not actually on.
|
|
12
26
|
if (variant === "brandSlide")
|
|
13
27
|
return colors.surfaceRaised;
|
|
14
|
-
return colors.background[
|
|
28
|
+
return colors.background[(0, exports.segmentedTrackStep)(colors)];
|
|
15
29
|
};
|
|
16
30
|
exports.segmentedTrackSurface = segmentedTrackSurface;
|
|
17
31
|
/** The surface the selected label sits on: the default variant lifts it onto its own plate. */
|
|
@@ -73,13 +73,13 @@ const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
|
73
73
|
return item.locked && item.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: item.lockedReason, placement: "top", children: row })) : (row);
|
|
74
74
|
};
|
|
75
75
|
/** Secondary flyout panel beside the main rail, listing the active menu's `secondaryItems`; collapses to icons. */
|
|
76
|
-
const SecondaryBar = ({ items = [], defaultCollapsed = true, collapsedWidth = "3.5rem", expandedWidth = "10rem", headerFontSize = sidebarScale_1.SIDEBAR_ROW.fontSize, itemFontSize = sidebarScale_1.SIDEBAR_ROW.fontSize, selected, onItemClick, title, icon, }) => {
|
|
76
|
+
const SecondaryBar = ({ items = [], defaultCollapsed = true, collapsedWidth = "3.5rem", expandedWidth = "10rem", shrinkable = false, headerFontSize = sidebarScale_1.SIDEBAR_ROW.fontSize, itemFontSize = sidebarScale_1.SIDEBAR_ROW.fontSize, selected, onItemClick, title, icon, }) => {
|
|
77
77
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
78
78
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
79
79
|
const scrollContainerId = (0, sidebarId_1.sanitizeId)((0, react_1.useId)());
|
|
80
80
|
const [collapsed, setCollapsed] = (0, react_1.useState)(defaultCollapsed);
|
|
81
81
|
const width = collapsed ? collapsedWidth : expandedWidth;
|
|
82
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "nav", "aria-label": title ? `${title} navigation` : "Secondary navigation", transition: (0, motion_1.transitionFor)(["width"], "base"), pos: "sticky", top: 0, sx: viewportHeight_1.fullViewportHeight, w: width, bg: theme.colors.sidebar.background[500], borderLeft: "1px solid", borderColor: theme.colors.sidebar.divider, boxShadow: theme.shadows.md, zIndex: 1, children: (0, jsx_runtime_1.jsxs)(react_2.VStack, { align: "stretch", spacing: 0, h: "100%", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", justify: collapsed ? "center" : "space-between", px: collapsed ? 0 : "10px", gap: "7px", h: Sidebar_1.HEADER_HEIGHT, overflow: "hidden", borderBottom: "1px solid", borderColor: theme.colors.sidebar.divider, flexShrink: 0, children: [!collapsed && ((0, jsx_runtime_1.jsxs)(
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "nav", "aria-label": title ? `${title} navigation` : "Secondary navigation", transition: (0, motion_1.transitionFor)(["width"], "base"), pos: "sticky", top: 0, sx: viewportHeight_1.fullViewportHeight, w: width, minW: shrinkable ? collapsedWidth : undefined, bg: theme.colors.sidebar.background[500], borderLeft: "1px solid", borderColor: theme.colors.sidebar.divider, boxShadow: theme.shadows.md, zIndex: 1, children: (0, jsx_runtime_1.jsxs)(react_2.VStack, { align: "stretch", spacing: 0, h: "100%", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", justify: collapsed ? "center" : "space-between", px: collapsed ? 0 : "10px", gap: "7px", h: Sidebar_1.HEADER_HEIGHT, overflow: "hidden", borderBottom: "1px solid", borderColor: theme.colors.sidebar.divider, flexShrink: 0, children: [!collapsed && ((0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: "7px", flex: "1", minW: 0, overflow: "hidden", children: [icon && ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, color: activeAccent.icon, flexShrink: 0 })), (0, jsx_runtime_1.jsx)(react_2.Box, { flex: "1", minW: 0, children: (0, jsx_runtime_1.jsx)(OverflowTooltipText_1.default, { placement: "right", maxWidth: "100%", fontSize: headerFontSize, fontWeight: 600, color: theme.colors.white, as: "p", children: title !== null && title !== void 0 ? title : "" }) })] })), (0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", "aria-label": collapsed ? "Expand navigation panel" : "Collapse navigation panel", "aria-expanded": !collapsed, border: "none", bg: "transparent", w: "24px", h: "24px", borderRadius: "lg", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer", flexShrink: 0, onClick: () => setCollapsed((c) => !c), _hover: { bg: "whiteAlpha.200" }, transition: sidebarMotion_1.SIDEBAR_BG_TRANSITION, sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: collapsed ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: title !== null && title !== void 0 ? title : "", placement: "right", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 13, color: theme.colors.sidebar.mutedIcon }) })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { size: 13, color: theme.colors.sidebar.mutedIcon })) })] }), (0, jsx_runtime_1.jsx)(react_2.Box, { id: scrollContainerId, flex: "1", minH: 0, overflowY: "auto", overflowX: "hidden", py: 2, px: "6px", sx: (0, Sidebar_1.cssForScrollBar)(theme), children: items.map((item) => {
|
|
83
83
|
var _a;
|
|
84
84
|
const isActive = String(selected) === String(item.id) ||
|
|
85
85
|
String(selected) === String(item.title);
|
|
@@ -39,6 +39,13 @@ const inlineTransitions = (collapse) => {
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
const OVERLAY_WIDTH = "14.7rem";
|
|
42
|
+
const OVERLAY_MAX_WIDTH = "88vw";
|
|
43
|
+
const PANEL_BORDER = "1px";
|
|
44
|
+
const SECONDARY_STRIP_WIDTH = "3.5rem";
|
|
45
|
+
const SECONDARY_OPEN_WIDTH = "10rem";
|
|
46
|
+
const PRIMARY_MAX_WITH_SECONDARY = `calc(${OVERLAY_MAX_WIDTH} - ${PANEL_BORDER} - ${SECONDARY_STRIP_WIDTH})`;
|
|
47
|
+
// NOTE: below this the primary (12.5rem) and secondary (8rem) label floors overflow 88vw.
|
|
48
|
+
const NARROW_DRAWER_QUERY = "(max-width: 23.3em)";
|
|
42
49
|
const SCRIM_TRANSITION = (0, motion_2.transitionFor)(["opacity", "visibility"], "base");
|
|
43
50
|
const OVERLAY_SLIDE = (0, motion_2.transitionFor)(["transform"], "enter", "out");
|
|
44
51
|
const OVERLAY_WIDTH_TRANSITION = (0, motion_2.transitionFor)(["width"], "enter", "out");
|
|
@@ -52,6 +59,7 @@ const PinnedSection_1 = __importDefault(require("./components/PinnedSection"));
|
|
|
52
59
|
const sidebarScale_1 = require("./sidebarScale");
|
|
53
60
|
const viewportHeight_1 = require("../../Theme/tokens/builders/viewportHeight");
|
|
54
61
|
const sharedResizeObserver_1 = require("../../Hooks/sharedResizeObserver");
|
|
62
|
+
const useMatchMedia_1 = require("../../Hooks/useMatchMedia");
|
|
55
63
|
const SidebarHeader = ({ logo, companyName, companySubtitle, toggle, isLoading, onToggle, overlay, onClose, }) => {
|
|
56
64
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
57
65
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
@@ -82,10 +90,10 @@ const SkeletonMenuRow = ({ toggle }) => {
|
|
|
82
90
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
83
91
|
return ((0, jsx_runtime_1.jsx)(react_2.Box, { w: "100%", px: toggle ? 1 : 2, py: 2, children: toggle ? ((0, jsx_runtime_1.jsx)(react_2.Flex, { align: "center", gap: 4, justifyContent: "center", children: (0, jsx_runtime_1.jsx)(react_2.Skeleton, { w: "24px", h: "24px", borderRadius: "lg", startColor: theme.colors.sidebar.background[400], endColor: theme.colors.sidebar.background[300] }) })) : ((0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 3, children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { w: "18px", h: "18px", borderRadius: "lg", startColor: theme.colors.sidebar.background[400], endColor: theme.colors.sidebar.background[300] }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { h: "0.875rem", w: "80%", borderRadius: "lg", startColor: theme.colors.sidebar.background[400], endColor: theme.colors.sidebar.background[300] })] })) }));
|
|
84
92
|
};
|
|
85
|
-
const AddNewButton = ({ toggle, onClick
|
|
93
|
+
const AddNewButton = ({ toggle, onClick }) => {
|
|
86
94
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
87
95
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
88
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", "data-group": "", "aria-label": "Add New", alignItems: "center", gap: "9px", px: "10px", py:
|
|
96
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", "data-group": "", "aria-label": "Add New", alignItems: "center", gap: "9px", px: "10px", py: "7px", borderRadius: "lg", cursor: "pointer", border: "none", bg: "transparent", w: "100%", mb: "2px", justifyContent: toggle ? "center" : "flex-start", _hover: { backgroundColor: "whiteAlpha.200" }, transition: sidebarMotion_1.SIDEBAR_BG_TRANSITION, sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), onClick: onClick, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { w: "18px", h: "18px", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: 16, color: activeAccent.icon }) }), !toggle && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, color: theme.colors.white, fontWeight: 500, children: "Add New" }))] }));
|
|
89
97
|
};
|
|
90
98
|
const deriveInitials = (user) => {
|
|
91
99
|
if (user.initials)
|
|
@@ -97,13 +105,13 @@ const deriveInitials = (user) => {
|
|
|
97
105
|
return parts[0].slice(0, 2).toUpperCase();
|
|
98
106
|
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
99
107
|
};
|
|
100
|
-
const UserFooter = ({ user, toggle
|
|
108
|
+
const UserFooter = ({ user, toggle }) => {
|
|
101
109
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
102
110
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
103
111
|
const avatar = user.avatarUrl ? ((0, jsx_runtime_1.jsx)(react_2.Image, { src: user.avatarUrl, alt: user.name, boxSize: "26px", borderRadius: "full", objectFit: "cover", flexShrink: 0 })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { boxSize: "26px", borderRadius: "full",
|
|
104
112
|
// Same rail-safe pairing as the logo tile — primary.opacity[32] was invisible on zinc/skyline.
|
|
105
113
|
bg: theme.colors.sidebar.activeBg, color: activeAccent.label, display: "flex", alignItems: "center", justifyContent: "center", fontSize: sidebarScale_1.SIDEBAR_CHROME.metaFontSize, fontWeight: 600, flexShrink: 0, children: deriveInitials(user) }));
|
|
106
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Box, { borderTop: "1px solid", borderColor: theme.colors.sidebar.divider, py: 2, px: "6px", flexShrink: 0, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", onClick: user.onClick, align: "center", gap: 2, px: 2, py:
|
|
114
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Box, { borderTop: "1px solid", borderColor: theme.colors.sidebar.divider, py: 2, px: "6px", flexShrink: 0, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", onClick: user.onClick, align: "center", gap: 2, px: 2, py: "6px", w: "100%", borderRadius: "lg", cursor: "pointer", bg: "transparent", border: "none", justify: toggle ? "center" : "flex-start", _hover: { bg: "whiteAlpha.200" }, transition: sidebarMotion_1.SIDEBAR_BG_TRANSITION, sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: [avatar, !toggle && ((0, jsx_runtime_1.jsxs)(react_2.Box, { flex: "1", minW: 0, textAlign: "left", children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: sidebarScale_1.SIDEBAR_CHROME.labelFontSize, fontWeight: 500, color: theme.colors.white, isTruncated: true, children: user.name }), user.role && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: sidebarScale_1.SIDEBAR_CHROME.metaFontSize, color: theme.colors.sidebar.mutedLabel, isTruncated: true, children: user.role }))] })), !toggle && (0, jsx_runtime_1.jsx)(lucide_react_1.MoreVertical, { size: 14, color: theme.colors.sidebar.mutedIcon })] }) }));
|
|
107
115
|
};
|
|
108
116
|
// Footer "cell" — one segment of the Collapse | Hide/Show control.
|
|
109
117
|
const ControlCell = ({ onClick, ariaLabel, label, accent, children }) => {
|
|
@@ -142,6 +150,7 @@ function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick,
|
|
|
142
150
|
// In overlay mode the panel is always fully expanded — the mini-rail/collapse
|
|
143
151
|
// is a desktop-only space affordance — so children render as if `toggle=false`.
|
|
144
152
|
const effToggle = overlay ? false : toggle;
|
|
153
|
+
const narrowViewport = (0, useMatchMedia_1.useMatchMedia)(NARROW_DRAWER_QUERY);
|
|
145
154
|
// A peeked overlay was never pinned, so leaving the panel must close it; a clicked-open
|
|
146
155
|
// one must not, or the drawer would vanish the moment the pointer moved away.
|
|
147
156
|
const overlayPeeking = overlay && peekOpen && !mobileOpen;
|
|
@@ -174,6 +183,7 @@ function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick,
|
|
|
174
183
|
const activeTop = menus.find((m) => String(m.title) === String(activeMenu)) ||
|
|
175
184
|
menus.find((m) => String(m.id) === String(activeMenu));
|
|
176
185
|
const secondaryItems = (_b = activeTop === null || activeTop === void 0 ? void 0 : activeTop.secondaryItems) !== null && _b !== void 0 ? _b : [];
|
|
186
|
+
const hasSecondary = secondaryItems.length > 0;
|
|
177
187
|
const inline = inlineTransitions(collapseTransition);
|
|
178
188
|
const pinnedActive = activePinnedId != null && !!(pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems.some((p) => String(p.id) === String(activePinnedId)));
|
|
179
189
|
// Sync toggle with external `open` prop.
|
|
@@ -339,7 +349,7 @@ function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick,
|
|
|
339
349
|
onMobileClose === null || onMobileClose === void 0 ? void 0 : onMobileClose();
|
|
340
350
|
};
|
|
341
351
|
const baseTransform = isOverlayOpen ? "translateX(0)" : "translateX(-100%)";
|
|
342
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.Box, { display: mobileNav ? "block" : { base: "block", lg: "none" }, position: "fixed", inset: 0, ...(0, overlay_styles_1.overlayScrimStyles)(theme.colors), zIndex: Z_SCRIM, opacity: isOverlayOpen ? 1 : 0, visibility: isOverlayOpen ? "visible" : "hidden", transition: SCRIM_TRANSITION, sx: { [motion_1.REDUCED_MOTION_QUERY]: { transition: "none" } }, onClick: closeOverlay, "aria-hidden": "true" }), (0, jsx_runtime_1.jsxs)(react_2.Box, { ref: panelRef, onKeyDown: trapTab, tabIndex: overlay ? -1 : undefined, outline: "none", position: mobileNav ? "fixed" : { base: "fixed", lg: "sticky" }, top: 0, left: mobileNav ? 0 : { base: 0, lg: "auto" }, bottom: mobileNav ? 0 : { base: 0, lg: "auto" }, zIndex: mobileNav ? Z_PANEL : { base: Z_PANEL, lg: "auto" }, maxW: mobileNav ?
|
|
352
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.Box, { display: mobileNav ? "block" : { base: "block", lg: "none" }, position: "fixed", inset: 0, ...(0, overlay_styles_1.overlayScrimStyles)(theme.colors), zIndex: Z_SCRIM, opacity: isOverlayOpen ? 1 : 0, visibility: isOverlayOpen ? "visible" : "hidden", transition: SCRIM_TRANSITION, sx: { [motion_1.REDUCED_MOTION_QUERY]: { transition: "none" } }, onClick: closeOverlay, "aria-hidden": "true" }), (0, jsx_runtime_1.jsxs)(react_2.Box, { ref: panelRef, onKeyDown: trapTab, tabIndex: overlay ? -1 : undefined, outline: "none", position: mobileNav ? "fixed" : { base: "fixed", lg: "sticky" }, top: 0, left: mobileNav ? 0 : { base: 0, lg: "auto" }, bottom: mobileNav ? 0 : { base: 0, lg: "auto" }, zIndex: mobileNav ? Z_PANEL : { base: Z_PANEL, lg: "auto" }, maxW: mobileNav ? OVERLAY_MAX_WIDTH : { base: OVERLAY_MAX_WIDTH, lg: "none" }, transform: mobileNav ? baseTransform : { base: baseTransform, lg: "none" }, transition: mobileNav
|
|
343
353
|
? dragging
|
|
344
354
|
? "none"
|
|
345
355
|
: OVERLAY_SLIDE
|
|
@@ -348,13 +358,13 @@ function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick,
|
|
|
348
358
|
? "none"
|
|
349
359
|
: OVERLAY_SLIDE,
|
|
350
360
|
lg: inline.shadow,
|
|
351
|
-
}, borderRadius: "none", boxShadow: mobileNav ? theme.shadows["2xl"] : { base: theme.shadows["2xl"], lg: theme.shadows.lg }, display: "flex", background: theme.colors.sidebar.background[500], borderRight:
|
|
361
|
+
}, borderRadius: "none", boxShadow: mobileNav ? theme.shadows["2xl"] : { base: theme.shadows["2xl"], lg: theme.shadows.lg }, display: "flex", background: theme.colors.sidebar.background[500], borderRight: `${PANEL_BORDER} solid`, borderColor: theme.colors.sidebar.divider, role: overlay ? "dialog" : undefined, "aria-modal": overlay ? true : undefined, "aria-label": overlay ? "Main navigation" : undefined, ...(overlay && !isOverlayOpen ? { inert: "" } : {}), sx: {
|
|
352
362
|
...viewportHeight_1.fullViewportHeight,
|
|
353
363
|
touchAction: overlay ? "pan-y" : "auto",
|
|
354
364
|
[motion_1.REDUCED_MOTION_QUERY]: { "&, & *": { transition: "none", animation: "none" } },
|
|
355
365
|
}, onMouseLeave: overlayPeeking ? onPeekEnd : undefined, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { width: mobileNav
|
|
356
366
|
? OVERLAY_WIDTH
|
|
357
|
-
: { base: OVERLAY_WIDTH, lg: effToggle ? RAIL_WIDTH : EXPANDED_WIDTH }, transition: mobileNav
|
|
367
|
+
: { base: OVERLAY_WIDTH, lg: effToggle ? RAIL_WIDTH : EXPANDED_WIDTH }, maxW: overlay && hasSecondary ? PRIMARY_MAX_WITH_SECONDARY : undefined, transition: mobileNav
|
|
358
368
|
? OVERLAY_WIDTH_TRANSITION
|
|
359
|
-
: { base: OVERLAY_WIDTH_TRANSITION, lg: inline.width }, display: "flex", flexDirection: "column", justifyContent: "space-between", sx: { "@media (prefers-reduced-motion: reduce)": { transition: "none" } }, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { flexDir: "column", w: "100%", as: "nav", "aria-label": "Main navigation", h: "100%", children: [(0, jsx_runtime_1.jsx)(SidebarHeader, { logo: logo, companyName: companyName, companySubtitle: companySubtitle, toggle: effToggle, isLoading: isLoading, onToggle: changeToggle, overlay: overlay, onClose: onMobileClose }), (0, jsx_runtime_1.jsx)(react_2.Box, { id: scrollContainerId, flex: "1", minH: 0, w: "100%", overflowY: "auto", overflowX: "hidden", py: 2, px: "6px", sx: (0, Sidebar_1.cssForScrollBar)(theme), children: isLoading ? (Array.from({ length: loadingLines !== null && loadingLines !== void 0 ? loadingLines : 15 }).map((_, i) => ((0, jsx_runtime_1.jsx)(SkeletonMenuRow, { toggle: effToggle }, i)))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [pinnedItems && pinnedItems.length > 0 && ((0, jsx_runtime_1.jsx)(PinnedSection_1.default, { items: pinnedItems, label: pinnedLabel, limit: pinnedLimit, toggle: effToggle, overlay: overlay, activeId: activePinnedId, labels: pinnedLabels, onItemClick: handleMenuClickInternal, onUnpin: onUnpin })), (0, jsx_runtime_1.jsx)(MenuItems_1.default, { activeMenu: pinnedActive ? NO_ACTIVE_MENU : activeMenu, menus: menus, handleMenuClick: handleMenuClickInternal, toggle: effToggle, selectedSubMenu: selectedSubMenu,
|
|
369
|
+
: { base: OVERLAY_WIDTH_TRANSITION, lg: inline.width }, display: "flex", flexDirection: "column", justifyContent: "space-between", sx: { "@media (prefers-reduced-motion: reduce)": { transition: "none" } }, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { flexDir: "column", w: "100%", as: "nav", "aria-label": "Main navigation", h: "100%", children: [(0, jsx_runtime_1.jsx)(SidebarHeader, { logo: logo, companyName: companyName, companySubtitle: companySubtitle, toggle: effToggle, isLoading: isLoading, onToggle: changeToggle, overlay: overlay, onClose: onMobileClose }), (0, jsx_runtime_1.jsx)(react_2.Box, { id: scrollContainerId, flex: "1", minH: 0, w: "100%", overflowY: "auto", overflowX: "hidden", py: 2, px: "6px", sx: (0, Sidebar_1.cssForScrollBar)(theme), children: isLoading ? (Array.from({ length: loadingLines !== null && loadingLines !== void 0 ? loadingLines : 15 }).map((_, i) => ((0, jsx_runtime_1.jsx)(SkeletonMenuRow, { toggle: effToggle }, i)))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [pinnedItems && pinnedItems.length > 0 && ((0, jsx_runtime_1.jsx)(PinnedSection_1.default, { items: pinnedItems, label: pinnedLabel, limit: pinnedLimit, toggle: effToggle, overlay: overlay, activeId: activePinnedId, labels: pinnedLabels, onItemClick: handleMenuClickInternal, onUnpin: onUnpin })), (0, jsx_runtime_1.jsx)(MenuItems_1.default, { activeMenu: pinnedActive ? NO_ACTIVE_MENU : activeMenu, menus: menus, handleMenuClick: handleMenuClickInternal, toggle: effToggle, selectedSubMenu: selectedSubMenu, containerId: scrollContainerId })] })) }), (0, jsx_runtime_1.jsxs)(react_2.Box, { flexShrink: 0, children: [!isDisableAddNew && ((0, jsx_runtime_1.jsx)(react_2.Box, { borderTop: "1px solid", borderColor: theme.colors.sidebar.divider, py: 2, px: "6px", children: (0, jsx_runtime_1.jsx)(AddNewButton, { toggle: effToggle, onClick: onAddNewClick }) })), (0, jsx_runtime_1.jsx)(OtherApps_1.default, { toggle: effToggle, otherApps: otherApps !== null && otherApps !== void 0 ? otherApps : [] }), user && (0, jsx_runtime_1.jsx)(UserFooter, { user: user, toggle: effToggle }), (0, jsx_runtime_1.jsx)(FooterControls, { toggle: effToggle, overlay: overlay, mobileNav: mobileNav, onToggleCollapse: changeToggle, onToggleMobileNav: onToggleMobileNav })] })] }) }), hasSecondary && ((0, jsx_runtime_1.jsx)(SecondaryBar_1.default, { items: secondaryItems, defaultCollapsed: effToggle || narrowViewport, collapsedWidth: SECONDARY_STRIP_WIDTH, expandedWidth: SECONDARY_OPEN_WIDTH, shrinkable: overlay, selected: selectedSecondaryItem, onItemClick: handleSecondaryNavClick, title: activeTop === null || activeTop === void 0 ? void 0 : activeTop.title, icon: activeTop === null || activeTop === void 0 ? void 0 : activeTop.icon })), overlay && ((0, jsx_runtime_1.jsx)(react_2.Box, { display: mobileOpen ? "block" : "none", position: "absolute", top: "50%", right: "6px", transform: "translateY(-50%)", w: "4px", h: "42px", borderRadius: "full", bg: theme.colors.sidebar.mutedIcon, "aria-hidden": "true" }))] })] }));
|
|
360
370
|
}
|
|
@@ -128,7 +128,7 @@ export type MenuProps = {
|
|
|
128
128
|
};
|
|
129
129
|
/** Nested rows shown inline when this row is expanded; non-empty turns the row into a toggle. */
|
|
130
130
|
subMenu?: MenuProps[];
|
|
131
|
-
/** Non-empty on the active menu auto-collapses the main rail and renders a SecondaryBar, regardless of the `toggle` prop. */
|
|
131
|
+
/** Non-empty on the active menu auto-collapses the main rail and renders a SecondaryBar, regardless of the `toggle` prop. On drawer viewports up to 23.3em (about 373px) it starts as the icon strip. */
|
|
132
132
|
secondaryItems?: MenuProps[];
|
|
133
133
|
/** First item with a new value renders a section label plus divider; items must be pre-sorted by group. */
|
|
134
134
|
group?: string;
|
|
@@ -147,7 +147,7 @@ export type RenderMenuType = {
|
|
|
147
147
|
selectedSubMenu?: string | null;
|
|
148
148
|
/** Id or title of the highlighted SecondaryBar item. */
|
|
149
149
|
selectedSecondaryItem?: string | number | null;
|
|
150
|
-
/**
|
|
150
|
+
/** @deprecated Dead — the drawer uses the docked row metrics; nothing reads it. */
|
|
151
151
|
overlay?: boolean;
|
|
152
152
|
/** The scroll container's own id, read back by the auto-scroll-into-view effect. */
|
|
153
153
|
containerId: string;
|
|
@@ -162,6 +162,8 @@ export type SecondaryBarProps = {
|
|
|
162
162
|
collapsedWidth?: string | number;
|
|
163
163
|
/** Defaults to "10rem". */
|
|
164
164
|
expandedWidth?: string | number;
|
|
165
|
+
/** Lets the panel narrow down to `collapsedWidth` inside a width-capped parent such as the mobile drawer, instead of overflowing it. */
|
|
166
|
+
shrinkable?: boolean;
|
|
165
167
|
/** Drill-down title size. Defaults to the shared sidebar row size (13px). */
|
|
166
168
|
headerFontSize?: string;
|
|
167
169
|
/** Row label size. Defaults to the shared sidebar row size (13px). */
|
|
@@ -8,8 +8,6 @@ interface Props {
|
|
|
8
8
|
selectedSubMenu?: string | null;
|
|
9
9
|
isOpen?: boolean;
|
|
10
10
|
onToggle?: (menu: MenuProps, clickY?: number) => void;
|
|
11
|
-
/** Overlay (touch) presentation — rows grow to a 48px touch target instead of the 32px desktop row. */
|
|
12
|
-
overlay?: boolean;
|
|
13
11
|
}
|
|
14
12
|
/**
|
|
15
13
|
* These rows are real `<a href>`s now, so the browser's own gestures have to keep working —
|
|
@@ -65,7 +65,7 @@ const SUBMENU_REVEAL_TRANSITION = (0, motion_1.transitionFor)(["opacity", "trans
|
|
|
65
65
|
*/
|
|
66
66
|
const isBrowserNavigationGesture = (e) => e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0;
|
|
67
67
|
exports.isBrowserNavigationGesture = isBrowserNavigationGesture;
|
|
68
|
-
const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
68
|
+
const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle, }) => {
|
|
69
69
|
var _a, _b, _c, _d, _e;
|
|
70
70
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
71
71
|
const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
|
|
@@ -77,7 +77,6 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
77
77
|
const isBlocked = (0, menuDisabled_1.menuDisabled)(menu) || locked;
|
|
78
78
|
const hasSubMenu = !!(subMenu === null || subMenu === void 0 ? void 0 : subMenu.length);
|
|
79
79
|
const submenuPanelId = `submenu-${reactId}`;
|
|
80
|
-
const rowHeight = overlay ? sidebarScale_1.SIDEBAR_ROW.overlayHeight : sidebarScale_1.SIDEBAR_ROW.height;
|
|
81
80
|
// A submenu parent only expands, so it is a button; every other row navigates.
|
|
82
81
|
// Cast: Chakra narrows `as` unions to their *shared* props, which drops `href`.
|
|
83
82
|
const rowAs = (hasSubMenu ? "button" : "a");
|
|
@@ -115,7 +114,7 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
|
|
|
115
114
|
textAlign: "left",
|
|
116
115
|
textDecoration: "none",
|
|
117
116
|
w: "100%",
|
|
118
|
-
h:
|
|
117
|
+
h: sidebarScale_1.SIDEBAR_ROW.height,
|
|
119
118
|
borderRadius: "lg",
|
|
120
119
|
px: "10px",
|
|
121
120
|
fontWeight: 500,
|
|
@@ -41,7 +41,7 @@ const react_1 = __importStar(require("react"));
|
|
|
41
41
|
const react_2 = require("@chakra-ui/react");
|
|
42
42
|
const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
43
43
|
const MenuItemBox_1 = __importDefault(require("./MenuItemBox"));
|
|
44
|
-
const MenuItems = ({ menus, activeMenu, handleMenuClick, toggle, selectedSubMenu,
|
|
44
|
+
const MenuItems = ({ menus, activeMenu, handleMenuClick, toggle, selectedSubMenu, containerId, }) => {
|
|
45
45
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
46
46
|
const [openMenuId, setOpenMenuId] = (0, react_1.useState)(null);
|
|
47
47
|
const [lastClickY, setLastClickY] = (0, react_1.useState)(null);
|
|
@@ -148,7 +148,7 @@ const MenuItems = ({ menus, activeMenu, handleMenuClick, toggle, selectedSubMenu
|
|
|
148
148
|
lastGroup = menu.group;
|
|
149
149
|
groupCount += 1;
|
|
150
150
|
}
|
|
151
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [showGroup && !isFirstGroup && ((0, jsx_runtime_1.jsx)(react_2.Box, { h: "1px", bg: theme.colors.sidebar.divider, mx: 2, my:
|
|
151
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [showGroup && !isFirstGroup && ((0, jsx_runtime_1.jsx)(react_2.Box, { h: "1px", bg: theme.colors.sidebar.divider, mx: 2, my: "5px" })), showGroup && !toggle && ((0, jsx_runtime_1.jsx)(react_2.Box, { "aria-hidden": "true", px: "10px", pt: "10px", pb: "3px", fontSize: "xs-minus", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.1em", color: theme.colors.sidebar.mutedLabel, whiteSpace: "nowrap", overflow: "hidden", children: menu.group })), (0, jsx_runtime_1.jsx)(MenuItemBox_1.default, { menu: menu, activeMenu: activeMenu, toggle: toggle, handleClick: handleMenuClick, selectedSubMenu: selectedSubMenu, isOpen: openMenuId === menu.id, onToggle: handleToggle })] }, `${String((_c = (_b = (_a = menu.id) !== null && _a !== void 0 ? _a : menu.url) !== null && _b !== void 0 ? _b : menu.title) !== null && _c !== void 0 ? _c : idx)}-${idx}`));
|
|
152
152
|
}) }));
|
|
153
153
|
};
|
|
154
154
|
exports.default = (0, react_1.memo)(MenuItems);
|
|
@@ -53,7 +53,6 @@ const PinnedSection = ({ items, label = exports.DEFAULT_PINNED_LABEL, limit = ex
|
|
|
53
53
|
const text = { ...DEFAULT_LABELS, ...labels };
|
|
54
54
|
const headingId = `pinned-${(0, sidebarId_1.sanitizeId)((0, react_1.useId)())}`;
|
|
55
55
|
const cap = Math.max(1, limit);
|
|
56
|
-
const rowHeight = overlay ? sidebarScale_1.SIDEBAR_ROW.overlayHeight : sidebarScale_1.SIDEBAR_ROW.height;
|
|
57
56
|
const activeIndex = activeId == null ? -1 : items.findIndex((i) => String(i.id) === String(activeId));
|
|
58
57
|
const [showAll, setShowAll] = (0, react_1.useState)(activeIndex >= cap);
|
|
59
58
|
(0, react_1.useEffect)(() => {
|
|
@@ -78,7 +77,7 @@ const PinnedSection = ({ items, label = exports.DEFAULT_PINNED_LABEL, limit = ex
|
|
|
78
77
|
};
|
|
79
78
|
const renderRow = (item) => {
|
|
80
79
|
const isActive = activeIndex >= 0 && String(item.id) === String(activeId);
|
|
81
|
-
const anchor = ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "a", href: item.url, "data-group": "", "data-pinned-id": String(item.id), "aria-label": toggle ? item.title : undefined, "aria-current": isActive ? "page" : undefined, display: "flex", alignItems: "center", textAlign: "left", textDecoration: "none", w: "100%", h:
|
|
80
|
+
const anchor = ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "a", href: item.url, "data-group": "", "data-pinned-id": String(item.id), "aria-label": toggle ? item.title : undefined, "aria-current": isActive ? "page" : undefined, display: "flex", alignItems: "center", textAlign: "left", textDecoration: "none", w: "100%", h: sidebarScale_1.SIDEBAR_ROW.height, borderRadius: "lg", pl: "10px", pr: !toggle && onUnpin ? `calc(10px + ${UNPIN_SIZE})` : "10px", fontWeight: 500, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", backgroundColor: isActive ? LADDER.active : "transparent", color: theme.colors.sidebar.mutedIcon, _hover: { backgroundColor: isActive ? LADDER.activeHover : LADDER.hover }, cursor: "pointer", transition: sidebarMotion_1.SIDEBAR_BG_TRANSITION, sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), onClick: (e) => {
|
|
82
81
|
if (item.url && (0, MenuItemBox_1.isBrowserNavigationGesture)(e))
|
|
83
82
|
return;
|
|
84
83
|
e.preventDefault();
|
|
@@ -92,10 +91,10 @@ const PinnedSection = ({ items, label = exports.DEFAULT_PINNED_LABEL, limit = ex
|
|
|
92
91
|
const disclosureLabel = showAll
|
|
93
92
|
? text.showLess
|
|
94
93
|
: text.showMore.replace("{count}", String(hiddenCount));
|
|
95
|
-
const disclosureButton = ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "button", type: "button", "aria-expanded": showAll, "aria-label": toggle ? disclosureLabel : undefined, onClick: () => setShowAll((v) => !v), display: "flex", alignItems: "center", justifyContent: toggle ? "center" : "flex-start", gap: "9px", w: "100%", h:
|
|
94
|
+
const disclosureButton = ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "button", type: "button", "aria-expanded": showAll, "aria-label": toggle ? disclosureLabel : undefined, onClick: () => setShowAll((v) => !v), display: "flex", alignItems: "center", justifyContent: toggle ? "center" : "flex-start", gap: "9px", w: "100%", h: sidebarScale_1.SIDEBAR_ROW.height, px: "10px", borderRadius: "lg", border: "none", borderLeft: "2px solid transparent", bg: "transparent", cursor: "pointer", color: theme.colors.sidebar.mutedLabel, fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, fontWeight: 500, _hover: {
|
|
96
95
|
backgroundColor: LADDER.hover,
|
|
97
96
|
color: theme.colors.white,
|
|
98
97
|
}, transition: sidebarMotion_1.SIDEBAR_BG_TRANSITION, sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: showAll ? lucide_react_1.ChevronUp : lucide_react_1.ChevronDown, fontSize: "md", flexShrink: 0 }), !toggle && (0, jsx_runtime_1.jsx)("span", { children: disclosureLabel })] }));
|
|
99
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { mb: toggle ? "5px" : "3px", "data-testid": "sidebar-pinned", children: [(0, jsx_runtime_1.jsx)(react_2.Box, { id: headingId, as: "h2", px: "10px", pt:
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { mb: toggle ? "5px" : "3px", "data-testid": "sidebar-pinned", children: [(0, jsx_runtime_1.jsx)(react_2.Box, { id: headingId, as: "h2", px: "10px", pt: "10px", pb: "3px", fontSize: "xs-minus", fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.1em", color: theme.colors.sidebar.mutedLabel, whiteSpace: "nowrap", overflow: "hidden", sx: toggle ? VISUALLY_HIDDEN : undefined, children: label }), (0, jsx_runtime_1.jsxs)(react_2.Box, { as: "ul", "aria-labelledby": headingId, display: "flex", flexDirection: "column", gap: "2px", m: 0, p: 0, children: [visible.map(renderRow), hiddenCount > 0 && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "li", listStyleType: "none", children: toggle ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: disclosureLabel, placement: "right", children: disclosureButton })) : (disclosureButton) }))] }), (0, jsx_runtime_1.jsx)(react_2.Box, { h: "1px", bg: theme.colors.sidebar.divider, mx: 2, mt: "8px", mb: "5px" })] }));
|
|
100
99
|
};
|
|
101
100
|
exports.default = PinnedSection;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/** One type and row scale for the whole sidebar — rail, submenu, flyout, secondary bar and chrome. */
|
|
2
2
|
export declare const SIDEBAR_ROW: {
|
|
3
3
|
readonly height: "32px";
|
|
4
|
-
/** Rail row in the mobile overlay — the WCAG 2.5.5 touch target. */
|
|
5
|
-
readonly overlayHeight: "44px";
|
|
6
4
|
readonly subHeight: "28px";
|
|
7
5
|
readonly fontSize: string;
|
|
8
6
|
readonly iconSize: "1rem";
|
|
@@ -5,8 +5,6 @@ const typography_1 = require("../../Theme/tokens/primitives/typography");
|
|
|
5
5
|
/** One type and row scale for the whole sidebar — rail, submenu, flyout, secondary bar and chrome. */
|
|
6
6
|
exports.SIDEBAR_ROW = {
|
|
7
7
|
height: "32px",
|
|
8
|
-
/** Rail row in the mobile overlay — the WCAG 2.5.5 touch target. */
|
|
9
|
-
overlayHeight: "44px",
|
|
10
8
|
subHeight: "28px",
|
|
11
9
|
fontSize: typography_1.fontSizes["xs-plus"],
|
|
12
10
|
iconSize: "1rem",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SwitchProps } from "./SwitchProps";
|
|
2
2
|
/** @deprecated Two labelled choices; for a single on/off field use `ToggleSwitch`. Renders `SegmentedControl` at 12.5rem when labelled. */
|
|
3
|
-
export default function Switch({ leftText, rightText, leftIcon, rightIcon, onSwitchToggle, switchActive, surface, "aria-label": ariaLabel, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function Switch({ leftText, rightText, leftIcon, rightIcon, onSwitchToggle, switchActive, size, surface, "aria-label": ariaLabel, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,12 +8,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const react_1 = require("@chakra-ui/react");
|
|
9
9
|
const SegmentedControl_1 = __importDefault(require("../SegmentedControl/SegmentedControl"));
|
|
10
10
|
/** @deprecated Two labelled choices; for a single on/off field use `ToggleSwitch`. Renders `SegmentedControl` at 12.5rem when labelled. */
|
|
11
|
-
function Switch({ leftText, rightText, leftIcon, rightIcon, onSwitchToggle, switchActive, surface, "aria-label": ariaLabel, }) {
|
|
11
|
+
function Switch({ leftText, rightText, leftIcon, rightIcon, onSwitchToggle, switchActive, size = "sm", surface, "aria-label": ariaLabel, }) {
|
|
12
12
|
const options = [
|
|
13
13
|
{ value: "left", label: leftText, icon: leftIcon },
|
|
14
14
|
{ value: "right", label: rightText, icon: rightIcon },
|
|
15
15
|
];
|
|
16
16
|
// Unlabelled segments have nothing to size to, so the 12.5rem floor only overflowed its cell.
|
|
17
17
|
const hasLabels = Boolean(leftText || rightText);
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { w: "fit-content", maxW: "100%", minW: hasLabels ? "12.5rem" : undefined, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.default, { options: options, value: switchActive, onChange: onSwitchToggle, variant: "brandSlide", surface: surface, isFullWidth: true, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : `${leftText} or ${rightText}` }) }));
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Box, { w: "fit-content", maxW: "100%", minW: hasLabels ? "12.5rem" : undefined, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.default, { options: options, value: switchActive, onChange: onSwitchToggle, size: size, variant: "brandSlide", surface: surface, isFullWidth: true, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : `${leftText} or ${rightText}` }) }));
|
|
19
19
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SegmentedControlSize } from "../SegmentedControl/SegmentedControlProps";
|
|
1
2
|
/** @deprecated Use `SegmentedControl` — this two-option pill is kept only for existing call sites. */
|
|
2
3
|
export type SwitchProps = {
|
|
3
4
|
/** Label of the left segment; when both labels are empty the control drops its 12.5rem minimum width. */
|
|
@@ -12,6 +13,8 @@ export type SwitchProps = {
|
|
|
12
13
|
onSwitchToggle: (value: "left" | "right") => void;
|
|
13
14
|
/** Controlled selected side; the pill only moves when this changes. */
|
|
14
15
|
switchActive: "left" | "right";
|
|
16
|
+
/** Whole-track height on the button control scale (sm 32 · md 40 · lg 48px, as Button); defaults to "sm". Pass "md" beside a "md" field. */
|
|
17
|
+
size?: SegmentedControlSize;
|
|
15
18
|
/** Background this sits on. Optional: the track is opaque on any backdrop; pass it only to aim the plate's hairline edge at the real backdrop. */
|
|
16
19
|
surface?: string;
|
|
17
20
|
/** Names the radiogroup; pass it, as there is no visible group label. */
|