pixelize-design-library 2.4.2-beta.58 → 2.4.2-beta.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/COMPONENT-GOTCHAS.md +88 -2
  3. package/DESIGN-GUIDE.md +26 -3
  4. package/dist/Components/AppSwitcher/AppSwitcher.js +5 -1
  5. package/dist/Components/AppSwitcher/AppSwitcherProps.d.ts +2 -0
  6. package/dist/Components/AppSwitcher/AppSwitcherProps.js +7 -4
  7. package/dist/Components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  8. package/dist/Components/Breadcrumbs/Breadcrumbs.js +33 -10
  9. package/dist/Components/Breadcrumbs/BreadcrumbsProps.d.ts +16 -2
  10. package/dist/Components/Card/Card.d.ts +3 -1
  11. package/dist/Components/Card/Card.js +12 -2
  12. package/dist/Components/Card/CardProps.d.ts +5 -1
  13. package/dist/Components/Editor/Editor.js +50 -2
  14. package/dist/Components/Editor/EditorFieldBar.d.ts +15 -0
  15. package/dist/Components/Editor/EditorFieldBar.js +19 -0
  16. package/dist/Components/Editor/EditorProps.d.ts +74 -1
  17. package/dist/Components/Editor/MakeDynamicDialog.d.ts +12 -0
  18. package/dist/Components/Editor/MakeDynamicDialog.js +59 -0
  19. package/dist/Components/Editor/editorLabels.d.ts +4 -0
  20. package/dist/Components/Editor/editorLabels.js +24 -0
  21. package/dist/Components/Editor/editorTokenStyles.d.ts +28 -0
  22. package/dist/Components/Editor/editorTokenStyles.js +30 -0
  23. package/dist/Components/Editor/editorTokens.d.ts +26 -0
  24. package/dist/Components/Editor/editorTokens.js +134 -0
  25. package/dist/Components/Editor/useEditorBridge.d.ts +40 -0
  26. package/dist/Components/Editor/useEditorBridge.js +141 -0
  27. package/dist/Components/Kbd/Kbd.d.ts +6 -0
  28. package/dist/Components/Kbd/Kbd.js +33 -0
  29. package/dist/Components/Kbd/KbdProps.d.ts +17 -0
  30. package/dist/Components/Kbd/KbdProps.js +2 -0
  31. package/dist/Components/LauncherTrigger/LauncherTrigger.d.ts +4 -0
  32. package/dist/Components/LauncherTrigger/LauncherTrigger.js +41 -0
  33. package/dist/Components/LauncherTrigger/LauncherTriggerProps.d.ts +16 -0
  34. package/dist/Components/LauncherTrigger/LauncherTriggerProps.js +2 -0
  35. package/dist/Components/NavLauncher/NavLauncher.d.ts +3 -0
  36. package/dist/Components/NavLauncher/NavLauncher.js +395 -0
  37. package/dist/Components/NavLauncher/NavLauncherProps.d.ts +187 -0
  38. package/dist/Components/NavLauncher/NavLauncherProps.js +2 -0
  39. package/dist/Components/NavLauncher/NewTabLink.d.ts +3 -0
  40. package/dist/Components/NavLauncher/NewTabLink.js +14 -0
  41. package/dist/Components/NavLauncher/PinToggle.d.ts +3 -0
  42. package/dist/Components/NavLauncher/PinToggle.js +21 -0
  43. package/dist/Components/NavLauncher/launcherParts.d.ts +93 -0
  44. package/dist/Components/NavLauncher/launcherParts.js +130 -0
  45. package/dist/Components/NavLauncher/match.d.ts +53 -0
  46. package/dist/Components/NavLauncher/match.js +178 -0
  47. package/dist/Components/NavLauncher/revealStyles.d.ts +4 -0
  48. package/dist/Components/NavLauncher/revealStyles.js +19 -0
  49. package/dist/Components/NavigationBar/NavigationBar.d.ts +1 -1
  50. package/dist/Components/NavigationBar/NavigationBar.js +2 -2
  51. package/dist/Components/NavigationBar/NavigationBarProps.d.ts +2 -0
  52. package/dist/Components/PageHeader/PageHeader.d.ts +1 -1
  53. package/dist/Components/PageHeader/PageHeader.js +9 -2
  54. package/dist/Components/PageHeader/PageHeaderProps.d.ts +8 -0
  55. package/dist/Components/PdfViewer/PdfViewer.d.ts +21 -4
  56. package/dist/Components/PdfViewer/PdfViewer.js +124 -3
  57. package/dist/Components/Search/Search.js +2 -1
  58. package/dist/Components/SideBar/SecondaryBar.js +4 -3
  59. package/dist/Components/SideBar/SideBar.d.ts +1 -1
  60. package/dist/Components/SideBar/SideBar.js +30 -9
  61. package/dist/Components/SideBar/SideBarProps.d.ts +32 -0
  62. package/dist/Components/SideBar/components/MenuItemBox.d.ts +6 -0
  63. package/dist/Components/SideBar/components/MenuItemBox.js +8 -4
  64. package/dist/Components/SideBar/components/MenuPopoverContent.js +3 -2
  65. package/dist/Components/SideBar/components/OtherApps.js +2 -1
  66. package/dist/Components/SideBar/components/PinnedSection.d.ts +17 -0
  67. package/dist/Components/SideBar/components/PinnedSection.js +98 -0
  68. package/dist/Components/SideBar/sidebarFocus.d.ts +23 -0
  69. package/dist/Components/SideBar/sidebarFocus.js +20 -0
  70. package/dist/Components/StageProgress/StageProgress.js +2 -2
  71. package/dist/Components/StageProgress/StageProgressProps.d.ts +2 -0
  72. package/dist/Components/StageProgress/StepperStage.js +5 -2
  73. package/dist/Components/WizardDialog/WizardDialog.d.ts +9 -0
  74. package/dist/Components/WizardDialog/WizardDialog.js +102 -0
  75. package/dist/Components/WizardDialog/WizardDialogProps.d.ts +48 -0
  76. package/dist/Components/WizardDialog/WizardDialogProps.js +2 -0
  77. package/dist/Components/WizardDialog/useWizardFlow.d.ts +22 -0
  78. package/dist/Components/WizardDialog/useWizardFlow.js +47 -0
  79. package/dist/Components/WizardDialog/wizardSteps.d.ts +31 -0
  80. package/dist/Components/WizardDialog/wizardSteps.js +40 -0
  81. package/dist/esm/Components/AppSwitcher/AppSwitcher.js +2 -1
  82. package/dist/esm/Components/AppSwitcher/AppSwitcherProps.js +5 -3
  83. package/dist/esm/Components/Breadcrumbs/Breadcrumbs.js +35 -12
  84. package/dist/esm/Components/Card/Card.js +12 -2
  85. package/dist/esm/Components/Editor/Editor.js +48 -3
  86. package/dist/esm/Components/Editor/EditorFieldBar.js +13 -0
  87. package/dist/esm/Components/Editor/MakeDynamicDialog.js +20 -0
  88. package/dist/esm/Components/Editor/editorLabels.js +20 -0
  89. package/dist/esm/Components/Editor/editorTokenStyles.js +25 -0
  90. package/dist/esm/Components/Editor/editorTokens.js +121 -0
  91. package/dist/esm/Components/Editor/useEditorBridge.js +138 -0
  92. package/dist/esm/Components/Kbd/Kbd.js +28 -0
  93. package/dist/esm/Components/Kbd/KbdProps.js +1 -0
  94. package/dist/esm/Components/LauncherTrigger/LauncherTrigger.js +37 -0
  95. package/dist/esm/Components/LauncherTrigger/LauncherTriggerProps.js +1 -0
  96. package/dist/esm/Components/NavLauncher/NavLauncher.js +356 -0
  97. package/dist/esm/Components/NavLauncher/NavLauncherProps.js +1 -0
  98. package/dist/esm/Components/NavLauncher/NewTabLink.js +11 -0
  99. package/dist/esm/Components/NavLauncher/PinToggle.js +18 -0
  100. package/dist/esm/Components/NavLauncher/launcherParts.js +110 -0
  101. package/dist/esm/Components/NavLauncher/match.js +172 -0
  102. package/dist/esm/Components/NavLauncher/revealStyles.js +15 -0
  103. package/dist/esm/Components/NavigationBar/NavigationBar.js +3 -3
  104. package/dist/esm/Components/PageHeader/PageHeader.js +9 -2
  105. package/dist/esm/Components/PdfViewer/PdfViewer.js +123 -2
  106. package/dist/esm/Components/Search/Search.js +3 -2
  107. package/dist/esm/Components/SideBar/SecondaryBar.js +4 -3
  108. package/dist/esm/Components/SideBar/SideBar.js +31 -10
  109. package/dist/esm/Components/SideBar/components/MenuItemBox.js +4 -2
  110. package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +3 -2
  111. package/dist/esm/Components/SideBar/components/OtherApps.js +2 -1
  112. package/dist/esm/Components/SideBar/components/PinnedSection.js +92 -0
  113. package/dist/esm/Components/SideBar/sidebarFocus.js +15 -0
  114. package/dist/esm/Components/StageProgress/StageProgress.js +2 -2
  115. package/dist/esm/Components/StageProgress/StepperStage.js +5 -2
  116. package/dist/esm/Components/WizardDialog/WizardDialog.js +58 -0
  117. package/dist/esm/Components/WizardDialog/WizardDialogProps.js +1 -0
  118. package/dist/esm/Components/WizardDialog/useWizardFlow.js +44 -0
  119. package/dist/esm/Components/WizardDialog/wizardSteps.js +35 -0
  120. package/dist/esm/index.js +7 -0
  121. package/dist/index.d.ts +19 -4
  122. package/dist/index.js +21 -1
  123. package/package.json +1 -1
