@elevasis/ui 2.41.0 → 2.42.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.
Files changed (95) hide show
  1. package/dist/api/index.js +4 -6
  2. package/dist/app/index.css +384 -0
  3. package/dist/app/index.d.ts +5 -1
  4. package/dist/app/index.js +17 -26
  5. package/dist/auth/index.css +659 -0
  6. package/dist/auth/index.js +19 -5
  7. package/dist/charts/index.css +533 -0
  8. package/dist/charts/index.js +18 -14
  9. package/dist/{chunk-JAN2ZXN5.js → chunk-3MTAHV5M.js} +28535 -18021
  10. package/dist/{chunk-73EWE2EW.js → chunk-EDVZ3AHA.js} +1 -1
  11. package/dist/chunk-GMXGDO3I.js +244 -0
  12. package/dist/{chunk-CXY7FMUM.js → chunk-GUKY77FJ.js} +50 -4
  13. package/dist/{chunk-TE4P6OSJ.js → chunk-MA7YCY7C.js} +1 -1
  14. package/dist/{chunk-5JYKCULK.js → chunk-NZ2F5RQ4.js} +44 -2
  15. package/dist/{chunk-WF7CONXF.js → chunk-OJJK27GC.js} +658 -6
  16. package/dist/chunk-YEGMSADG.js +1781 -0
  17. package/dist/components/chat/index.js +1 -2
  18. package/dist/components/index.css +149 -149
  19. package/dist/components/index.d.ts +5 -1
  20. package/dist/components/index.js +13 -36
  21. package/dist/components/navigation/index.css +659 -0
  22. package/dist/components/navigation/index.js +25 -3
  23. package/dist/features/auth/index.js +14 -37
  24. package/dist/features/clients/index.css +149 -149
  25. package/dist/features/clients/index.js +13 -36
  26. package/dist/features/crm/index.js +13 -36
  27. package/dist/features/dashboard/index.d.ts +5 -1
  28. package/dist/features/dashboard/index.js +13 -36
  29. package/dist/features/delivery/index.js +13 -36
  30. package/dist/features/knowledge/index.css +659 -0
  31. package/dist/features/knowledge/index.js +25 -247
  32. package/dist/features/lead-gen/index.d.ts +5 -1
  33. package/dist/features/lead-gen/index.js +13 -36
  34. package/dist/features/monitoring/index.js +13 -36
  35. package/dist/features/monitoring/requests/index.js +19 -149
  36. package/dist/features/operations/index.d.ts +5 -1
  37. package/dist/features/operations/index.js +13 -36
  38. package/dist/features/seo/index.js +1 -4
  39. package/dist/features/settings/index.js +13 -36
  40. package/dist/hooks/access/index.css +659 -0
  41. package/dist/hooks/access/index.js +19 -4
  42. package/dist/hooks/delivery/index.js +13 -36
  43. package/dist/hooks/index.d.ts +5 -1
  44. package/dist/hooks/index.js +13 -36
  45. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +5 -1
  46. package/dist/hooks/published.d.ts +5 -1
  47. package/dist/hooks/published.js +13 -36
  48. package/dist/index.d.ts +5 -1
  49. package/dist/index.js +14 -37
  50. package/dist/initialization/index.js +1 -1
  51. package/dist/knowledge/index.css +659 -0
  52. package/dist/knowledge/index.d.ts +5 -1
  53. package/dist/knowledge/index.js +25 -15
  54. package/dist/layout/index.css +659 -0
  55. package/dist/layout/index.js +24 -9
  56. package/dist/organization/index.js +13 -36
  57. package/dist/provider/index.css +384 -0
  58. package/dist/provider/index.d.ts +5 -1
  59. package/dist/provider/index.js +18 -21
  60. package/dist/provider/published.css +533 -0
  61. package/dist/provider/published.d.ts +5 -1
  62. package/dist/provider/published.js +18 -16
  63. package/dist/test-utils/index.js +4 -6
  64. package/dist/theme/index.js +2 -5
  65. package/dist/theme/presets/index.js +1 -2
  66. package/dist/types/index.d.ts +5 -1
  67. package/dist/utils/index.d.ts +5 -1
  68. package/dist/utils/index.js +1 -3
  69. package/package.json +3 -3
  70. package/dist/chunk-3KMDHCAR.js +0 -52
  71. package/dist/chunk-4DRI3G36.js +0 -1016
  72. package/dist/chunk-56O7QQE7.js +0 -356
  73. package/dist/chunk-5EYJ2GIN.js +0 -122
  74. package/dist/chunk-66U7JOWV.js +0 -425
  75. package/dist/chunk-6D4LCJ52.js +0 -10
  76. package/dist/chunk-6ROXVZ3L.js +0 -9
  77. package/dist/chunk-A2XN6PR2.js +0 -111
  78. package/dist/chunk-B2DZLPDL.js +0 -39
  79. package/dist/chunk-CLDCYJQT.js +0 -1
  80. package/dist/chunk-CTJBPF3Z.js +0 -734
  81. package/dist/chunk-DT3QYZVU.js +0 -23
  82. package/dist/chunk-FIMGOWOT.js +0 -3644
  83. package/dist/chunk-IIMU5YAJ.js +0 -53
  84. package/dist/chunk-JHVEA5NE.js +0 -133
  85. package/dist/chunk-L7GXUSCV.js +0 -215
  86. package/dist/chunk-NYBEU5TE.js +0 -118
  87. package/dist/chunk-QVQMOQXB.js +0 -1240
  88. package/dist/chunk-RH5VWWSC.js +0 -624
  89. package/dist/chunk-RXH4D6TY.js +0 -801
  90. package/dist/chunk-S4R2ZQS7.js +0 -2131
  91. package/dist/chunk-TYRUKGGD.js +0 -46
  92. package/dist/chunk-VAAU2Z3S.js +0 -85
  93. package/dist/chunk-WLOQ4IBG.js +0 -654
  94. package/dist/chunk-X4WBGKJQ.js +0 -138
  95. package/dist/chunk-YPWN2WQ3.js +0 -340
