@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.
- package/dist/api/index.d.ts +87 -0
- package/dist/api/index.js +3 -0
- package/dist/auth/context.d.ts +19 -0
- package/dist/auth/context.js +1 -0
- package/dist/auth/index.d.ts +85 -0
- package/dist/auth/index.js +3 -0
- package/dist/chunk-3KMDHCAR.js +52 -0
- package/dist/chunk-5UWFGBFM.js +129 -0
- package/dist/chunk-6BJOYF6E.js +8 -0
- package/dist/chunk-6M6OLGQY.js +36 -0
- package/dist/chunk-7AI5ZYJ4.js +202 -0
- package/dist/chunk-7PLEQFHO.js +18 -0
- package/dist/chunk-GDV44UWF.js +138 -0
- package/dist/chunk-GEFB5YIR.js +338 -0
- package/dist/chunk-HBRMWW6V.js +43 -0
- package/dist/chunk-HUWJXLLF.js +681 -0
- package/dist/chunk-J3FALDQE.js +176 -0
- package/dist/chunk-JKERRYVS.js +109 -0
- package/dist/chunk-KA7LO7U5.js +28 -0
- package/dist/chunk-LHQTTUL2.js +27 -0
- package/dist/chunk-MAAS6CGR.js +1299 -0
- package/dist/chunk-NE36BUGQ.js +146 -0
- package/dist/chunk-NGXCFBCS.js +398 -0
- package/dist/chunk-OEYU5O27.js +235 -0
- package/dist/chunk-OUHGHTE7.js +748 -0
- package/dist/chunk-OXVOHOP3.js +661 -0
- package/dist/chunk-PSLKGOBZ.js +58 -0
- package/dist/chunk-PYL4XW6H.js +107 -0
- package/dist/chunk-Q47SPRY7.js +1 -0
- package/dist/chunk-Q7DJKLEN.js +18 -0
- package/dist/chunk-RJCA5672.js +1664 -0
- package/dist/chunk-S66I2PYB.js +748 -0
- package/dist/chunk-W7ZBF5AA.js +1 -0
- package/dist/chunk-WNWKOCGJ.js +1067 -0
- package/dist/chunk-XCYKC6OZ.js +1 -0
- package/dist/chunk-YULUKCS6.js +56 -0
- package/dist/chunk-YZ6GTZXL.js +48 -0
- package/dist/chunk-ZGHDPDTF.js +379 -0
- package/dist/components/command-queue/index.css +53 -0
- package/dist/components/command-queue/index.d.ts +204 -0
- package/dist/components/command-queue/index.js +10 -0
- package/dist/components/forms/index.d.ts +56 -0
- package/dist/components/forms/index.js +2 -0
- package/dist/components/index.css +443 -0
- package/dist/components/index.d.ts +1354 -0
- package/dist/components/index.js +18 -0
- package/dist/components/monitoring/index.d.ts +66 -0
- package/dist/components/monitoring/index.js +2 -0
- package/dist/components/navigation/index.d.ts +54 -0
- package/dist/components/navigation/index.js +91 -0
- package/dist/components/notifications/index.d.ts +52 -0
- package/dist/components/notifications/index.js +4 -0
- package/dist/components/resource-definition/index.css +388 -0
- package/dist/components/resource-definition/index.d.ts +301 -0
- package/dist/components/resource-definition/index.js +3 -0
- package/dist/display/index.css +53 -0
- package/dist/display/index.d.ts +606 -0
- package/dist/display/index.js +6 -0
- package/dist/execution/index.css +388 -0
- package/dist/execution/index.d.ts +1090 -0
- package/dist/execution/index.js +4 -0
- package/dist/graph/index.css +388 -0
- package/dist/graph/index.d.ts +429 -0
- package/dist/graph/index.js +1 -0
- package/dist/hooks/index.d.ts +1927 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/published.d.ts +1653 -0
- package/dist/hooks/published.js +4 -0
- package/dist/index.css +505 -0
- package/dist/index.d.ts +7284 -0
- package/dist/index.js +31 -0
- package/dist/initialization/index.d.ts +2325 -0
- package/dist/initialization/index.js +4 -0
- package/dist/organization/index.d.ts +225 -0
- package/dist/organization/index.js +4 -0
- package/dist/profile/index.d.ts +2265 -0
- package/dist/profile/index.js +3 -0
- package/dist/provider/index.css +61 -0
- package/dist/provider/index.d.ts +291 -0
- package/dist/provider/index.js +7 -0
- package/dist/provider/published.d.ts +198 -0
- package/dist/provider/published.js +6 -0
- package/dist/router/context.d.ts +19 -0
- package/dist/router/context.js +1 -0
- package/dist/router/index.d.ts +31 -0
- package/dist/router/index.js +2 -0
- package/dist/sse/index.d.ts +83 -0
- package/dist/sse/index.js +185 -0
- package/dist/supabase/index.d.ts +4289 -0
- package/dist/supabase/index.js +47 -0
- package/dist/typeform/index.d.ts +458 -0
- package/dist/typeform/index.js +1976 -0
- package/dist/typeform/schemas.d.ts +67 -0
- package/dist/typeform/schemas.js +1 -0
- package/dist/utils/index.d.ts +177 -0
- package/dist/utils/index.js +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { formatDuration } from './chunk-6BJOYF6E.js';
|
|
2
|
+
import { Table, Text, Badge, Tooltip, Box, Center, Loader, Stack } from '@mantine/core';
|
|
3
|
+
import { IconFileOff, IconCircle, IconAlertTriangle, IconCircleX, IconCircleCheck } from '@tabler/icons-react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { AreaChart } from '@mantine/charts';
|
|
6
|
+
|
|
7
|
+
function formatStartTime(timestamp) {
|
|
8
|
+
return new Date(timestamp).toLocaleString("en-US", {
|
|
9
|
+
month: "short",
|
|
10
|
+
day: "numeric",
|
|
11
|
+
hour: "numeric",
|
|
12
|
+
minute: "2-digit"
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function getStatusConfig(status) {
|
|
16
|
+
switch (status) {
|
|
17
|
+
case "running":
|
|
18
|
+
return {
|
|
19
|
+
icon: /* @__PURE__ */ jsx(IconCircle, { size: 14, color: "var(--color-primary)" }),
|
|
20
|
+
label: "Running",
|
|
21
|
+
color: "blue"
|
|
22
|
+
};
|
|
23
|
+
case "completed":
|
|
24
|
+
return {
|
|
25
|
+
icon: /* @__PURE__ */ jsx(IconCircleCheck, { size: 14, color: "var(--color-success)" }),
|
|
26
|
+
label: "Completed",
|
|
27
|
+
color: "green"
|
|
28
|
+
};
|
|
29
|
+
case "failed":
|
|
30
|
+
return {
|
|
31
|
+
icon: /* @__PURE__ */ jsx(IconCircleX, { size: 14, color: "var(--color-error)" }),
|
|
32
|
+
label: "Failed",
|
|
33
|
+
color: "red"
|
|
34
|
+
};
|
|
35
|
+
case "warning":
|
|
36
|
+
return {
|
|
37
|
+
icon: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 14, color: "var(--color-warning)" }),
|
|
38
|
+
label: "Warning",
|
|
39
|
+
color: "yellow"
|
|
40
|
+
};
|
|
41
|
+
case "pending":
|
|
42
|
+
default:
|
|
43
|
+
return {
|
|
44
|
+
icon: /* @__PURE__ */ jsx(IconCircle, { size: 14, color: "var(--mantine-color-gray-6)" }),
|
|
45
|
+
label: "Pending",
|
|
46
|
+
color: "gray"
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function LoadingState() {
|
|
51
|
+
return /* @__PURE__ */ jsx(Center, { py: "xl", children: /* @__PURE__ */ jsx(Loader, { size: "md" }) });
|
|
52
|
+
}
|
|
53
|
+
function EmptyState() {
|
|
54
|
+
return /* @__PURE__ */ jsx(Center, { py: "xl", children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
|
|
55
|
+
/* @__PURE__ */ jsx(IconFileOff, { size: 48, color: "var(--color-text-subtle)" }),
|
|
56
|
+
/* @__PURE__ */ jsx(Text, { size: "lg", fw: 500, c: "dimmed", children: "No executions found" }),
|
|
57
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Executions will appear here when workflows or agents are run" })
|
|
58
|
+
] }) });
|
|
59
|
+
}
|
|
60
|
+
function ExecutionLogsTable({ executions, isLoading, onRowClick }) {
|
|
61
|
+
const handleRowClick = (execution) => {
|
|
62
|
+
onRowClick?.({
|
|
63
|
+
resourceType: execution.resourceType,
|
|
64
|
+
resourceId: execution.resourceId,
|
|
65
|
+
executionId: execution.id
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsxs(Table, { highlightOnHover: true, children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(Table.Th, { children: "Resource" }),
|
|
71
|
+
/* @__PURE__ */ jsx(Table.Th, { children: "Status" }),
|
|
72
|
+
/* @__PURE__ */ jsx(Table.Th, { children: "Started" }),
|
|
73
|
+
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Duration" }),
|
|
74
|
+
/* @__PURE__ */ jsx(Table.Th, { ta: "center", children: "Env" }),
|
|
75
|
+
/* @__PURE__ */ jsx(Table.Th, { ta: "center", children: "Version" })
|
|
76
|
+
] }) }),
|
|
77
|
+
/* @__PURE__ */ jsx(Table.Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: 6, children: /* @__PURE__ */ jsx(LoadingState, {}) }) }) : executions.length === 0 ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: 6, children: /* @__PURE__ */ jsx(EmptyState, {}) }) }) : executions.map((execution) => {
|
|
78
|
+
const statusConfig = getStatusConfig(execution.status);
|
|
79
|
+
return /* @__PURE__ */ jsxs(
|
|
80
|
+
Table.Tr,
|
|
81
|
+
{
|
|
82
|
+
style: { cursor: onRowClick ? "pointer" : void 0 },
|
|
83
|
+
onClick: () => handleRowClick(execution),
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 200 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", lineClamp: 1, title: execution.resourceName, children: execution.resourceName }) }),
|
|
86
|
+
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: statusConfig.color, variant: "light", size: "sm", leftSection: statusConfig.icon, children: statusConfig.label }) }),
|
|
87
|
+
/* @__PURE__ */ jsx(Table.Td, { style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Text, { size: "sm", children: formatStartTime(execution.startTime) }) }),
|
|
88
|
+
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: execution.status === "running" ? "dimmed" : void 0, children: formatDuration(execution.duration) }) }),
|
|
89
|
+
/* @__PURE__ */ jsx(Table.Td, { ta: "center", children: /* @__PURE__ */ jsx(Badge, { color: execution.resourceStatus === "prod" ? "green" : "gray", variant: "light", size: "sm", children: execution.resourceStatus.toUpperCase() }) }),
|
|
90
|
+
/* @__PURE__ */ jsx(Table.Td, { ta: "center", children: /* @__PURE__ */ jsx(
|
|
91
|
+
Tooltip,
|
|
92
|
+
{
|
|
93
|
+
label: `Resource: ${execution.resourceVersion ?? "-"}
|
|
94
|
+
API: ${execution.apiVersion ?? "-"}
|
|
95
|
+
SDK: ${execution.sdkVersion ?? "-"}`,
|
|
96
|
+
multiline: true,
|
|
97
|
+
position: "left",
|
|
98
|
+
children: /* @__PURE__ */ jsx(Text, { size: "sm", ff: "monospace", c: "dimmed", style: { cursor: "help" }, children: execution.resourceVersion ?? "-" })
|
|
99
|
+
}
|
|
100
|
+
) })
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
execution.id
|
|
104
|
+
);
|
|
105
|
+
}) })
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
function getHealthColor(successRate, hasExecutions = true) {
|
|
109
|
+
if (!hasExecutions) return "var(--mantine-color-gray-6)";
|
|
110
|
+
if (successRate >= 95) return "var(--color-success)";
|
|
111
|
+
if (successRate >= 80) return "var(--color-warning)";
|
|
112
|
+
return "var(--color-error)";
|
|
113
|
+
}
|
|
114
|
+
function ResourceHealthChart({
|
|
115
|
+
healthData,
|
|
116
|
+
hasExecutions = true,
|
|
117
|
+
width = 300,
|
|
118
|
+
height = 60
|
|
119
|
+
}) {
|
|
120
|
+
if (!healthData || healthData.trendData.length === 0) {
|
|
121
|
+
return /* @__PURE__ */ jsx(Box, { w: width, h: height, style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "No activity" }) });
|
|
122
|
+
}
|
|
123
|
+
const chartData = healthData.trendData.map((d) => ({
|
|
124
|
+
time: d.time,
|
|
125
|
+
rate: d.rate
|
|
126
|
+
}));
|
|
127
|
+
const chartColor = getHealthColor(healthData.summary.successRate, hasExecutions);
|
|
128
|
+
return /* @__PURE__ */ jsx(Box, { w: width, h: height, children: /* @__PURE__ */ jsx(
|
|
129
|
+
AreaChart,
|
|
130
|
+
{
|
|
131
|
+
h: height,
|
|
132
|
+
data: chartData,
|
|
133
|
+
dataKey: "time",
|
|
134
|
+
series: [{ name: "rate", color: chartColor }],
|
|
135
|
+
curveType: "monotone",
|
|
136
|
+
withDots: false,
|
|
137
|
+
withTooltip: false,
|
|
138
|
+
withXAxis: false,
|
|
139
|
+
withYAxis: false,
|
|
140
|
+
fillOpacity: 0.2,
|
|
141
|
+
gridAxis: "none"
|
|
142
|
+
}
|
|
143
|
+
) });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { ExecutionLogsTable, ResourceHealthChart, getHealthColor };
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { getPreset, generateShades, createCssVariablesResolver } from './chunk-MAAS6CGR.js';
|
|
2
|
+
import { ApiClientProvider, createUseApiClient } from './chunk-GDV44UWF.js';
|
|
3
|
+
import { ElevasisServiceProvider } from './chunk-KA7LO7U5.js';
|
|
4
|
+
import { WorkOSAuthBridge, OAuthProvider, OAuthAuthBridge } from './chunk-OEYU5O27.js';
|
|
5
|
+
import { useAuthContext } from './chunk-7PLEQFHO.js';
|
|
6
|
+
import { useMemo, useEffect, useRef } from 'react';
|
|
7
|
+
import { Tooltip, Text, Tabs, Table, Stack, SimpleGrid, Select, Combobox, SegmentedControl, ScrollArea, Paper, Popover, Notification, Modal, Menu, Input, HoverCard, Group, Grid, Flex, Code, Divider, Card, Button, Accordion, createTheme, mergeThemeOverrides, MantineProvider } from '@mantine/core';
|
|
8
|
+
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
|
|
9
|
+
import { AuthKitProvider } from '@workos-inc/authkit-react';
|
|
10
|
+
import '@mantine/core/styles.css';
|
|
11
|
+
import '@mantine/notifications/styles.css';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
var DEFAULT_SIZE = "sm";
|
|
15
|
+
var glassBase = {
|
|
16
|
+
backdropFilter: "var(--glass-blur)",
|
|
17
|
+
WebkitBackdropFilter: "var(--glass-blur)",
|
|
18
|
+
border: "1px solid var(--color-border)"
|
|
19
|
+
};
|
|
20
|
+
var componentThemes = {
|
|
21
|
+
Accordion: Accordion.extend({
|
|
22
|
+
styles: {
|
|
23
|
+
item: {
|
|
24
|
+
borderColor: "var(--color-border)"
|
|
25
|
+
},
|
|
26
|
+
content: {
|
|
27
|
+
backgroundColor: "var(--color-surface)"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
Button: Button.extend({
|
|
32
|
+
styles: {
|
|
33
|
+
root: {
|
|
34
|
+
transition: `all var(--duration-fast) var(--easing)`
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
Card: Card.extend({
|
|
39
|
+
defaultProps: {
|
|
40
|
+
p: DEFAULT_SIZE
|
|
41
|
+
},
|
|
42
|
+
styles: {
|
|
43
|
+
root: {
|
|
44
|
+
backgroundColor: "var(--glass-background)",
|
|
45
|
+
...glassBase,
|
|
46
|
+
boxShadow: "var(--card-shadow)"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
// Checkbox styles are in custom.css to support :checked pseudo-selector
|
|
51
|
+
Divider: Divider.extend({
|
|
52
|
+
styles: {
|
|
53
|
+
root: {
|
|
54
|
+
borderColor: "var(--color-border)"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
Code: Code.extend({
|
|
59
|
+
styles: {
|
|
60
|
+
root: {
|
|
61
|
+
backgroundColor: "var(--color-surface)",
|
|
62
|
+
border: "1px solid var(--color-border)"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
Flex: Flex.extend({
|
|
67
|
+
defaultProps: {
|
|
68
|
+
gap: DEFAULT_SIZE
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
Grid: Grid.extend({
|
|
72
|
+
defaultProps: {
|
|
73
|
+
gutter: DEFAULT_SIZE
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
Group: Group.extend({
|
|
77
|
+
defaultProps: {
|
|
78
|
+
gap: DEFAULT_SIZE
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
HoverCard: HoverCard.extend({
|
|
82
|
+
styles: {
|
|
83
|
+
dropdown: {
|
|
84
|
+
backgroundColor: "var(--color-surface)",
|
|
85
|
+
border: "1px solid var(--color-border)",
|
|
86
|
+
boxShadow: "var(--standard-box-shadow)"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
Input: Input.extend({
|
|
91
|
+
styles: {
|
|
92
|
+
input: {
|
|
93
|
+
backgroundColor: "var(--color-surface)",
|
|
94
|
+
border: "none",
|
|
95
|
+
borderBottom: "1px solid var(--color-border)",
|
|
96
|
+
borderRadius: "0"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}),
|
|
100
|
+
Menu: Menu.extend({
|
|
101
|
+
styles: {
|
|
102
|
+
dropdown: {
|
|
103
|
+
background: "var(--color-surface)",
|
|
104
|
+
border: "1px solid var(--color-border)"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
Modal: Modal.extend({
|
|
109
|
+
styles: {
|
|
110
|
+
content: {
|
|
111
|
+
backgroundColor: "var(--color-surface)",
|
|
112
|
+
border: "1px solid var(--color-border)"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
116
|
+
Notification: Notification.extend({
|
|
117
|
+
styles: {
|
|
118
|
+
root: {
|
|
119
|
+
backgroundColor: "color-mix(in srgb, var(--color-surface) 90%, transparent)",
|
|
120
|
+
...glassBase
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}),
|
|
124
|
+
Popover: Popover.extend({
|
|
125
|
+
styles: {
|
|
126
|
+
dropdown: {
|
|
127
|
+
backgroundColor: "var(--color-surface)",
|
|
128
|
+
...glassBase,
|
|
129
|
+
boxShadow: "var(--standard-box-shadow)"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
Paper: Paper.extend({
|
|
134
|
+
styles: {
|
|
135
|
+
root: {
|
|
136
|
+
backgroundColor: "var(--glass-background)",
|
|
137
|
+
...glassBase,
|
|
138
|
+
boxShadow: "var(--card-shadow)",
|
|
139
|
+
padding: `var(--mantine-spacing-${DEFAULT_SIZE})`
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}),
|
|
143
|
+
ScrollArea: ScrollArea.extend({
|
|
144
|
+
defaultProps: {
|
|
145
|
+
scrollbarSize: 8
|
|
146
|
+
},
|
|
147
|
+
styles: {
|
|
148
|
+
scrollbar: {
|
|
149
|
+
background: "transparent",
|
|
150
|
+
'&[data-orientation="vertical"]': {
|
|
151
|
+
width: "8px"
|
|
152
|
+
},
|
|
153
|
+
'&[data-orientation="horizontal"]': {
|
|
154
|
+
height: "8px"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
thumb: {
|
|
158
|
+
borderRadius: "var(--mantine-radius-default)",
|
|
159
|
+
background: "color-mix(in srgb, var(--color-text-subtle) 50%, var(--color-border))",
|
|
160
|
+
"&:hover": {
|
|
161
|
+
background: "var(--color-text-subtle)"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
SegmentedControl: SegmentedControl.extend({
|
|
167
|
+
styles: {
|
|
168
|
+
root: {
|
|
169
|
+
backgroundColor: "var(--color-surface)"
|
|
170
|
+
},
|
|
171
|
+
indicator: {
|
|
172
|
+
backgroundColor: "var(--color-surface-hover)",
|
|
173
|
+
boxShadow: "var(--standard-box-shadow)"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}),
|
|
177
|
+
Combobox: Combobox.extend({
|
|
178
|
+
styles: {
|
|
179
|
+
dropdown: {
|
|
180
|
+
backgroundColor: "red"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
184
|
+
Select: Select.extend({
|
|
185
|
+
styles: {
|
|
186
|
+
dropdown: {
|
|
187
|
+
backgroundColor: "var(--color-surface)"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}),
|
|
191
|
+
// Switch styles are in custom.css to support [data-checked] attribute selector
|
|
192
|
+
SimpleGrid: SimpleGrid.extend({
|
|
193
|
+
defaultProps: {
|
|
194
|
+
spacing: DEFAULT_SIZE,
|
|
195
|
+
verticalSpacing: DEFAULT_SIZE
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
Stack: Stack.extend({
|
|
199
|
+
defaultProps: {
|
|
200
|
+
gap: DEFAULT_SIZE
|
|
201
|
+
}
|
|
202
|
+
}),
|
|
203
|
+
Table: Table.extend({
|
|
204
|
+
defaultProps: {
|
|
205
|
+
highlightOnHover: true
|
|
206
|
+
},
|
|
207
|
+
styles: {
|
|
208
|
+
table: {
|
|
209
|
+
"--table-border-color": "var(--color-border)",
|
|
210
|
+
"--table-highlight-on-hover-color": "var(--color-surface-hover)"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}),
|
|
214
|
+
Tabs: Tabs.extend({}),
|
|
215
|
+
Text: Text.extend({
|
|
216
|
+
styles: {
|
|
217
|
+
root: {
|
|
218
|
+
fontFamily: 'Roboto, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}),
|
|
222
|
+
// Timeline styles are in custom.css to override color-scheme-specific selectors
|
|
223
|
+
Tooltip: Tooltip.extend({
|
|
224
|
+
styles: {
|
|
225
|
+
tooltip: {
|
|
226
|
+
backgroundColor: "var(--color-surface)",
|
|
227
|
+
color: "var(--color-text)",
|
|
228
|
+
border: "1px solid var(--color-border)"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
// Pagination styles are in custom.css to support :not([data-active]) selector
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// src/theme/MantineThemeOverride.ts
|
|
236
|
+
var mantineThemeOverride = createTheme({
|
|
237
|
+
defaultRadius: "xs",
|
|
238
|
+
fontFamily: 'Roboto, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
239
|
+
cursorType: "pointer",
|
|
240
|
+
spacing: {
|
|
241
|
+
xs: "0.5rem",
|
|
242
|
+
sm: "0.75rem",
|
|
243
|
+
md: "1rem",
|
|
244
|
+
lg: "1.5rem",
|
|
245
|
+
xl: "2rem"
|
|
246
|
+
},
|
|
247
|
+
radius: {
|
|
248
|
+
xs: "0.25rem",
|
|
249
|
+
sm: "0.5rem",
|
|
250
|
+
md: "0.75rem",
|
|
251
|
+
lg: "1rem",
|
|
252
|
+
xl: "1.5rem"
|
|
253
|
+
},
|
|
254
|
+
fontSizes: {
|
|
255
|
+
xs: "0.75rem",
|
|
256
|
+
sm: "0.875rem",
|
|
257
|
+
md: "1rem",
|
|
258
|
+
lg: "1.125rem",
|
|
259
|
+
xl: "1.25rem"
|
|
260
|
+
},
|
|
261
|
+
components: componentThemes
|
|
262
|
+
});
|
|
263
|
+
var defaultQueryClient = null;
|
|
264
|
+
function getDefaultQueryClient() {
|
|
265
|
+
if (!defaultQueryClient) {
|
|
266
|
+
defaultQueryClient = new QueryClient({
|
|
267
|
+
defaultOptions: { queries: { retry: 1 } }
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return defaultQueryClient;
|
|
271
|
+
}
|
|
272
|
+
var defaultUseOrganizations = () => ({ isInitializing: false, isOrgRefreshing: false });
|
|
273
|
+
function ElevasisUIProvider({
|
|
274
|
+
auth,
|
|
275
|
+
theme,
|
|
276
|
+
organizationId = null,
|
|
277
|
+
queryClient,
|
|
278
|
+
apiUrl,
|
|
279
|
+
onError,
|
|
280
|
+
isOrganizationReady,
|
|
281
|
+
children
|
|
282
|
+
}) {
|
|
283
|
+
if (auth.mode === "apiKey") {
|
|
284
|
+
throw new Error(
|
|
285
|
+
`ElevasisUIProvider: auth mode 'apiKey' is not yet implemented. Only 'authkit' and 'oauth' modes are supported.`
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
const resolvedQueryClient = queryClient ?? getDefaultQueryClient();
|
|
289
|
+
const resolvedColorScheme = theme?.colorScheme ?? "dark";
|
|
290
|
+
const preset = useMemo(() => getPreset(theme?.preset ?? "default"), [theme?.preset]);
|
|
291
|
+
useEffect(() => {
|
|
292
|
+
if (!preset.fontImports?.length) return;
|
|
293
|
+
const links = [];
|
|
294
|
+
for (const href of preset.fontImports) {
|
|
295
|
+
if (document.querySelector(`link[href="${href}"]`)) continue;
|
|
296
|
+
const link = document.createElement("link");
|
|
297
|
+
link.rel = "stylesheet";
|
|
298
|
+
link.href = href;
|
|
299
|
+
document.head.appendChild(link);
|
|
300
|
+
links.push(link);
|
|
301
|
+
}
|
|
302
|
+
const subtitleFont = preset.subtitleFontFamily ?? preset.mantine?.headings?.fontFamily ?? preset.mantine?.fontFamily ?? "";
|
|
303
|
+
document.documentElement.style.setProperty("--elevasis-font-family-subtitle", subtitleFont);
|
|
304
|
+
return () => {
|
|
305
|
+
links.forEach((l) => l.remove());
|
|
306
|
+
document.documentElement.style.removeProperty("--elevasis-font-family-subtitle");
|
|
307
|
+
};
|
|
308
|
+
}, [preset.fontImports, preset.subtitleFontFamily, preset.mantine?.headings?.fontFamily, preset.mantine?.fontFamily]);
|
|
309
|
+
const resolvedTheme = useMemo(() => {
|
|
310
|
+
const primaryHex = theme?.tokens?.primary ?? preset.dark.primary;
|
|
311
|
+
const primaryOverride = {
|
|
312
|
+
primaryColor: "primary",
|
|
313
|
+
colors: { primary: generateShades(primaryHex) }
|
|
314
|
+
};
|
|
315
|
+
let base = mergeThemeOverrides(mantineThemeOverride, primaryOverride);
|
|
316
|
+
if (preset.mantine) base = mergeThemeOverrides(base, preset.mantine);
|
|
317
|
+
return theme?.mantine ? mergeThemeOverrides(base, theme.mantine) : base;
|
|
318
|
+
}, [theme?.mantine, preset, theme?.tokens?.primary]);
|
|
319
|
+
const cssVariablesResolver = useMemo(
|
|
320
|
+
() => createCssVariablesResolver(theme?.tokens, theme?.preset),
|
|
321
|
+
[theme?.tokens, theme?.preset]
|
|
322
|
+
);
|
|
323
|
+
const content = apiUrl ? /* @__PURE__ */ jsx(
|
|
324
|
+
ServiceBridge,
|
|
325
|
+
{
|
|
326
|
+
apiUrl,
|
|
327
|
+
organizationId,
|
|
328
|
+
isOrganizationReady,
|
|
329
|
+
onError,
|
|
330
|
+
children
|
|
331
|
+
}
|
|
332
|
+
) : children;
|
|
333
|
+
const AuthInner = auth.mode === "authkit" ? /* @__PURE__ */ jsx(AuthKitInner, { auth, children: content }) : /* @__PURE__ */ jsx(OAuthInner, { auth, children: content });
|
|
334
|
+
return /* @__PURE__ */ jsx(
|
|
335
|
+
MantineProvider,
|
|
336
|
+
{
|
|
337
|
+
theme: resolvedTheme,
|
|
338
|
+
defaultColorScheme: resolvedColorScheme,
|
|
339
|
+
cssVariablesResolver,
|
|
340
|
+
children: /* @__PURE__ */ jsx(QueryClientProvider, { client: resolvedQueryClient, children: AuthInner })
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
function AuthKitInner({ auth, children }) {
|
|
345
|
+
return /* @__PURE__ */ jsx(
|
|
346
|
+
AuthKitProvider,
|
|
347
|
+
{
|
|
348
|
+
clientId: auth.clientId,
|
|
349
|
+
apiHostname: auth.apiHostname ?? "api.workos.com",
|
|
350
|
+
redirectUri: auth.redirectUri,
|
|
351
|
+
devMode: auth.devMode ?? false,
|
|
352
|
+
children: /* @__PURE__ */ jsx(WorkOSAuthBridge, { children })
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
function OAuthInner({ auth, children }) {
|
|
357
|
+
return /* @__PURE__ */ jsx(OAuthProvider, { config: auth, children: /* @__PURE__ */ jsx(OAuthAuthBridge, { children }) });
|
|
358
|
+
}
|
|
359
|
+
function ServiceBridge({
|
|
360
|
+
apiUrl,
|
|
361
|
+
organizationId,
|
|
362
|
+
isOrganizationReady,
|
|
363
|
+
onError,
|
|
364
|
+
children
|
|
365
|
+
}) {
|
|
366
|
+
const { getAccessToken } = useAuthContext();
|
|
367
|
+
return /* @__PURE__ */ jsx(
|
|
368
|
+
ApiClientProvider,
|
|
369
|
+
{
|
|
370
|
+
getAccessToken,
|
|
371
|
+
organizationId,
|
|
372
|
+
isOrganizationReady: isOrganizationReady ?? !!organizationId,
|
|
373
|
+
onError,
|
|
374
|
+
children: /* @__PURE__ */ jsx(ServiceBridgeInner, { apiUrl, organizationId, isOrganizationReady, children })
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
function ServiceBridgeInner({
|
|
379
|
+
apiUrl,
|
|
380
|
+
organizationId,
|
|
381
|
+
isOrganizationReady,
|
|
382
|
+
children
|
|
383
|
+
}) {
|
|
384
|
+
const useApiClient = useRef(createUseApiClient(defaultUseOrganizations, apiUrl)).current;
|
|
385
|
+
const { apiRequest } = useApiClient();
|
|
386
|
+
return /* @__PURE__ */ jsx(
|
|
387
|
+
ElevasisServiceProvider,
|
|
388
|
+
{
|
|
389
|
+
apiRequest,
|
|
390
|
+
organizationId,
|
|
391
|
+
isReady: isOrganizationReady ?? !!organizationId,
|
|
392
|
+
children
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
var ElevasisProvider = ElevasisUIProvider;
|
|
397
|
+
|
|
398
|
+
export { ElevasisProvider, ElevasisUIProvider, mantineThemeOverride };
|