@@ -1,15 +1,32 @@
1
1
  import React from "react";
2
+ /** Visible strings; every key falls back to its English default. */
3
+ export type PdfViewerLabels = Partial<{
4
+ open: string;
5
+ download: string;
6
+ unsupported: string;
7
+ failed: string;
8
+ }>;
2
9
  export interface PdfViewerProps {
3
- /** Rendered via a native browser <embed> — no fallback UI if the browser can't show PDFs inline. */
4
- pdfUrl: string;
5
- /** File name shown in the toolbar. */
10
+ /** URL of the PDF, rendered via a native browser <embed>; pass exactly one of `pdfUrl` / `getBlob`. */
11
+ pdfUrl?: string;
12
+ /** Source as a blob getter instead of a URL — for authed files; the viewer makes and revokes the object URL. */
13
+ getBlob?: () => Promise<Blob>;
14
+ /** File name shown in the toolbar and used as the download name. */
6
15
  fileName?: string;
7
16
  /** Height of the embed. */
8
17
  height?: string;
9
- /** Show the toolbar (name + open + download). */
18
+ /** Show the toolbar (name + open + download); set false when the caller renders its own file actions. */
10
19
  showToolbar?: boolean;
11
20
  /** Border radius of the frame. */
12
21
  borderRadius?: string;
22
+ /** What shows when inline PDF is unsupported or loading failed. Default: message + Open + Download. */
23
+ fallback?: React.ReactNode;
24
+ /** Fires when the embed loads; in blob mode, when the file bytes are ready (<embed> has no reliable load event). */
25
+ onLoad?: () => void;
26
+ /** Fires when `getBlob` rejects or an on-demand Open/Download fetch fails. */
27
+ onError?: (error: unknown) => void;
28
+ labels?: PdfViewerLabels;
29
+ "data-testid"?: string;
13
30
  }
14
31
  /** Always-inline PDF embed panel (never a modal) — for a modal previewer of images/video/other too, use FilePreview. */
15
32
  declare const PdfViewer: React.FC<PdfViewerProps>;
@@ -4,18 +4,139 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("@chakra-ui/react");
7
+ const react_1 = require("react");
8
+ const react_2 = require("@chakra-ui/react");
8
9
  const lucide_react_1 = require("lucide-react");
9
10
  const useCustomTheme_1 = require("../../Theme/useCustomTheme");
10
11
  const accentText_1 = require("../../Theme/tokens/builders/accentText");
11
12
  const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
13
+ const Button_1 = __importDefault(require("../Button/Button"));
14
+ const Skeletons_1 = __importDefault(require("../Skeletons/Skeletons"));
12
15
  const ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
16
+ const DEFAULT_LABELS = {
17
+ open: "Open in new tab",
18
+ download: "Download",
19
+ unsupported: "This browser can't display PDFs inline. Open or download the file instead.",
20
+ failed: "The document could not be loaded.",
21
+ };
22
+ const canEmbedPdf = () => typeof navigator === "undefined" || navigator.pdfViewerEnabled !== false;
23
+ const asPdf = (blob) => (blob.type ? blob : new Blob([blob], { type: "application/pdf" }));
13
24
  /** Always-inline PDF embed panel (never a modal) — for a modal previewer of images/video/other too, use FilePreview. */