@@ -1,1240 +0,0 @@
1
- import { SubshellNavItem } from './chunk-X4WBGKJQ.js';
2
- import { useAppearance } from './chunk-L7GXUSCV.js';
3
- import { NavigationButton } from './chunk-NYBEU5TE.js';
4
- import { sidebarItemGap, sidebarSubLinkPaddingY, sidebarSubLinkPaddingX, sidebarSubLinkIndent, sidebarHoverDelay, sidebarTransitionDuration, sidebarCollapsedWidth, sidebarWidth, topbarHeight, sidebarToggleIconSize, sidebarSectionPadding, sidebarGroupChevronSize, sidebarIconInnerSize } from './chunk-DT3QYZVU.js';
5
- import { useRouterContext } from './chunk-Q7DJKLEN.js';
6
- import { useElevasisSystems } from './chunk-FIMGOWOT.js';
7
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
- import { Collapse, HoverCard, Stack, Group, Text, UnstyledButton, Tooltip, ScrollArea, Menu, Avatar, Container, Title, Button, Box, Center, useMantineColorScheme, Switch, Code } from '@mantine/core';
9
- import { IconLayoutSidebarLeftExpand, IconLayoutSidebarLeftCollapse, IconUser, IconLogout, IconAlertCircle, IconChevronDown, IconChevronRight, IconMoonStars, IconSun } from '@tabler/icons-react';
10
- import { createContext, memo, useEffect, useRef, createElement, useContext, useLayoutEffect, useState, Fragment as Fragment$1 } from 'react';
11
-
12
- var randRange = (min, max) => min + Math.random() * (max - min);
13
- var FLUX_SPARKS = Array.from({ length: 30 }, () => {
14
- const duration = randRange(12, 70);
15
- const pulse = randRange(0.8, 2.2);
16
- return {
17
- left: randRange(0, 100),
18
- size: randRange(1.5, 4.2),
19
- duration,
20
- delay: -randRange(0, duration),
21
- drift: randRange(-35, 35),
22
- peak: randRange(0.18, 0.5),
23
- pulse,
24
- pulseDelay: -randRange(0, pulse)
25
- };
26
- });
27
- var FLUX_MOTES = Array.from({ length: 18 }, () => {
28
- const duration = randRange(18, 90);
29
- const pulse = randRange(1.6, 4);
30
- return {
31
- left: randRange(-2, 102),
32
- size: randRange(3.5, 10),
33
- duration,
34
- delay: -randRange(0, duration),
35
- drift: randRange(-55, 55),
36
- blur: randRange(1.5, 5),
37
- peak: randRange(0.22, 0.55),
38
- pulse,
39
- pulseDelay: -randRange(0, pulse)
40
- };
41
- });
42
- var FLUX_GLOWS = Array.from({ length: 10 }, () => {
43
- const duration = randRange(25, 130);
44
- const pulse = randRange(3.5, 7);
45
- return {
46
- left: randRange(-5, 105),
47
- size: randRange(3, 22),
48
- duration,
49
- delay: -randRange(0, duration),
50
- drift: randRange(-80, 80),
51
- blur: randRange(6, 16),
52
- opacity: randRange(0.18, 0.42),
53
- pulse,
54
- pulseDelay: -randRange(0, pulse)
55
- };
56
- });
57
- var KEYFRAMES = `
58
- @keyframes elevasis-cyber-spark-rise {
59
- 0% { transform: translate3d(0, 0, 0); opacity: 0; }
60
- 10% { opacity: var(--cy-peak, 1); }
61
- 85% { opacity: calc(var(--cy-peak, 1) * 0.9); }
62
- 100% { transform: translate3d(var(--cy-drift, 0px), -112vh, 0); opacity: 0; }
63
- }
64
- @keyframes elevasis-cyber-spark-pulse {
65
- 0%, 100% { filter: brightness(0.55); transform: scale(0.8); }
66
- 50% { filter: brightness(1.7); transform: scale(1.25); }
67
- }
68
- @keyframes elevasis-cyber-glow-pulse {
69
- 0%, 100% { transform: scale(0.85); }
70
- 50% { transform: scale(1.2); }
71
- }
72
- @media (prefers-reduced-motion: reduce) {
73
- .elevasis-cyber-spark,
74
- .elevasis-cyber-spark-inner,
75
- .elevasis-cyber-glow,
76
- .elevasis-cyber-glow-inner {
77
- animation: none !important;
78
- }
79
- .elevasis-cyber-spark,
80
- .elevasis-cyber-glow {
81
- opacity: 0 !important;
82
- }
83
- }
84
- `;
85
- function FluxGlows() {
86
- return /* @__PURE__ */ jsx(Fragment, { children: FLUX_GLOWS.map((g, i) => /* @__PURE__ */ jsx(
87
- "div",
88
- {
89
- className: "elevasis-cyber-glow",
90
- style: {
91
- position: "absolute",
92
- bottom: "-5%",
93
- left: `${g.left}%`,
94
- width: `${g.size}px`,
95
- height: `${g.size}px`,
96
- filter: `blur(${g.blur}px)`,
97
- animation: `elevasis-cyber-spark-rise ${g.duration}s linear infinite`,
98
- animationDelay: `${g.delay}s`,
99
- ["--cy-drift"]: `${g.drift}px`,
100
- ["--cy-peak"]: `${g.opacity}`,
101
- willChange: "transform, opacity"
102
- },
103
- children: /* @__PURE__ */ jsx(
104
- "div",
105
- {
106
- className: "elevasis-cyber-glow-inner",
107
- style: {
108
- width: "100%",
109
- height: "100%",
110
- borderRadius: "50%",
111
- background: `radial-gradient(circle, var(--color-primary) 0%, color-mix(in srgb, var(--color-primary) 60%, transparent) 45%, transparent 75%)`,
112
- animation: `elevasis-cyber-glow-pulse ${g.pulse}s ease-in-out infinite`,
113
- animationDelay: `${g.pulseDelay}s`,
114
- willChange: "transform"
115
- }
116
- }
117
- )
118
- },
119
- i
120
- )) });
121
- }
122
- function FluxMotes() {
123
- return /* @__PURE__ */ jsx(Fragment, { children: FLUX_MOTES.map((m, i) => /* @__PURE__ */ jsx(
124
- "div",
125
- {
126
- className: "elevasis-cyber-spark",
127
- style: {
128
- position: "absolute",
129
- bottom: "-3%",
130
- left: `${m.left}%`,
131
- width: `${m.size}px`,
132
- height: `${m.size}px`,
133
- filter: `blur(${m.blur}px)`,
134
- animation: `elevasis-cyber-spark-rise ${m.duration}s linear infinite`,
135
- animationDelay: `${m.delay}s`,
136
- ["--cy-drift"]: `${m.drift}px`,
137
- ["--cy-peak"]: `${m.peak}`,
138
- willChange: "transform, opacity"
139
- },
140
- children: /* @__PURE__ */ jsx(
141
- "div",
142
- {
143
- className: "elevasis-cyber-spark-inner",
144
- style: {
145
- width: "100%",
146
- height: "100%",
147
- borderRadius: "50%",
148
- background: `radial-gradient(circle, var(--color-primary) 0%, color-mix(in srgb, var(--color-primary) 70%, transparent) 55%, transparent 90%)`,
149
- boxShadow: `0 0 ${m.size * 1.2}px color-mix(in srgb, var(--color-primary) 40%, transparent)`,
150
- animation: `elevasis-cyber-spark-pulse ${m.pulse}s ease-in-out infinite`,
151
- animationDelay: `${m.pulseDelay}s`,
152
- willChange: "transform, filter"
153
- }
154
- }
155
- )
156
- },
157
- i
158
- )) });
159
- }
160
- function FluxSparks() {
161
- return /* @__PURE__ */ jsx(Fragment, { children: FLUX_SPARKS.map((s, i) => /* @__PURE__ */ jsx(
162
- "div",
163
- {
164
- className: "elevasis-cyber-spark",
165
- style: {
166
- position: "absolute",
167
- bottom: "-2%",
168
- left: `${s.left}%`,
169
- width: `${s.size}px`,
170
- height: `${s.size}px`,
171
- animation: `elevasis-cyber-spark-rise ${s.duration}s linear infinite`,
172
- animationDelay: `${s.delay}s`,
173
- ["--cy-drift"]: `${s.drift}px`,
174
- ["--cy-peak"]: `${s.peak}`,
175
- willChange: "transform, opacity"
176
- },
177
- children: /* @__PURE__ */ jsx(
178
- "div",
179
- {
180
- className: "elevasis-cyber-spark-inner",
181
- style: {
182
- width: "100%",
183
- height: "100%",
184
- borderRadius: "50%",
185
- background: "var(--color-primary)",
186
- boxShadow: `0 0 ${s.size * 2.5}px var(--color-primary), 0 0 ${s.size * 5}px color-mix(in srgb, var(--color-primary) 50%, transparent)`,
187
- animation: `elevasis-cyber-spark-pulse ${s.pulse}s ease-in-out infinite`,
188
- animationDelay: `${s.pulseDelay}s`,
189
- willChange: "transform, filter"
190
- }
191
- }
192
- )
193
- },
194
- i
195
- )) });
196
- }
197
- function CyberParticles({ variant: _variant, className }) {
198
- return /* @__PURE__ */ jsxs(
199
- "div",
200
- {
201
- className,
202
- "aria-hidden": "true",
203
- style: {
204
- position: "absolute",
205
- inset: 0,
206
- pointerEvents: "none",
207
- overflow: "hidden"
208
- },
209
- children: [
210
- /* @__PURE__ */ jsx("style", { children: KEYFRAMES }),
211
- /* @__PURE__ */ jsx(FluxGlows, {}),
212
- /* @__PURE__ */ jsx(FluxMotes, {}),
213
- /* @__PURE__ */ jsx(FluxSparks, {})
214
- ]
215
- }
216
- );
217
- }
218
- function Vignette({ strength = 0.35, className }) {
219
- return /* @__PURE__ */ jsx(
220
- "div",
221
- {
222
- className,
223
- style: {
224
- position: "absolute",
225
- inset: 0,
226
- pointerEvents: "none",
227
- background: `radial-gradient(ellipse 80% 70% at 50% 50%, transparent 50%, rgba(0, 0, 0, ${strength}) 100%)`
228
- }
229
- }
230
- );
231
- }
232
- var AppShellContainer = ({ children }) => {
233
- const { background } = useAppearance();
234
- return /* @__PURE__ */ jsxs(
235
- "div",
236
- {
237
- style: {
238
- height: "100vh",
239
- display: "flex",
240
- backgroundColor: "var(--color-background)",
241
- position: "relative"
242
- },
243
- children: [
244
- background,
245
- children
246
- ]
247
- }
248
- );
249
- };
250
- var AppShellRightSideContainer = ({ children }) => {
251
- return /* @__PURE__ */ jsx(
252
- "main",
253
- {
254
- style: {
255
- flex: 1,
256
- minWidth: 0,
257
- color: "var(--color-text)",
258
- display: "flex",
259
- flexDirection: "column",
260
- minHeight: "100vh"
261
- },
262
- children
263
- }
264
- );
265
- };
266
- var AppShellRightSideOuterContainer = ({ children }) => {
267
- return /* @__PURE__ */ jsx(
268
- "div",
269
- {
270
- style: {
271
- flex: 1,
272
- overflow: "auto",
273
- minWidth: 0,
274
- minHeight: "100vh"
275
- },
276
- children
277
- }
278
- );
279
- };
280
- var AppShellContentContainer = ({ children }) => {
281
- return /* @__PURE__ */ jsx(
282
- "div",
283
- {
284
- style: {
285
- height: "100%",
286
- padding: "var(--mantine-spacing-md)"
287
- },
288
- children
289
- }
290
- );
291
- };
292
- var PageContainer = ({ children }) => {
293
- return (
294
- // Add padding to the top of the container to adjust for the topbar height
295
- /* @__PURE__ */ jsx(Container, { size: "xl", p: 0, w: "100%", children: /* @__PURE__ */ jsx(Stack, { gap: "lg", children }) })
296
- );
297
- };
298
- var AppTopbarAdjusterWrapper = ({ children }) => {
299
- const padding = `${topbarHeight}px`;
300
- return /* @__PURE__ */ jsx("div", { style: { paddingTop: padding }, children });
301
- };
302
- var standardMdSpacing = 16;
303
- var topAndBottomSpacing = standardMdSpacing * 2;
304
- var AppShellCenteredContainer = ({ children }) => {
305
- return /* @__PURE__ */ jsx(
306
- "div",
307
- {
308
- style: {
309
- display: "flex",
310
- alignItems: "center",
311
- justifyContent: "center",
312
- margin: "auto auto",
313
- height: `calc(100vh - ${topbarHeight + topAndBottomSpacing}px)`,
314
- textAlign: "center"
315
- },
316
- children
317
- }
318
- );
319
- };
320
- var AppShellLoader = () => {
321
- const { loader } = useAppearance();
322
- return /* @__PURE__ */ jsx(AppShellCenteredContainer, { children: loader });
323
- };
324
- var AppShellError = ({ message, retry }) => {
325
- return /* @__PURE__ */ jsx(AppShellCenteredContainer, { children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "md", children: [
326
- /* @__PURE__ */ jsx(IconAlertCircle, { size: 48, color: "var(--color-error)" }),
327
- /* @__PURE__ */ jsx(Title, { order: 3, c: "dimmed", children: message }),
328
- retry && /* @__PURE__ */ jsx(Button, { onClick: retry, children: "Retry" })
329
- ] }) });
330
- };
331
- var SidebarContext = createContext(void 0);
332
- var SIDEBAR_COLLAPSED_KEY = "sidebar-collapsed";
333
- var SidebarProvider = ({ children }) => {
334
- const [expandedGroups, setExpandedGroups] = useState({});
335
- const [isInitialized, setIsInitialized] = useState(false);
336
- const [isCollapsed, setIsCollapsed] = useState(() => {
337
- if (typeof window !== "undefined" && window.innerWidth < 1024) {
338
- return true;
339
- }
340
- const stored = localStorage.getItem(SIDEBAR_COLLAPSED_KEY);
341
- return stored === "true";
342
- });
343
- const toggleGroup = (groupLabel) => {
344
- setExpandedGroups((prev) => ({
345
- ...prev,
346
- [groupLabel]: !prev[groupLabel]
347
- }));
348
- };
349
- const initializeGroups = (groups) => {
350
- if (!isInitialized) {
351
- const initialState = {};
352
- groups.forEach((group) => {
353
- initialState[group.label] = group.initiallyOpened || false;
354
- });
355
- setExpandedGroups(initialState);
356
- setIsInitialized(true);
357
- }
358
- };
359
- const toggleCollapsed = () => {
360
- setIsCollapsed((prev) => {
361
- const newValue = !prev;
362
- localStorage.setItem(SIDEBAR_COLLAPSED_KEY, String(newValue));
363
- return newValue;
364
- });
365
- };
366
- const setCollapsed = (value) => {
367
- setIsCollapsed(value);
368
- localStorage.setItem(SIDEBAR_COLLAPSED_KEY, String(value));
369
- };
370
- useEffect(() => {
371
- const handleStorageChange = (e) => {
372
- if (e.key === SIDEBAR_COLLAPSED_KEY && e.newValue !== null) {
373
- setIsCollapsed(e.newValue === "true");
374
- }
375
- };
376
- window.addEventListener("storage", handleStorageChange);
377
- return () => window.removeEventListener("storage", handleStorageChange);
378
- }, []);
379
- return /* @__PURE__ */ jsx(
380
- SidebarContext.Provider,
381
- {
382
- value: {
383
- expandedGroups,
384
- toggleGroup,
385
- initializeGroups,
386
- isCollapsed,
387
- toggleCollapsed,
388
- setCollapsed
389
- },
390
- children
391
- }
392
- );
393
- };
394
- var useSidebar = () => {
395
- const context = useContext(SidebarContext);
396
- if (context === void 0) {
397
- throw new Error("useSidebar must be used within a SidebarProvider");
398
- }
399
- return context;
400
- };
401
-
402
- // src/components/layout/sidebar/components/link-group-components/utils.ts
403
- var isPathActive = (linkPath, currentPath) => {
404
- if (!currentPath || !linkPath) return false;
405
- if (currentPath === linkPath) return true;
406
- const linkSegments = linkPath.split("/").filter(Boolean);
407
- const currentSegments = currentPath.split("/").filter(Boolean);
408
- if (currentSegments.length < linkSegments.length) return false;
409
- for (let i = 0; i < linkSegments.length; i++) {
410
- if (linkSegments[i] !== currentSegments[i]) return false;
411
- }
412
- return true;
413
- };
414
- var isOverviewLink = (label, link) => {
415
- return label === "Overview" && (link === "/admin" || link === "/operations" || link === "/monitoring" || link === "/settings" || link === "/execution-engine" || link === "/acquisition");
416
- };
417
- var isLinkItemActive = (linkItem, currentPath) => {
418
- const isKnowledgeBaseActive = linkItem.link === "/knowledge" && currentPath.startsWith("/knowledge") && !currentPath.startsWith("/knowledge/command-view");
419
- const matchesExtraPath = linkItem.activeMatchPaths?.some((path) => isPathActive(path, currentPath)) ?? false;
420
- if (isKnowledgeBaseActive) return true;
421
- if (linkItem.exact || isOverviewLink(linkItem.label, linkItem.link)) {
422
- return currentPath === linkItem.link || matchesExtraPath;
423
- }
424
- return isPathActive(linkItem.link, currentPath) || matchesExtraPath;
425
- };
426
- var SubLinkItem = ({ linkItem, currentPath }) => {
427
- const { Link } = useRouterContext();
428
- const isActive = isLinkItemActive(linkItem, currentPath);
429
- const activeColor2 = "var(--color-primary)";
430
- const activeColorBg = "color-mix(in srgb, var(--color-primary) 10%, transparent)";
431
- const defaultColor = "var(--color-text-subtle)";
432
- const hoverColor = "var(--color-text)";
433
- return /* @__PURE__ */ jsx(
434
- Link,
435
- {
436
- to: linkItem.link,
437
- onClick: linkItem.onClick,
438
- "data-onboarding-tour-id": linkItem.dataOnboardingTourId,
439
- style: {
440
- display: "block",
441
- textDecoration: "none",
442
- fontFamily: "var(--elevasis-font-family-subtitle)",
443
- fontSize: "var(--mantine-font-size-sm)",
444
- color: isActive ? activeColor2 : defaultColor,
445
- backgroundColor: isActive ? activeColorBg : "transparent",
446
- padding: `${sidebarSubLinkPaddingY}px ${sidebarSubLinkPaddingX}px ${sidebarSubLinkPaddingY}px ${sidebarSubLinkIndent}px`,
447
- borderRadius: "var(--mantine-radius-default)",
448
- transition: `all var(--duration-fast) var(--easing)`,
449
- fontWeight: isActive ? 600 : 400
450
- },
451
- onMouseEnter: (e) => {
452
- if (!isActive) {
453
- e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
454
- e.currentTarget.style.color = hoverColor;
455
- }
456
- },
457
- onMouseLeave: (e) => {
458
- if (!isActive) {
459
- e.currentTarget.style.backgroundColor = "transparent";
460
- e.currentTarget.style.color = defaultColor;
461
- }
462
- },
463
- children: linkItem.label
464
- }
465
- );
466
- };
467
- var MainButton = ({
468
- icon,
469
- label,
470
- isCollapsed,
471
- hasLinks,
472
- opened,
473
- isIconTextActive,
474
- isBackgroundActive,
475
- onClick,
476
- link,
477
- noWrapper = false
478
- }) => {
479
- const { Link } = useRouterContext();
480
- const button = /* @__PURE__ */ jsx(
481
- NavigationButton,
482
- {
483
- icon,
484
- label,
485
- isCollapsed,
486
- hasSubItems: hasLinks,
487
- isExpanded: opened,
488
- isActive: isIconTextActive,
489
- hasActiveBackground: isBackgroundActive,
490
- onClick,
491
- transitionDuration: sidebarTransitionDuration
492
- }
493
- );
494
- const wrapperStyle = { marginBottom: `${sidebarItemGap}px` };
495
- if (noWrapper) {
496
- return button;
497
- }
498
- if (!hasLinks && link) {
499
- return /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: /* @__PURE__ */ jsx(Link, { to: link, style: { textDecoration: "none" }, children: button }) });
500
- }
501
- return /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: button });
502
- };
503
- var CollapsedWithTooltip = ({ label, children }) => {
504
- return /* @__PURE__ */ jsx(Tooltip, { label, position: "right", offset: 12, children });
505
- };
506
- var CollapsedWithHoverCard = ({
507
- label,
508
- icon: Icon,
509
- links,
510
- currentPath,
511
- children
512
- }) => {
513
- const { Link } = useRouterContext();
514
- return /* @__PURE__ */ jsxs(
515
- HoverCard,
516
- {
517
- width: 200,
518
- position: "right-start",
519
- shadow: "md",
520
- withinPortal: true,
521
- offset: 12,
522
- openDelay: sidebarHoverDelay,
523
- closeDelay: 150,
524
- zIndex: 9999,
525
- children: [
526
- /* @__PURE__ */ jsx(HoverCard.Target, { children: /* @__PURE__ */ jsx("div", { style: { display: "inline-block", width: "100%" }, children }) }),
527
- /* @__PURE__ */ jsx(
528
- HoverCard.Dropdown,
529
- {
530
- style: {
531
- padding: "var(--mantine-spacing-sm)",
532
- background: "var(--glass-background)",
533
- backdropFilter: "var(--glass-blur)"
534
- },
535
- children: /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
536
- /* @__PURE__ */ jsxs(
537
- Group,
538
- {
539
- gap: "xs",
540
- style: {
541
- paddingBottom: "8px",
542
- borderBottom: "1px solid var(--color-border)",
543
- marginBottom: "4px"
544
- },
545
- children: [
546
- Icon && /* @__PURE__ */ jsx(Icon, { size: 16, stroke: 2 }),
547
- /* @__PURE__ */ jsx(
548
- Text,
549
- {
550
- size: "sm",
551
- fw: 600,
552
- c: "var(--color-text)",
553
- style: { fontFamily: "var(--mantine-font-family-headings)" },
554
- children: label
555
- }
556
- )
557
- ]
558
- }
559
- ),
560
- links.map((linkItem) => {
561
- const isActive = currentPath === linkItem.link;
562
- return /* @__PURE__ */ jsx(Link, { to: linkItem.link, style: { textDecoration: "none" }, onClick: () => {
563
- }, children: /* @__PURE__ */ jsx(
564
- UnstyledButton,
565
- {
566
- style: {
567
- width: "100%",
568
- padding: "8px 12px",
569
- borderRadius: "var(--mantine-radius-default)",
570
- backgroundColor: isActive ? "color-mix(in srgb, var(--color-primary) 10%, transparent)" : "transparent",
571
- color: isActive ? "var(--color-primary)" : "var(--color-text)",
572
- transition: "all var(--duration-fast) var(--easing)"
573
- },
574
- onMouseEnter: (e) => {
575
- if (!isActive) {
576
- e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
577
- }
578
- },
579
- onMouseLeave: (e) => {
580
- e.currentTarget.style.backgroundColor = isActive ? "color-mix(in srgb, var(--color-primary) 10%, transparent)" : "transparent";
581
- },
582
- children: /* @__PURE__ */ jsx(Text, { size: "sm", style: { lineHeight: 1.2 }, children: linkItem.label })
583
- }
584
- ) }, linkItem.link);
585
- })
586
- ] })
587
- }
588
- )
589
- ]
590
- }
591
- );
592
- };
593
- var LinksGroup = memo(function LinksGroup2({
594
- icon: Icon,
595
- label,
596
- links = [],
597
- link,
598
- onClick,
599
- currentPath = "",
600
- opened = false,
601
- onToggle
602
- }) {
603
- const hasLinks = links.length > 0;
604
- const { navigate } = useRouterContext();
605
- const { isCollapsed } = useSidebar();
606
- useEffect(() => {
607
- if (isCollapsed && opened && onToggle) {
608
- onToggle();
609
- }
610
- }, [isCollapsed, opened, onToggle]);
611
- const hasActiveChild = hasLinks && links.some((item) => isLinkItemActive(item, currentPath));
612
- const isParentActive = !hasLinks && (link === "/" ? currentPath === "/" : isPathActive(link || "", currentPath));
613
- const isIconTextActive = isParentActive || hasActiveChild;
614
- const isBackgroundActive = isParentActive || hasActiveChild && !opened;
615
- const prevPathRef = useRef(null);
616
- useEffect(() => {
617
- const pathChanged = prevPathRef.current !== currentPath;
618
- prevPathRef.current = currentPath;
619
- if (pathChanged && !isCollapsed && hasActiveChild && !opened && onToggle) {
620
- onToggle();
621
- }
622
- }, [currentPath, hasActiveChild, isCollapsed, opened, onToggle]);
623
- const handleMainClick = () => {
624
- if (hasLinks && !isCollapsed) {
625
- onToggle?.();
626
- } else if (!hasLinks) {
627
- if (link) {
628
- navigate(link);
629
- }
630
- onClick?.();
631
- }
632
- };
633
- const items = links.map((item) => /* @__PURE__ */ jsx(SubLinkItem, { linkItem: item, currentPath }, item.label));
634
- const mainButton = /* @__PURE__ */ jsx(
635
- MainButton,
636
- {
637
- icon: Icon,
638
- label,
639
- isCollapsed,
640
- hasLinks,
641
- opened,
642
- isIconTextActive,
643
- isBackgroundActive,
644
- onClick: handleMainClick,
645
- link
646
- }
647
- );
648
- if (isCollapsed && hasLinks) {
649
- const mainButtonNoWrapper = /* @__PURE__ */ jsx(
650
- MainButton,
651
- {
652
- icon: Icon,
653
- label,
654
- isCollapsed,
655
- hasLinks,
656
- opened,
657
- isIconTextActive,
658
- isBackgroundActive,
659
- onClick: handleMainClick,
660
- link,
661
- noWrapper: true
662
- }
663
- );
664
- return /* @__PURE__ */ jsx("div", { style: { marginBottom: `${sidebarItemGap}px` }, children: /* @__PURE__ */ jsx(CollapsedWithHoverCard, { label, icon: Icon, links, currentPath, children: mainButtonNoWrapper }) });
665
- }
666
- if (isCollapsed && !hasLinks) {
667
- const mainButtonNoWrapper = /* @__PURE__ */ jsx(
668
- MainButton,
669
- {
670
- icon: Icon,
671
- label,
672
- isCollapsed,
673
- hasLinks,
674
- opened,
675
- isIconTextActive,
676
- isBackgroundActive,
677
- onClick: handleMainClick,
678
- link,
679
- noWrapper: true
680
- }
681
- );
682
- return /* @__PURE__ */ jsx("div", { style: { marginBottom: `${sidebarItemGap}px` }, children: /* @__PURE__ */ jsx(CollapsedWithTooltip, { label, children: mainButtonNoWrapper }) });
683
- }
684
- return /* @__PURE__ */ jsxs(Fragment, { children: [
685
- mainButton,
686
- hasLinks && /* @__PURE__ */ jsx(Collapse, { in: opened && !isCollapsed, children: /* @__PURE__ */ jsx("div", { style: { paddingLeft: "0px" }, children: items }) })
687
- ] });
688
- });
689
- var useSidebarCollapse = () => {
690
- const { isCollapsed, toggleCollapsed, setCollapsed } = useSidebar();
691
- useEffect(() => {
692
- const handleKeyDown = (e) => {
693
- if ((e.metaKey || e.ctrlKey) && e.key === "b") {
694
- e.preventDefault();
695
- toggleCollapsed();
696
- }
697
- };
698
- window.addEventListener("keydown", handleKeyDown);
699
- return () => window.removeEventListener("keydown", handleKeyDown);
700
- }, [toggleCollapsed]);
701
- useEffect(() => {
702
- const handleResize = () => {
703
- if (window.innerWidth < 1024) {
704
- setCollapsed(true);
705
- }
706
- };
707
- handleResize();
708
- window.addEventListener("resize", handleResize);
709
- return () => window.removeEventListener("resize", handleResize);
710
- }, [setCollapsed]);
711
- return {
712
- isCollapsed,
713
- toggleCollapsed,
714
- setCollapsed
715
- };
716
- };
717
- var SidebarContainer = ({ children, className }) => {
718
- const { isCollapsed } = useSidebar();
719
- return /* @__PURE__ */ jsx(
720
- "nav",
721
- {
722
- className,
723
- style: {
724
- height: "100vh",
725
- width: isCollapsed ? `${sidebarCollapsedWidth}px` : `${sidebarWidth}px`,
726
- flexShrink: 0,
727
- display: "flex",
728
- flexDirection: "column",
729
- backgroundColor: "var(--glass-background)",
730
- backdropFilter: "var(--glass-blur)",
731
- WebkitBackdropFilter: "var(--glass-blur)",
732
- borderRight: "1px solid var(--color-border)",
733
- boxShadow: "var(--card-shadow)",
734
- transition: `width ${sidebarTransitionDuration}ms var(--easing)`,
735
- overflow: "hidden",
736
- position: "relative",
737
- fontFamily: "var(--mantine-font-family-headings)"
738
- },
739
- children
740
- }
741
- );
742
- };
743
- var SidebarTopSection = ({ logo }) => {
744
- const { isCollapsed, toggleCollapsed } = useSidebar();
745
- return /* @__PURE__ */ jsxs(
746
- "div",
747
- {
748
- style: {
749
- padding: "var(--mantine-spacing-sm)",
750
- borderBottom: "1px solid var(--color-border)",
751
- height: `${topbarHeight}px`,
752
- display: "flex",
753
- alignItems: "center",
754
- justifyContent: "space-between"
755
- },
756
- children: [
757
- !isCollapsed && logo ? /* @__PURE__ */ jsx(
758
- "img",
759
- {
760
- src: logo,
761
- alt: "Logo",
762
- style: {
763
- marginLeft: 12,
764
- width: "auto",
765
- height: "30px",
766
- transition: `opacity ${sidebarTransitionDuration}ms var(--easing)`,
767
- opacity: isCollapsed ? 0 : 1
768
- }
769
- }
770
- ) : /* @__PURE__ */ jsx("div", {}),
771
- /* @__PURE__ */ jsx(
772
- UnstyledButton,
773
- {
774
- onClick: toggleCollapsed,
775
- style: {
776
- padding: "6px",
777
- display: "flex",
778
- alignItems: "center",
779
- justifyContent: "center",
780
- color: "var(--color-text-subtle)",
781
- paddingRight: 6,
782
- marginRight: isCollapsed ? 6 : 0,
783
- transition: "all var(--duration-fast) var(--easing)",
784
- ":hover": {
785
- backgroundColor: "var(--color-surface-hover)",
786
- color: "var(--color-text)"
787
- }
788
- },
789
- onMouseEnter: (e) => {
790
- e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
791
- e.currentTarget.style.color = "var(--color-text)";
792
- },
793
- onMouseLeave: (e) => {
794
- e.currentTarget.style.backgroundColor = "transparent";
795
- e.currentTarget.style.color = "var(--color-text-subtle)";
796
- },
797
- children: isCollapsed ? /* @__PURE__ */ jsx(
798
- IconLayoutSidebarLeftExpand,
799
- {
800
- size: sidebarToggleIconSize,
801
- stroke: 1.5,
802
- style: {
803
- transition: `transform ${sidebarTransitionDuration}ms var(--easing)`
804
- }
805
- }
806
- ) : /* @__PURE__ */ jsx(
807
- IconLayoutSidebarLeftCollapse,
808
- {
809
- size: sidebarToggleIconSize,
810
- stroke: 1.5,
811
- style: {
812
- transition: `transform ${sidebarTransitionDuration}ms var(--easing)`
813
- }
814
- }
815
- )
816
- }
817
- )
818
- ]
819
- }
820
- );
821
- };
822
- var BOTTOM_SECTION_HEIGHT_VAR = "--elevasis-sidebar-bottom-section-height";
823
- var SidebarBottomSection = ({ user, onLogout, onAccountClick }) => {
824
- const { isCollapsed } = useSidebar();
825
- const rootRef = useRef(null);
826
- useLayoutEffect(() => {
827
- const el = rootRef.current;
828
- if (!el) return;
829
- const update = () => {
830
- document.documentElement.style.setProperty(BOTTOM_SECTION_HEIGHT_VAR, `${el.offsetHeight}px`);
831
- };
832
- update();
833
- const observer = new ResizeObserver(update);
834
- observer.observe(el);
835
- return () => {
836
- observer.disconnect();
837
- document.documentElement.style.removeProperty(BOTTOM_SECTION_HEIGHT_VAR);
838
- };
839
- }, [user]);
840
- if (!user) {
841
- return null;
842
- }
843
- return /* @__PURE__ */ jsx(
844
- "div",
845
- {
846
- ref: rootRef,
847
- style: {
848
- padding: "var(--mantine-spacing-sm)",
849
- borderTop: "1px solid var(--color-border)",
850
- transition: `padding ${sidebarTransitionDuration}ms var(--easing)`
851
- },
852
- children: /* @__PURE__ */ jsxs(Menu, { shadow: "md", width: 200, position: "top-start", offset: 8, children: [
853
- /* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(
854
- "div",
855
- {
856
- style: {
857
- borderRadius: "var(--mantine-radius-xs)",
858
- padding: "4px",
859
- transition: "background-color var(--duration-fast)",
860
- display: "flex",
861
- justifyContent: "flex-start",
862
- cursor: "pointer"
863
- },
864
- onMouseEnter: (e) => {
865
- e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
866
- },
867
- onMouseLeave: (e) => {
868
- e.currentTarget.style.backgroundColor = "transparent";
869
- },
870
- children: /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", children: [
871
- /* @__PURE__ */ jsx(
872
- Tooltip,
873
- {
874
- label: isCollapsed ? /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
875
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: [user.firstName, user.lastName].filter(Boolean).join(" ") || user.email }),
876
- /* @__PURE__ */ jsx("div", { style: { fontSize: "11px", opacity: 0.8 }, children: user.email })
877
- ] }) : null,
878
- position: "right",
879
- offset: 12,
880
- disabled: !isCollapsed,
881
- children: /* @__PURE__ */ jsx(
882
- Avatar,
883
- {
884
- src: user.profilePictureUrl || void 0,
885
- radius: "xl",
886
- size: isCollapsed ? "sm" : "md",
887
- alt: `${user.firstName || ""} ${user.lastName || ""}`.trim(),
888
- style: {
889
- marginLeft: isCollapsed ? 8 : 0,
890
- transition: `all ${sidebarTransitionDuration}ms var(--easing)`,
891
- cursor: "pointer"
892
- },
893
- children: (user.firstName || user.email).charAt(0).toUpperCase()
894
- }
895
- )
896
- }
897
- ),
898
- /* @__PURE__ */ jsxs(
899
- Stack,
900
- {
901
- gap: 2,
902
- style: {
903
- flex: 1,
904
- minWidth: 0,
905
- opacity: isCollapsed ? 0 : 1,
906
- width: isCollapsed ? 0 : "auto",
907
- overflow: "hidden",
908
- transition: `opacity ${sidebarTransitionDuration}ms var(--easing), width ${sidebarTransitionDuration}ms var(--easing)`
909
- },
910
- children: [
911
- /* @__PURE__ */ jsx(
912
- Text,
913
- {
914
- size: "sm",
915
- fw: 500,
916
- style: {
917
- color: "var(--color-text)",
918
- lineHeight: 1.2,
919
- overflow: "hidden",
920
- textOverflow: "ellipsis",
921
- whiteSpace: "nowrap"
922
- },
923
- children: [user.firstName, user.lastName].filter(Boolean).join(" ") || user.email
924
- }
925
- ),
926
- /* @__PURE__ */ jsx(
927
- Text,
928
- {
929
- size: "xs",
930
- style: {
931
- color: "var(--color-text-subtle)",
932
- lineHeight: 1.2,
933
- overflow: "hidden",
934
- textOverflow: "ellipsis",
935
- whiteSpace: "nowrap"
936
- },
937
- children: user.email
938
- }
939
- )
940
- ]
941
- }
942
- )
943
- ] })
944
- }
945
- ) }),
946
- /* @__PURE__ */ jsxs(
947
- Menu.Dropdown,
948
- {
949
- style: {
950
- background: "var(--glass-background)",
951
- backdropFilter: "var(--glass-blur)",
952
- WebkitBackdropFilter: "var(--glass-blur)"
953
- },
954
- children: [
955
- /* @__PURE__ */ jsx(Menu.Item, { leftSection: /* @__PURE__ */ jsx(IconUser, { size: 14 }), onClick: onAccountClick, children: "Account" }),
956
- onLogout && /* @__PURE__ */ jsx(Menu.Item, { leftSection: /* @__PURE__ */ jsx(IconLogout, { size: 14 }), onClick: onLogout, children: "Logout" })
957
- ]
958
- }
959
- )
960
- ] })
961
- }
962
- );
963
- };
964
- var SidebarMiddleSection = ({ linkElements }) => {
965
- return /* @__PURE__ */ jsx(
966
- ScrollArea,
967
- {
968
- style: {
969
- flex: 1,
970
- padding: sidebarSectionPadding,
971
- transition: `padding ${sidebarTransitionDuration}ms var(--easing)`
972
- },
973
- children: /* @__PURE__ */ jsx("div", { style: { paddingBottom: "var(--mantine-spacing-sm)" }, children: linkElements })
974
- }
975
- );
976
- };
977
- var Sidebar = memo(function Sidebar2({
978
- links = [],
979
- user,
980
- onLogout,
981
- onAccountClick,
982
- className = "",
983
- logo
984
- }) {
985
- const { currentPath } = useRouterContext();
986
- const { expandedGroups, toggleGroup, initializeGroups } = useSidebar();
987
- useSidebarCollapse();
988
- useEffect(() => {
989
- initializeGroups(links);
990
- }, [links, initializeGroups]);
991
- const linkElements = links.map((item) => {
992
- const isOpened = expandedGroups[item.label] || false;
993
- const linkGroup = /* @__PURE__ */ createElement(
994
- LinksGroup,
995
- {
996
- ...item,
997
- key: item.label,
998
- currentPath,
999
- opened: isOpened,
1000
- onToggle: () => toggleGroup(item.label)
1001
- }
1002
- );
1003
- if (item.dataOnboardingTourId) {
1004
- return /* @__PURE__ */ jsx("div", { "data-onboarding-tour-id": item.dataOnboardingTourId, children: linkGroup }, item.label);
1005
- }
1006
- return linkGroup;
1007
- });
1008
- return /* @__PURE__ */ jsxs(SidebarContainer, { className, children: [
1009
- /* @__PURE__ */ jsx(SidebarTopSection, { logo }),
1010
- /* @__PURE__ */ jsx(SidebarMiddleSection, { linkElements }),
1011
- /* @__PURE__ */ jsx(SidebarBottomSection, { user, onLogout, onAccountClick })
1012
- ] });
1013
- });
1014
- var activeColor = "var(--color-primary)";
1015
- var defaultTextColor = "var(--color-text)";
1016
- var subtleColor = "var(--color-text-subtle)";
1017
- var activeBg = `color-mix(in srgb, ${activeColor} 10%, transparent)`;
1018
- var CollapsibleSidebarGroup = ({
1019
- icon: Icon,
1020
- label,
1021
- isExpanded,
1022
- onToggle,
1023
- isActive = false,
1024
- badge,
1025
- children,
1026
- onLabelClick,
1027
- emptyMessage = "No items",
1028
- isEmpty = false,
1029
- isLoading = false,
1030
- loadingComponent
1031
- }) => {
1032
- const showActiveStyle = !isExpanded && isActive;
1033
- const iconColor = showActiveStyle ? activeColor : subtleColor;
1034
- const textColor = showActiveStyle ? activeColor : defaultTextColor;
1035
- const fontWeight = showActiveStyle ? 600 : 500;
1036
- const handleLabelClick = (e) => {
1037
- if (onLabelClick) {
1038
- e.stopPropagation();
1039
- onLabelClick();
1040
- }
1041
- };
1042
- return /* @__PURE__ */ jsxs(Box, { children: [
1043
- /* @__PURE__ */ jsx(
1044
- UnstyledButton,
1045
- {
1046
- onClick: onToggle,
1047
- style: {
1048
- display: "flex",
1049
- alignItems: "center",
1050
- width: "100%",
1051
- padding: "var(--mantine-spacing-xs)",
1052
- color: textColor,
1053
- backgroundColor: showActiveStyle ? activeBg : "transparent",
1054
- transition: `all var(--duration-fast) var(--easing)`,
1055
- cursor: "pointer",
1056
- overflow: "hidden"
1057
- },
1058
- onMouseEnter: (e) => {
1059
- if (!showActiveStyle) {
1060
- e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
1061
- }
1062
- },
1063
- onMouseLeave: (e) => {
1064
- if (!showActiveStyle) {
1065
- e.currentTarget.style.backgroundColor = "transparent";
1066
- }
1067
- },
1068
- children: /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", style: { width: "100%" }, children: [
1069
- /* @__PURE__ */ jsx(Box, { style: { flexShrink: 0, color: iconColor }, children: isExpanded ? /* @__PURE__ */ jsx(IconChevronDown, { size: sidebarGroupChevronSize }) : /* @__PURE__ */ jsx(IconChevronRight, { size: sidebarGroupChevronSize }) }),
1070
- /* @__PURE__ */ jsx(
1071
- Box,
1072
- {
1073
- style: { flexShrink: 0, color: iconColor, cursor: onLabelClick ? "pointer" : "inherit" },
1074
- onClick: onLabelClick ? handleLabelClick : void 0,
1075
- children: /* @__PURE__ */ jsx(Icon, { size: sidebarIconInnerSize, color: activeColor })
1076
- }
1077
- ),
1078
- /* @__PURE__ */ jsx(
1079
- Text,
1080
- {
1081
- size: "sm",
1082
- fw: fontWeight,
1083
- style: {
1084
- fontFamily: "var(--elevasis-font-family-subtitle)",
1085
- color: textColor,
1086
- transition: `color var(--duration-fast) var(--easing)`,
1087
- overflow: "hidden",
1088
- textOverflow: "ellipsis",
1089
- whiteSpace: "nowrap",
1090
- flex: 1,
1091
- cursor: onLabelClick ? "pointer" : "inherit"
1092
- },
1093
- onClick: onLabelClick ? handleLabelClick : void 0,
1094
- children: label
1095
- }
1096
- ),
1097
- badge && /* @__PURE__ */ jsx(Box, { style: { flexShrink: 0 }, children: badge })
1098
- ] })
1099
- }
1100
- ),
1101
- /* @__PURE__ */ jsx(Collapse, { in: isExpanded, children: /* @__PURE__ */ jsx(
1102
- Stack,
1103
- {
1104
- gap: 0,
1105
- mt: "xs",
1106
- ml: "xs",
1107
- style: {
1108
- borderLeft: `1px solid color-mix(in srgb, var(--color-primary) 40%, transparent)`,
1109
- marginLeft: "calc(var(--mantine-spacing-xs) + 6px)",
1110
- paddingLeft: "calc(var(--mantine-spacing-xs) - 2px)"
1111
- },
1112
- children: isLoading ? loadingComponent : isEmpty ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { padding: "6px 8px" }, children: emptyMessage }) : children
1113
- }
1114
- ) })
1115
- ] });
1116
- };
1117
- var SubshellNavList = ({ items }) => {
1118
- const { currentPath, navigate } = useRouterContext();
1119
- return /* @__PURE__ */ jsx(Fragment, { children: items.map((item) => {
1120
- const isActive = item.exact ? currentPath === item.to || currentPath === `${item.to}/` : currentPath.startsWith(item.to);
1121
- return /* @__PURE__ */ jsx(
1122
- SubshellNavItem,
1123
- {
1124
- icon: item.icon,
1125
- label: item.label,
1126
- isActive,
1127
- href: item.to,
1128
- onClick: () => navigate(item.to)
1129
- },
1130
- item.to
1131
- );
1132
- }) });
1133
- };
1134
-
1135
- // src/components/layout/sub-shell/constants.ts
1136
- var subsidebarWidth = 200;
1137
- function SubshellLoader() {
1138
- const { loader } = useAppearance();
1139
- return /* @__PURE__ */ jsx(Center, { mih: "calc(100vh - 70px)", children: loader });
1140
- }
1141
- function SubshellSidebarLoader({ padding = "sm" }) {
1142
- const { loader } = useAppearance();
1143
- return /* @__PURE__ */ jsx(Box, { style: { flex: 1, minHeight: 0, display: "flex" }, children: /* @__PURE__ */ jsx(Center, { p: padding, style: { flex: 1, minHeight: 0 }, children: loader }) });
1144
- }
1145
- var TopbarContainer = ({ children }) => {
1146
- const { isCollapsed } = useSidebar();
1147
- const actualSidebarWidth = isCollapsed ? sidebarCollapsedWidth : sidebarWidth;
1148
- return /* @__PURE__ */ jsx(
1149
- "div",
1150
- {
1151
- style: {
1152
- position: "fixed",
1153
- top: 0,
1154
- left: `${actualSidebarWidth}px`,
1155
- height: `${topbarHeight}px`,
1156
- width: `calc(100% - ${actualSidebarWidth}px)`,
1157
- backgroundColor: "var(--glass-background)",
1158
- backdropFilter: "var(--glass-blur)",
1159
- WebkitBackdropFilter: "var(--glass-blur)",
1160
- borderBottom: "1px solid var(--color-border)",
1161
- boxShadow: "var(--card-shadow)",
1162
- clipPath: "inset(-100px -100px -100px 0)",
1163
- padding: "var(--mantine-spacing-sm)",
1164
- display: "flex",
1165
- alignItems: "center",
1166
- justifyContent: "space-between",
1167
- zIndex: 100,
1168
- // Add transition to match sidebar animation
1169
- transition: `left ${sidebarTransitionDuration}ms var(--easing), width ${sidebarTransitionDuration}ms var(--easing)`
1170
- },
1171
- children
1172
- }
1173
- );
1174
- };
1175
- var Topbar = ({ version, leftContent, children }) => {
1176
- const { colorScheme, toggleColorScheme } = useMantineColorScheme();
1177
- const isDark = colorScheme === "dark";
1178
- const [switchChecked, setSwitchChecked] = useState(isDark);
1179
- const [isToggling, setIsToggling] = useState(false);
1180
- useEffect(() => {
1181
- if (!isToggling) {
1182
- setSwitchChecked(isDark);
1183
- }
1184
- }, [isDark, isToggling]);
1185
- const handleSwitchToggle = (event) => {
1186
- const checked = event.currentTarget.checked;
1187
- setIsToggling(true);
1188
- toggleColorScheme();
1189
- setTimeout(() => {
1190
- setSwitchChecked(checked);
1191
- setTimeout(() => {
1192
- setIsToggling(false);
1193
- }, 200);
1194
- }, 10);
1195
- };
1196
- return /* @__PURE__ */ jsxs(TopbarContainer, { children: [
1197
- leftContent,
1198
- /* @__PURE__ */ jsxs(Group, { gap: "sm", children: [
1199
- children,
1200
- /* @__PURE__ */ jsx(
1201
- Switch,
1202
- {
1203
- size: "md",
1204
- checked: switchChecked,
1205
- onChange: handleSwitchToggle,
1206
- onLabel: /* @__PURE__ */ jsx(IconSun, { size: 16, stroke: 2.5, color: "var(--mantine-color-yellow-4)" }),
1207
- offLabel: /* @__PURE__ */ jsx(IconMoonStars, { size: 16, stroke: 2.5, color: "var(--mantine-color-blue-6)" }),
1208
- styles: {
1209
- track: {
1210
- backgroundColor: "var(--color-surface-hover)",
1211
- borderColor: "var(--color-border)"
1212
- }
1213
- }
1214
- }
1215
- ),
1216
- /* @__PURE__ */ jsx(
1217
- Code,
1218
- {
1219
- style: {
1220
- backgroundColor: "var(--color-surface)",
1221
- color: "var(--color-text)",
1222
- fontSize: "var(--mantine-font-size-xs)",
1223
- fontWeight: 700,
1224
- padding: "2px 6px",
1225
- borderRadius: "var(--mantine-radius-xs)",
1226
- border: "1px solid var(--color-border)"
1227
- },
1228
- children: version
1229
- }
1230
- )
1231
- ] })
1232
- ] });
1233
- };
1234
- function TopbarActions({ isPlatformAdmin, isDev }) {
1235
- const { getTopbarActions } = useElevasisSystems();
1236
- const actions = getTopbarActions({ isPlatformAdmin, isDev });
1237
- return /* @__PURE__ */ jsx(Fragment, { children: actions.map(({ node, render }) => /* @__PURE__ */ jsx(Fragment$1, { children: render({ node }) }, node.id)) });
1238
- }
1239
-
1240
- export { AppShellCenteredContainer, AppShellContainer, AppShellContentContainer, AppShellError, AppShellLoader, AppShellRightSideContainer, AppShellRightSideOuterContainer, AppTopbarAdjusterWrapper, CollapsibleSidebarGroup, CyberParticles, LinksGroup, PageContainer, Sidebar, SidebarContext, SidebarProvider, SubshellLoader, SubshellNavList, SubshellSidebarLoader, Topbar, TopbarActions, TopbarContainer, Vignette, subsidebarWidth, useSidebar, useSidebarCollapse };