@elevasis/ui 2.36.0 → 2.38.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 -3
  2. package/dist/app/index.css +0 -384
  3. package/dist/app/index.d.ts +75 -2
  4. package/dist/app/index.js +22 -21
  5. package/dist/auth/index.d.ts +91 -28
  6. package/dist/auth/index.js +5 -1
  7. package/dist/charts/index.js +9 -3
  8. package/dist/chunk-4O3VAALW.js +349 -0
  9. package/dist/{chunk-O2Q4VMRN.js → chunk-566XWGPP.js} +76 -109
  10. package/dist/chunk-5EYJ2GIN.js +122 -0
  11. package/dist/chunk-6D4LCJ52.js +10 -0
  12. package/dist/chunk-6ROXVZ3L.js +9 -0
  13. package/dist/{chunk-YYX7OPZQ.js → chunk-73EWE2EW.js} +1 -1
  14. package/dist/{chunk-SIQ3P4OR.js → chunk-7GQFIWP4.js} +8 -756
  15. package/dist/{chunk-VKIZUUPM.js → chunk-7YXZFS56.js} +31 -14
  16. package/dist/{chunk-AKW7KISS.js → chunk-7ZWXTH5J.js} +2 -44
  17. package/dist/chunk-A7IG36LB.js +215 -0
  18. package/dist/chunk-B2DZLPDL.js +39 -0
  19. package/dist/chunk-C6BDBZRO.js +422 -0
  20. package/dist/chunk-CLDCYJQT.js +1 -0
  21. package/dist/{chunk-LUYVRATI.js → chunk-DA6I5VEY.js} +5 -213
  22. package/dist/chunk-H2MEFUQD.js +337 -0
  23. package/dist/chunk-I53EX4VU.js +734 -0
  24. package/dist/chunk-IIMU5YAJ.js +53 -0
  25. package/dist/chunk-JXVNHVK7.js +79 -0
  26. package/dist/chunk-M7Q4UBRY.js +85 -0
  27. package/dist/{chunk-K4UZU3TU.js → chunk-P34FFSOX.js} +1 -1
  28. package/dist/chunk-PGWANFNE.js +112 -0
  29. package/dist/{chunk-F6EFC2MJ.js → chunk-Q64E2TZY.js} +440 -2075
  30. package/dist/chunk-S3XR4II4.js +30 -0
  31. package/dist/chunk-SHZT7ULK.js +425 -0
  32. package/dist/{chunk-GX6XBRRF.js → chunk-TYRUKGGD.js} +2 -1
  33. package/dist/{chunk-R3VCBZDC.js → chunk-X4WBGKJQ.js} +3 -50
  34. package/dist/{chunk-GEFWMU26.js → chunk-X66MVMZT.js} +1 -9
  35. package/dist/{chunk-57OZ3AEG.js → chunk-Y3JQBSKQ.js} +1 -1
  36. package/dist/components/index.d.ts +74 -42
  37. package/dist/components/index.js +34 -19
  38. package/dist/components/navigation/index.js +3 -31
  39. package/dist/features/auth/index.d.ts +97 -99
  40. package/dist/features/auth/index.js +37 -99
  41. package/dist/features/clients/index.js +34 -19
  42. package/dist/features/crm/index.d.ts +65 -0
  43. package/dist/features/crm/index.js +34 -19
  44. package/dist/features/dashboard/index.js +34 -19
  45. package/dist/features/delivery/index.d.ts +65 -0
  46. package/dist/features/delivery/index.js +34 -19
  47. package/dist/features/knowledge/index.js +6 -30
  48. package/dist/features/lead-gen/index.d.ts +1096 -1
  49. package/dist/features/lead-gen/index.js +34 -19
  50. package/dist/features/monitoring/index.js +34 -19
  51. package/dist/features/monitoring/requests/index.js +34 -19
  52. package/dist/features/notes/index.d.ts +72 -0
  53. package/dist/features/notes/index.js +621 -0
  54. package/dist/features/operations/index.d.ts +10 -2
  55. package/dist/features/operations/index.js +34 -19
  56. package/dist/features/right-panel-host/index.d.ts +214 -0
  57. package/dist/features/right-panel-host/index.js +639 -0
  58. package/dist/features/seo/index.js +3 -2
  59. package/dist/features/settings/index.d.ts +68 -35
  60. package/dist/features/settings/index.js +34 -19
  61. package/dist/hooks/access/index.d.ts +90 -0
  62. package/dist/hooks/access/index.js +10 -0
  63. package/dist/hooks/delivery/index.d.ts +65 -0
  64. package/dist/hooks/delivery/index.js +34 -19
  65. package/dist/hooks/index.d.ts +1644 -1651
  66. package/dist/hooks/index.js +34 -19
  67. package/dist/hooks/published.d.ts +1644 -1651
  68. package/dist/hooks/published.js +34 -19
  69. package/dist/hooks/user-notes/index.d.ts +57 -0
  70. package/dist/hooks/user-notes/index.js +3 -0
  71. package/dist/index.d.ts +294 -277
  72. package/dist/index.js +35 -20
  73. package/dist/initialization/index.d.ts +65 -19
  74. package/dist/knowledge/index.d.ts +10 -2
  75. package/dist/knowledge/index.js +173 -28
  76. package/dist/layout/index.js +5 -3
  77. package/dist/organization/index.d.ts +0 -19
  78. package/dist/organization/index.js +34 -19
  79. package/dist/profile/index.d.ts +65 -0
  80. package/dist/provider/index.css +0 -384
  81. package/dist/provider/index.d.ts +75 -2
  82. package/dist/provider/index.js +16 -21
  83. package/dist/provider/published.css +0 -523
  84. package/dist/provider/published.d.ts +75 -2
  85. package/dist/provider/published.js +11 -21
  86. package/dist/supabase/index.d.ts +127 -0
  87. package/dist/test-utils/index.d.ts +2 -21
  88. package/dist/test-utils/index.js +5 -18
  89. package/dist/theme/index.js +3 -1
  90. package/dist/types/index.d.ts +115 -59
  91. package/dist/utils/index.js +2 -1
  92. package/package.json +21 -5
  93. package/src/auth/README.md +6 -6
  94. package/dist/components/navigation/index.css +0 -649
  95. package/dist/features/knowledge/index.css +0 -649