14
- const PdfViewer = ({ pdfUrl, fileName = "Document.pdf", height = "480px", showToolbar = true, borderRadius = "xl", }) => {
25
+ const PdfViewer = ({ pdfUrl, getBlob, fileName = "Document.pdf", height = "480px", showToolbar = true, borderRadius = "xl", fallback, onLoad, onError, labels, "data-testid": testId, }) => {
15
26
  const theme = (0, useCustomTheme_1.useCustomTheme)();
27
+ const text = { ...DEFAULT_LABELS, ...labels };
16
28
  const toolbarSurface = theme.colors.background[50];
17
29
  const iconHoverInk = (0, accentText_1.accentTextOnCanvas)(theme.colors.primary, toolbarSurface);
18
30
  const iconHoverBg = (0, rowStates_1.listRowBackgrounds)(theme.colors).active;
19
- return ((0, jsx_runtime_1.jsxs)(react_1.Box, { border: "1px solid", borderColor: theme.colors.gray[200], borderRadius: borderRadius, overflow: "hidden", bg: theme.colors.background[50], children: [showToolbar && ((0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", justify: "space-between", px: 4, py: 2.5, borderBottom: "1px solid", borderColor: theme.colors.gray[100], bg: theme.colors.background[50], children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 2, minW: 0, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.FileText, { size: 18, color: theme.colors.accentText }), (0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "sm", fontWeight: 500, color: theme.colors.gray[700], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: fileName })] }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: 1, children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Open in new tab", placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "a", href: pdfUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": `Open ${fileName} in a new tab`, p: 2, borderRadius: "lg", color: theme.colors.gray[600], _hover: { bg: iconHoverBg, color: iconHoverInk }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { size: 16 }) }) }), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: "Download", placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: "a", href: pdfUrl, download: fileName, "aria-label": `Download ${fileName}`, p: 2, borderRadius: "lg", color: theme.colors.gray[600], _hover: { bg: iconHoverBg, color: iconHoverInk }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Download, { size: 16 }) }) })] })] })), (0, jsx_runtime_1.jsx)(react_1.Box, { as: "embed", src: pdfUrl, type: "application/pdf", width: "100%", height: height, display: "block" })] }));
31
+ const supported = canEmbedPdf();
32
+ const isBlobMode = Boolean(getBlob);
33
+ const getBlobRef = (0, react_1.useRef)(getBlob);
34
+ const onLoadRef = (0, react_1.useRef)(onLoad);
35
+ const onErrorRef = (0, react_1.useRef)(onError);
36
+ getBlobRef.current = getBlob;
37
+ onLoadRef.current = onLoad;
38
+ onErrorRef.current = onError;
39
+ const [status, setStatus] = (0, react_1.useState)(isBlobMode && supported ? "loading" : "idle");
40
+ const [objectUrl, setObjectUrl] = (0, react_1.useState)(null);
41
+ const tempUrls = (0, react_1.useRef)([]);
42
+ (0, react_1.useEffect)(() => {
43
+ var _a;
44
+ if (!isBlobMode || !supported)
45
+ return undefined;
46
+ let cancelled = false;
47
+ let created = null;
48
+ setStatus("loading");
49
+ setObjectUrl(null);
50
+ (_a = getBlobRef.current) === null || _a === void 0 ? void 0 : _a.call(getBlobRef).then((blob) => {
51
+ var _a;
52
+ if (cancelled)
53
+ return;
54
+ created = URL.createObjectURL(asPdf(blob));
55
+ setObjectUrl(created);
56
+ setStatus("ready");
57
+ (_a = onLoadRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadRef);
58
+ }, (error) => {
59
+ var _a;
60
+ if (cancelled)
61
+ return;
62
+ setStatus("error");
63
+ (_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error);
64
+ });
65
+ return () => {
66
+ cancelled = true;
67
+ if (created)
68
+ URL.revokeObjectURL(created);
69
+ };
70
+ }, [isBlobMode, supported]);
71
+ (0, react_1.useEffect)(() => () => {
72
+ tempUrls.current.forEach((url) => URL.revokeObjectURL(url));
73
+ tempUrls.current = [];
74
+ }, []);
75
+ const makeTempUrl = (0, react_1.useCallback)((blob) => {
76
+ const url = URL.createObjectURL(asPdf(blob));
77
+ tempUrls.current.push(url);
78
+ return url;
79
+ }, []);
80
+ const openBlob = () => {
81
+ var _a;
82
+ if (objectUrl) {
83
+ window.open(objectUrl, "_blank", "noopener");
84
+ return;
85
+ }
86
+ const tab = window.open("", "_blank");
87
+ (_a = getBlobRef.current) === null || _a === void 0 ? void 0 : _a.call(getBlobRef).then((blob) => {
88
+ const url = makeTempUrl(blob);
89
+ if (tab)
90
+ tab.location.href = url;
91
+ else
92
+ window.location.assign(url);
93
+ }, (error) => {
94
+ var _a;
95
+ tab === null || tab === void 0 ? void 0 : tab.close();
96
+ (_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error);
97
+ });
98
+ };
99
+ const downloadBlob = () => {
100
+ var _a;
101
+ (_a = getBlobRef.current) === null || _a === void 0 ? void 0 : _a.call(getBlobRef).then((blob) => {
102
+ const link = document.createElement("a");
103
+ link.href = makeTempUrl(blob);
104
+ link.download = fileName;
105
+ document.body.appendChild(link);
106
+ link.click();
107
+ link.remove();
108
+ }, (error) => { var _a; return (_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error); });
109
+ };
110
+ const toolbarLabel = (kind) => {
111
+ if (labels === null || labels === void 0 ? void 0 : labels[kind])
112
+ return `${labels[kind]} ${fileName}`;
113
+ return kind === "open" ? `Open ${fileName} in a new tab` : `Download ${fileName}`;
114
+ };
115
+ const actionStyle = {
116
+ p: 2,
117
+ borderRadius: "lg",
118
+ color: theme.colors.gray[600],
119
+ _hover: { bg: iconHoverBg, color: iconHoverInk },
120
+ };
121
+ const openAction = isBlobMode ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", onClick: openBlob, "aria-label": toolbarLabel("open"), ...actionStyle, children: (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { size: 16, "aria-hidden": "true" }) })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "a", href: pdfUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": toolbarLabel("open"), ...actionStyle, children: (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { size: 16, "aria-hidden": "true" }) }));
122
+ const downloadAction = isBlobMode && !objectUrl ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", onClick: downloadBlob, "aria-label": toolbarLabel("download"), ...actionStyle, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Download, { size: 16, "aria-hidden": "true" }) })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "a", href: objectUrl !== null && objectUrl !== void 0 ? objectUrl : pdfUrl, download: fileName, "aria-label": toolbarLabel("download"), ...actionStyle, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Download, { size: 16, "aria-hidden": "true" }) }));
123
+ const showFallback = !supported || status === "error";
124
+ const isLoading = isBlobMode && supported && status === "loading";
125
+ const renderFallback = () => {
126
+ if (fallback !== undefined)
127
+ return fallback;
128
+ return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", align: "flex-start", gap: 3, p: 4, "data-testid": "pdf-fallback", children: [(0, jsx_runtime_1.jsx)(react_2.Text, { role: "status", fontSize: "sm", color: theme.colors.textMuted, children: supported ? text.failed : text.unsupported }), !showToolbar && ((0, jsx_runtime_1.jsxs)(react_2.Flex, { gap: 2, wrap: "wrap", children: [(0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outline", colorScheme: "gray", leftIcon: (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { size: 16, "aria-hidden": "true" }), label: text.open, onClick: isBlobMode ? openBlob : () => window.open(pdfUrl, "_blank", "noopener"), "data-testid": "pdf-open" }), (0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outline", colorScheme: "gray", leftIcon: (0, jsx_runtime_1.jsx)(lucide_react_1.Download, { size: 16, "aria-hidden": "true" }), label: text.download, onClick: isBlobMode ? downloadBlob : directDownload(pdfUrl, fileName), "data-testid": "pdf-download" })] }))] }));
129
+ };
130
+ return ((0, jsx_runtime_1.jsxs)(react_2.Box, { border: "1px solid", borderColor: theme.colors.gray[200], borderRadius: borderRadius, overflow: "hidden", bg: theme.colors.background[50], "data-testid": testId, children: [showToolbar && ((0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", justify: "space-between", px: 4, py: 2.5, borderBottom: "1px solid", borderColor: theme.colors.gray[100], bg: theme.colors.background[50], children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, minW: 0, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.FileText, { size: 18, color: theme.colors.accentText, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", fontWeight: 500, color: theme.colors.gray[700], overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: fileName })] }), (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 1, children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: text.open, placement: "top", children: openAction }), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: text.download, placement: "top", children: downloadAction })] })] })), showFallback ? (renderFallback()) : isLoading ? ((0, jsx_runtime_1.jsx)(react_2.Box, { "aria-busy": "true", "data-testid": "pdf-loading", children: (0, jsx_runtime_1.jsx)(Skeletons_1.default, { type: "skeleton", height: height, width: "100%", borderRadius: "0" }) })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "embed", src: objectUrl !== null && objectUrl !== void 0 ? objectUrl : pdfUrl, type: "application/pdf", title: fileName, onLoad: isBlobMode ? undefined : () => { var _a; return (_a = onLoadRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadRef); }, width: "100%", height: height, display: "block" }))] }));
131
+ };
132
+ const directDownload = (url, fileName) => () => {
133
+ if (!url)
134
+ return;
135
+ const link = document.createElement("a");
136
+ link.href = url;
137
+ link.download = fileName;
138
+ document.body.appendChild(link);
139
+ link.click();
140
+ link.remove();
20
141
  };
21
142
  exports.default = PdfViewer;
