@elevasis/ui 1.0.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 (97) hide show
  1. package/dist/api/index.d.ts +87 -0
  2. package/dist/api/index.js +3 -0
  3. package/dist/auth/context.d.ts +19 -0
  4. package/dist/auth/context.js +1 -0
  5. package/dist/auth/index.d.ts +85 -0
  6. package/dist/auth/index.js +3 -0
  7. package/dist/chunk-3KMDHCAR.js +52 -0
  8. package/dist/chunk-5UWFGBFM.js +129 -0
  9. package/dist/chunk-6BJOYF6E.js +8 -0
  10. package/dist/chunk-6M6OLGQY.js +36 -0
  11. package/dist/chunk-7AI5ZYJ4.js +202 -0
  12. package/dist/chunk-7PLEQFHO.js +18 -0
  13. package/dist/chunk-GDV44UWF.js +138 -0
  14. package/dist/chunk-GEFB5YIR.js +338 -0
  15. package/dist/chunk-HBRMWW6V.js +43 -0
  16. package/dist/chunk-HUWJXLLF.js +681 -0
  17. package/dist/chunk-J3FALDQE.js +176 -0
  18. package/dist/chunk-JKERRYVS.js +109 -0
  19. package/dist/chunk-KA7LO7U5.js +28 -0
  20. package/dist/chunk-LHQTTUL2.js +27 -0
  21. package/dist/chunk-MAAS6CGR.js +1299 -0
  22. package/dist/chunk-NE36BUGQ.js +146 -0
  23. package/dist/chunk-NGXCFBCS.js +398 -0
  24. package/dist/chunk-OEYU5O27.js +235 -0
  25. package/dist/chunk-OUHGHTE7.js +748 -0
  26. package/dist/chunk-OXVOHOP3.js +661 -0
  27. package/dist/chunk-PSLKGOBZ.js +58 -0
  28. package/dist/chunk-PYL4XW6H.js +107 -0
  29. package/dist/chunk-Q47SPRY7.js +1 -0
  30. package/dist/chunk-Q7DJKLEN.js +18 -0
  31. package/dist/chunk-RJCA5672.js +1664 -0
  32. package/dist/chunk-S66I2PYB.js +748 -0
  33. package/dist/chunk-W7ZBF5AA.js +1 -0
  34. package/dist/chunk-WNWKOCGJ.js +1067 -0
  35. package/dist/chunk-XCYKC6OZ.js +1 -0
  36. package/dist/chunk-YULUKCS6.js +56 -0
  37. package/dist/chunk-YZ6GTZXL.js +48 -0
  38. package/dist/chunk-ZGHDPDTF.js +379 -0
  39. package/dist/components/command-queue/index.css +53 -0
  40. package/dist/components/command-queue/index.d.ts +204 -0
  41. package/dist/components/command-queue/index.js +10 -0
  42. package/dist/components/forms/index.d.ts +56 -0
  43. package/dist/components/forms/index.js +2 -0
  44. package/dist/components/index.css +443 -0
  45. package/dist/components/index.d.ts +1354 -0
  46. package/dist/components/index.js +18 -0
  47. package/dist/components/monitoring/index.d.ts +66 -0
  48. package/dist/components/monitoring/index.js +2 -0
  49. package/dist/components/navigation/index.d.ts +54 -0
  50. package/dist/components/navigation/index.js +91 -0
  51. package/dist/components/notifications/index.d.ts +52 -0
  52. package/dist/components/notifications/index.js +4 -0
  53. package/dist/components/resource-definition/index.css +388 -0
  54. package/dist/components/resource-definition/index.d.ts +301 -0
  55. package/dist/components/resource-definition/index.js +3 -0
  56. package/dist/display/index.css +53 -0
  57. package/dist/display/index.d.ts +606 -0
  58. package/dist/display/index.js +6 -0
  59. package/dist/execution/index.css +388 -0
  60. package/dist/execution/index.d.ts +1090 -0
  61. package/dist/execution/index.js +4 -0
  62. package/dist/graph/index.css +388 -0
  63. package/dist/graph/index.d.ts +429 -0
  64. package/dist/graph/index.js +1 -0
  65. package/dist/hooks/index.d.ts +1927 -0
  66. package/dist/hooks/index.js +6 -0
  67. package/dist/hooks/published.d.ts +1653 -0
  68. package/dist/hooks/published.js +4 -0
  69. package/dist/index.css +505 -0
  70. package/dist/index.d.ts +7284 -0
  71. package/dist/index.js +31 -0
  72. package/dist/initialization/index.d.ts +2325 -0
  73. package/dist/initialization/index.js +4 -0
  74. package/dist/organization/index.d.ts +225 -0
  75. package/dist/organization/index.js +4 -0
  76. package/dist/profile/index.d.ts +2265 -0
  77. package/dist/profile/index.js +3 -0
  78. package/dist/provider/index.css +61 -0
  79. package/dist/provider/index.d.ts +291 -0
  80. package/dist/provider/index.js +7 -0
  81. package/dist/provider/published.d.ts +198 -0
  82. package/dist/provider/published.js +6 -0
  83. package/dist/router/context.d.ts +19 -0
  84. package/dist/router/context.js +1 -0
  85. package/dist/router/index.d.ts +31 -0
  86. package/dist/router/index.js +2 -0
  87. package/dist/sse/index.d.ts +83 -0
  88. package/dist/sse/index.js +185 -0
  89. package/dist/supabase/index.d.ts +4289 -0
  90. package/dist/supabase/index.js +47 -0
  91. package/dist/typeform/index.d.ts +458 -0
  92. package/dist/typeform/index.js +1976 -0
  93. package/dist/typeform/schemas.d.ts +67 -0
  94. package/dist/typeform/schemas.js +1 -0
  95. package/dist/utils/index.d.ts +177 -0
  96. package/dist/utils/index.js +1 -0
  97. package/package.json +88 -0
