@elevasis/ui 1.2.0 → 1.3.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/hooks/useApiClient.d.ts +54 -0
- package/dist/api/hooks/useApiClient.d.ts.map +1 -0
- package/dist/api/hooks/useApiClient.js +185 -0
- package/dist/api/index.d.ts +49 -11
- package/dist/api/index.js +3 -2
- package/dist/auth/index.d.ts +88 -2
- package/dist/auth/index.js +6 -2
- package/dist/{chunk-5UWFGBFM.js → chunk-4KAG5U7A.js} +18 -4
- package/dist/chunk-4VGWQ5AN.js +91 -0
- package/dist/{chunk-JKERRYVS.js → chunk-BLO4SISK.js} +7 -3
- package/dist/chunk-BWCC6ZJC.js +202 -0
- package/dist/{chunk-WNWKOCGJ.js → chunk-BZTA7IIL.js} +1 -1
- package/dist/chunk-DD3CCMCZ.js +15 -0
- package/dist/{chunk-GEFB5YIR.js → chunk-EZMRFWZQ.js} +1 -1
- package/dist/chunk-FDCVFCOQ.js +105 -0
- package/dist/chunk-FLJXZ7YC.js +150 -0
- package/dist/{chunk-7AI5ZYJ4.js → chunk-JVAZHVNV.js} +2 -94
- package/dist/{chunk-ZGHDPDTF.js → chunk-JYSYHVLU.js} +3 -3
- package/dist/{chunk-J3FALDQE.js → chunk-NXHL23JW.js} +7 -13
- package/dist/{chunk-OUHGHTE7.js → chunk-O3PY6B6E.js} +3 -2
- package/dist/chunk-OLD3NQLI.js +91 -0
- package/dist/{chunk-XVPEDNIM.js → chunk-PCBXNHKY.js} +325 -152
- package/dist/chunk-QQOLC46E.js +75 -0
- package/dist/{chunk-KSG4C5DD.js → chunk-QSVZP2NU.js} +2 -1
- package/dist/chunk-RNP5R5I3.js +1 -0
- package/dist/{chunk-YULUKCS6.js → chunk-SITSZUFW.js} +1 -1
- package/dist/chunk-TIRMFDM4.js +33 -0
- package/dist/{chunk-PYL4XW6H.js → chunk-TMFCNFLW.js} +1 -1
- package/dist/{chunk-S66I2PYB.js → chunk-TN3PU2WK.js} +1 -1
- package/dist/components/command-queue/index.js +6 -4
- package/dist/components/index.js +9 -7
- package/dist/components/notifications/index.js +4 -3
- package/dist/display/index.js +3 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +5 -4
- package/dist/hooks/published.d.ts +1 -1
- package/dist/hooks/published.js +4 -3
- package/dist/index.d.ts +458 -120
- package/dist/index.js +23 -17
- package/dist/initialization/index.d.ts +49 -1
- package/dist/initialization/index.js +5 -2
- package/dist/organization/index.d.ts +61 -2
- package/dist/organization/index.js +5 -2
- package/dist/profile/index.d.ts +30 -2
- package/dist/profile/index.js +2 -1
- package/dist/provider/index.d.ts +123 -30
- package/dist/provider/index.js +11 -6
- package/dist/provider/published.d.ts +96 -16
- package/dist/provider/published.js +10 -4
- package/dist/utils/index.js +2 -1
- package/package.json +17 -4
- package/dist/chunk-GDV44UWF.js +0 -138
- package/dist/chunk-HBRMWW6V.js +0 -43
- package/dist/chunk-QGEFP2EU.js +0 -399
package/dist/chunk-QGEFP2EU.js
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { getPreset, generateShades, createCssVariablesResolver } from './chunk-XVPEDNIM.js';
|
|
2
|
-
import { ApiClientProvider, createUseApiClient } from './chunk-GDV44UWF.js';
|
|
3
|
-
import { ElevasisServiceProvider } from './chunk-KA7LO7U5.js';
|
|
4
|
-
import { WorkOSAuthBridge } from './chunk-NIAVTSMB.js';
|
|
5
|
-
import { OAuthProvider } from './chunk-KSG4C5DD.js';
|
|
6
|
-
import { useAuthContext } from './chunk-7PLEQFHO.js';
|
|
7
|
-
import { useMemo, useEffect, useRef } from 'react';
|
|
8
|
-
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';
|
|
9
|
-
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
|
|
10
|
-
import { AuthKitProvider } from '@workos-inc/authkit-react';
|
|
11
|
-
import '@mantine/core/styles.css';
|
|
12
|
-
import '@mantine/notifications/styles.css';
|
|
13
|
-
import { jsx } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
var DEFAULT_SIZE = "sm";
|
|
16
|
-
var glassBase = {
|
|
17
|
-
backdropFilter: "var(--glass-blur)",
|
|
18
|
-
WebkitBackdropFilter: "var(--glass-blur)",
|
|
19
|
-
border: "1px solid var(--color-border)"
|
|
20
|
-
};
|
|
21
|
-
var componentThemes = {
|
|
22
|
-
Accordion: Accordion.extend({
|
|
23
|
-
styles: {
|
|
24
|
-
item: {
|
|
25
|
-
borderColor: "var(--color-border)"
|
|
26
|
-
},
|
|
27
|
-
content: {
|
|
28
|
-
backgroundColor: "var(--color-surface)"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}),
|
|
32
|
-
Button: Button.extend({
|
|
33
|
-
styles: {
|
|
34
|
-
root: {
|
|
35
|
-
transition: `all var(--duration-fast) var(--easing)`
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}),
|
|
39
|
-
Card: Card.extend({
|
|
40
|
-
defaultProps: {
|
|
41
|
-
p: DEFAULT_SIZE
|
|
42
|
-
},
|
|
43
|
-
styles: {
|
|
44
|
-
root: {
|
|
45
|
-
backgroundColor: "var(--glass-background)",
|
|
46
|
-
...glassBase,
|
|
47
|
-
boxShadow: "var(--card-shadow)"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
// Checkbox styles are in custom.css to support :checked pseudo-selector
|
|
52
|
-
Divider: Divider.extend({
|
|
53
|
-
styles: {
|
|
54
|
-
root: {
|
|
55
|
-
borderColor: "var(--color-border)"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}),
|
|
59
|
-
Code: Code.extend({
|
|
60
|
-
styles: {
|
|
61
|
-
root: {
|
|
62
|
-
backgroundColor: "var(--color-surface)",
|
|
63
|
-
border: "1px solid var(--color-border)"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}),
|
|
67
|
-
Flex: Flex.extend({
|
|
68
|
-
defaultProps: {
|
|
69
|
-
gap: DEFAULT_SIZE
|
|
70
|
-
}
|
|
71
|
-
}),
|
|
72
|
-
Grid: Grid.extend({
|
|
73
|
-
defaultProps: {
|
|
74
|
-
gutter: DEFAULT_SIZE
|
|
75
|
-
}
|
|
76
|
-
}),
|
|
77
|
-
Group: Group.extend({
|
|
78
|
-
defaultProps: {
|
|
79
|
-
gap: DEFAULT_SIZE
|
|
80
|
-
}
|
|
81
|
-
}),
|
|
82
|
-
HoverCard: HoverCard.extend({
|
|
83
|
-
styles: {
|
|
84
|
-
dropdown: {
|
|
85
|
-
backgroundColor: "var(--color-surface)",
|
|
86
|
-
border: "1px solid var(--color-border)",
|
|
87
|
-
boxShadow: "var(--standard-box-shadow)"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}),
|
|
91
|
-
Input: Input.extend({
|
|
92
|
-
styles: {
|
|
93
|
-
input: {
|
|
94
|
-
backgroundColor: "var(--color-surface)",
|
|
95
|
-
border: "none",
|
|
96
|
-
borderBottom: "1px solid var(--color-border)",
|
|
97
|
-
borderRadius: "0"
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}),
|
|
101
|
-
Menu: Menu.extend({
|
|
102
|
-
styles: {
|
|
103
|
-
dropdown: {
|
|
104
|
-
background: "var(--color-surface)",
|
|
105
|
-
border: "1px solid var(--color-border)"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}),
|
|
109
|
-
Modal: Modal.extend({
|
|
110
|
-
styles: {
|
|
111
|
-
content: {
|
|
112
|
-
backgroundColor: "var(--color-surface)",
|
|
113
|
-
border: "1px solid var(--color-border)"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}),
|
|
117
|
-
Notification: Notification.extend({
|
|
118
|
-
styles: {
|
|
119
|
-
root: {
|
|
120
|
-
backgroundColor: "color-mix(in srgb, var(--color-surface) 90%, transparent)",
|
|
121
|
-
...glassBase
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}),
|
|
125
|
-
Popover: Popover.extend({
|
|
126
|
-
styles: {
|
|
127
|
-
dropdown: {
|
|
128
|
-
backgroundColor: "var(--color-surface)",
|
|
129
|
-
...glassBase,
|
|
130
|
-
boxShadow: "var(--standard-box-shadow)"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}),
|
|
134
|
-
Paper: Paper.extend({
|
|
135
|
-
styles: {
|
|
136
|
-
root: {
|
|
137
|
-
backgroundColor: "var(--glass-background)",
|
|
138
|
-
...glassBase,
|
|
139
|
-
boxShadow: "var(--card-shadow)",
|
|
140
|
-
padding: `var(--mantine-spacing-${DEFAULT_SIZE})`
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}),
|
|
144
|
-
ScrollArea: ScrollArea.extend({
|
|
145
|
-
defaultProps: {
|
|
146
|
-
scrollbarSize: 8
|
|
147
|
-
},
|
|
148
|
-
styles: {
|
|
149
|
-
scrollbar: {
|
|
150
|
-
background: "transparent",
|
|
151
|
-
'&[data-orientation="vertical"]': {
|
|
152
|
-
width: "8px"
|
|
153
|
-
},
|
|
154
|
-
'&[data-orientation="horizontal"]': {
|
|
155
|
-
height: "8px"
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
thumb: {
|
|
159
|
-
borderRadius: "var(--mantine-radius-default)",
|
|
160
|
-
background: "color-mix(in srgb, var(--color-text-subtle) 50%, var(--color-border))",
|
|
161
|
-
"&:hover": {
|
|
162
|
-
background: "var(--color-text-subtle)"
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}),
|
|
167
|
-
SegmentedControl: SegmentedControl.extend({
|
|
168
|
-
styles: {
|
|
169
|
-
root: {
|
|
170
|
-
backgroundColor: "var(--color-surface)"
|
|
171
|
-
},
|
|
172
|
-
indicator: {
|
|
173
|
-
backgroundColor: "var(--color-surface-hover)",
|
|
174
|
-
boxShadow: "var(--standard-box-shadow)"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}),
|
|
178
|
-
Combobox: Combobox.extend({
|
|
179
|
-
styles: {
|
|
180
|
-
dropdown: {
|
|
181
|
-
backgroundColor: "red"
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}),
|
|
185
|
-
Select: Select.extend({
|
|
186
|
-
styles: {
|
|
187
|
-
dropdown: {
|
|
188
|
-
backgroundColor: "var(--color-surface)"
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}),
|
|
192
|
-
// Switch styles are in custom.css to support [data-checked] attribute selector
|
|
193
|
-
SimpleGrid: SimpleGrid.extend({
|
|
194
|
-
defaultProps: {
|
|
195
|
-
spacing: DEFAULT_SIZE,
|
|
196
|
-
verticalSpacing: DEFAULT_SIZE
|
|
197
|
-
}
|
|
198
|
-
}),
|
|
199
|
-
Stack: Stack.extend({
|
|
200
|
-
defaultProps: {
|
|
201
|
-
gap: DEFAULT_SIZE
|
|
202
|
-
}
|
|
203
|
-
}),
|
|
204
|
-
Table: Table.extend({
|
|
205
|
-
defaultProps: {
|
|
206
|
-
highlightOnHover: true
|
|
207
|
-
},
|
|
208
|
-
styles: {
|
|
209
|
-
table: {
|
|
210
|
-
"--table-border-color": "var(--color-border)",
|
|
211
|
-
"--table-highlight-on-hover-color": "var(--color-surface-hover)"
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}),
|
|
215
|
-
Tabs: Tabs.extend({}),
|
|
216
|
-
Text: Text.extend({
|
|
217
|
-
styles: {
|
|
218
|
-
root: {
|
|
219
|
-
fontFamily: 'Roboto, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}),
|
|
223
|
-
// Timeline styles are in custom.css to override color-scheme-specific selectors
|
|
224
|
-
Tooltip: Tooltip.extend({
|
|
225
|
-
styles: {
|
|
226
|
-
tooltip: {
|
|
227
|
-
backgroundColor: "var(--color-surface)",
|
|
228
|
-
color: "var(--color-text)",
|
|
229
|
-
border: "1px solid var(--color-border)"
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
})
|
|
233
|
-
// Pagination styles are in custom.css to support :not([data-active]) selector
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// src/theme/MantineThemeOverride.ts
|
|
237
|
-
var mantineThemeOverride = createTheme({
|
|
238
|
-
defaultRadius: "xs",
|
|
239
|
-
fontFamily: 'Roboto, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
240
|
-
cursorType: "pointer",
|
|
241
|
-
spacing: {
|
|
242
|
-
xs: "0.5rem",
|
|
243
|
-
sm: "0.75rem",
|
|
244
|
-
md: "1rem",
|
|
245
|
-
lg: "1.5rem",
|
|
246
|
-
xl: "2rem"
|
|
247
|
-
},
|
|
248
|
-
radius: {
|
|
249
|
-
xs: "0.25rem",
|
|
250
|
-
sm: "0.5rem",
|
|
251
|
-
md: "0.75rem",
|
|
252
|
-
lg: "1rem",
|
|
253
|
-
xl: "1.5rem"
|
|
254
|
-
},
|
|
255
|
-
fontSizes: {
|
|
256
|
-
xs: "0.75rem",
|
|
257
|
-
sm: "0.875rem",
|
|
258
|
-
md: "1rem",
|
|
259
|
-
lg: "1.125rem",
|
|
260
|
-
xl: "1.25rem"
|
|
261
|
-
},
|
|
262
|
-
components: componentThemes
|
|
263
|
-
});
|
|
264
|
-
var defaultQueryClient = null;
|
|
265
|
-
function getDefaultQueryClient() {
|
|
266
|
-
if (!defaultQueryClient) {
|
|
267
|
-
defaultQueryClient = new QueryClient({
|
|
268
|
-
defaultOptions: { queries: { retry: 1 } }
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
return defaultQueryClient;
|
|
272
|
-
}
|
|
273
|
-
var defaultUseOrganizations = () => ({ isInitializing: false, isOrgRefreshing: false });
|
|
274
|
-
function ElevasisUIProvider({
|
|
275
|
-
auth,
|
|
276
|
-
theme,
|
|
277
|
-
organizationId = null,
|
|
278
|
-
queryClient,
|
|
279
|
-
apiUrl,
|
|
280
|
-
onError,
|
|
281
|
-
isOrganizationReady,
|
|
282
|
-
children
|
|
283
|
-
}) {
|
|
284
|
-
if (auth.mode === "apiKey") {
|
|
285
|
-
throw new Error(
|
|
286
|
-
`ElevasisUIProvider: auth mode 'apiKey' is not yet implemented. Only 'authkit' and 'oauth' modes are supported.`
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
const resolvedQueryClient = queryClient ?? getDefaultQueryClient();
|
|
290
|
-
const resolvedColorScheme = theme?.colorScheme ?? "dark";
|
|
291
|
-
const preset = useMemo(() => getPreset(theme?.preset ?? "default"), [theme?.preset]);
|
|
292
|
-
useEffect(() => {
|
|
293
|
-
if (!preset.fontImports?.length) return;
|
|
294
|
-
const links = [];
|
|
295
|
-
for (const href of preset.fontImports) {
|
|
296
|
-
if (document.querySelector(`link[href="${href}"]`)) continue;
|
|
297
|
-
const link = document.createElement("link");
|
|
298
|
-
link.rel = "stylesheet";
|
|
299
|
-
link.href = href;
|
|
300
|
-
document.head.appendChild(link);
|
|
301
|
-
links.push(link);
|
|
302
|
-
}
|
|
303
|
-
const subtitleFont = preset.subtitleFontFamily ?? preset.mantine?.headings?.fontFamily ?? preset.mantine?.fontFamily ?? "";
|
|
304
|
-
document.documentElement.style.setProperty("--elevasis-font-family-subtitle", subtitleFont);
|
|
305
|
-
return () => {
|
|
306
|
-
links.forEach((l) => l.remove());
|
|
307
|
-
document.documentElement.style.removeProperty("--elevasis-font-family-subtitle");
|
|
308
|
-
};
|
|
309
|
-
}, [preset.fontImports, preset.subtitleFontFamily, preset.mantine?.headings?.fontFamily, preset.mantine?.fontFamily]);
|
|
310
|
-
const resolvedTheme = useMemo(() => {
|
|
311
|
-
const primaryHex = theme?.tokens?.primary ?? preset.dark.primary;
|
|
312
|
-
const primaryOverride = {
|
|
313
|
-
primaryColor: "primary",
|
|
314
|
-
colors: { primary: generateShades(primaryHex) }
|
|
315
|
-
};
|
|
316
|
-
let base = mergeThemeOverrides(mantineThemeOverride, primaryOverride);
|
|
317
|
-
if (preset.mantine) base = mergeThemeOverrides(base, preset.mantine);
|
|
318
|
-
return theme?.mantine ? mergeThemeOverrides(base, theme.mantine) : base;
|
|
319
|
-
}, [theme?.mantine, preset, theme?.tokens?.primary]);
|
|
320
|
-
const cssVariablesResolver = useMemo(
|
|
321
|
-
() => createCssVariablesResolver(theme?.tokens, theme?.preset),
|
|
322
|
-
[theme?.tokens, theme?.preset]
|
|
323
|
-
);
|
|
324
|
-
const content = apiUrl ? /* @__PURE__ */ jsx(
|
|
325
|
-
ServiceBridge,
|
|
326
|
-
{
|
|
327
|
-
apiUrl,
|
|
328
|
-
organizationId,
|
|
329
|
-
isOrganizationReady,
|
|
330
|
-
onError,
|
|
331
|
-
children
|
|
332
|
-
}
|
|
333
|
-
) : children;
|
|
334
|
-
const AuthInner = auth.mode === "authkit" ? /* @__PURE__ */ jsx(AuthKitInner, { auth, children: content }) : /* @__PURE__ */ jsx(OAuthInner, { auth, children: content });
|
|
335
|
-
return /* @__PURE__ */ jsx(
|
|
336
|
-
MantineProvider,
|
|
337
|
-
{
|
|
338
|
-
theme: resolvedTheme,
|
|
339
|
-
defaultColorScheme: resolvedColorScheme,
|
|
340
|
-
cssVariablesResolver,
|
|
341
|
-
children: /* @__PURE__ */ jsx(QueryClientProvider, { client: resolvedQueryClient, children: AuthInner })
|
|
342
|
-
}
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
function AuthKitInner({ auth, children }) {
|
|
346
|
-
return /* @__PURE__ */ jsx(
|
|
347
|
-
AuthKitProvider,
|
|
348
|
-
{
|
|
349
|
-
clientId: auth.clientId,
|
|
350
|
-
apiHostname: auth.apiHostname ?? "api.workos.com",
|
|
351
|
-
redirectUri: auth.redirectUri,
|
|
352
|
-
devMode: auth.devMode ?? false,
|
|
353
|
-
children: /* @__PURE__ */ jsx(WorkOSAuthBridge, { children })
|
|
354
|
-
}
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
function OAuthInner({ auth, children }) {
|
|
358
|
-
return /* @__PURE__ */ jsx(OAuthProvider, { config: auth, children });
|
|
359
|
-
}
|
|
360
|
-
function ServiceBridge({
|
|
361
|
-
apiUrl,
|
|
362
|
-
organizationId,
|
|
363
|
-
isOrganizationReady,
|
|
364
|
-
onError,
|
|
365
|
-
children
|
|
366
|
-
}) {
|
|
367
|
-
const { getAccessToken } = useAuthContext();
|
|
368
|
-
return /* @__PURE__ */ jsx(
|
|
369
|
-
ApiClientProvider,
|
|
370
|
-
{
|
|
371
|
-
getAccessToken,
|
|
372
|
-
organizationId,
|
|
373
|
-
isOrganizationReady: isOrganizationReady ?? !!organizationId,
|
|
374
|
-
onError,
|
|
375
|
-
children: /* @__PURE__ */ jsx(ServiceBridgeInner, { apiUrl, organizationId, isOrganizationReady, children })
|
|
376
|
-
}
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
function ServiceBridgeInner({
|
|
380
|
-
apiUrl,
|
|
381
|
-
organizationId,
|
|
382
|
-
isOrganizationReady,
|
|
383
|
-
children
|
|
384
|
-
}) {
|
|
385
|
-
const useApiClient = useRef(createUseApiClient(defaultUseOrganizations, apiUrl)).current;
|
|
386
|
-
const { apiRequest } = useApiClient();
|
|
387
|
-
return /* @__PURE__ */ jsx(
|
|
388
|
-
ElevasisServiceProvider,
|
|
389
|
-
{
|
|
390
|
-
apiRequest,
|
|
391
|
-
organizationId,
|
|
392
|
-
isReady: isOrganizationReady ?? !!organizationId,
|
|
393
|
-
children
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
var ElevasisProvider = ElevasisUIProvider;
|
|
398
|
-
|
|
399
|
-
export { ElevasisProvider, ElevasisUIProvider, mantineThemeOverride };
|