@elevasis/ui 2.35.0 → 2.37.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 (100) 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 +45 -18
  4. package/dist/app/index.js +21 -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-5CTJ7TW2.js +111 -0
  9. package/dist/chunk-5EYJ2GIN.js +122 -0
  10. package/dist/{chunk-VDOOGGBA.js → chunk-6NREL3KL.js} +2 -2
  11. package/dist/chunk-6ROXVZ3L.js +9 -0
  12. package/dist/{chunk-YYX7OPZQ.js → chunk-73EWE2EW.js} +1 -1
  13. package/dist/{chunk-SIQ3P4OR.js → chunk-7GQFIWP4.js} +8 -756
  14. package/dist/chunk-A7IG36LB.js +215 -0
  15. package/dist/chunk-CLDCYJQT.js +1 -0
  16. package/dist/{chunk-AKW7KISS.js → chunk-CWYQRM5T.js} +2 -38
  17. package/dist/{chunk-LUYVRATI.js → chunk-DA6I5VEY.js} +5 -213
  18. package/dist/chunk-I53EX4VU.js +734 -0
  19. package/dist/chunk-IIMU5YAJ.js +53 -0
  20. package/dist/{chunk-VKIZUUPM.js → chunk-JPVZRZ3X.js} +31 -14
  21. package/dist/chunk-JXVNHVK7.js +79 -0
  22. package/dist/chunk-JZ2WID2G.js +337 -0
  23. package/dist/chunk-LCJQ6OWC.js +348 -0
  24. package/dist/chunk-LNC6PZAE.js +85 -0
  25. package/dist/{chunk-4U3XAWCN.js → chunk-NWMPBG4U.js} +134 -495
  26. package/dist/chunk-NYNOMAAS.js +422 -0
  27. package/dist/chunk-S3KBYQTI.js +39 -0
  28. package/dist/chunk-S3XR4II4.js +30 -0
  29. package/dist/chunk-SHZT7ULK.js +425 -0
  30. package/dist/{chunk-26HFM4MH.js → chunk-T3NI7DOA.js} +2005 -4106
  31. package/dist/{chunk-GX6XBRRF.js → chunk-TYRUKGGD.js} +2 -1
  32. package/dist/{chunk-R3VCBZDC.js → chunk-X4WBGKJQ.js} +3 -50
  33. package/dist/{chunk-GEFWMU26.js → chunk-X66MVMZT.js} +1 -9
  34. package/dist/{chunk-57OZ3AEG.js → chunk-Y3JQBSKQ.js} +1 -1
  35. package/dist/components/index.d.ts +36 -46
  36. package/dist/components/index.js +33 -19
  37. package/dist/components/navigation/index.js +3 -31
  38. package/dist/execution/index.d.ts +2 -2
  39. package/dist/features/auth/index.d.ts +55 -99
  40. package/dist/features/auth/index.js +36 -99
  41. package/dist/features/clients/index.js +33 -19
  42. package/dist/features/crm/index.d.ts +23 -0
  43. package/dist/features/crm/index.js +33 -19
  44. package/dist/features/dashboard/index.d.ts +3 -3
  45. package/dist/features/dashboard/index.js +33 -19
  46. package/dist/features/delivery/index.d.ts +23 -0
  47. package/dist/features/delivery/index.js +33 -19
  48. package/dist/features/knowledge/index.js +6 -30
  49. package/dist/features/lead-gen/index.d.ts +1373 -48
  50. package/dist/features/lead-gen/index.js +33 -19
  51. package/dist/features/monitoring/index.js +33 -19
  52. package/dist/features/monitoring/requests/index.js +33 -19
  53. package/dist/features/notes/index.d.ts +72 -0
  54. package/dist/features/notes/index.js +621 -0
  55. package/dist/features/operations/index.d.ts +30 -30
  56. package/dist/features/operations/index.js +33 -19
  57. package/dist/features/right-panel-host/index.d.ts +214 -0
  58. package/dist/features/right-panel-host/index.js +640 -0
  59. package/dist/features/seo/index.js +3 -2
  60. package/dist/features/settings/index.d.ts +26 -35
  61. package/dist/features/settings/index.js +33 -19
  62. package/dist/hooks/access/index.d.ts +90 -0
  63. package/dist/hooks/access/index.js +10 -0
  64. package/dist/hooks/delivery/index.d.ts +23 -0
  65. package/dist/hooks/delivery/index.js +33 -19
  66. package/dist/hooks/index.d.ts +1816 -1855
  67. package/dist/hooks/index.js +33 -19
  68. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +13 -13
  69. package/dist/hooks/published.d.ts +1816 -1855
  70. package/dist/hooks/published.js +33 -19
  71. package/dist/hooks/user-notes/index.d.ts +57 -0
  72. package/dist/hooks/user-notes/index.js +3 -0
  73. package/dist/index.d.ts +290 -309
  74. package/dist/index.js +34 -20
  75. package/dist/initialization/index.d.ts +23 -19
  76. package/dist/knowledge/index.d.ts +21 -21
  77. package/dist/knowledge/index.js +12 -9
  78. package/dist/{knowledge-search-index-ORIJCEZX.js → knowledge-search-index-NBCTFIOH.js} +2 -2
  79. package/dist/layout/index.js +5 -3
  80. package/dist/organization/index.d.ts +0 -19
  81. package/dist/organization/index.js +33 -19
  82. package/dist/profile/index.d.ts +23 -0
  83. package/dist/provider/index.css +0 -384
  84. package/dist/provider/index.d.ts +45 -18
  85. package/dist/provider/index.js +15 -21
  86. package/dist/provider/published.css +0 -523
  87. package/dist/provider/published.d.ts +45 -18
  88. package/dist/provider/published.js +11 -21
  89. package/dist/sse/index.js +26 -5
  90. package/dist/supabase/index.d.ts +46 -0
  91. package/dist/test-utils/index.d.ts +2 -21
  92. package/dist/test-utils/index.js +5 -18
  93. package/dist/theme/index.js +2 -1
  94. package/dist/types/index.d.ts +86 -72
  95. package/dist/utils/index.d.ts +3 -3
  96. package/dist/utils/index.js +2 -1
  97. package/package.json +21 -5
  98. package/src/auth/README.md +6 -6
  99. package/dist/components/navigation/index.css +0 -649
  100. package/dist/features/knowledge/index.css +0 -649