@@ -7,6 +7,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
8
  const react_2 = require("@chakra-ui/react");
9
9
  const lucide_react_1 = require("lucide-react");
10
+ const Kbd_1 = __importDefault(require("../Kbd/Kbd"));
10
11
  const FormLabel_1 = require("../Common/FormLabel");
11
12
  const FieldMessage_1 = __importDefault(require("../Common/FieldMessage"));
12
13
  const useFieldIds_1 = require("../Common/useFieldIds");
@@ -49,6 +50,6 @@ const Search = (0, react_1.forwardRef)(function Search({ placeholder = "Search..
49
50
  ps: spec.height,
50
51
  pe: rightPadding,
51
52
  ...(0, motion_1.reducedMotionSx)(),
52
- } }), (showClear || showHint) && ((0, jsx_runtime_1.jsxs)(react_2.InputRightElement, { h: spec.height, w: "auto", pe: spec.paddingX, gap: 1, children: [showClear && ((0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": "Clear search", icon: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: spec.iconSize }), variant: "ghost", size: "xs", h: clearSize, minW: clearSize, color: theme.colors.textMuted, onClick: handleClear, sx: (0, focusRing_styles_1.focusVisibleStyles)(theme.colors) })), showHint && ((0, jsx_runtime_1.jsx)(react_2.Kbd, { "aria-hidden": true, fontSize: "0.6875rem", fontWeight: 500, color: theme.colors.textMuted, bg: theme.colors.backgroundColor.subtle, borderColor: theme.colors.boxborder[200], whiteSpace: "nowrap", children: shortcut }))] }))] }), (0, jsx_runtime_1.jsx)(FieldMessage_1.default, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
53
+ } }), (showClear || showHint) && ((0, jsx_runtime_1.jsxs)(react_2.InputRightElement, { h: spec.height, w: "auto", pe: spec.paddingX, gap: 1, children: [showClear && ((0, jsx_runtime_1.jsx)(react_2.IconButton, { "aria-label": "Clear search", icon: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: spec.iconSize }), variant: "ghost", size: "xs", h: clearSize, minW: clearSize, color: theme.colors.textMuted, onClick: handleClear, sx: (0, focusRing_styles_1.focusVisibleStyles)(theme.colors) })), showHint && ((0, jsx_runtime_1.jsx)("span", { "aria-hidden": true, children: (0, jsx_runtime_1.jsx)(Kbd_1.default, { size: "xs", children: shortcut }) }))] }))] }), (0, jsx_runtime_1.jsx)(FieldMessage_1.default, { error: error, errorMessage: errorMessage, helperText: helperText, helperId: ids.helperId, errorId: ids.errorId })] }));
53
54
  });
54
55
  exports.default = Search;
@@ -9,6 +9,7 @@ const react_2 = require("@chakra-ui/react");
9
9
  const useCustomTheme_1 = require("../../Theme/useCustomTheme");
10
10
  const sidebarAccentColors_1 = require("./sidebarAccentColors");
11
11
  const motion_1 = require("../../Theme/tokens/primitives/motion");
12
+ const sidebarFocus_1 = require("./sidebarFocus");
12
13
  const menuDisabled_1 = require("./menuDisabled");
13
14
  const lucide_react_1 = require("lucide-react");
14
15
  const OverflowTooltipText_1 = __importDefault(require("./components/OverflowTooltipText"));
@@ -51,7 +52,7 @@ const CollapsedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
51
52
  e.preventDefault();
52
53
  if (!blocked)
53
54
  onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
54
- }, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: (0, jsx_runtime_1.jsxs)(react_2.Box, { position: "relative", display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.sidebar.semanticText.error }))] }) }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: blocked ? "not-allowed" : "pointer", zIndex: 1500, color: theme.colors.white, border: 'none', children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: 3, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, justify: "space-between", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, flex: "1", minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: "md", flexShrink: 0 }), (0, jsx_runtime_1.jsx)(OverflowTooltipText_1.default, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: "medium", as: "p", children: item.title })] }), item.locked ? (item.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: item.lockedReason, placement: "top", children: (0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon }) })) : ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon }))) : (badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Badge, { ...softBadge(theme.colors, colorScheme, (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.elevated)), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }) }) }) })] }));
55
+ }, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: (0, jsx_runtime_1.jsxs)(react_2.Box, { position: "relative", display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.sidebar.semanticText.error }))] }) }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: blocked ? "not-allowed" : "pointer", zIndex: 1500, color: theme.colors.white, border: 'none', children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: 3, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, justify: "space-between", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, flex: "1", minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: "md", flexShrink: 0 }), (0, jsx_runtime_1.jsx)(OverflowTooltipText_1.default, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: "medium", as: "p", children: item.title })] }), item.locked ? (item.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: item.lockedReason, placement: "top", children: (0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon }) })) : ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon }))) : (badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Badge, { ...softBadge(theme.colors, colorScheme, (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.elevated)), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }) }) }) })] }));
55
56
  };
56
57
  const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
57
58
  var _a;
@@ -65,7 +66,7 @@ const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
65
66
  e.preventDefault();
66
67
  if (!blocked)
67
68
  onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
68
- }, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: "background 0.12s", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), (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: itemFontSize, fontWeight: isActive ? 600 : 500, color: isActive ? activeAccent.label : theme.colors.white, _groupHover: isActive ? undefined : { color: theme.colors.white }, as: "p", children: item.title }) })] }), item.locked ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon })) : (badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Badge, { ...softBadge(theme.colors, colorScheme, (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }));
69
+ }, borderLeft: "2px solid", borderLeftColor: isActive ? theme.colors.sidebar.activeIcon : "transparent", transition: "background 0.12s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, flex: "1", minW: 0, overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: item.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), (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: itemFontSize, fontWeight: isActive ? 600 : 500, color: isActive ? activeAccent.label : theme.colors.white, _groupHover: isActive ? undefined : { color: theme.colors.white }, as: "p", children: item.title }) })] }), item.locked ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "sm", flexShrink: 0, color: theme.colors.sidebar.mutedIcon })) : (badgeVal != null && ((0, jsx_runtime_1.jsx)(react_2.Badge, { ...softBadge(theme.colors, colorScheme, (0, sidebarAccent_1.sidebarRowPeak)(theme.colors.sidebar.background[500])), fontSize: "xs", variant: variant, borderRadius: radius, children: badgeVal })))] }));
69
70
  return item.locked && item.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: item.lockedReason, placement: "top", children: row })) : (row);
70
71
  };