@@ -1,3 +1,4 @@
1
+ import { useAccess } from './chunk-4O3VAALW.js';
1
2
  import { useInitialization } from './chunk-533DUEQY.js';
2
3
  import { useAuthContext } from './chunk-BRJ3QZ4E.js';
3
4
  import { useRef, useCallback, useEffect } from 'react';
@@ -93,24 +94,40 @@ function ProtectedRoute({
93
94
  }
94
95
  return /* @__PURE__ */ jsx(Fragment, { children });
95
96
  }
96
- function AdminGuard({ children, redirectTo = "/", fallback = null }) {
97
- const { userReady, profile } = useInitialization();
98
- const navigate = useNavigate();
97
+ function useOptionalNavigate() {
98
+ try {
99
+ return useNavigate();
100
+ } catch {
101
+ return null;
102
+ }
103
+ }
104
+ function renderFallback(fallback, answer) {
105
+ return typeof fallback === "function" ? fallback(answer) : fallback ?? null;
106
+ }
107
+ function AccessGuard({
108
+ accessKey,
109
+ children,
110
+ fallback = null,
111
+ loadingFallback = null,
112
+ redirectTo = null
113
+ }) {
114
+ const answer = useAccess(accessKey);
115
+ const navigate = useOptionalNavigate();
116
+ const hasRedirected = useRef(false);
99
117
  useEffect(() => {
100
- if (!userReady || !profile) {
118
+ if (!answer.isReady || answer.allowed || !redirectTo || hasRedirected.current) return;
119
+ hasRedirected.current = true;
120
+ if (navigate) {
121
+ navigate({ to: redirectTo });
101
122
  return;
102
123
  }
103
- if (!profile.is_platform_admin) {
104
- navigate({ to: redirectTo });
124
+ if (typeof window !== "undefined") {
125
+ window.location.assign(redirectTo);
105
126
  }
106
- }, [userReady, profile, navigate, redirectTo]);
107
- if (!userReady) {
108
- return /* @__PURE__ */ jsx(Fragment, { children: fallback });
109
- }
110
- if (!profile?.is_platform_admin) {
111
- return null;
112
- }
127
+ }, [answer.allowed, answer.isReady, navigate, redirectTo]);
128
+ if (!answer.isReady) return /* @__PURE__ */ jsx(Fragment, { children: loadingFallback });
129
+ if (!answer.allowed) return /* @__PURE__ */ jsx(Fragment, { children: renderFallback(fallback, answer) });
113
130
  return /* @__PURE__ */ jsx(Fragment, { children });
114
131
  }
115
132
 
116
- export { AdminGuard, ProtectedRoute, useSessionCheck, useStableAccessToken };
133
+ export { AccessGuard, ProtectedRoute, useSessionCheck, useStableAccessToken };
@@ -1,6 +1,5 @@
1
- import { PRESETS, getPreset, generateShades } from './chunk-WF7CONXF.js';
1
+ import { getPreset, generateShades } from './chunk-WF7CONXF.js';
2
2
  import { Tooltip, Tree, Text, TagsInput, Tabs, Table, Stack, SimpleGrid, Select, Combobox, SegmentedControl, ScrollArea, Paper, Popover, Notification, MultiSelect, Modal, Menu, Input, HoverCard, Group, Grid, Flex, Drawer, Code, Divider, Card, Button, Accordion, createTheme } from '@mantine/core';
3
- import { createContext, useContext, useMemo } from 'react';
4
3
 
5
4
  // src/theme/cssVariables.ts
6
5
  var TOKEN_VAR_MAP = {
@@ -418,8 +417,6 @@ var componentThemes = {
418
417
  })
419
418
  // Pagination styles are in custom.css to support :not([data-active]) selector
420
419
  };
