@luxfi/ui 7.4.0 → 7.4.3
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 +33 -35
- package/dist/badge.js +33 -35
- 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 +960 -0
- package/dist/chrome.d.cts +93 -0
- package/dist/chrome.d.ts +93 -0
- package/dist/chrome.js +931 -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 +216 -0
- package/dist/iam.d.cts +65 -0
- package/dist/iam.d.ts +65 -0
- package/dist/iam.js +211 -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 +430 -0
- package/dist/identity.d.cts +64 -0
- package/dist/identity.d.ts +64 -0
- package/dist/identity.js +408 -0
- package/dist/index.cjs +1610 -836
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1587 -831
- 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 +132 -0
- package/dist/next.d.cts +32 -0
- package/dist/next.d.ts +32 -0
- package/dist/next.js +129 -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 +146 -4
- package/dist/provider.d.cts +15 -3
- package/dist/provider.d.ts +15 -3
- package/dist/provider.js +146 -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 +34 -36
- package/dist/tag.js +33 -35
- package/dist/textarea.cjs +3 -1
- package/dist/textarea.js +3 -1
- package/dist/tooltip.cjs +28 -30
- package/dist/tooltip.js +27 -29
- 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 +109 -0
- package/dist/vite.d.cts +29 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.js +107 -0
- package/dist/white-label.cjs +142 -0
- package/dist/white-label.d.cts +59 -0
- package/dist/white-label.d.ts +59 -0
- package/dist/white-label.js +134 -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/engine.ts +130 -0
- 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 +89 -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 +15 -24
- package/src/use-narrow.ts +40 -0
- package/src/vite.ts +80 -0
- package/src/white-label.ts +254 -0
- package/tokens.css +613 -319
- package/src/tokens.css +0 -438
package/dist/index.js
CHANGED
|
@@ -1,38 +1,161 @@
|
|
|
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 issuer is `zoolabs.id` — the one row where it is not `<org>.id`,
|
|
50
|
+
// and the one every hand-rolled branding map gets wrong. `id.zoo.network`
|
|
51
|
+
// ANSWERS, which is why it keeps being copied around, but it is an alias:
|
|
52
|
+
// its own discovery document advertises
|
|
53
|
+
// issuer https://zoolabs.id
|
|
54
|
+
// authorization_endpoint https://zoolabs.id/v1/iam/oauth/authorize
|
|
55
|
+
// jwks_uri https://zoolabs.id/v1/iam/.well-known/jwks
|
|
56
|
+
// so a client configured on the alias validates `iss` against a string the
|
|
57
|
+
// IdP never emits and rejects every token it is given — the exact shape of
|
|
58
|
+
// the lux.id outage. `zoo.id` is not an IdP at all (no discovery document).
|
|
59
|
+
iamDomain: "zoolabs.id",
|
|
60
|
+
accent: LUX_BRAND.zoo,
|
|
61
|
+
accentForeground: "#FFFFFF"
|
|
62
|
+
},
|
|
63
|
+
bootnode: {
|
|
64
|
+
org: "bootnode",
|
|
65
|
+
name: "Bootnode",
|
|
66
|
+
domain: "bootno.de",
|
|
67
|
+
iamDomain: "id.bootno.de",
|
|
68
|
+
accent: LUX_BRAND.lux,
|
|
69
|
+
accentForeground: "#FFFFFF"
|
|
70
|
+
},
|
|
71
|
+
hanzo: {
|
|
72
|
+
org: "hanzo",
|
|
73
|
+
name: "Hanzo",
|
|
74
|
+
domain: "hanzo.ai",
|
|
75
|
+
iamDomain: "hanzo.id",
|
|
76
|
+
accent: LUX_BRAND.hanzo,
|
|
77
|
+
accentForeground: "#FFFFFF"
|
|
78
|
+
},
|
|
79
|
+
pars: {
|
|
80
|
+
org: "pars",
|
|
81
|
+
name: "Pars",
|
|
82
|
+
domain: "pars.id",
|
|
83
|
+
iamDomain: "pars.id",
|
|
84
|
+
accent: LUX_BRAND.pars,
|
|
85
|
+
accentForeground: PARS_GOLD
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var DOMAIN_ORG = [
|
|
89
|
+
["lux.network", "lux"],
|
|
90
|
+
["lux.cloud", "lux"],
|
|
91
|
+
["lux.id", "lux"],
|
|
92
|
+
["lux.finance", "lux"],
|
|
93
|
+
["lux.market", "lux"],
|
|
94
|
+
["lux.exchange", "lux"],
|
|
95
|
+
["zoo.ngo", "zoo"],
|
|
96
|
+
["zoo.network", "zoo"],
|
|
97
|
+
["zoo.cloud", "zoo"],
|
|
98
|
+
["zoolabs.id", "zoo"],
|
|
99
|
+
["hanzo.ai", "hanzo"],
|
|
100
|
+
["hanzo.cloud", "hanzo"],
|
|
101
|
+
["hanzo.id", "hanzo"],
|
|
102
|
+
["pars.id", "pars", "app"],
|
|
103
|
+
["pars.network", "pars", "app"],
|
|
104
|
+
["parsdao.org", "pars", "app"],
|
|
105
|
+
["bootno.de", "bootnode", "platform"]
|
|
106
|
+
];
|
|
107
|
+
var DEFAULT_ORG = "lux";
|
|
108
|
+
function normalizeHost(host) {
|
|
109
|
+
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
110
|
+
return noPort.replace(/\.$/, "");
|
|
111
|
+
}
|
|
112
|
+
function isUnder(host, domain) {
|
|
113
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
114
|
+
}
|
|
115
|
+
function matchDomain(host) {
|
|
116
|
+
let best;
|
|
117
|
+
for (const entry of DOMAIN_ORG) {
|
|
118
|
+
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
119
|
+
best = entry;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return best;
|
|
123
|
+
}
|
|
124
|
+
function appSlug(host, domain, pinned) {
|
|
125
|
+
if (pinned) return pinned;
|
|
126
|
+
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
127
|
+
const leftmost = sub.split(".")[0] ?? "";
|
|
128
|
+
if (leftmost && leftmost !== "www") return leftmost;
|
|
129
|
+
const label = domain.split(".")[0] ?? "";
|
|
130
|
+
const tld = domain.split(".").slice(1).join(".");
|
|
131
|
+
return tld.split(".")[0] || label;
|
|
132
|
+
}
|
|
133
|
+
function isLocal(host) {
|
|
134
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
135
|
+
}
|
|
136
|
+
function resolveWhiteLabel(host) {
|
|
137
|
+
const h = normalizeHost(host ?? "");
|
|
138
|
+
const match = h ? matchDomain(h) : void 0;
|
|
139
|
+
const org = match ? match[1] : DEFAULT_ORG;
|
|
140
|
+
const identity = ORGS[org];
|
|
141
|
+
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
142
|
+
return {
|
|
143
|
+
...identity,
|
|
144
|
+
host: h,
|
|
145
|
+
app,
|
|
146
|
+
theme: `dark_${org}`,
|
|
147
|
+
issuer: `https://${identity.iamDomain}`,
|
|
148
|
+
clientId: `${org}-${app}`
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function currentHost() {
|
|
152
|
+
return typeof window === "undefined" ? "" : window.location.host;
|
|
153
|
+
}
|
|
154
|
+
function orgIdentity(org) {
|
|
155
|
+
return ORGS[org];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/lux.config.ts
|
|
36
159
|
var TRUE_BLACK = "#000000";
|
|
37
160
|
var darkBase = {
|
|
38
161
|
...defaultConfig.themes.dark,
|
|
@@ -54,48 +177,1107 @@ var luxThemes = {
|
|
|
54
177
|
dark_lux: brandTheme(LUX_BRAND.lux),
|
|
55
178
|
dark_zoo: brandTheme(LUX_BRAND.zoo),
|
|
56
179
|
dark_hanzo: brandTheme(LUX_BRAND.hanzo),
|
|
57
|
-
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD })
|
|
180
|
+
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD }),
|
|
181
|
+
dark_bootnode: brandTheme(LUX_BRAND.bootnode)
|
|
182
|
+
};
|
|
183
|
+
var config = createGui({
|
|
184
|
+
...defaultConfig,
|
|
185
|
+
animations,
|
|
186
|
+
settings: {
|
|
187
|
+
...defaultConfig.settings,
|
|
188
|
+
onlyAllowShorthands: false
|
|
189
|
+
},
|
|
190
|
+
themes: {
|
|
191
|
+
...defaultConfig.themes,
|
|
192
|
+
...luxThemes
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
var lux_config_default = config;
|
|
196
|
+
var defaultQueryClient = new QueryClient({
|
|
197
|
+
defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
|
|
198
|
+
});
|
|
199
|
+
var FONT_BODY_RESET_ID = "lux-ui-font-body-reset";
|
|
200
|
+
var FONT_BODY_RESET_CSS = "body .font_body{line-height:1.5}";
|
|
201
|
+
var useFontBodyReset = () => {
|
|
202
|
+
React33__default.useInsertionEffect(() => {
|
|
203
|
+
if (typeof document === "undefined") return;
|
|
204
|
+
if (document.getElementById(FONT_BODY_RESET_ID)) return;
|
|
205
|
+
const style = document.createElement("style");
|
|
206
|
+
style.id = FONT_BODY_RESET_ID;
|
|
207
|
+
style.textContent = FONT_BODY_RESET_CSS;
|
|
208
|
+
document.head.appendChild(style);
|
|
209
|
+
}, []);
|
|
210
|
+
};
|
|
211
|
+
var WhiteLabelContext = React33__default.createContext(resolveWhiteLabel(""));
|
|
212
|
+
var useWhiteLabel = () => React33__default.useContext(WhiteLabelContext);
|
|
213
|
+
var useHostWhiteLabel = (host) => {
|
|
214
|
+
const [resolvedHost, setResolvedHost] = React33__default.useState(host ?? "");
|
|
215
|
+
React33__default.useEffect(() => {
|
|
216
|
+
if (host !== void 0) return;
|
|
217
|
+
const browserHost = currentHost();
|
|
218
|
+
if (browserHost) setResolvedHost(browserHost);
|
|
219
|
+
}, [host]);
|
|
220
|
+
return React33__default.useMemo(() => resolveWhiteLabel(resolvedHost), [resolvedHost]);
|
|
221
|
+
};
|
|
222
|
+
var AppProvider = ({
|
|
223
|
+
children,
|
|
224
|
+
queryClient,
|
|
225
|
+
host,
|
|
226
|
+
defaultTheme
|
|
227
|
+
}) => {
|
|
228
|
+
useFontBodyReset();
|
|
229
|
+
const whiteLabel = useHostWhiteLabel(host);
|
|
230
|
+
const theme = defaultTheme ?? whiteLabel.theme;
|
|
231
|
+
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 }) }) });
|
|
232
|
+
};
|
|
233
|
+
function cn(...inputs) {
|
|
234
|
+
return twMerge(clsx(inputs));
|
|
235
|
+
}
|
|
236
|
+
var NARROW_PX = 640;
|
|
237
|
+
var TOUCH_PX = 1024;
|
|
238
|
+
function useBelow(px) {
|
|
239
|
+
const [below, setBelow] = React33.useState(false);
|
|
240
|
+
React33.useEffect(() => {
|
|
241
|
+
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
242
|
+
const apply = () => setBelow(mql.matches);
|
|
243
|
+
apply();
|
|
244
|
+
mql.addEventListener("change", apply);
|
|
245
|
+
return () => mql.removeEventListener("change", apply);
|
|
246
|
+
}, [px]);
|
|
247
|
+
return below;
|
|
248
|
+
}
|
|
249
|
+
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
250
|
+
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
251
|
+
|
|
252
|
+
// src/iam.ts
|
|
253
|
+
var IamError = class extends Error {
|
|
254
|
+
constructor(message, status, unauthenticated) {
|
|
255
|
+
super(message);
|
|
256
|
+
this.name = "IamError";
|
|
257
|
+
this.status = status;
|
|
258
|
+
this.unauthenticated = unauthenticated;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
262
|
+
function isSignedOut(status, msg) {
|
|
263
|
+
return status === 401 || status === 403 || SIGNED_OUT.test(msg);
|
|
264
|
+
}
|
|
265
|
+
function iamBase(host) {
|
|
266
|
+
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
|
267
|
+
return `${wl.issuer}/v1/iam`;
|
|
268
|
+
}
|
|
269
|
+
async function read(call, verb, params) {
|
|
270
|
+
const url = new URL(`${call.base}/${verb}`);
|
|
271
|
+
for (const [k, v] of Object.entries(params)) url.searchParams.set(k, String(v));
|
|
272
|
+
let res;
|
|
273
|
+
try {
|
|
274
|
+
res = await fetch(url.toString(), {
|
|
275
|
+
method: "GET",
|
|
276
|
+
// The bearer is the whole credential. IAM does not allow credentialed
|
|
277
|
+
// CORS, so sending cookies would only get the response blocked.
|
|
278
|
+
headers: call.token ? { Authorization: `Bearer ${call.token}` } : {},
|
|
279
|
+
signal: call.signal
|
|
280
|
+
});
|
|
281
|
+
} catch (e) {
|
|
282
|
+
throw new IamError(e instanceof Error ? e.message : "IAM unreachable", 0, false);
|
|
283
|
+
}
|
|
284
|
+
const body = await res.json().catch(() => ({}));
|
|
285
|
+
const msg = typeof body.msg === "string" ? body.msg : "";
|
|
286
|
+
if (!res.ok || body.status === "error") {
|
|
287
|
+
throw new IamError(msg || `IAM ${verb} failed (${res.status})`, res.status, isSignedOut(res.status, msg));
|
|
288
|
+
}
|
|
289
|
+
return body.data;
|
|
290
|
+
}
|
|
291
|
+
var IAM_PAGE_SIZE = 20;
|
|
292
|
+
var iam = {
|
|
293
|
+
/** The signed-in principal, or null when there is no session. */
|
|
294
|
+
async account(call) {
|
|
295
|
+
try {
|
|
296
|
+
const data = await read(call, "get-account", {});
|
|
297
|
+
return data && data.name ? data : null;
|
|
298
|
+
} catch (e) {
|
|
299
|
+
if (e instanceof IamError && e.unauthenticated) return null;
|
|
300
|
+
throw e;
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* One page of the orgs the principal can see. IAM scopes the read to the
|
|
305
|
+
* caller's authority, so a normal member gets their own org and a super
|
|
306
|
+
* admin gets the tenant list — the page never has to decide.
|
|
307
|
+
*/
|
|
308
|
+
async organizations(call, page = 0, query = "", pageSize = IAM_PAGE_SIZE) {
|
|
309
|
+
const params = {
|
|
310
|
+
owner: "admin",
|
|
311
|
+
// IAM orgs live under the reserved `admin` owner
|
|
312
|
+
p: page + 1,
|
|
313
|
+
// the backend page is 1-based
|
|
314
|
+
pageSize,
|
|
315
|
+
sortField: "name",
|
|
316
|
+
sortOrder: "ascending"
|
|
317
|
+
};
|
|
318
|
+
const q = query.trim();
|
|
319
|
+
if (q) {
|
|
320
|
+
params.field = "name";
|
|
321
|
+
params.value = q;
|
|
322
|
+
}
|
|
323
|
+
return await read(call, "get-organizations", params) ?? [];
|
|
324
|
+
},
|
|
325
|
+
/** One organization by name. */
|
|
326
|
+
async organization(call, name) {
|
|
327
|
+
return await read(call, "get-organization", { id: `admin/${name}` }) ?? null;
|
|
328
|
+
},
|
|
329
|
+
/** Members of an organization. */
|
|
330
|
+
async users(call, org) {
|
|
331
|
+
return await read(call, "get-users", { owner: org }) ?? [];
|
|
332
|
+
},
|
|
333
|
+
/** The organization's projects — IAM keys this read by `organization`. */
|
|
334
|
+
async projects(call, org) {
|
|
335
|
+
return await read(call, "get-organization-projects", { organization: org }) ?? [];
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
var IAM_TOKEN_KEY = "hanzo_iam_access_token";
|
|
339
|
+
function storedToken() {
|
|
340
|
+
if (typeof window === "undefined") return null;
|
|
341
|
+
for (const store of [window.sessionStorage, window.localStorage]) {
|
|
342
|
+
try {
|
|
343
|
+
const t = store.getItem(IAM_TOKEN_KEY);
|
|
344
|
+
if (t) return t;
|
|
345
|
+
} catch {
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
function clearStoredTokens() {
|
|
351
|
+
if (typeof window === "undefined") return;
|
|
352
|
+
for (const store of [window.sessionStorage, window.localStorage]) {
|
|
353
|
+
try {
|
|
354
|
+
for (const k of ["access_token", "refresh_token", "id_token", "expires_at"]) {
|
|
355
|
+
store.removeItem(`hanzo_iam_${k}`);
|
|
356
|
+
}
|
|
357
|
+
} catch {
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
var defaultAuth = {};
|
|
362
|
+
var scopeKey = (host, kind) => `lux-ui:${kind}:${host}`;
|
|
363
|
+
function readScope(host, kind) {
|
|
364
|
+
if (typeof window === "undefined") return null;
|
|
365
|
+
try {
|
|
366
|
+
return window.localStorage.getItem(scopeKey(host, kind));
|
|
367
|
+
} catch {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function writeScope(host, kind, value) {
|
|
372
|
+
if (typeof window === "undefined") return;
|
|
373
|
+
try {
|
|
374
|
+
window.localStorage.setItem(scopeKey(host, kind), value);
|
|
375
|
+
} catch {
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
var IdentityContext = React33.createContext(null);
|
|
379
|
+
var IdentityProvider = ({
|
|
380
|
+
children,
|
|
381
|
+
auth = defaultAuth,
|
|
382
|
+
loginPath = "/login"
|
|
383
|
+
}) => {
|
|
384
|
+
const whiteLabel = useWhiteLabel();
|
|
385
|
+
const base = React33.useMemo(() => iamBase(whiteLabel), [whiteLabel]);
|
|
386
|
+
const [status, setStatus] = React33.useState("loading");
|
|
387
|
+
const [account, setAccount] = React33.useState(null);
|
|
388
|
+
const [orgs, setOrgs] = React33.useState([]);
|
|
389
|
+
const [projects, setProjects] = React33.useState([]);
|
|
390
|
+
const [error, setError] = React33.useState(null);
|
|
391
|
+
const [orgName, setOrgName] = React33.useState(null);
|
|
392
|
+
const [projectName, setProjectName] = React33.useState(null);
|
|
393
|
+
const [epoch, setEpoch] = React33.useState(0);
|
|
394
|
+
React33.useEffect(() => {
|
|
395
|
+
const ac = new AbortController();
|
|
396
|
+
let live = true;
|
|
397
|
+
void (async () => {
|
|
398
|
+
const token = await (auth.token ?? storedToken)();
|
|
399
|
+
if (!live) return;
|
|
400
|
+
if (!token) {
|
|
401
|
+
setStatus("anonymous");
|
|
402
|
+
setAccount(null);
|
|
403
|
+
setOrgs([]);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const call = { base, token, signal: ac.signal };
|
|
407
|
+
try {
|
|
408
|
+
const me = await iam.account(call);
|
|
409
|
+
if (!live) return;
|
|
410
|
+
if (!me) {
|
|
411
|
+
setStatus("anonymous");
|
|
412
|
+
setAccount(null);
|
|
413
|
+
setOrgs([]);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
setAccount(me);
|
|
417
|
+
const rows = await iam.organizations(call).catch((e) => {
|
|
418
|
+
if (e instanceof IamError && !e.unauthenticated) return [{ owner: "admin", name: me.owner }];
|
|
419
|
+
throw e;
|
|
420
|
+
});
|
|
421
|
+
if (!live) return;
|
|
422
|
+
setOrgs(rows);
|
|
423
|
+
setStatus("ready");
|
|
424
|
+
setError(null);
|
|
425
|
+
} catch (e) {
|
|
426
|
+
if (!live || ac.signal.aborted) return;
|
|
427
|
+
if (e instanceof IamError && e.unauthenticated) {
|
|
428
|
+
setStatus("anonymous");
|
|
429
|
+
setAccount(null);
|
|
430
|
+
setOrgs([]);
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
setStatus("error");
|
|
434
|
+
setError(e instanceof Error ? e.message : "Could not reach IAM.");
|
|
435
|
+
}
|
|
436
|
+
})();
|
|
437
|
+
return () => {
|
|
438
|
+
live = false;
|
|
439
|
+
ac.abort();
|
|
440
|
+
};
|
|
441
|
+
}, [base, auth, epoch]);
|
|
442
|
+
const org = React33.useMemo(() => {
|
|
443
|
+
if (orgs.length === 0) return null;
|
|
444
|
+
const saved = orgName ?? readScope(whiteLabel.host, "org");
|
|
445
|
+
return orgs.find((o) => o.name === saved) ?? orgs.find((o) => o.name === account?.owner) ?? orgs[0];
|
|
446
|
+
}, [orgs, orgName, account, whiteLabel.host]);
|
|
447
|
+
React33.useEffect(() => {
|
|
448
|
+
if (!org) {
|
|
449
|
+
setProjects([]);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const ac = new AbortController();
|
|
453
|
+
let live = true;
|
|
454
|
+
void (async () => {
|
|
455
|
+
const token = await (auth.token ?? storedToken)();
|
|
456
|
+
if (!live || !token) return;
|
|
457
|
+
const rows = await iam.projects({ base, token, signal: ac.signal }, org.name).catch(() => []);
|
|
458
|
+
if (live) setProjects(rows);
|
|
459
|
+
})();
|
|
460
|
+
return () => {
|
|
461
|
+
live = false;
|
|
462
|
+
ac.abort();
|
|
463
|
+
};
|
|
464
|
+
}, [base, auth, org, epoch]);
|
|
465
|
+
const project = React33.useMemo(() => {
|
|
466
|
+
if (projects.length === 0) return null;
|
|
467
|
+
const saved = projectName ?? readScope(whiteLabel.host, "project");
|
|
468
|
+
return projects.find((p) => p.name === saved) ?? projects.find((p) => p.isDefault) ?? projects[0];
|
|
469
|
+
}, [projects, projectName, whiteLabel.host]);
|
|
470
|
+
const value = React33.useMemo(() => ({
|
|
471
|
+
status,
|
|
472
|
+
account,
|
|
473
|
+
orgs,
|
|
474
|
+
org,
|
|
475
|
+
projects,
|
|
476
|
+
project,
|
|
477
|
+
error,
|
|
478
|
+
whiteLabel,
|
|
479
|
+
setOrg: (name) => {
|
|
480
|
+
writeScope(whiteLabel.host, "org", name);
|
|
481
|
+
setOrgName(name);
|
|
482
|
+
setProjectName(null);
|
|
483
|
+
},
|
|
484
|
+
setProject: (name) => {
|
|
485
|
+
writeScope(whiteLabel.host, "project", name);
|
|
486
|
+
setProjectName(name);
|
|
487
|
+
},
|
|
488
|
+
signIn: () => {
|
|
489
|
+
if (auth.signIn) return auth.signIn();
|
|
490
|
+
if (typeof window !== "undefined") window.location.assign(loginPath);
|
|
491
|
+
},
|
|
492
|
+
signOut: () => {
|
|
493
|
+
if (auth.signOut) return auth.signOut();
|
|
494
|
+
clearStoredTokens();
|
|
495
|
+
if (typeof window !== "undefined") window.location.assign(loginPath);
|
|
496
|
+
},
|
|
497
|
+
reload: () => setEpoch((n) => n + 1)
|
|
498
|
+
}), [status, account, orgs, org, projects, project, error, whiteLabel, auth, loginPath]);
|
|
499
|
+
return /* @__PURE__ */ jsx(IdentityContext.Provider, { value, children });
|
|
500
|
+
};
|
|
501
|
+
function useIdentity() {
|
|
502
|
+
const ctx = React33.useContext(IdentityContext);
|
|
503
|
+
const whiteLabel = useWhiteLabel();
|
|
504
|
+
const fallback = React33.useMemo(() => ({
|
|
505
|
+
status: "anonymous",
|
|
506
|
+
account: null,
|
|
507
|
+
orgs: [],
|
|
508
|
+
org: null,
|
|
509
|
+
projects: [],
|
|
510
|
+
project: null,
|
|
511
|
+
error: null,
|
|
512
|
+
whiteLabel,
|
|
513
|
+
setOrg: () => void 0,
|
|
514
|
+
setProject: () => void 0,
|
|
515
|
+
signIn: () => {
|
|
516
|
+
if (typeof window !== "undefined") window.location.assign("/login");
|
|
517
|
+
},
|
|
518
|
+
signOut: () => void 0,
|
|
519
|
+
reload: () => void 0
|
|
520
|
+
}), [whiteLabel]);
|
|
521
|
+
return ctx ?? fallback;
|
|
522
|
+
}
|
|
523
|
+
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";
|
|
524
|
+
var CloseButtonFrame = styled(View, {
|
|
525
|
+
name: "LuxCloseButton",
|
|
526
|
+
render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
|
|
527
|
+
role: "button",
|
|
528
|
+
cursor: "pointer",
|
|
529
|
+
display: "inline-flex",
|
|
530
|
+
alignItems: "center",
|
|
531
|
+
justifyContent: "center",
|
|
532
|
+
width: 20,
|
|
533
|
+
height: 20,
|
|
534
|
+
minWidth: 0,
|
|
535
|
+
flexShrink: 1,
|
|
536
|
+
padding: 0,
|
|
537
|
+
borderRadius: 4,
|
|
538
|
+
borderWidth: 0,
|
|
539
|
+
overflow: "hidden",
|
|
540
|
+
backgroundColor: "transparent",
|
|
541
|
+
hoverStyle: {
|
|
542
|
+
backgroundColor: "transparent"
|
|
543
|
+
},
|
|
544
|
+
variants: {
|
|
545
|
+
disabled: {
|
|
546
|
+
true: {
|
|
547
|
+
opacity: 0.4,
|
|
548
|
+
pointerEvents: "none"
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
var CLOSE_BUTTON_CLASSES = [
|
|
554
|
+
"text-[var(--closeButton-fg,currentColor)]",
|
|
555
|
+
"hover:text-[var(--hover-color,currentColor)]",
|
|
556
|
+
"disabled:opacity-40"
|
|
557
|
+
].join(" ");
|
|
558
|
+
var CloseButton = React33.forwardRef(function CloseButton2(props, ref) {
|
|
559
|
+
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
560
|
+
return /* @__PURE__ */ jsx(
|
|
561
|
+
CloseButtonFrame,
|
|
562
|
+
{
|
|
563
|
+
ref,
|
|
564
|
+
className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
|
|
565
|
+
...rest,
|
|
566
|
+
children: children ?? /* @__PURE__ */ jsx(
|
|
567
|
+
"svg",
|
|
568
|
+
{
|
|
569
|
+
className: "size-5",
|
|
570
|
+
viewBox: "0 0 20 20",
|
|
571
|
+
fill: "none",
|
|
572
|
+
"aria-hidden": "true",
|
|
573
|
+
children: /* @__PURE__ */ jsx(
|
|
574
|
+
"path",
|
|
575
|
+
{
|
|
576
|
+
d: CLOSE_ICON_PATH,
|
|
577
|
+
fill: "currentColor"
|
|
578
|
+
}
|
|
579
|
+
)
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
}
|
|
583
|
+
);
|
|
584
|
+
});
|
|
585
|
+
var DrawerPlacementContext = React33.createContext("right");
|
|
586
|
+
var DrawerSizeContext = React33.createContext("md");
|
|
587
|
+
var DrawerStateContext = React33.createContext({
|
|
588
|
+
open: false,
|
|
589
|
+
setOpen: () => {
|
|
590
|
+
},
|
|
591
|
+
modal: true
|
|
592
|
+
});
|
|
593
|
+
var DrawerRoot = (props) => {
|
|
594
|
+
const {
|
|
595
|
+
children,
|
|
596
|
+
open,
|
|
597
|
+
defaultOpen,
|
|
598
|
+
onOpenChange,
|
|
599
|
+
placement = "right",
|
|
600
|
+
modal = true,
|
|
601
|
+
size = "md"
|
|
602
|
+
} = props;
|
|
603
|
+
const [uncontrolled, setUncontrolled] = React33.useState(defaultOpen ?? false);
|
|
604
|
+
const isControlled = open !== void 0;
|
|
605
|
+
const isOpen = isControlled ? open : uncontrolled;
|
|
606
|
+
const setOpen = React33.useCallback((nextOpen) => {
|
|
607
|
+
if (!isControlled) setUncontrolled(nextOpen);
|
|
608
|
+
onOpenChange?.({ open: nextOpen });
|
|
609
|
+
}, [isControlled, onOpenChange]);
|
|
610
|
+
const state = React33.useMemo(
|
|
611
|
+
() => ({ open: isOpen, setOpen, modal }),
|
|
612
|
+
[isOpen, setOpen, modal]
|
|
613
|
+
);
|
|
614
|
+
return /* @__PURE__ */ jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(DrawerStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(
|
|
615
|
+
RadixDialog.Root,
|
|
616
|
+
{
|
|
617
|
+
open: isOpen,
|
|
618
|
+
onOpenChange: setOpen,
|
|
619
|
+
modal,
|
|
620
|
+
children
|
|
621
|
+
}
|
|
622
|
+
) }) }) });
|
|
623
|
+
};
|
|
624
|
+
var PLACEMENT_CLASSES = {
|
|
625
|
+
right: [
|
|
626
|
+
"inset-y-0 right-0",
|
|
627
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
|
|
628
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
|
|
629
|
+
].join(" "),
|
|
630
|
+
left: [
|
|
631
|
+
"inset-y-0 left-0",
|
|
632
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
|
|
633
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
|
|
634
|
+
].join(" "),
|
|
635
|
+
top: [
|
|
636
|
+
"inset-x-0 top-0",
|
|
637
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
|
|
638
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
|
|
639
|
+
].join(" "),
|
|
640
|
+
bottom: [
|
|
641
|
+
"inset-x-0 bottom-0",
|
|
642
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
|
|
643
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
|
|
644
|
+
].join(" ")
|
|
645
|
+
};
|
|
646
|
+
var SIZE_CLASSES = {
|
|
647
|
+
right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
648
|
+
left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
649
|
+
top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
|
|
650
|
+
bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
|
|
651
|
+
};
|
|
652
|
+
var DrawerContent = React33.forwardRef(
|
|
653
|
+
function DrawerContent2(props, ref) {
|
|
654
|
+
const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
|
|
655
|
+
const placement = React33.useContext(DrawerPlacementContext);
|
|
656
|
+
const size = React33.useContext(DrawerSizeContext);
|
|
657
|
+
const { open, setOpen, modal } = React33.useContext(DrawerStateContext);
|
|
658
|
+
const isNarrow = useIsNarrow();
|
|
659
|
+
if (isNarrow) {
|
|
660
|
+
return /* @__PURE__ */ jsxs(
|
|
661
|
+
Sheet,
|
|
662
|
+
{
|
|
663
|
+
open,
|
|
664
|
+
onOpenChange: setOpen,
|
|
665
|
+
modal,
|
|
666
|
+
dismissOnSnapToBottom: true,
|
|
667
|
+
snapPointsMode: "percent",
|
|
668
|
+
snapPoints: [88],
|
|
669
|
+
transition: "medium",
|
|
670
|
+
children: [
|
|
671
|
+
backdrop && /* @__PURE__ */ jsx(
|
|
672
|
+
Sheet.Overlay,
|
|
673
|
+
{
|
|
674
|
+
transition: "lazy",
|
|
675
|
+
enterStyle: { opacity: 0 },
|
|
676
|
+
exitStyle: { opacity: 0 },
|
|
677
|
+
className: "bg-black/50"
|
|
678
|
+
}
|
|
679
|
+
),
|
|
680
|
+
/* @__PURE__ */ jsx(Sheet.Handle, {}),
|
|
681
|
+
/* @__PURE__ */ jsx(
|
|
682
|
+
Sheet.Frame,
|
|
683
|
+
{
|
|
684
|
+
unstyled: true,
|
|
685
|
+
className: cn(
|
|
686
|
+
"flex flex-col rounded-t-2xl bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)]",
|
|
687
|
+
className
|
|
688
|
+
),
|
|
689
|
+
...rest,
|
|
690
|
+
children
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
698
|
+
backdrop && /* @__PURE__ */ jsx(
|
|
699
|
+
RadixDialog.Overlay,
|
|
700
|
+
{
|
|
701
|
+
className: cn(
|
|
702
|
+
"fixed inset-0 z-50 bg-black/50",
|
|
703
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
704
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
|
|
705
|
+
)
|
|
706
|
+
}
|
|
707
|
+
),
|
|
708
|
+
/* @__PURE__ */ jsx(
|
|
709
|
+
RadixDialog.Content,
|
|
710
|
+
{
|
|
711
|
+
ref,
|
|
712
|
+
className: cn(
|
|
713
|
+
"fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
|
|
714
|
+
PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
|
|
715
|
+
SIZE_CLASSES[placement]?.[size] ?? SIZE_CLASSES.right?.md,
|
|
716
|
+
className
|
|
717
|
+
),
|
|
718
|
+
...rest,
|
|
719
|
+
children
|
|
720
|
+
}
|
|
721
|
+
)
|
|
722
|
+
] });
|
|
723
|
+
if (portalled) {
|
|
724
|
+
return /* @__PURE__ */ jsx(RadixDialog.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
725
|
+
}
|
|
726
|
+
return content;
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
var DrawerCloseTrigger = React33.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
730
|
+
return /* @__PURE__ */ jsx(RadixDialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
731
|
+
CloseButton,
|
|
732
|
+
{
|
|
733
|
+
ref,
|
|
734
|
+
className: cn("absolute top-7 right-5", props.className),
|
|
735
|
+
...props
|
|
736
|
+
}
|
|
737
|
+
) });
|
|
738
|
+
});
|
|
739
|
+
var DrawerTrigger = (props) => {
|
|
740
|
+
const { asChild = true, ...rest } = props;
|
|
741
|
+
return /* @__PURE__ */ jsx(RadixDialog.Trigger, { asChild, ...rest });
|
|
742
|
+
};
|
|
743
|
+
var DrawerHeader = React33.forwardRef(
|
|
744
|
+
function DrawerHeader2({ className, ...props }, ref) {
|
|
745
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
|
|
746
|
+
}
|
|
747
|
+
);
|
|
748
|
+
var DrawerBody = React33.forwardRef(
|
|
749
|
+
function DrawerBody2({ className, ...props }, ref) {
|
|
750
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
|
|
751
|
+
}
|
|
752
|
+
);
|
|
753
|
+
var DrawerFooter = React33.forwardRef(
|
|
754
|
+
function DrawerFooter2({ className, ...props }, ref) {
|
|
755
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
var DrawerTitle = RadixDialog.Title;
|
|
759
|
+
var DrawerDescription = RadixDialog.Description;
|
|
760
|
+
var DrawerActionTrigger = RadixDialog.Close;
|
|
761
|
+
function parsePlacement(placement) {
|
|
762
|
+
if (!placement) {
|
|
763
|
+
return { side: "bottom", align: "start" };
|
|
764
|
+
}
|
|
765
|
+
const parts = placement.split("-");
|
|
766
|
+
const side = parts[0] ?? "bottom";
|
|
767
|
+
const alignPart = parts[1];
|
|
768
|
+
let align = "center";
|
|
769
|
+
if (alignPart === "start") {
|
|
770
|
+
align = "start";
|
|
771
|
+
} else if (alignPart === "end") {
|
|
772
|
+
align = "end";
|
|
773
|
+
}
|
|
774
|
+
return { side, align };
|
|
775
|
+
}
|
|
776
|
+
var PositioningContext = React33.createContext({
|
|
777
|
+
side: "bottom",
|
|
778
|
+
align: "start",
|
|
779
|
+
sideOffset: 4,
|
|
780
|
+
alignOffset: 0
|
|
781
|
+
});
|
|
782
|
+
var MenuRoot = (props) => {
|
|
783
|
+
const {
|
|
784
|
+
children,
|
|
785
|
+
open,
|
|
786
|
+
defaultOpen,
|
|
787
|
+
onOpenChange,
|
|
788
|
+
positioning,
|
|
789
|
+
modal = true,
|
|
790
|
+
// lazyMount / unmountOnExit have no direct Radix equivalent; Radix handles
|
|
791
|
+
// mount/unmount automatically.
|
|
792
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
793
|
+
lazyMount: _lazyMount,
|
|
794
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
795
|
+
unmountOnExit: _unmountOnExit
|
|
796
|
+
} = props;
|
|
797
|
+
const mergedPositioning = {
|
|
798
|
+
placement: "bottom-start",
|
|
799
|
+
...positioning,
|
|
800
|
+
offset: {
|
|
801
|
+
mainAxis: 4,
|
|
802
|
+
...positioning?.offset
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
const { side, align } = parsePlacement(mergedPositioning.placement);
|
|
806
|
+
const positioningValue = React33.useMemo(() => ({
|
|
807
|
+
side,
|
|
808
|
+
align,
|
|
809
|
+
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
810
|
+
alignOffset: mergedPositioning.offset?.crossAxis ?? 0
|
|
811
|
+
}), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
|
|
812
|
+
const handleOpenChange = React33.useCallback((isOpen) => {
|
|
813
|
+
onOpenChange?.({ open: isOpen });
|
|
814
|
+
}, [onOpenChange]);
|
|
815
|
+
return /* @__PURE__ */ jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsx(
|
|
816
|
+
DropdownMenu.Root,
|
|
817
|
+
{
|
|
818
|
+
open,
|
|
819
|
+
defaultOpen,
|
|
820
|
+
onOpenChange: handleOpenChange,
|
|
821
|
+
modal,
|
|
822
|
+
children
|
|
823
|
+
}
|
|
824
|
+
) });
|
|
825
|
+
};
|
|
826
|
+
var MenuTrigger = React33.forwardRef(function MenuTrigger2(props, ref) {
|
|
827
|
+
const { asChild = false, ...rest } = props;
|
|
828
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild, ref, ...rest });
|
|
829
|
+
});
|
|
830
|
+
var MenuContent = React33.forwardRef(function MenuContent2(props, ref) {
|
|
831
|
+
const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
|
|
832
|
+
const positioning = React33.useContext(PositioningContext);
|
|
833
|
+
const mergedStyle = {
|
|
834
|
+
...style,
|
|
835
|
+
...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
|
|
836
|
+
...minW !== void 0 ? { minWidth: minW } : {}
|
|
837
|
+
};
|
|
838
|
+
const content = /* @__PURE__ */ jsx(
|
|
839
|
+
DropdownMenu.Content,
|
|
840
|
+
{
|
|
841
|
+
ref,
|
|
842
|
+
side: positioning.side,
|
|
843
|
+
align: positioning.align,
|
|
844
|
+
sideOffset: positioning.sideOffset,
|
|
845
|
+
alignOffset: positioning.alignOffset,
|
|
846
|
+
className: cn(
|
|
847
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-lg p-1",
|
|
848
|
+
"border border-[var(--color-popover-border,var(--color-border-divider))]",
|
|
849
|
+
"bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
|
|
850
|
+
"shadow-[0_4px_12px_var(--color-popover-shadow)]",
|
|
851
|
+
"outline-none",
|
|
852
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
853
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
854
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
855
|
+
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
856
|
+
className
|
|
857
|
+
),
|
|
858
|
+
style: Object.keys(mergedStyle).length > 0 ? mergedStyle : void 0,
|
|
859
|
+
...rest
|
|
860
|
+
}
|
|
861
|
+
);
|
|
862
|
+
if (!portalled) {
|
|
863
|
+
return content;
|
|
864
|
+
}
|
|
865
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
866
|
+
});
|
|
867
|
+
var MenuItem = React33.forwardRef(function MenuItem2(props, ref) {
|
|
868
|
+
const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
|
|
869
|
+
return /* @__PURE__ */ jsx(
|
|
870
|
+
DropdownMenu.Item,
|
|
871
|
+
{
|
|
872
|
+
ref,
|
|
873
|
+
asChild,
|
|
874
|
+
disabled,
|
|
875
|
+
onClick,
|
|
876
|
+
className: cn(
|
|
877
|
+
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
878
|
+
"outline-none transition-colors",
|
|
879
|
+
"text-[var(--color-text-primary,inherit)]",
|
|
880
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
881
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
882
|
+
className
|
|
883
|
+
),
|
|
884
|
+
...rest,
|
|
885
|
+
children
|
|
886
|
+
}
|
|
887
|
+
);
|
|
888
|
+
});
|
|
889
|
+
var MenuItemText = React33.forwardRef(function MenuItemText2(props, ref) {
|
|
890
|
+
const { className, ...rest } = props;
|
|
891
|
+
return /* @__PURE__ */ jsx("span", { ref, className: cn("flex-1", className), ...rest });
|
|
892
|
+
});
|
|
893
|
+
React33.forwardRef(function MenuItemCommand2(props, ref) {
|
|
894
|
+
const { className, ...rest } = props;
|
|
895
|
+
return /* @__PURE__ */ jsx(
|
|
896
|
+
"span",
|
|
897
|
+
{
|
|
898
|
+
ref,
|
|
899
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
900
|
+
...rest
|
|
901
|
+
}
|
|
902
|
+
);
|
|
903
|
+
});
|
|
904
|
+
var MenuSeparator = React33.forwardRef(function MenuSeparator2(props, ref) {
|
|
905
|
+
const { className, ...rest } = props;
|
|
906
|
+
return /* @__PURE__ */ jsx(
|
|
907
|
+
DropdownMenu.Separator,
|
|
908
|
+
{
|
|
909
|
+
ref,
|
|
910
|
+
className: cn("-mx-1 my-1 h-px bg-[var(--color-border-divider)]", className),
|
|
911
|
+
...rest
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
});
|
|
915
|
+
var MenuItemGroup = React33.forwardRef(function MenuItemGroup2(props, ref) {
|
|
916
|
+
const { title, children, className, ...rest } = props;
|
|
917
|
+
return /* @__PURE__ */ jsxs(DropdownMenu.Group, { ref, className, ...rest, children: [
|
|
918
|
+
title && /* @__PURE__ */ jsx(DropdownMenu.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
|
|
919
|
+
children
|
|
920
|
+
] });
|
|
921
|
+
});
|
|
922
|
+
var MenuArrow = React33.forwardRef(function MenuArrow2(props, ref) {
|
|
923
|
+
const { className, ...rest } = props;
|
|
924
|
+
return /* @__PURE__ */ jsx(
|
|
925
|
+
DropdownMenu.Arrow,
|
|
926
|
+
{
|
|
927
|
+
ref,
|
|
928
|
+
className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
|
|
929
|
+
...rest
|
|
930
|
+
}
|
|
931
|
+
);
|
|
932
|
+
});
|
|
933
|
+
var MenuCheckboxItem = React33.forwardRef(function MenuCheckboxItem2(props, ref) {
|
|
934
|
+
const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
|
|
935
|
+
return /* @__PURE__ */ jsxs(
|
|
936
|
+
DropdownMenu.CheckboxItem,
|
|
937
|
+
{
|
|
938
|
+
ref,
|
|
939
|
+
checked,
|
|
940
|
+
onCheckedChange,
|
|
941
|
+
onClick,
|
|
942
|
+
className: cn(
|
|
943
|
+
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
944
|
+
"outline-none transition-colors",
|
|
945
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
946
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
947
|
+
className
|
|
948
|
+
),
|
|
949
|
+
...rest,
|
|
950
|
+
children: [
|
|
951
|
+
/* @__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" }) }) }),
|
|
952
|
+
children
|
|
953
|
+
]
|
|
954
|
+
}
|
|
955
|
+
);
|
|
956
|
+
});
|
|
957
|
+
var MenuRadioItemGroup = React33.forwardRef(function MenuRadioItemGroup2(props, ref) {
|
|
958
|
+
const { value, onValueChange, ...rest } = props;
|
|
959
|
+
return /* @__PURE__ */ jsx(
|
|
960
|
+
DropdownMenu.RadioGroup,
|
|
961
|
+
{
|
|
962
|
+
ref,
|
|
963
|
+
value,
|
|
964
|
+
onValueChange,
|
|
965
|
+
...rest
|
|
966
|
+
}
|
|
967
|
+
);
|
|
968
|
+
});
|
|
969
|
+
var MenuRadioItem = React33.forwardRef(function MenuRadioItem2(props, ref) {
|
|
970
|
+
const { className, children, value, onClick, ...rest } = props;
|
|
971
|
+
const { value: _v, ...radixRest } = rest;
|
|
972
|
+
return /* @__PURE__ */ jsxs(
|
|
973
|
+
DropdownMenu.RadioItem,
|
|
974
|
+
{
|
|
975
|
+
ref,
|
|
976
|
+
value,
|
|
977
|
+
onClick,
|
|
978
|
+
className: cn(
|
|
979
|
+
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
980
|
+
"outline-none transition-colors",
|
|
981
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
982
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
983
|
+
className
|
|
984
|
+
),
|
|
985
|
+
children: [
|
|
986
|
+
/* @__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" }) }) }),
|
|
987
|
+
/* @__PURE__ */ jsx("span", { children })
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
);
|
|
991
|
+
});
|
|
992
|
+
React33.forwardRef(function MenuContextTrigger2(props, ref) {
|
|
993
|
+
const { asChild: _asChild, ...rest } = props;
|
|
994
|
+
return /* @__PURE__ */ jsx("span", { ref, ...rest });
|
|
995
|
+
});
|
|
996
|
+
var MenuTriggerItem = React33.forwardRef(function MenuTriggerItem2(props, ref) {
|
|
997
|
+
const { startIcon, children, className, ...rest } = props;
|
|
998
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Sub, { children: /* @__PURE__ */ jsxs(
|
|
999
|
+
DropdownMenu.SubTrigger,
|
|
1000
|
+
{
|
|
1001
|
+
ref,
|
|
1002
|
+
className: cn(
|
|
1003
|
+
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
1004
|
+
"outline-none transition-colors",
|
|
1005
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
1006
|
+
className
|
|
1007
|
+
),
|
|
1008
|
+
...rest,
|
|
1009
|
+
children: [
|
|
1010
|
+
startIcon,
|
|
1011
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children }),
|
|
1012
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
1013
|
+
]
|
|
1014
|
+
}
|
|
1015
|
+
) });
|
|
1016
|
+
});
|
|
1017
|
+
function initials(label) {
|
|
1018
|
+
return label.split(/[\s._-]+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2).toUpperCase();
|
|
1019
|
+
}
|
|
1020
|
+
var Monogram = ({ label, logo }) => logo ? /* @__PURE__ */ jsx("img", { src: logo, alt: "", className: "h-5 w-5 shrink-0 rounded object-contain" }) : /* @__PURE__ */ jsx(
|
|
1021
|
+
"span",
|
|
1022
|
+
{
|
|
1023
|
+
"aria-hidden": "true",
|
|
1024
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded bg-[rgba(127,127,127,0.22)] text-[10px] font-bold",
|
|
1025
|
+
children: initials(label)
|
|
1026
|
+
}
|
|
1027
|
+
);
|
|
1028
|
+
var Row = ({ item, onDone, menu }) => {
|
|
1029
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1030
|
+
item.icon,
|
|
1031
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: item.label }),
|
|
1032
|
+
item.hint ? /* @__PURE__ */ jsx("span", { className: "text-xs opacity-60", children: item.hint }) : null,
|
|
1033
|
+
item.selected ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "h-4 w-4 shrink-0" }) : null
|
|
1034
|
+
] });
|
|
1035
|
+
const className = cn(
|
|
1036
|
+
"flex w-full cursor-pointer select-none items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm",
|
|
1037
|
+
"hover:bg-[rgba(127,127,127,0.14)]",
|
|
1038
|
+
item.danger && "text-[var(--color-text-error,#e5484d)]"
|
|
1039
|
+
);
|
|
1040
|
+
const activate = () => {
|
|
1041
|
+
onDone();
|
|
1042
|
+
item.onSelect?.();
|
|
1043
|
+
};
|
|
1044
|
+
const shared = {
|
|
1045
|
+
"data-testid": `chrome-item-${item.id}`,
|
|
1046
|
+
"aria-current": item.selected ? "true" : void 0,
|
|
1047
|
+
className
|
|
1048
|
+
};
|
|
1049
|
+
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 });
|
|
1050
|
+
return menu ? /* @__PURE__ */ jsx(MenuItem, { value: item.id, asChild: true, children: control }) : control;
|
|
1051
|
+
};
|
|
1052
|
+
var Switcher = ({
|
|
1053
|
+
title,
|
|
1054
|
+
label,
|
|
1055
|
+
icon,
|
|
1056
|
+
items,
|
|
1057
|
+
footer = [],
|
|
1058
|
+
status = "ready",
|
|
1059
|
+
empty = "Nothing here yet.",
|
|
1060
|
+
onSignIn,
|
|
1061
|
+
signInLabel = "Sign in",
|
|
1062
|
+
error,
|
|
1063
|
+
align = "start",
|
|
1064
|
+
testId
|
|
1065
|
+
}) => {
|
|
1066
|
+
const [open, setOpen] = React33.useState(false);
|
|
1067
|
+
const narrow = useIsNarrow();
|
|
1068
|
+
const close = React33.useCallback(() => setOpen(false), []);
|
|
1069
|
+
const message = status === "loading" ? "Loading\u2026" : status === "error" ? error ?? "Could not reach IAM." : status === "anonymous" ? null : items.length === 0 ? empty : null;
|
|
1070
|
+
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 : [];
|
|
1071
|
+
const panel = (menu) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1072
|
+
/* @__PURE__ */ jsx("div", { className: "px-2 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-wide opacity-55", children: title }),
|
|
1073
|
+
message ? /* @__PURE__ */ jsx("div", { "data-testid": "chrome-message", className: "px-2 py-2 text-sm opacity-70", children: message }) : null,
|
|
1074
|
+
rows.map((item) => /* @__PURE__ */ jsx(Row, { item, onDone: close, menu }, item.id)),
|
|
1075
|
+
footer.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1076
|
+
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))]" }),
|
|
1077
|
+
footer.map((item) => /* @__PURE__ */ jsx(Row, { item, onDone: close, menu }, item.id))
|
|
1078
|
+
] }) : null
|
|
1079
|
+
] });
|
|
1080
|
+
const trigger = /* @__PURE__ */ jsxs(
|
|
1081
|
+
"button",
|
|
1082
|
+
{
|
|
1083
|
+
type: "button",
|
|
1084
|
+
"data-testid": testId,
|
|
1085
|
+
"aria-label": title,
|
|
1086
|
+
"aria-haspopup": "menu",
|
|
1087
|
+
"aria-expanded": open,
|
|
1088
|
+
className: cn(
|
|
1089
|
+
"flex max-w-[14rem] items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium",
|
|
1090
|
+
"hover:bg-[rgba(127,127,127,0.14)]"
|
|
1091
|
+
),
|
|
1092
|
+
children: [
|
|
1093
|
+
icon,
|
|
1094
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: label }),
|
|
1095
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0 opacity-60" })
|
|
1096
|
+
]
|
|
1097
|
+
}
|
|
1098
|
+
);
|
|
1099
|
+
if (narrow) {
|
|
1100
|
+
return /* @__PURE__ */ jsxs(DrawerRoot, { open, onOpenChange: (d) => setOpen(d.open), placement: "bottom", size: "md", children: [
|
|
1101
|
+
React33.cloneElement(trigger, { onClick: () => setOpen(true) }),
|
|
1102
|
+
/* @__PURE__ */ jsxs(DrawerContent, { "data-testid": testId ? `${testId}-panel` : void 0, children: [
|
|
1103
|
+
/* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: title }) }),
|
|
1104
|
+
/* @__PURE__ */ jsx(DrawerBody, { children: panel(false) })
|
|
1105
|
+
] })
|
|
1106
|
+
] });
|
|
1107
|
+
}
|
|
1108
|
+
return /* @__PURE__ */ jsxs(
|
|
1109
|
+
MenuRoot,
|
|
1110
|
+
{
|
|
1111
|
+
open,
|
|
1112
|
+
onOpenChange: (d) => setOpen(d.open),
|
|
1113
|
+
positioning: { placement: align === "end" ? "bottom-end" : "bottom-start" },
|
|
1114
|
+
children: [
|
|
1115
|
+
/* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: trigger }),
|
|
1116
|
+
/* @__PURE__ */ jsx(MenuContent, { minW: "16rem", "data-testid": testId ? `${testId}-panel` : void 0, children: panel(true) })
|
|
1117
|
+
]
|
|
1118
|
+
}
|
|
1119
|
+
);
|
|
1120
|
+
};
|
|
1121
|
+
var OrgSwitcher = () => {
|
|
1122
|
+
const id = useIdentity();
|
|
1123
|
+
return /* @__PURE__ */ jsx(
|
|
1124
|
+
Switcher,
|
|
1125
|
+
{
|
|
1126
|
+
testId: "org-switcher",
|
|
1127
|
+
title: "Organization",
|
|
1128
|
+
label: id.org?.displayName || id.org?.name || id.whiteLabel.name,
|
|
1129
|
+
icon: /* @__PURE__ */ jsx(Monogram, { label: id.org?.displayName || id.org?.name || id.whiteLabel.name, logo: id.org?.logo }),
|
|
1130
|
+
status: id.status,
|
|
1131
|
+
error: id.error,
|
|
1132
|
+
empty: "No organizations for this account.",
|
|
1133
|
+
onSignIn: id.signIn,
|
|
1134
|
+
signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
|
|
1135
|
+
items: id.orgs.map((o) => ({
|
|
1136
|
+
id: o.name,
|
|
1137
|
+
label: o.displayName || o.name,
|
|
1138
|
+
icon: /* @__PURE__ */ jsx(Monogram, { label: o.displayName || o.name, logo: o.logo }),
|
|
1139
|
+
selected: o.name === id.org?.name,
|
|
1140
|
+
onSelect: () => id.setOrg(o.name)
|
|
1141
|
+
}))
|
|
1142
|
+
}
|
|
1143
|
+
);
|
|
1144
|
+
};
|
|
1145
|
+
var ProjectSwitcher = () => {
|
|
1146
|
+
const id = useIdentity();
|
|
1147
|
+
if (id.status === "ready" && id.projects.length === 0) return null;
|
|
1148
|
+
return /* @__PURE__ */ jsx(
|
|
1149
|
+
Switcher,
|
|
1150
|
+
{
|
|
1151
|
+
testId: "project-switcher",
|
|
1152
|
+
title: "Project",
|
|
1153
|
+
label: id.project?.displayName || id.project?.name || "Project",
|
|
1154
|
+
icon: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1155
|
+
status: id.status,
|
|
1156
|
+
error: id.error,
|
|
1157
|
+
empty: "No projects in this organization.",
|
|
1158
|
+
onSignIn: id.signIn,
|
|
1159
|
+
items: id.projects.map((p) => ({
|
|
1160
|
+
id: p.name,
|
|
1161
|
+
label: p.displayName || p.name,
|
|
1162
|
+
icon: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1163
|
+
selected: p.name === id.project?.name,
|
|
1164
|
+
onSelect: () => id.setProject(p.name)
|
|
1165
|
+
}))
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
58
1168
|
};
|
|
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
|
-
}, []);
|
|
1169
|
+
var UserMenu = ({ items = [] }) => {
|
|
1170
|
+
const id = useIdentity();
|
|
1171
|
+
const who = id.account?.displayName || id.account?.email || id.account?.name || "Account";
|
|
1172
|
+
return /* @__PURE__ */ jsx(
|
|
1173
|
+
Switcher,
|
|
1174
|
+
{
|
|
1175
|
+
testId: "user-menu",
|
|
1176
|
+
align: "end",
|
|
1177
|
+
title: id.status === "ready" ? who : "Account",
|
|
1178
|
+
label: id.status === "ready" ? who : "Sign in",
|
|
1179
|
+
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" }),
|
|
1180
|
+
status: id.status,
|
|
1181
|
+
error: id.error,
|
|
1182
|
+
onSignIn: id.signIn,
|
|
1183
|
+
signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
|
|
1184
|
+
items: [
|
|
1185
|
+
{ id: "account", label: id.account?.email || who, icon: /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) },
|
|
1186
|
+
...items
|
|
1187
|
+
],
|
|
1188
|
+
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 }] : []
|
|
1189
|
+
}
|
|
1190
|
+
);
|
|
85
1191
|
};
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
1192
|
+
var SettingsMenu = ({ items = [], href = "/settings" }) => /* @__PURE__ */ jsx(
|
|
1193
|
+
Switcher,
|
|
1194
|
+
{
|
|
1195
|
+
testId: "settings-menu",
|
|
1196
|
+
align: "end",
|
|
1197
|
+
title: "Settings",
|
|
1198
|
+
label: "Settings",
|
|
1199
|
+
icon: /* @__PURE__ */ jsx(Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1200
|
+
items,
|
|
1201
|
+
empty: "No settings on this surface.",
|
|
1202
|
+
footer: [{ id: "all-settings", label: "All settings", href, icon: /* @__PURE__ */ jsx(Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) }]
|
|
1203
|
+
}
|
|
1204
|
+
);
|
|
1205
|
+
var AppNav = ({
|
|
1206
|
+
brand,
|
|
1207
|
+
home = "/",
|
|
1208
|
+
links = [],
|
|
1209
|
+
org = true,
|
|
1210
|
+
project = false,
|
|
1211
|
+
settings,
|
|
1212
|
+
userItems,
|
|
1213
|
+
children
|
|
90
1214
|
}) => {
|
|
91
|
-
|
|
92
|
-
|
|
1215
|
+
const id = useIdentity();
|
|
1216
|
+
const narrow = useIsNarrow();
|
|
1217
|
+
const [menu, setMenu] = React33.useState(false);
|
|
1218
|
+
return /* @__PURE__ */ jsx(
|
|
1219
|
+
"header",
|
|
1220
|
+
{
|
|
1221
|
+
"data-testid": "app-nav",
|
|
1222
|
+
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)]",
|
|
1223
|
+
children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-14 max-w-7xl items-center gap-2 px-4", children: [
|
|
1224
|
+
narrow && links.length > 0 ? /* @__PURE__ */ jsxs(DrawerRoot, { open: menu, onOpenChange: (d) => setMenu(d.open), placement: "bottom", size: "md", children: [
|
|
1225
|
+
/* @__PURE__ */ jsx(
|
|
1226
|
+
"button",
|
|
1227
|
+
{
|
|
1228
|
+
type: "button",
|
|
1229
|
+
"aria-label": "Menu",
|
|
1230
|
+
"data-testid": "nav-menu",
|
|
1231
|
+
className: "rounded-md p-2 hover:bg-[rgba(127,127,127,0.14)]",
|
|
1232
|
+
onClick: () => setMenu(true),
|
|
1233
|
+
children: /* @__PURE__ */ jsx(Menu, { "aria-hidden": "true", className: "h-5 w-5" })
|
|
1234
|
+
}
|
|
1235
|
+
),
|
|
1236
|
+
/* @__PURE__ */ jsxs(DrawerContent, { "data-testid": "nav-menu-panel", children: [
|
|
1237
|
+
/* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: "Menu" }) }),
|
|
1238
|
+
/* @__PURE__ */ jsx(DrawerBody, { children: links.map((l) => /* @__PURE__ */ jsx(
|
|
1239
|
+
"a",
|
|
1240
|
+
{
|
|
1241
|
+
href: l.href,
|
|
1242
|
+
onClick: () => setMenu(false),
|
|
1243
|
+
"aria-current": l.active ? "page" : void 0,
|
|
1244
|
+
className: "block rounded-md px-2 py-2.5 text-sm hover:bg-[rgba(127,127,127,0.14)]",
|
|
1245
|
+
children: l.label
|
|
1246
|
+
},
|
|
1247
|
+
l.href
|
|
1248
|
+
)) })
|
|
1249
|
+
] })
|
|
1250
|
+
] }) : null,
|
|
1251
|
+
/* @__PURE__ */ jsx("a", { href: home, className: "flex items-center gap-2 font-semibold tracking-tight", children: brand ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1252
|
+
/* @__PURE__ */ jsx(Building2, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1253
|
+
id.whiteLabel.name
|
|
1254
|
+
] }) }),
|
|
1255
|
+
org ? /* @__PURE__ */ jsx(OrgSwitcher, {}) : null,
|
|
1256
|
+
project ? /* @__PURE__ */ jsx(ProjectSwitcher, {}) : null,
|
|
1257
|
+
!narrow && links.length > 0 ? /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-1", children: links.map((l) => /* @__PURE__ */ jsx(
|
|
1258
|
+
"a",
|
|
1259
|
+
{
|
|
1260
|
+
href: l.href,
|
|
1261
|
+
"aria-current": l.active ? "page" : void 0,
|
|
1262
|
+
className: cn(
|
|
1263
|
+
"rounded-md px-3 py-1.5 text-sm font-medium",
|
|
1264
|
+
l.active ? "bg-[rgba(127,127,127,0.14)]" : "opacity-75 hover:opacity-100"
|
|
1265
|
+
),
|
|
1266
|
+
children: l.label
|
|
1267
|
+
},
|
|
1268
|
+
l.href
|
|
1269
|
+
)) }) : null,
|
|
1270
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center justify-end gap-1", children: [
|
|
1271
|
+
children,
|
|
1272
|
+
settings ? /* @__PURE__ */ jsx(SettingsMenu, { items: settings }) : null,
|
|
1273
|
+
/* @__PURE__ */ jsx(UserMenu, { items: userItems })
|
|
1274
|
+
] })
|
|
1275
|
+
] })
|
|
1276
|
+
}
|
|
1277
|
+
);
|
|
93
1278
|
};
|
|
94
|
-
function cn(...inputs) {
|
|
95
|
-
return twMerge(clsx(inputs));
|
|
96
|
-
}
|
|
97
1279
|
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 =
|
|
1280
|
+
var AccordionRoot = React33.forwardRef(
|
|
99
1281
|
function AccordionRoot2(props, ref) {
|
|
100
1282
|
const {
|
|
101
1283
|
multiple: _multiple,
|
|
@@ -114,7 +1296,7 @@ var AccordionRoot = React30.forwardRef(
|
|
|
114
1296
|
borderRadius: _borderRadius,
|
|
115
1297
|
...rest
|
|
116
1298
|
} = props;
|
|
117
|
-
const handleValueChange =
|
|
1299
|
+
const handleValueChange = React33.useCallback(
|
|
118
1300
|
(next) => {
|
|
119
1301
|
onValueChange?.({ value: next });
|
|
120
1302
|
},
|
|
@@ -142,7 +1324,7 @@ var AccordionRoot = React30.forwardRef(
|
|
|
142
1324
|
);
|
|
143
1325
|
}
|
|
144
1326
|
);
|
|
145
|
-
var AccordionItem =
|
|
1327
|
+
var AccordionItem = React33.forwardRef(
|
|
146
1328
|
function AccordionItem2(props, ref) {
|
|
147
1329
|
const { className, as: _as, _first, _last, display: _display, ...rest } = props;
|
|
148
1330
|
return /* @__PURE__ */ jsx(
|
|
@@ -158,7 +1340,7 @@ var AccordionItem = React30.forwardRef(
|
|
|
158
1340
|
);
|
|
159
1341
|
}
|
|
160
1342
|
);
|
|
161
|
-
var AccordionItemTrigger =
|
|
1343
|
+
var AccordionItemTrigger = React33.forwardRef(function AccordionItemTrigger2(props, ref) {
|
|
162
1344
|
const {
|
|
163
1345
|
children,
|
|
164
1346
|
indicatorPlacement: indicatorPlacementProp,
|
|
@@ -223,7 +1405,7 @@ var AccordionItemTrigger = React30.forwardRef(function AccordionItemTrigger2(pro
|
|
|
223
1405
|
}
|
|
224
1406
|
) }) });
|
|
225
1407
|
});
|
|
226
|
-
var AccordionItemContent =
|
|
1408
|
+
var AccordionItemContent = React33.forwardRef(function AccordionItemContent2(props, ref) {
|
|
227
1409
|
const { className, children, pb: _pb, pr: _pr, pl: _pl, w: _w, display: _display, flexDir: _flexDir, rowGap: _rowGap, ...rest } = props;
|
|
228
1410
|
return /* @__PURE__ */ jsx(
|
|
229
1411
|
AccordionPrimitive.Content,
|
|
@@ -241,11 +1423,11 @@ var AccordionItemContent = React30.forwardRef(function AccordionItemContent2(pro
|
|
|
241
1423
|
);
|
|
242
1424
|
});
|
|
243
1425
|
function useAccordion(items) {
|
|
244
|
-
const [value, setValue] =
|
|
245
|
-
const onValueChange =
|
|
1426
|
+
const [value, setValue] = React33.useState([]);
|
|
1427
|
+
const onValueChange = React33.useCallback(({ value: value2 }) => {
|
|
246
1428
|
setValue(value2);
|
|
247
1429
|
}, []);
|
|
248
|
-
const scrollToItemFromUrl =
|
|
1430
|
+
const scrollToItemFromUrl = React33.useCallback(() => {
|
|
249
1431
|
const hash = window.location.hash.replace("#", "");
|
|
250
1432
|
if (!hash) {
|
|
251
1433
|
return;
|
|
@@ -259,7 +1441,7 @@ function useAccordion(items) {
|
|
|
259
1441
|
setValue([itemToScroll.id]);
|
|
260
1442
|
}
|
|
261
1443
|
}, [items]);
|
|
262
|
-
return
|
|
1444
|
+
return React33.useMemo(() => {
|
|
263
1445
|
return {
|
|
264
1446
|
value,
|
|
265
1447
|
onValueChange,
|
|
@@ -267,68 +1449,6 @@ function useAccordion(items) {
|
|
|
267
1449
|
};
|
|
268
1450
|
}, [value, onValueChange, scrollToItemFromUrl]);
|
|
269
1451
|
}
|
|
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
1452
|
var SHIM_PROPS = [
|
|
333
1453
|
"w",
|
|
334
1454
|
"h",
|
|
@@ -449,7 +1569,7 @@ var SKELETON_CLASSES = [
|
|
|
449
1569
|
"bg-[length:200%_100%]"
|
|
450
1570
|
].join(" ");
|
|
451
1571
|
var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
|
|
452
|
-
var Skeleton =
|
|
1572
|
+
var Skeleton = React33.forwardRef(
|
|
453
1573
|
function Skeleton2(props, ref) {
|
|
454
1574
|
const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
|
|
455
1575
|
const shimStyle = shimToStyle(props);
|
|
@@ -458,10 +1578,10 @@ var Skeleton = React30.forwardRef(
|
|
|
458
1578
|
const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
|
|
459
1579
|
const htmlRest = stripShims(allRest);
|
|
460
1580
|
if (!loading) {
|
|
461
|
-
if (asChild &&
|
|
1581
|
+
if (asChild && React33.isValidElement(children)) return children;
|
|
462
1582
|
return /* @__PURE__ */ jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
|
|
463
1583
|
}
|
|
464
|
-
if (asChild &&
|
|
1584
|
+
if (asChild && React33.isValidElement(children)) {
|
|
465
1585
|
return /* @__PURE__ */ jsx(
|
|
466
1586
|
Component,
|
|
467
1587
|
{
|
|
@@ -487,7 +1607,7 @@ var Skeleton = React30.forwardRef(
|
|
|
487
1607
|
);
|
|
488
1608
|
}
|
|
489
1609
|
);
|
|
490
|
-
var SkeletonCircle =
|
|
1610
|
+
var SkeletonCircle = React33.forwardRef(
|
|
491
1611
|
function SkeletonCircle2(props, ref) {
|
|
492
1612
|
const { size = 40, loading = true, className, ...rest } = props;
|
|
493
1613
|
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
@@ -503,7 +1623,7 @@ var SkeletonCircle = React30.forwardRef(
|
|
|
503
1623
|
);
|
|
504
1624
|
}
|
|
505
1625
|
);
|
|
506
|
-
var SkeletonText =
|
|
1626
|
+
var SkeletonText = React33.forwardRef(
|
|
507
1627
|
function SkeletonText2(props, ref) {
|
|
508
1628
|
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
509
1629
|
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 +1645,7 @@ var STATUS_CLASSES = {
|
|
|
525
1645
|
success: "bg-[var(--color-alert-bg-success)]",
|
|
526
1646
|
error: "bg-[var(--color-alert-bg-error)]"
|
|
527
1647
|
};
|
|
528
|
-
var
|
|
1648
|
+
var SIZE_CLASSES2 = {
|
|
529
1649
|
sm: "gap-2 px-2 py-2 text-xs",
|
|
530
1650
|
md: "gap-2 px-3 py-2 text-base"
|
|
531
1651
|
};
|
|
@@ -533,7 +1653,7 @@ var INDICATOR_SIZE_CLASSES = {
|
|
|
533
1653
|
sm: "w-5 h-5 my-0",
|
|
534
1654
|
md: "w-5 h-5 my-[2px]"
|
|
535
1655
|
};
|
|
536
|
-
var Alert =
|
|
1656
|
+
var Alert = React33.forwardRef(
|
|
537
1657
|
function Alert2(props, ref) {
|
|
538
1658
|
const {
|
|
539
1659
|
title,
|
|
@@ -558,7 +1678,7 @@ var Alert = React30.forwardRef(
|
|
|
558
1678
|
if (_mb !== void 0) shimStyle.marginBottom = typeof _mb === "number" ? `${_mb * 4}px` : _mb;
|
|
559
1679
|
if (_mt !== void 0) shimStyle.marginTop = typeof _mt === "number" ? `${_mt * 4}px` : _mt;
|
|
560
1680
|
const alertStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
|
|
561
|
-
const [isOpen, setIsOpen] =
|
|
1681
|
+
const [isOpen, setIsOpen] = React33.useState(true);
|
|
562
1682
|
const resolvedSize = size ?? "md";
|
|
563
1683
|
const defaultIcon = /* @__PURE__ */ jsx(IndicatorIcon2, { className: "w-5 h-5" });
|
|
564
1684
|
const iconElement = (() => {
|
|
@@ -573,7 +1693,7 @@ var Alert = React30.forwardRef(
|
|
|
573
1693
|
INDICATOR_SIZE_CLASSES[resolvedSize]
|
|
574
1694
|
), children: icon || defaultIcon });
|
|
575
1695
|
})();
|
|
576
|
-
const handleClose =
|
|
1696
|
+
const handleClose = React33.useCallback(() => {
|
|
577
1697
|
setIsOpen(false);
|
|
578
1698
|
onClose?.();
|
|
579
1699
|
}, [onClose]);
|
|
@@ -604,7 +1724,7 @@ var Alert = React30.forwardRef(
|
|
|
604
1724
|
"div",
|
|
605
1725
|
{
|
|
606
1726
|
ref,
|
|
607
|
-
className: cn(ALERT_BASE, STATUS_CLASSES[status],
|
|
1727
|
+
className: cn(ALERT_BASE, STATUS_CLASSES[status], SIZE_CLASSES2[resolvedSize], className),
|
|
608
1728
|
style: alertStyle,
|
|
609
1729
|
...alertRest,
|
|
610
1730
|
children: [
|
|
@@ -634,7 +1754,7 @@ var Alert = React30.forwardRef(
|
|
|
634
1754
|
) });
|
|
635
1755
|
}
|
|
636
1756
|
);
|
|
637
|
-
var
|
|
1757
|
+
var SIZE_CLASSES3 = {
|
|
638
1758
|
xs: "h-6 w-6 text-[10px]",
|
|
639
1759
|
sm: "h-8 w-8 text-xs",
|
|
640
1760
|
md: "h-10 w-10 text-sm",
|
|
@@ -649,11 +1769,11 @@ var VARIANT_CLASSES = {
|
|
|
649
1769
|
};
|
|
650
1770
|
var DEFAULT_SIZE = "md";
|
|
651
1771
|
var DEFAULT_VARIANT = "subtle";
|
|
652
|
-
var AvatarGroupContext =
|
|
1772
|
+
var AvatarGroupContext = React33.createContext({});
|
|
653
1773
|
function useAvatarGroupContext() {
|
|
654
|
-
return
|
|
1774
|
+
return React33.useContext(AvatarGroupContext);
|
|
655
1775
|
}
|
|
656
|
-
var Avatar =
|
|
1776
|
+
var Avatar = React33.forwardRef(
|
|
657
1777
|
function Avatar2(props, ref) {
|
|
658
1778
|
const group = useAvatarGroupContext();
|
|
659
1779
|
const {
|
|
@@ -674,12 +1794,13 @@ var Avatar = React30.forwardRef(
|
|
|
674
1794
|
const variant = variantProp ?? group.variant ?? DEFAULT_VARIANT;
|
|
675
1795
|
const isBorderless = borderless ?? group.borderless ?? false;
|
|
676
1796
|
return /* @__PURE__ */ jsxs(
|
|
677
|
-
|
|
1797
|
+
Avatar$1,
|
|
678
1798
|
{
|
|
679
1799
|
ref,
|
|
1800
|
+
unstyled: true,
|
|
680
1801
|
className: cn(
|
|
681
1802
|
"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full align-middle",
|
|
682
|
-
|
|
1803
|
+
SIZE_CLASSES3[size],
|
|
683
1804
|
VARIANT_CLASSES[variant],
|
|
684
1805
|
!isBorderless && "ring-2 ring-white dark:ring-gray-900",
|
|
685
1806
|
className
|
|
@@ -687,8 +1808,8 @@ var Avatar = React30.forwardRef(
|
|
|
687
1808
|
...rest,
|
|
688
1809
|
children: [
|
|
689
1810
|
/* @__PURE__ */ jsx(AvatarFallback, { name, icon, children: fallback }),
|
|
690
|
-
/* @__PURE__ */ jsx(
|
|
691
|
-
|
|
1811
|
+
src != null && /* @__PURE__ */ jsx(
|
|
1812
|
+
Avatar$1.Image,
|
|
692
1813
|
{
|
|
693
1814
|
className: "h-full w-full rounded-[inherit] object-cover",
|
|
694
1815
|
src,
|
|
@@ -703,13 +1824,14 @@ var Avatar = React30.forwardRef(
|
|
|
703
1824
|
);
|
|
704
1825
|
}
|
|
705
1826
|
);
|
|
706
|
-
var AvatarFallback =
|
|
1827
|
+
var AvatarFallback = React33.forwardRef(
|
|
707
1828
|
function AvatarFallback2(props, ref) {
|
|
708
1829
|
const { name, icon, children, className, ...rest } = props;
|
|
709
1830
|
return /* @__PURE__ */ jsxs(
|
|
710
|
-
|
|
1831
|
+
Avatar$1.Fallback,
|
|
711
1832
|
{
|
|
712
1833
|
ref,
|
|
1834
|
+
unstyled: true,
|
|
713
1835
|
className: cn(
|
|
714
1836
|
"flex h-full w-full items-center justify-center font-medium",
|
|
715
1837
|
className
|
|
@@ -730,10 +1852,10 @@ function getInitials(name) {
|
|
|
730
1852
|
const lastName = names.length > 1 ? names[names.length - 1] : "";
|
|
731
1853
|
return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0);
|
|
732
1854
|
}
|
|
733
|
-
var AvatarGroup =
|
|
1855
|
+
var AvatarGroup = React33.forwardRef(
|
|
734
1856
|
function AvatarGroup2(props, ref) {
|
|
735
1857
|
const { size, variant, borderless, className, ...rest } = props;
|
|
736
|
-
const contextValue =
|
|
1858
|
+
const contextValue = React33.useMemo(
|
|
737
1859
|
() => ({ size, variant, borderless }),
|
|
738
1860
|
[size, variant, borderless]
|
|
739
1861
|
);
|
|
@@ -747,26 +1869,11 @@ var AvatarGroup = React30.forwardRef(
|
|
|
747
1869
|
) });
|
|
748
1870
|
}
|
|
749
1871
|
);
|
|
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
1872
|
function mapPlacement(p) {
|
|
766
1873
|
if (!p) return void 0;
|
|
767
1874
|
return p;
|
|
768
1875
|
}
|
|
769
|
-
var Tooltip =
|
|
1876
|
+
var Tooltip = React33.forwardRef(
|
|
770
1877
|
function Tooltip2(props, ref) {
|
|
771
1878
|
const {
|
|
772
1879
|
showArrow: showArrowProp,
|
|
@@ -785,28 +1892,28 @@ var Tooltip = React30.forwardRef(
|
|
|
785
1892
|
interactive,
|
|
786
1893
|
positioning
|
|
787
1894
|
} = props;
|
|
788
|
-
const [open, setOpen] =
|
|
789
|
-
const timeoutRef =
|
|
790
|
-
const isMobile =
|
|
791
|
-
const handleOpenChange =
|
|
1895
|
+
const [open, setOpen] = React33.useState(defaultOpen);
|
|
1896
|
+
const timeoutRef = React33.useRef(null);
|
|
1897
|
+
const isMobile = useIsTouch();
|
|
1898
|
+
const handleOpenChange = React33.useCallback((nextOpen) => {
|
|
792
1899
|
setOpen(nextOpen);
|
|
793
1900
|
onOpenChange?.({ open: nextOpen });
|
|
794
1901
|
}, [onOpenChange]);
|
|
795
|
-
const handleOpenChangeManual =
|
|
1902
|
+
const handleOpenChangeManual = React33.useCallback((nextOpen) => {
|
|
796
1903
|
timeoutRef.current && window.clearTimeout(timeoutRef.current);
|
|
797
1904
|
timeoutRef.current = window.setTimeout(() => {
|
|
798
1905
|
setOpen(nextOpen);
|
|
799
1906
|
onOpenChange?.({ open: nextOpen });
|
|
800
1907
|
}, nextOpen ? openDelay : closeDelay);
|
|
801
1908
|
}, [closeDelay, openDelay, onOpenChange]);
|
|
802
|
-
const handleClickAway =
|
|
803
|
-
handleOpenChangeManual(false);
|
|
804
|
-
}, [handleOpenChangeManual]);
|
|
1909
|
+
const handleClickAway = React33.useCallback(() => {
|
|
1910
|
+
if (open) handleOpenChangeManual(false);
|
|
1911
|
+
}, [open, handleOpenChangeManual]);
|
|
805
1912
|
const triggerRef = useClickAway(handleClickAway);
|
|
806
|
-
const handleTriggerClick =
|
|
1913
|
+
const handleTriggerClick = React33.useCallback(() => {
|
|
807
1914
|
handleOpenChangeManual(!open);
|
|
808
1915
|
}, [handleOpenChangeManual, open]);
|
|
809
|
-
const handleContentClick =
|
|
1916
|
+
const handleContentClick = React33.useCallback((event) => {
|
|
810
1917
|
event.stopPropagation();
|
|
811
1918
|
if (interactive) {
|
|
812
1919
|
const closestLink = event.target?.closest("a");
|
|
@@ -815,7 +1922,7 @@ var Tooltip = React30.forwardRef(
|
|
|
815
1922
|
}
|
|
816
1923
|
}
|
|
817
1924
|
}, [interactive, handleOpenChangeManual]);
|
|
818
|
-
|
|
1925
|
+
React33.useEffect(() => {
|
|
819
1926
|
return () => {
|
|
820
1927
|
if (timeoutRef.current) {
|
|
821
1928
|
clearTimeout(timeoutRef.current);
|
|
@@ -841,7 +1948,7 @@ var Tooltip = React30.forwardRef(
|
|
|
841
1948
|
/* @__PURE__ */ jsx(
|
|
842
1949
|
Tooltip$1.Trigger,
|
|
843
1950
|
{
|
|
844
|
-
ref:
|
|
1951
|
+
ref: triggerRef,
|
|
845
1952
|
asChild: true,
|
|
846
1953
|
...isMobile ? { onPress: handleTriggerClick } : {},
|
|
847
1954
|
...triggerProps,
|
|
@@ -887,7 +1994,7 @@ function TruncatedTextTooltip({ label, children }) {
|
|
|
887
1994
|
return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
|
|
888
1995
|
}
|
|
889
1996
|
var BASE_CLASSES = "inline-flex items-center rounded-sm gap-1 font-medium w-fit max-w-full whitespace-nowrap select-text";
|
|
890
|
-
var
|
|
1997
|
+
var SIZE_CLASSES4 = {
|
|
891
1998
|
sm: "text-xs p-1 h-[18px] min-h-[18px]",
|
|
892
1999
|
md: "text-sm px-1 py-0.5 min-h-6",
|
|
893
2000
|
lg: "text-sm px-2 py-1 min-h-7 font-semibold"
|
|
@@ -917,7 +2024,7 @@ var COLOR_PALETTE_CLASSES = {
|
|
|
917
2024
|
bright_pink: "bg-badge-bright-pink-bg text-badge-bright-pink-fg"
|
|
918
2025
|
};
|
|
919
2026
|
var S2 = 4;
|
|
920
|
-
var Badge =
|
|
2027
|
+
var Badge = React33__default.forwardRef(
|
|
921
2028
|
function Badge2(props, ref) {
|
|
922
2029
|
const {
|
|
923
2030
|
loading,
|
|
@@ -957,7 +2064,7 @@ var Badge = React30__default.forwardRef(
|
|
|
957
2064
|
ref,
|
|
958
2065
|
className: cn(
|
|
959
2066
|
BASE_CLASSES,
|
|
960
|
-
|
|
2067
|
+
SIZE_CLASSES4[size],
|
|
961
2068
|
COLOR_PALETTE_CLASSES[colorPalette],
|
|
962
2069
|
className
|
|
963
2070
|
),
|
|
@@ -1166,7 +2273,7 @@ function buildShimStyle(props) {
|
|
|
1166
2273
|
if (props.borderTopRightRadius !== void 0) s.borderTopRightRadius = typeof props.borderTopRightRadius === "number" ? `${props.borderTopRightRadius}px` : props.borderTopRightRadius;
|
|
1167
2274
|
return Object.keys(s).length > 0 ? s : void 0;
|
|
1168
2275
|
}
|
|
1169
|
-
var Button =
|
|
2276
|
+
var Button = React33.forwardRef(
|
|
1170
2277
|
function Button2(props, ref) {
|
|
1171
2278
|
const {
|
|
1172
2279
|
className,
|
|
@@ -1257,7 +2364,7 @@ var Button = React30.forwardRef(
|
|
|
1257
2364
|
return button;
|
|
1258
2365
|
}
|
|
1259
2366
|
);
|
|
1260
|
-
var
|
|
2367
|
+
var SIZE_CLASSES5 = {
|
|
1261
2368
|
"2xs": "px-2 h-5 min-w-5 text-xs rounded-sm gap-1",
|
|
1262
2369
|
xs: "px-2 h-6 min-w-6 text-sm rounded-sm gap-1",
|
|
1263
2370
|
sm: "px-3 h-8 min-w-8 text-sm rounded-md gap-1",
|
|
@@ -1266,9 +2373,9 @@ var SIZE_CLASSES4 = {
|
|
|
1266
2373
|
function buttonVariants(opts) {
|
|
1267
2374
|
const v = opts?.variant ?? "solid";
|
|
1268
2375
|
const s = opts?.size ?? "md";
|
|
1269
|
-
return [BASE_CLASSES2, VARIANT_CLASSES2[v] ?? "",
|
|
2376
|
+
return [BASE_CLASSES2, VARIANT_CLASSES2[v] ?? "", SIZE_CLASSES5[s] ?? ""].filter(Boolean).join(" ");
|
|
1270
2377
|
}
|
|
1271
|
-
var ButtonGroup =
|
|
2378
|
+
var ButtonGroup = React33.forwardRef(
|
|
1272
2379
|
function ButtonGroup2(props, ref) {
|
|
1273
2380
|
const { className, ...rest } = props;
|
|
1274
2381
|
return /* @__PURE__ */ jsx(
|
|
@@ -1282,7 +2389,7 @@ var ButtonGroup = React30.forwardRef(
|
|
|
1282
2389
|
);
|
|
1283
2390
|
}
|
|
1284
2391
|
);
|
|
1285
|
-
var ButtonGroupRadio =
|
|
2392
|
+
var ButtonGroupRadio = React33.forwardRef(
|
|
1286
2393
|
function ButtonGroupRadio2(props, ref) {
|
|
1287
2394
|
const {
|
|
1288
2395
|
children,
|
|
@@ -1294,24 +2401,24 @@ var ButtonGroupRadio = React30.forwardRef(
|
|
|
1294
2401
|
className,
|
|
1295
2402
|
...rest
|
|
1296
2403
|
} = props;
|
|
1297
|
-
const firstChildValue =
|
|
2404
|
+
const firstChildValue = React33.useMemo(() => {
|
|
1298
2405
|
const firstChild = Array.isArray(children) ? children[0] : void 0;
|
|
1299
2406
|
return typeof firstChild?.props.value === "string" ? firstChild.props.value : void 0;
|
|
1300
2407
|
}, [children]);
|
|
1301
|
-
const [value, setValue] =
|
|
1302
|
-
const handleItemClick =
|
|
2408
|
+
const [value, setValue] = React33.useState(defaultValue ?? firstChildValue);
|
|
2409
|
+
const handleItemClick = React33.useCallback((event) => {
|
|
1303
2410
|
const v = event.currentTarget.value;
|
|
1304
2411
|
setValue(v);
|
|
1305
2412
|
onChange?.(v);
|
|
1306
2413
|
}, [onChange]);
|
|
1307
|
-
const clonedChildren =
|
|
1308
|
-
return
|
|
2414
|
+
const clonedChildren = React33.Children.map(children, (child) => {
|
|
2415
|
+
return React33.cloneElement(child, {
|
|
1309
2416
|
onClick: handleItemClick,
|
|
1310
2417
|
selected: value === child.props.value,
|
|
1311
2418
|
variant
|
|
1312
2419
|
});
|
|
1313
2420
|
});
|
|
1314
|
-
const childrenLength =
|
|
2421
|
+
const childrenLength = React33.Children.count(children);
|
|
1315
2422
|
return /* @__PURE__ */ jsx(Skeleton, { loading, children: /* @__PURE__ */ jsx(
|
|
1316
2423
|
"div",
|
|
1317
2424
|
{
|
|
@@ -1331,11 +2438,11 @@ var ButtonGroupRadio = React30.forwardRef(
|
|
|
1331
2438
|
);
|
|
1332
2439
|
var NOOP = () => {
|
|
1333
2440
|
};
|
|
1334
|
-
var CheckboxGroupContext =
|
|
2441
|
+
var CheckboxGroupContext = React33.createContext(null);
|
|
1335
2442
|
function useCheckboxGroupContext() {
|
|
1336
|
-
return
|
|
2443
|
+
return React33.useContext(CheckboxGroupContext);
|
|
1337
2444
|
}
|
|
1338
|
-
var CheckboxGroupBase =
|
|
2445
|
+
var CheckboxGroupBase = React33.forwardRef(
|
|
1339
2446
|
function CheckboxGroup(props, ref) {
|
|
1340
2447
|
const {
|
|
1341
2448
|
children,
|
|
@@ -1347,10 +2454,10 @@ var CheckboxGroupBase = React30.forwardRef(
|
|
|
1347
2454
|
className,
|
|
1348
2455
|
...rest
|
|
1349
2456
|
} = props;
|
|
1350
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
2457
|
+
const [uncontrolledValue, setUncontrolledValue] = React33.useState(defaultValue ?? []);
|
|
1351
2458
|
const isControlled = controlledValue !== void 0;
|
|
1352
2459
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
1353
|
-
const toggle =
|
|
2460
|
+
const toggle = React33.useCallback(
|
|
1354
2461
|
(itemValue) => {
|
|
1355
2462
|
const next = value.includes(itemValue) ? value.filter((v) => v !== itemValue) : [...value, itemValue];
|
|
1356
2463
|
if (!isControlled) {
|
|
@@ -1360,12 +2467,12 @@ var CheckboxGroupBase = React30.forwardRef(
|
|
|
1360
2467
|
},
|
|
1361
2468
|
[value, isControlled, onValueChange]
|
|
1362
2469
|
);
|
|
1363
|
-
|
|
2470
|
+
React33.useEffect(() => {
|
|
1364
2471
|
if (isControlled) {
|
|
1365
2472
|
setUncontrolledValue(controlledValue);
|
|
1366
2473
|
}
|
|
1367
2474
|
}, [isControlled, controlledValue]);
|
|
1368
|
-
const ctx =
|
|
2475
|
+
const ctx = React33.useMemo(() => ({ value, toggle }), [value, toggle]);
|
|
1369
2476
|
return /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
1370
2477
|
"div",
|
|
1371
2478
|
{
|
|
@@ -1383,7 +2490,7 @@ var CheckboxGroupBase = React30.forwardRef(
|
|
|
1383
2490
|
}
|
|
1384
2491
|
);
|
|
1385
2492
|
var CheckboxGroup2 = CheckboxGroupBase;
|
|
1386
|
-
var
|
|
2493
|
+
var SIZE_CLASSES6 = {
|
|
1387
2494
|
sm: {
|
|
1388
2495
|
root: "gap-1.5",
|
|
1389
2496
|
control: "h-3.5 w-3.5 rounded-sm",
|
|
@@ -1423,8 +2530,8 @@ var IndeterminateIcon = ({ className }) => /* @__PURE__ */ jsx(
|
|
|
1423
2530
|
children: /* @__PURE__ */ jsx("path", { d: "M0 0H12V2H0V0Z", fill: "currentColor" })
|
|
1424
2531
|
}
|
|
1425
2532
|
);
|
|
1426
|
-
var CheckboxBase =
|
|
1427
|
-
function Checkbox(props, ref) {
|
|
2533
|
+
var CheckboxBase = React33.forwardRef(
|
|
2534
|
+
function Checkbox$1(props, ref) {
|
|
1428
2535
|
const {
|
|
1429
2536
|
icon,
|
|
1430
2537
|
children,
|
|
@@ -1444,8 +2551,8 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1444
2551
|
...rest
|
|
1445
2552
|
} = props;
|
|
1446
2553
|
const group = useCheckboxGroupContext();
|
|
1447
|
-
const hiddenInputRef =
|
|
1448
|
-
const setHiddenInputRef =
|
|
2554
|
+
const hiddenInputRef = React33.useRef(null);
|
|
2555
|
+
const setHiddenInputRef = React33.useCallback(
|
|
1449
2556
|
(node) => {
|
|
1450
2557
|
hiddenInputRef.current = node;
|
|
1451
2558
|
if (typeof ref === "function") {
|
|
@@ -1458,7 +2565,7 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1458
2565
|
);
|
|
1459
2566
|
const isInGroup = group !== null && value !== void 0;
|
|
1460
2567
|
const groupChecked = isInGroup ? group.value.includes(value) : void 0;
|
|
1461
|
-
const [internalChecked, setInternalChecked] =
|
|
2568
|
+
const [internalChecked, setInternalChecked] = React33.useState(
|
|
1462
2569
|
defaultChecked ?? false
|
|
1463
2570
|
);
|
|
1464
2571
|
const isControlled = checkedProp !== void 0 || isInGroup;
|
|
@@ -1470,7 +2577,7 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1470
2577
|
} else {
|
|
1471
2578
|
checkedState = internalChecked;
|
|
1472
2579
|
}
|
|
1473
|
-
const handleCheckedChange =
|
|
2580
|
+
const handleCheckedChange = React33.useCallback(
|
|
1474
2581
|
(nextChecked) => {
|
|
1475
2582
|
if (readOnly) return;
|
|
1476
2583
|
if (!isControlled) {
|
|
@@ -1493,7 +2600,7 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1493
2600
|
},
|
|
1494
2601
|
[readOnly, isControlled, isInGroup, group, value, onCheckedChange, onChange]
|
|
1495
2602
|
);
|
|
1496
|
-
const sizeClasses2 =
|
|
2603
|
+
const sizeClasses2 = SIZE_CLASSES6[size];
|
|
1497
2604
|
return /* @__PURE__ */ jsxs(
|
|
1498
2605
|
"label",
|
|
1499
2606
|
{
|
|
@@ -1511,8 +2618,9 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1511
2618
|
...rest,
|
|
1512
2619
|
children: [
|
|
1513
2620
|
/* @__PURE__ */ jsx(
|
|
1514
|
-
|
|
2621
|
+
Checkbox,
|
|
1515
2622
|
{
|
|
2623
|
+
unstyled: true,
|
|
1516
2624
|
checked: checkedState,
|
|
1517
2625
|
onCheckedChange: handleCheckedChange,
|
|
1518
2626
|
disabled: disabled || readOnly,
|
|
@@ -1530,7 +2638,7 @@ var CheckboxBase = React30.forwardRef(
|
|
|
1530
2638
|
"transition-colors duration-150",
|
|
1531
2639
|
sizeClasses2.control
|
|
1532
2640
|
),
|
|
1533
|
-
children: icon ?? /* @__PURE__ */ jsx(
|
|
2641
|
+
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
2642
|
}
|
|
1535
2643
|
),
|
|
1536
2644
|
/* @__PURE__ */ jsx(
|
|
@@ -1634,7 +2742,7 @@ function resolveSpacing(v) {
|
|
|
1634
2742
|
}
|
|
1635
2743
|
return void 0;
|
|
1636
2744
|
}
|
|
1637
|
-
var Link =
|
|
2745
|
+
var Link = React33__default.forwardRef(
|
|
1638
2746
|
function Link2(props, ref) {
|
|
1639
2747
|
const {
|
|
1640
2748
|
external,
|
|
@@ -1723,7 +2831,7 @@ var Link = React30__default.forwardRef(
|
|
|
1723
2831
|
) });
|
|
1724
2832
|
}
|
|
1725
2833
|
);
|
|
1726
|
-
var LinkBox =
|
|
2834
|
+
var LinkBox = React33__default.forwardRef(
|
|
1727
2835
|
function LinkBox2(props, ref) {
|
|
1728
2836
|
const { className, ...rest } = props;
|
|
1729
2837
|
return /* @__PURE__ */ jsx(
|
|
@@ -1736,7 +2844,7 @@ var LinkBox = React30__default.forwardRef(
|
|
|
1736
2844
|
);
|
|
1737
2845
|
}
|
|
1738
2846
|
);
|
|
1739
|
-
var LinkOverlay =
|
|
2847
|
+
var LinkOverlay = React33__default.forwardRef(
|
|
1740
2848
|
function LinkOverlay2(props, ref) {
|
|
1741
2849
|
const {
|
|
1742
2850
|
children,
|
|
@@ -1817,8 +2925,8 @@ var LinkOverlay = React30__default.forwardRef(
|
|
|
1817
2925
|
}
|
|
1818
2926
|
);
|
|
1819
2927
|
function useUpdateEffect(effect, deps) {
|
|
1820
|
-
const isFirstMount =
|
|
1821
|
-
|
|
2928
|
+
const isFirstMount = React33__default.useRef(true);
|
|
2929
|
+
React33__default.useEffect(() => {
|
|
1822
2930
|
if (isFirstMount.current) {
|
|
1823
2931
|
isFirstMount.current = false;
|
|
1824
2932
|
return;
|
|
@@ -1835,8 +2943,8 @@ function scrollToElement(id) {
|
|
|
1835
2943
|
var CUT_ID = "CollapsibleDetails";
|
|
1836
2944
|
var CollapsibleDetails = (props) => {
|
|
1837
2945
|
const { children, id = CUT_ID, onClick, isExpanded: isExpandedProp = false, text: textProp, loading, noScroll, ...rest } = props;
|
|
1838
|
-
const [isExpanded, setIsExpanded] =
|
|
1839
|
-
const handleClick =
|
|
2946
|
+
const [isExpanded, setIsExpanded] = React33__default.useState(isExpandedProp);
|
|
2947
|
+
const handleClick = React33__default.useCallback((event) => {
|
|
1840
2948
|
setIsExpanded((flag) => !flag);
|
|
1841
2949
|
if (!noScroll) {
|
|
1842
2950
|
scrollToElement(id);
|
|
@@ -1867,11 +2975,11 @@ var CollapsibleDetails = (props) => {
|
|
|
1867
2975
|
var CollapsibleList = (props) => {
|
|
1868
2976
|
const CUT_LENGTH = 3;
|
|
1869
2977
|
const { items, renderItem, triggerProps, cutLength = CUT_LENGTH, text: textProp, defaultExpanded = false, className, ...rest } = props;
|
|
1870
|
-
const [isExpanded, setIsExpanded] =
|
|
1871
|
-
|
|
2978
|
+
const [isExpanded, setIsExpanded] = React33__default.useState(defaultExpanded);
|
|
2979
|
+
React33__default.useEffect(() => {
|
|
1872
2980
|
setIsExpanded(defaultExpanded);
|
|
1873
2981
|
}, [defaultExpanded]);
|
|
1874
|
-
const handleToggle =
|
|
2982
|
+
const handleToggle = React33__default.useCallback(() => {
|
|
1875
2983
|
setIsExpanded((flag) => !flag);
|
|
1876
2984
|
}, []);
|
|
1877
2985
|
const text = isExpanded ? textProp?.[1] ?? "Hide" : textProp?.[0] ?? "Show all";
|
|
@@ -1888,10 +2996,10 @@ var CollapsibleList = (props) => {
|
|
|
1888
2996
|
) })
|
|
1889
2997
|
] }) });
|
|
1890
2998
|
};
|
|
1891
|
-
var ColorModeContext =
|
|
2999
|
+
var ColorModeContext = React33.createContext(void 0);
|
|
1892
3000
|
function ColorModeProvider(props) {
|
|
1893
3001
|
const { children, defaultTheme = "light", value: controlledValue, onValueChange } = props;
|
|
1894
|
-
const [internalMode, setInternalMode] =
|
|
3002
|
+
const [internalMode, setInternalMode] = React33.useState(() => {
|
|
1895
3003
|
if (controlledValue === "dark" || controlledValue === "light") {
|
|
1896
3004
|
return controlledValue;
|
|
1897
3005
|
}
|
|
@@ -1901,7 +3009,7 @@ function ColorModeProvider(props) {
|
|
|
1901
3009
|
return defaultTheme === "dark" ? "dark" : "light";
|
|
1902
3010
|
});
|
|
1903
3011
|
const colorMode = controlledValue === "dark" || controlledValue === "light" ? controlledValue : internalMode;
|
|
1904
|
-
const setColorMode =
|
|
3012
|
+
const setColorMode = React33.useCallback((mode) => {
|
|
1905
3013
|
const resolved = mode === "dark" ? "dark" : "light";
|
|
1906
3014
|
setInternalMode(resolved);
|
|
1907
3015
|
onValueChange?.(resolved);
|
|
@@ -1910,19 +3018,19 @@ function ColorModeProvider(props) {
|
|
|
1910
3018
|
document.documentElement.classList.toggle("light", resolved === "light");
|
|
1911
3019
|
}
|
|
1912
3020
|
}, [onValueChange]);
|
|
1913
|
-
const toggleColorMode =
|
|
3021
|
+
const toggleColorMode = React33.useCallback(() => {
|
|
1914
3022
|
setColorMode(colorMode === "dark" ? "light" : "dark");
|
|
1915
3023
|
}, [colorMode, setColorMode]);
|
|
1916
|
-
const ctx =
|
|
3024
|
+
const ctx = React33.useMemo(
|
|
1917
3025
|
() => ({ colorMode, setColorMode, toggleColorMode }),
|
|
1918
3026
|
[colorMode, setColorMode, toggleColorMode]
|
|
1919
3027
|
);
|
|
1920
3028
|
return /* @__PURE__ */ jsx(ColorModeContext.Provider, { value: ctx, children });
|
|
1921
3029
|
}
|
|
1922
3030
|
function useColorMode() {
|
|
1923
|
-
const ctx =
|
|
3031
|
+
const ctx = React33.useContext(ColorModeContext);
|
|
1924
3032
|
if (!ctx) {
|
|
1925
|
-
const [mode, setMode] =
|
|
3033
|
+
const [mode, setMode] = React33.useState(() => {
|
|
1926
3034
|
if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
|
|
1927
3035
|
return "dark";
|
|
1928
3036
|
}
|
|
@@ -1966,9 +3074,9 @@ function BackToButton({ onClick }) {
|
|
|
1966
3074
|
}
|
|
1967
3075
|
);
|
|
1968
3076
|
}
|
|
1969
|
-
var DialogSizeContext =
|
|
3077
|
+
var DialogSizeContext = React33.createContext({ size: "md" });
|
|
1970
3078
|
function useDialogSizeContext() {
|
|
1971
|
-
return
|
|
3079
|
+
return React33.useContext(DialogSizeContext);
|
|
1972
3080
|
}
|
|
1973
3081
|
var CONTENT_SIZE_MAP = {
|
|
1974
3082
|
sm: "max-w-[400px]",
|
|
@@ -2000,13 +3108,13 @@ var DialogRoot = ({
|
|
|
2000
3108
|
modal = true
|
|
2001
3109
|
// motionPreset is intentionally unused -- kept for API compat
|
|
2002
3110
|
}) => {
|
|
2003
|
-
const handleOpenChange =
|
|
3111
|
+
const handleOpenChange = React33.useCallback(
|
|
2004
3112
|
(nextOpen) => {
|
|
2005
3113
|
onOpenChange?.({ open: nextOpen });
|
|
2006
3114
|
},
|
|
2007
3115
|
[onOpenChange]
|
|
2008
3116
|
);
|
|
2009
|
-
const ctx =
|
|
3117
|
+
const ctx = React33.useMemo(() => ({ size }), [size]);
|
|
2010
3118
|
return /* @__PURE__ */ jsx(DialogSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
2011
3119
|
Dialog,
|
|
2012
3120
|
{
|
|
@@ -2018,7 +3126,7 @@ var DialogRoot = ({
|
|
|
2018
3126
|
}
|
|
2019
3127
|
) });
|
|
2020
3128
|
};
|
|
2021
|
-
var DialogContent =
|
|
3129
|
+
var DialogContent = React33.forwardRef(function DialogContent2(props, ref) {
|
|
2022
3130
|
const {
|
|
2023
3131
|
children,
|
|
2024
3132
|
portalled: _portalled = true,
|
|
@@ -2075,11 +3183,11 @@ var DialogContent = React30.forwardRef(function DialogContent2(props, ref) {
|
|
|
2075
3183
|
)
|
|
2076
3184
|
] });
|
|
2077
3185
|
});
|
|
2078
|
-
var DialogCloseTrigger =
|
|
3186
|
+
var DialogCloseTrigger = React33.forwardRef(function DialogCloseTrigger2(props, ref) {
|
|
2079
3187
|
const { className, ...rest } = props;
|
|
2080
3188
|
return /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
|
|
2081
3189
|
});
|
|
2082
|
-
var DialogHeader =
|
|
3190
|
+
var DialogHeader = React33.forwardRef(function DialogHeader2(props, ref) {
|
|
2083
3191
|
const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
|
|
2084
3192
|
const startElement = startElementProp ?? (onBackToClick ? /* @__PURE__ */ jsx(BackToButton, { onClick: onBackToClick }) : void 0);
|
|
2085
3193
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2109,7 +3217,7 @@ var DialogHeader = React30.forwardRef(function DialogHeader2(props, ref) {
|
|
|
2109
3217
|
}
|
|
2110
3218
|
);
|
|
2111
3219
|
});
|
|
2112
|
-
var DialogBody =
|
|
3220
|
+
var DialogBody = React33.forwardRef(function DialogBody2({ className, pt, display, flexDir, style: styleProp, ...props }, ref) {
|
|
2113
3221
|
const bodyStyle = {
|
|
2114
3222
|
...styleProp,
|
|
2115
3223
|
...pt !== void 0 ? { paddingTop: typeof pt === "number" ? `${pt * 4}px` : pt } : {},
|
|
@@ -2126,7 +3234,7 @@ var DialogBody = React30.forwardRef(function DialogBody2({ className, pt, displa
|
|
|
2126
3234
|
}
|
|
2127
3235
|
);
|
|
2128
3236
|
});
|
|
2129
|
-
var DialogFooter =
|
|
3237
|
+
var DialogFooter = React33.forwardRef(function DialogFooter2({ className, ...props }, ref) {
|
|
2130
3238
|
return /* @__PURE__ */ jsx(
|
|
2131
3239
|
"div",
|
|
2132
3240
|
{
|
|
@@ -2138,138 +3246,15 @@ var DialogFooter = React30.forwardRef(function DialogFooter2({ className, ...pro
|
|
|
2138
3246
|
});
|
|
2139
3247
|
var DialogBackdrop = Dialog.Overlay;
|
|
2140
3248
|
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;
|
|
3249
|
+
var DialogDescription = Dialog.Description;
|
|
3250
|
+
var DialogTrigger = Dialog.Trigger;
|
|
3251
|
+
var DialogActionTrigger = Dialog.Close;
|
|
2267
3252
|
var apos = "\u2019";
|
|
2268
3253
|
function upperFirst(str) {
|
|
2269
3254
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2270
3255
|
}
|
|
2271
3256
|
var ICONS = {};
|
|
2272
|
-
var EmptyState =
|
|
3257
|
+
var EmptyState = React33.forwardRef(
|
|
2273
3258
|
function EmptyState2(props, ref) {
|
|
2274
3259
|
const { title, description, term, type = "query", icon, children, className, ...rest } = props;
|
|
2275
3260
|
const titleContent = (() => {
|
|
@@ -2329,7 +3314,7 @@ function getComponentDisplayName(type) {
|
|
|
2329
3314
|
if ("displayName" in type) return type.displayName;
|
|
2330
3315
|
return void 0;
|
|
2331
3316
|
}
|
|
2332
|
-
var Field =
|
|
3317
|
+
var Field = React33.forwardRef(
|
|
2333
3318
|
function Field2(props, ref) {
|
|
2334
3319
|
const {
|
|
2335
3320
|
label,
|
|
@@ -2381,14 +3366,14 @@ var Field = React30.forwardRef(
|
|
|
2381
3366
|
}
|
|
2382
3367
|
);
|
|
2383
3368
|
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 =
|
|
3369
|
+
const child2 = React33.Children.only(children);
|
|
2385
3370
|
const isInputGroup = getComponentDisplayName(child2.type) === "InputGroup";
|
|
2386
3371
|
if (isInputGroup) {
|
|
2387
|
-
const inputElement2 =
|
|
2388
|
-
|
|
3372
|
+
const inputElement2 = React33.cloneElement(
|
|
3373
|
+
React33.Children.only(child2.props.children),
|
|
2389
3374
|
injectedProps2
|
|
2390
3375
|
);
|
|
2391
|
-
const groupInputElement =
|
|
3376
|
+
const groupInputElement = React33.cloneElement(
|
|
2392
3377
|
child2,
|
|
2393
3378
|
{},
|
|
2394
3379
|
inputElement2,
|
|
@@ -2411,7 +3396,7 @@ var Field = React30.forwardRef(
|
|
|
2411
3396
|
}
|
|
2412
3397
|
);
|
|
2413
3398
|
}
|
|
2414
|
-
const inputElement =
|
|
3399
|
+
const inputElement = React33.cloneElement(child2, injectedProps2);
|
|
2415
3400
|
return /* @__PURE__ */ jsxs(
|
|
2416
3401
|
"div",
|
|
2417
3402
|
{
|
|
@@ -2433,8 +3418,8 @@ var Field = React30.forwardRef(
|
|
|
2433
3418
|
const injectedProps = {
|
|
2434
3419
|
size
|
|
2435
3420
|
};
|
|
2436
|
-
const child =
|
|
2437
|
-
const clonedChild =
|
|
3421
|
+
const child = React33.Children.only(children);
|
|
3422
|
+
const clonedChild = React33.cloneElement(child, injectedProps);
|
|
2438
3423
|
return /* @__PURE__ */ jsxs(
|
|
2439
3424
|
"div",
|
|
2440
3425
|
{
|
|
@@ -2470,22 +3455,23 @@ var Field = React30.forwardRef(
|
|
|
2470
3455
|
);
|
|
2471
3456
|
}
|
|
2472
3457
|
);
|
|
2473
|
-
var LEVEL_TAG = { "1":
|
|
3458
|
+
var LEVEL_TAG = { "1": H1, "2": H2, "3": H3 };
|
|
2474
3459
|
var LEVEL_CLASSES = {
|
|
2475
3460
|
"1": "text-[18px] leading-[24px] font-medium lg:text-[32px] lg:leading-[40px] lg:tracking-[-0.5px]",
|
|
2476
3461
|
"2": "text-[16px] leading-[24px] font-medium lg:text-[24px] lg:leading-[32px]",
|
|
2477
3462
|
"3": "text-[14px] leading-[20px] font-semibold lg:text-[18px] lg:leading-[24px] lg:font-medium"
|
|
2478
3463
|
};
|
|
2479
3464
|
var BASE_CLASSES4 = "font-heading text-heading";
|
|
2480
|
-
var Heading =
|
|
3465
|
+
var Heading = React33__default.forwardRef(
|
|
2481
3466
|
function Heading2({ level, className, mb, size: _size, style: styleProp, ...rest }, ref) {
|
|
2482
|
-
const Tag3 = level ? LEVEL_TAG[level] :
|
|
3467
|
+
const Tag3 = level ? LEVEL_TAG[level] : H2;
|
|
2483
3468
|
const levelClasses = level ? LEVEL_CLASSES[level] : void 0;
|
|
2484
3469
|
const mergedStyle = mb !== void 0 ? { ...styleProp, marginBottom: typeof mb === "number" ? `${mb * 4}px` : mb } : styleProp;
|
|
2485
3470
|
return /* @__PURE__ */ jsx(
|
|
2486
3471
|
Tag3,
|
|
2487
3472
|
{
|
|
2488
3473
|
ref,
|
|
3474
|
+
unstyled: true,
|
|
2489
3475
|
className: cn(BASE_CLASSES4, levelClasses, className),
|
|
2490
3476
|
style: mergedStyle,
|
|
2491
3477
|
...rest
|
|
@@ -2563,7 +3549,7 @@ var ICON_SIZE_CLASSES = {
|
|
|
2563
3549
|
md: "[&_svg]:size-5"
|
|
2564
3550
|
};
|
|
2565
3551
|
var SP2 = 4;
|
|
2566
|
-
var IconButton =
|
|
3552
|
+
var IconButton = React33.forwardRef(
|
|
2567
3553
|
function IconButton2(props, ref) {
|
|
2568
3554
|
const {
|
|
2569
3555
|
size,
|
|
@@ -2614,7 +3600,7 @@ var IconButton = React30.forwardRef(
|
|
|
2614
3600
|
ref,
|
|
2615
3601
|
size,
|
|
2616
3602
|
disabled: !loadingSkeleton && (loading || disabled) || void 0,
|
|
2617
|
-
render: _as ?
|
|
3603
|
+
render: _as ? React33.createElement(_as) : void 0,
|
|
2618
3604
|
className: combinedClassName,
|
|
2619
3605
|
style: mergedStyle,
|
|
2620
3606
|
...expanded ? { "data-expanded": true } : {},
|
|
@@ -2785,31 +3771,31 @@ function extractStyleProps(props) {
|
|
|
2785
3771
|
}
|
|
2786
3772
|
return { styleProps, rest };
|
|
2787
3773
|
}
|
|
2788
|
-
var
|
|
2789
|
-
function
|
|
3774
|
+
var Image = React33__default.forwardRef(
|
|
3775
|
+
function Image2(props, ref) {
|
|
2790
3776
|
const { fallback, src, onLoad, onError, skeletonWidth, skeletonHeight, alt, className, style: styleProp, ...allRest } = props;
|
|
2791
3777
|
const { styleProps, rest: extraProps } = extractStyleProps(allRest);
|
|
2792
|
-
const [loading, setLoading] =
|
|
2793
|
-
const [error, setError] =
|
|
2794
|
-
const handleLoadError =
|
|
3778
|
+
const [loading, setLoading] = React33__default.useState(true);
|
|
3779
|
+
const [error, setError] = React33__default.useState(false);
|
|
3780
|
+
const handleLoadError = React33__default.useCallback((event) => {
|
|
2795
3781
|
setError(true);
|
|
2796
3782
|
setLoading(false);
|
|
2797
3783
|
onError?.(event);
|
|
2798
3784
|
}, [onError]);
|
|
2799
|
-
const handleLoadSuccess =
|
|
3785
|
+
const handleLoadSuccess = React33__default.useCallback((event) => {
|
|
2800
3786
|
setLoading(false);
|
|
2801
3787
|
onLoad?.(event);
|
|
2802
3788
|
}, [onLoad]);
|
|
2803
3789
|
const passthroughProps = allRest;
|
|
2804
3790
|
if (!src && fallback) {
|
|
2805
|
-
if (
|
|
2806
|
-
return
|
|
3791
|
+
if (React33__default.isValidElement(fallback)) {
|
|
3792
|
+
return React33__default.cloneElement(fallback, passthroughProps);
|
|
2807
3793
|
}
|
|
2808
3794
|
return fallback;
|
|
2809
3795
|
}
|
|
2810
3796
|
if (error) {
|
|
2811
|
-
if (
|
|
2812
|
-
return
|
|
3797
|
+
if (React33__default.isValidElement(fallback)) {
|
|
3798
|
+
return React33__default.cloneElement(fallback, passthroughProps);
|
|
2813
3799
|
}
|
|
2814
3800
|
return fallback;
|
|
2815
3801
|
}
|
|
@@ -2865,9 +3851,9 @@ var INPUT_VARIANT_CLASSES = {
|
|
|
2865
3851
|
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
2866
3852
|
unstyled: "border-0 bg-transparent p-0 h-auto"
|
|
2867
3853
|
};
|
|
2868
|
-
var Input =
|
|
3854
|
+
var Input = React33__default.forwardRef(
|
|
2869
3855
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
2870
|
-
const handleChange =
|
|
3856
|
+
const handleChange = React33__default.useCallback(
|
|
2871
3857
|
(event) => {
|
|
2872
3858
|
onChange?.(event);
|
|
2873
3859
|
onChangeText?.(event.target.value);
|
|
@@ -2875,9 +3861,10 @@ var Input = React30__default.forwardRef(
|
|
|
2875
3861
|
[onChange, onChangeText]
|
|
2876
3862
|
);
|
|
2877
3863
|
return /* @__PURE__ */ jsx(
|
|
2878
|
-
|
|
3864
|
+
Input$1,
|
|
2879
3865
|
{
|
|
2880
3866
|
ref,
|
|
3867
|
+
unstyled: true,
|
|
2881
3868
|
className: cn(INPUT_BASE, INPUT_SIZE_CLASSES[size], INPUT_VARIANT_CLASSES[variant], className),
|
|
2882
3869
|
...rest,
|
|
2883
3870
|
onChange: handleChange
|
|
@@ -2891,7 +3878,7 @@ function getComponentDisplayName2(type) {
|
|
|
2891
3878
|
if ("displayName" in type) return type.displayName;
|
|
2892
3879
|
return void 0;
|
|
2893
3880
|
}
|
|
2894
|
-
var InputGroup =
|
|
3881
|
+
var InputGroup = React33.forwardRef(
|
|
2895
3882
|
function InputGroup2(props, ref) {
|
|
2896
3883
|
const {
|
|
2897
3884
|
startElement,
|
|
@@ -2904,11 +3891,11 @@ var InputGroup = React30.forwardRef(
|
|
|
2904
3891
|
className,
|
|
2905
3892
|
...rest
|
|
2906
3893
|
} = props;
|
|
2907
|
-
const startElementRef =
|
|
2908
|
-
const endElementRef =
|
|
2909
|
-
const groupRef =
|
|
2910
|
-
const [inlinePaddings, setInlinePaddings] =
|
|
2911
|
-
const calculateInlinePaddings =
|
|
3894
|
+
const startElementRef = React33.useRef(null);
|
|
3895
|
+
const endElementRef = React33.useRef(null);
|
|
3896
|
+
const groupRef = React33.useRef(null);
|
|
3897
|
+
const [inlinePaddings, setInlinePaddings] = React33.useState();
|
|
3898
|
+
const calculateInlinePaddings = React33.useCallback(() => {
|
|
2912
3899
|
const startWidth = startElementRef.current?.getBoundingClientRect().width ?? 0;
|
|
2913
3900
|
const endWidth = endElementRef.current?.getBoundingClientRect().width ?? 0;
|
|
2914
3901
|
setInlinePaddings({
|
|
@@ -2916,7 +3903,7 @@ var InputGroup = React30.forwardRef(
|
|
|
2916
3903
|
end: endWidth
|
|
2917
3904
|
});
|
|
2918
3905
|
}, []);
|
|
2919
|
-
|
|
3906
|
+
React33.useEffect(() => {
|
|
2920
3907
|
if (!groupRef.current) return;
|
|
2921
3908
|
let timeoutId;
|
|
2922
3909
|
const intersectionObserver = new IntersectionObserver(
|
|
@@ -2936,7 +3923,7 @@ var InputGroup = React30.forwardRef(
|
|
|
2936
3923
|
}
|
|
2937
3924
|
};
|
|
2938
3925
|
}, [calculateInlinePaddings]);
|
|
2939
|
-
|
|
3926
|
+
React33.useEffect(() => {
|
|
2940
3927
|
calculateInlinePaddings();
|
|
2941
3928
|
const resizeHandler = debounce(calculateInlinePaddings, 300);
|
|
2942
3929
|
const resizeObserver = new ResizeObserver(resizeHandler);
|
|
@@ -2947,7 +3934,7 @@ var InputGroup = React30.forwardRef(
|
|
|
2947
3934
|
resizeObserver.disconnect();
|
|
2948
3935
|
};
|
|
2949
3936
|
}, [calculateInlinePaddings]);
|
|
2950
|
-
const combinedRef =
|
|
3937
|
+
const combinedRef = React33.useCallback((node) => {
|
|
2951
3938
|
groupRef.current = node;
|
|
2952
3939
|
if (typeof ref === "function") {
|
|
2953
3940
|
ref(node);
|
|
@@ -2976,11 +3963,11 @@ var InputGroup = React30.forwardRef(
|
|
|
2976
3963
|
children: startElement
|
|
2977
3964
|
}
|
|
2978
3965
|
),
|
|
2979
|
-
|
|
3966
|
+
React33.Children.map(children, (child) => {
|
|
2980
3967
|
if (getComponentDisplayName2(child.type) !== "FieldInput") {
|
|
2981
3968
|
return child;
|
|
2982
3969
|
}
|
|
2983
|
-
return
|
|
3970
|
+
return React33.cloneElement(child, {
|
|
2984
3971
|
...startElement && { ps: startOffset ?? (inlinePaddings?.start ? `${inlinePaddings.start}px` : void 0) },
|
|
2985
3972
|
...endElement && { pe: endOffset ?? (inlinePaddings?.end ? `${inlinePaddings.end}px` : void 0) },
|
|
2986
3973
|
// hide input value and placeholder for the first render
|
|
@@ -3006,262 +3993,6 @@ var InputGroup = React30.forwardRef(
|
|
|
3006
3993
|
}
|
|
3007
3994
|
);
|
|
3008
3995
|
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
3996
|
var INPUT_BASE2 = [
|
|
3266
3997
|
"w-10 h-10",
|
|
3267
3998
|
"text-center text-sm font-medium",
|
|
@@ -3276,7 +4007,7 @@ var INPUT_BASE2 = [
|
|
|
3276
4007
|
].join(" ");
|
|
3277
4008
|
var INPUT_FILLED = "border-[var(--color-input-border)]";
|
|
3278
4009
|
var INPUT_INVALID = "border-[var(--color-border-error)] hover:border-[var(--color-border-error)]";
|
|
3279
|
-
var PinInput =
|
|
4010
|
+
var PinInput = React33.forwardRef(
|
|
3280
4011
|
function PinInput2(props, ref) {
|
|
3281
4012
|
const {
|
|
3282
4013
|
count = 6,
|
|
@@ -3294,12 +4025,12 @@ var PinInput = React30.forwardRef(
|
|
|
3294
4025
|
bgColor,
|
|
3295
4026
|
className
|
|
3296
4027
|
} = props;
|
|
3297
|
-
const inputRefs =
|
|
3298
|
-
const values =
|
|
4028
|
+
const inputRefs = React33.useRef([]);
|
|
4029
|
+
const values = React33.useMemo(
|
|
3299
4030
|
() => controlledValue ?? Array.from({ length: count }).fill(""),
|
|
3300
4031
|
[controlledValue, count]
|
|
3301
4032
|
);
|
|
3302
|
-
const updateValue =
|
|
4033
|
+
const updateValue = React33.useCallback((index, char) => {
|
|
3303
4034
|
const next = [...values];
|
|
3304
4035
|
next[index] = char;
|
|
3305
4036
|
onValueChange?.({ value: next });
|
|
@@ -3307,11 +4038,11 @@ var PinInput = React30.forwardRef(
|
|
|
3307
4038
|
onValueComplete?.({ value: next });
|
|
3308
4039
|
}
|
|
3309
4040
|
}, [values, onValueChange, onValueComplete]);
|
|
3310
|
-
const focusInput =
|
|
4041
|
+
const focusInput = React33.useCallback((index) => {
|
|
3311
4042
|
const clamped = Math.max(0, Math.min(index, count - 1));
|
|
3312
4043
|
inputRefs.current[clamped]?.focus();
|
|
3313
4044
|
}, [count]);
|
|
3314
|
-
const handleInput =
|
|
4045
|
+
const handleInput = React33.useCallback((index, e) => {
|
|
3315
4046
|
const target = e.currentTarget;
|
|
3316
4047
|
const char = target.value.slice(-1);
|
|
3317
4048
|
updateValue(index, char);
|
|
@@ -3319,7 +4050,7 @@ var PinInput = React30.forwardRef(
|
|
|
3319
4050
|
focusInput(index + 1);
|
|
3320
4051
|
}
|
|
3321
4052
|
}, [count, updateValue, focusInput]);
|
|
3322
|
-
const handleKeyDown =
|
|
4053
|
+
const handleKeyDown = React33.useCallback((index, e) => {
|
|
3323
4054
|
if (e.key === "Backspace") {
|
|
3324
4055
|
if (values[index]) {
|
|
3325
4056
|
updateValue(index, "");
|
|
@@ -3336,7 +4067,7 @@ var PinInput = React30.forwardRef(
|
|
|
3336
4067
|
e.preventDefault();
|
|
3337
4068
|
}
|
|
3338
4069
|
}, [count, values, updateValue, focusInput]);
|
|
3339
|
-
const handlePaste =
|
|
4070
|
+
const handlePaste = React33.useCallback((e) => {
|
|
3340
4071
|
e.preventDefault();
|
|
3341
4072
|
const pasted = e.clipboardData.getData("text/plain").trim();
|
|
3342
4073
|
if (!pasted) {
|
|
@@ -3353,18 +4084,18 @@ var PinInput = React30.forwardRef(
|
|
|
3353
4084
|
}
|
|
3354
4085
|
focusInput(Math.min(chars.length, count - 1));
|
|
3355
4086
|
}, [count, values, onValueChange, onValueComplete, focusInput]);
|
|
3356
|
-
const handleFocus =
|
|
4087
|
+
const handleFocus = React33.useCallback((e) => {
|
|
3357
4088
|
e.currentTarget.select();
|
|
3358
4089
|
}, []);
|
|
3359
|
-
const handleNoop =
|
|
4090
|
+
const handleNoop = React33.useCallback(() => {
|
|
3360
4091
|
}, []);
|
|
3361
|
-
const setInputRef =
|
|
4092
|
+
const setInputRef = React33.useCallback((index) => (el) => {
|
|
3362
4093
|
inputRefs.current[index] = el;
|
|
3363
4094
|
}, []);
|
|
3364
|
-
const onInputAtIndex =
|
|
4095
|
+
const onInputAtIndex = React33.useCallback((index) => (e) => {
|
|
3365
4096
|
handleInput(index, e);
|
|
3366
4097
|
}, [handleInput]);
|
|
3367
|
-
const onKeyDownAtIndex =
|
|
4098
|
+
const onKeyDownAtIndex = React33.useCallback((index) => (e) => {
|
|
3368
4099
|
handleKeyDown(index, e);
|
|
3369
4100
|
}, [handleKeyDown]);
|
|
3370
4101
|
const bgStyle = bgColor ? { backgroundColor: `var(--color-${bgColor.replace(/\./g, "-")})` } : void 0;
|
|
@@ -3425,7 +4156,7 @@ function parsePlacement2(placement) {
|
|
|
3425
4156
|
}
|
|
3426
4157
|
return { side, align };
|
|
3427
4158
|
}
|
|
3428
|
-
var PositioningContext2 =
|
|
4159
|
+
var PositioningContext2 = React33.createContext({
|
|
3429
4160
|
side: "bottom",
|
|
3430
4161
|
align: "start",
|
|
3431
4162
|
sideOffset: 4,
|
|
@@ -3459,7 +4190,7 @@ var PopoverRoot = (props) => {
|
|
|
3459
4190
|
}
|
|
3460
4191
|
};
|
|
3461
4192
|
const { side, align } = parsePlacement2(mergedPositioning.placement);
|
|
3462
|
-
const positioningValue =
|
|
4193
|
+
const positioningValue = React33.useMemo(() => ({
|
|
3463
4194
|
side,
|
|
3464
4195
|
align,
|
|
3465
4196
|
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
@@ -3476,7 +4207,7 @@ var PopoverRoot = (props) => {
|
|
|
3476
4207
|
autoFocus,
|
|
3477
4208
|
closeOnInteractOutside
|
|
3478
4209
|
]);
|
|
3479
|
-
const handleOpenChange =
|
|
4210
|
+
const handleOpenChange = React33.useCallback((isOpen) => {
|
|
3480
4211
|
onOpenChange?.({ open: isOpen });
|
|
3481
4212
|
}, [onOpenChange]);
|
|
3482
4213
|
const placement = mergedPositioning.placement ?? "bottom-start";
|
|
@@ -3494,11 +4225,11 @@ var PopoverRoot = (props) => {
|
|
|
3494
4225
|
}
|
|
3495
4226
|
) });
|
|
3496
4227
|
};
|
|
3497
|
-
var PopoverTrigger =
|
|
4228
|
+
var PopoverTrigger = React33.forwardRef(function PopoverTrigger2(props, ref) {
|
|
3498
4229
|
const { asChild = true, ...rest } = props;
|
|
3499
4230
|
return /* @__PURE__ */ jsx(Popover.Trigger, { asChild: asChild ? "except-style" : void 0, ref, ...rest });
|
|
3500
4231
|
});
|
|
3501
|
-
var PopoverContent =
|
|
4232
|
+
var PopoverContent = React33.forwardRef(function PopoverContent2(props, ref) {
|
|
3502
4233
|
const { portalled = true, portalRef: _portalRef, className, w, minW, maxW, paddingTop, style: styleProp, ...rest } = props;
|
|
3503
4234
|
const resolvedW = typeof w === "object" ? w.base ?? w.lg : w;
|
|
3504
4235
|
const contentStyle = {
|
|
@@ -3529,7 +4260,7 @@ var PopoverContent = React30.forwardRef(function PopoverContent2(props, ref) {
|
|
|
3529
4260
|
}
|
|
3530
4261
|
);
|
|
3531
4262
|
});
|
|
3532
|
-
var PopoverArrow =
|
|
4263
|
+
var PopoverArrow = React33.forwardRef(function PopoverArrow2(props, ref) {
|
|
3533
4264
|
const { className, ...rest } = props;
|
|
3534
4265
|
return /* @__PURE__ */ jsx(
|
|
3535
4266
|
Popover.Arrow,
|
|
@@ -3541,7 +4272,7 @@ var PopoverArrow = React30.forwardRef(function PopoverArrow2(props, ref) {
|
|
|
3541
4272
|
}
|
|
3542
4273
|
);
|
|
3543
4274
|
});
|
|
3544
|
-
var PopoverCloseTrigger =
|
|
4275
|
+
var PopoverCloseTrigger = React33.forwardRef(function PopoverCloseTrigger2(props, ref) {
|
|
3545
4276
|
const { className, ...rest } = props;
|
|
3546
4277
|
return /* @__PURE__ */ jsx(
|
|
3547
4278
|
Popover.Close,
|
|
@@ -3555,14 +4286,14 @@ var PopoverCloseTrigger = React30.forwardRef(function PopoverCloseTrigger2(props
|
|
|
3555
4286
|
}
|
|
3556
4287
|
);
|
|
3557
4288
|
});
|
|
3558
|
-
var PopoverCloseTriggerWrapper =
|
|
4289
|
+
var PopoverCloseTriggerWrapper = React33.forwardRef(function PopoverCloseTriggerWrapper2(props, ref) {
|
|
3559
4290
|
const { disabled, children, ...rest } = props;
|
|
3560
4291
|
if (disabled) {
|
|
3561
4292
|
return children;
|
|
3562
4293
|
}
|
|
3563
4294
|
return /* @__PURE__ */ jsx(Popover.Close, { ref, ...rest, asChild: true, children });
|
|
3564
4295
|
});
|
|
3565
|
-
var PopoverBody =
|
|
4296
|
+
var PopoverBody = React33.forwardRef(function PopoverBody2(props, ref) {
|
|
3566
4297
|
const {
|
|
3567
4298
|
className,
|
|
3568
4299
|
style: styleProp,
|
|
@@ -3600,7 +4331,7 @@ var PopoverBody = React30.forwardRef(function PopoverBody2(props, ref) {
|
|
|
3600
4331
|
}
|
|
3601
4332
|
);
|
|
3602
4333
|
});
|
|
3603
|
-
var PopoverHeader =
|
|
4334
|
+
var PopoverHeader = React33.forwardRef(function PopoverHeader2(props, ref) {
|
|
3604
4335
|
const { className, ...rest } = props;
|
|
3605
4336
|
return /* @__PURE__ */ jsx(
|
|
3606
4337
|
"div",
|
|
@@ -3611,7 +4342,7 @@ var PopoverHeader = React30.forwardRef(function PopoverHeader2(props, ref) {
|
|
|
3611
4342
|
}
|
|
3612
4343
|
);
|
|
3613
4344
|
});
|
|
3614
|
-
var PopoverFooter =
|
|
4345
|
+
var PopoverFooter = React33.forwardRef(function PopoverFooter2(props, ref) {
|
|
3615
4346
|
const { className, ...rest } = props;
|
|
3616
4347
|
return /* @__PURE__ */ jsx(
|
|
3617
4348
|
"div",
|
|
@@ -3622,7 +4353,7 @@ var PopoverFooter = React30.forwardRef(function PopoverFooter2(props, ref) {
|
|
|
3622
4353
|
}
|
|
3623
4354
|
);
|
|
3624
4355
|
});
|
|
3625
|
-
var PopoverTitle =
|
|
4356
|
+
var PopoverTitle = React33.forwardRef(function PopoverTitle2(props, ref) {
|
|
3626
4357
|
const { className, ...rest } = props;
|
|
3627
4358
|
return /* @__PURE__ */ jsx(
|
|
3628
4359
|
"h3",
|
|
@@ -3633,7 +4364,7 @@ var PopoverTitle = React30.forwardRef(function PopoverTitle2(props, ref) {
|
|
|
3633
4364
|
}
|
|
3634
4365
|
);
|
|
3635
4366
|
});
|
|
3636
|
-
var PopoverDescription =
|
|
4367
|
+
var PopoverDescription = React33.forwardRef(function PopoverDescription2(props, ref) {
|
|
3637
4368
|
const { className, ...rest } = props;
|
|
3638
4369
|
return /* @__PURE__ */ jsx(
|
|
3639
4370
|
"p",
|
|
@@ -3655,7 +4386,7 @@ function normalizeValue(value, min, max) {
|
|
|
3655
4386
|
if (max <= min) return 0;
|
|
3656
4387
|
return Math.round((value - min) / (max - min) * 100);
|
|
3657
4388
|
}
|
|
3658
|
-
var Progress =
|
|
4389
|
+
var Progress = React33.forwardRef(
|
|
3659
4390
|
function Progress2(props, ref) {
|
|
3660
4391
|
const {
|
|
3661
4392
|
value,
|
|
@@ -3695,10 +4426,11 @@ var Progress = React30.forwardRef(
|
|
|
3695
4426
|
style: rootStyle,
|
|
3696
4427
|
...rest,
|
|
3697
4428
|
children: /* @__PURE__ */ jsx(
|
|
3698
|
-
|
|
4429
|
+
Progress$1,
|
|
3699
4430
|
{
|
|
3700
4431
|
value: percent,
|
|
3701
4432
|
max: 100,
|
|
4433
|
+
unstyled: true,
|
|
3702
4434
|
className: cn(
|
|
3703
4435
|
"w-full overflow-hidden rounded-full",
|
|
3704
4436
|
"bg-[var(--color-progress-track)]",
|
|
@@ -3707,14 +4439,15 @@ var Progress = React30.forwardRef(
|
|
|
3707
4439
|
),
|
|
3708
4440
|
style: trackStyle,
|
|
3709
4441
|
children: /* @__PURE__ */ jsx(
|
|
3710
|
-
|
|
4442
|
+
Progress$1.Indicator,
|
|
3711
4443
|
{
|
|
4444
|
+
unstyled: true,
|
|
4445
|
+
transition: "slow",
|
|
3712
4446
|
className: cn(
|
|
3713
|
-
"h-full rounded-full
|
|
4447
|
+
"h-full rounded-full",
|
|
3714
4448
|
!color && "bg-[var(--color-progress-indicator)]"
|
|
3715
4449
|
),
|
|
3716
4450
|
style: {
|
|
3717
|
-
width: `${percent}%`,
|
|
3718
4451
|
...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
|
|
3719
4452
|
}
|
|
3720
4453
|
}
|
|
@@ -3732,12 +4465,12 @@ var SIZE_MAP = {
|
|
|
3732
4465
|
lg: { size: 48, thickness: 7, textClass: "text-sm" },
|
|
3733
4466
|
xl: { size: 64, thickness: 8, textClass: "text-sm" }
|
|
3734
4467
|
};
|
|
3735
|
-
var Ctx =
|
|
4468
|
+
var Ctx = React33.createContext({
|
|
3736
4469
|
value: 0,
|
|
3737
4470
|
size: "md",
|
|
3738
4471
|
colorPalette: "blue"
|
|
3739
4472
|
});
|
|
3740
|
-
var ProgressCircleRoot =
|
|
4473
|
+
var ProgressCircleRoot = React33.forwardRef(function ProgressCircleRoot2(props, ref) {
|
|
3741
4474
|
const {
|
|
3742
4475
|
value = 0,
|
|
3743
4476
|
size = "md",
|
|
@@ -3746,7 +4479,7 @@ var ProgressCircleRoot = React30.forwardRef(function ProgressCircleRoot2(props,
|
|
|
3746
4479
|
children,
|
|
3747
4480
|
...rest
|
|
3748
4481
|
} = props;
|
|
3749
|
-
const ctx =
|
|
4482
|
+
const ctx = React33.useMemo(
|
|
3750
4483
|
() => ({ value: value ?? null, size, colorPalette }),
|
|
3751
4484
|
[value, size, colorPalette]
|
|
3752
4485
|
);
|
|
@@ -3764,9 +4497,9 @@ var ProgressCircleRoot = React30.forwardRef(function ProgressCircleRoot2(props,
|
|
|
3764
4497
|
}
|
|
3765
4498
|
) });
|
|
3766
4499
|
});
|
|
3767
|
-
var ProgressCircleRing =
|
|
4500
|
+
var ProgressCircleRing = React33.forwardRef(function ProgressCircleRing2(props, ref) {
|
|
3768
4501
|
const { trackColor, cap, color, className, ...rest } = props;
|
|
3769
|
-
const { value, size: sizeKey } =
|
|
4502
|
+
const { value, size: sizeKey } = React33.useContext(Ctx);
|
|
3770
4503
|
const { size, thickness } = SIZE_MAP[sizeKey];
|
|
3771
4504
|
const radius = size / 2 - thickness / 2;
|
|
3772
4505
|
const circumference = 2 * Math.PI * radius;
|
|
@@ -3821,9 +4554,9 @@ var ProgressCircleRing = React30.forwardRef(function ProgressCircleRing2(props,
|
|
|
3821
4554
|
}
|
|
3822
4555
|
);
|
|
3823
4556
|
});
|
|
3824
|
-
var ProgressCircleValueText =
|
|
4557
|
+
var ProgressCircleValueText = React33.forwardRef(function ProgressCircleValueText2(props, ref) {
|
|
3825
4558
|
const { className, children, ...rest } = props;
|
|
3826
|
-
const { value, size: sizeKey } =
|
|
4559
|
+
const { value, size: sizeKey } = React33.useContext(Ctx);
|
|
3827
4560
|
const { textClass } = SIZE_MAP[sizeKey];
|
|
3828
4561
|
return /* @__PURE__ */ jsx(
|
|
3829
4562
|
"div",
|
|
@@ -3867,8 +4600,8 @@ var SIZE_CLASSES8 = {
|
|
|
3867
4600
|
label: "text-base"
|
|
3868
4601
|
}
|
|
3869
4602
|
};
|
|
3870
|
-
var RadioSizeContext =
|
|
3871
|
-
var RadioGroupBase =
|
|
4603
|
+
var RadioSizeContext = React33.createContext("md");
|
|
4604
|
+
var RadioGroupBase = React33.forwardRef(
|
|
3872
4605
|
function RadioGroup2(props, ref) {
|
|
3873
4606
|
const {
|
|
3874
4607
|
children,
|
|
@@ -3877,7 +4610,8 @@ var RadioGroupBase = React30.forwardRef(
|
|
|
3877
4610
|
disabled = false,
|
|
3878
4611
|
readOnly = false,
|
|
3879
4612
|
orientation = "vertical",
|
|
3880
|
-
loop
|
|
4613
|
+
// `loop` was a Radix-only knob; gui's roving focus always wraps.
|
|
4614
|
+
loop: _loop = true,
|
|
3881
4615
|
defaultValue,
|
|
3882
4616
|
value,
|
|
3883
4617
|
onValueChange,
|
|
@@ -3885,7 +4619,7 @@ var RadioGroupBase = React30.forwardRef(
|
|
|
3885
4619
|
className,
|
|
3886
4620
|
...rest
|
|
3887
4621
|
} = props;
|
|
3888
|
-
const handleValueChange =
|
|
4622
|
+
const handleValueChange = React33.useCallback(
|
|
3889
4623
|
(nextValue) => {
|
|
3890
4624
|
if (readOnly) return;
|
|
3891
4625
|
onValueChange?.({ value: nextValue });
|
|
@@ -3893,14 +4627,14 @@ var RadioGroupBase = React30.forwardRef(
|
|
|
3893
4627
|
[readOnly, onValueChange]
|
|
3894
4628
|
);
|
|
3895
4629
|
return /* @__PURE__ */ jsx(RadioSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(
|
|
3896
|
-
|
|
4630
|
+
RadioGroup,
|
|
3897
4631
|
{
|
|
3898
4632
|
ref,
|
|
4633
|
+
unstyled: true,
|
|
3899
4634
|
name,
|
|
3900
4635
|
required,
|
|
3901
4636
|
disabled: disabled || readOnly,
|
|
3902
4637
|
orientation,
|
|
3903
|
-
loop,
|
|
3904
4638
|
defaultValue,
|
|
3905
4639
|
value: value ?? void 0,
|
|
3906
4640
|
onValueChange: handleValueChange,
|
|
@@ -3918,10 +4652,10 @@ var RadioGroupBase = React30.forwardRef(
|
|
|
3918
4652
|
var RadioGroup3 = RadioGroupBase;
|
|
3919
4653
|
var NOOP2 = () => {
|
|
3920
4654
|
};
|
|
3921
|
-
var RadioBase =
|
|
4655
|
+
var RadioBase = React33.forwardRef(
|
|
3922
4656
|
function Radio(props, ref) {
|
|
3923
4657
|
const { children, inputProps, rootRef, value, disabled, className, ...rest } = props;
|
|
3924
|
-
const size =
|
|
4658
|
+
const size = React33.useContext(RadioSizeContext);
|
|
3925
4659
|
const sizeClasses2 = SIZE_CLASSES8[size];
|
|
3926
4660
|
return /* @__PURE__ */ jsxs(
|
|
3927
4661
|
"label",
|
|
@@ -3937,8 +4671,9 @@ var RadioBase = React30.forwardRef(
|
|
|
3937
4671
|
...rest,
|
|
3938
4672
|
children: [
|
|
3939
4673
|
/* @__PURE__ */ jsx(
|
|
3940
|
-
|
|
4674
|
+
RadioGroup.Item,
|
|
3941
4675
|
{
|
|
4676
|
+
unstyled: true,
|
|
3942
4677
|
value,
|
|
3943
4678
|
disabled,
|
|
3944
4679
|
className: cn(
|
|
@@ -3950,8 +4685,9 @@ var RadioBase = React30.forwardRef(
|
|
|
3950
4685
|
sizeClasses2.control
|
|
3951
4686
|
),
|
|
3952
4687
|
children: /* @__PURE__ */ jsx(
|
|
3953
|
-
|
|
4688
|
+
RadioGroup.Indicator,
|
|
3954
4689
|
{
|
|
4690
|
+
unstyled: true,
|
|
3955
4691
|
className: cn(
|
|
3956
4692
|
"block rounded-full bg-gray-800 dark:bg-white",
|
|
3957
4693
|
sizeClasses2.indicator
|
|
@@ -3983,23 +4719,23 @@ var RadioBase = React30.forwardRef(
|
|
|
3983
4719
|
var Radio2 = RadioBase;
|
|
3984
4720
|
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
4721
|
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 =
|
|
4722
|
+
var Rating = React33.forwardRef(
|
|
3987
4723
|
function Rating2(props, ref) {
|
|
3988
4724
|
const { count = 5, label: labelProp, defaultValue = 0, onValueChange, readOnly, className, ...rest } = props;
|
|
3989
|
-
const [value, setValue] =
|
|
3990
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4725
|
+
const [value, setValue] = React33.useState(defaultValue);
|
|
4726
|
+
const [hoveredIndex, setHoveredIndex] = React33.useState(-1);
|
|
3991
4727
|
const highlightedIndex = hoveredIndex >= 0 && !readOnly ? hoveredIndex + 1 : value;
|
|
3992
4728
|
const label = Array.isArray(labelProp) ? labelProp[highlightedIndex - 1] : labelProp;
|
|
3993
|
-
const handleClick =
|
|
4729
|
+
const handleClick = React33.useCallback((index) => () => {
|
|
3994
4730
|
if (readOnly) return;
|
|
3995
4731
|
setValue(index);
|
|
3996
4732
|
onValueChange?.({ value: index });
|
|
3997
4733
|
}, [readOnly, onValueChange]);
|
|
3998
|
-
const handleMouseEnter =
|
|
4734
|
+
const handleMouseEnter = React33.useCallback((index) => () => {
|
|
3999
4735
|
if (readOnly) return;
|
|
4000
4736
|
setHoveredIndex(index);
|
|
4001
4737
|
}, [readOnly]);
|
|
4002
|
-
const handleMouseLeave =
|
|
4738
|
+
const handleMouseLeave = React33.useCallback(() => {
|
|
4003
4739
|
setHoveredIndex(-1);
|
|
4004
4740
|
}, []);
|
|
4005
4741
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("inline-flex items-center gap-1", className), ...rest, children: [
|
|
@@ -4033,8 +4769,8 @@ function createListCollection(config2) {
|
|
|
4033
4769
|
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
4770
|
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
4771
|
function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
4036
|
-
const [value, setValue] =
|
|
4037
|
-
const handleChange =
|
|
4772
|
+
const [value, setValue] = React33.useState(initialValue);
|
|
4773
|
+
const handleChange = React33.useCallback((e) => {
|
|
4038
4774
|
setValue(e.target.value);
|
|
4039
4775
|
onChange?.(e.target.value);
|
|
4040
4776
|
}, [onChange]);
|
|
@@ -4053,15 +4789,15 @@ function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
|
4053
4789
|
}
|
|
4054
4790
|
);
|
|
4055
4791
|
}
|
|
4056
|
-
var SelectInternalContext =
|
|
4792
|
+
var SelectInternalContext = React33.createContext(null);
|
|
4057
4793
|
function useSelectInternalContext() {
|
|
4058
|
-
const ctx =
|
|
4794
|
+
const ctx = React33.useContext(SelectInternalContext);
|
|
4059
4795
|
if (!ctx) {
|
|
4060
4796
|
throw new Error("Select compound components must be rendered inside <SelectRoot>");
|
|
4061
4797
|
}
|
|
4062
4798
|
return ctx;
|
|
4063
4799
|
}
|
|
4064
|
-
var SelectRoot =
|
|
4800
|
+
var SelectRoot = React33.forwardRef(
|
|
4065
4801
|
function SelectRoot2(props, ref) {
|
|
4066
4802
|
const {
|
|
4067
4803
|
children,
|
|
@@ -4092,21 +4828,21 @@ var SelectRoot = React30.forwardRef(
|
|
|
4092
4828
|
hideFrom: _hideFrom
|
|
4093
4829
|
} = props;
|
|
4094
4830
|
const collection = collectionProp ?? createListCollection({ items: [] });
|
|
4095
|
-
const [internalValue, setInternalValue] =
|
|
4831
|
+
const [internalValue, setInternalValue] = React33.useState(defaultValueArr ?? []);
|
|
4096
4832
|
const currentValue = valueProp ?? internalValue;
|
|
4097
|
-
const selectedItems =
|
|
4833
|
+
const selectedItems = React33.useMemo(() => {
|
|
4098
4834
|
return currentValue.map((v) => collection.items.find((item) => item.value === v)).filter(Boolean);
|
|
4099
4835
|
}, [currentValue, collection.items]);
|
|
4100
|
-
const [open, setOpen] =
|
|
4836
|
+
const [open, setOpen] = React33.useState(defaultOpen ?? false);
|
|
4101
4837
|
const isOpen = openProp ?? open;
|
|
4102
|
-
const handleOpenChange =
|
|
4838
|
+
const handleOpenChange = React33.useCallback((nextOpen) => {
|
|
4103
4839
|
setOpen(nextOpen);
|
|
4104
4840
|
onOpenChange?.(nextOpen);
|
|
4105
4841
|
if (!nextOpen) {
|
|
4106
4842
|
onInteractOutside?.();
|
|
4107
4843
|
}
|
|
4108
4844
|
}, [onOpenChange, onInteractOutside]);
|
|
4109
|
-
const handleRadixValueChange =
|
|
4845
|
+
const handleRadixValueChange = React33.useCallback((radixValue) => {
|
|
4110
4846
|
const nextArr = [radixValue];
|
|
4111
4847
|
if (!valueProp) {
|
|
4112
4848
|
setInternalValue(nextArr);
|
|
@@ -4114,7 +4850,7 @@ var SelectRoot = React30.forwardRef(
|
|
|
4114
4850
|
const items = collection.items.filter((item) => nextArr.includes(item.value));
|
|
4115
4851
|
onValueChangeProp?.({ value: nextArr, items });
|
|
4116
4852
|
}, [valueProp, collection.items, onValueChangeProp]);
|
|
4117
|
-
const ctxValue =
|
|
4853
|
+
const ctxValue = React33.useMemo(() => ({
|
|
4118
4854
|
value: currentValue,
|
|
4119
4855
|
selectedItems,
|
|
4120
4856
|
collection,
|
|
@@ -4134,7 +4870,7 @@ var SelectRoot = React30.forwardRef(
|
|
|
4134
4870
|
if (typeof v === "string") return v;
|
|
4135
4871
|
return v.base ?? v.lg ?? Object.values(v)[0];
|
|
4136
4872
|
};
|
|
4137
|
-
const inlineStyle =
|
|
4873
|
+
const inlineStyle = React33.useMemo(() => {
|
|
4138
4874
|
const s = { ...style };
|
|
4139
4875
|
const rw = resolveVal(w);
|
|
4140
4876
|
if (rw) s.width = rw;
|
|
@@ -4172,7 +4908,7 @@ var SelectRoot = React30.forwardRef(
|
|
|
4172
4908
|
) });
|
|
4173
4909
|
}
|
|
4174
4910
|
);
|
|
4175
|
-
var SelectControl =
|
|
4911
|
+
var SelectControl = React33.forwardRef(
|
|
4176
4912
|
function SelectControl2(props, ref) {
|
|
4177
4913
|
const { children, noIndicator, triggerProps, loading, defaultValue } = props;
|
|
4178
4914
|
const ctx = useSelectInternalContext();
|
|
@@ -4209,11 +4945,11 @@ var SelectControl = React30.forwardRef(
|
|
|
4209
4945
|
return trigger;
|
|
4210
4946
|
}
|
|
4211
4947
|
);
|
|
4212
|
-
var SelectClearTrigger =
|
|
4948
|
+
var SelectClearTrigger = React33.forwardRef(
|
|
4213
4949
|
function SelectClearTrigger2(props, ref) {
|
|
4214
4950
|
const { className, ...rest } = props;
|
|
4215
4951
|
const ctx = useSelectInternalContext();
|
|
4216
|
-
const handleClick =
|
|
4952
|
+
const handleClick = React33.useCallback(() => {
|
|
4217
4953
|
ctx.onValueChange({ value: [], items: [] });
|
|
4218
4954
|
}, [ctx]);
|
|
4219
4955
|
return /* @__PURE__ */ jsx(
|
|
@@ -4230,7 +4966,7 @@ var SelectClearTrigger = React30.forwardRef(
|
|
|
4230
4966
|
);
|
|
4231
4967
|
}
|
|
4232
4968
|
);
|
|
4233
|
-
var SelectContent =
|
|
4969
|
+
var SelectContent = React33.forwardRef(
|
|
4234
4970
|
function SelectContent2(props, ref) {
|
|
4235
4971
|
const { portalled = true, portalRef, children, className, ...rest } = props;
|
|
4236
4972
|
const content = /* @__PURE__ */ jsx(
|
|
@@ -4257,7 +4993,7 @@ var SelectContent = React30.forwardRef(
|
|
|
4257
4993
|
return content;
|
|
4258
4994
|
}
|
|
4259
4995
|
);
|
|
4260
|
-
var SelectItem =
|
|
4996
|
+
var SelectItem = React33.forwardRef(
|
|
4261
4997
|
function SelectItem2(props, ref) {
|
|
4262
4998
|
const { item, children, className, ...rest } = props;
|
|
4263
4999
|
return /* @__PURE__ */ jsxs(
|
|
@@ -4285,7 +5021,7 @@ var SelectItem = React30.forwardRef(
|
|
|
4285
5021
|
);
|
|
4286
5022
|
}
|
|
4287
5023
|
);
|
|
4288
|
-
var SelectValueText =
|
|
5024
|
+
var SelectValueText = React33.forwardRef(
|
|
4289
5025
|
function SelectValueText2(props, ref) {
|
|
4290
5026
|
const { children, size, required, invalid, errorText, mode, className, style, placeholder: placeholderProp, ...rest } = props;
|
|
4291
5027
|
const ctx = useSelectInternalContext();
|
|
@@ -4341,7 +5077,7 @@ var SelectValueText = React30.forwardRef(
|
|
|
4341
5077
|
);
|
|
4342
5078
|
}
|
|
4343
5079
|
);
|
|
4344
|
-
var SelectItemGroup =
|
|
5080
|
+
var SelectItemGroup = React33.forwardRef(
|
|
4345
5081
|
function SelectItemGroup2(props, ref) {
|
|
4346
5082
|
const { children, label, className, ...rest } = props;
|
|
4347
5083
|
return /* @__PURE__ */ jsxs(RadixSelect.Group, { ref, className: cn("py-1", className), ...rest, children: [
|
|
@@ -4352,7 +5088,7 @@ var SelectItemGroup = React30.forwardRef(
|
|
|
4352
5088
|
);
|
|
4353
5089
|
var SelectLabel = RadixSelect.Label;
|
|
4354
5090
|
var SelectItemText = RadixSelect.ItemText;
|
|
4355
|
-
var Select =
|
|
5091
|
+
var Select = React33.forwardRef((props, ref) => {
|
|
4356
5092
|
const { collection, placeholder, portalled = true, loading, errorText, contentProps, contentHeader, itemFilter, mode, ...rest } = props;
|
|
4357
5093
|
return /* @__PURE__ */ jsxs(
|
|
4358
5094
|
SelectRoot,
|
|
@@ -4374,7 +5110,7 @@ var Select = React30.forwardRef((props, ref) => {
|
|
|
4374
5110
|
) }),
|
|
4375
5111
|
/* @__PURE__ */ jsxs(SelectContent, { portalled, ...contentProps, children: [
|
|
4376
5112
|
contentHeader,
|
|
4377
|
-
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxs(
|
|
5113
|
+
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxs(React33.Fragment, { children: [
|
|
4378
5114
|
/* @__PURE__ */ jsx(SelectItem, { item, children: item.renderLabel ? item.renderLabel("item") : item.label }),
|
|
4379
5115
|
item.afterElement
|
|
4380
5116
|
] }, item.value))
|
|
@@ -4383,19 +5119,19 @@ var Select = React30.forwardRef((props, ref) => {
|
|
|
4383
5119
|
}
|
|
4384
5120
|
);
|
|
4385
5121
|
});
|
|
4386
|
-
var SelectAsync =
|
|
5122
|
+
var SelectAsync = React33.forwardRef((props, ref) => {
|
|
4387
5123
|
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] =
|
|
5124
|
+
const [collection, setCollection] = React33.useState(createListCollection({ items: [] }));
|
|
5125
|
+
const [inputValue, setInputValue] = React33.useState("");
|
|
5126
|
+
const [value, setValue] = React33.useState([]);
|
|
4391
5127
|
const debouncedInputValue = useDebounce(inputValue, 300);
|
|
4392
|
-
|
|
5128
|
+
React33.useEffect(() => {
|
|
4393
5129
|
loadOptions(debouncedInputValue, value).then(setCollection);
|
|
4394
5130
|
}, [debouncedInputValue, loadOptions, value]);
|
|
4395
|
-
const handleFilterChange =
|
|
5131
|
+
const handleFilterChange = React33.useCallback((val) => {
|
|
4396
5132
|
setInputValue(val);
|
|
4397
5133
|
}, []);
|
|
4398
|
-
const handleValueChange =
|
|
5134
|
+
const handleValueChange = React33.useCallback(({ value: v, items }) => {
|
|
4399
5135
|
setValue(v);
|
|
4400
5136
|
onValueChange?.({ value: v, items });
|
|
4401
5137
|
}, [onValueChange]);
|
|
@@ -4454,13 +5190,14 @@ var VERTICAL_SIZE_CLASSES = {
|
|
|
4454
5190
|
md: "border-l-2",
|
|
4455
5191
|
lg: "border-l-[3px]"
|
|
4456
5192
|
};
|
|
4457
|
-
var Separator2 =
|
|
5193
|
+
var Separator2 = React33__default.forwardRef(
|
|
4458
5194
|
function Separator3({ orientation = "horizontal", variant = "solid", size = "sm", className, ...rest }, ref) {
|
|
4459
5195
|
const isVertical = orientation === "vertical";
|
|
4460
5196
|
return /* @__PURE__ */ jsx(
|
|
4461
|
-
|
|
5197
|
+
Separator,
|
|
4462
5198
|
{
|
|
4463
5199
|
ref,
|
|
5200
|
+
vertical: isVertical,
|
|
4464
5201
|
role: "separator",
|
|
4465
5202
|
"aria-orientation": orientation,
|
|
4466
5203
|
className: cn(
|
|
@@ -4476,9 +5213,7 @@ var Separator2 = React30__default.forwardRef(
|
|
|
4476
5213
|
);
|
|
4477
5214
|
}
|
|
4478
5215
|
);
|
|
4479
|
-
var
|
|
4480
|
-
var TRACK_HEIGHT = 6;
|
|
4481
|
-
var Slider = React30.forwardRef(
|
|
5216
|
+
var Slider = React33.forwardRef(
|
|
4482
5217
|
function Slider2(props, ref) {
|
|
4483
5218
|
const {
|
|
4484
5219
|
marks: marksProp,
|
|
@@ -4490,7 +5225,7 @@ var Slider = React30.forwardRef(
|
|
|
4490
5225
|
max = 100,
|
|
4491
5226
|
step,
|
|
4492
5227
|
disabled,
|
|
4493
|
-
orientation,
|
|
5228
|
+
orientation = "horizontal",
|
|
4494
5229
|
name,
|
|
4495
5230
|
onValueChange,
|
|
4496
5231
|
onValueCommit,
|
|
@@ -4502,6 +5237,14 @@ var Slider = React30.forwardRef(
|
|
|
4502
5237
|
return mark;
|
|
4503
5238
|
});
|
|
4504
5239
|
const hasMarkLabel = Boolean(marks?.some((mark) => mark.label));
|
|
5240
|
+
const latest = React33.useRef(value ?? defaultValue ?? []);
|
|
5241
|
+
const handleValueChange = React33.useCallback((next) => {
|
|
5242
|
+
latest.current = next;
|
|
5243
|
+
onValueChange?.(next);
|
|
5244
|
+
}, [onValueChange]);
|
|
5245
|
+
const handleSlideEnd = React33.useCallback(() => {
|
|
5246
|
+
onValueCommit?.(latest.current);
|
|
5247
|
+
}, [onValueCommit]);
|
|
4505
5248
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
4506
5249
|
label && !showValue && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
|
|
4507
5250
|
label && showValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -4509,9 +5252,10 @@ var Slider = React30.forwardRef(
|
|
|
4509
5252
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
|
|
4510
5253
|
] }),
|
|
4511
5254
|
/* @__PURE__ */ jsxs(
|
|
4512
|
-
|
|
5255
|
+
Slider$1,
|
|
4513
5256
|
{
|
|
4514
5257
|
ref,
|
|
5258
|
+
unstyled: true,
|
|
4515
5259
|
className: cn(
|
|
4516
5260
|
"relative flex w-full touch-none select-none items-center",
|
|
4517
5261
|
hasMarkLabel && "mb-6"
|
|
@@ -4524,24 +5268,30 @@ var Slider = React30.forwardRef(
|
|
|
4524
5268
|
disabled,
|
|
4525
5269
|
orientation,
|
|
4526
5270
|
name,
|
|
4527
|
-
onValueChange,
|
|
4528
|
-
|
|
5271
|
+
onValueChange: handleValueChange,
|
|
5272
|
+
onSlideEnd: handleSlideEnd,
|
|
4529
5273
|
children: [
|
|
4530
5274
|
/* @__PURE__ */ jsx(
|
|
4531
|
-
|
|
5275
|
+
Slider$1.Track,
|
|
4532
5276
|
{
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
5277
|
+
unstyled: true,
|
|
5278
|
+
className: "relative grow h-1.5 rounded-full bg-border-divider",
|
|
5279
|
+
children: /* @__PURE__ */ jsx(
|
|
5280
|
+
Slider$1.TrackActive,
|
|
5281
|
+
{
|
|
5282
|
+
unstyled: true,
|
|
5283
|
+
className: "absolute h-full rounded-full bg-link-primary"
|
|
5284
|
+
}
|
|
5285
|
+
)
|
|
4538
5286
|
}
|
|
4539
5287
|
),
|
|
4540
5288
|
resolvedValue?.map((_, index) => /* @__PURE__ */ jsx(
|
|
4541
|
-
|
|
5289
|
+
Slider$1.Thumb,
|
|
4542
5290
|
{
|
|
5291
|
+
index,
|
|
5292
|
+
unstyled: true,
|
|
4543
5293
|
className: cn(
|
|
4544
|
-
|
|
5294
|
+
"block h-5 w-5",
|
|
4545
5295
|
"rounded-full border-2 border-link-primary bg-white",
|
|
4546
5296
|
"shadow-sm transition-colors",
|
|
4547
5297
|
"hover:border-link-primary-hover",
|
|
@@ -4583,22 +5333,22 @@ var NOOP3 = () => {
|
|
|
4583
5333
|
var SIZE_CLASSES9 = {
|
|
4584
5334
|
sm: {
|
|
4585
5335
|
root: "h-4 w-7",
|
|
4586
|
-
thumb: "h-3 w-3
|
|
5336
|
+
thumb: "h-3 w-3",
|
|
4587
5337
|
label: "text-xs"
|
|
4588
5338
|
},
|
|
4589
5339
|
md: {
|
|
4590
5340
|
root: "h-5 w-9",
|
|
4591
|
-
thumb: "h-4 w-4
|
|
5341
|
+
thumb: "h-4 w-4",
|
|
4592
5342
|
label: "text-sm"
|
|
4593
5343
|
},
|
|
4594
5344
|
lg: {
|
|
4595
5345
|
root: "h-6 w-11",
|
|
4596
|
-
thumb: "h-5 w-5
|
|
5346
|
+
thumb: "h-5 w-5",
|
|
4597
5347
|
label: "text-base"
|
|
4598
5348
|
}
|
|
4599
5349
|
};
|
|
4600
|
-
var SwitchBase =
|
|
4601
|
-
function Switch(props, ref) {
|
|
5350
|
+
var SwitchBase = React33.forwardRef(
|
|
5351
|
+
function Switch$1(props, ref) {
|
|
4602
5352
|
const {
|
|
4603
5353
|
inputProps,
|
|
4604
5354
|
children,
|
|
@@ -4616,17 +5366,15 @@ var SwitchBase = React30.forwardRef(
|
|
|
4616
5366
|
className,
|
|
4617
5367
|
...rest
|
|
4618
5368
|
} = props;
|
|
4619
|
-
const [internalChecked, setInternalChecked] =
|
|
5369
|
+
const [internalChecked, setInternalChecked] = React33.useState(defaultChecked ?? false);
|
|
4620
5370
|
const isControlled = checkedProp !== void 0;
|
|
4621
5371
|
const checkedState = isControlled ? checkedProp : internalChecked;
|
|
4622
|
-
const handleCheckedChange =
|
|
5372
|
+
const handleCheckedChange = React33.useCallback(
|
|
4623
5373
|
(nextChecked) => {
|
|
4624
5374
|
if (!isControlled) {
|
|
4625
5375
|
setInternalChecked(nextChecked);
|
|
4626
5376
|
}
|
|
4627
|
-
|
|
4628
|
-
onCheckedChange({ checked: nextChecked });
|
|
4629
|
-
}
|
|
5377
|
+
onCheckedChange?.({ checked: nextChecked });
|
|
4630
5378
|
},
|
|
4631
5379
|
[isControlled, onCheckedChange]
|
|
4632
5380
|
);
|
|
@@ -4647,8 +5395,9 @@ var SwitchBase = React30.forwardRef(
|
|
|
4647
5395
|
...rest,
|
|
4648
5396
|
children: [
|
|
4649
5397
|
/* @__PURE__ */ jsxs(
|
|
4650
|
-
|
|
5398
|
+
Switch,
|
|
4651
5399
|
{
|
|
5400
|
+
unstyled: true,
|
|
4652
5401
|
checked: checkedState,
|
|
4653
5402
|
onCheckedChange: handleCheckedChange,
|
|
4654
5403
|
disabled,
|
|
@@ -4663,12 +5412,13 @@ var SwitchBase = React30.forwardRef(
|
|
|
4663
5412
|
children: [
|
|
4664
5413
|
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
5414
|
/* @__PURE__ */ jsx(
|
|
4666
|
-
|
|
5415
|
+
Switch.Thumb,
|
|
4667
5416
|
{
|
|
5417
|
+
unstyled: true,
|
|
5418
|
+
"data-thumb": true,
|
|
5419
|
+
transition: "quicker",
|
|
4668
5420
|
className: cn(
|
|
4669
5421
|
"block rounded-full bg-white shadow-sm",
|
|
4670
|
-
"transition-transform duration-200",
|
|
4671
|
-
"translate-x-0.5",
|
|
4672
5422
|
sizeClasses2.thumb
|
|
4673
5423
|
),
|
|
4674
5424
|
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 +5634,7 @@ function resolveResponsive(value) {
|
|
|
4884
5634
|
}
|
|
4885
5635
|
return void 0;
|
|
4886
5636
|
}
|
|
4887
|
-
var TableRoot =
|
|
5637
|
+
var TableRoot = React33.forwardRef(
|
|
4888
5638
|
function TableRoot2(props, ref) {
|
|
4889
5639
|
const { className, style: styleProp, children, ...other } = props;
|
|
4890
5640
|
const rawMinW = other.minWidth ?? other.minW;
|
|
@@ -4907,7 +5657,7 @@ var TableRoot = React30.forwardRef(
|
|
|
4907
5657
|
);
|
|
4908
5658
|
}
|
|
4909
5659
|
);
|
|
4910
|
-
var TableHeader =
|
|
5660
|
+
var TableHeader = React33.forwardRef(
|
|
4911
5661
|
function TableHeader2(props, ref) {
|
|
4912
5662
|
const { className, style: styleProp, children, ...other } = props;
|
|
4913
5663
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4924,7 +5674,7 @@ var TableHeader = React30.forwardRef(
|
|
|
4924
5674
|
);
|
|
4925
5675
|
}
|
|
4926
5676
|
);
|
|
4927
|
-
var TableBody =
|
|
5677
|
+
var TableBody = React33.forwardRef(
|
|
4928
5678
|
function TableBody2(props, ref) {
|
|
4929
5679
|
const { className, style: styleProp, children, ...other } = props;
|
|
4930
5680
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4941,7 +5691,7 @@ var TableBody = React30.forwardRef(
|
|
|
4941
5691
|
);
|
|
4942
5692
|
}
|
|
4943
5693
|
);
|
|
4944
|
-
var TableRow =
|
|
5694
|
+
var TableRow = React33.forwardRef(
|
|
4945
5695
|
function TableRow2(props, ref) {
|
|
4946
5696
|
const { className, style: styleProp, children, ...other } = props;
|
|
4947
5697
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4958,7 +5708,7 @@ var TableRow = React30.forwardRef(
|
|
|
4958
5708
|
);
|
|
4959
5709
|
}
|
|
4960
5710
|
);
|
|
4961
|
-
var TableCell =
|
|
5711
|
+
var TableCell = React33.forwardRef(
|
|
4962
5712
|
function TableCell2(props, ref) {
|
|
4963
5713
|
const { isNumeric, className, style: styleProp, children, ...other } = props;
|
|
4964
5714
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4979,7 +5729,7 @@ var TableCell = React30.forwardRef(
|
|
|
4979
5729
|
);
|
|
4980
5730
|
}
|
|
4981
5731
|
);
|
|
4982
|
-
var TableColumnHeader =
|
|
5732
|
+
var TableColumnHeader = React33.forwardRef(
|
|
4983
5733
|
function TableColumnHeader2(props, ref) {
|
|
4984
5734
|
const { isNumeric, className, style: styleProp, children, ...other } = props;
|
|
4985
5735
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5006,7 +5756,7 @@ var TableColumnHeader = React30.forwardRef(
|
|
|
5006
5756
|
);
|
|
5007
5757
|
var TableColumnHeaderSortable = (props) => {
|
|
5008
5758
|
const { sortField, sortValue, onSortToggle, children, disabled, indicatorPosition = "left", contentAfter, ...rest } = props;
|
|
5009
|
-
const handleSortToggle =
|
|
5759
|
+
const handleSortToggle = React33.useCallback(() => {
|
|
5010
5760
|
onSortToggle(sortField);
|
|
5011
5761
|
}, [onSortToggle, sortField]);
|
|
5012
5762
|
const isActive = sortValue.includes(sortField);
|
|
@@ -5032,16 +5782,16 @@ var TableColumnHeaderSortable = (props) => {
|
|
|
5032
5782
|
var ACTION_BAR_SHADOW = "0 4px 4px -4px rgb(0 0 0 / 10%), 0 2px 4px -4px rgb(0 0 0 / 6%)";
|
|
5033
5783
|
var TableHeaderSticky = (props) => {
|
|
5034
5784
|
const { top, children, className, style: styleProp, ...rest } = props;
|
|
5035
|
-
const ref =
|
|
5036
|
-
const [isStuck, setIsStuck] =
|
|
5037
|
-
const handleScroll =
|
|
5785
|
+
const ref = React33.useRef(null);
|
|
5786
|
+
const [isStuck, setIsStuck] = React33.useState(false);
|
|
5787
|
+
const handleScroll = React33.useCallback(() => {
|
|
5038
5788
|
if (Number(ref.current?.getBoundingClientRect().y) <= (Number(top) || 0)) {
|
|
5039
5789
|
setIsStuck(true);
|
|
5040
5790
|
} else {
|
|
5041
5791
|
setIsStuck(false);
|
|
5042
5792
|
}
|
|
5043
5793
|
}, [top]);
|
|
5044
|
-
|
|
5794
|
+
React33.useEffect(() => {
|
|
5045
5795
|
const throttledHandleScroll = throttle(handleScroll, 300);
|
|
5046
5796
|
window.addEventListener("scroll", throttledHandleScroll);
|
|
5047
5797
|
return () => {
|
|
@@ -5063,7 +5813,7 @@ var TableHeaderSticky = (props) => {
|
|
|
5063
5813
|
}
|
|
5064
5814
|
);
|
|
5065
5815
|
};
|
|
5066
|
-
var TableCaption =
|
|
5816
|
+
var TableCaption = React33.forwardRef(
|
|
5067
5817
|
function TableCaption2(props, ref) {
|
|
5068
5818
|
const { className, style: styleProp, children, ...other } = props;
|
|
5069
5819
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5080,7 +5830,7 @@ var TableCaption = React30.forwardRef(
|
|
|
5080
5830
|
);
|
|
5081
5831
|
}
|
|
5082
5832
|
);
|
|
5083
|
-
var TableFooter =
|
|
5833
|
+
var TableFooter = React33.forwardRef(
|
|
5084
5834
|
function TableFooter2(props, ref) {
|
|
5085
5835
|
const { className, style: styleProp, children, ...other } = props;
|
|
5086
5836
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5097,7 +5847,7 @@ var TableFooter = React30.forwardRef(
|
|
|
5097
5847
|
);
|
|
5098
5848
|
}
|
|
5099
5849
|
);
|
|
5100
|
-
var TableScrollWrapper =
|
|
5850
|
+
var TableScrollWrapper = React33.forwardRef(
|
|
5101
5851
|
function TableScrollWrapper2(props, ref) {
|
|
5102
5852
|
const { className, children, ...rest } = props;
|
|
5103
5853
|
return /* @__PURE__ */ jsx(
|
|
@@ -5116,7 +5866,7 @@ var ROOT_SIZE_CLASSES = {
|
|
|
5116
5866
|
md: "[--tabs-height:2.5rem] [--tabs-content-padding:1.5rem]",
|
|
5117
5867
|
free: ""
|
|
5118
5868
|
};
|
|
5119
|
-
var TabsRoot =
|
|
5869
|
+
var TabsRoot = React33.forwardRef(
|
|
5120
5870
|
function TabsRoot2(props, ref) {
|
|
5121
5871
|
const {
|
|
5122
5872
|
variant = "solid",
|
|
@@ -5128,7 +5878,7 @@ var TabsRoot = React30.forwardRef(
|
|
|
5128
5878
|
className,
|
|
5129
5879
|
...rest
|
|
5130
5880
|
} = props;
|
|
5131
|
-
const handleValueChange =
|
|
5881
|
+
const handleValueChange = React33.useCallback(
|
|
5132
5882
|
(value) => {
|
|
5133
5883
|
if (!onValueChange) return;
|
|
5134
5884
|
onValueChange({ value });
|
|
@@ -5153,7 +5903,7 @@ var TabsRoot = React30.forwardRef(
|
|
|
5153
5903
|
);
|
|
5154
5904
|
}
|
|
5155
5905
|
);
|
|
5156
|
-
var TabsList =
|
|
5906
|
+
var TabsList = React33.forwardRef(
|
|
5157
5907
|
function TabsList2(props, ref) {
|
|
5158
5908
|
const {
|
|
5159
5909
|
className,
|
|
@@ -5207,7 +5957,7 @@ var TRIGGER_VARIANT_CLASSES = {
|
|
|
5207
5957
|
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
5958
|
unstyled: ""
|
|
5209
5959
|
};
|
|
5210
|
-
var TabsTrigger =
|
|
5960
|
+
var TabsTrigger = React33.forwardRef(
|
|
5211
5961
|
function TabsTrigger2(props, ref) {
|
|
5212
5962
|
const {
|
|
5213
5963
|
className,
|
|
@@ -5227,7 +5977,7 @@ var TabsTrigger = React30.forwardRef(
|
|
|
5227
5977
|
visibility: _visibility,
|
|
5228
5978
|
...rest
|
|
5229
5979
|
} = props;
|
|
5230
|
-
const internalRef =
|
|
5980
|
+
const internalRef = React33.useRef(null);
|
|
5231
5981
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
5232
5982
|
const { variant, size, fitted } = useTabsContext(internalRef);
|
|
5233
5983
|
return /* @__PURE__ */ jsx(
|
|
@@ -5247,7 +5997,7 @@ var TabsTrigger = React30.forwardRef(
|
|
|
5247
5997
|
);
|
|
5248
5998
|
}
|
|
5249
5999
|
);
|
|
5250
|
-
var TabsContent =
|
|
6000
|
+
var TabsContent = React33.forwardRef(
|
|
5251
6001
|
function TabsContent2(props, ref) {
|
|
5252
6002
|
const { className, padding: _padding, ...rest } = props;
|
|
5253
6003
|
return /* @__PURE__ */ jsx(
|
|
@@ -5281,8 +6031,8 @@ var TabsCounter = ({ count }) => {
|
|
|
5281
6031
|
);
|
|
5282
6032
|
};
|
|
5283
6033
|
function useTabsContext(triggerRef) {
|
|
5284
|
-
const [ctx, setCtx] =
|
|
5285
|
-
|
|
6034
|
+
const [ctx, setCtx] = React33.useState({ variant: "solid", size: "md", fitted: false });
|
|
6035
|
+
React33.useEffect(() => {
|
|
5286
6036
|
const el = triggerRef.current;
|
|
5287
6037
|
if (!el) return;
|
|
5288
6038
|
const root = el.closest("[data-variant]");
|
|
@@ -5296,7 +6046,7 @@ function useTabsContext(triggerRef) {
|
|
|
5296
6046
|
return ctx;
|
|
5297
6047
|
}
|
|
5298
6048
|
function useMergedRef(...refs) {
|
|
5299
|
-
return
|
|
6049
|
+
return React33.useCallback(
|
|
5300
6050
|
(instance) => {
|
|
5301
6051
|
for (const ref of refs) {
|
|
5302
6052
|
if (!ref) continue;
|
|
@@ -5334,7 +6084,7 @@ var TAG_SELECTED_CLASSES = [
|
|
|
5334
6084
|
"hover:opacity-76"
|
|
5335
6085
|
].join(" ");
|
|
5336
6086
|
var TAG_DISABLED_CLASSES = "opacity-40 pointer-events-none cursor-not-allowed";
|
|
5337
|
-
var Tag =
|
|
6087
|
+
var Tag = React33.forwardRef(
|
|
5338
6088
|
function Tag2(props, ref) {
|
|
5339
6089
|
const {
|
|
5340
6090
|
variant,
|
|
@@ -5421,9 +6171,9 @@ var TEXTAREA_VARIANT_CLASSES = {
|
|
|
5421
6171
|
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
5422
6172
|
unstyled: "border-0 bg-transparent p-0"
|
|
5423
6173
|
};
|
|
5424
|
-
var Textarea =
|
|
6174
|
+
var Textarea = React33__default.forwardRef(
|
|
5425
6175
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
5426
|
-
const handleChange =
|
|
6176
|
+
const handleChange = React33__default.useCallback(
|
|
5427
6177
|
(event) => {
|
|
5428
6178
|
onChange?.(event);
|
|
5429
6179
|
onChangeText?.(event.target.value);
|
|
@@ -5431,9 +6181,10 @@ var Textarea = React30__default.forwardRef(
|
|
|
5431
6181
|
[onChange, onChangeText]
|
|
5432
6182
|
);
|
|
5433
6183
|
return /* @__PURE__ */ jsx(
|
|
5434
|
-
|
|
6184
|
+
TextArea,
|
|
5435
6185
|
{
|
|
5436
6186
|
ref,
|
|
6187
|
+
unstyled: true,
|
|
5437
6188
|
className: cn(TEXTAREA_BASE, TEXTAREA_SIZE_CLASSES[size], TEXTAREA_VARIANT_CLASSES[variant], className),
|
|
5438
6189
|
...rest,
|
|
5439
6190
|
onChange: handleChange
|
|
@@ -5565,7 +6316,7 @@ function QuoteCell({ value, highlight, align = "right", onClick, className }) {
|
|
|
5565
6316
|
}
|
|
5566
6317
|
var CALL_HEADERS = ["Bid", "Ask", "Last", "Vol", "OI", "IV", "Delta"];
|
|
5567
6318
|
var PUT_HEADERS = ["Delta", "IV", "OI", "Vol", "Last", "Ask", "Bid"];
|
|
5568
|
-
var OptionChain =
|
|
6319
|
+
var OptionChain = React33.forwardRef(
|
|
5569
6320
|
function OptionChain2(props, ref) {
|
|
5570
6321
|
const {
|
|
5571
6322
|
symbol: _symbol,
|
|
@@ -5576,7 +6327,7 @@ var OptionChain = React30.forwardRef(
|
|
|
5576
6327
|
className,
|
|
5577
6328
|
...rest
|
|
5578
6329
|
} = props;
|
|
5579
|
-
const handleClick =
|
|
6330
|
+
const handleClick = React33.useCallback(
|
|
5580
6331
|
(quote, type, strike) => {
|
|
5581
6332
|
if (!quote || !onSelectContract) return;
|
|
5582
6333
|
onSelectContract({
|
|
@@ -5682,7 +6433,7 @@ var OptionChain = React30.forwardRef(
|
|
|
5682
6433
|
{
|
|
5683
6434
|
className: cn(
|
|
5684
6435
|
"px-2 py-1 text-center font-mono tabular-nums text-xs font-semibold",
|
|
5685
|
-
isATM ? "text-
|
|
6436
|
+
isATM ? "text-[var(--foreground)] bg-[var(--secondary)]" : "text-[var(--muted-foreground)]"
|
|
5686
6437
|
),
|
|
5687
6438
|
children: fmt(row.strike)
|
|
5688
6439
|
}
|
|
@@ -5721,12 +6472,12 @@ var OptionChain = React30.forwardRef(
|
|
|
5721
6472
|
}
|
|
5722
6473
|
);
|
|
5723
6474
|
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-
|
|
6475
|
+
{ key: "delta", label: "Delta", symbol: "\u0394", color: "text-[var(--foreground)]", barColor: "bg-[var(--foreground)]", decimals: 4, maxMagnitude: 1 },
|
|
6476
|
+
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "text-[var(--chart-1)]", barColor: "bg-[var(--chart-1)]", decimals: 4, maxMagnitude: 0.1 },
|
|
6477
|
+
{ key: "theta", label: "Theta", symbol: "\u0398", color: "text-[var(--chart-4)]", barColor: "bg-[var(--chart-4)]", decimals: 4, maxMagnitude: 1 },
|
|
6478
|
+
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "text-[var(--chart-2)]", barColor: "bg-[var(--chart-2)]", decimals: 4, maxMagnitude: 1 },
|
|
6479
|
+
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "text-[var(--chart-3)]", barColor: "bg-[var(--chart-3)]", decimals: 4, maxMagnitude: 1 },
|
|
6480
|
+
{ key: "iv", label: "IV", symbol: "\u03C3", color: "text-[var(--chart-5)]", barColor: "bg-[var(--chart-5)]", decimals: 1, maxMagnitude: 100 }
|
|
5730
6481
|
];
|
|
5731
6482
|
function GreekItem({ def, value, compact }) {
|
|
5732
6483
|
const magnitude = Math.min(Math.abs(value) / def.maxMagnitude, 1);
|
|
@@ -5756,7 +6507,7 @@ function GreekItem({ def, value, compact }) {
|
|
|
5756
6507
|
}
|
|
5757
6508
|
);
|
|
5758
6509
|
}
|
|
5759
|
-
var GreeksDisplay =
|
|
6510
|
+
var GreeksDisplay = React33.forwardRef(
|
|
5760
6511
|
function GreeksDisplay2(props, ref) {
|
|
5761
6512
|
const {
|
|
5762
6513
|
delta,
|
|
@@ -5933,7 +6684,8 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
5933
6684
|
type: "button",
|
|
5934
6685
|
className: cn(
|
|
5935
6686
|
"px-2 py-0.5 rounded text-xs font-medium transition-colors",
|
|
5936
|
-
|
|
6687
|
+
// Call vs put is a rank difference, not a hue difference.
|
|
6688
|
+
leg.type === "call" ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
|
|
5937
6689
|
),
|
|
5938
6690
|
onClick: () => update2({ type: leg.type === "call" ? "put" : "call" }),
|
|
5939
6691
|
children: leg.type === "call" ? "CALL" : "PUT"
|
|
@@ -5987,7 +6739,7 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
5987
6739
|
)
|
|
5988
6740
|
] });
|
|
5989
6741
|
}
|
|
5990
|
-
var StrategyBuilder =
|
|
6742
|
+
var StrategyBuilder = React33.forwardRef(
|
|
5991
6743
|
function StrategyBuilder2(props, ref) {
|
|
5992
6744
|
const {
|
|
5993
6745
|
underlying,
|
|
@@ -5999,12 +6751,12 @@ var StrategyBuilder = React30.forwardRef(
|
|
|
5999
6751
|
...rest
|
|
6000
6752
|
} = props;
|
|
6001
6753
|
const defaultExp = expirations[0] ?? "";
|
|
6002
|
-
const [strategyType, setStrategyType] =
|
|
6003
|
-
const [legs, setLegs] =
|
|
6754
|
+
const [strategyType, setStrategyType] = React33.useState("bull_call_spread");
|
|
6755
|
+
const [legs, setLegs] = React33.useState(() => {
|
|
6004
6756
|
const preset = STRATEGY_PRESETS.find((p) => p.value === "bull_call_spread");
|
|
6005
6757
|
return preset ? preset.buildLegs(strikes, spotPrice, defaultExp) : [];
|
|
6006
6758
|
});
|
|
6007
|
-
const handleStrategyChange =
|
|
6759
|
+
const handleStrategyChange = React33.useCallback(
|
|
6008
6760
|
(e) => {
|
|
6009
6761
|
const type = e.target.value;
|
|
6010
6762
|
setStrategyType(type);
|
|
@@ -6015,7 +6767,7 @@ var StrategyBuilder = React30.forwardRef(
|
|
|
6015
6767
|
},
|
|
6016
6768
|
[strikes, spotPrice, defaultExp]
|
|
6017
6769
|
);
|
|
6018
|
-
const handleLegChange =
|
|
6770
|
+
const handleLegChange = React33.useCallback(
|
|
6019
6771
|
(index, leg) => {
|
|
6020
6772
|
setLegs((prev) => {
|
|
6021
6773
|
const next = [...prev];
|
|
@@ -6025,13 +6777,13 @@ var StrategyBuilder = React30.forwardRef(
|
|
|
6025
6777
|
},
|
|
6026
6778
|
[]
|
|
6027
6779
|
);
|
|
6028
|
-
const handleLegRemove =
|
|
6780
|
+
const handleLegRemove = React33.useCallback(
|
|
6029
6781
|
(index) => {
|
|
6030
6782
|
setLegs((prev) => prev.filter((_, i) => i !== index));
|
|
6031
6783
|
},
|
|
6032
6784
|
[]
|
|
6033
6785
|
);
|
|
6034
|
-
const handleAddLeg =
|
|
6786
|
+
const handleAddLeg = React33.useCallback(() => {
|
|
6035
6787
|
if (legs.length >= 4) return;
|
|
6036
6788
|
const atm = findATM(strikes, spotPrice);
|
|
6037
6789
|
setLegs((prev) => [
|
|
@@ -6039,14 +6791,14 @@ var StrategyBuilder = React30.forwardRef(
|
|
|
6039
6791
|
{ action: "buy", type: "call", strike: atm, expiration: defaultExp, quantity: 1 }
|
|
6040
6792
|
]);
|
|
6041
6793
|
}, [legs.length, strikes, spotPrice, defaultExp]);
|
|
6042
|
-
const netPremium =
|
|
6794
|
+
const netPremium = React33.useMemo(() => {
|
|
6043
6795
|
return legs.reduce((sum, leg) => {
|
|
6044
6796
|
if (leg.premium === void 0) return sum;
|
|
6045
6797
|
const sign = leg.action === "buy" ? -1 : 1;
|
|
6046
6798
|
return sum + sign * leg.premium * leg.quantity;
|
|
6047
6799
|
}, 0);
|
|
6048
6800
|
}, [legs]);
|
|
6049
|
-
const handleSubmit =
|
|
6801
|
+
const handleSubmit = React33.useCallback(() => {
|
|
6050
6802
|
if (!onSubmit || legs.length === 0) return;
|
|
6051
6803
|
onSubmit({
|
|
6052
6804
|
type: strategyType,
|
|
@@ -6166,8 +6918,10 @@ function buildPath(points, vb, width, height) {
|
|
|
6166
6918
|
});
|
|
6167
6919
|
return parts.join(" ");
|
|
6168
6920
|
}
|
|
6169
|
-
var LEG_COLORS = ["
|
|
6170
|
-
var
|
|
6921
|
+
var LEG_COLORS = ["var(--chart-1)", "var(--chart-2)", "var(--chart-3)", "var(--chart-4)"];
|
|
6922
|
+
var BREAKEVEN_COLOR = "var(--chart-1)";
|
|
6923
|
+
var BREAKEVEN_RING = "var(--background)";
|
|
6924
|
+
var PnlDiagram = React33.forwardRef(
|
|
6171
6925
|
function PnlDiagram2(props, ref) {
|
|
6172
6926
|
const {
|
|
6173
6927
|
legs,
|
|
@@ -6176,10 +6930,10 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6176
6930
|
className,
|
|
6177
6931
|
...rest
|
|
6178
6932
|
} = props;
|
|
6179
|
-
const containerRef =
|
|
6180
|
-
const [hoverX, setHoverX] =
|
|
6181
|
-
const [dims, setDims] =
|
|
6182
|
-
|
|
6933
|
+
const containerRef = React33.useRef(null);
|
|
6934
|
+
const [hoverX, setHoverX] = React33.useState(null);
|
|
6935
|
+
const [dims, setDims] = React33.useState({ width: 600, height: 240 });
|
|
6936
|
+
React33.useEffect(() => {
|
|
6183
6937
|
const el = containerRef.current;
|
|
6184
6938
|
if (!el) return;
|
|
6185
6939
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -6202,7 +6956,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6202
6956
|
const xMax = maxStrike + range * 0.3;
|
|
6203
6957
|
const SAMPLES = 200;
|
|
6204
6958
|
const step = (xMax - xMin) / SAMPLES;
|
|
6205
|
-
const combinedPoints =
|
|
6959
|
+
const combinedPoints = React33.useMemo(() => {
|
|
6206
6960
|
const pts = [];
|
|
6207
6961
|
for (let i = 0; i <= SAMPLES; i++) {
|
|
6208
6962
|
const price = xMin + i * step;
|
|
@@ -6210,7 +6964,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6210
6964
|
}
|
|
6211
6965
|
return pts;
|
|
6212
6966
|
}, [legs, multiplier, xMin, step]);
|
|
6213
|
-
const legPointSets =
|
|
6967
|
+
const legPointSets = React33.useMemo(() => {
|
|
6214
6968
|
return legs.map((leg) => {
|
|
6215
6969
|
const pts = [];
|
|
6216
6970
|
for (let i = 0; i <= SAMPLES; i++) {
|
|
@@ -6231,7 +6985,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6231
6985
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6232
6986
|
const scaleX = (x) => PADDING.left + (x - vb.xMin) / (vb.xMax - vb.xMin) * chartW;
|
|
6233
6987
|
const scaleY = (y) => PADDING.top + chartH - (y - vb.yMin) / (vb.yMax - vb.yMin) * chartH;
|
|
6234
|
-
const breakevens =
|
|
6988
|
+
const breakevens = React33.useMemo(() => {
|
|
6235
6989
|
const pts = [];
|
|
6236
6990
|
for (let i = 1; i < combinedPoints.length; i++) {
|
|
6237
6991
|
const prev = combinedPoints[i - 1];
|
|
@@ -6248,7 +7002,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6248
7002
|
const maxGainPoint = combinedPoints.find((p) => p.y === maxGain);
|
|
6249
7003
|
const maxLossPoint = combinedPoints.find((p) => p.y === maxLoss);
|
|
6250
7004
|
const zeroY = scaleY(0);
|
|
6251
|
-
const handleMouseMove =
|
|
7005
|
+
const handleMouseMove = React33.useCallback(
|
|
6252
7006
|
(e) => {
|
|
6253
7007
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
6254
7008
|
const mouseX = e.clientX - rect.left;
|
|
@@ -6261,7 +7015,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6261
7015
|
},
|
|
6262
7016
|
[vb.xMin, vb.xMax, chartW]
|
|
6263
7017
|
);
|
|
6264
|
-
const handleMouseLeave =
|
|
7018
|
+
const handleMouseLeave = React33.useCallback(() => setHoverX(null), []);
|
|
6265
7019
|
const hoverPnl = hoverX !== null ? calcTotalPnl(legs, hoverX, multiplier) : null;
|
|
6266
7020
|
buildPath(
|
|
6267
7021
|
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 +7162,13 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6408
7162
|
}
|
|
6409
7163
|
),
|
|
6410
7164
|
breakevens.map((be, i) => /* @__PURE__ */ jsxs("g", { children: [
|
|
6411
|
-
/* @__PURE__ */ jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill:
|
|
7165
|
+
/* @__PURE__ */ jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill: BREAKEVEN_COLOR, stroke: BREAKEVEN_RING, strokeWidth: "1" }),
|
|
6412
7166
|
/* @__PURE__ */ jsx(
|
|
6413
7167
|
"text",
|
|
6414
7168
|
{
|
|
6415
7169
|
x: scaleX(be),
|
|
6416
7170
|
y: PADDING.top + chartH + 14,
|
|
6417
|
-
fill:
|
|
7171
|
+
fill: BREAKEVEN_COLOR,
|
|
6418
7172
|
fontSize: "8",
|
|
6419
7173
|
fontFamily: "monospace",
|
|
6420
7174
|
textAnchor: "middle",
|
|
@@ -6455,7 +7209,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6455
7209
|
cy: scaleY(hoverPnl),
|
|
6456
7210
|
r: "3",
|
|
6457
7211
|
fill: hoverPnl >= 0 ? "#22c55e" : "#ef4444",
|
|
6458
|
-
stroke:
|
|
7212
|
+
stroke: BREAKEVEN_RING,
|
|
6459
7213
|
strokeWidth: "1"
|
|
6460
7214
|
}
|
|
6461
7215
|
),
|
|
@@ -6467,7 +7221,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6467
7221
|
width: "90",
|
|
6468
7222
|
height: "28",
|
|
6469
7223
|
rx: "3",
|
|
6470
|
-
fill:
|
|
7224
|
+
fill: BREAKEVEN_RING,
|
|
6471
7225
|
stroke: "#3f3f46",
|
|
6472
7226
|
strokeWidth: "1"
|
|
6473
7227
|
}
|
|
@@ -6549,7 +7303,7 @@ var PnlDiagram = React30.forwardRef(
|
|
|
6549
7303
|
] })
|
|
6550
7304
|
] }, i)),
|
|
6551
7305
|
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
|
|
7306
|
+
/* @__PURE__ */ jsx("div", { className: "h-1.5 w-1.5 rounded-full", style: { background: BREAKEVEN_COLOR } }),
|
|
6553
7307
|
/* @__PURE__ */ jsxs("span", { className: "text-[10px] text-zinc-500", children: [
|
|
6554
7308
|
"BE: ",
|
|
6555
7309
|
breakevens.map((b) => b.toFixed(1)).join(", ")
|
|
@@ -6565,7 +7319,7 @@ function formatDate(date) {
|
|
|
6565
7319
|
const d = new Date(date);
|
|
6566
7320
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
6567
7321
|
}
|
|
6568
|
-
var OptionPositionCard =
|
|
7322
|
+
var OptionPositionCard = React33.forwardRef(
|
|
6569
7323
|
function OptionPositionCard2(props, ref) {
|
|
6570
7324
|
const {
|
|
6571
7325
|
position,
|
|
@@ -6591,7 +7345,8 @@ var OptionPositionCard = React30.forwardRef(
|
|
|
6591
7345
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
6592
7346
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs("span", { className: cn(
|
|
6593
7347
|
"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-semibold",
|
|
6594
|
-
|
|
7348
|
+
// Call vs put is a rank difference, not a hue difference.
|
|
7349
|
+
isCall ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
|
|
6595
7350
|
), children: [
|
|
6596
7351
|
position.underlying,
|
|
6597
7352
|
/* @__PURE__ */ jsx("span", { className: "font-mono tabular-nums", children: position.strike }),
|
|
@@ -6717,8 +7472,9 @@ function ExpirationPill({ exp, isSelected, onClick }) {
|
|
|
6717
7472
|
/* @__PURE__ */ jsx("span", { className: "font-medium whitespace-nowrap", children: formatExpDate(exp.date) }),
|
|
6718
7473
|
/* @__PURE__ */ jsxs("span", { className: cn(
|
|
6719
7474
|
"font-mono tabular-nums text-[10px]",
|
|
6720
|
-
isSelected ? "text-
|
|
6721
|
-
|
|
7475
|
+
isSelected ? "text-[var(--foreground)]" : "text-[var(--muted-foreground)]",
|
|
7476
|
+
// Near expiry is a notice, and a notice in Lux is the loudest neutral.
|
|
7477
|
+
exp.dte <= 7 && !isSelected && "text-[var(--color-status-warn)]"
|
|
6722
7478
|
), children: [
|
|
6723
7479
|
exp.dte,
|
|
6724
7480
|
"d"
|
|
@@ -6727,7 +7483,7 @@ function ExpirationPill({ exp, isSelected, onClick }) {
|
|
|
6727
7483
|
}
|
|
6728
7484
|
);
|
|
6729
7485
|
}
|
|
6730
|
-
var ExpirationSelector =
|
|
7486
|
+
var ExpirationSelector = React33.forwardRef(
|
|
6731
7487
|
function ExpirationSelector2(props, ref) {
|
|
6732
7488
|
const {
|
|
6733
7489
|
expirations,
|
|
@@ -6737,8 +7493,8 @@ var ExpirationSelector = React30.forwardRef(
|
|
|
6737
7493
|
className,
|
|
6738
7494
|
...rest
|
|
6739
7495
|
} = props;
|
|
6740
|
-
const scrollRef =
|
|
6741
|
-
|
|
7496
|
+
const scrollRef = React33.useRef(null);
|
|
7497
|
+
React33.useEffect(() => {
|
|
6742
7498
|
const container = scrollRef.current;
|
|
6743
7499
|
if (!container) return;
|
|
6744
7500
|
const selectedEl = container.querySelector('[data-selected="true"]');
|
|
@@ -7050,4 +7806,4 @@ var BankPage = styled(View, {
|
|
|
7050
7806
|
padding: 16
|
|
7051
7807
|
});
|
|
7052
7808
|
|
|
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,
|
|
7809
|
+
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 };
|