71
72
  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, }) => {
@@ -74,7 +75,7 @@ const SecondaryBar = ({ items = [], defaultCollapsed = true, collapsedWidth = "3
74
75
  const scrollContainerId = (0, sidebarId_1.sanitizeId)((0, react_1.useId)());
75
76
  const [collapsed, setCollapsed] = (0, react_1.useState)(defaultCollapsed);
76
77
  const width = collapsed ? collapsedWidth : expandedWidth;
77
- 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)(jsx_runtime_1.Fragment, { 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: "background 0.15s", 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) => {
78
+ 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)(jsx_runtime_1.Fragment, { 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: "background 0.15s", 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) => {
78
79
  var _a;
79
80
  const isActive = String(selected) === String(item.id) ||
80
81
  String(selected) === String(item.title);
@@ -1,2 +1,2 @@
1
1
  import { SidebarProps } from "./SideBarProps";
2
- export default function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick, toggle, changeToggle, logo, companyName, companySubtitle, user, isDisableAddNew, onAddNewClick, selectedSubMenu, selectedSecondaryItem, isLoading, loadingLines, open, otherApps, mobileOpen, onMobileClose, mobileNav, onToggleMobileNav, peekOpen, onPeekEnd, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick, toggle, changeToggle, logo, companyName, companySubtitle, user, isDisableAddNew, onAddNewClick, selectedSubMenu, selectedSecondaryItem, isLoading, loadingLines, open, otherApps, mobileOpen, onMobileClose, mobileNav, onToggleMobileNav, peekOpen, onPeekEnd, pinnedItems, pinnedLabel, onUnpin, activePinnedId, pinnedLimit, pinnedLabels, collapseTransition, autoCollapse, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
@@ -13,6 +13,7 @@ const sidebarId_1 = require("./sidebarId");
13
13
  const Sidebar_1 = require("../../Constants/Sidebar");
14
14
  const overlay_styles_1 = require("../../Theme/chakra/overlay.styles");
15
15
  const motion_1 = require("../../Theme/chakra/motion");
16
+ const sidebarFocus_1 = require("./sidebarFocus");
16
17
  const motion_2 = require("../../Theme/tokens/primitives/motion");
17
18
  const lucide_react_1 = require("lucide-react");
18
19
  // Overlay stacking — mirrors theme.zIndices (overlay=1300 scrim, modal=1400 panel).
@@ -24,6 +25,18 @@ const Z_PANEL = 1400;
24
25
  const RAIL_WIDTH = "4.688rem";
25
26
  const PANEL_EASE = "cubic-bezier(0.22, 1, 0.36, 1)";
26
27
  const EXPANDED_WIDTH = "13rem";
28
+ const COLLAPSE_MS = { ...motion_2.MOTION_MS, slow: 260 };
29
+ const NO_ACTIVE_MENU = "\u0000pinned-active";
30
+ const inlineTransitions = (collapse) => {
31
+ var _a;
32
+ if (collapse === "none")
33
+ return { width: "none", shadow: "none" };
34
+ const ms = COLLAPSE_MS[(_a = collapse.speed) !== null && _a !== void 0 ? _a : "slow"];
35
+ return {
36
+ width: `width ${ms}ms ${PANEL_EASE}`,
37
+ shadow: collapse.animateShadow === false ? "none" : `box-shadow ${ms}ms ${motion_2.MOTION_EASE}`,
38
+ };
39
+ };
27
40
  const OVERLAY_WIDTH = "14.7rem";
28
41
  const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
29
42
  const MenuItems_1 = __importDefault(require("./components/MenuItems"));
@@ -31,6 +44,7 @@ const defaultLogo_1 = __importDefault(require("../../Assets/defaultLogo"));
31
44
  const OverflowTooltipText_1 = __importDefault(require("./components/OverflowTooltipText"));
32
45
  const SecondaryBar_1 = __importDefault(require("./SecondaryBar"));
33
46
  const OtherApps_1 = __importDefault(require("./components/OtherApps"));
47
+ const PinnedSection_1 = __importDefault(require("./components/PinnedSection"));
34
48
  const sidebarScale_1 = require("./sidebarScale");
35
49
  const viewportHeight_1 = require("../../Theme/tokens/builders/viewportHeight");
36
50
  const SidebarHeader = ({ logo, companyName, companySubtitle, toggle, isLoading, onToggle, overlay, onClose, }) => {
@@ -47,6 +61,7 @@ const SidebarHeader = ({ logo, companyName, companySubtitle, toggle, isLoading,
47
61
  // some brands (zinc), making the tile disappear. See THEME-CONTRACT.md sidebar rules.
48
62
  bg: theme.colors.sidebar.activeBg, color: activeAccent.label, borderRadius: "lg", boxSize: "1.75rem", display: "flex", alignItems: "center", justifyContent: "center", fontWeight: "bold", flexShrink: 0, cursor: toggle ? "pointer" : undefined, onClick: toggle ? onToggle : undefined, children: (0, jsx_runtime_1.jsx)(defaultLogo_1.default, {}) }));
49
63
  return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { h: Sidebar_1.HEADER_HEIGHT, w: "100%", alignItems: "center", justifyContent: toggle ? "center" : "flex-start", gap: 2, px: toggle ? "8px" : "10px", borderBottom: "1px solid", borderColor: theme.colors.sidebar.divider, minW: 0, overflow: "hidden", flexShrink: 0, children: [logoNode, !toggle && ((0, jsx_runtime_1.jsxs)(react_2.Box, { flex: "1", minW: 0, children: [(0, jsx_runtime_1.jsx)(OverflowTooltipText_1.default, { placement: "right", fontWeight: 600, fontSize: sidebarScale_1.SIDEBAR_CHROME.titleFontSize, textAlign: "left", color: theme.colors.white, lineHeight: "1.3", as: "p", width: "100%", children: companyName !== null && companyName !== void 0 ? companyName : "" }), companySubtitle && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: sidebarScale_1.SIDEBAR_CHROME.metaFontSize, color: theme.colors.sidebar.mutedLabel, lineHeight: "1.3", isTruncated: true, children: companySubtitle }))] })), !toggle && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", onClick: overlay ? onClose : onToggle, "aria-label": overlay ? "Close menu" : "Collapse sidebar", w: "22px", h: "22px", borderRadius: "lg", bg: "whiteAlpha.200", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, position: "relative", _hover: { bg: "whiteAlpha.300" }, transition: "background 0.15s", sx: {
64
+ ...(0, sidebarFocus_1.sidebarFocusStyles)(theme.colors),
50
65
  "&::after": {
51
66
  content: '""',
52
67
  position: "absolute",
@@ -65,7 +80,7 @@ const SkeletonMenuRow = ({ toggle }) => {
65
80
  const AddNewButton = ({ toggle, onClick, overlay }) => {
66
81
  const theme = (0, useCustomTheme_1.useCustomTheme)();
67
82
  const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
68
- 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: overlay ? "11px" : "7px", borderRadius: "lg", cursor: "pointer", border: "none", bg: "transparent", w: "100%", mb: "2px", justifyContent: toggle ? "center" : "flex-start", _hover: { backgroundColor: "whiteAlpha.200" }, transition: "background 0.12s", 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: "medium", children: "Add New" }))] }));
83
+ 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: overlay ? "11px" : "7px", borderRadius: "lg", cursor: "pointer", border: "none", bg: "transparent", w: "100%", mb: "2px", justifyContent: toggle ? "center" : "flex-start", _hover: { backgroundColor: "whiteAlpha.200" }, transition: "background 0.12s", 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: "medium", children: "Add New" }))] }));
69
84
  };
70
85
  const deriveInitials = (user) => {
71
86
  if (user.initials)
@@ -83,13 +98,13 @@ const UserFooter = ({ user, toggle, overlay }) => {
83
98
  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",
84
99
  // Same rail-safe pairing as the logo tile — primary.opacity[32] was invisible on zinc/skyline.
85
100
  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) }));
86
- 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: overlay ? "10px" : "6px", w: "100%", borderRadius: "lg", cursor: "pointer", bg: "transparent", border: "none", justify: toggle ? "center" : "flex-start", _hover: { bg: "whiteAlpha.200" }, transition: "background 0.12s", 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 })] }) }));
101
+ 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: overlay ? "10px" : "6px", w: "100%", borderRadius: "lg", cursor: "pointer", bg: "transparent", border: "none", justify: toggle ? "center" : "flex-start", _hover: { bg: "whiteAlpha.200" }, transition: "background 0.12s", 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 })] }) }));
87
102
  };
88
103
  // Footer "cell" — one segment of the Collapse | Hide/Show control.