421
-
422
- // src/theme/MantineThemeOverride.ts
423
420
  var mantineThemeOverride = createTheme({
424
421
  defaultRadius: "xs",
425
422
  fontFamily: 'Roboto, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
@@ -447,44 +444,5 @@ var mantineThemeOverride = createTheme({
447
444
  },
448
445
  components: componentThemes
449
446
  });
450
- var PresetsContext = createContext(PRESETS);
451
- var PresetsProvider = PresetsContext.Provider;
452
- function usePresetsContext() {
453
- return useContext(PresetsContext);
454
- }
455
- var BUILT_IN_NAMES = /* @__PURE__ */ new Set([
456
- "default",
457
- "tactical",
458
- "regal",
459
- "cyber-volt",
460
- "aurora",
461
- "rose-gold",
462
- "midnight",
463
- "titanium",
464
- "obsidian",
465
- "honey",
466
- "abyss",
467
- "canopy",
468
- "slate",
469
- "cyber-strike",
470
- "cyber-chrome",
471
- "cyber-void",
472
- "quarry"
473
- ]);
474
- function titleCase(str) {
475
- return str.replace(/(^|-)(\w)/g, (_, sep, char) => (sep ? " " : "") + char.toUpperCase());
476
- }
477
- function useAvailablePresets() {
478
- const presetsMap = usePresetsContext();
479
- return useMemo(() => {
480
- return Object.entries(presetsMap).map(([key, preset]) => ({
481
- value: key,
482
- label: preset.label ?? titleCase(key),
483
- description: preset.description ?? "",
484
- colors: preset.colors ?? [preset.dark.primary, preset.dark.background, preset.light.background],
485
- isCustom: !BUILT_IN_NAMES.has(key)
486
- }));
487
- }, [presetsMap]);
488
- }
489
447
 
490
- export { PresetsProvider, TOKEN_VAR_MAP, componentThemes, createCssVariablesResolver, glassBase, mantineThemeOverride, useAvailablePresets, usePresetsContext };
448
+ export { TOKEN_VAR_MAP, componentThemes, createCssVariablesResolver, glassBase, mantineThemeOverride };
@@ -0,0 +1,215 @@
1
+ import { topbarHeight, sidebarTransitionDuration, sidebarBottomSectionHeight } from './chunk-DT3QYZVU.js';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { createContext, useState, useContext } from 'react';
4
+
5
+ var SubshellContainer = ({ children, className }) => {
6
+ return /* @__PURE__ */ jsx(
7
+ "div",
8
+ {
9
+ className,
10
+ style: {
11
+ display: "flex",
12
+ height: "100%",
13
+ width: "100%",
14
+ position: "relative"
15
+ },
16
+ children
17
+ }
18
+ );
19
+ };
20
+ var SubshellRightSideContainer = ({ children, className }) => {
21
+ return /* @__PURE__ */ jsx(
22
+ "div",
23
+ {
24
+ className,
25
+ style: {
26
+ flex: 1,
27
+ minWidth: 0,
28
+ display: "flex",
29
+ flexDirection: "column",
30
+ overflow: "hidden"
31
+ },
32
+ children
33
+ }
34
+ );
35
+ };
36
+ var mdSpacing = 16;
37
+ var SubshellContentContainer = ({ children, className }) => {
38
+ return /* @__PURE__ */ jsx(
39
+ "div",
40
+ {
41
+ className,
42
+ style: {
43
+ display: "flex",
44
+ flexDirection: "column",
45
+ flex: 1,
46
+ overflowX: "clip",
47
+ overflowY: "auto",
48
+ minWidth: 0,
49
+ minHeight: 0,
50
+ padding: "var(--mantine-spacing-md)",
51
+ paddingTop: `${topbarHeight + mdSpacing}px`
52
+ },
53
+ children
54
+ }
55
+ );
56
+ };
57
+ var SubshellSidebar = ({
58
+ children,
59
+ className,
60
+ width,
61
+ collapsible = true,
62
+ defaultOpen = true
63
+ }) => {
64
+ const [isOpen, setIsOpen] = useState(defaultOpen);
65
+ const effectiveWidth = collapsible && !isOpen ? 0 : width;
66
+ if (!collapsible) {
67
+ return /* @__PURE__ */ jsx(
68
+ "aside",
69
+ {
70
+ className,
71
+ style: {
72
+ width: `${width}px`,
73
+ flexShrink: 0,
74
+ display: "flex",
75
+ flexDirection: "column",
76
+ backgroundColor: "color-mix(in srgb, var(--glass-background) 80%, transparent)",
77
+ backdropFilter: "var(--glass-blur)",
78
+ WebkitBackdropFilter: "var(--glass-blur)",
79
+ borderRight: "1px solid var(--color-border)",
80
+ boxShadow: "var(--card-shadow)",
81
+ clipPath: "inset(-100px -100px -100px 0)",
82
+ height: `calc(100vh - ${topbarHeight}px)`,
83
+ minHeight: 0,
84
+ marginTop: `${topbarHeight}px`,
85
+ fontFamily: "var(--elevasis-font-family-subtitle)",
86
+ overflow: "hidden"
87
+ },
88
+ children
89
+ }
90
+ );
91
+ }
92
+ return /* @__PURE__ */ jsxs(
93
+ "div",
94
+ {
95
+ style: {
96
+ position: "relative",
97
+ flexShrink: 0,
98
+ marginTop: `${topbarHeight}px`,
99
+ height: `calc(100vh - ${topbarHeight}px)`,
100
+ minHeight: 0
101
+ },
102
+ children: [
103
+ /* @__PURE__ */ jsx(
104
+ "aside",
105
+ {
106
+ className,
107
+ style: {
108
+ width: `${effectiveWidth}px`,
109
+ flexShrink: 0,
110
+ display: "flex",
111
+ flexDirection: "column",
112
+ backgroundColor: "color-mix(in srgb, var(--glass-background) 80%, transparent)",
113
+ backdropFilter: "var(--glass-blur)",
114
+ WebkitBackdropFilter: "var(--glass-blur)",
115
+ borderRight: isOpen ? "1px solid var(--color-border)" : "none",
116
+ boxShadow: isOpen ? "var(--card-shadow)" : "none",
117
+ clipPath: isOpen ? "inset(-100px -100px -100px 0)" : "none",
118
+ height: "100%",
119
+ fontFamily: "var(--elevasis-font-family-subtitle)",
120
+ overflow: "hidden",
121
+ transition: `width ${sidebarTransitionDuration}ms var(--easing)`
122
+ },
123
+ children: /* @__PURE__ */ jsx(
124
+ "div",
125
+ {
126
+ style: {
127
+ width: `${width}px`,
128
+ flexShrink: 0,
129
+ height: "100%",
130
+ minHeight: 0,
131
+ display: "flex",
132
+ flexDirection: "column",
133
+ opacity: isOpen ? 1 : 0,
134
+ transition: `opacity var(--duration-fast) var(--easing)`
135
+ },
136
+ children
137
+ }
138
+ )
139
+ }
140
+ ),
141
+ /* @__PURE__ */ jsx(
142
+ "button",
143
+ {
144
+ onClick: () => setIsOpen((prev) => !prev),
145
+ style: {
146
+ position: "absolute",
147
+ right: 0,
148
+ bottom: 0,
149
+ transform: "translateX(100%)",
150
+ width: "20px",
151
+ // Match the live height of the outer Sidebar's bottom profile section.
152
+ // SidebarBottomSection publishes --elevasis-sidebar-bottom-section-height
153
+ // via ResizeObserver so this follows its actual height through
154
+ // collapse/expand transitions. Falls back to the expanded-state
155
+ // constant when rendered outside a Sidebar layout.
156
+ height: `var(--elevasis-sidebar-bottom-section-height, ${sidebarBottomSectionHeight}px)`,
157
+ display: "flex",
158
+ alignItems: "center",
159
+ justifyContent: "center",
160
+ backgroundColor: "color-mix(in srgb, var(--glass-background) 80%, transparent)",
161
+ backdropFilter: "var(--glass-blur)",
162
+ WebkitBackdropFilter: "var(--glass-blur)",
163
+ border: "1px solid var(--color-border)",
164
+ borderLeft: "none",
165
+ borderBottom: "none",
166
+ borderRadius: "0 4px 0 0",
167
+ cursor: "pointer",
168
+ color: "var(--color-text-subtle)",
169
+ padding: 0,
170
+ zIndex: 10,
171
+ transition: `color var(--duration-fast) var(--easing)`
172
+ },
173
+ "aria-label": isOpen ? "Collapse sidebar" : "Expand sidebar",
174
+ children: /* @__PURE__ */ jsx(
175
+ "svg",
176
+ {
177
+ width: "6",
178
+ height: "10",
179
+ viewBox: "0 0 8 12",
180
+ fill: "none",
181
+ style: {
182
+ transform: isOpen ? void 0 : "rotate(180deg)",
183
+ transition: `transform var(--duration-fast) var(--easing)`
184
+ },
185
+ children: /* @__PURE__ */ jsx(
186
+ "path",
187
+ {
188
+ d: "M6 1L1 6L6 11",
189
+ stroke: "currentColor",
190
+ strokeWidth: "1.5",
191
+ strokeLinecap: "round",
192
+ strokeLinejoin: "round"
193
+ }
194
+ )
195
+ }
196
+ )
197
+ }
198
+ )
199
+ ]
200
+ }
201
+ );
202
+ };
203
+ var AppearanceContext = createContext(null);
204
+ function AppearanceProvider({ value, children }) {
205
+ return /* @__PURE__ */ jsx(AppearanceContext.Provider, { value, children });
206
+ }
207
+ function useAppearance() {
208
+ const ctx = useContext(AppearanceContext);
209
+ if (!ctx) {
210
+ throw new Error("useAppearance must be used within an AppearanceProvider (ElevasisCoreProvider)");
211
+ }
212
+ return ctx;
213
+ }
214
+
215
+ export { AppearanceProvider, SubshellContainer, SubshellContentContainer, SubshellRightSideContainer, SubshellSidebar, useAppearance };
@@ -0,0 +1,39 @@
1
+ import { usePresetsContext } from './chunk-6D4LCJ52.js';
2
+ import { useMemo } from 'react';
3
+
4
+ var BUILT_IN_NAMES = /* @__PURE__ */ new Set([
5
+ "default",
6
+ "tactical",
7
+ "regal",
8
+ "cyber-volt",
9
+ "aurora",
10
+ "rose-gold",
11
+ "midnight",
12
+ "titanium",
13
+ "obsidian",
14
+ "honey",
15
+ "abyss",
16
+ "canopy",
17
+ "slate",
18
+ "cyber-strike",
19
+ "cyber-chrome",
20
+ "cyber-void",
21
+ "quarry"
22
+ ]);
23
+ function titleCase(str) {
24
+ return str.replace(/(^|-)(\w)/g, (_, sep, char) => (sep ? " " : "") + char.toUpperCase());
25
+ }
26
+ function useAvailablePresets() {
27
+ const presetsMap = usePresetsContext();
28
+ return useMemo(() => {
29
+ return Object.entries(presetsMap).map(([key, preset]) => ({
30
+ value: key,
31
+ label: preset.label ?? titleCase(key),
32
+ description: preset.description ?? "",
33
+ colors: preset.colors ?? [preset.dark.primary, preset.dark.background, preset.light.background],
34
+ isCustom: !BUILT_IN_NAMES.has(key)
35
+ }));
36
+ }, [presetsMap]);
37
+ }
38
+
39
+ export { useAvailablePresets };