@@ -0,0 +1,422 @@
1
+ import { devOnlyFor, requiresAdminFor, topLevel, parentOf, ancestorsOf, childrenOf, findById, findByPath, listAllSystems, defaultPathFor, getSortedSidebarEntries, getSemanticIconComponent } from './chunk-NWMPBG4U.js';
2
+ import { createContext, useContext, useMemo, useCallback } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ // src/provider/resolvers/RouteResolver.ts
6
+ function normalizeRoutePath(path) {
7
+ const trimmedPath = path.trim();
8
+ if (!trimmedPath || trimmedPath === "/") {
9
+ return "/";
10
+ }
11
+ return trimmedPath.replace(/\/+$/, "") || "/";
12
+ }
13
+ function isRouteMatch(currentPath, route) {
14
+ const normalizedCurrentPath = normalizeRoutePath(currentPath);
15
+ const normalizedRoute = normalizeRoutePath(route);
16
+ return normalizedCurrentPath === normalizedRoute || normalizedCurrentPath.startsWith(`${normalizedRoute}/`);
17
+ }
18
+
19
+ // src/provider/resolvers/NavResolver.ts
20
+ function uniqueIds(ids) {
21
+ return ids ? [...new Set(ids)] : [];
22
+ }
23
+
24
+ // src/provider/validateManifests.ts
25
+ function listSystemRefs(systems) {
26
+ const refs = [];
27
+ function walk(map, prefix = "") {
28
+ for (const [key, system] of Object.entries(map)) {
29
+ const path = prefix ? `${prefix}.${key}` : key;
30
+ refs.push(path, system.id);
31
+ const subsystems = system.subsystems;
32
+ if (subsystems) {
33
+ walk(subsystems, path);
34
+ }
35
+ }
36
+ }
37
+ walk(systems);
38
+ return refs;
39
+ }
40
+ function validateManifests(manifests, organizationModel) {
41
+ if (!organizationModel) {
42
+ return;
43
+ }
44
+ const validSystemIds = /* @__PURE__ */ new Set([
45
+ ...Object.keys(organizationModel.systems ?? {}),
46
+ ...listSystemRefs(organizationModel.systems ?? {})
47
+ ]);
48
+ const errors = [];
49
+ for (const manifest of manifests) {
50
+ const key = manifest.key;
51
+ const systemId = manifest.systemId;
52
+ if (!systemId) {
53
+ continue;
54
+ }
55
+ if (!validSystemIds.has(systemId)) {
56
+ errors.push(
57
+ `Manifest "${key}": systemId "${systemId}" is not a known system id. Valid values: ${[...validSystemIds].sort().join(", ")}`
58
+ );
59
+ }
60
+ }
61
+ if (errors.length > 0) {
62
+ throw new Error(
63
+ `System manifest validation failed with ${errors.length} error(s):
64
+ ` + errors.map((e, i) => ` ${i + 1}. ${e}`).join("\n")
65
+ );
66
+ }
67
+ }
68
+ var ElevasisSystemsContext = createContext(null);
69
+
70
+ // src/provider/sidebarProjection.ts
71
+ function isLifecycleEnabled(system) {
72
+ if (system.enabled === false) return false;
73
+ return system.lifecycle !== "deprecated" && system.lifecycle !== "archived";
74
+ }
75
+ function isSystemAccessible(systemId, context) {
76
+ const system = context.shellModel.findById(systemId);
77
+ if (!system || !isLifecycleEnabled(system)) return false;
78
+ if (!context.isSystemEnabled(systemId)) return false;
79
+ if (context.shellModel.requiresAdminFor(systemId) && !context.isPlatformAdmin) return false;
80
+ if (context.shellModel.devOnlyFor(systemId) && !context.isDev) return false;
81
+ return true;
82
+ }
83
+ function isSurfaceAccessible(node, context) {
84
+ if (node.devOnly && !context.isDev) return false;
85
+ if (node.requiresAdmin && !context.isPlatformAdmin) return false;
86
+ const systemTargets = node.targets?.systems ?? [];
87
+ if (systemTargets.length === 0) return true;
88
+ return systemTargets.some((systemId) => isSystemAccessible(systemId, context));
89
+ }
90
+ function iconForNode(node, context) {
91
+ if (node.type === "surface") {
92
+ const targetIcon = node.targets?.systems?.map((systemId) => context.shellModel.findById(systemId)?.iconComponent).find(Boolean);
93
+ if (targetIcon) return targetIcon;
94
+ }
95
+ return getSemanticIconComponent(node.icon);
96
+ }
97
+ function activeMatchPathsForSurface(node, context) {
98
+ const targets = node.targets?.systems ?? [];
99
+ if (targets.length !== 1) return void 0;
100
+ const paths = context.shellModel.childrenOf(targets[0]).map((child) => child.path).filter((path) => Boolean(path && path !== node.path));
101
+ return paths.length > 0 ? [...new Set(paths)] : void 0;
102
+ }
103
+ function surfaceToLinkItem(node, context, siblings) {
104
+ if (!isSurfaceAccessible(node, context)) return void 0;
105
+ const siblingShadows = siblings.some((sibling) => sibling !== node && sibling.path.startsWith(`${node.path}/`));
106
+ const activeMatchPaths = activeMatchPathsForSurface(node, context);
107
+ return {
108
+ label: node.label,
109
+ link: node.path,
110
+ ...siblingShadows ? { exact: true } : {},
111
+ ...activeMatchPaths ? { activeMatchPaths } : {}
112
+ };
113
+ }
114
+ function projectNode(node, context) {
115
+ if (node.type === "surface") {
116
+ if (!isSurfaceAccessible(node, context)) return void 0;
117
+ return {
118
+ label: node.label,
119
+ icon: iconForNode(node, context),
120
+ link: node.path
121
+ };
122
+ }
123
+ const childEntries = getSortedSidebarEntries(node.children);
124
+ const childSurfaces = childEntries.map(([, child]) => child).filter((child) => child.type === "surface");
125
+ const links = childEntries.flatMap(([, child]) => {
126
+ if (child.type === "surface") {
127
+ const link = surfaceToLinkItem(child, context, childSurfaces);
128
+ return link ? [link] : [];
129
+ }
130
+ const nestedGroup = projectNode(child, context);
131
+ return nestedGroup?.link ? [
132
+ {
133
+ label: nestedGroup.label,
134
+ link: nestedGroup.link
135
+ }
136
+ ] : nestedGroup?.links ?? [];
137
+ });
138
+ if (links.length === 0) return void 0;
139
+ return {
140
+ label: node.label,
141
+ icon: iconForNode(node, context),
142
+ links
143
+ };
144
+ }
145
+ function projectSection(section, context) {
146
+ const entries = getSortedSidebarEntries(section);
147
+ return entries.flatMap(([, node]) => {
148
+ const group = projectNode(node, context);
149
+ return group ? [group] : [];
150
+ });
151
+ }
152
+ function projectSidebarLinks({
153
+ shellModel,
154
+ organizationModel,
155
+ isSystemEnabled,
156
+ isPlatformAdmin = false,
157
+ isDev = false,
158
+ section
159
+ }) {
160
+ const context = {
161
+ shellModel,
162
+ isSystemEnabled,
163
+ isPlatformAdmin,
164
+ isDev
165
+ };
166
+ const sidebar = organizationModel?.navigation.sidebar;
167
+ if (!sidebar) return [];
168
+ if (section) {
169
+ return projectSection(sidebar[section], context);
170
+ }
171
+ return [...projectSection(sidebar.primary, context), ...projectSection(sidebar.bottom, context)];
172
+ }
173
+ function useElevasisSystems() {
174
+ const context = useContext(ElevasisSystemsContext);
175
+ if (!context) {
176
+ throw new Error(
177
+ "useElevasisSystems must be used within an ElevasisSystemsProvider. Wrap your app (or the relevant subtree) with <ElevasisSystemsProvider>."
178
+ );
179
+ }
180
+ return context;
181
+ }
182
+ function useOptionalElevasisSystems() {
183
+ return useContext(ElevasisSystemsContext);
184
+ }
185
+ function defaultSystems(organizationModel) {
186
+ if (!organizationModel) return [];
187
+ return listAllSystems(organizationModel).map(({ path, system }) => ({ ...system, id: path }));
188
+ }
189
+ function systemPath(system) {
190
+ return system.ui?.path ?? system.path ?? defaultPathFor(system.id);
191
+ }
192
+ function systemLabel(system) {
193
+ return system.label ?? system.title ?? system.id;
194
+ }
195
+ function moduleSystemId(module) {
196
+ return module.systemId ?? module.key;
197
+ }
198
+ function isLifecycleEnabled2(system) {
199
+ if (system.enabled === false) return false;
200
+ return system.lifecycle !== "deprecated" && system.lifecycle !== "archived";
201
+ }
202
+ function isOrganizationModelSystemEnabled(organizationModel, systemId) {
203
+ const system = defaultSystems(organizationModel).find((candidate) => candidate.id === systemId);
204
+ return system ? isLifecycleEnabled2(system) : void 0;
205
+ }
206
+ function resolveSystemModules(systems, isSystemEnabled) {
207
+ return systems.map((system) => {
208
+ const systemId = system.systemId;
209
+ const accessKey = systemId ?? system.key;
210
+ return {
211
+ ...system,
212
+ systemId,
213
+ access: {
214
+ systemKey: system.key,
215
+ systemId,
216
+ enabled: isSystemEnabled(accessKey)
217
+ },
218
+ semantics: {
219
+ capabilityIds: uniqueIds(system.capabilityIds ?? [])
220
+ }
221
+ };
222
+ });
223
+ }
224
+ function buildShellSystems(organizationModel, modules) {
225
+ const iconBySystemId = new Map(
226
+ modules.flatMap((module) => module.systemId ? [[moduleSystemId(module), module.icon]] : [])
227
+ );
228
+ return defaultSystems(organizationModel).map((system) => ({
229
+ ...system,
230
+ label: systemLabel(system),
231
+ path: systemPath(system),
232
+ iconComponent: iconBySystemId.get(system.id)
233
+ }));
234
+ }
235
+ function createShellModel(systems) {
236
+ const systemsRecord = Object.fromEntries(systems.map((s) => [s.id, s]));
237
+ return {
238
+ systems,
239
+ findByPath: (path) => findByPath(systemsRecord, normalizeRoutePath(path)),
240
+ findById: (id) => findById(systemsRecord, id),
241
+ childrenOf: (id) => childrenOf(systemsRecord, id),
242
+ ancestorsOf: (id) => ancestorsOf(systemsRecord, id),
243
+ parentOf: (id) => parentOf(systemsRecord, id),
244
+ topLevel: () => topLevel(systemsRecord),
245
+ requiresAdminFor: (id) => requiresAdminFor(systemsRecord, id),
246
+ devOnlyFor: (id) => devOnlyFor(systemsRecord, id)
247
+ };
248
+ }
249
+ function resolveOrganizationGraphSystem(systems, shellModel) {
250
+ for (const system of systems) {
251
+ const graphBridge = system.organizationGraph;
252
+ if (!graphBridge) continue;
253
+ const systemId = graphBridge.systemId;
254
+ if (!systemId) continue;
255
+ const node = shellModel.findById(systemId);
256
+ return {
257
+ available: Boolean(node),
258
+ systemId,
259
+ systemPath: node ? systemPath(node) : void 0
260
+ };
261
+ }
262
+ return {
263
+ available: false
264
+ };
265
+ }
266
+ function findMatchingNode(shellModel, currentPath) {
267
+ const normalizedPath = normalizeRoutePath(currentPath);
268
+ const exact = shellModel.findByPath(normalizedPath);
269
+ if (exact) return exact;
270
+ return [...shellModel.systems].filter((system) => {
271
+ const path = normalizeRoutePath(systemPath(system));
272
+ return path !== "/" && isRouteMatch(normalizedPath, path);
273
+ }).sort((a, b) => systemPath(b).length - systemPath(a).length)[0];
274
+ }
275
+ function ownsNode(module, node) {
276
+ if (!node || !module.systemId) return false;
277
+ return node.id === module.systemId || node.id.startsWith(`${module.systemId}.`);
278
+ }
279
+ function ownsRoutePrefix(module, normalizedPath) {
280
+ return (module.routePrefixes ?? []).some((prefix) => isRouteMatch(normalizedPath, normalizeRoutePath(prefix)));
281
+ }
282
+ function resolveRoute(systems, shellModel, currentPath, disabledSubsectionPaths) {
283
+ const node = findMatchingNode(shellModel, currentPath);
284
+ const normalizedPath = normalizeRoutePath(currentPath);
285
+ if (disabledSubsectionPaths.some((disabledPath) => isRouteMatch(normalizedPath, disabledPath))) {
286
+ return {
287
+ status: "hidden",
288
+ path: currentPath,
289
+ node
290
+ };
291
+ }
292
+ const system = systems.find((candidate) => ownsNode(candidate, node)) ?? systems.filter((candidate) => ownsRoutePrefix(candidate, normalizedPath)).sort(
293
+ (a, b) => Math.max(...(b.routePrefixes ?? []).map((prefix) => prefix.length)) - Math.max(...(a.routePrefixes ?? []).map((prefix) => prefix.length))
294
+ )[0];
295
+ if (!system) {
296
+ return {
297
+ status: "unmatched",
298
+ path: currentPath,
299
+ node
300
+ };
301
+ }
302
+ return {
303
+ status: "matched",
304
+ path: currentPath,
305
+ system,
306
+ node
307
+ };
308
+ }
309
+ function ElevasisSystemsProvider({
310
+ systems,
311
+ organizationModel,
312
+ timeRange,
313
+ operationsApiUrl,
314
+ operationsSSEManager,
315
+ deliveryApiUrl,
316
+ deliverySSEManager,
317
+ disabledSubsectionPaths = [],
318
+ children
319
+ }) {
320
+ const activeSystems = systems ?? [];
321
+ const resolvedOrganizationModel = useMemo(() => {
322
+ if (!organizationModel) {
323
+ return void 0;
324
+ }
325
+ return {
326
+ ...organizationModel,
327
+ knowledge: organizationModel.knowledge ?? {}
328
+ };
329
+ }, [organizationModel]);
330
+ useMemo(() => validateManifests(activeSystems, resolvedOrganizationModel), [activeSystems, resolvedOrganizationModel]);
331
+ const hasResolvedSystem = useCallback(
332
+ (key) => {
333
+ const organizationModelSystemEnabled = isOrganizationModelSystemEnabled(resolvedOrganizationModel, key);
334
+ return organizationModelSystemEnabled ?? true;
335
+ },
336
+ [resolvedOrganizationModel]
337
+ );
338
+ const shellSystems = useMemo(
339
+ () => buildShellSystems(resolvedOrganizationModel, activeSystems),
340
+ [resolvedOrganizationModel, activeSystems]
341
+ );
342
+ const shellModel = useMemo(() => createShellModel(shellSystems), [shellSystems]);
343
+ const normalizedDisabledSubsectionPaths = useMemo(
344
+ () => [...new Set(disabledSubsectionPaths.map((path) => normalizeRoutePath(path)))],
345
+ [disabledSubsectionPaths]
346
+ );
347
+ const resolvedSystems = useMemo(
348
+ () => resolveSystemModules(activeSystems, hasResolvedSystem),
349
+ [activeSystems, hasResolvedSystem]
350
+ );
351
+ const enabledResolvedSystems = useMemo(
352
+ () => resolvedSystems.filter((system) => system.access.enabled),
353
+ [resolvedSystems]
354
+ );
355
+ const organizationGraph = useMemo(
356
+ () => resolveOrganizationGraphSystem(enabledResolvedSystems, shellModel),
357
+ [enabledResolvedSystems, shellModel]
358
+ );
359
+ const getResolvedSystem = useCallback(
360
+ (key) => resolvedSystems.find((system) => system.key === key),
361
+ [resolvedSystems]
362
+ );
363
+ const isSystemEnabled = useCallback((key) => hasResolvedSystem(key), [hasResolvedSystem]);
364
+ const getSidebarLinks = useCallback(
365
+ (options = {}) => projectSidebarLinks({
366
+ shellModel,
367
+ organizationModel: resolvedOrganizationModel,
368
+ isSystemEnabled,
369
+ ...options
370
+ }),
371
+ [shellModel, resolvedOrganizationModel, isSystemEnabled]
372
+ );
373
+ const resolveRouteByPath = useCallback(
374
+ (path) => resolveRoute(enabledResolvedSystems, shellModel, path, normalizedDisabledSubsectionPaths),
375
+ [enabledResolvedSystems, shellModel, normalizedDisabledSubsectionPaths]
376
+ );
377
+ const shellRuntime = useMemo(
378
+ () => ({
379
+ resolveRoute: resolveRouteByPath
380
+ }),
381
+ [resolveRouteByPath]
382
+ );
383
+ const value = useMemo(
384
+ () => ({
385
+ shellModel,
386
+ shellRuntime,
387
+ getSidebarLinks,
388
+ enabledResolvedSystems,
389
+ resolvedSystems,
390
+ organizationGraph,
391
+ organizationModel: resolvedOrganizationModel,
392
+ timeRange,
393
+ operationsApiUrl,
394
+ operationsSSEManager,
395
+ deliveryApiUrl,
396
+ deliverySSEManager,
397
+ disabledSubsectionPaths: normalizedDisabledSubsectionPaths,
398
+ isSystemEnabled,
399
+ getResolvedSystem
400
+ }),
401
+ [
402
+ shellModel,
403
+ shellRuntime,
404
+ enabledResolvedSystems,
405
+ resolvedSystems,
406
+ organizationGraph,
407
+ resolvedOrganizationModel,
408
+ timeRange,
409
+ operationsApiUrl,
410
+ operationsSSEManager,
411
+ deliveryApiUrl,
412
+ deliverySSEManager,
413
+ normalizedDisabledSubsectionPaths,
414
+ isSystemEnabled,
415
+ getResolvedSystem,
416
+ getSidebarLinks
417
+ ]
418
+ );
419
+ return /* @__PURE__ */ jsx(ElevasisSystemsContext.Provider, { value, children });
420
+ }
421
+
422
+ export { ElevasisSystemsProvider, useElevasisSystems, useOptionalElevasisSystems };
@@ -0,0 +1,39 @@
1
+ import { usePresetsContext } from './chunk-CWYQRM5T.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 };
@@ -0,0 +1,30 @@
1
+ import { Group, Box, Title, Text, ThemeIcon } from '@mantine/core';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+
4
+ // src/components/display/CardHeader.tsx
5
+ function CardHeader({
6
+ icon,
7
+ title,
8
+ subtitle,
9
+ rightSection,
10
+ titleOrder = 3,
11
+ iconColor,
12
+ mb = "md"
13
+ }) {
14
+ const wrappedIcon = icon ? /* @__PURE__ */ jsx(ThemeIcon, { size: "md", variant: "light", color: iconColor, children: icon }) : null;
15
+ return /* @__PURE__ */ jsxs(Group, { justify: "space-between", mb, gap: "md", align: "flex-start", wrap: "nowrap", children: [
16
+ subtitle ? /* @__PURE__ */ jsxs(Box, { style: { minWidth: 0 }, children: [
17
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
18
+ wrappedIcon,
19
+ /* @__PURE__ */ jsx(Title, { order: titleOrder, style: { overflowWrap: "anywhere" }, children: title })
20
+ ] }),
21
+ /* @__PURE__ */ jsx(Text, { size: "sm", mt: 2, style: { color: "var(--color-text-dimmed)", overflowWrap: "anywhere" }, children: subtitle })
22
+ ] }) : /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
23
+ wrappedIcon,
24
+ /* @__PURE__ */ jsx(Title, { order: titleOrder, style: { overflowWrap: "anywhere" }, children: title })
25
+ ] }),
26
+ rightSection
27
+ ] });
28
+ }
29
+
30
+ export { CardHeader };