89
104
  const ControlCell = ({ onClick, ariaLabel, label, accent, children }) => {
90
105
  const theme = (0, useCustomTheme_1.useCustomTheme)();
91
106
  const activeAccent = (0, sidebarAccentColors_1.getSidebarActiveAccent)(theme.colors);
92
- return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", "aria-label": ariaLabel, flex: "1", minW: 0, alignItems: "center", justifyContent: "center", gap: "7px", px: "10px", py: "14px", cursor: "pointer", border: "none", bg: accent ? "whiteAlpha.300" : "transparent", onClick: onClick, _hover: { bg: accent ? "whiteAlpha.400" : "whiteAlpha.200" }, transition: "background 0.15s", children: [children, label && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: sidebarScale_1.SIDEBAR_CHROME.labelFontSize, color: accent ? activeAccent.label : theme.colors.sidebar.mutedLabel, fontWeight: "medium", children: label }))] }));
107
+ return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", "aria-label": ariaLabel, flex: "1", minW: 0, alignItems: "center", justifyContent: "center", gap: "7px", px: "10px", py: "14px", cursor: "pointer", border: "none", bg: accent ? "whiteAlpha.300" : "transparent", onClick: onClick, _hover: { bg: accent ? "whiteAlpha.400" : "whiteAlpha.200" }, transition: "background 0.15s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: [children, label && ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: sidebarScale_1.SIDEBAR_CHROME.labelFontSize, color: accent ? activeAccent.label : theme.colors.sidebar.mutedLabel, fontWeight: "medium", children: label }))] }));
93
108
  };
94
109
  // Collapse (mini-rail) sits next to the Hide/Show navbar-mode toggle. In the
95
110
  // desktop mobile-nav overlay only "Show" (return to the docked sidebar) is shown;
@@ -108,7 +123,7 @@ const FooterControls = ({ toggle, overlay, mobileNav, onToggleCollapse, onToggle
108
123
  return shell((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ControlCell, { onClick: onToggleCollapse, ariaLabel: toggle ? "Expand sidebar" : undefined, label: toggle ? undefined : "Collapse", children: toggle ? ((0, jsx_runtime_1.jsx)(lucide_react_1.ArrowRightToLine, { size: 14, color: iconColor })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeftToLine, { size: 14, color: iconColor })) }), onToggleMobileNav && ((0, jsx_runtime_1.jsx)(ControlCell, { onClick: onToggleMobileNav, ariaLabel: toggle ? "Show sidebar in overlay mode" : undefined, label: toggle ? undefined : "Hide", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Maximize2, { size: 14, color: iconColor }) }))] }));
109
124
  };
110
125
  // --- Main Sidebar component ---
111
- function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick, toggle, changeToggle, logo, companyName, companySubtitle, user, isDisableAddNew = false, onAddNewClick, selectedSubMenu, selectedSecondaryItem, isLoading, loadingLines, open = true, otherApps, mobileOpen = false, onMobileClose, mobileNav = false, onToggleMobileNav, peekOpen = false, onPeekEnd, }) {
126
+ function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick, toggle, changeToggle, logo, companyName, companySubtitle, user, isDisableAddNew = false, onAddNewClick, selectedSubMenu, selectedSecondaryItem, isLoading, loadingLines, open = true, otherApps, mobileOpen = false, onMobileClose, mobileNav = false, onToggleMobileNav, peekOpen = false, onPeekEnd, pinnedItems, pinnedLabel, onUnpin, activePinnedId, pinnedLimit, pinnedLabels, collapseTransition = { speed: "slow" }, autoCollapse = true, }) {
112
127
  var _a, _b;
113
128
  const theme = (0, useCustomTheme_1.useCustomTheme)();
114
129
  const scrollContainerId = (0, sidebarId_1.sanitizeId)((0, react_1.useId)());
@@ -148,20 +163,24 @@ function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick,
148
163
  const activeTop = menus.find((m) => String(m.title) === String(activeMenu)) ||
149
164
  menus.find((m) => String(m.id) === String(activeMenu));
150
165
  const secondaryItems = (_b = activeTop === null || activeTop === void 0 ? void 0 : activeTop.secondaryItems) !== null && _b !== void 0 ? _b : [];
166
+ const inline = inlineTransitions(collapseTransition);
167
+ const pinnedActive = activePinnedId != null && !!(pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems.some((p) => String(p.id) === String(activePinnedId)));
151
168
  // Sync toggle with external `open` prop.
152
169
  // `open=false` → collapsed (toggle=true); `open=true` → expanded (toggle=false).
153
170
  (0, react_1.useEffect)(() => {
171
+ if (!autoCollapse)
172
+ return;
154
173
  const shouldBeCollapsed = !open;
155
174
  if (shouldBeCollapsed !== toggleRef.current) {
156
175
  changeToggleRef.current();
157
176
  }
158
- }, [open]);
177
+ }, [open, autoCollapse]);
159
178
  // Auto-collapse the main sidebar whenever a secondary panel is active.
160
179
  (0, react_1.useEffect)(() => {
161
- if (secondaryItems.length > 0 && !toggleRef.current) {
180
+ if (autoCollapse && secondaryItems.length > 0 && !toggleRef.current) {
162
181
  changeToggleRef.current();
163
182
  }
164
- }, [secondaryItems.length]);
183
+ }, [secondaryItems.length, autoCollapse]);
165
184
  // Esc closes the overlay.
