@luxfi/ui 7.4.0 → 7.4.2
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/avatar.cjs +7 -6
- package/dist/avatar.js +7 -5
- package/dist/badge.cjs +30 -32
- package/dist/badge.js +30 -32
- package/dist/bank.d.cts +3 -3
- package/dist/bank.d.ts +3 -3
- package/dist/checkbox.cjs +4 -4
- package/dist/checkbox.d.cts +3 -2
- package/dist/checkbox.d.ts +3 -2
- package/dist/checkbox.js +5 -4
- package/dist/chrome.cjs +950 -0
- package/dist/chrome.d.cts +93 -0
- package/dist/chrome.d.ts +93 -0
- package/dist/chrome.js +921 -0
- package/dist/drawer.cjs +86 -20
- package/dist/drawer.js +85 -19
- package/dist/expiration-selector.cjs +3 -2
- package/dist/expiration-selector.js +3 -2
- package/dist/greeks-display.cjs +6 -6
- package/dist/greeks-display.js +6 -6
- package/dist/gui.cjs +13 -0
- package/dist/gui.d.cts +2 -0
- package/dist/gui.d.ts +2 -0
- package/dist/gui.js +2 -0
- package/dist/heading.cjs +4 -2
- package/dist/heading.js +4 -2
- package/dist/iam.cjs +206 -0
- package/dist/iam.d.cts +65 -0
- package/dist/iam.d.ts +65 -0
- package/dist/iam.js +201 -0
- package/dist/icons.cjs +13 -0
- package/dist/icons.d.cts +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/identity.cjs +420 -0
- package/dist/identity.d.cts +64 -0
- package/dist/identity.d.ts +64 -0
- package/dist/identity.js +398 -0
- package/dist/index.cjs +1597 -833
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1574 -828
- package/dist/input.cjs +3 -1
- package/dist/input.d.cts +3 -5
- package/dist/input.d.ts +3 -5
- package/dist/input.js +3 -1
- package/dist/lux.config.cjs +23 -2
- package/dist/lux.config.d.cts +28 -10
- package/dist/lux.config.d.ts +28 -10
- package/dist/lux.config.js +23 -2
- package/dist/menu.cjs +4 -4
- package/dist/menu.js +4 -4
- package/dist/next.cjs +99 -0
- package/dist/next.d.cts +29 -0
- package/dist/next.d.ts +29 -0
- package/dist/next.js +96 -0
- package/dist/option-chain.cjs +1 -1
- package/dist/option-chain.js +1 -1
- package/dist/option-position.cjs +2 -1
- package/dist/option-position.js +2 -1
- package/dist/pnl-diagram.cjs +8 -6
- package/dist/pnl-diagram.js +8 -6
- package/dist/progress.cjs +7 -6
- package/dist/progress.js +7 -5
- package/dist/provider.cjs +136 -4
- package/dist/provider.d.cts +15 -3
- package/dist/provider.d.ts +15 -3
- package/dist/provider.js +136 -5
- package/dist/radio.cjs +9 -7
- package/dist/radio.js +10 -7
- package/dist/separator.cjs +3 -1
- package/dist/separator.js +3 -1
- package/dist/slider.cjs +28 -16
- package/dist/slider.js +28 -15
- package/dist/strategy-builder.cjs +2 -1
- package/dist/strategy-builder.js +2 -1
- package/dist/switch.cjs +11 -12
- package/dist/switch.js +12 -12
- package/dist/tag.cjs +31 -33
- package/dist/tag.js +30 -32
- package/dist/textarea.cjs +3 -1
- package/dist/textarea.js +3 -1
- package/dist/tooltip.cjs +25 -27
- package/dist/tooltip.js +24 -26
- package/dist/use-narrow.cjs +46 -0
- package/dist/use-narrow.d.cts +12 -0
- package/dist/use-narrow.d.ts +12 -0
- package/dist/use-narrow.js +20 -0
- package/dist/vite.cjs +40 -0
- package/dist/vite.d.cts +29 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.js +38 -0
- package/dist/white-label.cjs +132 -0
- package/dist/white-label.d.cts +59 -0
- package/dist/white-label.d.ts +59 -0
- package/dist/white-label.js +124 -0
- package/package.json +85 -19
- package/src/avatar.tsx +22 -16
- package/src/checkbox.tsx +15 -10
- package/src/chrome.tsx +459 -0
- package/src/drawer.tsx +83 -10
- package/src/expiration-selector.tsx +3 -2
- package/src/greeks-display.tsx +9 -6
- package/src/gui.ts +17 -0
- package/src/heading.tsx +12 -8
- package/src/iam.ts +170 -0
- package/src/icons.ts +18 -0
- package/src/identity.tsx +318 -0
- package/src/index.ts +44 -1
- package/src/input.tsx +13 -9
- package/src/lux.config.ts +16 -15
- package/src/menu.tsx +4 -4
- package/src/next.ts +142 -0
- package/src/option-chain.tsx +1 -1
- package/src/option-position.tsx +2 -1
- package/src/pnl-diagram.tsx +11 -6
- package/src/progress.tsx +15 -8
- package/src/provider.tsx +48 -7
- package/src/radio.tsx +15 -11
- package/src/separator.tsx +8 -3
- package/src/slider.tsx +35 -19
- package/src/strategy-builder.tsx +3 -2
- package/src/switch.tsx +17 -16
- package/src/textarea.tsx +8 -4
- package/src/tooltip.tsx +2 -21
- package/src/use-narrow.ts +40 -0
- package/src/vite.ts +78 -0
- package/src/white-label.ts +240 -0
- package/tokens.css +544 -319
- package/src/tokens.css +0 -438
package/dist/index.js
CHANGED
|
@@ -1,38 +1,151 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createGui, styled, View, TooltipGroup, Tooltip as Tooltip$1, Dialog, Popover, Text, GuiProvider } from '@hanzo/gui';
|
|
2
|
+
import { createGui, styled, View, Sheet, Avatar as Avatar$1, TooltipGroup, Tooltip as Tooltip$1, Checkbox, Dialog, H3, H2, H1, Input as Input$1, Popover, Progress as Progress$1, RadioGroup, Separator, Slider as Slider$1, Switch, TextArea, Text, GuiProvider } from '@hanzo/gui';
|
|
3
3
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
4
|
+
import * as React33 from 'react';
|
|
5
|
+
import React33__default from 'react';
|
|
6
6
|
import { defaultConfig } from '@hanzogui/config/v5';
|
|
7
|
+
import { animations } from '@hanzogui/config/v5-css';
|
|
7
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
9
|
import { clsx } from 'clsx';
|
|
9
10
|
import { twMerge } from 'tailwind-merge';
|
|
11
|
+
import { Check, ChevronRight, ChevronsUpDown, Folder, LogOut, User, Settings, Menu, Building2 } from 'lucide-react';
|
|
12
|
+
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
13
|
+
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
10
14
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
11
|
-
import * as RadixAvatar from '@radix-ui/react-avatar';
|
|
12
15
|
import { useClickAway, useDebounce } from '@uidotdev/usehooks';
|
|
13
|
-
import * as RadixCheckbox from '@radix-ui/react-checkbox';
|
|
14
16
|
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
15
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
16
17
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
17
18
|
import { debounce, throttle } from 'es-toolkit';
|
|
18
|
-
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
19
|
-
import { LuCheck, LuChevronRight } from 'react-icons/lu';
|
|
20
|
-
import * as RadixProgress from '@radix-ui/react-progress';
|
|
21
|
-
import * as RadixRadioGroup from '@radix-ui/react-radio-group';
|
|
22
19
|
import * as RadixSelect from '@radix-ui/react-select';
|
|
23
|
-
import * as RadixSlider from '@radix-ui/react-slider';
|
|
24
|
-
import * as RadixSwitch from '@radix-ui/react-switch';
|
|
25
20
|
import * as RadixTabs from '@radix-ui/react-tabs';
|
|
26
21
|
import { toast, Toaster as Toaster$1 } from 'sonner';
|
|
27
22
|
|
|
28
23
|
// src/provider.tsx
|
|
24
|
+
|
|
25
|
+
// src/white-label.ts
|
|
29
26
|
var LUX_BRAND = {
|
|
30
27
|
lux: "#7000FF",
|
|
31
28
|
zoo: "#6C5EFB",
|
|
32
29
|
hanzo: "#EA580C",
|
|
33
|
-
pars: "#1C3879"
|
|
30
|
+
pars: "#1C3879",
|
|
31
|
+
// bootno.de is its own white label with its own IdP (id.bootno.de) — accent
|
|
32
|
+
// taken from the bootnode console's own brand default, not invented here.
|
|
33
|
+
bootnode: "#3B82F6"
|
|
34
34
|
};
|
|
35
35
|
var PARS_GOLD = "#C8A45C";
|
|
36
|
+
var ORGS = {
|
|
37
|
+
lux: {
|
|
38
|
+
org: "lux",
|
|
39
|
+
name: "Lux",
|
|
40
|
+
domain: "lux.network",
|
|
41
|
+
iamDomain: "lux.id",
|
|
42
|
+
accent: LUX_BRAND.lux,
|
|
43
|
+
accentForeground: "#FFFFFF"
|
|
44
|
+
},
|
|
45
|
+
zoo: {
|
|
46
|
+
org: "zoo",
|
|
47
|
+
name: "Zoo",
|
|
48
|
+
domain: "zoo.ngo",
|
|
49
|
+
// Zoo's IdP is `id.zoo.network`, not a `zoo.id` apex — the one row in this
|
|
50
|
+
// table where the issuer is not `<org>.id`, and the one every hand-rolled
|
|
51
|
+
// per-app branding map got wrong.
|
|
52
|
+
iamDomain: "id.zoo.network",
|
|
53
|
+
accent: LUX_BRAND.zoo,
|
|
54
|
+
accentForeground: "#FFFFFF"
|
|
55
|
+
},
|
|
56
|
+
bootnode: {
|
|
57
|
+
org: "bootnode",
|
|
58
|
+
name: "Bootnode",
|
|
59
|
+
domain: "bootno.de",
|
|
60
|
+
iamDomain: "id.bootno.de",
|
|
61
|
+
accent: LUX_BRAND.lux,
|
|
62
|
+
accentForeground: "#FFFFFF"
|
|
63
|
+
},
|
|
64
|
+
hanzo: {
|
|
65
|
+
org: "hanzo",
|
|
66
|
+
name: "Hanzo",
|
|
67
|
+
domain: "hanzo.ai",
|
|
68
|
+
iamDomain: "hanzo.id",
|
|
69
|
+
accent: LUX_BRAND.hanzo,
|
|
70
|
+
accentForeground: "#FFFFFF"
|
|
71
|
+
},
|
|
72
|
+
pars: {
|
|
73
|
+
org: "pars",
|
|
74
|
+
name: "Pars",
|
|
75
|
+
domain: "pars.id",
|
|
76
|
+
iamDomain: "pars.id",
|
|
77
|
+
accent: LUX_BRAND.pars,
|
|
78
|
+
accentForeground: PARS_GOLD
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var DOMAIN_ORG = [
|
|
82
|
+
["lux.network", "lux"],
|
|
83
|
+
["lux.cloud", "lux"],
|
|
84
|
+
["lux.id", "lux"],
|
|
85
|
+
["lux.finance", "lux"],
|
|
86
|
+
["zoo.ngo", "zoo"],
|
|
87
|
+
["zoo.network", "zoo"],
|
|
88
|
+
["zoo.cloud", "zoo"],
|
|
89
|
+
["zoo.id", "zoo"],
|
|
90
|
+
["hanzo.ai", "hanzo"],
|
|
91
|
+
["hanzo.cloud", "hanzo"],
|
|
92
|
+
["hanzo.id", "hanzo"],
|
|
93
|
+
["pars.id", "pars"],
|
|
94
|
+
["parsdao.org", "pars"],
|
|
95
|
+
["bootno.de", "bootnode", "platform"]
|
|
96
|
+
];
|
|
97
|
+
var DEFAULT_ORG = "lux";
|
|
98
|
+
function normalizeHost(host) {
|
|
99
|
+
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
100
|
+
return noPort.replace(/\.$/, "");
|
|
101
|
+
}
|
|
102
|
+
function isUnder(host, domain) {
|
|
103
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
104
|
+
}
|
|
105
|
+
function matchDomain(host) {
|
|
106
|
+
let best;
|
|
107
|
+
for (const entry of DOMAIN_ORG) {
|
|
108
|
+
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
109
|
+
best = entry;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return best;
|
|
113
|
+
}
|
|
114
|
+
function appSlug(host, domain, apexApp) {
|
|
115
|
+
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
116
|
+
const leftmost = sub.split(".")[0] ?? "";
|
|
117
|
+
if (leftmost && leftmost !== "www") return leftmost;
|
|
118
|
+
if (apexApp) return apexApp;
|
|
119
|
+
const label = domain.split(".")[0] ?? "";
|
|
120
|
+
const tld = domain.split(".").slice(1).join(".");
|
|
121
|
+
return tld.split(".")[0] || label;
|
|
122
|
+
}
|
|
123
|
+
function isLocal(host) {
|
|
124
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
125
|
+
}
|
|
126
|
+
function resolveWhiteLabel(host) {
|
|
127
|
+
const h = normalizeHost(host ?? "");
|
|
128
|
+
const match = h ? matchDomain(h) : void 0;
|
|
129
|
+
const org = match ? match[1] : DEFAULT_ORG;
|
|
130
|
+
const identity = ORGS[org];
|
|
131
|
+
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
132
|
+
return {
|
|
133
|
+
...identity,
|
|
134
|
+
host: h,
|
|
135
|
+
app,
|
|
136
|
+
theme: `dark_${org}`,
|
|
137
|
+
issuer: `https://${identity.iamDomain}`,
|
|
138
|
+
clientId: `${org}-${app}`
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function currentHost() {
|
|
142
|
+
return typeof window === "undefined" ? "" : window.location.host;
|
|
143
|
+
}
|
|
144
|
+
function orgIdentity(org) {
|
|
145
|
+
return ORGS[org];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/lux.config.ts
|
|
36
149
|
var TRUE_BLACK = "#000000";
|
|
37
150
|
var darkBase = {
|
|
38
151
|
...defaultConfig.themes.dark,
|
|
@@ -54,48 +167,1107 @@ var luxThemes = {
|
|
|
54
167
|
dark_lux: brandTheme(LUX_BRAND.lux),
|
|
55
168
|
dark_zoo: brandTheme(LUX_BRAND.zoo),
|
|
56
169
|
dark_hanzo: brandTheme(LUX_BRAND.hanzo),
|
|
57
|
-
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD })
|
|
170
|
+
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD }),
|
|
171
|
+
dark_bootnode: brandTheme(LUX_BRAND.bootnode)
|
|
172
|
+
};
|
|
173
|
+
var config = createGui({
|
|
174
|
+
...defaultConfig,
|
|
175
|
+
animations,
|
|
176
|
+
settings: {
|
|
177
|
+
...defaultConfig.settings,
|
|
178
|
+
onlyAllowShorthands: false
|
|
179
|
+
},
|
|
180
|
+
themes: {
|
|
181
|
+
...defaultConfig.themes,
|
|
182
|
+
...luxThemes
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
var lux_config_default = config;
|
|
186
|
+
var defaultQueryClient = new QueryClient({
|
|
187
|
+
defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
|
|
188
|
+
});
|
|
189
|
+
var FONT_BODY_RESET_ID = "lux-ui-font-body-reset";
|
|
190
|
+
var FONT_BODY_RESET_CSS = "body .font_body{line-height:1.5}";
|
|
191
|
+
var useFontBodyReset = () => {
|
|
192
|
+
React33__default.useInsertionEffect(() => {
|
|
193
|
+
if (typeof document === "undefined") return;
|
|
194
|
+
if (document.getElementById(FONT_BODY_RESET_ID)) return;
|
|
195
|
+
const style = document.createElement("style");
|
|
196
|
+
style.id = FONT_BODY_RESET_ID;
|
|
197
|
+
style.textContent = FONT_BODY_RESET_CSS;
|
|
198
|
+
document.head.appendChild(style);
|
|
199
|
+
}, []);
|
|
200
|
+
};
|
|
201
|
+
var WhiteLabelContext = React33__default.createContext(resolveWhiteLabel(""));
|
|
202
|
+
var useWhiteLabel = () => React33__default.useContext(WhiteLabelContext);
|
|
203
|
+
var useHostWhiteLabel = (host) => {
|
|
204
|
+
const [resolvedHost, setResolvedHost] = React33__default.useState(host ?? "");
|
|
205
|
+
React33__default.useEffect(() => {
|
|
206
|
+
if (host !== void 0) return;
|
|
207
|
+
const browserHost = currentHost();
|
|
208
|
+
if (browserHost) setResolvedHost(browserHost);
|
|
209
|
+
}, [host]);
|
|
210
|
+
return React33__default.useMemo(() => resolveWhiteLabel(resolvedHost), [resolvedHost]);
|
|
211
|
+
};
|
|
212
|
+
var AppProvider = ({
|
|
213
|
+
children,
|
|
214
|
+
queryClient,
|
|
215
|
+
host,
|
|
216
|
+
defaultTheme
|
|
217
|
+
}) => {
|
|
218
|
+
useFontBodyReset();
|
|
219
|
+
const whiteLabel = useHostWhiteLabel(host);
|
|
220
|
+
const theme = defaultTheme ?? whiteLabel.theme;
|
|
221
|
+
return /* @__PURE__ */ jsx(WhiteLabelContext.Provider, { value: whiteLabel, children: /* @__PURE__ */ jsx(GuiProvider, { config: lux_config_default, defaultTheme: theme, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient ?? defaultQueryClient, children }) }) });
|
|
222
|
+
};
|
|
223
|
+
function cn(...inputs) {
|
|
224
|
+
return twMerge(clsx(inputs));
|
|
225
|
+
}
|
|
226
|
+
var NARROW_PX = 640;
|
|
227
|
+
var TOUCH_PX = 1024;
|
|
228
|
+
function useBelow(px) {
|
|
229
|
+
const [below, setBelow] = React33.useState(false);
|
|
230
|
+
React33.useEffect(() => {
|
|
231
|
+
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
232
|
+
const apply = () => setBelow(mql.matches);
|
|
233
|
+
apply();
|
|
234
|
+
mql.addEventListener("change", apply);
|
|
235
|
+
return () => mql.removeEventListener("change", apply);
|
|
236
|
+
}, [px]);
|
|
237
|
+
return below;
|
|
238
|
+
}
|
|
239
|
+
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
240
|
+
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
241
|
+
|
|
242
|
+
// src/iam.ts
|
|
243
|
+
var IamError = class extends Error {
|
|
244
|
+
constructor(message, status, unauthenticated) {
|
|
245
|
+
super(message);
|
|
246
|
+
this.name = "IamError";
|
|
247
|
+
this.status = status;
|
|
248
|
+
this.unauthenticated = unauthenticated;
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
252
|
+
function isSignedOut(status, msg) {
|
|
253
|
+
return status === 401 || status === 403 || SIGNED_OUT.test(msg);
|
|
254
|
+
}
|
|
255
|
+
function iamBase(host) {
|
|
256
|
+
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
|
257
|
+
return `${wl.issuer}/v1/iam`;
|
|
258
|
+
}
|
|
259
|
+
async function read(call, verb, params) {
|
|
260
|
+
const url = new URL(`${call.base}/${verb}`);
|
|
261
|
+
for (const [k, v] of Object.entries(params)) url.searchParams.set(k, String(v));
|
|
262
|
+
let res;
|
|
263
|
+
try {
|
|
264
|
+
res = await fetch(url.toString(), {
|
|
265
|
+
method: "GET",
|
|
266
|
+
// The bearer is the whole credential. IAM does not allow credentialed
|
|
267
|
+
// CORS, so sending cookies would only get the response blocked.
|
|
268
|
+
headers: call.token ? { Authorization: `Bearer ${call.token}` } : {},
|
|
269
|
+
signal: call.signal
|
|
270
|
+
});
|
|
271
|
+
} catch (e) {
|
|
272
|
+
throw new IamError(e instanceof Error ? e.message : "IAM unreachable", 0, false);
|
|
273
|
+
}
|
|
274
|
+
const body = await res.json().catch(() => ({}));
|
|
275
|
+
const msg = typeof body.msg === "string" ? body.msg : "";
|
|
276
|
+
if (!res.ok || body.status === "error") {
|
|
277
|
+
throw new IamError(msg || `IAM ${verb} failed (${res.status})`, res.status, isSignedOut(res.status, msg));
|
|
278
|
+
}
|
|
279
|
+
return body.data;
|
|
280
|
+
}
|
|
281
|
+
var IAM_PAGE_SIZE = 20;
|
|
282
|
+
var iam = {
|
|
283
|
+
/** The signed-in principal, or null when there is no session. */
|
|
284
|
+
async account(call) {
|
|
285
|
+
try {
|
|
286
|
+
const data = await read(call, "get-account", {});
|
|
287
|
+
return data && data.name ? data : null;
|
|
288
|
+
} catch (e) {
|
|
289
|
+
if (e instanceof IamError && e.unauthenticated) return null;
|
|
290
|
+
throw e;
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
/**
|
|
294
|
+
* One page of the orgs the principal can see. IAM scopes the read to the
|
|
295
|
+
* caller's authority, so a normal member gets their own org and a super
|
|
296
|
+
* admin gets the tenant list — the page never has to decide.
|
|
297
|
+
*/
|
|
298
|
+
async organizations(call, page = 0, query = "", pageSize = IAM_PAGE_SIZE) {
|
|
299
|
+
const params = {
|
|
300
|
+
owner: "admin",
|
|
301
|
+
// IAM orgs live under the reserved `admin` owner
|
|
302
|
+
p: page + 1,
|
|
303
|
+
// the backend page is 1-based
|
|
304
|
+
pageSize,
|
|
305
|
+
sortField: "name",
|
|
306
|
+
sortOrder: "ascending"
|
|
307
|
+
};
|
|
308
|
+
const q = query.trim();
|
|
309
|
+
if (q) {
|
|
310
|
+
params.field = "name";
|
|
311
|
+
params.value = q;
|
|
312
|
+
}
|
|
313
|
+
return await read(call, "get-organizations", params) ?? [];
|
|
314
|
+
},
|
|
315
|
+
/** One organization by name. */
|
|
316
|
+
async organization(call, name) {
|
|
317
|
+
return await read(call, "get-organization", { id: `admin/${name}` }) ?? null;
|
|
318
|
+
},
|
|
319
|
+
/** Members of an organization. */
|
|
320
|
+
async users(call, org) {
|
|
321
|
+
return await read(call, "get-users", { owner: org }) ?? [];
|
|
322
|
+
},
|
|
323
|
+
/** The organization's projects — IAM keys this read by `organization`. */
|
|
324
|
+
async projects(call, org) {
|
|
325
|
+
return await read(call, "get-organization-projects", { organization: org }) ?? [];
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
var IAM_TOKEN_KEY = "hanzo_iam_access_token";
|
|
329
|
+
function storedToken() {
|
|
330
|
+
if (typeof window === "undefined") return null;
|
|
331
|
+
for (const store of [window.sessionStorage, window.localStorage]) {
|
|
332
|
+
try {
|
|
333
|
+
const t = store.getItem(IAM_TOKEN_KEY);
|
|
334
|
+
if (t) return t;
|
|
335
|
+
} catch {
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
function clearStoredTokens() {
|
|
341
|
+
if (typeof window === "undefined") return;
|
|
342
|
+
for (const store of [window.sessionStorage, window.localStorage]) {
|
|
343
|
+
try {
|
|
344
|
+
for (const k of ["access_token", "refresh_token", "id_token", "expires_at"]) {
|
|
345
|
+
store.removeItem(`hanzo_iam_${k}`);
|
|
346
|
+
}
|
|
347
|
+
} catch {
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
var defaultAuth = {};
|
|
352
|
+
var scopeKey = (host, kind) => `lux-ui:${kind}:${host}`;
|
|
353
|
+
function readScope(host, kind) {
|
|
354
|
+
if (typeof window === "undefined") return null;
|
|
355
|
+
try {
|
|
356
|
+
return window.localStorage.getItem(scopeKey(host, kind));
|
|
357
|
+
} catch {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function writeScope(host, kind, value) {
|
|
362
|
+
if (typeof window === "undefined") return;
|
|
363
|
+
try {
|
|
364
|
+
window.localStorage.setItem(scopeKey(host, kind), value);
|
|
365
|
+
} catch {
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
var IdentityContext = React33.createContext(null);
|
|
369
|
+
var IdentityProvider = ({
|
|
370
|
+
children,
|
|
371
|
+
auth = defaultAuth,
|
|
372
|
+
loginPath = "/login"
|
|
373
|
+
}) => {
|
|
374
|
+
const whiteLabel = useWhiteLabel();
|
|
375
|
+
const base = React33.useMemo(() => iamBase(whiteLabel), [whiteLabel]);
|
|
376
|
+
const [status, setStatus] = React33.useState("loading");
|
|
377
|
+
const [account, setAccount] = React33.useState(null);
|
|
378
|
+
const [orgs, setOrgs] = React33.useState([]);
|
|
379
|
+
const [projects, setProjects] = React33.useState([]);
|
|
380
|
+
const [error, setError] = React33.useState(null);
|
|
381
|
+
const [orgName, setOrgName] = React33.useState(null);
|
|
382
|
+
const [projectName, setProjectName] = React33.useState(null);
|
|
383
|
+
const [epoch, setEpoch] = React33.useState(0);
|
|
384
|
+
React33.useEffect(() => {
|
|
385
|
+
const ac = new AbortController();
|
|
386
|
+
let live = true;
|
|
387
|
+
void (async () => {
|
|
388
|
+
const token = await (auth.token ?? storedToken)();
|
|
389
|
+
if (!live) return;
|
|
390
|
+
if (!token) {
|
|
391
|
+
setStatus("anonymous");
|
|
392
|
+
setAccount(null);
|
|
393
|
+
setOrgs([]);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const call = { base, token, signal: ac.signal };
|
|
397
|
+
try {
|
|
398
|
+
const me = await iam.account(call);
|
|
399
|
+
if (!live) return;
|
|
400
|
+
if (!me) {
|
|
401
|
+
setStatus("anonymous");
|
|
402
|
+
setAccount(null);
|
|
403
|
+
setOrgs([]);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
setAccount(me);
|
|
407
|
+
const rows = await iam.organizations(call).catch((e) => {
|
|
408
|
+
if (e instanceof IamError && !e.unauthenticated) return [{ owner: "admin", name: me.owner }];
|
|
409
|
+
throw e;
|
|
410
|
+
});
|
|
411
|
+
if (!live) return;
|
|
412
|
+
setOrgs(rows);
|
|
413
|
+
setStatus("ready");
|
|
414
|
+
setError(null);
|
|
415
|
+
} catch (e) {
|
|
416
|
+
if (!live || ac.signal.aborted) return;
|
|
417
|
+
if (e instanceof IamError && e.unauthenticated) {
|
|
418
|
+
setStatus("anonymous");
|
|
419
|
+
setAccount(null);
|
|
420
|
+
setOrgs([]);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
setStatus("error");
|
|
424
|
+
setError(e instanceof Error ? e.message : "Could not reach IAM.");
|
|
425
|
+
}
|
|
426
|
+
})();
|
|
427
|
+
return () => {
|
|
428
|
+
live = false;
|
|
429
|
+
ac.abort();
|
|
430
|
+
};
|
|
431
|
+
}, [base, auth, epoch]);
|
|
432
|
+
const org = React33.useMemo(() => {
|
|
433
|
+
if (orgs.length === 0) return null;
|
|
434
|
+
const saved = orgName ?? readScope(whiteLabel.host, "org");
|
|
435
|
+
return orgs.find((o) => o.name === saved) ?? orgs.find((o) => o.name === account?.owner) ?? orgs[0];
|
|
436
|
+
}, [orgs, orgName, account, whiteLabel.host]);
|
|
437
|
+
React33.useEffect(() => {
|
|
438
|
+
if (!org) {
|
|
439
|
+
setProjects([]);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const ac = new AbortController();
|
|
443
|
+
let live = true;
|
|
444
|
+
void (async () => {
|
|
445
|
+
const token = await (auth.token ?? storedToken)();
|
|
446
|
+
if (!live || !token) return;
|
|
447
|
+
const rows = await iam.projects({ base, token, signal: ac.signal }, org.name).catch(() => []);
|
|
448
|
+
if (live) setProjects(rows);
|
|
449
|
+
})();
|
|
450
|
+
return () => {
|
|
451
|
+
live = false;
|
|
452
|
+
ac.abort();
|
|
453
|
+
};
|
|
454
|
+
}, [base, auth, org, epoch]);
|
|
455
|
+
const project = React33.useMemo(() => {
|
|
456
|
+
if (projects.length === 0) return null;
|
|
457
|
+
const saved = projectName ?? readScope(whiteLabel.host, "project");
|
|
458
|
+
return projects.find((p) => p.name === saved) ?? projects.find((p) => p.isDefault) ?? projects[0];
|
|
459
|
+
}, [projects, projectName, whiteLabel.host]);
|
|
460
|
+
const value = React33.useMemo(() => ({
|
|
461
|
+
status,
|
|
462
|
+
account,
|
|
463
|
+
orgs,
|
|
464
|
+
org,
|
|
465
|
+
projects,
|
|
466
|
+
project,
|
|
467
|
+
error,
|
|
468
|
+
whiteLabel,
|
|
469
|
+
setOrg: (name) => {
|
|
470
|
+
writeScope(whiteLabel.host, "org", name);
|
|
471
|
+
setOrgName(name);
|
|
472
|
+
setProjectName(null);
|
|
473
|
+
},
|
|
474
|
+
setProject: (name) => {
|
|
475
|
+
writeScope(whiteLabel.host, "project", name);
|
|
476
|
+
setProjectName(name);
|
|
477
|
+
},
|
|
478
|
+
signIn: () => {
|
|
479
|
+
if (auth.signIn) return auth.signIn();
|
|
480
|
+
if (typeof window !== "undefined") window.location.assign(loginPath);
|
|
481
|
+
},
|
|
482
|
+
signOut: () => {
|
|
483
|
+
if (auth.signOut) return auth.signOut();
|
|
484
|
+
clearStoredTokens();
|
|
485
|
+
if (typeof window !== "undefined") window.location.assign(loginPath);
|
|
486
|
+
},
|
|
487
|
+
reload: () => setEpoch((n) => n + 1)
|
|
488
|
+
}), [status, account, orgs, org, projects, project, error, whiteLabel, auth, loginPath]);
|
|
489
|
+
return /* @__PURE__ */ jsx(IdentityContext.Provider, { value, children });
|
|
490
|
+
};
|
|
491
|
+
function useIdentity() {
|
|
492
|
+
const ctx = React33.useContext(IdentityContext);
|
|
493
|
+
const whiteLabel = useWhiteLabel();
|
|
494
|
+
const fallback = React33.useMemo(() => ({
|
|
495
|
+
status: "anonymous",
|
|
496
|
+
account: null,
|
|
497
|
+
orgs: [],
|
|
498
|
+
org: null,
|
|
499
|
+
projects: [],
|
|
500
|
+
project: null,
|
|
501
|
+
error: null,
|
|
502
|
+
whiteLabel,
|
|
503
|
+
setOrg: () => void 0,
|
|
504
|
+
setProject: () => void 0,
|
|
505
|
+
signIn: () => {
|
|
506
|
+
if (typeof window !== "undefined") window.location.assign("/login");
|
|
507
|
+
},
|
|
508
|
+
signOut: () => void 0,
|
|
509
|
+
reload: () => void 0
|
|
510
|
+
}), [whiteLabel]);
|
|
511
|
+
return ctx ?? fallback;
|
|
512
|
+
}
|
|
513
|
+
var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
|
|
514
|
+
var CloseButtonFrame = styled(View, {
|
|
515
|
+
name: "LuxCloseButton",
|
|
516
|
+
render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
|
|
517
|
+
role: "button",
|
|
518
|
+
cursor: "pointer",
|
|
519
|
+
display: "inline-flex",
|
|
520
|
+
alignItems: "center",
|
|
521
|
+
justifyContent: "center",
|
|
522
|
+
width: 20,
|
|
523
|
+
height: 20,
|
|
524
|
+
minWidth: 0,
|
|
525
|
+
flexShrink: 1,
|
|
526
|
+
padding: 0,
|
|
527
|
+
borderRadius: 4,
|
|
528
|
+
borderWidth: 0,
|
|
529
|
+
overflow: "hidden",
|
|
530
|
+
backgroundColor: "transparent",
|
|
531
|
+
hoverStyle: {
|
|
532
|
+
backgroundColor: "transparent"
|
|
533
|
+
},
|
|
534
|
+
variants: {
|
|
535
|
+
disabled: {
|
|
536
|
+
true: {
|
|
537
|
+
opacity: 0.4,
|
|
538
|
+
pointerEvents: "none"
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
var CLOSE_BUTTON_CLASSES = [
|
|
544
|
+
"text-[var(--closeButton-fg,currentColor)]",
|
|
545
|
+
"hover:text-[var(--hover-color,currentColor)]",
|
|
546
|
+
"disabled:opacity-40"
|
|
547
|
+
].join(" ");
|
|
548
|
+
var CloseButton = React33.forwardRef(function CloseButton2(props, ref) {
|
|
549
|
+
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
550
|
+
return /* @__PURE__ */ jsx(
|
|
551
|
+
CloseButtonFrame,
|
|
552
|
+
{
|
|
553
|
+
ref,
|
|
554
|
+
className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
|
|
555
|
+
...rest,
|
|
556
|
+
children: children ?? /* @__PURE__ */ jsx(
|
|
557
|
+
"svg",
|
|
558
|
+
{
|
|
559
|
+
className: "size-5",
|
|
560
|
+
viewBox: "0 0 20 20",
|
|
561
|
+
fill: "none",
|
|
562
|
+
"aria-hidden": "true",
|
|
563
|
+
children: /* @__PURE__ */ jsx(
|
|
564
|
+
"path",
|
|
565
|
+
{
|
|
566
|
+
d: CLOSE_ICON_PATH,
|
|
567
|
+
fill: "currentColor"
|
|
568
|
+
}
|
|
569
|
+
)
|
|
570
|
+
}
|
|
571
|
+
)
|
|
572
|
+
}
|
|
573
|
+
);
|
|
574
|
+
});
|
|
575
|
+
var DrawerPlacementContext = React33.createContext("right");
|
|
576
|
+
var DrawerSizeContext = React33.createContext("md");
|
|
577
|
+
var DrawerStateContext = React33.createContext({
|
|
578
|
+
open: false,
|
|
579
|
+
setOpen: () => {
|
|
580
|
+
},
|
|
581
|
+
modal: true
|
|
582
|
+
});
|
|
583
|
+
var DrawerRoot = (props) => {
|
|
584
|
+
const {
|
|
585
|
+
children,
|
|
586
|
+
open,
|
|
587
|
+
defaultOpen,
|
|
588
|
+
onOpenChange,
|
|
589
|
+
placement = "right",
|
|
590
|
+
modal = true,
|
|
591
|
+
size = "md"
|
|
592
|
+
} = props;
|
|
593
|
+
const [uncontrolled, setUncontrolled] = React33.useState(defaultOpen ?? false);
|
|
594
|
+
const isControlled = open !== void 0;
|
|
595
|
+
const isOpen = isControlled ? open : uncontrolled;
|
|
596
|
+
const setOpen = React33.useCallback((nextOpen) => {
|
|
597
|
+
if (!isControlled) setUncontrolled(nextOpen);
|
|
598
|
+
onOpenChange?.({ open: nextOpen });
|
|
599
|
+
}, [isControlled, onOpenChange]);
|
|
600
|
+
const state = React33.useMemo(
|
|
601
|
+
() => ({ open: isOpen, setOpen, modal }),
|
|
602
|
+
[isOpen, setOpen, modal]
|
|
603
|
+
);
|
|
604
|
+
return /* @__PURE__ */ jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(DrawerStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(
|
|
605
|
+
RadixDialog.Root,
|
|
606
|
+
{
|
|
607
|
+
open: isOpen,
|
|
608
|
+
onOpenChange: setOpen,
|
|
609
|
+
modal,
|
|
610
|
+
children
|
|
611
|
+
}
|
|
612
|
+
) }) }) });
|
|
613
|
+
};
|
|
614
|
+
var PLACEMENT_CLASSES = {
|
|
615
|
+
right: [
|
|
616
|
+
"inset-y-0 right-0",
|
|
617
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
|
|
618
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
|
|
619
|
+
].join(" "),
|
|
620
|
+
left: [
|
|
621
|
+
"inset-y-0 left-0",
|
|
622
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
|
|
623
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
|
|
624
|
+
].join(" "),
|
|
625
|
+
top: [
|
|
626
|
+
"inset-x-0 top-0",
|
|
627
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
|
|
628
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
|
|
629
|
+
].join(" "),
|
|
630
|
+
bottom: [
|
|
631
|
+
"inset-x-0 bottom-0",
|
|
632
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
|
|
633
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
|
|
634
|
+
].join(" ")
|
|
635
|
+
};
|
|
636
|
+
var SIZE_CLASSES = {
|
|
637
|
+
right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
638
|
+
left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
639
|
+
top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
|
|
640
|
+
bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
|
|
641
|
+
};
|
|
642
|
+
var DrawerContent = React33.forwardRef(
|
|
643
|
+
function DrawerContent2(props, ref) {
|
|
644
|
+
const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
|
|
645
|
+
const placement = React33.useContext(DrawerPlacementContext);
|
|
646
|
+
const size = React33.useContext(DrawerSizeContext);
|
|
647
|
+
const { open, setOpen, modal } = React33.useContext(DrawerStateContext);
|
|
648
|
+
const isNarrow = useIsNarrow();
|
|
649
|
+
if (isNarrow) {
|
|
650
|
+
return /* @__PURE__ */ jsxs(
|
|
651
|
+
Sheet,
|
|
652
|
+
{
|
|
653
|
+
open,
|
|
654
|
+
onOpenChange: setOpen,
|
|
655
|
+
modal,
|
|
656
|
+
dismissOnSnapToBottom: true,
|
|
657
|
+
snapPointsMode: "percent",
|
|
658
|
+
snapPoints: [88],
|
|
659
|
+
transition: "medium",
|
|
660
|
+
children: [
|
|
661
|
+
backdrop && /* @__PURE__ */ jsx(
|
|
662
|
+
Sheet.Overlay,
|
|
663
|
+
{
|
|
664
|
+
transition: "lazy",
|
|
665
|
+
enterStyle: { opacity: 0 },
|
|
666
|
+
exitStyle: { opacity: 0 },
|
|
667
|
+
className: "bg-black/50"
|
|
668
|
+
}
|
|
669
|
+
),
|
|
670
|
+
/* @__PURE__ */ jsx(Sheet.Handle, {}),
|
|
671
|
+
/* @__PURE__ */ jsx(
|
|
672
|
+
Sheet.Frame,
|
|
673
|
+
{
|
|
674
|
+
unstyled: true,
|
|
675
|
+
className: cn(
|
|
676
|
+
"flex flex-col rounded-t-2xl bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)]",
|
|
677
|
+
className
|
|
678
|
+
),
|
|
679
|
+
...rest,
|
|
680
|
+
children
|
|
681
|
+
}
|
|
682
|
+
)
|
|
683
|
+
]
|
|
684
|
+
}
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
688
|
+
backdrop && /* @__PURE__ */ jsx(
|
|
689
|
+
RadixDialog.Overlay,
|
|
690
|
+
{
|
|
691
|
+
className: cn(
|
|
692
|
+
"fixed inset-0 z-50 bg-black/50",
|
|
693
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
694
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
|
|
695
|
+
)
|
|
696
|
+
}
|
|
697
|
+
),
|
|
698
|
+
/* @__PURE__ */ jsx(
|
|
699
|
+
RadixDialog.Content,
|
|
700
|
+
{
|
|
701
|
+
ref,
|
|
702
|
+
className: cn(
|
|
703
|
+
"fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
|
|
704
|
+
PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
|
|
705
|
+
SIZE_CLASSES[placement]?.[size] ?? SIZE_CLASSES.right?.md,
|
|
706
|
+
className
|
|
707
|
+
),
|
|
708
|
+
...rest,
|
|
709
|
+
children
|
|
710
|
+
}
|
|
711
|
+
)
|
|
712
|
+
] });
|
|
713
|
+
if (portalled) {
|
|
714
|
+
return /* @__PURE__ */ jsx(RadixDialog.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
715
|
+
}
|
|
716
|
+
return content;
|
|
717
|
+
}
|
|
718
|
+
);
|
|
719
|
+
var DrawerCloseTrigger = React33.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
720
|
+
return /* @__PURE__ */ jsx(RadixDialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
721
|
+
CloseButton,
|
|
722
|
+
{
|
|
723
|
+
ref,
|
|
724
|
+
className: cn("absolute top-7 right-5", props.className),
|
|
725
|
+
...props
|
|
726
|
+
}
|
|
727
|
+
) });
|
|
728
|
+
});
|
|
729
|
+
var DrawerTrigger = (props) => {
|
|
730
|
+
const { asChild = true, ...rest } = props;
|
|
731
|
+
return /* @__PURE__ */ jsx(RadixDialog.Trigger, { asChild, ...rest });
|
|
732
|
+
};
|
|
733
|
+
var DrawerHeader = React33.forwardRef(
|
|
734
|
+
function DrawerHeader2({ className, ...props }, ref) {
|
|
735
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
|
|
736
|
+
}
|
|
737
|
+
);
|
|
738
|
+
var DrawerBody = React33.forwardRef(
|
|
739
|
+
function DrawerBody2({ className, ...props }, ref) {
|
|
740
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
var DrawerFooter = React33.forwardRef(
|
|
744
|
+
function DrawerFooter2({ className, ...props }, ref) {
|
|
745
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
|
|
746
|
+
}
|
|
747
|
+
);
|
|
748
|
+
var DrawerTitle = RadixDialog.Title;
|
|
749
|
+
var DrawerDescription = RadixDialog.Description;
|
|
750
|
+
var DrawerActionTrigger = RadixDialog.Close;
|
|
751
|
+
function parsePlacement(placement) {
|
|
752
|
+
if (!placement) {
|
|
753
|
+
return { side: "bottom", align: "start" };
|
|
754
|
+
}
|
|
755
|
+
const parts = placement.split("-");
|
|
756
|
+
const side = parts[0] ?? "bottom";
|
|
757
|
+
const alignPart = parts[1];
|
|
758
|
+
let align = "center";
|
|
759
|
+
if (alignPart === "start") {
|
|
760
|
+
align = "start";
|
|
761
|
+
} else if (alignPart === "end") {
|
|
762
|
+
align = "end";
|
|
763
|
+
}
|
|
764
|
+
return { side, align };
|
|
765
|
+
}
|
|
766
|
+
var PositioningContext = React33.createContext({
|
|
767
|
+
side: "bottom",
|
|
768
|
+
align: "start",
|
|
769
|
+
sideOffset: 4,
|
|
770
|
+
alignOffset: 0
|
|
771
|
+
});
|
|
772
|
+
var MenuRoot = (props) => {
|
|
773
|
+
const {
|
|
774
|
+
children,
|
|
775
|
+
open,
|
|
776
|
+
defaultOpen,
|
|
777
|
+
onOpenChange,
|
|
778
|
+
positioning,
|
|
779
|
+
modal = true,
|
|
780
|
+
// lazyMount / unmountOnExit have no direct Radix equivalent; Radix handles
|
|
781
|
+
// mount/unmount automatically.
|
|
782
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
783
|
+
lazyMount: _lazyMount,
|
|
784
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
785
|
+
unmountOnExit: _unmountOnExit
|
|
786
|
+
} = props;
|
|
787
|
+
const mergedPositioning = {
|
|
788
|
+
placement: "bottom-start",
|
|
789
|
+
...positioning,
|
|
790
|
+
offset: {
|
|
791
|
+
mainAxis: 4,
|
|
792
|
+
...positioning?.offset
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
const { side, align } = parsePlacement(mergedPositioning.placement);
|
|
796
|
+
const positioningValue = React33.useMemo(() => ({
|
|
797
|
+
side,
|
|
798
|
+
align,
|
|
799
|
+
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
800
|
+
alignOffset: mergedPositioning.offset?.crossAxis ?? 0
|
|
801
|
+
}), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
|
|
802
|
+
const handleOpenChange = React33.useCallback((isOpen) => {
|
|
803
|
+
onOpenChange?.({ open: isOpen });
|
|
804
|
+
}, [onOpenChange]);
|
|
805
|
+
return /* @__PURE__ */ jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsx(
|
|
806
|
+
DropdownMenu.Root,
|
|
807
|
+
{
|
|
808
|
+
open,
|
|
809
|
+
defaultOpen,
|
|
810
|
+
onOpenChange: handleOpenChange,
|
|
811
|
+
modal,
|
|
812
|
+
children
|
|
813
|
+
}
|
|
814
|
+
) });
|
|
815
|
+
};
|
|
816
|
+
var MenuTrigger = React33.forwardRef(function MenuTrigger2(props, ref) {
|
|
817
|
+
const { asChild = false, ...rest } = props;
|
|
818
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild, ref, ...rest });
|
|
819
|
+
});
|
|
820
|
+
var MenuContent = React33.forwardRef(function MenuContent2(props, ref) {
|
|
821
|
+
const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
|
|
822
|
+
const positioning = React33.useContext(PositioningContext);
|
|
823
|
+
const mergedStyle = {
|
|
824
|
+
...style,
|
|
825
|
+
...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
|
|
826
|
+
...minW !== void 0 ? { minWidth: minW } : {}
|
|
827
|
+
};
|
|
828
|
+
const content = /* @__PURE__ */ jsx(
|
|
829
|
+
DropdownMenu.Content,
|
|
830
|
+
{
|
|
831
|
+
ref,
|
|
832
|
+
side: positioning.side,
|
|
833
|
+
align: positioning.align,
|
|
834
|
+
sideOffset: positioning.sideOffset,
|
|
835
|
+
alignOffset: positioning.alignOffset,
|
|
836
|
+
className: cn(
|
|
837
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-lg p-1",
|
|
838
|
+
"border border-[var(--color-popover-border,var(--color-border-divider))]",
|
|
839
|
+
"bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
|
|
840
|
+
"shadow-[0_4px_12px_var(--color-popover-shadow)]",
|
|
841
|
+
"outline-none",
|
|
842
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
843
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
844
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
845
|
+
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
846
|
+
className
|
|
847
|
+
),
|
|
848
|
+
style: Object.keys(mergedStyle).length > 0 ? mergedStyle : void 0,
|
|
849
|
+
...rest
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
if (!portalled) {
|
|
853
|
+
return content;
|
|
854
|
+
}
|
|
855
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
856
|
+
});
|
|
857
|
+
var MenuItem = React33.forwardRef(function MenuItem2(props, ref) {
|
|
858
|
+
const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
|
|
859
|
+
return /* @__PURE__ */ jsx(
|
|
860
|
+
DropdownMenu.Item,
|
|
861
|
+
{
|
|
862
|
+
ref,
|
|
863
|
+
asChild,
|
|
864
|
+
disabled,
|
|
865
|
+
onClick,
|
|
866
|
+
className: cn(
|
|
867
|
+
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
868
|
+
"outline-none transition-colors",
|
|
869
|
+
"text-[var(--color-text-primary,inherit)]",
|
|
870
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
871
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
872
|
+
className
|
|
873
|
+
),
|
|
874
|
+
...rest,
|
|
875
|
+
children
|
|
876
|
+
}
|
|
877
|
+
);
|
|
878
|
+
});
|
|
879
|
+
var MenuItemText = React33.forwardRef(function MenuItemText2(props, ref) {
|
|
880
|
+
const { className, ...rest } = props;
|
|
881
|
+
return /* @__PURE__ */ jsx("span", { ref, className: cn("flex-1", className), ...rest });
|
|
882
|
+
});
|
|
883
|
+
React33.forwardRef(function MenuItemCommand2(props, ref) {
|
|
884
|
+
const { className, ...rest } = props;
|
|
885
|
+
return /* @__PURE__ */ jsx(
|
|
886
|
+
"span",
|
|
887
|
+
{
|
|
888
|
+
ref,
|
|
889
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
890
|
+
...rest
|
|
891
|
+
}
|
|
892
|
+
);
|
|
893
|
+
});
|
|
894
|
+
var MenuSeparator = React33.forwardRef(function MenuSeparator2(props, ref) {
|
|
895
|
+
const { className, ...rest } = props;
|
|
896
|
+
return /* @__PURE__ */ jsx(
|
|
897
|
+
DropdownMenu.Separator,
|
|
898
|
+
{
|
|
899
|
+
ref,
|
|
900
|
+
className: cn("-mx-1 my-1 h-px bg-[var(--color-border-divider)]", className),
|
|
901
|
+
...rest
|
|
902
|
+
}
|
|
903
|
+
);
|
|
904
|
+
});
|
|
905
|
+
var MenuItemGroup = React33.forwardRef(function MenuItemGroup2(props, ref) {
|
|
906
|
+
const { title, children, className, ...rest } = props;
|
|
907
|
+
return /* @__PURE__ */ jsxs(DropdownMenu.Group, { ref, className, ...rest, children: [
|
|
908
|
+
title && /* @__PURE__ */ jsx(DropdownMenu.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
|
|
909
|
+
children
|
|
910
|
+
] });
|
|
911
|
+
});
|
|
912
|
+
var MenuArrow = React33.forwardRef(function MenuArrow2(props, ref) {
|
|
913
|
+
const { className, ...rest } = props;
|
|
914
|
+
return /* @__PURE__ */ jsx(
|
|
915
|
+
DropdownMenu.Arrow,
|
|
916
|
+
{
|
|
917
|
+
ref,
|
|
918
|
+
className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
|
|
919
|
+
...rest
|
|
920
|
+
}
|
|
921
|
+
);
|
|
922
|
+
});
|
|
923
|
+
var MenuCheckboxItem = React33.forwardRef(function MenuCheckboxItem2(props, ref) {
|
|
924
|
+
const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
|
|
925
|
+
return /* @__PURE__ */ jsxs(
|
|
926
|
+
DropdownMenu.CheckboxItem,
|
|
927
|
+
{
|
|
928
|
+
ref,
|
|
929
|
+
checked,
|
|
930
|
+
onCheckedChange,
|
|
931
|
+
onClick,
|
|
932
|
+
className: cn(
|
|
933
|
+
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
934
|
+
"outline-none transition-colors",
|
|
935
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
936
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
937
|
+
className
|
|
938
|
+
),
|
|
939
|
+
...rest,
|
|
940
|
+
children: [
|
|
941
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
|
|
942
|
+
children
|
|
943
|
+
]
|
|
944
|
+
}
|
|
945
|
+
);
|
|
946
|
+
});
|
|
947
|
+
var MenuRadioItemGroup = React33.forwardRef(function MenuRadioItemGroup2(props, ref) {
|
|
948
|
+
const { value, onValueChange, ...rest } = props;
|
|
949
|
+
return /* @__PURE__ */ jsx(
|
|
950
|
+
DropdownMenu.RadioGroup,
|
|
951
|
+
{
|
|
952
|
+
ref,
|
|
953
|
+
value,
|
|
954
|
+
onValueChange,
|
|
955
|
+
...rest
|
|
956
|
+
}
|
|
957
|
+
);
|
|
958
|
+
});
|
|
959
|
+
var MenuRadioItem = React33.forwardRef(function MenuRadioItem2(props, ref) {
|
|
960
|
+
const { className, children, value, onClick, ...rest } = props;
|
|
961
|
+
const { value: _v, ...radixRest } = rest;
|
|
962
|
+
return /* @__PURE__ */ jsxs(
|
|
963
|
+
DropdownMenu.RadioItem,
|
|
964
|
+
{
|
|
965
|
+
ref,
|
|
966
|
+
value,
|
|
967
|
+
onClick,
|
|
968
|
+
className: cn(
|
|
969
|
+
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
970
|
+
"outline-none transition-colors",
|
|
971
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
972
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
973
|
+
className
|
|
974
|
+
),
|
|
975
|
+
children: [
|
|
976
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
|
|
977
|
+
/* @__PURE__ */ jsx("span", { children })
|
|
978
|
+
]
|
|
979
|
+
}
|
|
980
|
+
);
|
|
981
|
+
});
|
|
982
|
+
React33.forwardRef(function MenuContextTrigger2(props, ref) {
|
|
983
|
+
const { asChild: _asChild, ...rest } = props;
|
|
984
|
+
return /* @__PURE__ */ jsx("span", { ref, ...rest });
|
|
985
|
+
});
|
|
986
|
+
var MenuTriggerItem = React33.forwardRef(function MenuTriggerItem2(props, ref) {
|
|
987
|
+
const { startIcon, children, className, ...rest } = props;
|
|
988
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Sub, { children: /* @__PURE__ */ jsxs(
|
|
989
|
+
DropdownMenu.SubTrigger,
|
|
990
|
+
{
|
|
991
|
+
ref,
|
|
992
|
+
className: cn(
|
|
993
|
+
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
994
|
+
"outline-none transition-colors",
|
|
995
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
996
|
+
className
|
|
997
|
+
),
|
|
998
|
+
...rest,
|
|
999
|
+
children: [
|
|
1000
|
+
startIcon,
|
|
1001
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children }),
|
|
1002
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
1003
|
+
]
|
|
1004
|
+
}
|
|
1005
|
+
) });
|
|
1006
|
+
});
|
|
1007
|
+
function initials(label) {
|
|
1008
|
+
return label.split(/[\s._-]+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2).toUpperCase();
|
|
1009
|
+
}
|
|
1010
|
+
var Monogram = ({ label, logo }) => logo ? /* @__PURE__ */ jsx("img", { src: logo, alt: "", className: "h-5 w-5 shrink-0 rounded object-contain" }) : /* @__PURE__ */ jsx(
|
|
1011
|
+
"span",
|
|
1012
|
+
{
|
|
1013
|
+
"aria-hidden": "true",
|
|
1014
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded bg-[rgba(127,127,127,0.22)] text-[10px] font-bold",
|
|
1015
|
+
children: initials(label)
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
var Row = ({ item, onDone, menu }) => {
|
|
1019
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1020
|
+
item.icon,
|
|
1021
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: item.label }),
|
|
1022
|
+
item.hint ? /* @__PURE__ */ jsx("span", { className: "text-xs opacity-60", children: item.hint }) : null,
|
|
1023
|
+
item.selected ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "h-4 w-4 shrink-0" }) : null
|
|
1024
|
+
] });
|
|
1025
|
+
const className = cn(
|
|
1026
|
+
"flex w-full cursor-pointer select-none items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm",
|
|
1027
|
+
"hover:bg-[rgba(127,127,127,0.14)]",
|
|
1028
|
+
item.danger && "text-[var(--color-text-error,#e5484d)]"
|
|
1029
|
+
);
|
|
1030
|
+
const activate = () => {
|
|
1031
|
+
onDone();
|
|
1032
|
+
item.onSelect?.();
|
|
1033
|
+
};
|
|
1034
|
+
const shared = {
|
|
1035
|
+
"data-testid": `chrome-item-${item.id}`,
|
|
1036
|
+
"aria-current": item.selected ? "true" : void 0,
|
|
1037
|
+
className
|
|
1038
|
+
};
|
|
1039
|
+
const control = item.href ? /* @__PURE__ */ jsx("a", { href: item.href, ...shared, onClick: onDone, children: body }) : /* @__PURE__ */ jsx("button", { type: "button", ...shared, onClick: activate, children: body });
|
|
1040
|
+
return menu ? /* @__PURE__ */ jsx(MenuItem, { value: item.id, asChild: true, children: control }) : control;
|
|
1041
|
+
};
|
|
1042
|
+
var Switcher = ({
|
|
1043
|
+
title,
|
|
1044
|
+
label,
|
|
1045
|
+
icon,
|
|
1046
|
+
items,
|
|
1047
|
+
footer = [],
|
|
1048
|
+
status = "ready",
|
|
1049
|
+
empty = "Nothing here yet.",
|
|
1050
|
+
onSignIn,
|
|
1051
|
+
signInLabel = "Sign in",
|
|
1052
|
+
error,
|
|
1053
|
+
align = "start",
|
|
1054
|
+
testId
|
|
1055
|
+
}) => {
|
|
1056
|
+
const [open, setOpen] = React33.useState(false);
|
|
1057
|
+
const narrow = useIsNarrow();
|
|
1058
|
+
const close = React33.useCallback(() => setOpen(false), []);
|
|
1059
|
+
const message = status === "loading" ? "Loading\u2026" : status === "error" ? error ?? "Could not reach IAM." : status === "anonymous" ? null : items.length === 0 ? empty : null;
|
|
1060
|
+
const rows = status === "anonymous" && onSignIn ? [{ id: "sign-in", label: signInLabel, icon: /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4" }), onSelect: onSignIn }] : status === "ready" ? items : [];
|
|
1061
|
+
const panel = (menu) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1062
|
+
/* @__PURE__ */ jsx("div", { className: "px-2 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-wide opacity-55", children: title }),
|
|
1063
|
+
message ? /* @__PURE__ */ jsx("div", { "data-testid": "chrome-message", className: "px-2 py-2 text-sm opacity-70", children: message }) : null,
|
|
1064
|
+
rows.map((item) => /* @__PURE__ */ jsx(Row, { item, onDone: close, menu }, item.id)),
|
|
1065
|
+
footer.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1066
|
+
menu ? /* @__PURE__ */ jsx(MenuSeparator, { className: "my-1 h-px bg-[var(--color-border-divider,rgba(127,127,127,0.25))]" }) : /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-[var(--color-border-divider,rgba(127,127,127,0.25))]" }),
|
|
1067
|
+
footer.map((item) => /* @__PURE__ */ jsx(Row, { item, onDone: close, menu }, item.id))
|
|
1068
|
+
] }) : null
|
|
1069
|
+
] });
|
|
1070
|
+
const trigger = /* @__PURE__ */ jsxs(
|
|
1071
|
+
"button",
|
|
1072
|
+
{
|
|
1073
|
+
type: "button",
|
|
1074
|
+
"data-testid": testId,
|
|
1075
|
+
"aria-label": title,
|
|
1076
|
+
"aria-haspopup": "menu",
|
|
1077
|
+
"aria-expanded": open,
|
|
1078
|
+
className: cn(
|
|
1079
|
+
"flex max-w-[14rem] items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium",
|
|
1080
|
+
"hover:bg-[rgba(127,127,127,0.14)]"
|
|
1081
|
+
),
|
|
1082
|
+
children: [
|
|
1083
|
+
icon,
|
|
1084
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: label }),
|
|
1085
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0 opacity-60" })
|
|
1086
|
+
]
|
|
1087
|
+
}
|
|
1088
|
+
);
|
|
1089
|
+
if (narrow) {
|
|
1090
|
+
return /* @__PURE__ */ jsxs(DrawerRoot, { open, onOpenChange: (d) => setOpen(d.open), placement: "bottom", size: "md", children: [
|
|
1091
|
+
React33.cloneElement(trigger, { onClick: () => setOpen(true) }),
|
|
1092
|
+
/* @__PURE__ */ jsxs(DrawerContent, { "data-testid": testId ? `${testId}-panel` : void 0, children: [
|
|
1093
|
+
/* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: title }) }),
|
|
1094
|
+
/* @__PURE__ */ jsx(DrawerBody, { children: panel(false) })
|
|
1095
|
+
] })
|
|
1096
|
+
] });
|
|
1097
|
+
}
|
|
1098
|
+
return /* @__PURE__ */ jsxs(
|
|
1099
|
+
MenuRoot,
|
|
1100
|
+
{
|
|
1101
|
+
open,
|
|
1102
|
+
onOpenChange: (d) => setOpen(d.open),
|
|
1103
|
+
positioning: { placement: align === "end" ? "bottom-end" : "bottom-start" },
|
|
1104
|
+
children: [
|
|
1105
|
+
/* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: trigger }),
|
|
1106
|
+
/* @__PURE__ */ jsx(MenuContent, { minW: "16rem", "data-testid": testId ? `${testId}-panel` : void 0, children: panel(true) })
|
|
1107
|
+
]
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
};
|
|
1111
|
+
var OrgSwitcher = () => {
|
|
1112
|
+
const id = useIdentity();
|
|
1113
|
+
return /* @__PURE__ */ jsx(
|
|
1114
|
+
Switcher,
|
|
1115
|
+
{
|
|
1116
|
+
testId: "org-switcher",
|
|
1117
|
+
title: "Organization",
|
|
1118
|
+
label: id.org?.displayName || id.org?.name || id.whiteLabel.name,
|
|
1119
|
+
icon: /* @__PURE__ */ jsx(Monogram, { label: id.org?.displayName || id.org?.name || id.whiteLabel.name, logo: id.org?.logo }),
|
|
1120
|
+
status: id.status,
|
|
1121
|
+
error: id.error,
|
|
1122
|
+
empty: "No organizations for this account.",
|
|
1123
|
+
onSignIn: id.signIn,
|
|
1124
|
+
signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
|
|
1125
|
+
items: id.orgs.map((o) => ({
|
|
1126
|
+
id: o.name,
|
|
1127
|
+
label: o.displayName || o.name,
|
|
1128
|
+
icon: /* @__PURE__ */ jsx(Monogram, { label: o.displayName || o.name, logo: o.logo }),
|
|
1129
|
+
selected: o.name === id.org?.name,
|
|
1130
|
+
onSelect: () => id.setOrg(o.name)
|
|
1131
|
+
}))
|
|
1132
|
+
}
|
|
1133
|
+
);
|
|
1134
|
+
};
|
|
1135
|
+
var ProjectSwitcher = () => {
|
|
1136
|
+
const id = useIdentity();
|
|
1137
|
+
if (id.status === "ready" && id.projects.length === 0) return null;
|
|
1138
|
+
return /* @__PURE__ */ jsx(
|
|
1139
|
+
Switcher,
|
|
1140
|
+
{
|
|
1141
|
+
testId: "project-switcher",
|
|
1142
|
+
title: "Project",
|
|
1143
|
+
label: id.project?.displayName || id.project?.name || "Project",
|
|
1144
|
+
icon: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1145
|
+
status: id.status,
|
|
1146
|
+
error: id.error,
|
|
1147
|
+
empty: "No projects in this organization.",
|
|
1148
|
+
onSignIn: id.signIn,
|
|
1149
|
+
items: id.projects.map((p) => ({
|
|
1150
|
+
id: p.name,
|
|
1151
|
+
label: p.displayName || p.name,
|
|
1152
|
+
icon: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1153
|
+
selected: p.name === id.project?.name,
|
|
1154
|
+
onSelect: () => id.setProject(p.name)
|
|
1155
|
+
}))
|
|
1156
|
+
}
|
|
1157
|
+
);
|
|
58
1158
|
};
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
style.id = FONT_BODY_RESET_ID;
|
|
82
|
-
style.textContent = FONT_BODY_RESET_CSS;
|
|
83
|
-
document.head.appendChild(style);
|
|
84
|
-
}, []);
|
|
1159
|
+
var UserMenu = ({ items = [] }) => {
|
|
1160
|
+
const id = useIdentity();
|
|
1161
|
+
const who = id.account?.displayName || id.account?.email || id.account?.name || "Account";
|
|
1162
|
+
return /* @__PURE__ */ jsx(
|
|
1163
|
+
Switcher,
|
|
1164
|
+
{
|
|
1165
|
+
testId: "user-menu",
|
|
1166
|
+
align: "end",
|
|
1167
|
+
title: id.status === "ready" ? who : "Account",
|
|
1168
|
+
label: id.status === "ready" ? who : "Sign in",
|
|
1169
|
+
icon: id.status === "ready" ? /* @__PURE__ */ jsx(Monogram, { label: who, logo: id.account?.avatar }) : /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1170
|
+
status: id.status,
|
|
1171
|
+
error: id.error,
|
|
1172
|
+
onSignIn: id.signIn,
|
|
1173
|
+
signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
|
|
1174
|
+
items: [
|
|
1175
|
+
{ id: "account", label: id.account?.email || who, icon: /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) },
|
|
1176
|
+
...items
|
|
1177
|
+
],
|
|
1178
|
+
footer: id.status === "ready" ? [{ id: "sign-out", label: "Sign out", danger: true, icon: /* @__PURE__ */ jsx(LogOut, { "aria-hidden": "true", className: "h-4 w-4" }), onSelect: id.signOut }] : []
|
|
1179
|
+
}
|
|
1180
|
+
);
|
|
85
1181
|
};
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
1182
|
+
var SettingsMenu = ({ items = [], href = "/settings" }) => /* @__PURE__ */ jsx(
|
|
1183
|
+
Switcher,
|
|
1184
|
+
{
|
|
1185
|
+
testId: "settings-menu",
|
|
1186
|
+
align: "end",
|
|
1187
|
+
title: "Settings",
|
|
1188
|
+
label: "Settings",
|
|
1189
|
+
icon: /* @__PURE__ */ jsx(Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1190
|
+
items,
|
|
1191
|
+
empty: "No settings on this surface.",
|
|
1192
|
+
footer: [{ id: "all-settings", label: "All settings", href, icon: /* @__PURE__ */ jsx(Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) }]
|
|
1193
|
+
}
|
|
1194
|
+
);
|
|
1195
|
+
var AppNav = ({
|
|
1196
|
+
brand,
|
|
1197
|
+
home = "/",
|
|
1198
|
+
links = [],
|
|
1199
|
+
org = true,
|
|
1200
|
+
project = false,
|
|
1201
|
+
settings,
|
|
1202
|
+
userItems,
|
|
1203
|
+
children
|
|
90
1204
|
}) => {
|
|
91
|
-
|
|
92
|
-
|
|
1205
|
+
const id = useIdentity();
|
|
1206
|
+
const narrow = useIsNarrow();
|
|
1207
|
+
const [menu, setMenu] = React33.useState(false);
|
|
1208
|
+
return /* @__PURE__ */ jsx(
|
|
1209
|
+
"header",
|
|
1210
|
+
{
|
|
1211
|
+
"data-testid": "app-nav",
|
|
1212
|
+
className: "sticky top-0 z-50 border-b border-[var(--color-border-divider,rgba(127,127,127,0.25))] bg-[var(--color-bg-body,inherit)]",
|
|
1213
|
+
children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-14 max-w-7xl items-center gap-2 px-4", children: [
|
|
1214
|
+
narrow && links.length > 0 ? /* @__PURE__ */ jsxs(DrawerRoot, { open: menu, onOpenChange: (d) => setMenu(d.open), placement: "bottom", size: "md", children: [
|
|
1215
|
+
/* @__PURE__ */ jsx(
|
|
1216
|
+
"button",
|
|
1217
|
+
{
|
|
1218
|
+
type: "button",
|
|
1219
|
+
"aria-label": "Menu",
|
|
1220
|
+
"data-testid": "nav-menu",
|
|
1221
|
+
className: "rounded-md p-2 hover:bg-[rgba(127,127,127,0.14)]",
|
|
1222
|
+
onClick: () => setMenu(true),
|
|
1223
|
+
children: /* @__PURE__ */ jsx(Menu, { "aria-hidden": "true", className: "h-5 w-5" })
|
|
1224
|
+
}
|
|
1225
|
+
),
|
|
1226
|
+
/* @__PURE__ */ jsxs(DrawerContent, { "data-testid": "nav-menu-panel", children: [
|
|
1227
|
+
/* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: "Menu" }) }),
|
|
1228
|
+
/* @__PURE__ */ jsx(DrawerBody, { children: links.map((l) => /* @__PURE__ */ jsx(
|
|
1229
|
+
"a",
|
|
1230
|
+
{
|
|
1231
|
+
href: l.href,
|
|
1232
|
+
onClick: () => setMenu(false),
|
|
1233
|
+
"aria-current": l.active ? "page" : void 0,
|
|
1234
|
+
className: "block rounded-md px-2 py-2.5 text-sm hover:bg-[rgba(127,127,127,0.14)]",
|
|
1235
|
+
children: l.label
|
|
1236
|
+
},
|
|
1237
|
+
l.href
|
|
1238
|
+
)) })
|
|
1239
|
+
] })
|
|
1240
|
+
] }) : null,
|
|
1241
|
+
/* @__PURE__ */ jsx("a", { href: home, className: "flex items-center gap-2 font-semibold tracking-tight", children: brand ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1242
|
+
/* @__PURE__ */ jsx(Building2, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1243
|
+
id.whiteLabel.name
|
|
1244
|
+
] }) }),
|
|
1245
|
+
org ? /* @__PURE__ */ jsx(OrgSwitcher, {}) : null,
|
|
1246
|
+
project ? /* @__PURE__ */ jsx(ProjectSwitcher, {}) : null,
|
|
1247
|
+
!narrow && links.length > 0 ? /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-1", children: links.map((l) => /* @__PURE__ */ jsx(
|
|
1248
|
+
"a",
|
|
1249
|
+
{
|
|
1250
|
+
href: l.href,
|
|
1251
|
+
"aria-current": l.active ? "page" : void 0,
|
|
1252
|
+
className: cn(
|
|
1253
|
+
"rounded-md px-3 py-1.5 text-sm font-medium",
|
|
1254
|
+
l.active ? "bg-[rgba(127,127,127,0.14)]" : "opacity-75 hover:opacity-100"
|
|
1255
|
+
),
|
|
1256
|
+
children: l.label
|
|
1257
|
+
},
|
|
1258
|
+
l.href
|
|
1259
|
+
)) }) : null,
|
|
1260
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center justify-end gap-1", children: [
|
|
1261
|
+
children,
|
|
1262
|
+
settings ? /* @__PURE__ */ jsx(SettingsMenu, { items: settings }) : null,
|
|
1263
|
+
/* @__PURE__ */ jsx(UserMenu, { items: userItems })
|
|
1264
|
+
] })
|
|
1265
|
+
] })
|
|
1266
|
+
}
|
|
1267
|
+
);
|
|
93
1268
|
};
|
|
94
|
-
function cn(...inputs) {
|
|
95
|
-
return twMerge(clsx(inputs));
|
|
96
|
-
}
|
|
97
1269
|
var IndicatorIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
98
|
-
var AccordionRoot =
|
|
1270
|
+
var AccordionRoot = React33.forwardRef(
|
|
99
1271
|
function AccordionRoot2(props, ref) {
|
|
100
1272
|
const {
|
|
101
1273
|
multiple: _multiple,
|
|
@@ -114,7 +1286,7 @@ var AccordionRoot = React30.forwardRef(
|
|
|
114
1286
|
borderRadius: _borderRadius,
|
|
115
1287
|
...rest
|
|
116
1288
|
} = props;
|
|
117
|
-
const handleValueChange =
|
|
1289
|
+
const handleValueChange = React33.useCallback(
|
|
118
1290
|
(next) => {
|
|
119
1291
|
onValueChange?.({ value: next });
|
|
120
1292
|
},
|
|
@@ -142,7 +1314,7 @@ var AccordionRoot = React30.forwardRef(
|
|
|
142
1314
|
);
|
|
143
1315
|
}
|
|
144
1316
|
);
|
|
145
|
-
var AccordionItem =
|
|
1317
|
+
var AccordionItem = React33.forwardRef(
|
|
146
1318
|
function AccordionItem2(props, ref) {
|
|
147
1319
|
const { className, as: _as, _first, _last, display: _display, ...rest } = props;
|
|
148
1320
|
return /* @__PURE__ */ jsx(
|
|
@@ -158,7 +1330,7 @@ var AccordionItem = React30.forwardRef(
|
|
|
158
1330
|
);
|
|
159
1331
|
}
|
|
160
1332
|
);
|
|
161
|
-
var AccordionItemTrigger =
|
|
1333
|
+
var AccordionItemTrigger = React33.forwardRef(function AccordionItemTrigger2(props, ref) {
|
|
162
1334
|
const {
|
|
163
1335
|
children,
|
|
164
1336
|
indicatorPlacement: indicatorPlacementProp,
|
|
@@ -223,7 +1395,7 @@ var AccordionItemTrigger = React30.forwardRef(function AccordionItemTrigger2(pro
|
|
|
223
1395
|
}
|
|
224
1396
|
) }) });
|
|
225
1397
|
});
|
|
226
|
-
var AccordionItemContent =
|
|
1398
|
+
var AccordionItemContent = React33.forwardRef(function AccordionItemContent2(props, ref) {
|
|
227
1399
|
const { className, children, pb: _pb, pr: _pr, pl: _pl, w: _w, display: _display, flexDir: _flexDir, rowGap: _rowGap, ...rest } = props;
|
|
228
1400
|
return /* @__PURE__ */ jsx(
|
|
229
1401
|
AccordionPrimitive.Content,
|
|
@@ -241,11 +1413,11 @@ var AccordionItemContent = React30.forwardRef(function AccordionItemContent2(pro
|
|
|
241
1413
|
);
|
|
242
1414
|
});
|
|
243
1415
|
function useAccordion(items) {
|
|
244
|
-
const [value, setValue] =
|
|
245
|
-
const onValueChange =
|
|
1416
|
+
const [value, setValue] = React33.useState([]);
|
|
1417
|
+
const onValueChange = React33.useCallback(({ value: value2 }) => {
|
|
246
1418
|
setValue(value2);
|
|
247
1419
|
}, []);
|
|
248
|
-
const scrollToItemFromUrl =
|
|
1420
|
+
const scrollToItemFromUrl = React33.useCallback(() => {
|
|
249
1421
|
const hash = window.location.hash.replace("#", "");
|
|
250
1422
|
if (!hash) {
|
|
251
1423
|
return;
|
|
@@ -259,7 +1431,7 @@ function useAccordion(items) {
|
|
|
259
1431
|
setValue([itemToScroll.id]);
|
|
260
1432
|
}
|
|
261
1433
|
}, [items]);
|
|
262
|
-
return
|
|
1434
|
+
return React33.useMemo(() => {
|
|
263
1435
|
return {
|
|
264
1436
|
value,
|
|
265
1437
|
onValueChange,
|
|
@@ -267,68 +1439,6 @@ function useAccordion(items) {
|
|
|
267
1439
|
};
|
|
268
1440
|
}, [value, onValueChange, scrollToItemFromUrl]);
|
|
269
1441
|
}
|
|
270
|
-
var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
|
|
271
|
-
var CloseButtonFrame = styled(View, {
|
|
272
|
-
name: "LuxCloseButton",
|
|
273
|
-
render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
|
|
274
|
-
role: "button",
|
|
275
|
-
cursor: "pointer",
|
|
276
|
-
display: "inline-flex",
|
|
277
|
-
alignItems: "center",
|
|
278
|
-
justifyContent: "center",
|
|
279
|
-
width: 20,
|
|
280
|
-
height: 20,
|
|
281
|
-
minWidth: 0,
|
|
282
|
-
flexShrink: 1,
|
|
283
|
-
padding: 0,
|
|
284
|
-
borderRadius: 4,
|
|
285
|
-
borderWidth: 0,
|
|
286
|
-
overflow: "hidden",
|
|
287
|
-
backgroundColor: "transparent",
|
|
288
|
-
hoverStyle: {
|
|
289
|
-
backgroundColor: "transparent"
|
|
290
|
-
},
|
|
291
|
-
variants: {
|
|
292
|
-
disabled: {
|
|
293
|
-
true: {
|
|
294
|
-
opacity: 0.4,
|
|
295
|
-
pointerEvents: "none"
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
var CLOSE_BUTTON_CLASSES = [
|
|
301
|
-
"text-[var(--closeButton-fg,currentColor)]",
|
|
302
|
-
"hover:text-[var(--hover-color,currentColor)]",
|
|
303
|
-
"disabled:opacity-40"
|
|
304
|
-
].join(" ");
|
|
305
|
-
var CloseButton = React30.forwardRef(function CloseButton2(props, ref) {
|
|
306
|
-
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
307
|
-
return /* @__PURE__ */ jsx(
|
|
308
|
-
CloseButtonFrame,
|
|
309
|
-
{
|
|
310
|
-
ref,
|
|
311
|
-
className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
|
|
312
|
-
...rest,
|
|
313
|
-
children: children ?? /* @__PURE__ */ jsx(
|
|
314
|
-
"svg",
|
|
315
|
-
{
|
|
316
|
-
className: "size-5",
|
|
317
|
-
viewBox: "0 0 20 20",
|
|
318
|
-
fill: "none",
|
|
319
|
-
"aria-hidden": "true",
|
|
320
|
-
children: /* @__PURE__ */ jsx(
|
|
321
|
-
"path",
|
|
322
|
-
{
|
|
323
|
-
d: CLOSE_ICON_PATH,
|
|
324
|
-
fill: "currentColor"
|
|
325
|
-
}
|
|
326
|
-
)
|
|
327
|
-
}
|
|
328
|
-
)
|
|
329
|
-
}
|
|
330
|
-
);
|
|
331
|
-
});
|
|
332
1442
|
var SHIM_PROPS = [
|
|
333
1443
|
"w",
|
|
334
1444
|
"h",
|
|
@@ -449,7 +1559,7 @@ var SKELETON_CLASSES = [
|
|
|
449
1559
|
"bg-[length:200%_100%]"
|
|
450
1560
|
].join(" ");
|
|
451
1561
|
var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
|
|
452
|
-
var Skeleton =
|
|
1562
|
+
var Skeleton = React33.forwardRef(
|
|
453
1563
|
function Skeleton2(props, ref) {
|
|
454
1564
|
const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
|
|
455
1565
|
const shimStyle = shimToStyle(props);
|
|
@@ -458,10 +1568,10 @@ var Skeleton = React30.forwardRef(
|
|
|
458
1568
|
const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
|
|
459
1569
|
const htmlRest = stripShims(allRest);
|
|
460
1570
|
if (!loading) {
|
|
461
|
-
if (asChild &&
|
|
1571
|
+
if (asChild && React33.isValidElement(children)) return children;
|
|
462
1572
|
return /* @__PURE__ */ jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
|
|
463
1573
|
}
|
|
464
|
-
if (asChild &&
|
|
1574
|
+
if (asChild && React33.isValidElement(children)) {
|
|
465
1575
|
return /* @__PURE__ */ jsx(
|
|
466
1576
|
Component,
|
|
467
1577
|
{
|
|
@@ -487,7 +1597,7 @@ var Skeleton = React30.forwardRef(
|
|
|
487
1597
|
);
|
|
488
1598
|
}
|
|
489
1599
|
);
|
|
490
|
-
var SkeletonCircle =
|
|
1600
|
+
var SkeletonCircle = React33.forwardRef(
|
|
491
1601
|
function SkeletonCircle2(props, ref) {
|
|
492
1602
|
const { size = 40, loading = true, className, ...rest } = props;
|
|
493
1603
|
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
@@ -503,7 +1613,7 @@ var SkeletonCircle = React30.forwardRef(
|
|
|
503
1613
|
);
|
|
504
1614
|
}
|
|
505
1615
|
);
|
|
506
|
-
var SkeletonText =
|
|
1616
|
+
var SkeletonText = React33.forwardRef(
|
|
507
1617
|
function SkeletonText2(props, ref) {
|
|
508
1618
|
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
509
1619
|
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx(
|
|
@@ -525,7 +1635,7 @@ var STATUS_CLASSES = {
|
|
|
525
1635
|
success: "bg-[var(--color-alert-bg-success)]",
|
|
526
1636
|
error: "bg-[var(--color-alert-bg-error)]"
|
|
527
1637
|
};
|
|
528
|
-
var
|
|
1638
|
+
var SIZE_CLASSES2 = {
|
|
529
1639
|
sm: "gap-2 px-2 py-2 text-xs",
|
|
530
1640
|
md: "gap-2 px-3 py-2 text-base"
|
|
531
1641
|
};
|
|
@@ -533,7 +1643,7 @@ var INDICATOR_SIZE_CLASSES = {
|
|
|
533
1643
|
sm: "w-5 h-5 my-0",
|
|
534
1644
|
md: "w-5 h-5 my-[2px]"
|
|
535
1645
|
};
|
|
536
|
-
var Alert =
|
|
1646
|
+
var Alert = React33.forwardRef(
|
|
537
1647
|
function Alert2(props, ref) {
|
|
538
1648
|
const {
|
|
539
1649
|
title,
|
|
@@ -558,7 +1668,7 @@ var Alert = React30.forwardRef(
|
|
|
558
1668
|
if (_mb !== void 0) shimStyle.marginBottom = typeof _mb === "number" ? `${_mb * 4}px` : _mb;
|
|
559
1669
|
if (_mt !== void 0) shimStyle.marginTop = typeof _mt === "number" ? `${_mt * 4}px` : _mt;
|
|
560
1670
|
const alertStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
|
|
561
|
-
const [isOpen, setIsOpen] =
|
|
1671
|
+
const [isOpen, setIsOpen] = React33.useState(true);
|
|
562
1672
|
const resolvedSize = size ?? "md";
|
|
563
1673
|
const defaultIcon = /* @__PURE__ */ jsx(IndicatorIcon2, { className: "w-5 h-5" });
|
|
564
1674
|
const iconElement = (() => {
|
|
@@ -573,7 +1683,7 @@ var Alert = React30.forwardRef(
|
|
|
573
1683
|
INDICATOR_SIZE_CLASSES[resolvedSize]
|
|
574
1684
|
), children: icon || defaultIcon });
|
|
575
1685
|
})();
|
|
576
|
-
const handleClose =
|
|
1686
|
+
const handleClose = React33.useCallback(() => {
|
|
577
1687
|
setIsOpen(false);
|
|
578
1688
|
onClose?.();
|
|
579
1689
|
}, [onClose]);
|
|
@@ -604,7 +1714,7 @@ var Alert = React30.forwardRef(
|
|
|
604
1714
|
"div",
|
|
605
1715
|
{
|
|
606
1716
|
ref,
|
|
607
|
-
className: cn(ALERT_BASE, STATUS_CLASSES[status],
|
|
1717
|
+
className: cn(ALERT_BASE, STATUS_CLASSES[status], SIZE_CLASSES2[resolvedSize], className),
|
|
608
1718
|
style: alertStyle,
|
|
609
1719
|
...alertRest,
|
|
610
1720
|
children: [
|
|
@@ -634,7 +1744,7 @@ var Alert = React30.forwardRef(
|
|
|
634
1744
|
) });
|
|
635
1745
|
}
|
|
636
1746
|
);
|
|
637
|
-
var
|
|
1747
|
+
var SIZE_CLASSES3 = {
|
|
638
1748
|
xs: "h-6 w-6 text-[10px]",
|
|
639
1749
|
sm: "h-8 w-8 text-xs",
|
|
640
1750
|
md: "h-10 w-10 text-sm",
|
|
@@ -649,11 +1759,11 @@ var VARIANT_CLASSES = {
|
|
|
649
1759
|
};
|
|
650
1760
|
var DEFAULT_SIZE = "md";
|
|
651
1761
|
var DEFAULT_VARIANT = "subtle";
|
|
652
|
-
var AvatarGroupContext =
|
|
1762
|
+
var AvatarGroupContext = React33.createContext({});
|
|
653
1763
|
function useAvatarGroupContext() {
|
|
654
|
-
return
|
|
1764
|
+
return React33.useContext(AvatarGroupContext);
|
|
655
1765
|
}
|
|
656
|
-
var Avatar =
|
|
1766
|
+
var Avatar = React33.forwardRef(
|
|
657
1767
|
function Avatar2(props, ref) {
|
|
658
1768
|
const group = useAvatarGroupContext();
|
|
659
1769
|
const {
|
|
@@ -674,12 +1784,13 @@ var Avatar = React30.forwardRef(
|
|
|
674
1784
|
const variant = variantProp ?? group.variant ?? DEFAULT_VARIANT;
|
|
675
1785
|
const isBorderless = borderless ?? group.borderless ?? false;
|
|
676
1786
|
return /* @__PURE__ */ jsxs(
|
|
677
|
-
|
|
1787
|
+
Avatar$1,
|
|
678
1788
|
{
|
|
679
1789
|
ref,
|
|
1790
|
+
unstyled: true,
|
|
680
1791
|
className: cn(
|
|
681
1792
|
"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full align-middle",
|
|
682
|
-
|
|
1793
|
+
SIZE_CLASSES3[size],
|
|
683
1794
|
VARIANT_CLASSES[variant],
|
|
684
1795
|
!isBorderless && "ring-2 ring-white dark:ring-gray-900",
|
|
685
1796
|
className
|
|
@@ -687,8 +1798,8 @@ var Avatar = React30.forwardRef(
|
|
|
687
1798
|
...rest,
|
|
688
1799
|
children: [
|
|
689
1800
|
/* @__PURE__ */ jsx(AvatarFallback, { name, icon, children: fallback }),
|
|
690
|
-
/* @__PURE__ */ jsx(
|
|
691
|
-
|
|
1801
|
+
src != null && /* @__PURE__ */ jsx(
|
|
1802
|
+
Avatar$1.Image,
|
|
692
1803
|
{
|
|
693
1804
|
className: "h-full w-full rounded-[inherit] object-cover",
|
|
694
1805
|
src,
|
|
@@ -703,13 +1814,14 @@ var Avatar = React30.forwardRef(
|
|
|
703
1814
|
);
|
|
704
1815
|
}
|
|
705
1816
|
);
|
|
706
|
-
var AvatarFallback =
|
|
1817
|
+
var AvatarFallback = React33.forwardRef(
|
|
707
1818
|
function AvatarFallback2(props, ref) {
|
|
708
1819
|
const { name, icon, children, className, ...rest } = props;
|
|
709
1820
|
return /* @__PURE__ */ jsxs(
|
|
710
|
-
|
|
1821
|
+
Avatar$1.Fallback,
|
|
711
1822
|
{
|
|
712
1823
|
ref,
|
|
1824
|
+
unstyled: true,
|
|
713
1825
|
className: cn(
|
|
714
1826
|
"flex h-full w-full items-center justify-center font-medium",
|
|
715
1827
|
className
|
|
@@ -730,10 +1842,10 @@ function getInitials(name) {
|
|
|
730
1842
|
const lastName = names.length > 1 ? names[names.length - 1] : "";
|
|
731
1843
|
return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0);
|
|
732
1844
|
}
|
|
733
|
-
var AvatarGroup =
|
|
1845
|
+
var AvatarGroup = React33.forwardRef(
|
|
734
1846
|
function AvatarGroup2(props, ref) {
|
|
735
1847
|
const { size, variant, borderless, className, ...rest } = props;
|
|
736
|
-
const contextValue =
|
|
1848
|
+
const contextValue = React33.useMemo(
|
|
737
1849
|
() => ({ size, variant, borderless }),
|
|
738
1850
|
[size, variant, borderless]
|
|
739
1851
|
);
|
|
@@ -747,26 +1859,11 @@ var AvatarGroup = React30.forwardRef(
|
|
|
747
1859
|
) });
|
|
748
1860
|
}
|
|
749
1861
|
);
|
|
750
|
-
var LG_BREAKPOINT = 1024;
|
|
751
|
-
function useIsMobile() {
|
|
752
|
-
const [isMobile, setIsMobile] = React30.useState(() => {
|
|
753
|
-
if (typeof window === "undefined") return false;
|
|
754
|
-
return window.innerWidth < LG_BREAKPOINT;
|
|
755
|
-
});
|
|
756
|
-
React30.useEffect(() => {
|
|
757
|
-
const mql = window.matchMedia(`(max-width: ${LG_BREAKPOINT - 1}px)`);
|
|
758
|
-
const handler = (e) => setIsMobile(e.matches);
|
|
759
|
-
setIsMobile(mql.matches);
|
|
760
|
-
mql.addEventListener("change", handler);
|
|
761
|
-
return () => mql.removeEventListener("change", handler);
|
|
762
|
-
}, []);
|
|
763
|
-
return isMobile;
|
|
764
|
-
}
|
|
765
1862
|
function mapPlacement(p) {
|
|
766
1863
|
if (!p) return void 0;
|
|
767
1864
|
return p;
|
|
768
1865
|
}
|
|
769
|
-
var Tooltip =
|
|
1866
|
+
var Tooltip = React33.forwardRef(
|
|
770
1867
|
function Tooltip2(props, ref) {
|
|
771
1868
|
const {
|
|
772
1869
|
showArrow: showArrowProp,
|
|
@@ -785,28 +1882,28 @@ var Tooltip = React30.forwardRef(
|
|
|
785
1882
|
interactive,
|
|
786
1883
|
positioning
|
|
787
1884
|
} = props;
|
|
788
|
-
const [open, setOpen] =
|
|
789
|
-
const timeoutRef =
|
|
790
|
-
const isMobile =
|
|
791
|
-
const handleOpenChange =
|
|
1885
|
+
const [open, setOpen] = React33.useState(defaultOpen);
|
|
1886
|
+
const timeoutRef = React33.useRef(null);
|
|
1887
|
+
const isMobile = useIsTouch();
|
|
1888
|
+
const handleOpenChange = React33.useCallback((nextOpen) => {
|
|
792
1889
|
setOpen(nextOpen);
|
|
793
1890
|
onOpenChange?.({ open: nextOpen });
|
|
794
1891
|
}, [onOpenChange]);
|
|
795
|
-
const handleOpenChangeManual =
|
|
1892
|
+
const handleOpenChangeManual = React33.useCallback((nextOpen) => {
|
|
796
1893
|
timeoutRef.current && window.clearTimeout(timeoutRef.current);
|
|
797
1894
|
timeoutRef.current = window.setTimeout(() => {
|
|
798
1895
|
setOpen(nextOpen);
|
|
799
1896
|
onOpenChange?.({ open: nextOpen });
|
|
800
1897
|
}, nextOpen ? openDelay : closeDelay);
|
|
801
1898
|
}, [closeDelay, openDelay, onOpenChange]);
|
|
802
|
-
const handleClickAway =
|
|
1899
|
+
const handleClickAway = React33.useCallback(() => {
|
|
803
1900
|
handleOpenChangeManual(false);
|
|
804
1901
|
}, [handleOpenChangeManual]);
|
|
805
1902
|
const triggerRef = useClickAway(handleClickAway);
|
|
806
|
-
const handleTriggerClick =
|
|
1903
|
+
const handleTriggerClick = React33.useCallback(() => {
|
|
807
1904
|
handleOpenChangeManual(!open);
|
|
808
1905
|
}, [handleOpenChangeManual, open]);
|
|
809
|
-
const handleContentClick =
|
|
1906
|
+
const handleContentClick = React33.useCallback((event) => {
|
|
810
1907
|
event.stopPropagation();
|
|
811
1908
|
if (interactive) {
|
|
812
1909
|
const closestLink = event.target?.closest("a");
|
|
@@ -815,7 +1912,7 @@ var Tooltip = React30.forwardRef(
|
|
|
815
1912
|
}
|
|
816
1913
|
}
|
|
817
1914
|
}, [interactive, handleOpenChangeManual]);
|
|
818
|
-
|
|
1915
|
+
React33.useEffect(() => {
|
|
819
1916
|
return () => {
|
|
820
1917
|
if (timeoutRef.current) {
|
|
821
1918
|
clearTimeout(timeoutRef.current);
|
|
@@ -887,7 +1984,7 @@ function TruncatedTextTooltip({ label, children }) {
|
|
|
887
1984
|
return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
|
|
888
1985
|
}
|
|
889
1986
|
var BASE_CLASSES = "inline-flex items-center rounded-sm gap-1 font-medium w-fit max-w-full whitespace-nowrap select-text";
|
|
890
|
-
var
|
|
1987
|
+
var SIZE_CLASSES4 = {
|
|
891
1988
|
sm: "text-xs p-1 h-[18px] min-h-[18px]",
|
|
892
1989
|
md: "text-sm px-1 py-0.5 min-h-6",
|
|
893
1990
|
lg: "text-sm px-2 py-1 min-h-7 font-semibold"
|
|
@@ -917,7 +2014,7 @@ var COLOR_PALETTE_CLASSES = {
|
|
|
917
2014
|
bright_pink: "bg-badge-bright-pink-bg text-badge-bright-pink-fg"
|
|
918
2015
|
};
|
|
919
2016
|
var S2 = 4;
|
|
920
|
-
var Badge =
|
|
2017
|
+
var Badge = React33__default.forwardRef(
|
|
921
2018
|
function Badge2(props, ref) {
|
|
922
2019
|
const {
|
|
923
2020
|
loading,
|
|
@@ -957,7 +2054,7 @@ var Badge = React30__default.forwardRef(
|
|
|
957
2054
|
ref,
|
|
958
2055
|
className: cn(
|
|
959
2056
|
BASE_CLASSES,
|
|
960
|
-
|
|
2057
|
+
SIZE_CLASSES4[size],
|
|
961
2058
|
COLOR_PALETTE_CLASSES[colorPalette],
|
|
962
2059
|
className
|
|
963
2060
|
),
|
|
@@ -1166,7 +2263,7 @@ function buildShimStyle(props) {
|
|
|
1166
2263
|
if (props.borderTopRightRadius !== void 0) s.borderTopRightRadius = typeof props.borderTopRightRadius === "number" ? `${props.borderTopRightRadius}px` : props.borderTopRightRadius;
|
|
1167
2264
|
return Object.keys(s).length > 0 ? s : void 0;
|
|
1168
2265
|
}
|
|
1169
|
-
var Button =
|
|
2266
|
+
var Button = React33.forwardRef(
|
|
1170
2267
|
function Button2(props, ref) {
|
|
1171
2268
|
const {
|
|
1172
2269
|
className,
|
|
@@ -1257,7 +2354,7 @@ var Button = React30.forwardRef(
|
|
|
1257
2354
|
return button;
|
|
1258
2355
|
}
|
|
1259
2356
|
);
|
|
1260
|
-
var
|
|
2357
|
+
var SIZE_CLASSES5 = {
|
|
1261
2358
|
"2xs": "px-2 h-5 min-w-5 text-xs rounded-sm gap-1",
|
|
1262
2359
|
xs: "px-2 h-6 min-w-6 text-sm rounded-sm gap-1",
|
|
1263
2360
|
sm: "px-3 h-8 min-w-8 text-sm rounded-md gap-1",
|
|
@@ -1266,9 +2363,9 @@ var SIZE_CLASSES4 = {
|
|
|
1266
2363
|
function buttonVariants(opts) {
|
|
1267
2364
|
const v = opts?.variant ?? "solid";
|
|
1268
2365
|
const s = opts?.size ?? "md";
|
|
1269
|
-
return [BASE_CLASSES2, VARIANT_CLASSES2[v] ?? "",
|
|
2366
|
+
return [BASE_CLASSES2, VARIANT_CLASSES2[v] ?? "", SIZE_CLASSES5[s] ?? ""].filter(Boolean).join(" ");
|
|
1270
2367
|
}
|
|
1271
|
-
var ButtonGroup =
|
|
2368
|
+
var ButtonGroup = React33.forwardRef(
|
|
1272
2369
|
function ButtonGroup2(props, ref) {
|
|
1273
2370
|
const { className, ...rest } = props;
|
|
1274
2371
|
return /* @__PURE__ */ jsx(
|
|
@@ -1282,7 +2379,7 @@ var ButtonGroup = React30.forwardRef(
|
|
|
1282
2379
|
);
|
|
1283
2380
|
}
|
|
1284
2381
|
);
|
|
1285
|
-
var ButtonGroupRadio =
|
|
2382
|
+
var ButtonGroupRadio = React33.forwardRef(
|
|
1286
2383
|
function ButtonGroupRadio2(props, ref) {
|
|
1287
2384
|
const {
|
|
1288
2385
|
children,
|
|
@@ -1294,24 +2391,24 @@ var ButtonGroupRadio = React30.forwardRef(
|
|
|
1294
2391
|
className,
|
|
1295
2392
|
...rest
|
|
1296
2393
|
} = props;
|
|
1297
|
-
const firstChildValue =
|
|
2394
|
+
const firstChildValue = React33.useMemo(() => {
|
|
1298
2395
|
const firstChild = Array.isArray(children) ? children[0] : void 0;
|
|
1299
2396
|
return typeof firstChild?.props.value === "string" ? firstChild.props.value : void 0;
|
|
1300
2397
|
}, [children]);
|
|
1301
|
-
const [value, setValue] =
|
|
1302
|
-
const handleItemClick =
|
|
2398
|
+
const [value, setValue] = React33.useState(defaultValue ?? firstChildValue);
|
|
2399
|
+
const handleItemClick = React33.useCallback((event) => {
|
|
1303
2400
|
const v = event.currentTarget.value;
|
|
1304
2401
|
setValue(v);
|
|
1305
2402
|
onChange?.(v);
|
|
1306
2403
|
}, [onChange]);
|
|
1307
|
-
const clonedChildren =
|
|
1308
|
-
return
|
|
2404
|
+
const clonedChildren = React33.Children.map(children, (child) => {
|
|
2405
|
+
return React33.cloneElement(child, {
|
|
1309
2406
|
onClick: handleItemClick,
|
|
1310
2407
|
selected: value === child.props.value,
|
|
1311
2408
|
variant
|
|
1312
2409
|
});
|
|
1313
2410
|
});
|
|
1314
|
-
const childrenLength =
|
|
2411
|
+
const childrenLength = React33.Children.count(children);
|
|
1315
2412
|
return /* @__PURE__ */ jsx(Skeleton, { loading, children: /* @__PURE__ */ jsx(
|
|
1316
2413
|
"div",
|
|
1317
2414
|
{
|
|
@@ -1331,11 +2428,11 @@ var ButtonGroupRadio = React30.forwardRef(
|
|
|
1331
2428
|
);
|
|
1332
2429
|
var NOOP = () => {
|
|
1333
2430
|
};
|
|
1334
|
-
var CheckboxGroupContext =
|
|
2431
|
+
var CheckboxGroupContext = React33.createContext(null);
|
|
1335
2432
|
function useCheckboxGroupContext() {
|
|
1336
|
-
return
|
|
2433
|
+
return React33.useContext(CheckboxGroupContext);
|
|
1337
2434
|
}
|
|
1338
|
-
var CheckboxGroupBase =
|
|
2435
|
+
var CheckboxGroupBase = React33.forwardRef(
|
|
1339
2436
|
function CheckboxGroup(props, ref) {
|
|
1340
2437
|
const {
|
|
1341
2438
|
children,
|
|
@@ -1347,10 +2444,10 @@ var CheckboxGroupBase = React30.forwardRef(
|
|
|
1347
2444
|
className,
|
|
1348
2445
|
...rest
|
|
1349
2446
|
} = props;
|
|
1350
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
2447
|
+
const [uncontrolledValue, setUncontrolledValue] = React33.useState(defaultValue ?? []);
|
|
1351
2448
|
const isControlled = controlledValue !== void 0;
|
|
1352
2449
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
1353
|
-
const toggle =
|
|
2450
|
+
const toggle = React33.useCallback(
|
|
1354
2451
|
(itemValue) => {
|
|
1355
2452
|
const next = value.includes(itemValue) ? value.filter((v) => v !== itemValue) : [...value, itemValue];
|
|
1356
2453
|
if (!isControlled) {
|
|
@@ -1360,12 +2457,12 @@ var CheckboxGroupBase = React30.forwardRef(
|
|
|
1360
2457
|
},
|
|
1361
2458
|
[value, isControlled, onValueChange]
|
|
1362
2459
|
);
|
|
1363
|
-
|
|
2460
|
+
React33.useEffect(() => {
|
|
1364
2461
|
if (isControlled) {
|
|
1365
2462
|
setUncontrolledValue(controlledValue);
|
|
1366
2463
|
}
|
|
1367
2464
|
}, [isControlled, controlledValue]);
|
|
1368
|
-
const ctx =
|
|
2465
|
+
const ctx = React33.useMemo(() => ({ value, toggle }), [value, toggle]);
|
|
1369
2466
|
return /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
1370
2467
|
"div",
|
|
1371
2468
|
{
|
|
@@ -1383,7 +2480,7 @@ var CheckboxGroupBase = React30.forwardRef(
|
|
|
1383
2480
|
}
|
|
1384
2481
|
);
|
|
1385
2482
|
var CheckboxGroup2 = CheckboxGroupBase;
|
|
1386
|
-
var
|
|
2483
|
+
var SIZE_CLASSES6 = {
|
|
1387
2484
|
sm: {
|
|
1388
2485
|
root: "gap-1.5",
|
|
1389
2486
|
control: "h-3.5 w-3.5 rounded-sm",
|
|
@@ -1423,8 +2520,8 @@ var IndeterminateIcon = ({ className }) => /* @__PURE__ */ jsx(
|
|
|
1423
2520
|
children: /* @__PURE__ */ jsx("path", { d: "M0 0H12V2H0V0Z", fill: "currentColor" })
|
|
1424
2521
|
}
|
|
1425
2522
|
);
|
|
1426
|
-
var CheckboxBase =
|
|
1427
|
-
function Checkbox(props, ref) {
|
|
2523
|
+
var CheckboxBase = React33.forwardRef(
|
|
2524
|
+
function Checkbox$1(props, ref) {
|
|
1428
2525
|
const {
|
|
1429
2526
|
icon,
|
|
1430
2527
|
children,
|
|
@@ -1444,8 +2541,8 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1444
2541
|
...rest
|
|
1445
2542
|
} = props;
|
|
1446
2543
|
const group = useCheckboxGroupContext();
|
|
1447
|
-
const hiddenInputRef =
|
|
1448
|
-
const setHiddenInputRef =
|
|
2544
|
+
const hiddenInputRef = React33.useRef(null);
|
|
2545
|
+
const setHiddenInputRef = React33.useCallback(
|
|
1449
2546
|
(node) => {
|
|
1450
2547
|
hiddenInputRef.current = node;
|
|
1451
2548
|
if (typeof ref === "function") {
|
|
@@ -1458,7 +2555,7 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1458
2555
|
);
|
|
1459
2556
|
const isInGroup = group !== null && value !== void 0;
|
|
1460
2557
|
const groupChecked = isInGroup ? group.value.includes(value) : void 0;
|
|
1461
|
-
const [internalChecked, setInternalChecked] =
|
|
2558
|
+
const [internalChecked, setInternalChecked] = React33.useState(
|
|
1462
2559
|
defaultChecked ?? false
|
|
1463
2560
|
);
|
|
1464
2561
|
const isControlled = checkedProp !== void 0 || isInGroup;
|
|
@@ -1470,7 +2567,7 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1470
2567
|
} else {
|
|
1471
2568
|
checkedState = internalChecked;
|
|
1472
2569
|
}
|
|
1473
|
-
const handleCheckedChange =
|
|
2570
|
+
const handleCheckedChange = React33.useCallback(
|
|
1474
2571
|
(nextChecked) => {
|
|
1475
2572
|
if (readOnly) return;
|
|
1476
2573
|
if (!isControlled) {
|
|
@@ -1493,7 +2590,7 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1493
2590
|
},
|
|
1494
2591
|
[readOnly, isControlled, isInGroup, group, value, onCheckedChange, onChange]
|
|
1495
2592
|
);
|
|
1496
|
-
const sizeClasses2 =
|
|
2593
|
+
const sizeClasses2 = SIZE_CLASSES6[size];
|
|
1497
2594
|
return /* @__PURE__ */ jsxs(
|
|
1498
2595
|
"label",
|
|
1499
2596
|
{
|
|
@@ -1511,8 +2608,9 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1511
2608
|
...rest,
|
|
1512
2609
|
children: [
|
|
1513
2610
|
/* @__PURE__ */ jsx(
|
|
1514
|
-
|
|
2611
|
+
Checkbox,
|
|
1515
2612
|
{
|
|
2613
|
+
unstyled: true,
|
|
1516
2614
|
checked: checkedState,
|
|
1517
2615
|
onCheckedChange: handleCheckedChange,
|
|
1518
2616
|
disabled: disabled || readOnly,
|
|
@@ -1530,7 +2628,7 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1530
2628
|
"transition-colors duration-150",
|
|
1531
2629
|
sizeClasses2.control
|
|
1532
2630
|
),
|
|
1533
|
-
children: icon ?? /* @__PURE__ */ jsx(
|
|
2631
|
+
children: icon ?? /* @__PURE__ */ jsx(Checkbox.Indicator, { className: cn("flex items-center justify-center", sizeClasses2.icon), children: checkedState === "indeterminate" ? /* @__PURE__ */ jsx(IndeterminateIcon, { className: sizeClasses2.icon }) : /* @__PURE__ */ jsx(CheckIcon, { className: sizeClasses2.icon }) })
|
|
1534
2632
|
}
|
|
1535
2633
|
),
|
|
1536
2634
|
/* @__PURE__ */ jsx(
|
|
@@ -1634,7 +2732,7 @@ function resolveSpacing(v) {
|
|
|
1634
2732
|
}
|
|
1635
2733
|
return void 0;
|
|
1636
2734
|
}
|
|
1637
|
-
var Link =
|
|
2735
|
+
var Link = React33__default.forwardRef(
|
|
1638
2736
|
function Link2(props, ref) {
|
|
1639
2737
|
const {
|
|
1640
2738
|
external,
|
|
@@ -1723,7 +2821,7 @@ var Link = React30__default.forwardRef(
|
|
|
1723
2821
|
) });
|
|
1724
2822
|
}
|
|
1725
2823
|
);
|
|
1726
|
-
var LinkBox =
|
|
2824
|
+
var LinkBox = React33__default.forwardRef(
|
|
1727
2825
|
function LinkBox2(props, ref) {
|
|
1728
2826
|
const { className, ...rest } = props;
|
|
1729
2827
|
return /* @__PURE__ */ jsx(
|
|
@@ -1736,7 +2834,7 @@ var LinkBox = React30__default.forwardRef(
|
|
|
1736
2834
|
);
|
|
1737
2835
|
}
|
|
1738
2836
|
);
|
|
1739
|
-
var LinkOverlay =
|
|
2837
|
+
var LinkOverlay = React33__default.forwardRef(
|
|
1740
2838
|
function LinkOverlay2(props, ref) {
|
|
1741
2839
|
const {
|
|
1742
2840
|
children,
|
|
@@ -1817,8 +2915,8 @@ var LinkOverlay = React30__default.forwardRef(
|
|
|
1817
2915
|
}
|
|
1818
2916
|
);
|
|
1819
2917
|
function useUpdateEffect(effect, deps) {
|
|
1820
|
-
const isFirstMount =
|
|
1821
|
-
|
|
2918
|
+
const isFirstMount = React33__default.useRef(true);
|
|
2919
|
+
React33__default.useEffect(() => {
|
|
1822
2920
|
if (isFirstMount.current) {
|
|
1823
2921
|
isFirstMount.current = false;
|
|
1824
2922
|
return;
|
|
@@ -1835,8 +2933,8 @@ function scrollToElement(id) {
|
|
|
1835
2933
|
var CUT_ID = "CollapsibleDetails";
|
|
1836
2934
|
var CollapsibleDetails = (props) => {
|
|
1837
2935
|
const { children, id = CUT_ID, onClick, isExpanded: isExpandedProp = false, text: textProp, loading, noScroll, ...rest } = props;
|
|
1838
|
-
const [isExpanded, setIsExpanded] =
|
|
1839
|
-
const handleClick =
|
|
2936
|
+
const [isExpanded, setIsExpanded] = React33__default.useState(isExpandedProp);
|
|
2937
|
+
const handleClick = React33__default.useCallback((event) => {
|
|
1840
2938
|
setIsExpanded((flag) => !flag);
|
|
1841
2939
|
if (!noScroll) {
|
|
1842
2940
|
scrollToElement(id);
|
|
@@ -1867,11 +2965,11 @@ var CollapsibleDetails = (props) => {
|
|
|
1867
2965
|
var CollapsibleList = (props) => {
|
|
1868
2966
|
const CUT_LENGTH = 3;
|
|
1869
2967
|
const { items, renderItem, triggerProps, cutLength = CUT_LENGTH, text: textProp, defaultExpanded = false, className, ...rest } = props;
|
|
1870
|
-
const [isExpanded, setIsExpanded] =
|
|
1871
|
-
|
|
2968
|
+
const [isExpanded, setIsExpanded] = React33__default.useState(defaultExpanded);
|
|
2969
|
+
React33__default.useEffect(() => {
|
|
1872
2970
|
setIsExpanded(defaultExpanded);
|
|
1873
2971
|
}, [defaultExpanded]);
|
|
1874
|
-
const handleToggle =
|
|
2972
|
+
const handleToggle = React33__default.useCallback(() => {
|
|
1875
2973
|
setIsExpanded((flag) => !flag);
|
|
1876
2974
|
}, []);
|
|
1877
2975
|
const text = isExpanded ? textProp?.[1] ?? "Hide" : textProp?.[0] ?? "Show all";
|
|
@@ -1888,10 +2986,10 @@ var CollapsibleList = (props) => {
|
|
|
1888
2986
|
) })
|
|
1889
2987
|
] }) });
|
|
1890
2988
|
};
|
|
1891
|
-
var ColorModeContext =
|
|
2989
|
+
var ColorModeContext = React33.createContext(void 0);
|
|
1892
2990
|
function ColorModeProvider(props) {
|
|
1893
2991
|
const { children, defaultTheme = "light", value: controlledValue, onValueChange } = props;
|
|
1894
|
-
const [internalMode, setInternalMode] =
|
|
2992
|
+
const [internalMode, setInternalMode] = React33.useState(() => {
|
|
1895
2993
|
if (controlledValue === "dark" || controlledValue === "light") {
|
|
1896
2994
|
return controlledValue;
|
|
1897
2995
|
}
|
|
@@ -1901,7 +2999,7 @@ function ColorModeProvider(props) {
|
|
|
1901
2999
|
return defaultTheme === "dark" ? "dark" : "light";
|
|
1902
3000
|
});
|
|
1903
3001
|
const colorMode = controlledValue === "dark" || controlledValue === "light" ? controlledValue : internalMode;
|
|
1904
|
-
const setColorMode =
|
|
3002
|
+
const setColorMode = React33.useCallback((mode) => {
|
|
1905
3003
|
const resolved = mode === "dark" ? "dark" : "light";
|
|
1906
3004
|
setInternalMode(resolved);
|
|
1907
3005
|
onValueChange?.(resolved);
|
|
@@ -1910,19 +3008,19 @@ function ColorModeProvider(props) {
|
|
|
1910
3008
|
document.documentElement.classList.toggle("light", resolved === "light");
|
|
1911
3009
|
}
|
|
1912
3010
|
}, [onValueChange]);
|
|
1913
|
-
const toggleColorMode =
|
|
3011
|
+
const toggleColorMode = React33.useCallback(() => {
|
|
1914
3012
|
setColorMode(colorMode === "dark" ? "light" : "dark");
|
|
1915
3013
|
}, [colorMode, setColorMode]);
|
|
1916
|
-
const ctx =
|
|
3014
|
+
const ctx = React33.useMemo(
|
|
1917
3015
|
() => ({ colorMode, setColorMode, toggleColorMode }),
|
|
1918
3016
|
[colorMode, setColorMode, toggleColorMode]
|
|
1919
3017
|
);
|
|
1920
3018
|
return /* @__PURE__ */ jsx(ColorModeContext.Provider, { value: ctx, children });
|
|
1921
3019
|
}
|
|
1922
3020
|
function useColorMode() {
|
|
1923
|
-
const ctx =
|
|
3021
|
+
const ctx = React33.useContext(ColorModeContext);
|
|
1924
3022
|
if (!ctx) {
|
|
1925
|
-
const [mode, setMode] =
|
|
3023
|
+
const [mode, setMode] = React33.useState(() => {
|
|
1926
3024
|
if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
|
|
1927
3025
|
return "dark";
|
|
1928
3026
|
}
|
|
@@ -1966,9 +3064,9 @@ function BackToButton({ onClick }) {
|
|
|
1966
3064
|
}
|
|
1967
3065
|
);
|
|
1968
3066
|
}
|
|
1969
|
-
var DialogSizeContext =
|
|
3067
|
+
var DialogSizeContext = React33.createContext({ size: "md" });
|
|
1970
3068
|
function useDialogSizeContext() {
|
|
1971
|
-
return
|
|
3069
|
+
return React33.useContext(DialogSizeContext);
|
|
1972
3070
|
}
|
|
1973
3071
|
var CONTENT_SIZE_MAP = {
|
|
1974
3072
|
sm: "max-w-[400px]",
|
|
@@ -2000,13 +3098,13 @@ var DialogRoot = ({
|
|
|
2000
3098
|
modal = true
|
|
2001
3099
|
// motionPreset is intentionally unused -- kept for API compat
|
|
2002
3100
|
}) => {
|
|
2003
|
-
const handleOpenChange =
|
|
3101
|
+
const handleOpenChange = React33.useCallback(
|
|
2004
3102
|
(nextOpen) => {
|
|
2005
3103
|
onOpenChange?.({ open: nextOpen });
|
|
2006
3104
|
},
|
|
2007
3105
|
[onOpenChange]
|
|
2008
3106
|
);
|
|
2009
|
-
const ctx =
|
|
3107
|
+
const ctx = React33.useMemo(() => ({ size }), [size]);
|
|
2010
3108
|
return /* @__PURE__ */ jsx(DialogSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
2011
3109
|
Dialog,
|
|
2012
3110
|
{
|
|
@@ -2018,7 +3116,7 @@ var DialogRoot = ({
|
|
|
2018
3116
|
}
|
|
2019
3117
|
) });
|
|
2020
3118
|
};
|
|
2021
|
-
var DialogContent =
|
|
3119
|
+
var DialogContent = React33.forwardRef(function DialogContent2(props, ref) {
|
|
2022
3120
|
const {
|
|
2023
3121
|
children,
|
|
2024
3122
|
portalled: _portalled = true,
|
|
@@ -2075,11 +3173,11 @@ var DialogContent = React30.forwardRef(function DialogContent2(props, ref) {
|
|
|
2075
3173
|
)
|
|
2076
3174
|
] });
|
|
2077
3175
|
});
|
|
2078
|
-
var DialogCloseTrigger =
|
|
3176
|
+
var DialogCloseTrigger = React33.forwardRef(function DialogCloseTrigger2(props, ref) {
|
|
2079
3177
|
const { className, ...rest } = props;
|
|
2080
3178
|
return /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
|
|
2081
3179
|
});
|
|
2082
|
-
var DialogHeader =
|
|
3180
|
+
var DialogHeader = React33.forwardRef(function DialogHeader2(props, ref) {
|
|
2083
3181
|
const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
|
|
2084
3182
|
const startElement = startElementProp ?? (onBackToClick ? /* @__PURE__ */ jsx(BackToButton, { onClick: onBackToClick }) : void 0);
|
|
2085
3183
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2109,7 +3207,7 @@ var DialogHeader = React30.forwardRef(function DialogHeader2(props, ref) {
|
|
|
2109
3207
|
}
|
|
2110
3208
|
);
|
|
2111
3209
|
});
|
|
2112
|
-
var DialogBody =
|
|
3210
|
+
var DialogBody = React33.forwardRef(function DialogBody2({ className, pt, display, flexDir, style: styleProp, ...props }, ref) {
|
|
2113
3211
|
const bodyStyle = {
|
|
2114
3212
|
...styleProp,
|
|
2115
3213
|
...pt !== void 0 ? { paddingTop: typeof pt === "number" ? `${pt * 4}px` : pt } : {},
|
|
@@ -2126,7 +3224,7 @@ var DialogBody = React30.forwardRef(function DialogBody2({ className, pt, displa
|
|
|
2126
3224
|
}
|
|
2127
3225
|
);
|
|
2128
3226
|
});
|
|
2129
|
-
var DialogFooter =
|
|
3227
|
+
var DialogFooter = React33.forwardRef(function DialogFooter2({ className, ...props }, ref) {
|
|
2130
3228
|
return /* @__PURE__ */ jsx(
|
|
2131
3229
|
"div",
|
|
2132
3230
|
{
|
|
@@ -2138,138 +3236,15 @@ var DialogFooter = React30.forwardRef(function DialogFooter2({ className, ...pro
|
|
|
2138
3236
|
});
|
|
2139
3237
|
var DialogBackdrop = Dialog.Overlay;
|
|
2140
3238
|
var DialogTitle = Dialog.Title;
|
|
2141
|
-
var DialogDescription = Dialog.Description;
|
|
2142
|
-
var DialogTrigger = Dialog.Trigger;
|
|
2143
|
-
var DialogActionTrigger = Dialog.Close;
|
|
2144
|
-
var DrawerPlacementContext = React30.createContext("right");
|
|
2145
|
-
var DrawerSizeContext = React30.createContext("md");
|
|
2146
|
-
var DrawerRoot = (props) => {
|
|
2147
|
-
const {
|
|
2148
|
-
children,
|
|
2149
|
-
open,
|
|
2150
|
-
defaultOpen,
|
|
2151
|
-
onOpenChange,
|
|
2152
|
-
placement = "right",
|
|
2153
|
-
modal = true,
|
|
2154
|
-
size = "md"
|
|
2155
|
-
} = props;
|
|
2156
|
-
const handleOpenChange = React30.useCallback((nextOpen) => {
|
|
2157
|
-
onOpenChange?.({ open: nextOpen });
|
|
2158
|
-
}, [onOpenChange]);
|
|
2159
|
-
return /* @__PURE__ */ jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(
|
|
2160
|
-
RadixDialog.Root,
|
|
2161
|
-
{
|
|
2162
|
-
open,
|
|
2163
|
-
defaultOpen,
|
|
2164
|
-
onOpenChange: handleOpenChange,
|
|
2165
|
-
modal,
|
|
2166
|
-
children
|
|
2167
|
-
}
|
|
2168
|
-
) }) });
|
|
2169
|
-
};
|
|
2170
|
-
var PLACEMENT_CLASSES = {
|
|
2171
|
-
right: [
|
|
2172
|
-
"inset-y-0 right-0",
|
|
2173
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
|
|
2174
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
|
|
2175
|
-
].join(" "),
|
|
2176
|
-
left: [
|
|
2177
|
-
"inset-y-0 left-0",
|
|
2178
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
|
|
2179
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
|
|
2180
|
-
].join(" "),
|
|
2181
|
-
top: [
|
|
2182
|
-
"inset-x-0 top-0",
|
|
2183
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
|
|
2184
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
|
|
2185
|
-
].join(" "),
|
|
2186
|
-
bottom: [
|
|
2187
|
-
"inset-x-0 bottom-0",
|
|
2188
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
|
|
2189
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
|
|
2190
|
-
].join(" ")
|
|
2191
|
-
};
|
|
2192
|
-
var SIZE_CLASSES6 = {
|
|
2193
|
-
right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
2194
|
-
left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
2195
|
-
top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
|
|
2196
|
-
bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
|
|
2197
|
-
};
|
|
2198
|
-
var DrawerContent = React30.forwardRef(
|
|
2199
|
-
function DrawerContent2(props, ref) {
|
|
2200
|
-
const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
|
|
2201
|
-
const placement = React30.useContext(DrawerPlacementContext);
|
|
2202
|
-
const size = React30.useContext(DrawerSizeContext);
|
|
2203
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2204
|
-
backdrop && /* @__PURE__ */ jsx(
|
|
2205
|
-
RadixDialog.Overlay,
|
|
2206
|
-
{
|
|
2207
|
-
className: cn(
|
|
2208
|
-
"fixed inset-0 z-50 bg-black/50",
|
|
2209
|
-
"data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
2210
|
-
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
|
|
2211
|
-
)
|
|
2212
|
-
}
|
|
2213
|
-
),
|
|
2214
|
-
/* @__PURE__ */ jsx(
|
|
2215
|
-
RadixDialog.Content,
|
|
2216
|
-
{
|
|
2217
|
-
ref,
|
|
2218
|
-
className: cn(
|
|
2219
|
-
"fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
|
|
2220
|
-
PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
|
|
2221
|
-
SIZE_CLASSES6[placement]?.[size] ?? SIZE_CLASSES6.right?.md,
|
|
2222
|
-
className
|
|
2223
|
-
),
|
|
2224
|
-
...rest,
|
|
2225
|
-
children
|
|
2226
|
-
}
|
|
2227
|
-
)
|
|
2228
|
-
] });
|
|
2229
|
-
if (portalled) {
|
|
2230
|
-
return /* @__PURE__ */ jsx(RadixDialog.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
2231
|
-
}
|
|
2232
|
-
return content;
|
|
2233
|
-
}
|
|
2234
|
-
);
|
|
2235
|
-
var DrawerCloseTrigger = React30.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
2236
|
-
return /* @__PURE__ */ jsx(RadixDialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2237
|
-
CloseButton,
|
|
2238
|
-
{
|
|
2239
|
-
ref,
|
|
2240
|
-
className: cn("absolute top-7 right-5", props.className),
|
|
2241
|
-
...props
|
|
2242
|
-
}
|
|
2243
|
-
) });
|
|
2244
|
-
});
|
|
2245
|
-
var DrawerTrigger = (props) => {
|
|
2246
|
-
const { asChild = true, ...rest } = props;
|
|
2247
|
-
return /* @__PURE__ */ jsx(RadixDialog.Trigger, { asChild, ...rest });
|
|
2248
|
-
};
|
|
2249
|
-
var DrawerHeader = React30.forwardRef(
|
|
2250
|
-
function DrawerHeader2({ className, ...props }, ref) {
|
|
2251
|
-
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
|
|
2252
|
-
}
|
|
2253
|
-
);
|
|
2254
|
-
var DrawerBody = React30.forwardRef(
|
|
2255
|
-
function DrawerBody2({ className, ...props }, ref) {
|
|
2256
|
-
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
|
|
2257
|
-
}
|
|
2258
|
-
);
|
|
2259
|
-
var DrawerFooter = React30.forwardRef(
|
|
2260
|
-
function DrawerFooter2({ className, ...props }, ref) {
|
|
2261
|
-
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
|
|
2262
|
-
}
|
|
2263
|
-
);
|
|
2264
|
-
var DrawerTitle = RadixDialog.Title;
|
|
2265
|
-
var DrawerDescription = RadixDialog.Description;
|
|
2266
|
-
var DrawerActionTrigger = RadixDialog.Close;
|
|
3239
|
+
var DialogDescription = Dialog.Description;
|
|
3240
|
+
var DialogTrigger = Dialog.Trigger;
|
|
3241
|
+
var DialogActionTrigger = Dialog.Close;
|
|
2267
3242
|
var apos = "\u2019";
|
|
2268
3243
|
function upperFirst(str) {
|
|
2269
3244
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2270
3245
|
}
|
|
2271
3246
|
var ICONS = {};
|
|
2272
|
-
var EmptyState =
|
|
3247
|
+
var EmptyState = React33.forwardRef(
|
|
2273
3248
|
function EmptyState2(props, ref) {
|
|
2274
3249
|
const { title, description, term, type = "query", icon, children, className, ...rest } = props;
|
|
2275
3250
|
const titleContent = (() => {
|
|
@@ -2329,7 +3304,7 @@ function getComponentDisplayName(type) {
|
|
|
2329
3304
|
if ("displayName" in type) return type.displayName;
|
|
2330
3305
|
return void 0;
|
|
2331
3306
|
}
|
|
2332
|
-
var Field =
|
|
3307
|
+
var Field = React33.forwardRef(
|
|
2333
3308
|
function Field2(props, ref) {
|
|
2334
3309
|
const {
|
|
2335
3310
|
label,
|
|
@@ -2381,14 +3356,14 @@ var Field = React30.forwardRef(
|
|
|
2381
3356
|
}
|
|
2382
3357
|
);
|
|
2383
3358
|
const helperTextElement = helperText ? /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-xs text-[var(--color-text-secondary,theme(colors.gray.400))]", children: helperText }) : null;
|
|
2384
|
-
const child2 =
|
|
3359
|
+
const child2 = React33.Children.only(children);
|
|
2385
3360
|
const isInputGroup = getComponentDisplayName(child2.type) === "InputGroup";
|
|
2386
3361
|
if (isInputGroup) {
|
|
2387
|
-
const inputElement2 =
|
|
2388
|
-
|
|
3362
|
+
const inputElement2 = React33.cloneElement(
|
|
3363
|
+
React33.Children.only(child2.props.children),
|
|
2389
3364
|
injectedProps2
|
|
2390
3365
|
);
|
|
2391
|
-
const groupInputElement =
|
|
3366
|
+
const groupInputElement = React33.cloneElement(
|
|
2392
3367
|
child2,
|
|
2393
3368
|
{},
|
|
2394
3369
|
inputElement2,
|
|
@@ -2411,7 +3386,7 @@ var Field = React30.forwardRef(
|
|
|
2411
3386
|
}
|
|
2412
3387
|
);
|
|
2413
3388
|
}
|
|
2414
|
-
const inputElement =
|
|
3389
|
+
const inputElement = React33.cloneElement(child2, injectedProps2);
|
|
2415
3390
|
return /* @__PURE__ */ jsxs(
|
|
2416
3391
|
"div",
|
|
2417
3392
|
{
|
|
@@ -2433,8 +3408,8 @@ var Field = React30.forwardRef(
|
|
|
2433
3408
|
const injectedProps = {
|
|
2434
3409
|
size
|
|
2435
3410
|
};
|
|
2436
|
-
const child =
|
|
2437
|
-
const clonedChild =
|
|
3411
|
+
const child = React33.Children.only(children);
|
|
3412
|
+
const clonedChild = React33.cloneElement(child, injectedProps);
|
|
2438
3413
|
return /* @__PURE__ */ jsxs(
|
|
2439
3414
|
"div",
|
|
2440
3415
|
{
|
|
@@ -2470,22 +3445,23 @@ var Field = React30.forwardRef(
|
|
|
2470
3445
|
);
|
|
2471
3446
|
}
|
|
2472
3447
|
);
|
|
2473
|
-
var LEVEL_TAG = { "1":
|
|
3448
|
+
var LEVEL_TAG = { "1": H1, "2": H2, "3": H3 };
|
|
2474
3449
|
var LEVEL_CLASSES = {
|
|
2475
3450
|
"1": "text-[18px] leading-[24px] font-medium lg:text-[32px] lg:leading-[40px] lg:tracking-[-0.5px]",
|
|
2476
3451
|
"2": "text-[16px] leading-[24px] font-medium lg:text-[24px] lg:leading-[32px]",
|
|
2477
3452
|
"3": "text-[14px] leading-[20px] font-semibold lg:text-[18px] lg:leading-[24px] lg:font-medium"
|
|
2478
3453
|
};
|
|
2479
3454
|
var BASE_CLASSES4 = "font-heading text-heading";
|
|
2480
|
-
var Heading =
|
|
3455
|
+
var Heading = React33__default.forwardRef(
|
|
2481
3456
|
function Heading2({ level, className, mb, size: _size, style: styleProp, ...rest }, ref) {
|
|
2482
|
-
const Tag3 = level ? LEVEL_TAG[level] :
|
|
3457
|
+
const Tag3 = level ? LEVEL_TAG[level] : H2;
|
|
2483
3458
|
const levelClasses = level ? LEVEL_CLASSES[level] : void 0;
|
|
2484
3459
|
const mergedStyle = mb !== void 0 ? { ...styleProp, marginBottom: typeof mb === "number" ? `${mb * 4}px` : mb } : styleProp;
|
|
2485
3460
|
return /* @__PURE__ */ jsx(
|
|
2486
3461
|
Tag3,
|
|
2487
3462
|
{
|
|
2488
3463
|
ref,
|
|
3464
|
+
unstyled: true,
|
|
2489
3465
|
className: cn(BASE_CLASSES4, levelClasses, className),
|
|
2490
3466
|
style: mergedStyle,
|
|
2491
3467
|
...rest
|
|
@@ -2563,7 +3539,7 @@ var ICON_SIZE_CLASSES = {
|
|
|
2563
3539
|
md: "[&_svg]:size-5"
|
|
2564
3540
|
};
|
|
2565
3541
|
var SP2 = 4;
|
|
2566
|
-
var IconButton =
|
|
3542
|
+
var IconButton = React33.forwardRef(
|
|
2567
3543
|
function IconButton2(props, ref) {
|
|
2568
3544
|
const {
|
|
2569
3545
|
size,
|
|
@@ -2614,7 +3590,7 @@ var IconButton = React30.forwardRef(
|
|
|
2614
3590
|
ref,
|
|
2615
3591
|
size,
|
|
2616
3592
|
disabled: !loadingSkeleton && (loading || disabled) || void 0,
|
|
2617
|
-
render: _as ?
|
|
3593
|
+
render: _as ? React33.createElement(_as) : void 0,
|
|
2618
3594
|
className: combinedClassName,
|
|
2619
3595
|
style: mergedStyle,
|
|
2620
3596
|
...expanded ? { "data-expanded": true } : {},
|
|
@@ -2785,31 +3761,31 @@ function extractStyleProps(props) {
|
|
|
2785
3761
|
}
|
|
2786
3762
|
return { styleProps, rest };
|
|
2787
3763
|
}
|
|
2788
|
-
var
|
|
2789
|
-
function
|
|
3764
|
+
var Image = React33__default.forwardRef(
|
|
3765
|
+
function Image2(props, ref) {
|
|
2790
3766
|
const { fallback, src, onLoad, onError, skeletonWidth, skeletonHeight, alt, className, style: styleProp, ...allRest } = props;
|
|
2791
3767
|
const { styleProps, rest: extraProps } = extractStyleProps(allRest);
|
|
2792
|
-
const [loading, setLoading] =
|
|
2793
|
-
const [error, setError] =
|
|
2794
|
-
const handleLoadError =
|
|
3768
|
+
const [loading, setLoading] = React33__default.useState(true);
|
|
3769
|
+
const [error, setError] = React33__default.useState(false);
|
|
3770
|
+
const handleLoadError = React33__default.useCallback((event) => {
|
|
2795
3771
|
setError(true);
|
|
2796
3772
|
setLoading(false);
|
|
2797
3773
|
onError?.(event);
|
|
2798
3774
|
}, [onError]);
|
|
2799
|
-
const handleLoadSuccess =
|
|
3775
|
+
const handleLoadSuccess = React33__default.useCallback((event) => {
|
|
2800
3776
|
setLoading(false);
|
|
2801
3777
|
onLoad?.(event);
|
|
2802
3778
|
}, [onLoad]);
|
|
2803
3779
|
const passthroughProps = allRest;
|
|
2804
3780
|
if (!src && fallback) {
|
|
2805
|
-
if (
|
|
2806
|
-
return
|
|
3781
|
+
if (React33__default.isValidElement(fallback)) {
|
|
3782
|
+
return React33__default.cloneElement(fallback, passthroughProps);
|
|
2807
3783
|
}
|
|
2808
3784
|
return fallback;
|
|
2809
3785
|
}
|
|
2810
3786
|
if (error) {
|
|
2811
|
-
if (
|
|
2812
|
-
return
|
|
3787
|
+
if (React33__default.isValidElement(fallback)) {
|
|
3788
|
+
return React33__default.cloneElement(fallback, passthroughProps);
|
|
2813
3789
|
}
|
|
2814
3790
|
return fallback;
|
|
2815
3791
|
}
|
|
@@ -2865,9 +3841,9 @@ var INPUT_VARIANT_CLASSES = {
|
|
|
2865
3841
|
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
2866
3842
|
unstyled: "border-0 bg-transparent p-0 h-auto"
|
|
2867
3843
|
};
|
|
2868
|
-
var Input =
|
|
3844
|
+
var Input = React33__default.forwardRef(
|
|
2869
3845
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
2870
|
-
const handleChange =
|
|
3846
|
+
const handleChange = React33__default.useCallback(
|
|
2871
3847
|
(event) => {
|
|
2872
3848
|
onChange?.(event);
|
|
2873
3849
|
onChangeText?.(event.target.value);
|
|
@@ -2875,9 +3851,10 @@ var Input = React30__default.forwardRef(
|
|
|
2875
3851
|
[onChange, onChangeText]
|
|
2876
3852
|
);
|
|
2877
3853
|
return /* @__PURE__ */ jsx(
|
|
2878
|
-
|
|
3854
|
+
Input$1,
|
|
2879
3855
|
{
|
|
2880
3856
|
ref,
|
|
3857
|
+
unstyled: true,
|
|
2881
3858
|
className: cn(INPUT_BASE, INPUT_SIZE_CLASSES[size], INPUT_VARIANT_CLASSES[variant], className),
|
|
2882
3859
|
...rest,
|
|
2883
3860
|
onChange: handleChange
|
|
@@ -2891,7 +3868,7 @@ function getComponentDisplayName2(type) {
|
|
|
2891
3868
|
if ("displayName" in type) return type.displayName;
|
|
2892
3869
|
return void 0;
|
|
2893
3870
|
}
|
|
2894
|
-
var InputGroup =
|
|
3871
|
+
var InputGroup = React33.forwardRef(
|
|
2895
3872
|
function InputGroup2(props, ref) {
|
|
2896
3873
|
const {
|
|
2897
3874
|
startElement,
|
|
@@ -2904,11 +3881,11 @@ var InputGroup = React30.forwardRef(
|
|
|
2904
3881
|
className,
|
|
2905
3882
|
...rest
|
|
2906
3883
|
} = props;
|
|
2907
|
-
const startElementRef =
|
|
2908
|
-
const endElementRef =
|
|
2909
|
-
const groupRef =
|
|
2910
|
-
const [inlinePaddings, setInlinePaddings] =
|
|
2911
|
-
const calculateInlinePaddings =
|
|
3884
|
+
const startElementRef = React33.useRef(null);
|
|
3885
|
+
const endElementRef = React33.useRef(null);
|
|
3886
|
+
const groupRef = React33.useRef(null);
|
|
3887
|
+
const [inlinePaddings, setInlinePaddings] = React33.useState();
|
|
3888
|
+
const calculateInlinePaddings = React33.useCallback(() => {
|
|
2912
3889
|
const startWidth = startElementRef.current?.getBoundingClientRect().width ?? 0;
|
|
2913
3890
|
const endWidth = endElementRef.current?.getBoundingClientRect().width ?? 0;
|
|
2914
3891
|
setInlinePaddings({
|
|
@@ -2916,7 +3893,7 @@ var InputGroup = React30.forwardRef(
|
|
|
2916
3893
|
end: endWidth
|
|
2917
3894
|
});
|
|
2918
3895
|
}, []);
|
|
2919
|
-
|
|
3896
|
+
React33.useEffect(() => {
|
|
2920
3897
|
if (!groupRef.current) return;
|
|
2921
3898
|
let timeoutId;
|
|
2922
3899
|
const intersectionObserver = new IntersectionObserver(
|
|
@@ -2936,7 +3913,7 @@ var InputGroup = React30.forwardRef(
|
|
|
2936
3913
|
}
|
|
2937
3914
|
};
|
|
2938
3915
|
}, [calculateInlinePaddings]);
|
|
2939
|
-
|
|
3916
|
+
React33.useEffect(() => {
|
|
2940
3917
|
calculateInlinePaddings();
|
|
2941
3918
|
const resizeHandler = debounce(calculateInlinePaddings, 300);
|
|
2942
3919
|
const resizeObserver = new ResizeObserver(resizeHandler);
|
|
@@ -2947,7 +3924,7 @@ var InputGroup = React30.forwardRef(
|
|
|
2947
3924
|
resizeObserver.disconnect();
|
|
2948
3925
|
};
|
|
2949
3926
|
}, [calculateInlinePaddings]);
|
|
2950
|
-
const combinedRef =
|
|
3927
|
+
const combinedRef = React33.useCallback((node) => {
|
|
2951
3928
|
groupRef.current = node;
|
|
2952
3929
|
if (typeof ref === "function") {
|
|
2953
3930
|
ref(node);
|
|
@@ -2976,11 +3953,11 @@ var InputGroup = React30.forwardRef(
|
|
|
2976
3953
|
children: startElement
|
|
2977
3954
|
}
|
|
2978
3955
|
),
|
|
2979
|
-
|
|
3956
|
+
React33.Children.map(children, (child) => {
|
|
2980
3957
|
if (getComponentDisplayName2(child.type) !== "FieldInput") {
|
|
2981
3958
|
return child;
|
|
2982
3959
|
}
|
|
2983
|
-
return
|
|
3960
|
+
return React33.cloneElement(child, {
|
|
2984
3961
|
...startElement && { ps: startOffset ?? (inlinePaddings?.start ? `${inlinePaddings.start}px` : void 0) },
|
|
2985
3962
|
...endElement && { pe: endOffset ?? (inlinePaddings?.end ? `${inlinePaddings.end}px` : void 0) },
|
|
2986
3963
|
// hide input value and placeholder for the first render
|
|
@@ -3006,262 +3983,6 @@ var InputGroup = React30.forwardRef(
|
|
|
3006
3983
|
}
|
|
3007
3984
|
);
|
|
3008
3985
|
InputGroup.displayName = "InputGroup";
|
|
3009
|
-
function parsePlacement(placement) {
|
|
3010
|
-
if (!placement) {
|
|
3011
|
-
return { side: "bottom", align: "start" };
|
|
3012
|
-
}
|
|
3013
|
-
const parts = placement.split("-");
|
|
3014
|
-
const side = parts[0] ?? "bottom";
|
|
3015
|
-
const alignPart = parts[1];
|
|
3016
|
-
let align = "center";
|
|
3017
|
-
if (alignPart === "start") {
|
|
3018
|
-
align = "start";
|
|
3019
|
-
} else if (alignPart === "end") {
|
|
3020
|
-
align = "end";
|
|
3021
|
-
}
|
|
3022
|
-
return { side, align };
|
|
3023
|
-
}
|
|
3024
|
-
var PositioningContext = React30.createContext({
|
|
3025
|
-
side: "bottom",
|
|
3026
|
-
align: "start",
|
|
3027
|
-
sideOffset: 4,
|
|
3028
|
-
alignOffset: 0
|
|
3029
|
-
});
|
|
3030
|
-
var MenuRoot = (props) => {
|
|
3031
|
-
const {
|
|
3032
|
-
children,
|
|
3033
|
-
open,
|
|
3034
|
-
defaultOpen,
|
|
3035
|
-
onOpenChange,
|
|
3036
|
-
positioning,
|
|
3037
|
-
modal = true,
|
|
3038
|
-
// lazyMount / unmountOnExit have no direct Radix equivalent; Radix handles
|
|
3039
|
-
// mount/unmount automatically.
|
|
3040
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3041
|
-
lazyMount: _lazyMount,
|
|
3042
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3043
|
-
unmountOnExit: _unmountOnExit
|
|
3044
|
-
} = props;
|
|
3045
|
-
const mergedPositioning = {
|
|
3046
|
-
placement: "bottom-start",
|
|
3047
|
-
...positioning,
|
|
3048
|
-
offset: {
|
|
3049
|
-
mainAxis: 4,
|
|
3050
|
-
...positioning?.offset
|
|
3051
|
-
}
|
|
3052
|
-
};
|
|
3053
|
-
const { side, align } = parsePlacement(mergedPositioning.placement);
|
|
3054
|
-
const positioningValue = React30.useMemo(() => ({
|
|
3055
|
-
side,
|
|
3056
|
-
align,
|
|
3057
|
-
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
3058
|
-
alignOffset: mergedPositioning.offset?.crossAxis ?? 0
|
|
3059
|
-
}), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
|
|
3060
|
-
const handleOpenChange = React30.useCallback((isOpen) => {
|
|
3061
|
-
onOpenChange?.({ open: isOpen });
|
|
3062
|
-
}, [onOpenChange]);
|
|
3063
|
-
return /* @__PURE__ */ jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsx(
|
|
3064
|
-
DropdownMenu.Root,
|
|
3065
|
-
{
|
|
3066
|
-
open,
|
|
3067
|
-
defaultOpen,
|
|
3068
|
-
onOpenChange: handleOpenChange,
|
|
3069
|
-
modal,
|
|
3070
|
-
children
|
|
3071
|
-
}
|
|
3072
|
-
) });
|
|
3073
|
-
};
|
|
3074
|
-
var MenuTrigger = React30.forwardRef(function MenuTrigger2(props, ref) {
|
|
3075
|
-
const { asChild = false, ...rest } = props;
|
|
3076
|
-
return /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild, ref, ...rest });
|
|
3077
|
-
});
|
|
3078
|
-
var MenuContent = React30.forwardRef(function MenuContent2(props, ref) {
|
|
3079
|
-
const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
|
|
3080
|
-
const positioning = React30.useContext(PositioningContext);
|
|
3081
|
-
const mergedStyle = {
|
|
3082
|
-
...style,
|
|
3083
|
-
...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
|
|
3084
|
-
...minW !== void 0 ? { minWidth: minW } : {}
|
|
3085
|
-
};
|
|
3086
|
-
const content = /* @__PURE__ */ jsx(
|
|
3087
|
-
DropdownMenu.Content,
|
|
3088
|
-
{
|
|
3089
|
-
ref,
|
|
3090
|
-
side: positioning.side,
|
|
3091
|
-
align: positioning.align,
|
|
3092
|
-
sideOffset: positioning.sideOffset,
|
|
3093
|
-
alignOffset: positioning.alignOffset,
|
|
3094
|
-
className: cn(
|
|
3095
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-lg p-1",
|
|
3096
|
-
"border border-[var(--color-popover-border,var(--color-border-divider))]",
|
|
3097
|
-
"bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
|
|
3098
|
-
"shadow-[0_4px_12px_var(--color-popover-shadow)]",
|
|
3099
|
-
"outline-none",
|
|
3100
|
-
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
3101
|
-
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
3102
|
-
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
3103
|
-
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
3104
|
-
className
|
|
3105
|
-
),
|
|
3106
|
-
style: Object.keys(mergedStyle).length > 0 ? mergedStyle : void 0,
|
|
3107
|
-
...rest
|
|
3108
|
-
}
|
|
3109
|
-
);
|
|
3110
|
-
if (!portalled) {
|
|
3111
|
-
return content;
|
|
3112
|
-
}
|
|
3113
|
-
return /* @__PURE__ */ jsx(DropdownMenu.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
3114
|
-
});
|
|
3115
|
-
var MenuItem = React30.forwardRef(function MenuItem2(props, ref) {
|
|
3116
|
-
const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
|
|
3117
|
-
return /* @__PURE__ */ jsx(
|
|
3118
|
-
DropdownMenu.Item,
|
|
3119
|
-
{
|
|
3120
|
-
ref,
|
|
3121
|
-
asChild,
|
|
3122
|
-
disabled,
|
|
3123
|
-
onClick,
|
|
3124
|
-
className: cn(
|
|
3125
|
-
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
3126
|
-
"outline-none transition-colors",
|
|
3127
|
-
"text-[var(--color-text-primary,inherit)]",
|
|
3128
|
-
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
3129
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3130
|
-
className
|
|
3131
|
-
),
|
|
3132
|
-
...rest,
|
|
3133
|
-
children
|
|
3134
|
-
}
|
|
3135
|
-
);
|
|
3136
|
-
});
|
|
3137
|
-
var MenuItemText = React30.forwardRef(function MenuItemText2(props, ref) {
|
|
3138
|
-
const { className, ...rest } = props;
|
|
3139
|
-
return /* @__PURE__ */ jsx("span", { ref, className: cn("flex-1", className), ...rest });
|
|
3140
|
-
});
|
|
3141
|
-
React30.forwardRef(function MenuItemCommand2(props, ref) {
|
|
3142
|
-
const { className, ...rest } = props;
|
|
3143
|
-
return /* @__PURE__ */ jsx(
|
|
3144
|
-
"span",
|
|
3145
|
-
{
|
|
3146
|
-
ref,
|
|
3147
|
-
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
3148
|
-
...rest
|
|
3149
|
-
}
|
|
3150
|
-
);
|
|
3151
|
-
});
|
|
3152
|
-
var MenuSeparator = React30.forwardRef(function MenuSeparator2(props, ref) {
|
|
3153
|
-
const { className, ...rest } = props;
|
|
3154
|
-
return /* @__PURE__ */ jsx(
|
|
3155
|
-
DropdownMenu.Separator,
|
|
3156
|
-
{
|
|
3157
|
-
ref,
|
|
3158
|
-
className: cn("-mx-1 my-1 h-px bg-[var(--color-border-divider)]", className),
|
|
3159
|
-
...rest
|
|
3160
|
-
}
|
|
3161
|
-
);
|
|
3162
|
-
});
|
|
3163
|
-
var MenuItemGroup = React30.forwardRef(function MenuItemGroup2(props, ref) {
|
|
3164
|
-
const { title, children, className, ...rest } = props;
|
|
3165
|
-
return /* @__PURE__ */ jsxs(DropdownMenu.Group, { ref, className, ...rest, children: [
|
|
3166
|
-
title && /* @__PURE__ */ jsx(DropdownMenu.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
|
|
3167
|
-
children
|
|
3168
|
-
] });
|
|
3169
|
-
});
|
|
3170
|
-
var MenuArrow = React30.forwardRef(function MenuArrow2(props, ref) {
|
|
3171
|
-
const { className, ...rest } = props;
|
|
3172
|
-
return /* @__PURE__ */ jsx(
|
|
3173
|
-
DropdownMenu.Arrow,
|
|
3174
|
-
{
|
|
3175
|
-
ref,
|
|
3176
|
-
className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
|
|
3177
|
-
...rest
|
|
3178
|
-
}
|
|
3179
|
-
);
|
|
3180
|
-
});
|
|
3181
|
-
var MenuCheckboxItem = React30.forwardRef(function MenuCheckboxItem2(props, ref) {
|
|
3182
|
-
const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
|
|
3183
|
-
return /* @__PURE__ */ jsxs(
|
|
3184
|
-
DropdownMenu.CheckboxItem,
|
|
3185
|
-
{
|
|
3186
|
-
ref,
|
|
3187
|
-
checked,
|
|
3188
|
-
onCheckedChange,
|
|
3189
|
-
onClick,
|
|
3190
|
-
className: cn(
|
|
3191
|
-
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
3192
|
-
"outline-none transition-colors",
|
|
3193
|
-
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
3194
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3195
|
-
className
|
|
3196
|
-
),
|
|
3197
|
-
...rest,
|
|
3198
|
-
children: [
|
|
3199
|
-
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ jsx(LuCheck, { className: "h-4 w-4" }) }) }),
|
|
3200
|
-
children
|
|
3201
|
-
]
|
|
3202
|
-
}
|
|
3203
|
-
);
|
|
3204
|
-
});
|
|
3205
|
-
var MenuRadioItemGroup = React30.forwardRef(function MenuRadioItemGroup2(props, ref) {
|
|
3206
|
-
const { value, onValueChange, ...rest } = props;
|
|
3207
|
-
return /* @__PURE__ */ jsx(
|
|
3208
|
-
DropdownMenu.RadioGroup,
|
|
3209
|
-
{
|
|
3210
|
-
ref,
|
|
3211
|
-
value,
|
|
3212
|
-
onValueChange,
|
|
3213
|
-
...rest
|
|
3214
|
-
}
|
|
3215
|
-
);
|
|
3216
|
-
});
|
|
3217
|
-
var MenuRadioItem = React30.forwardRef(function MenuRadioItem2(props, ref) {
|
|
3218
|
-
const { className, children, value, onClick, ...rest } = props;
|
|
3219
|
-
const { value: _v, ...radixRest } = rest;
|
|
3220
|
-
return /* @__PURE__ */ jsxs(
|
|
3221
|
-
DropdownMenu.RadioItem,
|
|
3222
|
-
{
|
|
3223
|
-
ref,
|
|
3224
|
-
value,
|
|
3225
|
-
onClick,
|
|
3226
|
-
className: cn(
|
|
3227
|
-
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
3228
|
-
"outline-none transition-colors",
|
|
3229
|
-
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
3230
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3231
|
-
className
|
|
3232
|
-
),
|
|
3233
|
-
children: [
|
|
3234
|
-
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ jsx(LuCheck, { className: "h-4 w-4" }) }) }),
|
|
3235
|
-
/* @__PURE__ */ jsx("span", { children })
|
|
3236
|
-
]
|
|
3237
|
-
}
|
|
3238
|
-
);
|
|
3239
|
-
});
|
|
3240
|
-
React30.forwardRef(function MenuContextTrigger2(props, ref) {
|
|
3241
|
-
const { asChild: _asChild, ...rest } = props;
|
|
3242
|
-
return /* @__PURE__ */ jsx("span", { ref, ...rest });
|
|
3243
|
-
});
|
|
3244
|
-
var MenuTriggerItem = React30.forwardRef(function MenuTriggerItem2(props, ref) {
|
|
3245
|
-
const { startIcon, children, className, ...rest } = props;
|
|
3246
|
-
return /* @__PURE__ */ jsx(DropdownMenu.Sub, { children: /* @__PURE__ */ jsxs(
|
|
3247
|
-
DropdownMenu.SubTrigger,
|
|
3248
|
-
{
|
|
3249
|
-
ref,
|
|
3250
|
-
className: cn(
|
|
3251
|
-
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
3252
|
-
"outline-none transition-colors",
|
|
3253
|
-
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
3254
|
-
className
|
|
3255
|
-
),
|
|
3256
|
-
...rest,
|
|
3257
|
-
children: [
|
|
3258
|
-
startIcon,
|
|
3259
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1", children }),
|
|
3260
|
-
/* @__PURE__ */ jsx(LuChevronRight, { className: "h-4 w-4" })
|
|
3261
|
-
]
|
|
3262
|
-
}
|
|
3263
|
-
) });
|
|
3264
|
-
});
|
|
3265
3986
|
var INPUT_BASE2 = [
|
|
3266
3987
|
"w-10 h-10",
|
|
3267
3988
|
"text-center text-sm font-medium",
|
|
@@ -3276,7 +3997,7 @@ var INPUT_BASE2 = [
|
|
|
3276
3997
|
].join(" ");
|
|
3277
3998
|
var INPUT_FILLED = "border-[var(--color-input-border)]";
|
|
3278
3999
|
var INPUT_INVALID = "border-[var(--color-border-error)] hover:border-[var(--color-border-error)]";
|
|
3279
|
-
var PinInput =
|
|
4000
|
+
var PinInput = React33.forwardRef(
|
|
3280
4001
|
function PinInput2(props, ref) {
|
|
3281
4002
|
const {
|
|
3282
4003
|
count = 6,
|
|
@@ -3294,12 +4015,12 @@ var PinInput = React30.forwardRef(
|
|
|
3294
4015
|
bgColor,
|
|
3295
4016
|
className
|
|
3296
4017
|
} = props;
|
|
3297
|
-
const inputRefs =
|
|
3298
|
-
const values =
|
|
4018
|
+
const inputRefs = React33.useRef([]);
|
|
4019
|
+
const values = React33.useMemo(
|
|
3299
4020
|
() => controlledValue ?? Array.from({ length: count }).fill(""),
|
|
3300
4021
|
[controlledValue, count]
|
|
3301
4022
|
);
|
|
3302
|
-
const updateValue =
|
|
4023
|
+
const updateValue = React33.useCallback((index, char) => {
|
|
3303
4024
|
const next = [...values];
|
|
3304
4025
|
next[index] = char;
|
|
3305
4026
|
onValueChange?.({ value: next });
|
|
@@ -3307,11 +4028,11 @@ var PinInput = React30.forwardRef(
|
|
|
3307
4028
|
onValueComplete?.({ value: next });
|
|
3308
4029
|
}
|
|
3309
4030
|
}, [values, onValueChange, onValueComplete]);
|
|
3310
|
-
const focusInput =
|
|
4031
|
+
const focusInput = React33.useCallback((index) => {
|
|
3311
4032
|
const clamped = Math.max(0, Math.min(index, count - 1));
|
|
3312
4033
|
inputRefs.current[clamped]?.focus();
|
|
3313
4034
|
}, [count]);
|
|
3314
|
-
const handleInput =
|
|
4035
|
+
const handleInput = React33.useCallback((index, e) => {
|
|
3315
4036
|
const target = e.currentTarget;
|
|
3316
4037
|
const char = target.value.slice(-1);
|
|
3317
4038
|
updateValue(index, char);
|
|
@@ -3319,7 +4040,7 @@ var PinInput = React30.forwardRef(
|
|
|
3319
4040
|
focusInput(index + 1);
|
|
3320
4041
|
}
|
|
3321
4042
|
}, [count, updateValue, focusInput]);
|
|
3322
|
-
const handleKeyDown =
|
|
4043
|
+
const handleKeyDown = React33.useCallback((index, e) => {
|
|
3323
4044
|
if (e.key === "Backspace") {
|
|
3324
4045
|
if (values[index]) {
|
|
3325
4046
|
updateValue(index, "");
|
|
@@ -3336,7 +4057,7 @@ var PinInput = React30.forwardRef(
|
|
|
3336
4057
|
e.preventDefault();
|
|
3337
4058
|
}
|
|
3338
4059
|
}, [count, values, updateValue, focusInput]);
|
|
3339
|
-
const handlePaste =
|
|
4060
|
+
const handlePaste = React33.useCallback((e) => {
|
|
3340
4061
|
e.preventDefault();
|
|
3341
4062
|
const pasted = e.clipboardData.getData("text/plain").trim();
|
|
3342
4063
|
if (!pasted) {
|
|
@@ -3353,18 +4074,18 @@ var PinInput = React30.forwardRef(
|
|
|
3353
4074
|
}
|
|
3354
4075
|
focusInput(Math.min(chars.length, count - 1));
|
|
3355
4076
|
}, [count, values, onValueChange, onValueComplete, focusInput]);
|
|
3356
|
-
const handleFocus =
|
|
4077
|
+
const handleFocus = React33.useCallback((e) => {
|
|
3357
4078
|
e.currentTarget.select();
|
|
3358
4079
|
}, []);
|
|
3359
|
-
const handleNoop =
|
|
4080
|
+
const handleNoop = React33.useCallback(() => {
|
|
3360
4081
|
}, []);
|
|
3361
|
-
const setInputRef =
|
|
4082
|
+
const setInputRef = React33.useCallback((index) => (el) => {
|
|
3362
4083
|
inputRefs.current[index] = el;
|
|
3363
4084
|
}, []);
|
|
3364
|
-
const onInputAtIndex =
|
|
4085
|
+
const onInputAtIndex = React33.useCallback((index) => (e) => {
|
|
3365
4086
|
handleInput(index, e);
|
|
3366
4087
|
}, [handleInput]);
|
|
3367
|
-
const onKeyDownAtIndex =
|
|
4088
|
+
const onKeyDownAtIndex = React33.useCallback((index) => (e) => {
|
|
3368
4089
|
handleKeyDown(index, e);
|
|
3369
4090
|
}, [handleKeyDown]);
|
|
3370
4091
|
const bgStyle = bgColor ? { backgroundColor: `var(--color-${bgColor.replace(/\./g, "-")})` } : void 0;
|
|
@@ -3425,7 +4146,7 @@ function parsePlacement2(placement) {
|
|
|
3425
4146
|
}
|
|
3426
4147
|
return { side, align };
|
|
3427
4148
|
}
|
|
3428
|
-
var PositioningContext2 =
|
|
4149
|
+
var PositioningContext2 = React33.createContext({
|
|
3429
4150
|
side: "bottom",
|
|
3430
4151
|
align: "start",
|
|
3431
4152
|
sideOffset: 4,
|
|
@@ -3459,7 +4180,7 @@ var PopoverRoot = (props) => {
|
|
|
3459
4180
|
}
|
|
3460
4181
|
};
|
|
3461
4182
|
const { side, align } = parsePlacement2(mergedPositioning.placement);
|
|
3462
|
-
const positioningValue =
|
|
4183
|
+
const positioningValue = React33.useMemo(() => ({
|
|
3463
4184
|
side,
|
|
3464
4185
|
align,
|
|
3465
4186
|
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
@@ -3476,7 +4197,7 @@ var PopoverRoot = (props) => {
|
|
|
3476
4197
|
autoFocus,
|
|
3477
4198
|
closeOnInteractOutside
|
|
3478
4199
|
]);
|
|
3479
|
-
const handleOpenChange =
|
|
4200
|
+
const handleOpenChange = React33.useCallback((isOpen) => {
|
|
3480
4201
|
onOpenChange?.({ open: isOpen });
|
|
3481
4202
|
}, [onOpenChange]);
|
|
3482
4203
|
const placement = mergedPositioning.placement ?? "bottom-start";
|
|
@@ -3494,11 +4215,11 @@ var PopoverRoot = (props) => {
|
|
|
3494
4215
|
}
|
|
3495
4216
|
) });
|
|
3496
4217
|
};
|
|
3497
|
-
var PopoverTrigger =
|
|
4218
|
+
var PopoverTrigger = React33.forwardRef(function PopoverTrigger2(props, ref) {
|
|
3498
4219
|
const { asChild = true, ...rest } = props;
|
|
3499
4220
|
return /* @__PURE__ */ jsx(Popover.Trigger, { asChild: asChild ? "except-style" : void 0, ref, ...rest });
|
|
3500
4221
|
});
|
|
3501
|
-
var PopoverContent =
|
|
4222
|
+
var PopoverContent = React33.forwardRef(function PopoverContent2(props, ref) {
|
|
3502
4223
|
const { portalled = true, portalRef: _portalRef, className, w, minW, maxW, paddingTop, style: styleProp, ...rest } = props;
|
|
3503
4224
|
const resolvedW = typeof w === "object" ? w.base ?? w.lg : w;
|
|
3504
4225
|
const contentStyle = {
|
|
@@ -3529,7 +4250,7 @@ var PopoverContent = React30.forwardRef(function PopoverContent2(props, ref) {
|
|
|
3529
4250
|
}
|
|
3530
4251
|
);
|
|
3531
4252
|
});
|
|
3532
|
-
var PopoverArrow =
|
|
4253
|
+
var PopoverArrow = React33.forwardRef(function PopoverArrow2(props, ref) {
|
|
3533
4254
|
const { className, ...rest } = props;
|
|
3534
4255
|
return /* @__PURE__ */ jsx(
|
|
3535
4256
|
Popover.Arrow,
|
|
@@ -3541,7 +4262,7 @@ var PopoverArrow = React30.forwardRef(function PopoverArrow2(props, ref) {
|
|
|
3541
4262
|
}
|
|
3542
4263
|
);
|
|
3543
4264
|
});
|
|
3544
|
-
var PopoverCloseTrigger =
|
|
4265
|
+
var PopoverCloseTrigger = React33.forwardRef(function PopoverCloseTrigger2(props, ref) {
|
|
3545
4266
|
const { className, ...rest } = props;
|
|
3546
4267
|
return /* @__PURE__ */ jsx(
|
|
3547
4268
|
Popover.Close,
|
|
@@ -3555,14 +4276,14 @@ var PopoverCloseTrigger = React30.forwardRef(function PopoverCloseTrigger2(props
|
|
|
3555
4276
|
}
|
|
3556
4277
|
);
|
|
3557
4278
|
});
|
|
3558
|
-
var PopoverCloseTriggerWrapper =
|
|
4279
|
+
var PopoverCloseTriggerWrapper = React33.forwardRef(function PopoverCloseTriggerWrapper2(props, ref) {
|
|
3559
4280
|
const { disabled, children, ...rest } = props;
|
|
3560
4281
|
if (disabled) {
|
|
3561
4282
|
return children;
|
|
3562
4283
|
}
|
|
3563
4284
|
return /* @__PURE__ */ jsx(Popover.Close, { ref, ...rest, asChild: true, children });
|
|
3564
4285
|
});
|
|
3565
|
-
var PopoverBody =
|
|
4286
|
+
var PopoverBody = React33.forwardRef(function PopoverBody2(props, ref) {
|
|
3566
4287
|
const {
|
|
3567
4288
|
className,
|
|
3568
4289
|
style: styleProp,
|
|
@@ -3600,7 +4321,7 @@ var PopoverBody = React30.forwardRef(function PopoverBody2(props, ref) {
|
|
|
3600
4321
|
}
|
|
3601
4322
|
);
|
|
3602
4323
|
});
|
|
3603
|
-
var PopoverHeader =
|
|
4324
|
+
var PopoverHeader = React33.forwardRef(function PopoverHeader2(props, ref) {
|
|
3604
4325
|
const { className, ...rest } = props;
|
|
3605
4326
|
return /* @__PURE__ */ jsx(
|
|
3606
4327
|
"div",
|
|
@@ -3611,7 +4332,7 @@ var PopoverHeader = React30.forwardRef(function PopoverHeader2(props, ref) {
|
|
|
3611
4332
|
}
|
|
3612
4333
|
);
|
|
3613
4334
|
});
|
|
3614
|
-
var PopoverFooter =
|
|
4335
|
+
var PopoverFooter = React33.forwardRef(function PopoverFooter2(props, ref) {
|
|
3615
4336
|
const { className, ...rest } = props;
|
|
3616
4337
|
return /* @__PURE__ */ jsx(
|
|
3617
4338
|
"div",
|
|
@@ -3622,7 +4343,7 @@ var PopoverFooter = React30.forwardRef(function PopoverFooter2(props, ref) {
|
|
|
3622
4343
|
}
|
|
3623
4344
|
);
|
|
3624
4345
|
});
|
|
3625
|
-
var PopoverTitle =
|
|
4346
|
+
var PopoverTitle = React33.forwardRef(function PopoverTitle2(props, ref) {
|
|
3626
4347
|
const { className, ...rest } = props;
|
|
3627
4348
|
return /* @__PURE__ */ jsx(
|
|
3628
4349
|
"h3",
|
|
@@ -3633,7 +4354,7 @@ var PopoverTitle = React30.forwardRef(function PopoverTitle2(props, ref) {
|
|
|
3633
4354
|
}
|
|
3634
4355
|
);
|
|
3635
4356
|
});
|
|
3636
|
-
var PopoverDescription =
|
|
4357
|
+
var PopoverDescription = React33.forwardRef(function PopoverDescription2(props, ref) {
|
|
3637
4358
|
const { className, ...rest } = props;
|
|
3638
4359
|
return /* @__PURE__ */ jsx(
|
|
3639
4360
|
"p",
|
|
@@ -3655,7 +4376,7 @@ function normalizeValue(value, min, max) {
|
|
|
3655
4376
|
if (max <= min) return 0;
|
|
3656
4377
|
return Math.round((value - min) / (max - min) * 100);
|
|
3657
4378
|
}
|
|
3658
|
-
var Progress =
|
|
4379
|
+
var Progress = React33.forwardRef(
|
|
3659
4380
|
function Progress2(props, ref) {
|
|
3660
4381
|
const {
|
|
3661
4382
|
value,
|
|
@@ -3695,10 +4416,11 @@ var Progress = React30.forwardRef(
|
|
|
3695
4416
|
style: rootStyle,
|
|
3696
4417
|
...rest,
|
|
3697
4418
|
children: /* @__PURE__ */ jsx(
|
|
3698
|
-
|
|
4419
|
+
Progress$1,
|
|
3699
4420
|
{
|
|
3700
4421
|
value: percent,
|
|
3701
4422
|
max: 100,
|
|
4423
|
+
unstyled: true,
|
|
3702
4424
|
className: cn(
|
|
3703
4425
|
"w-full overflow-hidden rounded-full",
|
|
3704
4426
|
"bg-[var(--color-progress-track)]",
|
|
@@ -3707,14 +4429,15 @@ var Progress = React30.forwardRef(
|
|
|
3707
4429
|
),
|
|
3708
4430
|
style: trackStyle,
|
|
3709
4431
|
children: /* @__PURE__ */ jsx(
|
|
3710
|
-
|
|
4432
|
+
Progress$1.Indicator,
|
|
3711
4433
|
{
|
|
4434
|
+
unstyled: true,
|
|
4435
|
+
transition: "slow",
|
|
3712
4436
|
className: cn(
|
|
3713
|
-
"h-full rounded-full
|
|
4437
|
+
"h-full rounded-full",
|
|
3714
4438
|
!color && "bg-[var(--color-progress-indicator)]"
|
|
3715
4439
|
),
|
|
3716
4440
|
style: {
|
|
3717
|
-
width: `${percent}%`,
|
|
3718
4441
|
...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
|
|
3719
4442
|
}
|
|
3720
4443
|
}
|
|
@@ -3732,12 +4455,12 @@ var SIZE_MAP = {
|
|
|
3732
4455
|
lg: { size: 48, thickness: 7, textClass: "text-sm" },
|
|
3733
4456
|
xl: { size: 64, thickness: 8, textClass: "text-sm" }
|
|
3734
4457
|
};
|
|
3735
|
-
var Ctx =
|
|
4458
|
+
var Ctx = React33.createContext({
|
|
3736
4459
|
value: 0,
|
|
3737
4460
|
size: "md",
|
|
3738
4461
|
colorPalette: "blue"
|
|
3739
4462
|
});
|
|
3740
|
-
var ProgressCircleRoot =
|
|
4463
|
+
var ProgressCircleRoot = React33.forwardRef(function ProgressCircleRoot2(props, ref) {
|
|
3741
4464
|
const {
|
|
3742
4465
|
value = 0,
|
|
3743
4466
|
size = "md",
|
|
@@ -3746,7 +4469,7 @@ var ProgressCircleRoot = React30.forwardRef(function ProgressCircleRoot2(props,
|
|
|
3746
4469
|
children,
|
|
3747
4470
|
...rest
|
|
3748
4471
|
} = props;
|
|
3749
|
-
const ctx =
|
|
4472
|
+
const ctx = React33.useMemo(
|
|
3750
4473
|
() => ({ value: value ?? null, size, colorPalette }),
|
|
3751
4474
|
[value, size, colorPalette]
|
|
3752
4475
|
);
|
|
@@ -3764,9 +4487,9 @@ var ProgressCircleRoot = React30.forwardRef(function ProgressCircleRoot2(props,
|
|
|
3764
4487
|
}
|
|
3765
4488
|
) });
|
|
3766
4489
|
});
|
|
3767
|
-
var ProgressCircleRing =
|
|
4490
|
+
var ProgressCircleRing = React33.forwardRef(function ProgressCircleRing2(props, ref) {
|
|
3768
4491
|
const { trackColor, cap, color, className, ...rest } = props;
|
|
3769
|
-
const { value, size: sizeKey } =
|
|
4492
|
+
const { value, size: sizeKey } = React33.useContext(Ctx);
|
|
3770
4493
|
const { size, thickness } = SIZE_MAP[sizeKey];
|
|
3771
4494
|
const radius = size / 2 - thickness / 2;
|
|
3772
4495
|
const circumference = 2 * Math.PI * radius;
|
|
@@ -3821,9 +4544,9 @@ var ProgressCircleRing = React30.forwardRef(function ProgressCircleRing2(props,
|
|
|
3821
4544
|
}
|
|
3822
4545
|
);
|
|
3823
4546
|
});
|
|
3824
|
-
var ProgressCircleValueText =
|
|
4547
|
+
var ProgressCircleValueText = React33.forwardRef(function ProgressCircleValueText2(props, ref) {
|
|
3825
4548
|
const { className, children, ...rest } = props;
|
|
3826
|
-
const { value, size: sizeKey } =
|
|
4549
|
+
const { value, size: sizeKey } = React33.useContext(Ctx);
|
|
3827
4550
|
const { textClass } = SIZE_MAP[sizeKey];
|
|
3828
4551
|
return /* @__PURE__ */ jsx(
|
|
3829
4552
|
"div",
|
|
@@ -3867,8 +4590,8 @@ var SIZE_CLASSES8 = {
|
|
|
3867
4590
|
label: "text-base"
|
|
3868
4591
|
}
|
|
3869
4592
|
};
|
|
3870
|
-
var RadioSizeContext =
|
|
3871
|
-
var RadioGroupBase =
|
|
4593
|
+
var RadioSizeContext = React33.createContext("md");
|
|
4594
|
+
var RadioGroupBase = React33.forwardRef(
|
|
3872
4595
|
function RadioGroup2(props, ref) {
|
|
3873
4596
|
const {
|
|
3874
4597
|
children,
|
|
@@ -3877,7 +4600,8 @@ var RadioGroupBase = React30.forwardRef(
|
|
|
3877
4600
|
disabled = false,
|
|
3878
4601
|
readOnly = false,
|
|
3879
4602
|
orientation = "vertical",
|
|
3880
|
-
loop
|
|
4603
|
+
// `loop` was a Radix-only knob; gui's roving focus always wraps.
|
|
4604
|
+
loop: _loop = true,
|
|
3881
4605
|
defaultValue,
|
|
3882
4606
|
value,
|
|
3883
4607
|
onValueChange,
|
|
@@ -3885,7 +4609,7 @@ var RadioGroupBase = React30.forwardRef(
|
|
|
3885
4609
|
className,
|
|
3886
4610
|
...rest
|
|
3887
4611
|
} = props;
|
|
3888
|
-
const handleValueChange =
|
|
4612
|
+
const handleValueChange = React33.useCallback(
|
|
3889
4613
|
(nextValue) => {
|
|
3890
4614
|
if (readOnly) return;
|
|
3891
4615
|
onValueChange?.({ value: nextValue });
|
|
@@ -3893,14 +4617,14 @@ var RadioGroupBase = React30.forwardRef(
|
|
|
3893
4617
|
[readOnly, onValueChange]
|
|
3894
4618
|
);
|
|
3895
4619
|
return /* @__PURE__ */ jsx(RadioSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(
|
|
3896
|
-
|
|
4620
|
+
RadioGroup,
|
|
3897
4621
|
{
|
|
3898
4622
|
ref,
|
|
4623
|
+
unstyled: true,
|
|
3899
4624
|
name,
|
|
3900
4625
|
required,
|
|
3901
4626
|
disabled: disabled || readOnly,
|
|
3902
4627
|
orientation,
|
|
3903
|
-
loop,
|
|
3904
4628
|
defaultValue,
|
|
3905
4629
|
value: value ?? void 0,
|
|
3906
4630
|
onValueChange: handleValueChange,
|
|
@@ -3918,10 +4642,10 @@ var RadioGroupBase = React30.forwardRef(
|
|
|
3918
4642
|
var RadioGroup3 = RadioGroupBase;
|
|
3919
4643
|
var NOOP2 = () => {
|
|
3920
4644
|
};
|
|
3921
|
-
var RadioBase =
|
|
4645
|
+
var RadioBase = React33.forwardRef(
|
|
3922
4646
|
function Radio(props, ref) {
|
|
3923
4647
|
const { children, inputProps, rootRef, value, disabled, className, ...rest } = props;
|
|
3924
|
-
const size =
|
|
4648
|
+
const size = React33.useContext(RadioSizeContext);
|
|
3925
4649
|
const sizeClasses2 = SIZE_CLASSES8[size];
|
|
3926
4650
|
return /* @__PURE__ */ jsxs(
|
|
3927
4651
|
"label",
|
|
@@ -3937,8 +4661,9 @@ var RadioBase = React30.forwardRef(
|
|
|
3937
4661
|
...rest,
|
|
3938
4662
|
children: [
|
|
3939
4663
|
/* @__PURE__ */ jsx(
|
|
3940
|
-
|
|
4664
|
+
RadioGroup.Item,
|
|
3941
4665
|
{
|
|
4666
|
+
unstyled: true,
|
|
3942
4667
|
value,
|
|
3943
4668
|
disabled,
|
|
3944
4669
|
className: cn(
|
|
@@ -3950,8 +4675,9 @@ var RadioBase = React30.forwardRef(
|
|
|
3950
4675
|
sizeClasses2.control
|
|
3951
4676
|
),
|
|
3952
4677
|
children: /* @__PURE__ */ jsx(
|
|
3953
|
-
|
|
4678
|
+
RadioGroup.Indicator,
|
|
3954
4679
|
{
|
|
4680
|
+
unstyled: true,
|
|
3955
4681
|
className: cn(
|
|
3956
4682
|
"block rounded-full bg-gray-800 dark:bg-white",
|
|
3957
4683
|
sizeClasses2.indicator
|
|
@@ -3983,23 +4709,23 @@ var RadioBase = React30.forwardRef(
|
|
|
3983
4709
|
var Radio2 = RadioBase;
|
|
3984
4710
|
var StarFilledIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) });
|
|
3985
4711
|
var StarOutlineIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z", strokeWidth: "1.5" }) });
|
|
3986
|
-
var Rating =
|
|
4712
|
+
var Rating = React33.forwardRef(
|
|
3987
4713
|
function Rating2(props, ref) {
|
|
3988
4714
|
const { count = 5, label: labelProp, defaultValue = 0, onValueChange, readOnly, className, ...rest } = props;
|
|
3989
|
-
const [value, setValue] =
|
|
3990
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4715
|
+
const [value, setValue] = React33.useState(defaultValue);
|
|
4716
|
+
const [hoveredIndex, setHoveredIndex] = React33.useState(-1);
|
|
3991
4717
|
const highlightedIndex = hoveredIndex >= 0 && !readOnly ? hoveredIndex + 1 : value;
|
|
3992
4718
|
const label = Array.isArray(labelProp) ? labelProp[highlightedIndex - 1] : labelProp;
|
|
3993
|
-
const handleClick =
|
|
4719
|
+
const handleClick = React33.useCallback((index) => () => {
|
|
3994
4720
|
if (readOnly) return;
|
|
3995
4721
|
setValue(index);
|
|
3996
4722
|
onValueChange?.({ value: index });
|
|
3997
4723
|
}, [readOnly, onValueChange]);
|
|
3998
|
-
const handleMouseEnter =
|
|
4724
|
+
const handleMouseEnter = React33.useCallback((index) => () => {
|
|
3999
4725
|
if (readOnly) return;
|
|
4000
4726
|
setHoveredIndex(index);
|
|
4001
4727
|
}, [readOnly]);
|
|
4002
|
-
const handleMouseLeave =
|
|
4728
|
+
const handleMouseLeave = React33.useCallback(() => {
|
|
4003
4729
|
setHoveredIndex(-1);
|
|
4004
4730
|
}, []);
|
|
4005
4731
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("inline-flex items-center gap-1", className), ...rest, children: [
|
|
@@ -4033,8 +4759,8 @@ function createListCollection(config2) {
|
|
|
4033
4759
|
var ArrowIcon2 = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
4034
4760
|
var CheckIcon2 = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M16.667 5L7.5 14.167 3.333 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
4035
4761
|
function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
4036
|
-
const [value, setValue] =
|
|
4037
|
-
const handleChange =
|
|
4762
|
+
const [value, setValue] = React33.useState(initialValue);
|
|
4763
|
+
const handleChange = React33.useCallback((e) => {
|
|
4038
4764
|
setValue(e.target.value);
|
|
4039
4765
|
onChange?.(e.target.value);
|
|
4040
4766
|
}, [onChange]);
|
|
@@ -4053,15 +4779,15 @@ function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
|
4053
4779
|
}
|
|
4054
4780
|
);
|
|
4055
4781
|
}
|
|
4056
|
-
var SelectInternalContext =
|
|
4782
|
+
var SelectInternalContext = React33.createContext(null);
|
|
4057
4783
|
function useSelectInternalContext() {
|
|
4058
|
-
const ctx =
|
|
4784
|
+
const ctx = React33.useContext(SelectInternalContext);
|
|
4059
4785
|
if (!ctx) {
|
|
4060
4786
|
throw new Error("Select compound components must be rendered inside <SelectRoot>");
|
|
4061
4787
|
}
|
|
4062
4788
|
return ctx;
|
|
4063
4789
|
}
|
|
4064
|
-
var SelectRoot =
|
|
4790
|
+
var SelectRoot = React33.forwardRef(
|
|
4065
4791
|
function SelectRoot2(props, ref) {
|
|
4066
4792
|
const {
|
|
4067
4793
|
children,
|
|
@@ -4092,21 +4818,21 @@ var SelectRoot = React30.forwardRef(
|
|
|
4092
4818
|
hideFrom: _hideFrom
|
|
4093
4819
|
} = props;
|
|
4094
4820
|
const collection = collectionProp ?? createListCollection({ items: [] });
|
|
4095
|
-
const [internalValue, setInternalValue] =
|
|
4821
|
+
const [internalValue, setInternalValue] = React33.useState(defaultValueArr ?? []);
|
|
4096
4822
|
const currentValue = valueProp ?? internalValue;
|
|
4097
|
-
const selectedItems =
|
|
4823
|
+
const selectedItems = React33.useMemo(() => {
|
|
4098
4824
|
return currentValue.map((v) => collection.items.find((item) => item.value === v)).filter(Boolean);
|
|
4099
4825
|
}, [currentValue, collection.items]);
|
|
4100
|
-
const [open, setOpen] =
|
|
4826
|
+
const [open, setOpen] = React33.useState(defaultOpen ?? false);
|
|
4101
4827
|
const isOpen = openProp ?? open;
|
|
4102
|
-
const handleOpenChange =
|
|
4828
|
+
const handleOpenChange = React33.useCallback((nextOpen) => {
|
|
4103
4829
|
setOpen(nextOpen);
|
|
4104
4830
|
onOpenChange?.(nextOpen);
|
|
4105
4831
|
if (!nextOpen) {
|
|
4106
4832
|
onInteractOutside?.();
|
|
4107
4833
|
}
|
|
4108
4834
|
}, [onOpenChange, onInteractOutside]);
|
|
4109
|
-
const handleRadixValueChange =
|
|
4835
|
+
const handleRadixValueChange = React33.useCallback((radixValue) => {
|
|
4110
4836
|
const nextArr = [radixValue];
|
|
4111
4837
|
if (!valueProp) {
|
|
4112
4838
|
setInternalValue(nextArr);
|
|
@@ -4114,7 +4840,7 @@ var SelectRoot = React30.forwardRef(
|
|
|
4114
4840
|
const items = collection.items.filter((item) => nextArr.includes(item.value));
|
|
4115
4841
|
onValueChangeProp?.({ value: nextArr, items });
|
|
4116
4842
|
}, [valueProp, collection.items, onValueChangeProp]);
|
|
4117
|
-
const ctxValue =
|
|
4843
|
+
const ctxValue = React33.useMemo(() => ({
|
|
4118
4844
|
value: currentValue,
|
|
4119
4845
|
selectedItems,
|
|
4120
4846
|
collection,
|
|
@@ -4134,7 +4860,7 @@ var SelectRoot = React30.forwardRef(
|
|
|
4134
4860
|
if (typeof v === "string") return v;
|
|
4135
4861
|
return v.base ?? v.lg ?? Object.values(v)[0];
|
|
4136
4862
|
};
|
|
4137
|
-
const inlineStyle =
|
|
4863
|
+
const inlineStyle = React33.useMemo(() => {
|
|
4138
4864
|
const s = { ...style };
|
|
4139
4865
|
const rw = resolveVal(w);
|
|
4140
4866
|
if (rw) s.width = rw;
|
|
@@ -4172,7 +4898,7 @@ var SelectRoot = React30.forwardRef(
|
|
|
4172
4898
|
) });
|
|
4173
4899
|
}
|
|
4174
4900
|
);
|
|
4175
|
-
var SelectControl =
|
|
4901
|
+
var SelectControl = React33.forwardRef(
|
|
4176
4902
|
function SelectControl2(props, ref) {
|
|
4177
4903
|
const { children, noIndicator, triggerProps, loading, defaultValue } = props;
|
|
4178
4904
|
const ctx = useSelectInternalContext();
|
|
@@ -4209,11 +4935,11 @@ var SelectControl = React30.forwardRef(
|
|
|
4209
4935
|
return trigger;
|
|
4210
4936
|
}
|
|
4211
4937
|
);
|
|
4212
|
-
var SelectClearTrigger =
|
|
4938
|
+
var SelectClearTrigger = React33.forwardRef(
|
|
4213
4939
|
function SelectClearTrigger2(props, ref) {
|
|
4214
4940
|
const { className, ...rest } = props;
|
|
4215
4941
|
const ctx = useSelectInternalContext();
|
|
4216
|
-
const handleClick =
|
|
4942
|
+
const handleClick = React33.useCallback(() => {
|
|
4217
4943
|
ctx.onValueChange({ value: [], items: [] });
|
|
4218
4944
|
}, [ctx]);
|
|
4219
4945
|
return /* @__PURE__ */ jsx(
|
|
@@ -4230,7 +4956,7 @@ var SelectClearTrigger = React30.forwardRef(
|
|
|
4230
4956
|
);
|
|
4231
4957
|
}
|
|
4232
4958
|
);
|
|
4233
|
-
var SelectContent =
|
|
4959
|
+
var SelectContent = React33.forwardRef(
|
|
4234
4960
|
function SelectContent2(props, ref) {
|
|
4235
4961
|
const { portalled = true, portalRef, children, className, ...rest } = props;
|
|
4236
4962
|
const content = /* @__PURE__ */ jsx(
|
|
@@ -4257,7 +4983,7 @@ var SelectContent = React30.forwardRef(
|
|
|
4257
4983
|
return content;
|
|
4258
4984
|
}
|
|
4259
4985
|
);
|
|
4260
|
-
var SelectItem =
|
|
4986
|
+
var SelectItem = React33.forwardRef(
|
|
4261
4987
|
function SelectItem2(props, ref) {
|
|
4262
4988
|
const { item, children, className, ...rest } = props;
|
|
4263
4989
|
return /* @__PURE__ */ jsxs(
|
|
@@ -4285,7 +5011,7 @@ var SelectItem = React30.forwardRef(
|
|
|
4285
5011
|
);
|
|
4286
5012
|
}
|
|
4287
5013
|
);
|
|
4288
|
-
var SelectValueText =
|
|
5014
|
+
var SelectValueText = React33.forwardRef(
|
|
4289
5015
|
function SelectValueText2(props, ref) {
|
|
4290
5016
|
const { children, size, required, invalid, errorText, mode, className, style, placeholder: placeholderProp, ...rest } = props;
|
|
4291
5017
|
const ctx = useSelectInternalContext();
|
|
@@ -4341,7 +5067,7 @@ var SelectValueText = React30.forwardRef(
|
|
|
4341
5067
|
);
|
|
4342
5068
|
}
|
|
4343
5069
|
);
|
|
4344
|
-
var SelectItemGroup =
|
|
5070
|
+
var SelectItemGroup = React33.forwardRef(
|
|
4345
5071
|
function SelectItemGroup2(props, ref) {
|
|
4346
5072
|
const { children, label, className, ...rest } = props;
|
|
4347
5073
|
return /* @__PURE__ */ jsxs(RadixSelect.Group, { ref, className: cn("py-1", className), ...rest, children: [
|
|
@@ -4352,7 +5078,7 @@ var SelectItemGroup = React30.forwardRef(
|
|
|
4352
5078
|
);
|
|
4353
5079
|
var SelectLabel = RadixSelect.Label;
|
|
4354
5080
|
var SelectItemText = RadixSelect.ItemText;
|
|
4355
|
-
var Select =
|
|
5081
|
+
var Select = React33.forwardRef((props, ref) => {
|
|
4356
5082
|
const { collection, placeholder, portalled = true, loading, errorText, contentProps, contentHeader, itemFilter, mode, ...rest } = props;
|
|
4357
5083
|
return /* @__PURE__ */ jsxs(
|
|
4358
5084
|
SelectRoot,
|
|
@@ -4374,7 +5100,7 @@ var Select = React30.forwardRef((props, ref) => {
|
|
|
4374
5100
|
) }),
|
|
4375
5101
|
/* @__PURE__ */ jsxs(SelectContent, { portalled, ...contentProps, children: [
|
|
4376
5102
|
contentHeader,
|
|
4377
|
-
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxs(
|
|
5103
|
+
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxs(React33.Fragment, { children: [
|
|
4378
5104
|
/* @__PURE__ */ jsx(SelectItem, { item, children: item.renderLabel ? item.renderLabel("item") : item.label }),
|
|
4379
5105
|
item.afterElement
|
|
4380
5106
|
] }, item.value))
|
|
@@ -4383,19 +5109,19 @@ var Select = React30.forwardRef((props, ref) => {
|
|
|
4383
5109
|
}
|
|
4384
5110
|
);
|
|
4385
5111
|
});
|
|
4386
|
-
var SelectAsync =
|
|
5112
|
+
var SelectAsync = React33.forwardRef((props, ref) => {
|
|
4387
5113
|
const { placeholder, portalled = true, loading, loadOptions, extraControls, onValueChange, errorText, mode, contentHeader, ...rest } = props;
|
|
4388
|
-
const [collection, setCollection] =
|
|
4389
|
-
const [inputValue, setInputValue] =
|
|
4390
|
-
const [value, setValue] =
|
|
5114
|
+
const [collection, setCollection] = React33.useState(createListCollection({ items: [] }));
|
|
5115
|
+
const [inputValue, setInputValue] = React33.useState("");
|
|
5116
|
+
const [value, setValue] = React33.useState([]);
|
|
4391
5117
|
const debouncedInputValue = useDebounce(inputValue, 300);
|
|
4392
|
-
|
|
5118
|
+
React33.useEffect(() => {
|
|
4393
5119
|
loadOptions(debouncedInputValue, value).then(setCollection);
|
|
4394
5120
|
}, [debouncedInputValue, loadOptions, value]);
|
|
4395
|
-
const handleFilterChange =
|
|
5121
|
+
const handleFilterChange = React33.useCallback((val) => {
|
|
4396
5122
|
setInputValue(val);
|
|
4397
5123
|
}, []);
|
|
4398
|
-
const handleValueChange =
|
|
5124
|
+
const handleValueChange = React33.useCallback(({ value: v, items }) => {
|
|
4399
5125
|
setValue(v);
|
|
4400
5126
|
onValueChange?.({ value: v, items });
|
|
4401
5127
|
}, [onValueChange]);
|
|
@@ -4454,13 +5180,14 @@ var VERTICAL_SIZE_CLASSES = {
|
|
|
4454
5180
|
md: "border-l-2",
|
|
4455
5181
|
lg: "border-l-[3px]"
|
|
4456
5182
|
};
|
|
4457
|
-
var Separator2 =
|
|
5183
|
+
var Separator2 = React33__default.forwardRef(
|
|
4458
5184
|
function Separator3({ orientation = "horizontal", variant = "solid", size = "sm", className, ...rest }, ref) {
|
|
4459
5185
|
const isVertical = orientation === "vertical";
|
|
4460
5186
|
return /* @__PURE__ */ jsx(
|
|
4461
|
-
|
|
5187
|
+
Separator,
|
|
4462
5188
|
{
|
|
4463
5189
|
ref,
|
|
5190
|
+
vertical: isVertical,
|
|
4464
5191
|
role: "separator",
|
|
4465
5192
|
"aria-orientation": orientation,
|
|
4466
5193
|
className: cn(
|
|
@@ -4476,9 +5203,7 @@ var Separator2 = React30__default.forwardRef(
|
|
|
4476
5203
|
);
|
|
4477
5204
|
}
|
|
4478
5205
|
);
|
|
4479
|
-
var
|
|
4480
|
-
var TRACK_HEIGHT = 6;
|
|
4481
|
-
var Slider = React30.forwardRef(
|
|
5206
|
+
var Slider = React33.forwardRef(
|
|
4482
5207
|
function Slider2(props, ref) {
|
|
4483
5208
|
const {
|
|
4484
5209
|
marks: marksProp,
|
|
@@ -4490,7 +5215,7 @@ var Slider = React30.forwardRef(
|
|
|
4490
5215
|
max = 100,
|
|
4491
5216
|
step,
|
|
4492
5217
|
disabled,
|
|
4493
|
-
orientation,
|
|
5218
|
+
orientation = "horizontal",
|
|
4494
5219
|
name,
|
|
4495
5220
|
onValueChange,
|
|
4496
5221
|
onValueCommit,
|
|
@@ -4502,6 +5227,14 @@ var Slider = React30.forwardRef(
|
|
|
4502
5227
|
return mark;
|
|
4503
5228
|
});
|
|
4504
5229
|
const hasMarkLabel = Boolean(marks?.some((mark) => mark.label));
|
|
5230
|
+
const latest = React33.useRef(value ?? defaultValue ?? []);
|
|
5231
|
+
const handleValueChange = React33.useCallback((next) => {
|
|
5232
|
+
latest.current = next;
|
|
5233
|
+
onValueChange?.(next);
|
|
5234
|
+
}, [onValueChange]);
|
|
5235
|
+
const handleSlideEnd = React33.useCallback(() => {
|
|
5236
|
+
onValueCommit?.(latest.current);
|
|
5237
|
+
}, [onValueCommit]);
|
|
4505
5238
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
4506
5239
|
label && !showValue && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
|
|
4507
5240
|
label && showValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -4509,9 +5242,10 @@ var Slider = React30.forwardRef(
|
|
|
4509
5242
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
|
|
4510
5243
|
] }),
|
|
4511
5244
|
/* @__PURE__ */ jsxs(
|
|
4512
|
-
|
|
5245
|
+
Slider$1,
|
|
4513
5246
|
{
|
|
4514
5247
|
ref,
|
|
5248
|
+
unstyled: true,
|
|
4515
5249
|
className: cn(
|
|
4516
5250
|
"relative flex w-full touch-none select-none items-center",
|
|
4517
5251
|
hasMarkLabel && "mb-6"
|
|
@@ -4524,24 +5258,30 @@ var Slider = React30.forwardRef(
|
|
|
4524
5258
|
disabled,
|
|
4525
5259
|
orientation,
|
|
4526
5260
|
name,
|
|
4527
|
-
onValueChange,
|
|
4528
|
-
|
|
5261
|
+
onValueChange: handleValueChange,
|
|
5262
|
+
onSlideEnd: handleSlideEnd,
|
|
4529
5263
|
children: [
|
|
4530
5264
|
/* @__PURE__ */ jsx(
|
|
4531
|
-
|
|
5265
|
+
Slider$1.Track,
|
|
4532
5266
|
{
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
5267
|
+
unstyled: true,
|
|
5268
|
+
className: "relative grow h-1.5 rounded-full bg-border-divider",
|
|
5269
|
+
children: /* @__PURE__ */ jsx(
|
|
5270
|
+
Slider$1.TrackActive,
|
|
5271
|
+
{
|
|
5272
|
+
unstyled: true,
|
|
5273
|
+
className: "absolute h-full rounded-full bg-link-primary"
|
|
5274
|
+
}
|
|
5275
|
+
)
|
|
4538
5276
|
}
|
|
4539
5277
|
),
|
|
4540
5278
|
resolvedValue?.map((_, index) => /* @__PURE__ */ jsx(
|
|
4541
|
-
|
|
5279
|
+
Slider$1.Thumb,
|
|
4542
5280
|
{
|
|
5281
|
+
index,
|
|
5282
|
+
unstyled: true,
|
|
4543
5283
|
className: cn(
|
|
4544
|
-
|
|
5284
|
+
"block h-5 w-5",
|
|
4545
5285
|
"rounded-full border-2 border-link-primary bg-white",
|
|
4546
5286
|
"shadow-sm transition-colors",
|
|
4547
5287
|
"hover:border-link-primary-hover",
|
|
@@ -4583,22 +5323,22 @@ var NOOP3 = () => {
|
|
|
4583
5323
|
var SIZE_CLASSES9 = {
|
|
4584
5324
|
sm: {
|
|
4585
5325
|
root: "h-4 w-7",
|
|
4586
|
-
thumb: "h-3 w-3
|
|
5326
|
+
thumb: "h-3 w-3",
|
|
4587
5327
|
label: "text-xs"
|
|
4588
5328
|
},
|
|
4589
5329
|
md: {
|
|
4590
5330
|
root: "h-5 w-9",
|
|
4591
|
-
thumb: "h-4 w-4
|
|
5331
|
+
thumb: "h-4 w-4",
|
|
4592
5332
|
label: "text-sm"
|
|
4593
5333
|
},
|
|
4594
5334
|
lg: {
|
|
4595
5335
|
root: "h-6 w-11",
|
|
4596
|
-
thumb: "h-5 w-5
|
|
5336
|
+
thumb: "h-5 w-5",
|
|
4597
5337
|
label: "text-base"
|
|
4598
5338
|
}
|
|
4599
5339
|
};
|
|
4600
|
-
var SwitchBase =
|
|
4601
|
-
function Switch(props, ref) {
|
|
5340
|
+
var SwitchBase = React33.forwardRef(
|
|
5341
|
+
function Switch$1(props, ref) {
|
|
4602
5342
|
const {
|
|
4603
5343
|
inputProps,
|
|
4604
5344
|
children,
|
|
@@ -4616,17 +5356,15 @@ var SwitchBase = React30.forwardRef(
|
|
|
4616
5356
|
className,
|
|
4617
5357
|
...rest
|
|
4618
5358
|
} = props;
|
|
4619
|
-
const [internalChecked, setInternalChecked] =
|
|
5359
|
+
const [internalChecked, setInternalChecked] = React33.useState(defaultChecked ?? false);
|
|
4620
5360
|
const isControlled = checkedProp !== void 0;
|
|
4621
5361
|
const checkedState = isControlled ? checkedProp : internalChecked;
|
|
4622
|
-
const handleCheckedChange =
|
|
5362
|
+
const handleCheckedChange = React33.useCallback(
|
|
4623
5363
|
(nextChecked) => {
|
|
4624
5364
|
if (!isControlled) {
|
|
4625
5365
|
setInternalChecked(nextChecked);
|
|
4626
5366
|
}
|
|
4627
|
-
|
|
4628
|
-
onCheckedChange({ checked: nextChecked });
|
|
4629
|
-
}
|
|
5367
|
+
onCheckedChange?.({ checked: nextChecked });
|
|
4630
5368
|
},
|
|
4631
5369
|
[isControlled, onCheckedChange]
|
|
4632
5370
|
);
|
|
@@ -4647,8 +5385,9 @@ var SwitchBase = React30.forwardRef(
|
|
|
4647
5385
|
...rest,
|
|
4648
5386
|
children: [
|
|
4649
5387
|
/* @__PURE__ */ jsxs(
|
|
4650
|
-
|
|
5388
|
+
Switch,
|
|
4651
5389
|
{
|
|
5390
|
+
unstyled: true,
|
|
4652
5391
|
checked: checkedState,
|
|
4653
5392
|
onCheckedChange: handleCheckedChange,
|
|
4654
5393
|
disabled,
|
|
@@ -4663,12 +5402,13 @@ var SwitchBase = React30.forwardRef(
|
|
|
4663
5402
|
children: [
|
|
4664
5403
|
trackLabel && /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-bold text-white pointer-events-none", children: checkedState ? trackLabel.on : trackLabel.off }),
|
|
4665
5404
|
/* @__PURE__ */ jsx(
|
|
4666
|
-
|
|
5405
|
+
Switch.Thumb,
|
|
4667
5406
|
{
|
|
5407
|
+
unstyled: true,
|
|
5408
|
+
"data-thumb": true,
|
|
5409
|
+
transition: "quicker",
|
|
4668
5410
|
className: cn(
|
|
4669
5411
|
"block rounded-full bg-white shadow-sm",
|
|
4670
|
-
"transition-transform duration-200",
|
|
4671
|
-
"translate-x-0.5",
|
|
4672
5412
|
sizeClasses2.thumb
|
|
4673
5413
|
),
|
|
4674
5414
|
children: thumbLabel && /* @__PURE__ */ jsx("span", { className: "flex items-center justify-center h-full w-full text-[8px]", children: checkedState ? thumbLabel.on : thumbLabel.off })
|
|
@@ -4884,7 +5624,7 @@ function resolveResponsive(value) {
|
|
|
4884
5624
|
}
|
|
4885
5625
|
return void 0;
|
|
4886
5626
|
}
|
|
4887
|
-
var TableRoot =
|
|
5627
|
+
var TableRoot = React33.forwardRef(
|
|
4888
5628
|
function TableRoot2(props, ref) {
|
|
4889
5629
|
const { className, style: styleProp, children, ...other } = props;
|
|
4890
5630
|
const rawMinW = other.minWidth ?? other.minW;
|
|
@@ -4907,7 +5647,7 @@ var TableRoot = React30.forwardRef(
|
|
|
4907
5647
|
);
|
|
4908
5648
|
}
|
|
4909
5649
|
);
|
|
4910
|
-
var TableHeader =
|
|
5650
|
+
var TableHeader = React33.forwardRef(
|
|
4911
5651
|
function TableHeader2(props, ref) {
|
|
4912
5652
|
const { className, style: styleProp, children, ...other } = props;
|
|
4913
5653
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4924,7 +5664,7 @@ var TableHeader = React30.forwardRef(
|
|
|
4924
5664
|
);
|
|
4925
5665
|
}
|
|
4926
5666
|
);
|
|
4927
|
-
var TableBody =
|
|
5667
|
+
var TableBody = React33.forwardRef(
|
|
4928
5668
|
function TableBody2(props, ref) {
|
|
4929
5669
|
const { className, style: styleProp, children, ...other } = props;
|
|
4930
5670
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4941,7 +5681,7 @@ var TableBody = React30.forwardRef(
|
|
|
4941
5681
|
);
|
|
4942
5682
|
}
|
|
4943
5683
|
);
|
|
4944
|
-
var TableRow =
|
|
5684
|
+
var TableRow = React33.forwardRef(
|
|
4945
5685
|
function TableRow2(props, ref) {
|
|
4946
5686
|
const { className, style: styleProp, children, ...other } = props;
|
|
4947
5687
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4958,7 +5698,7 @@ var TableRow = React30.forwardRef(
|
|
|
4958
5698
|
);
|
|
4959
5699
|
}
|
|
4960
5700
|
);
|
|
4961
|
-
var TableCell =
|
|
5701
|
+
var TableCell = React33.forwardRef(
|
|
4962
5702
|
function TableCell2(props, ref) {
|
|
4963
5703
|
const { isNumeric, className, style: styleProp, children, ...other } = props;
|
|
4964
5704
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4979,7 +5719,7 @@ var TableCell = React30.forwardRef(
|
|
|
4979
5719
|
);
|
|
4980
5720
|
}
|
|
4981
5721
|
);
|
|
4982
|
-
var TableColumnHeader =
|
|
5722
|
+
var TableColumnHeader = React33.forwardRef(
|
|
4983
5723
|
function TableColumnHeader2(props, ref) {
|
|
4984
5724
|
const { isNumeric, className, style: styleProp, children, ...other } = props;
|
|
4985
5725
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5006,7 +5746,7 @@ var TableColumnHeader = React30.forwardRef(
|
|
|
5006
5746
|
);
|
|
5007
5747
|
var TableColumnHeaderSortable = (props) => {
|
|
5008
5748
|
const { sortField, sortValue, onSortToggle, children, disabled, indicatorPosition = "left", contentAfter, ...rest } = props;
|
|
5009
|
-
const handleSortToggle =
|
|
5749
|
+
const handleSortToggle = React33.useCallback(() => {
|
|
5010
5750
|
onSortToggle(sortField);
|
|
5011
5751
|
}, [onSortToggle, sortField]);
|
|
5012
5752
|
const isActive = sortValue.includes(sortField);
|
|
@@ -5032,16 +5772,16 @@ var TableColumnHeaderSortable = (props) => {
|
|
|
5032
5772
|
var ACTION_BAR_SHADOW = "0 4px 4px -4px rgb(0 0 0 / 10%), 0 2px 4px -4px rgb(0 0 0 / 6%)";
|
|
5033
5773
|
var TableHeaderSticky = (props) => {
|
|
5034
5774
|
const { top, children, className, style: styleProp, ...rest } = props;
|
|
5035
|
-
const ref =
|
|
5036
|
-
const [isStuck, setIsStuck] =
|
|
5037
|
-
const handleScroll =
|
|
5775
|
+
const ref = React33.useRef(null);
|
|
5776
|
+
const [isStuck, setIsStuck] = React33.useState(false);
|
|
5777
|
+
const handleScroll = React33.useCallback(() => {
|
|
5038
5778
|
if (Number(ref.current?.getBoundingClientRect().y) <= (Number(top) || 0)) {
|
|
5039
5779
|
setIsStuck(true);
|
|
5040
5780
|
} else {
|
|
5041
5781
|
setIsStuck(false);
|
|
5042
5782
|
}
|
|
5043
5783
|
}, [top]);
|
|
5044
|
-
|
|
5784
|
+
React33.useEffect(() => {
|
|
5045
5785
|
const throttledHandleScroll = throttle(handleScroll, 300);
|
|
5046
5786
|
window.addEventListener("scroll", throttledHandleScroll);
|
|
5047
5787
|
return () => {
|
|
@@ -5063,7 +5803,7 @@ var TableHeaderSticky = (props) => {
|
|
|
5063
5803
|
}
|
|
5064
5804
|
);
|
|
5065
5805
|
};
|
|
5066
|
-
var TableCaption =
|
|
5806
|
+
var TableCaption = React33.forwardRef(
|
|
5067
5807
|
function TableCaption2(props, ref) {
|
|
5068
5808
|
const { className, style: styleProp, children, ...other } = props;
|
|
5069
5809
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5080,7 +5820,7 @@ var TableCaption = React30.forwardRef(
|
|
|
5080
5820
|
);
|
|
5081
5821
|
}
|
|
5082
5822
|
);
|
|
5083
|
-
var TableFooter =
|
|
5823
|
+
var TableFooter = React33.forwardRef(
|
|
5084
5824
|
function TableFooter2(props, ref) {
|
|
5085
5825
|
const { className, style: styleProp, children, ...other } = props;
|
|
5086
5826
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5097,7 +5837,7 @@ var TableFooter = React30.forwardRef(
|
|
|
5097
5837
|
);
|
|
5098
5838
|
}
|
|
5099
5839
|
);
|
|
5100
|
-
var TableScrollWrapper =
|
|
5840
|
+
var TableScrollWrapper = React33.forwardRef(
|
|
5101
5841
|
function TableScrollWrapper2(props, ref) {
|
|
5102
5842
|
const { className, children, ...rest } = props;
|
|
5103
5843
|
return /* @__PURE__ */ jsx(
|
|
@@ -5116,7 +5856,7 @@ var ROOT_SIZE_CLASSES = {
|
|
|
5116
5856
|
md: "[--tabs-height:2.5rem] [--tabs-content-padding:1.5rem]",
|
|
5117
5857
|
free: ""
|
|
5118
5858
|
};
|
|
5119
|
-
var TabsRoot =
|
|
5859
|
+
var TabsRoot = React33.forwardRef(
|
|
5120
5860
|
function TabsRoot2(props, ref) {
|
|
5121
5861
|
const {
|
|
5122
5862
|
variant = "solid",
|
|
@@ -5128,7 +5868,7 @@ var TabsRoot = React30.forwardRef(
|
|
|
5128
5868
|
className,
|
|
5129
5869
|
...rest
|
|
5130
5870
|
} = props;
|
|
5131
|
-
const handleValueChange =
|
|
5871
|
+
const handleValueChange = React33.useCallback(
|
|
5132
5872
|
(value) => {
|
|
5133
5873
|
if (!onValueChange) return;
|
|
5134
5874
|
onValueChange({ value });
|
|
@@ -5153,7 +5893,7 @@ var TabsRoot = React30.forwardRef(
|
|
|
5153
5893
|
);
|
|
5154
5894
|
}
|
|
5155
5895
|
);
|
|
5156
|
-
var TabsList =
|
|
5896
|
+
var TabsList = React33.forwardRef(
|
|
5157
5897
|
function TabsList2(props, ref) {
|
|
5158
5898
|
const {
|
|
5159
5899
|
className,
|
|
@@ -5207,7 +5947,7 @@ var TRIGGER_VARIANT_CLASSES = {
|
|
|
5207
5947
|
segmented: "bg-transparent text-text-primary border-2 border-solid border-selected-control-bg hover:text-hover data-[state=active]:text-selected-control-text data-[state=active]:bg-selected-control-bg data-[state=active]:border-selected-control-bg data-[state=active]:hover:text-selected-control-text",
|
|
5208
5948
|
unstyled: ""
|
|
5209
5949
|
};
|
|
5210
|
-
var TabsTrigger =
|
|
5950
|
+
var TabsTrigger = React33.forwardRef(
|
|
5211
5951
|
function TabsTrigger2(props, ref) {
|
|
5212
5952
|
const {
|
|
5213
5953
|
className,
|
|
@@ -5227,7 +5967,7 @@ var TabsTrigger = React30.forwardRef(
|
|
|
5227
5967
|
visibility: _visibility,
|
|
5228
5968
|
...rest
|
|
5229
5969
|
} = props;
|
|
5230
|
-
const internalRef =
|
|
5970
|
+
const internalRef = React33.useRef(null);
|
|
5231
5971
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
5232
5972
|
const { variant, size, fitted } = useTabsContext(internalRef);
|
|
5233
5973
|
return /* @__PURE__ */ jsx(
|
|
@@ -5247,7 +5987,7 @@ var TabsTrigger = React30.forwardRef(
|
|
|
5247
5987
|
);
|
|
5248
5988
|
}
|
|
5249
5989
|
);
|
|
5250
|
-
var TabsContent =
|
|
5990
|
+
var TabsContent = React33.forwardRef(
|
|
5251
5991
|
function TabsContent2(props, ref) {
|
|
5252
5992
|
const { className, padding: _padding, ...rest } = props;
|
|
5253
5993
|
return /* @__PURE__ */ jsx(
|
|
@@ -5281,8 +6021,8 @@ var TabsCounter = ({ count }) => {
|
|
|
5281
6021
|
);
|
|
5282
6022
|
};
|
|
5283
6023
|
function useTabsContext(triggerRef) {
|
|
5284
|
-
const [ctx, setCtx] =
|
|
5285
|
-
|
|
6024
|
+
const [ctx, setCtx] = React33.useState({ variant: "solid", size: "md", fitted: false });
|
|
6025
|
+
React33.useEffect(() => {
|
|
5286
6026
|
const el = triggerRef.current;
|
|
5287
6027
|
if (!el) return;
|
|
5288
6028
|
const root = el.closest("[data-variant]");
|
|
@@ -5296,7 +6036,7 @@ function useTabsContext(triggerRef) {
|
|
|
5296
6036
|
return ctx;
|
|
5297
6037
|
}
|
|
5298
6038
|
function useMergedRef(...refs) {
|
|
5299
|
-
return
|
|
6039
|
+
return React33.useCallback(
|
|
5300
6040
|
(instance) => {
|
|
5301
6041
|
for (const ref of refs) {
|
|
5302
6042
|
if (!ref) continue;
|
|
@@ -5334,7 +6074,7 @@ var TAG_SELECTED_CLASSES = [
|
|
|
5334
6074
|
"hover:opacity-76"
|
|
5335
6075
|
].join(" ");
|
|
5336
6076
|
var TAG_DISABLED_CLASSES = "opacity-40 pointer-events-none cursor-not-allowed";
|
|
5337
|
-
var Tag =
|
|
6077
|
+
var Tag = React33.forwardRef(
|
|
5338
6078
|
function Tag2(props, ref) {
|
|
5339
6079
|
const {
|
|
5340
6080
|
variant,
|
|
@@ -5421,9 +6161,9 @@ var TEXTAREA_VARIANT_CLASSES = {
|
|
|
5421
6161
|
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
5422
6162
|
unstyled: "border-0 bg-transparent p-0"
|
|
5423
6163
|
};
|
|
5424
|
-
var Textarea =
|
|
6164
|
+
var Textarea = React33__default.forwardRef(
|
|
5425
6165
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
5426
|
-
const handleChange =
|
|
6166
|
+
const handleChange = React33__default.useCallback(
|
|
5427
6167
|
(event) => {
|
|
5428
6168
|
onChange?.(event);
|
|
5429
6169
|
onChangeText?.(event.target.value);
|
|
@@ -5431,9 +6171,10 @@ var Textarea = React30__default.forwardRef(
|
|
|
5431
6171
|
[onChange, onChangeText]
|
|
5432
6172
|
);
|
|
5433
6173
|
return /* @__PURE__ */ jsx(
|
|
5434
|
-
|
|
6174
|
+
TextArea,
|
|
5435
6175
|
{
|
|
5436
6176
|
ref,
|
|
6177
|
+
unstyled: true,
|
|
5437
6178
|
className: cn(TEXTAREA_BASE, TEXTAREA_SIZE_CLASSES[size], TEXTAREA_VARIANT_CLASSES[variant], className),
|
|
5438
6179
|
...rest,
|
|
5439
6180
|
onChange: handleChange
|
|
@@ -5565,7 +6306,7 @@ function QuoteCell({ value, highlight, align = "right", onClick, className }) {
|
|
|
5565
6306
|
}
|
|
5566
6307
|
var CALL_HEADERS = ["Bid", "Ask", "Last", "Vol", "OI", "IV", "Delta"];
|
|
5567
6308
|
var PUT_HEADERS = ["Delta", "IV", "OI", "Vol", "Last", "Ask", "Bid"];
|
|
5568
|
-
var OptionChain =
|
|
6309
|
+
var OptionChain = React33.forwardRef(
|
|
5569
6310
|
function OptionChain2(props, ref) {
|
|
5570
6311
|
const {
|
|
5571
6312
|
symbol: _symbol,
|
|
@@ -5576,7 +6317,7 @@ var OptionChain = React30.forwardRef(
|
|
|
5576
6317
|
className,
|
|
5577
6318
|
...rest
|
|
5578
6319
|
} = props;
|
|
5579
|
-
const handleClick =
|
|
6320
|
+
const handleClick = React33.useCallback(
|
|
5580
6321
|
(quote, type, strike) => {
|
|
5581
6322
|
if (!quote || !onSelectContract) return;
|
|
5582
6323
|
onSelectContract({
|
|
@@ -5682,7 +6423,7 @@ var OptionChain = React30.forwardRef(
|
|
|
5682
6423
|
{
|
|
5683
6424
|
className: cn(
|
|
5684
6425
|
"px-2 py-1 text-center font-mono tabular-nums text-xs font-semibold",
|
|
5685
|
-
isATM ? "text-
|
|
6426
|
+
isATM ? "text-[var(--foreground)] bg-[var(--secondary)]" : "text-[var(--muted-foreground)]"
|
|
5686
6427
|
),
|
|
5687
6428
|
children: fmt(row.strike)
|
|
5688
6429
|
}
|
|
@@ -5721,12 +6462,12 @@ var OptionChain = React30.forwardRef(
|
|
|
5721
6462
|
}
|
|
5722
6463
|
);
|
|
5723
6464
|
var GREEKS = [
|
|
5724
|
-
{ key: "delta", label: "Delta", symbol: "\u0394", color: "text-
|
|
5725
|
-
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "text-
|
|
5726
|
-
{ key: "theta", label: "Theta", symbol: "\u0398", color: "text-
|
|
5727
|
-
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "text-
|
|
5728
|
-
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "text-
|
|
5729
|
-
{ key: "iv", label: "IV", symbol: "\u03C3", color: "text-
|
|
6465
|
+
{ key: "delta", label: "Delta", symbol: "\u0394", color: "text-[var(--foreground)]", barColor: "bg-[var(--foreground)]", decimals: 4, maxMagnitude: 1 },
|
|
6466
|
+
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "text-[var(--chart-1)]", barColor: "bg-[var(--chart-1)]", decimals: 4, maxMagnitude: 0.1 },
|
|
6467
|
+
{ key: "theta", label: "Theta", symbol: "\u0398", color: "text-[var(--chart-4)]", barColor: "bg-[var(--chart-4)]", decimals: 4, maxMagnitude: 1 },
|
|
6468
|
+
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "text-[var(--chart-2)]", barColor: "bg-[var(--chart-2)]", decimals: 4, maxMagnitude: 1 },
|
|
6469
|
+
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "text-[var(--chart-3)]", barColor: "bg-[var(--chart-3)]", decimals: 4, maxMagnitude: 1 },
|
|
6470
|
+
{ key: "iv", label: "IV", symbol: "\u03C3", color: "text-[var(--chart-5)]", barColor: "bg-[var(--chart-5)]", decimals: 1, maxMagnitude: 100 }
|
|
5730
6471
|
];
|
|
5731
6472
|
function GreekItem({ def, value, compact }) {
|
|
5732
6473
|
const magnitude = Math.min(Math.abs(value) / def.maxMagnitude, 1);
|
|
@@ -5756,7 +6497,7 @@ function GreekItem({ def, value, compact }) {
|
|
|
5756
6497
|
}
|
|
5757
6498
|
);
|
|
5758
6499
|
}
|
|
5759
|
-
var GreeksDisplay =
|
|
6500
|
+
var GreeksDisplay = React33.forwardRef(
|
|
5760
6501
|
function GreeksDisplay2(props, ref) {
|
|
5761
6502
|
const {
|
|
5762
6503
|
delta,
|
|
@@ -5933,7 +6674,8 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
5933
6674
|
type: "button",
|
|
5934
6675
|
className: cn(
|
|
5935
6676
|
"px-2 py-0.5 rounded text-xs font-medium transition-colors",
|
|
5936
|
-
|
|
6677
|
+
// Call vs put is a rank difference, not a hue difference.
|
|
6678
|
+
leg.type === "call" ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
|
|
5937
6679
|
),
|
|
5938
6680
|
onClick: () => update2({ type: leg.type === "call" ? "put" : "call" }),
|
|
5939
6681
|
children: leg.type === "call" ? "CALL" : "PUT"
|
|
@@ -5987,7 +6729,7 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
5987
6729
|
)
|
|
5988
6730
|
] });
|
|
5989
6731
|
}
|
|
5990
|
-
var StrategyBuilder =
|
|
6732
|
+
var StrategyBuilder = React33.forwardRef(
|
|
5991
6733
|
function StrategyBuilder2(props, ref) {
|
|
5992
6734
|
const {
|
|
5993
6735
|
underlying,
|
|
@@ -5999,12 +6741,12 @@ var StrategyBuilder = React30.forwardRef(
|
|
|
5999
6741
|
...rest
|
|
6000
6742
|
} = props;
|
|
6001
6743
|
const defaultExp = expirations[0] ?? "";
|
|
6002
|
-
const [strategyType, setStrategyType] =
|
|
6003
|
-
const [legs, setLegs] =
|
|
6744
|
+
const [strategyType, setStrategyType] = React33.useState("bull_call_spread");
|
|
6745
|
+
const [legs, setLegs] = React33.useState(() => {
|
|
6004
6746
|
const preset = STRATEGY_PRESETS.find((p) => p.value === "bull_call_spread");
|
|
6005
6747
|
return preset ? preset.buildLegs(strikes, spotPrice, defaultExp) : [];
|
|
6006
6748
|
});
|
|
6007
|
-
const handleStrategyChange =
|
|
6749
|
+
const handleStrategyChange = React33.useCallback(
|
|
6008
6750
|
(e) => {
|
|
6009
6751
|
const type = e.target.value;
|
|
6010
6752
|
setStrategyType(type);
|
|
@@ -6015,7 +6757,7 @@ var StrategyBuilder = React30.forwardRef(
|
|
|
6015
6757
|
},
|
|
6016
6758
|
[strikes, spotPrice, defaultExp]
|
|
6017
6759
|
);
|
|
6018
|
-
const handleLegChange =
|
|
6760
|
+
const handleLegChange = React33.useCallback(
|
|
6019
6761
|
(index, leg) => {
|
|
6020
6762
|
setLegs((prev) => {
|
|
6021
6763
|
const next = [...prev];
|
|
@@ -6025,13 +6767,13 @@ var StrategyBuilder = React30.forwardRef(
|
|
|
6025
6767
|
},
|
|
6026
6768
|
[]
|
|
6027
6769
|
);
|
|
6028
|
-
const handleLegRemove =
|
|
6770
|
+
const handleLegRemove = React33.useCallback(
|
|
6029
6771
|
(index) => {
|
|
6030
6772
|
setLegs((prev) => prev.filter((_, i) => i !== index));
|
|
6031
6773
|
},
|
|
6032
6774
|
[]
|
|
6033
6775
|
);
|
|
6034
|
-
const handleAddLeg =
|
|
6776
|
+
const handleAddLeg = React33.useCallback(() => {
|
|
6035
6777
|
if (legs.length >= 4) return;
|
|
6036
6778
|
const atm = findATM(strikes, spotPrice);
|
|
6037
6779
|
setLegs((prev) => [
|
|
@@ -6039,14 +6781,14 @@ var StrategyBuilder = React30.forwardRef(
|
|
|
6039
6781
|
{ action: "buy", type: "call", strike: atm, expiration: defaultExp, quantity: 1 }
|
|
6040
6782
|
]);
|
|
6041
6783
|
}, [legs.length, strikes, spotPrice, defaultExp]);
|
|
6042
|
-
const netPremium =
|
|
6784
|
+
const netPremium = React33.useMemo(() => {
|
|
6043
6785
|
return legs.reduce((sum, leg) => {
|
|
6044
6786
|
if (leg.premium === void 0) return sum;
|
|
6045
6787
|
const sign = leg.action === "buy" ? -1 : 1;
|
|
6046
6788
|
return sum + sign * leg.premium * leg.quantity;
|
|
6047
6789
|
}, 0);
|
|
6048
6790
|
}, [legs]);
|
|
6049
|
-
const handleSubmit =
|
|
6791
|
+
const handleSubmit = React33.useCallback(() => {
|
|
6050
6792
|
if (!onSubmit || legs.length === 0) return;
|
|
6051
6793
|
onSubmit({
|
|
6052
6794
|
type: strategyType,
|
|
@@ -6166,8 +6908,10 @@ function buildPath(points, vb, width, height) {
|
|
|
6166
6908
|
});
|
|
6167
6909
|
return parts.join(" ");
|
|
6168
6910
|
}
|
|
6169
|
-
var LEG_COLORS = ["
|
|
6170
|
-
var
|
|
6911
|
+
var LEG_COLORS = ["var(--chart-1)", "var(--chart-2)", "var(--chart-3)", "var(--chart-4)"];
|
|
6912
|
+
var BREAKEVEN_COLOR = "var(--chart-1)";
|
|
6913
|
+
var BREAKEVEN_RING = "var(--background)";
|
|
6914
|
+
var PnlDiagram = React33.forwardRef(
|
|
6171
6915
|
function PnlDiagram2(props, ref) {
|
|
6172
6916
|
const {
|
|
6173
6917
|
legs,
|
|
@@ -6176,10 +6920,10 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6176
6920
|
className,
|
|
6177
6921
|
...rest
|
|
6178
6922
|
} = props;
|
|
6179
|
-
const containerRef =
|
|
6180
|
-
const [hoverX, setHoverX] =
|
|
6181
|
-
const [dims, setDims] =
|
|
6182
|
-
|
|
6923
|
+
const containerRef = React33.useRef(null);
|
|
6924
|
+
const [hoverX, setHoverX] = React33.useState(null);
|
|
6925
|
+
const [dims, setDims] = React33.useState({ width: 600, height: 240 });
|
|
6926
|
+
React33.useEffect(() => {
|
|
6183
6927
|
const el = containerRef.current;
|
|
6184
6928
|
if (!el) return;
|
|
6185
6929
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -6202,7 +6946,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6202
6946
|
const xMax = maxStrike + range * 0.3;
|
|
6203
6947
|
const SAMPLES = 200;
|
|
6204
6948
|
const step = (xMax - xMin) / SAMPLES;
|
|
6205
|
-
const combinedPoints =
|
|
6949
|
+
const combinedPoints = React33.useMemo(() => {
|
|
6206
6950
|
const pts = [];
|
|
6207
6951
|
for (let i = 0; i <= SAMPLES; i++) {
|
|
6208
6952
|
const price = xMin + i * step;
|
|
@@ -6210,7 +6954,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6210
6954
|
}
|
|
6211
6955
|
return pts;
|
|
6212
6956
|
}, [legs, multiplier, xMin, step]);
|
|
6213
|
-
const legPointSets =
|
|
6957
|
+
const legPointSets = React33.useMemo(() => {
|
|
6214
6958
|
return legs.map((leg) => {
|
|
6215
6959
|
const pts = [];
|
|
6216
6960
|
for (let i = 0; i <= SAMPLES; i++) {
|
|
@@ -6231,7 +6975,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6231
6975
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6232
6976
|
const scaleX = (x) => PADDING.left + (x - vb.xMin) / (vb.xMax - vb.xMin) * chartW;
|
|
6233
6977
|
const scaleY = (y) => PADDING.top + chartH - (y - vb.yMin) / (vb.yMax - vb.yMin) * chartH;
|
|
6234
|
-
const breakevens =
|
|
6978
|
+
const breakevens = React33.useMemo(() => {
|
|
6235
6979
|
const pts = [];
|
|
6236
6980
|
for (let i = 1; i < combinedPoints.length; i++) {
|
|
6237
6981
|
const prev = combinedPoints[i - 1];
|
|
@@ -6248,7 +6992,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6248
6992
|
const maxGainPoint = combinedPoints.find((p) => p.y === maxGain);
|
|
6249
6993
|
const maxLossPoint = combinedPoints.find((p) => p.y === maxLoss);
|
|
6250
6994
|
const zeroY = scaleY(0);
|
|
6251
|
-
const handleMouseMove =
|
|
6995
|
+
const handleMouseMove = React33.useCallback(
|
|
6252
6996
|
(e) => {
|
|
6253
6997
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
6254
6998
|
const mouseX = e.clientX - rect.left;
|
|
@@ -6261,7 +7005,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6261
7005
|
},
|
|
6262
7006
|
[vb.xMin, vb.xMax, chartW]
|
|
6263
7007
|
);
|
|
6264
|
-
const handleMouseLeave =
|
|
7008
|
+
const handleMouseLeave = React33.useCallback(() => setHoverX(null), []);
|
|
6265
7009
|
const hoverPnl = hoverX !== null ? calcTotalPnl(legs, hoverX, multiplier) : null;
|
|
6266
7010
|
buildPath(
|
|
6267
7011
|
combinedPoints.map((p) => ({ x: scaleX(p.x), y: scaleY(p.y) })).map((p) => ({ x: p.x - PADDING.left, y: p.y - PADDING.top })),
|
|
@@ -6408,13 +7152,13 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6408
7152
|
}
|
|
6409
7153
|
),
|
|
6410
7154
|
breakevens.map((be, i) => /* @__PURE__ */ jsxs("g", { children: [
|
|
6411
|
-
/* @__PURE__ */ jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill:
|
|
7155
|
+
/* @__PURE__ */ jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill: BREAKEVEN_COLOR, stroke: BREAKEVEN_RING, strokeWidth: "1" }),
|
|
6412
7156
|
/* @__PURE__ */ jsx(
|
|
6413
7157
|
"text",
|
|
6414
7158
|
{
|
|
6415
7159
|
x: scaleX(be),
|
|
6416
7160
|
y: PADDING.top + chartH + 14,
|
|
6417
|
-
fill:
|
|
7161
|
+
fill: BREAKEVEN_COLOR,
|
|
6418
7162
|
fontSize: "8",
|
|
6419
7163
|
fontFamily: "monospace",
|
|
6420
7164
|
textAnchor: "middle",
|
|
@@ -6455,7 +7199,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6455
7199
|
cy: scaleY(hoverPnl),
|
|
6456
7200
|
r: "3",
|
|
6457
7201
|
fill: hoverPnl >= 0 ? "#22c55e" : "#ef4444",
|
|
6458
|
-
stroke:
|
|
7202
|
+
stroke: BREAKEVEN_RING,
|
|
6459
7203
|
strokeWidth: "1"
|
|
6460
7204
|
}
|
|
6461
7205
|
),
|
|
@@ -6467,7 +7211,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6467
7211
|
width: "90",
|
|
6468
7212
|
height: "28",
|
|
6469
7213
|
rx: "3",
|
|
6470
|
-
fill:
|
|
7214
|
+
fill: BREAKEVEN_RING,
|
|
6471
7215
|
stroke: "#3f3f46",
|
|
6472
7216
|
strokeWidth: "1"
|
|
6473
7217
|
}
|
|
@@ -6549,7 +7293,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6549
7293
|
] })
|
|
6550
7294
|
] }, i)),
|
|
6551
7295
|
breakevens.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
6552
|
-
/* @__PURE__ */ jsx("div", { className: "h-1.5 w-1.5 rounded-full
|
|
7296
|
+
/* @__PURE__ */ jsx("div", { className: "h-1.5 w-1.5 rounded-full", style: { background: BREAKEVEN_COLOR } }),
|
|
6553
7297
|
/* @__PURE__ */ jsxs("span", { className: "text-[10px] text-zinc-500", children: [
|
|
6554
7298
|
"BE: ",
|
|
6555
7299
|
breakevens.map((b) => b.toFixed(1)).join(", ")
|
|
@@ -6565,7 +7309,7 @@ function formatDate(date) {
|
|
|
6565
7309
|
const d = new Date(date);
|
|
6566
7310
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
6567
7311
|
}
|
|
6568
|
-
var OptionPositionCard =
|
|
7312
|
+
var OptionPositionCard = React33.forwardRef(
|
|
6569
7313
|
function OptionPositionCard2(props, ref) {
|
|
6570
7314
|
const {
|
|
6571
7315
|
position,
|
|
@@ -6591,7 +7335,8 @@ var OptionPositionCard = React30.forwardRef(
|
|
|
6591
7335
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
6592
7336
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs("span", { className: cn(
|
|
6593
7337
|
"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-semibold",
|
|
6594
|
-
|
|
7338
|
+
// Call vs put is a rank difference, not a hue difference.
|
|
7339
|
+
isCall ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
|
|
6595
7340
|
), children: [
|
|
6596
7341
|
position.underlying,
|
|
6597
7342
|
/* @__PURE__ */ jsx("span", { className: "font-mono tabular-nums", children: position.strike }),
|
|
@@ -6717,8 +7462,9 @@ function ExpirationPill({ exp, isSelected, onClick }) {
|
|
|
6717
7462
|
/* @__PURE__ */ jsx("span", { className: "font-medium whitespace-nowrap", children: formatExpDate(exp.date) }),
|
|
6718
7463
|
/* @__PURE__ */ jsxs("span", { className: cn(
|
|
6719
7464
|
"font-mono tabular-nums text-[10px]",
|
|
6720
|
-
isSelected ? "text-
|
|
6721
|
-
|
|
7465
|
+
isSelected ? "text-[var(--foreground)]" : "text-[var(--muted-foreground)]",
|
|
7466
|
+
// Near expiry is a notice, and a notice in Lux is the loudest neutral.
|
|
7467
|
+
exp.dte <= 7 && !isSelected && "text-[var(--color-status-warn)]"
|
|
6722
7468
|
), children: [
|
|
6723
7469
|
exp.dte,
|
|
6724
7470
|
"d"
|
|
@@ -6727,7 +7473,7 @@ function ExpirationPill({ exp, isSelected, onClick }) {
|
|
|
6727
7473
|
}
|
|
6728
7474
|
);
|
|
6729
7475
|
}
|
|
6730
|
-
var ExpirationSelector =
|
|
7476
|
+
var ExpirationSelector = React33.forwardRef(
|
|
6731
7477
|
function ExpirationSelector2(props, ref) {
|
|
6732
7478
|
const {
|
|
6733
7479
|
expirations,
|
|
@@ -6737,8 +7483,8 @@ var ExpirationSelector = React30.forwardRef(
|
|
|
6737
7483
|
className,
|
|
6738
7484
|
...rest
|
|
6739
7485
|
} = props;
|
|
6740
|
-
const scrollRef =
|
|
6741
|
-
|
|
7486
|
+
const scrollRef = React33.useRef(null);
|
|
7487
|
+
React33.useEffect(() => {
|
|
6742
7488
|
const container = scrollRef.current;
|
|
6743
7489
|
if (!container) return;
|
|
6744
7490
|
const selectedEl = container.querySelector('[data-selected="true"]');
|
|
@@ -7050,4 +7796,4 @@ var BankPage = styled(View, {
|
|
|
7050
7796
|
padding: 16
|
|
7051
7797
|
});
|
|
7052
7798
|
|
|
7053
|
-
export { AccordionItem, AccordionItemContent, AccordionItemTrigger, AccordionRoot, Alert, AppProvider, Avatar, AvatarGroup, Badge, BankAlert, BankAlertText, BankButton, BankButtonText, BankCard, BankDivider, BankField, BankHeading, BankInput, BankPage, BankPinBox, BankText, Button, ButtonGroup, ButtonGroupRadio, Checkbox2 as Checkbox, CheckboxGroup2 as CheckboxGroup, CloseButton, CollapsibleDetails, CollapsibleList, ColorModeProvider, DialogActionTrigger, DialogBackdrop, DialogBody, DialogCloseTrigger, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger, DrawerActionTrigger, DrawerBody, DrawerCloseTrigger, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerRoot, DrawerTitle, DrawerTrigger, EmptyState, ExpirationSelector, Field, GreeksDisplay, Heading, IconButton,
|
|
7799
|
+
export { AccordionItem, AccordionItemContent, AccordionItemTrigger, AccordionRoot, Alert, AppNav, AppProvider, Avatar, AvatarGroup, Badge, BankAlert, BankAlertText, BankButton, BankButtonText, BankCard, BankDivider, BankField, BankHeading, BankInput, BankPage, BankPinBox, BankText, Button, ButtonGroup, ButtonGroupRadio, Checkbox2 as Checkbox, CheckboxGroup2 as CheckboxGroup, CloseButton, CollapsibleDetails, CollapsibleList, ColorModeProvider, DEFAULT_ORG, DialogActionTrigger, DialogBackdrop, DialogBody, DialogCloseTrigger, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger, DrawerActionTrigger, DrawerBody, DrawerCloseTrigger, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerRoot, DrawerTitle, DrawerTrigger, EmptyState, ExpirationSelector, Field, GreeksDisplay, Heading, IAM_PAGE_SIZE, IamError, IconButton, IdentityProvider, Image, Input, InputGroup, LUX_BRAND, Link, LinkBox, LinkExternalIcon, LinkOverlay, MenuArrow, MenuCheckboxItem, MenuContent, MenuItem, MenuItemGroup, MenuItemText, MenuRadioItem, MenuRadioItemGroup, MenuRoot, MenuSeparator, MenuTrigger, MenuTriggerItem, NARROW_PX, OptionChain, OptionPositionCard, OrgSwitcher, PARS_GOLD, PinInput, PnlDiagram, PopoverArrow, PopoverBody, PopoverCloseTrigger, PopoverCloseTriggerWrapper, PopoverContent, PopoverDescription, PopoverFooter, PopoverHeader, PopoverRoot, PopoverTitle, PopoverTrigger, Progress, ProgressCircleRing, ProgressCircleRoot, ProgressCircleValueText, ProjectSwitcher, Radio2 as Radio, RadioGroup3 as RadioGroup, Rating, Select, SelectAsync, SelectClearTrigger, SelectContent, SelectControl, SelectItem, SelectItemGroup, SelectItemText, SelectLabel, SelectRoot, SelectValueText, Separator2 as Separator, SettingsMenu, Skeleton, SkeletonCircle, SkeletonText, Slider, StrategyBuilder, Switch2 as Switch, Switcher, TOUCH_PX, TableBody, TableCaption, TableCell, TableColumnHeader, TableColumnHeaderSortable, TableFooter, TableHeader, TableHeaderSticky, TableRoot, TableRow, TableScrollWrapper, TabsContent, TabsCounter, TabsList, TabsRoot, TabsTrigger, Tag, Textarea, Toaster, Tooltip, UserMenu, bankColors, buttonVariants, cn, config, createListCollection, currentHost, lux_config_default as guiConfig, iam, iamBase, initials, luxThemes, orgIdentity, ORGS as orgs, resolveWhiteLabel, toaster, useAccordion, useBelow, useColorMode, useColorModeValue, useIdentity, useIsNarrow, useIsTouch, useWhiteLabel };
|