@@ -0,0 +1,748 @@
1
+ import { StyledMarkdown } from './chunk-3KMDHCAR.js';
2
+ import { ResourceStatusColors } from './chunk-YZ6GTZXL.js';
3
+ import { getErrorInfo, getErrorTitle, getResourceIcon } from './chunk-7AI5ZYJ4.js';
4
+ import { useAuthContext } from './chunk-7PLEQFHO.js';
5
+ import { useRouterContext } from './chunk-Q7DJKLEN.js';
6
+ import { Alert, Text, Code, Group, Badge, Collapse, ScrollArea, Center, Stack, Title, Button, UnstyledButton, Box, ThemeIcon, Card, Skeleton, Paper, Loader, Select, Grid, Space } from '@mantine/core';
7
+ import { IconAlertCircle, IconChevronUp, IconChevronDown, IconChevronRight, IconInfoCircle, IconClock, IconMinus, IconTrendingUp, IconTrendingDown } from '@tabler/icons-react';
8
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
+ import { useState } from 'react';
10
+ import { Prism } from 'react-syntax-highlighter';
11
+ import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
12
+
13
+ function APIErrorAlert({
14
+ error,
15
+ title,
16
+ showRequestId = true,
17
+ icon = /* @__PURE__ */ jsx(IconAlertCircle, {}),
18
+ color = "red"
19
+ }) {
20
+ const { message, code, requestId, retryAfter } = getErrorInfo(error);
21
+ const alertTitle = title || getErrorTitle(code);
22
+ return /* @__PURE__ */ jsxs(
23
+ Alert,
24
+ {
25
+ icon,
26
+ title: alertTitle,
27
+ color,
28
+ variant: "light",
29
+ children: [
30
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: message }),
31
+ retryAfter && /* @__PURE__ */ jsxs(Text, { size: "sm", mt: "xs", children: [
32
+ "Please wait ",
33
+ retryAfter,
34
+ " seconds before retrying."
35
+ ] }),
36
+ showRequestId && requestId && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", mt: "xs", children: [
37
+ "Request ID: ",
38
+ /* @__PURE__ */ jsx(Code, { children: requestId })
39
+ ] })
40
+ ]
41
+ }
42
+ );
43
+ }
44
+ function CollapsibleSection({
45
+ title,
46
+ count,
47
+ countLabel,
48
+ children,
49
+ emptyMessage,
50
+ defaultExpanded = true,
51
+ maxHeight = 300
52
+ }) {
53
+ const [expanded, setExpanded] = useState(defaultExpanded);
54
+ const isEmpty = count === 0;
55
+ return /* @__PURE__ */ jsxs(
56
+ "div",
57
+ {
58
+ style: {
59
+ borderRadius: "8px",
60
+ padding: "8px",
61
+ border: "1px solid var(--color-border)",
62
+ boxShadow: "var(--standard-box-shadow)"
63
+ },
64
+ children: [
65
+ /* @__PURE__ */ jsxs(
66
+ Group,
67
+ {
68
+ gap: "xs",
69
+ mb: expanded ? "xs" : 0,
70
+ justify: "space-between",
71
+ align: "center",
72
+ style: { cursor: "pointer" },
73
+ onClick: () => setExpanded(!expanded),
74
+ children: [
75
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", style: { flex: 1 }, children: [
76
+ typeof title === "string" ? /* @__PURE__ */ jsx(
77
+ Text,
78
+ {
79
+ fw: 600,
80
+ size: "sm",
81
+ c: "var(--color-text)",
82
+ style: { fontFamily: "var(--elevasis-font-family-subtitle)" },
83
+ children: title
84
+ }
85
+ ) : title,
86
+ count !== void 0 && countLabel && /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", color: "gray", children: [
87
+ count,
88
+ " ",
89
+ count === 1 ? countLabel.replace(/s$/, "") : countLabel
90
+ ] })
91
+ ] }),
92
+ expanded ? /* @__PURE__ */ jsx(IconChevronUp, { size: 16 }) : /* @__PURE__ */ jsx(IconChevronDown, { size: 16 })
93
+ ]
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsx(Collapse, { in: expanded, children: isEmpty && emptyMessage ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: emptyMessage }) : /* @__PURE__ */ jsx(ScrollArea, { h: maxHeight, type: "scroll", offsetScrollbars: true, children }) })
97
+ ]
98
+ }
99
+ );
100
+ }
101
+ function EmptyState({ icon: Icon, title, description, action, py = "xl" }) {
102
+ return /* @__PURE__ */ jsx(Center, { py, children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
103
+ /* @__PURE__ */ jsx(Icon, { size: 48, style: { opacity: 0.5 } }),
104
+ /* @__PURE__ */ jsx(Title, { order: 3, children: title }),
105
+ description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", children: description }),
106
+ action && /* @__PURE__ */ jsx(Button, { variant: "light", onClick: action.onClick, leftSection: action.icon, mt: "sm", children: action.label })
107
+ ] }) });
108
+ }
109
+ var NavigationButton = ({
110
+ icon: Icon,
111
+ label,
112
+ isCollapsed = false,
113
+ hasSubItems = false,
114
+ isExpanded = false,
115
+ isActive = false,
116
+ hasActiveBackground = false,
117
+ onClick,
118
+ style,
119
+ transitionDuration = 200
120
+ }) => {
121
+ const activeColor = "var(--color-primary)";
122
+ const textColor = isActive ? activeColor : "var(--color-text)";
123
+ const bgColor = hasActiveBackground ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent";
124
+ return /* @__PURE__ */ jsx(
125
+ UnstyledButton,
126
+ {
127
+ onClick: (event) => {
128
+ event.preventDefault();
129
+ event.stopPropagation();
130
+ onClick?.();
131
+ },
132
+ style: {
133
+ height: 46,
134
+ display: "flex",
135
+ alignItems: "center",
136
+ width: "100%",
137
+ padding: "var(--mantine-spacing-xs)",
138
+ color: textColor,
139
+ backgroundColor: bgColor,
140
+ transition: `all var(--duration-fast) var(--easing)`,
141
+ cursor: "pointer",
142
+ overflow: "hidden",
143
+ borderRadius: "var(--mantine-radius-default)",
144
+ ...style
145
+ },
146
+ onMouseEnter: (e) => {
147
+ if (!hasActiveBackground) {
148
+ e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
149
+ }
150
+ },
151
+ onMouseLeave: (e) => {
152
+ if (!hasActiveBackground) {
153
+ e.currentTarget.style.backgroundColor = "transparent";
154
+ }
155
+ },
156
+ children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", gap: 0, style: { width: "100%", overflow: "hidden" }, children: [
157
+ /* @__PURE__ */ jsxs(
158
+ Box,
159
+ {
160
+ style: {
161
+ display: "flex",
162
+ alignItems: "center",
163
+ justifyContent: "flex-start",
164
+ flex: hasSubItems && !isCollapsed ? 1 : "initial",
165
+ minWidth: 0,
166
+ overflow: "hidden"
167
+ },
168
+ children: [
169
+ /* @__PURE__ */ jsx(
170
+ ThemeIcon,
171
+ {
172
+ variant: "light",
173
+ size: 30,
174
+ style: {
175
+ backgroundColor: isActive ? activeColor : "var(--color-surface)",
176
+ color: isActive ? "white" : activeColor,
177
+ marginRight: isCollapsed ? 0 : "var(--mantine-spacing-sm)",
178
+ transition: `margin ${transitionDuration}ms var(--easing)`,
179
+ flexShrink: 0
180
+ },
181
+ children: /* @__PURE__ */ jsx(Icon, { size: 18, stroke: 1.5 })
182
+ }
183
+ ),
184
+ !isCollapsed && /* @__PURE__ */ jsx(
185
+ Box,
186
+ {
187
+ style: {
188
+ fontFamily: "var(--elevasis-font-family-subtitle)",
189
+ fontSize: "var(--mantine-font-size-md)",
190
+ fontWeight: isActive ? 600 : 500,
191
+ color: textColor,
192
+ transition: `opacity ${transitionDuration}ms var(--easing)`,
193
+ whiteSpace: "nowrap",
194
+ overflow: "hidden",
195
+ textOverflow: "ellipsis"
196
+ },
197
+ children: label
198
+ }
199
+ )
200
+ ]
201
+ }
202
+ ),
203
+ hasSubItems && !isCollapsed && /* @__PURE__ */ jsx(
204
+ IconChevronRight,
205
+ {
206
+ size: 14,
207
+ stroke: 1.5,
208
+ style: {
209
+ transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)",
210
+ transition: `transform var(--duration-fast) var(--easing)`,
211
+ color: "var(--color-text-subtle)",
212
+ flexShrink: 0,
213
+ marginLeft: "auto"
214
+ }
215
+ }
216
+ )
217
+ ] })
218
+ }
219
+ );
220
+ };
221
+ function PageNotFound() {
222
+ const { currentPath, navigate } = useRouterContext();
223
+ const { user, isLoading } = useAuthContext();
224
+ const isAuthPage = currentPath === "/login" || currentPath === "/auth-redirect";
225
+ const shouldShowSidebar = user && !isLoading && !isAuthPage;
226
+ const height = shouldShowSidebar ? "100%" : "100vh";
227
+ return /* @__PURE__ */ jsx(Center, { h: height, bg: "var(--color-background)", children: /* @__PURE__ */ jsxs(Stack, { align: "center", justify: "center", children: [
228
+ /* @__PURE__ */ jsx(IconInfoCircle, { size: 60, color: "var(--color-text-subtle)" }),
229
+ /* @__PURE__ */ jsx(Title, { order: 1, children: "Page Not Found" }),
230
+ /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "lg", children: "The page you are looking for does not exist." }),
231
+ /* @__PURE__ */ jsx(Group, { justify: "center", children: /* @__PURE__ */ jsx(Button, { size: "md", onClick: () => navigate("/"), children: "Go Home" }) })
232
+ ] }) });
233
+ }
234
+ var PageTitleCaption = ({ title, caption, rightSection }) => {
235
+ const renderCaption = () => {
236
+ if (!caption) return null;
237
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Text, { c: "dimmed", style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: caption }) });
238
+ };
239
+ const titleContent = /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
240
+ /* @__PURE__ */ jsx(Title, { order: 1, children: title }),
241
+ /* @__PURE__ */ jsx(Space, { h: "4" }),
242
+ renderCaption()
243
+ ] });
244
+ if (!rightSection) {
245
+ return titleContent;
246
+ }
247
+ return /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "end", children: [
248
+ titleContent,
249
+ rightSection
250
+ ] });
251
+ };
252
+ function StatsCardSkeleton({ chartHeight = 120, withChart = true, statCount = 3 }) {
253
+ return /* @__PURE__ */ jsxs(Card, { withBorder: true, children: [
254
+ /* @__PURE__ */ jsx(Skeleton, { height: 24, width: 150, mb: "md" }),
255
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", mb: "xl", children: [
256
+ /* @__PURE__ */ jsx(Skeleton, { height: 60, width: 100 }),
257
+ statCount >= 2 && /* @__PURE__ */ jsx(Skeleton, { height: 60, width: 100 }),
258
+ /* @__PURE__ */ jsx(Skeleton, { height: 40, circle: true })
259
+ ] }),
260
+ withChart && /* @__PURE__ */ jsx(Skeleton, { height: chartHeight })
261
+ ] });
262
+ }
263
+ function ListSkeleton({ rows = 3, rowHeight = 50 }) {
264
+ return /* @__PURE__ */ jsx(Stack, { gap: "xs", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsx(Skeleton, { height: rowHeight }, i)) });
265
+ }
266
+ function DetailCardSkeleton({ rows = 3 }) {
267
+ return /* @__PURE__ */ jsxs(Card, { withBorder: true, children: [
268
+ /* @__PURE__ */ jsx(Skeleton, { height: 24, width: 150, mb: "md" }),
269
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", mb: "lg", children: [
270
+ /* @__PURE__ */ jsx(Skeleton, { height: 80, width: 100 }),
271
+ /* @__PURE__ */ jsx(Skeleton, { height: 80, width: 100 }),
272
+ /* @__PURE__ */ jsx(Skeleton, { height: 40, circle: true })
273
+ ] }),
274
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsx(Skeleton, { height: 60 }, i)) })
275
+ ] });
276
+ }
277
+
278
+ // src/components/display/StatCard.module.css
279
+ var StatCard_default = {};
280
+ function StatCard(props) {
281
+ if (props.variant === "hero") {
282
+ return /* @__PURE__ */ jsx(HeroStatCard, { ...props });
283
+ }
284
+ const { label, value, icon: IconComponent, color } = props;
285
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
286
+ /* @__PURE__ */ jsx(ThemeIcon, { size: "lg", variant: "light", color, children: /* @__PURE__ */ jsx(IconComponent, { size: 18 }) }),
287
+ /* @__PURE__ */ jsxs("div", { children: [
288
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: label }),
289
+ /* @__PURE__ */ jsx(Text, { size: "lg", fw: 600, style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: value })
290
+ ] })
291
+ ] }) });
292
+ }
293
+ function HeroStatCard({
294
+ icon: IconComponent,
295
+ value,
296
+ label,
297
+ valueColor,
298
+ isLoading,
299
+ size = "sm",
300
+ children
301
+ }) {
302
+ const sm = size === "sm";
303
+ const iconSize = sm ? 36 : 46;
304
+ if (isLoading) {
305
+ return /* @__PURE__ */ jsx(Paper, { p: sm ? "md" : "lg", className: StatCard_default.heroCard, children: /* @__PURE__ */ jsxs(Group, { gap: sm ? "sm" : "md", wrap: "nowrap", children: [
306
+ /* @__PURE__ */ jsx(Skeleton, { circle: true, height: iconSize }),
307
+ /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
308
+ /* @__PURE__ */ jsx(Skeleton, { height: sm ? 24 : 32, width: 60 }),
309
+ /* @__PURE__ */ jsx(Skeleton, { height: 12, width: 80 })
310
+ ] })
311
+ ] }) });
312
+ }
313
+ return /* @__PURE__ */ jsx(Paper, { p: sm ? "md" : "lg", className: StatCard_default.heroCard, children: /* @__PURE__ */ jsxs(Group, { gap: sm ? "sm" : "md", wrap: "nowrap", children: [
314
+ /* @__PURE__ */ jsx("div", { className: sm ? StatCard_default.iconRingSm : StatCard_default.iconRing, children: /* @__PURE__ */ jsx(IconComponent, { size: sm ? 18 : 22 }) }),
315
+ /* @__PURE__ */ jsxs(Stack, { gap: 2, style: { flex: children ? 1 : void 0 }, children: [
316
+ /* @__PURE__ */ jsx(
317
+ "span",
318
+ {
319
+ className: sm ? StatCard_default.heroValueSm : StatCard_default.heroValue,
320
+ style: valueColor ? { color: valueColor } : void 0,
321
+ children: value
322
+ }
323
+ ),
324
+ children ? /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", style: { flex: 1 }, children: [
325
+ /* @__PURE__ */ jsx("span", { className: sm ? StatCard_default.heroLabelSm : StatCard_default.heroLabel, children: label }),
326
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children })
327
+ ] }) : /* @__PURE__ */ jsx("span", { className: sm ? StatCard_default.heroLabelSm : StatCard_default.heroLabel, children: label })
328
+ ] })
329
+ ] }) });
330
+ }
331
+ function StatCardSkeleton() {
332
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Skeleton, { height: 60 }) });
333
+ }
334
+ function TabCountBadge({ count, isLoading }) {
335
+ return /* @__PURE__ */ jsx(Box, { miw: 20, h: 20, style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: isLoading ? /* @__PURE__ */ jsx(Loader, { size: 12 }) : /* @__PURE__ */ jsx(Badge, { size: "sm", variant: "light", circle: count < 10, children: count }) });
336
+ }
337
+ function CustomSelector({
338
+ value,
339
+ onChange,
340
+ data,
341
+ leftSection,
342
+ placeholder,
343
+ w,
344
+ withCheckIcon = false,
345
+ disabled
346
+ }) {
347
+ return /* @__PURE__ */ jsx(
348
+ Select,
349
+ {
350
+ value,
351
+ onChange,
352
+ data,
353
+ leftSection,
354
+ placeholder,
355
+ w,
356
+ size: "xs",
357
+ variant: "unstyled",
358
+ withCheckIcon,
359
+ disabled,
360
+ styles: {
361
+ wrapper: {
362
+ border: "1px solid var(--color-border)",
363
+ borderRadius: "var(--mantine-radius-default)",
364
+ backgroundColor: "var(--color-surface)",
365
+ transition: "border-color 150ms ease, background-color 150ms ease",
366
+ "&:hover": {
367
+ borderColor: "var(--color-border-hover, var(--mantine-color-dark-3))"
368
+ }
369
+ },
370
+ input: {
371
+ fontSize: "var(--mantine-font-size-xs)",
372
+ fontWeight: 500,
373
+ height: "30px",
374
+ minHeight: "30px",
375
+ paddingLeft: leftSection ? "30px" : void 0,
376
+ borderRadius: "var(--mantine-radius-default)",
377
+ cursor: "pointer"
378
+ },
379
+ section: {
380
+ color: "var(--color-text-subtle)"
381
+ },
382
+ dropdown: {
383
+ border: "1px solid var(--color-border)",
384
+ backgroundColor: "var(--color-surface)",
385
+ boxShadow: "var(--card-shadow)"
386
+ },
387
+ option: {
388
+ fontSize: "var(--mantine-font-size-xs)"
389
+ }
390
+ }
391
+ }
392
+ );
393
+ }
394
+ var TIME_RANGE_OPTIONS = [
395
+ { value: "1h", label: "Last 1 hour" },
396
+ { value: "24h", label: "Last 24 hours" },
397
+ { value: "7d", label: "Last 7 days" },
398
+ { value: "30d", label: "Last 30 days" }
399
+ ];
400
+ function TimeRangeSelector({ value, onChange, width = 180 }) {
401
+ return /* @__PURE__ */ jsx(
402
+ CustomSelector,
403
+ {
404
+ value,
405
+ onChange: (newValue) => newValue && onChange(newValue),
406
+ data: TIME_RANGE_OPTIONS,
407
+ leftSection: /* @__PURE__ */ jsx(IconClock, { size: 16, color: "var(--color-text-subtle)" }),
408
+ w: width,
409
+ withCheckIcon: true
410
+ }
411
+ );
412
+ }
413
+ function TrendIndicator({ current, previous, inverse }) {
414
+ const change = previous === 0 ? 0 : (current - previous) / previous * 100;
415
+ const isPositive = inverse ? change < 0 : change > 0;
416
+ const isFlat = Math.abs(change) < 0.1;
417
+ const color = isFlat ? "gray" : isPositive ? "green" : "red";
418
+ const Icon = isFlat ? IconMinus : change > 0 ? IconTrendingUp : IconTrendingDown;
419
+ return /* @__PURE__ */ jsxs(Group, { gap: 4, children: [
420
+ /* @__PURE__ */ jsx(Icon, { size: 12 }),
421
+ /* @__PURE__ */ jsx(Badge, { size: "sm", color, variant: "light", children: isFlat ? "No change" : `${isPositive ? "+" : ""}${Math.abs(change).toFixed(1)}%` })
422
+ ] });
423
+ }
424
+ var subtleMarkdownComponents = {
425
+ p: ({ children }) => /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, c: "var(--color-text-subtle)", style: { whiteSpace: "pre-wrap" }, children })
426
+ };
427
+ var subtleMarkdownWrapperStyle = {
428
+ display: "flex",
429
+ flexDirection: "column",
430
+ gap: 8
431
+ };
432
+ function ContextViewer({ data }) {
433
+ return /* @__PURE__ */ jsx(ContextNode, { data, depth: 0 });
434
+ }
435
+ function ContextNode({ data, depth }) {
436
+ if (data === null || data === void 0) {
437
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "No context provided" });
438
+ }
439
+ if (typeof data === "string") {
440
+ return /* @__PURE__ */ jsx(StyledMarkdown, { components: subtleMarkdownComponents, style: subtleMarkdownWrapperStyle, children: data });
441
+ }
442
+ if (typeof data === "number" || typeof data === "boolean") {
443
+ return /* @__PURE__ */ jsx(Text, { size: "sm", children: String(data) });
444
+ }
445
+ if (Array.isArray(data)) {
446
+ return /* @__PURE__ */ jsx(ArrayView, { items: data, depth });
447
+ }
448
+ if (typeof data === "object") {
449
+ return /* @__PURE__ */ jsx(ObjectView, { data, depth });
450
+ }
451
+ return /* @__PURE__ */ jsx(Text, { size: "sm", children: String(data) });
452
+ }
453
+ function formatLabel(key) {
454
+ return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
455
+ }
456
+ function hasMarkdown(value) {
457
+ return /(\*\*.+\*\*|^#{1,6}\s|^\s*[-*]\s|\[.+\]\(.+\)|^\|.+\|$|^>\s|```)/.test(value);
458
+ }
459
+ function NestedSection({ title, children }) {
460
+ const [expanded, setExpanded] = useState(true);
461
+ return /* @__PURE__ */ jsxs(Stack, { gap: 6, children: [
462
+ /* @__PURE__ */ jsxs(Group, { gap: 4, style: { cursor: "pointer", userSelect: "none" }, onClick: () => setExpanded((v) => !v), children: [
463
+ /* @__PURE__ */ jsx(
464
+ IconChevronRight,
465
+ {
466
+ size: 14,
467
+ color: "var(--color-primary)",
468
+ style: {
469
+ transition: "transform 150ms ease",
470
+ transform: expanded ? "rotate(90deg)" : "rotate(0deg)",
471
+ flexShrink: 0
472
+ }
473
+ }
474
+ ),
475
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: title })
476
+ ] }),
477
+ expanded && /* @__PURE__ */ jsx(Box, { pl: "sm", style: { borderLeft: "2px solid var(--color-border)" }, children })
478
+ ] });
479
+ }
480
+ function PrimitiveValue({ value }) {
481
+ if (value === null || value === void 0) {
482
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "\u2014" });
483
+ }
484
+ if (typeof value === "boolean") {
485
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children: value ? "Yes" : "No" });
486
+ }
487
+ if (typeof value === "number") {
488
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children: value.toLocaleString() });
489
+ }
490
+ const str = String(value);
491
+ if (hasMarkdown(str)) {
492
+ return /* @__PURE__ */ jsx(StyledMarkdown, { components: subtleMarkdownComponents, children: str });
493
+ }
494
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, c: "var(--color-text-subtle)", style: { whiteSpace: "pre-wrap" }, children: str });
495
+ }
496
+ function ArrayView({ items, depth }) {
497
+ if (items.length === 0) {
498
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Empty list" });
499
+ }
500
+ const allPrimitive = items.every((item) => typeof item !== "object" || item === null);
501
+ if (allPrimitive) {
502
+ return /* @__PURE__ */ jsx(Stack, { gap: 2, children: items.map((item, i) => /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "flex-start", children: [
503
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { userSelect: "none" }, children: "\u2022" }),
504
+ /* @__PURE__ */ jsx(PrimitiveValue, { value: item })
505
+ ] }, i)) });
506
+ }
507
+ return /* @__PURE__ */ jsx(Stack, { gap: "sm", children: items.map((item, i) => /* @__PURE__ */ jsx(Paper, { p: "sm", style: { border: "1px solid var(--color-border)" }, children: /* @__PURE__ */ jsx(ContextNode, { data: item, depth: depth + 1 }) }, i)) });
508
+ }
509
+ function ObjectView({ data, depth }) {
510
+ const entries = Object.entries(data);
511
+ if (entries.length === 0) {
512
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Empty" });
513
+ }
514
+ const simpleEntries = [];
515
+ const complexEntries = [];
516
+ for (const [key, value] of entries) {
517
+ if (value === null || value === void 0 || typeof value === "boolean" || typeof value === "number") {
518
+ simpleEntries.push([key, value]);
519
+ } else if (typeof value === "string") {
520
+ if (hasMarkdown(value) || value.length > 120) {
521
+ complexEntries.push([key, value]);
522
+ } else {
523
+ simpleEntries.push([key, value]);
524
+ }
525
+ } else {
526
+ complexEntries.push([key, value]);
527
+ }
528
+ }
529
+ return /* @__PURE__ */ jsxs(Stack, { gap: 10, children: [
530
+ simpleEntries.length > 0 && /* @__PURE__ */ jsx(Stack, { gap: 6, children: simpleEntries.map(([key, value]) => /* @__PURE__ */ jsxs(Group, { gap: "sm", align: "flex-start", wrap: "nowrap", children: [
531
+ /* @__PURE__ */ jsx(
532
+ Text,
533
+ {
534
+ size: "sm",
535
+ style: { minWidth: 140, flexShrink: 0, fontFamily: "var(--mantine-font-family-headings)" },
536
+ children: formatLabel(key)
537
+ }
538
+ ),
539
+ /* @__PURE__ */ jsx(PrimitiveValue, { value })
540
+ ] }, key)) }),
541
+ complexEntries.map(([key, value]) => /* @__PURE__ */ jsx(NestedSection, { title: formatLabel(key), children: /* @__PURE__ */ jsx(ContextNode, { data: value, depth: depth + 1 }) }, key))
542
+ ] });
543
+ }
544
+ var jsonTheme = Object.fromEntries(
545
+ Object.entries(oneDark).map(([key, value]) => [
546
+ key,
547
+ typeof value === "object" && value !== null ? { ...value, background: "none", backgroundColor: "none" } : value
548
+ ])
549
+ );
550
+ function JsonViewer({ data, maxHeight, fontSize = "0.8rem" }) {
551
+ const jsonString = typeof data === "string" ? data : JSON.stringify(data, null, 2);
552
+ return /* @__PURE__ */ jsx(
553
+ Prism,
554
+ {
555
+ language: "json",
556
+ style: jsonTheme,
557
+ customStyle: {
558
+ margin: 0,
559
+ fontSize,
560
+ maxHeight,
561
+ overflow: maxHeight ? "auto" : void 0,
562
+ overflowX: "auto"
563
+ },
564
+ children: jsonString
565
+ }
566
+ );
567
+ }
568
+ function ResourceCard({
569
+ resource,
570
+ onClick,
571
+ layout = "stack",
572
+ rightSection,
573
+ topSection,
574
+ lastRunLabel,
575
+ style,
576
+ ...rest
577
+ }) {
578
+ const Icon = getResourceIcon(resource.type);
579
+ if (!Icon) {
580
+ return /* @__PURE__ */ jsx(Card, { shadow: "sm", withBorder: true, children: /* @__PURE__ */ jsxs(Text, { children: [
581
+ "Invalid resource type: ",
582
+ resource.type
583
+ ] }) });
584
+ }
585
+ const cardStyle = {
586
+ cursor: "pointer",
587
+ ...layout === "grid" || layout === "card" ? { transition: "box-shadow var(--duration-fast) var(--easing)" } : {},
588
+ ...style
589
+ };
590
+ const iconSize = layout === "grid" ? 28 : 20;
591
+ const details = /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", children: [
592
+ /* @__PURE__ */ jsx(Icon, { size: iconSize, color: "var(--color-primary)" }),
593
+ /* @__PURE__ */ jsxs(Stack, { gap: 4, style: { flex: 1, minWidth: 0 }, children: [
594
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", children: [
595
+ /* @__PURE__ */ jsx(
596
+ Text,
597
+ {
598
+ fw: 600,
599
+ size: "sm",
600
+ style: { fontFamily: "var(--elevasis-font-family-subtitle)" },
601
+ ...layout === "stack" ? { lineClamp: 1 } : { truncate: true },
602
+ children: resource.name
603
+ }
604
+ ),
605
+ /* @__PURE__ */ jsx(Badge, { variant: "light", size: layout === "grid" ? "xs" : "sm", children: resource.type })
606
+ ] }),
607
+ resource.description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ...layout === "stack" ? { lineClamp: 1 } : { truncate: true }, children: resource.description }),
608
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
609
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "outline", size: "xs", children: [
610
+ "v",
611
+ resource.version
612
+ ] }),
613
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "outline", size: layout === "grid" ? "xs" : "sm", children: resource.status.toUpperCase() })
614
+ ] }),
615
+ lastRunLabel && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: lastRunLabel }),
616
+ /* @__PURE__ */ jsx(Text, { size: layout === "grid" ? "sm" : "xs", c: "dimmed", ff: "monospace", children: resource.resourceId })
617
+ ] })
618
+ ] });
619
+ if (layout === "card") {
620
+ return /* @__PURE__ */ jsx(
621
+ Card,
622
+ {
623
+ withBorder: true,
624
+ padding: 0,
625
+ style: cardStyle,
626
+ onClick: () => onClick(resource),
627
+ "data-resource-id": rest["data-resource-id"],
628
+ children: /* @__PURE__ */ jsxs(Stack, { gap: 8, p: "sm", pb: "xs", children: [
629
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", justify: "space-between", children: [
630
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", style: { minWidth: 0 }, children: [
631
+ /* @__PURE__ */ jsx(Icon, { size: 20, color: "var(--color-primary)", style: { flexShrink: 0 } }),
632
+ /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, truncate: true, children: resource.name })
633
+ ] }),
634
+ /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", style: { flexShrink: 0 }, children: [
635
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "sm", children: [
636
+ "v",
637
+ resource.version
638
+ ] }),
639
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "light", size: "sm", children: resource.status.toUpperCase() })
640
+ ] })
641
+ ] }),
642
+ resource.description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", truncate: true, children: resource.description }),
643
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", justify: "space-between", wrap: "nowrap", children: [
644
+ rightSection || /* @__PURE__ */ jsx("span", {}),
645
+ lastRunLabel && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap" }, children: lastRunLabel })
646
+ ] }),
647
+ topSection
648
+ ] })
649
+ }
650
+ );
651
+ }
652
+ if (layout === "row") {
653
+ const [hovered, setHovered] = useState(false);
654
+ return /* @__PURE__ */ jsx(
655
+ Card,
656
+ {
657
+ padding: 0,
658
+ style: {
659
+ cursor: "pointer",
660
+ border: "1px solid var(--color-border)",
661
+ transition: "background 150ms ease",
662
+ background: hovered ? "var(--active-background)" : "var(--glass-background)",
663
+ ...style
664
+ },
665
+ onClick: () => onClick(resource),
666
+ onMouseEnter: () => setHovered(true),
667
+ onMouseLeave: () => setHovered(false),
668
+ "data-resource-id": rest["data-resource-id"],
669
+ children: /* @__PURE__ */ jsxs(
670
+ "div",
671
+ {
672
+ style: {
673
+ display: "grid",
674
+ gridTemplateColumns: "18px 200px 120px 1fr 180px 140px 14px",
675
+ alignItems: "center",
676
+ gap: "var(--mantine-spacing-sm)"
677
+ },
678
+ children: [
679
+ /* @__PURE__ */ jsx(Icon, { size: 18, color: "var(--color-primary)" }),
680
+ /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", truncate: true, style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: resource.name }),
681
+ /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", children: [
682
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "sm", children: [
683
+ "v",
684
+ resource.version
685
+ ] }),
686
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "light", size: "sm", children: resource.status.toUpperCase() })
687
+ ] }),
688
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", truncate: true, style: { minWidth: 0 }, children: resource.description || "" }),
689
+ /* @__PURE__ */ jsx("div", { style: { whiteSpace: "nowrap" }, children: rightSection }),
690
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap", textAlign: "right" }, children: lastRunLabel || "" }),
691
+ /* @__PURE__ */ jsx(
692
+ IconChevronRight,
693
+ {
694
+ size: 14,
695
+ style: {
696
+ opacity: hovered ? 0.7 : 0,
697
+ transition: "opacity 150ms ease"
698
+ }
699
+ }
700
+ )
701
+ ]
702
+ }
703
+ )
704
+ }
705
+ );
706
+ }
707
+ if (layout === "grid") {
708
+ return /* @__PURE__ */ jsx(
709
+ Card,
710
+ {
711
+ withBorder: true,
712
+ padding: "sm",
713
+ style: cardStyle,
714
+ onClick: () => onClick(resource),
715
+ "data-resource-id": rest["data-resource-id"],
716
+ children: /* @__PURE__ */ jsxs(Grid, { gutter: "sm", align: "center", children: [
717
+ /* @__PURE__ */ jsx(Grid.Col, { span: 8, children: details }),
718
+ rightSection && /* @__PURE__ */ jsx(Grid.Col, { span: 4, children: /* @__PURE__ */ jsx(Group, { justify: "flex-end", gap: "md", wrap: "nowrap", children: rightSection }) })
719
+ ] })
720
+ }
721
+ );
722
+ }
723
+ return /* @__PURE__ */ jsx(
724
+ Card,
725
+ {
726
+ shadow: "sm",
727
+ withBorder: true,
728
+ style: cardStyle,
729
+ onClick: () => onClick(resource),
730
+ "data-resource-id": rest["data-resource-id"],
731
+ children: /* @__PURE__ */ jsx(Stack, { children: details })
732
+ }
733
+ );
734
+ }
735
+
736
+ // src/components/display/ResourceCardAdapters.ts
737
+ function catalogItemToResourceDefinition(item) {
738
+ return {
739
+ resourceId: item.resourceId,
740
+ name: item.resourceName,
741
+ description: item.description || "",
742
+ version: item.version,
743
+ type: item.resourceType,
744
+ status: item.status
745
+ };
746
+ }
747
+
748
+ export { APIErrorAlert, CollapsibleSection, ContextViewer, CustomSelector, DetailCardSkeleton, EmptyState, JsonViewer, ListSkeleton, NavigationButton, PageNotFound, PageTitleCaption, ResourceCard, StatCard, StatCardSkeleton, StatsCardSkeleton, TabCountBadge, TimeRangeSelector, TrendIndicator, catalogItemToResourceDefinition };