166
185
  (0, react_1.useEffect)(() => {
167
186
  if (!isOverlayOpen)
@@ -263,12 +282,14 @@ function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick,
263
282
  base: dragging
264
283
  ? "none"
265
284
  : "transform 0.28s cubic-bezier(0.22, 1, 0.36, 1)",
266
- lg: (0, motion_2.transitionFor)(["box-shadow"], "base"),
285
+ lg: inline.shadow,
267
286
  }, borderRadius: "none", boxShadow: mobileNav ? theme.shadows["2xl"] : { base: theme.shadows["2xl"], lg: theme.shadows.lg }, display: "flex", background: theme.colors.sidebar.background[500], borderRight: "1px 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: {
268
287
  ...viewportHeight_1.fullViewportHeight,
269
288
  touchAction: overlay ? "pan-y" : "auto",
270
289
  [motion_1.REDUCED_MOTION_QUERY]: { "&, & *": { transition: "none", animation: "none" } },
271
290
  }, onMouseLeave: overlayPeeking ? onPeekEnd : undefined, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { width: mobileNav
272
291
  ? OVERLAY_WIDTH
273
- : { base: OVERLAY_WIDTH, lg: effToggle ? RAIL_WIDTH : EXPANDED_WIDTH }, transition: `width 0.26s ${PANEL_EASE}`, 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.jsx)(MenuItems_1.default, { activeMenu: activeMenu, menus: menus, handleMenuClick: handleMenuClickInternal, toggle: effToggle, selectedSubMenu: selectedSubMenu, overlay: overlay, 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, overlay: overlay }) })), (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, overlay: overlay }), (0, jsx_runtime_1.jsx)(FooterControls, { toggle: effToggle, overlay: overlay, mobileNav: mobileNav, onToggleCollapse: changeToggle, onToggleMobileNav: onToggleMobileNav })] })] }) }), secondaryItems.length > 0 && ((0, jsx_runtime_1.jsx)(SecondaryBar_1.default, { items: secondaryItems, defaultCollapsed: effToggle, collapsedWidth: "3.5rem", expandedWidth: "10rem", 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" }))] })] }));
292
+ : { base: OVERLAY_WIDTH, lg: effToggle ? RAIL_WIDTH : EXPANDED_WIDTH }, transition: mobileNav
293
+ ? `width 0.26s ${PANEL_EASE}`
294
+ : { base: `width 0.26s ${PANEL_EASE}`, 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, overlay: overlay, 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, overlay: overlay }) })), (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, overlay: overlay }), (0, jsx_runtime_1.jsx)(FooterControls, { toggle: effToggle, overlay: overlay, mobileNav: mobileNav, onToggleCollapse: changeToggle, onToggleMobileNav: onToggleMobileNav })] })] }) }), secondaryItems.length > 0 && ((0, jsx_runtime_1.jsx)(SecondaryBar_1.default, { items: secondaryItems, defaultCollapsed: effToggle, collapsedWidth: "3.5rem", expandedWidth: "10rem", 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" }))] })] }));
274
295
  }
@@ -47,6 +47,38 @@ export type SidebarProps = {
47
47
  /** Shows the sidebar without pinning — closes on pointer-leave. Wire to NavigationBar's `onSideBarPeek`. */
48
48
  peekOpen?: boolean;
49
49
  onPeekEnd?: () => void;
50
+ /** Rendered above `menus` under a `pinnedLabel` heading; the whole block is omitted when empty. */
51
+ pinnedItems?: SidebarPinnedItem[];
52
+ /** Heading above the pinned block; defaults to "Pinned". */
53
+ pinnedLabel?: string;
54
+ /** Shows an unpin button on row hover/focus (always visible in the overlay); omit for read-only rows. */
55
+ onUnpin?: (item: SidebarPinnedItem) => void;
56
+ /** Matched against pinned ids for the active state; while it matches, the same id in `menus` is not highlighted. */
57
+ activePinnedId?: string | number | null;
58
+ /** Rows shown before the rest collapse behind a "Show N more" row; defaults to 5. */
59
+ pinnedLimit?: number;
60
+ /** Overrides for the pinned block's strings; `{count}` and `{title}` are substituted. */
61
+ pinnedLabels?: SidebarPinnedLabels;
62
+ /** Inline (`lg`+) collapse/expand animation; defaults to `{ speed: "slow" }` (260ms). Overlay slide is unaffected. */
63
+ collapseTransition?: SidebarCollapseTransition;
64
+ /** Defaults to true: a menu with `secondaryItems` (and the `open` prop) call `changeToggle` for you. False: `toggle` alone decides. */
65
+ autoCollapse?: boolean;
66
+ };
67
+ /** One pinned shortcut row; the same fields as a menu item, minus the lock/disabled/submenu states. */
68
+ export type SidebarPinnedItem = Pick<MenuProps, "id" | "title" | "icon" | "url" | "badge">;
69
+ /** Strings for the pinned block; every key is optional and falls back to English. */
70
+ export type SidebarPinnedLabels = {
71
+ /** Default "Show {count} more". */
72
+ showMore?: string;
73
+ /** Default "Show less". */
74
+ showLess?: string;
75
+ /** Default "Unpin {title}". */
76
+ unpin?: string;
77
+ };
78
+ /** `"none"` is instant; otherwise `speed` picks 150/200/260ms and `animateShadow` (default true) toggles the panel shadow. */
79
+ export type SidebarCollapseTransition = "none" | {
80
+ speed?: "fast" | "base" | "slow";
81
+ animateShadow?: boolean;
50
82
  };
51
83
  /** One nav item; `subMenu` renders inline (expand/collapse), `secondaryItems` opens a separate SecondaryBar instead. */
52
84
  export type MenuProps = {
@@ -11,5 +11,11 @@ interface Props {
11
11
  /** Overlay (touch) presentation — rows grow to a 48px touch target instead of the 32px desktop row. */
12
12
  overlay?: boolean;
13
13
  }
14
+ /**
15
+ * These rows are real `<a href>`s now, so the browser's own gestures have to keep working —
16
+ * cmd/ctrl-click for a new tab, shift for a window, middle-click. Only a plain left click is
17
+ * routed through the in-app handler.
18
+ */
19
+ export declare const isBrowserNavigationGesture: (e: React.MouseEvent) => boolean;
14
20
  declare const MenuItemBox: React.FC<Props>;
15
21
  export default MenuItemBox;
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.isBrowserNavigationGesture = void 0;
39
40
  const jsx_runtime_1 = require("react/jsx-runtime");
40
41
  const react_1 = __importStar(require("react"));
41
42
  const react_2 = require("@chakra-ui/react");
@@ -50,6 +51,7 @@ const paletteFromTheme_1 = require("../../../Theme/chakra/paletteFromTheme");
50
51
  const TextTruncation_1 = __importDefault(require("./TextTruncation"));
51
52
  const sidebarId_1 = require("../sidebarId");
52
53
  const ToolTip_1 = __importDefault(require("../../ToolTip/ToolTip"));
54
+ const sidebarFocus_1 = require("../sidebarFocus");
53
55
  const sidebarScale_1 = require("../sidebarScale");
54
56
  /**
55
57
  * These rows are real `<a href>`s now, so the browser's own gestures have to keep working —
@@ -57,6 +59,7 @@ const sidebarScale_1 = require("../sidebarScale");
57
59
  * routed through the in-app handler.
58
60
  */
59
61
  const isBrowserNavigationGesture = (e) => e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0;
62
+ exports.isBrowserNavigationGesture = isBrowserNavigationGesture;
60
63
  const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle, overlay = false, }) => {
61
64
  var _a, _b, _c, _d, _e;
62
65
  const theme = (0, useCustomTheme_1.useCustomTheme)();
@@ -124,6 +127,7 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
124
127
  cursor: isBlocked ? "not-allowed" : "pointer",
125
128
  opacity: isBlocked ? 0.6 : 1,
126
129
  transition: "background 0.12s",
130
+ sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors),
127
131
  };
128
132
  const buttonContent = ((0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: "9px", justify: toggle ? "center" : "space-between", w: "100%", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: "9px", overflow: "hidden", children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { position: "relative", display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Icon, { as: icon, fontSize: "md", verticalAlign: "middle", color: isAnyActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isAnyActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" }), toggle && (badgeValue != null || hasSubmenuBadge) && ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.sidebar.semanticText.error }))] }), !toggle && ((0, jsx_runtime_1.jsx)(TextTruncation_1.default
129
133
  // open={isOpen}
@@ -143,14 +147,14 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
143
147
  if (toggle) {
144
148
  // Collapsed sidebar: show Popover
145
149
  return ((0, jsx_runtime_1.jsxs)(react_2.Popover, { trigger: "hover", placement: "right-start", closeOnBlur: false, isLazy: true, children: [(0, jsx_runtime_1.jsx)(react_2.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_2.Box, { ...commonStyles, as: rowAs, type: hasSubMenu ? "button" : undefined, href: hasSubMenu ? undefined : url !== null && url !== void 0 ? url : "#", "aria-label": title, "aria-current": isAnyActive ? "page" : undefined, "aria-disabled": isBlocked ? true : undefined, onClick: (e) => {
146
- if (!hasSubMenu && url && isBrowserNavigationGesture(e))
150
+ if (!hasSubMenu && url && (0, exports.isBrowserNavigationGesture)(e))
147
151
  return;
148
152
  e.preventDefault();
149
153
  handleToggleSubMenu(e);
150
154
  }, "data-menu-id": String((_c = menu.id) !== null && _c !== void 0 ? _c : title), children: buttonContent }) }), (0, jsx_runtime_1.jsx)(react_2.Portal, { children: (0, jsx_runtime_1.jsx)(react_2.PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", border: 'none', cursor: isBlocked ? "not-allowed" : "pointer", zIndex: 1500, children: (0, jsx_runtime_1.jsx)(react_2.PopoverBody, { p: "0.625rem", color: theme.colors.white, children: (0, jsx_runtime_1.jsx)(MenuPopoverContent_1.default, { menu: menu, handleMenuClick: handleClick, activeMenu: activeMenu }) }) }) })] }));
151
155
  }
152
156
  const row = ((0, jsx_runtime_1.jsx)(react_2.Box, { ...commonStyles, as: rowAs, type: hasSubMenu ? "button" : undefined, href: hasSubMenu ? undefined : url !== null && url !== void 0 ? url : "#", "aria-expanded": hasSubMenu ? !!isOpen : undefined, "aria-controls": hasSubMenu ? submenuPanelId : undefined, "aria-current": isAnyActive ? "page" : undefined, "aria-disabled": isBlocked ? true : undefined, onClick: (e) => {
153
- if (!hasSubMenu && url && isBrowserNavigationGesture(e))
157
+ if (!hasSubMenu && url && (0, exports.isBrowserNavigationGesture)(e))
154
158
  return;
155
159
  e.preventDefault();
156
160
  handleToggleSubMenu(e);
@@ -171,12 +175,12 @@ const MenuItemBox = ({ menu, activeMenu, toggle, handleClick, isOpen, onToggle,
171
175
  ? "whiteAlpha.400"
172
176
  : "whiteAlpha.200",
173
177
  }, opacity: isSubBlocked ? 0.6 : 1, cursor: isSubBlocked ? "not-allowed" : "pointer", pointerEvents: isSubBlocked ? "none" : "auto", onClick: (e) => {
174
- if (sub.url && isBrowserNavigationGesture(e))
178
+ if (sub.url && (0, exports.isBrowserNavigationGesture)(e))
175
179
  return;
176
180
  e.preventDefault();
177
181
  if (!isSubBlocked)
178
182
  handleClick === null || handleClick === void 0 ? void 0 : handleClick(sub);
179
- }, display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, transition: "background 0.12s", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: sub.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { w: "5px", h: "5px", borderRadius: "full", flexShrink: 0, bg: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { bg: theme.colors.white }, transition: "background 0.12s" })), (0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, fontWeight: isSubActive ? 600 : 500, lineHeight: "1", color: isSubActive ? activeAccent.label : theme.colors.sidebar.mutedLabel, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })) : (() => {
183
+ }, display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, transition: "background 0.12s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors), children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: sub.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : ((0, jsx_runtime_1.jsx)(react_2.Box, { w: "5px", h: "5px", borderRadius: "full", flexShrink: 0, bg: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { bg: theme.colors.white }, transition: "background 0.12s" })), (0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, fontWeight: isSubActive ? 600 : 500, lineHeight: "1", color: isSubActive ? activeAccent.label : theme.colors.sidebar.mutedLabel, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon })) : (() => {
180
184
  var _a, _b, _c, _d;
181
185
  const subCfg = typeof sub.badge === "object" && sub.badge !== null
182
186
  ? sub.badge
@@ -14,6 +14,7 @@ const sidebarAccent_1 = require("../../../Theme/tokens/builders/sidebarAccent");
14
14
  const paletteFromTheme_1 = require("../../../Theme/chakra/paletteFromTheme");
15
15
  const TextTruncation_1 = __importDefault(require("./TextTruncation"));
16
16
  const ToolTip_1 = __importDefault(require("../../ToolTip/ToolTip"));
17
+ const sidebarFocus_1 = require("../sidebarFocus");
17
18
  const sidebarScale_1 = require("../sidebarScale");
18
19
  const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
19
20
  var _a;
@@ -31,7 +32,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
31
32
  if (!isBlocked)
32
33
  handleMenuClick === null || handleMenuClick === void 0 ? void 0 : handleMenuClick(menu);
33
34
  }
34
- }, cursor: !hasSubMenu ? (isBlocked ? "not-allowed" : "pointer") : "default", "aria-disabled": !hasSubMenu && isBlocked ? true : undefined, children: [(0, jsx_runtime_1.jsx)(react_1.Icon, { as: icon, fontSize: "md", flexShrink: 0, color: !hasSubMenu && isParentActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon }), (0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontWeight: 600, fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, flex: "1", color: theme.colors.white, children: title }), (() => {
35
+ }, cursor: !hasSubMenu ? (isBlocked ? "not-allowed" : "pointer") : "default", "aria-disabled": !hasSubMenu && isBlocked ? true : undefined, sx: hasSubMenu ? undefined : (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors, theme.colors.sidebar.elevated), children: [(0, jsx_runtime_1.jsx)(react_1.Icon, { as: icon, fontSize: "md", flexShrink: 0, color: !hasSubMenu && isParentActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon }), (0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontWeight: 600, fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, flex: "1", color: theme.colors.white, children: title }), (() => {
35
36
  var _a, _b, _c, _d;
36
37
  const cfg = typeof badge === "object" && badge !== null
37
38
  ? badge
@@ -55,7 +56,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
55
56
  }, px: 2, h: sidebarScale_1.SIDEBAR_ROW.subHeight, mb: "2px", borderRadius: "lg", align: "center", justify: "space-between", gap: 2, borderLeft: "2px solid", borderLeftColor: isSubActive ? theme.colors.sidebar.activeIcon : "transparent", bg: isSubActive ? "whiteAlpha.300" : "transparent", _hover: {
56
57
  bg: isSubBlocked ? "transparent" : isSubActive ? "whiteAlpha.400" : "whiteAlpha.200",
57
58
  cursor: !isSubBlocked ? "pointer" : "not-allowed",
58
- }, opacity: isSubBlocked ? 0.5 : 1, pointerEvents: isSubBlocked ? "none" : "auto", transition: "background 0.12s", children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: sub.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : ((0, jsx_runtime_1.jsx)(react_1.Box, { w: "5px", h: "5px", borderRadius: "full", flexShrink: 0, bg: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { bg: theme.colors.white }, transition: "background 0.12s" })), (0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, fontWeight: isSubActive ? 600 : 500, flex: 1, color: isSubActive ? activeAccent.label : theme.colors.white, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? (sub.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: sub.lockedReason, placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }) })) : ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }))) : (() => {
59
+ }, opacity: isSubBlocked ? 0.5 : 1, pointerEvents: isSubBlocked ? "none" : "auto", transition: "background 0.12s", sx: (0, sidebarFocus_1.sidebarFocusStyles)(theme.colors, theme.colors.sidebar.elevated), children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [sub.icon ? ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: sub.icon, fontSize: sidebarScale_1.SIDEBAR_ROW.iconSize, flexShrink: 0, color: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, transition: "color 0.12s" })) : ((0, jsx_runtime_1.jsx)(react_1.Box, { w: "5px", h: "5px", borderRadius: "full", flexShrink: 0, bg: isSubActive ? activeAccent.icon : theme.colors.sidebar.mutedIcon, _groupHover: isSubActive ? undefined : { bg: theme.colors.white }, transition: "background 0.12s" })), (0, jsx_runtime_1.jsx)(TextTruncation_1.default, { fontSize: sidebarScale_1.SIDEBAR_ROW.fontSize, fontWeight: isSubActive ? 600 : 500, flex: 1, color: isSubActive ? activeAccent.label : theme.colors.white, _groupHover: isSubActive ? undefined : { color: theme.colors.white }, children: sub.title })] }), sub.locked ? (sub.lockedReason ? ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: sub.lockedReason, placement: "top", children: (0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }) })) : ((0, jsx_runtime_1.jsx)(react_1.Icon, { as: lucide_react_1.LockKeyhole, fontSize: "md", color: theme.colors.sidebar.mutedIcon }))) : (() => {
59
60
  var _a, _b, _c, _d;
60
61
  const cfg = typeof sub.badge === "object" && sub.badge !== null
61
62
  ? sub.badge