@luxfi/ui 7.3.2 → 7.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alert.cjs +2 -2
- package/dist/alert.js +1 -1
- package/dist/avatar.cjs +7 -6
- package/dist/avatar.js +7 -5
- package/dist/badge.cjs +36 -38
- package/dist/badge.js +31 -33
- package/dist/bank.cjs +13 -13
- package/dist/bank.d.cts +31 -24
- package/dist/bank.d.ts +31 -24
- package/dist/bank.js +1 -1
- package/dist/button.cjs +3 -3
- package/dist/button.js +1 -1
- package/dist/checkbox.cjs +4 -4
- package/dist/checkbox.d.cts +3 -2
- package/dist/checkbox.d.ts +3 -2
- package/dist/checkbox.js +5 -4
- package/dist/chrome.cjs +950 -0
- package/dist/chrome.d.cts +93 -0
- package/dist/chrome.d.ts +93 -0
- package/dist/chrome.js +921 -0
- package/dist/close-button.cjs +2 -2
- package/dist/close-button.js +1 -1
- package/dist/dialog.cjs +13 -14
- package/dist/dialog.d.cts +58 -5
- package/dist/dialog.d.ts +58 -5
- package/dist/dialog.js +1 -2
- package/dist/drawer.cjs +87 -21
- package/dist/drawer.js +85 -19
- package/dist/expiration-selector.cjs +3 -2
- package/dist/expiration-selector.js +3 -2
- package/dist/greeks-display.cjs +6 -6
- package/dist/greeks-display.js +6 -6
- package/dist/gui.cjs +13 -0
- package/dist/gui.d.cts +2 -0
- package/dist/gui.d.ts +2 -0
- package/dist/gui.js +2 -0
- package/dist/heading.cjs +4 -2
- package/dist/heading.js +4 -2
- package/dist/iam.cjs +206 -0
- package/dist/iam.d.cts +65 -0
- package/dist/iam.d.ts +65 -0
- package/dist/iam.js +201 -0
- package/dist/icon-button.cjs +2 -2
- package/dist/icon-button.js +1 -1
- package/dist/icons.cjs +13 -0
- package/dist/icons.d.cts +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/identity.cjs +420 -0
- package/dist/identity.d.cts +64 -0
- package/dist/identity.d.ts +64 -0
- package/dist/identity.js +398 -0
- package/dist/index.cjs +1699 -860
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +1618 -802
- package/dist/input.cjs +13 -3
- package/dist/input.d.cts +6 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.js +13 -3
- package/dist/lux.config.cjs +77 -0
- package/dist/lux.config.d.cts +433 -0
- package/dist/lux.config.d.ts +433 -0
- package/dist/lux.config.js +69 -0
- package/dist/menu.cjs +4 -4
- package/dist/menu.js +4 -4
- package/dist/next.cjs +99 -0
- package/dist/next.d.cts +29 -0
- package/dist/next.d.ts +29 -0
- package/dist/next.js +96 -0
- package/dist/option-chain.cjs +1 -1
- package/dist/option-chain.js +1 -1
- package/dist/option-position.cjs +2 -1
- package/dist/option-position.js +2 -1
- package/dist/pnl-diagram.cjs +8 -6
- package/dist/pnl-diagram.js +8 -6
- package/dist/popover.cjs +8 -9
- package/dist/popover.js +1 -2
- package/dist/progress.cjs +7 -6
- package/dist/progress.js +7 -5
- package/dist/provider.cjs +199 -5
- package/dist/provider.d.cts +16 -3
- package/dist/provider.d.ts +16 -3
- package/dist/provider.js +195 -6
- 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 +38 -41
- package/dist/tag.js +31 -34
- package/dist/textarea.cjs +13 -3
- package/dist/textarea.d.cts +2 -0
- package/dist/textarea.d.ts +2 -0
- package/dist/textarea.js +13 -3
- package/dist/tooltip.cjs +31 -33
- package/dist/tooltip.js +25 -27
- package/dist/use-narrow.cjs +46 -0
- package/dist/use-narrow.d.cts +12 -0
- package/dist/use-narrow.d.ts +12 -0
- package/dist/use-narrow.js +20 -0
- package/dist/vite.cjs +40 -0
- package/dist/vite.d.cts +29 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.js +38 -0
- package/dist/white-label.cjs +132 -0
- package/dist/white-label.d.cts +59 -0
- package/dist/white-label.d.ts +59 -0
- package/dist/white-label.js +124 -0
- package/package.json +95 -17
- package/src/avatar.tsx +22 -16
- package/src/bank.tsx +2 -2
- package/src/button.tsx +1 -1
- package/src/checkbox.tsx +15 -10
- package/src/chrome.tsx +459 -0
- package/src/close-button.tsx +1 -1
- package/src/dialog.tsx +1 -1
- package/src/drawer.tsx +83 -10
- package/src/expiration-selector.tsx +3 -2
- package/src/greeks-display.tsx +9 -6
- package/src/gui.ts +17 -0
- package/src/heading.tsx +12 -8
- package/src/iam.ts +170 -0
- package/src/icon-button.tsx +1 -1
- package/src/icons.ts +18 -0
- package/src/identity.tsx +318 -0
- package/src/index.ts +50 -1
- package/src/input.tsx +24 -4
- package/src/lux.config.ts +82 -0
- package/src/menu.tsx +4 -4
- package/src/next.ts +142 -0
- package/src/option-chain.tsx +1 -1
- package/src/option-position.tsx +2 -1
- package/src/pnl-diagram.tsx +11 -6
- package/src/popover.tsx +1 -1
- package/src/progress.tsx +15 -8
- package/src/provider.tsx +92 -12
- 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 +18 -4
- package/src/tooltip.tsx +4 -23
- package/src/use-narrow.ts +40 -0
- package/src/vite.ts +78 -0
- package/src/white-label.ts +240 -0
- package/tokens.css +544 -319
- package/src/tokens.css +0 -438
package/dist/index.cjs
CHANGED
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var gui = require('@hanzo/gui');
|
|
5
5
|
var reactQuery = require('@tanstack/react-query');
|
|
6
|
+
var React33 = require('react');
|
|
7
|
+
var v5 = require('@hanzogui/config/v5');
|
|
8
|
+
var v5Css = require('@hanzogui/config/v5-css');
|
|
6
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
10
|
var clsx = require('clsx');
|
|
8
11
|
var tailwindMerge = require('tailwind-merge');
|
|
12
|
+
var lucideReact = require('lucide-react');
|
|
13
|
+
var RadixDialog = require('@radix-ui/react-dialog');
|
|
14
|
+
var DropdownMenu = require('@radix-ui/react-dropdown-menu');
|
|
9
15
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
10
|
-
var React29 = require('react');
|
|
11
|
-
var RadixAvatar = require('@radix-ui/react-avatar');
|
|
12
|
-
var tooltip = require('@hanzogui/tooltip');
|
|
13
16
|
var usehooks = require('@uidotdev/usehooks');
|
|
14
|
-
var RadixCheckbox = require('@radix-ui/react-checkbox');
|
|
15
17
|
var Collapsible = require('@radix-ui/react-collapsible');
|
|
16
|
-
var dialog = require('@hanzogui/dialog');
|
|
17
|
-
var RadixDialog = require('@radix-ui/react-dialog');
|
|
18
18
|
var LabelPrimitive = require('@radix-ui/react-label');
|
|
19
19
|
var esToolkit = require('es-toolkit');
|
|
20
|
-
var DropdownMenu = require('@radix-ui/react-dropdown-menu');
|
|
21
|
-
var lu = require('react-icons/lu');
|
|
22
|
-
var popover = require('@hanzogui/popover');
|
|
23
|
-
var RadixProgress = require('@radix-ui/react-progress');
|
|
24
|
-
var RadixRadioGroup = require('@radix-ui/react-radio-group');
|
|
25
20
|
var RadixSelect = require('@radix-ui/react-select');
|
|
26
|
-
var RadixSlider = require('@radix-ui/react-slider');
|
|
27
|
-
var RadixSwitch = require('@radix-ui/react-switch');
|
|
28
21
|
var RadixTabs = require('@radix-ui/react-tabs');
|
|
29
22
|
var sonner = require('sonner');
|
|
30
23
|
|
|
@@ -42,40 +35,1267 @@ function _interopNamespace(e) {
|
|
|
42
35
|
}
|
|
43
36
|
});
|
|
44
37
|
}
|
|
45
|
-
n.default = e;
|
|
46
|
-
return Object.freeze(n);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var Collapsible__namespace = /*#__PURE__*/_interopNamespace(Collapsible);
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var
|
|
72
|
-
|
|
38
|
+
n.default = e;
|
|
39
|
+
return Object.freeze(n);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var React33__namespace = /*#__PURE__*/_interopNamespace(React33);
|
|
43
|
+
var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
|
|
44
|
+
var DropdownMenu__namespace = /*#__PURE__*/_interopNamespace(DropdownMenu);
|
|
45
|
+
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
46
|
+
var Collapsible__namespace = /*#__PURE__*/_interopNamespace(Collapsible);
|
|
47
|
+
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
48
|
+
var RadixSelect__namespace = /*#__PURE__*/_interopNamespace(RadixSelect);
|
|
49
|
+
var RadixTabs__namespace = /*#__PURE__*/_interopNamespace(RadixTabs);
|
|
50
|
+
|
|
51
|
+
// src/provider.tsx
|
|
52
|
+
|
|
53
|
+
// src/white-label.ts
|
|
54
|
+
var LUX_BRAND = {
|
|
55
|
+
lux: "#7000FF",
|
|
56
|
+
zoo: "#6C5EFB",
|
|
57
|
+
hanzo: "#EA580C",
|
|
58
|
+
pars: "#1C3879",
|
|
59
|
+
// bootno.de is its own white label with its own IdP (id.bootno.de) — accent
|
|
60
|
+
// taken from the bootnode console's own brand default, not invented here.
|
|
61
|
+
bootnode: "#3B82F6"
|
|
62
|
+
};
|
|
63
|
+
var PARS_GOLD = "#C8A45C";
|
|
64
|
+
var ORGS = {
|
|
65
|
+
lux: {
|
|
66
|
+
org: "lux",
|
|
67
|
+
name: "Lux",
|
|
68
|
+
domain: "lux.network",
|
|
69
|
+
iamDomain: "lux.id",
|
|
70
|
+
accent: LUX_BRAND.lux,
|
|
71
|
+
accentForeground: "#FFFFFF"
|
|
72
|
+
},
|
|
73
|
+
zoo: {
|
|
74
|
+
org: "zoo",
|
|
75
|
+
name: "Zoo",
|
|
76
|
+
domain: "zoo.ngo",
|
|
77
|
+
// Zoo's IdP is `id.zoo.network`, not a `zoo.id` apex — the one row in this
|
|
78
|
+
// table where the issuer is not `<org>.id`, and the one every hand-rolled
|
|
79
|
+
// per-app branding map got wrong.
|
|
80
|
+
iamDomain: "id.zoo.network",
|
|
81
|
+
accent: LUX_BRAND.zoo,
|
|
82
|
+
accentForeground: "#FFFFFF"
|
|
83
|
+
},
|
|
84
|
+
bootnode: {
|
|
85
|
+
org: "bootnode",
|
|
86
|
+
name: "Bootnode",
|
|
87
|
+
domain: "bootno.de",
|
|
88
|
+
iamDomain: "id.bootno.de",
|
|
89
|
+
accent: LUX_BRAND.lux,
|
|
90
|
+
accentForeground: "#FFFFFF"
|
|
91
|
+
},
|
|
92
|
+
hanzo: {
|
|
93
|
+
org: "hanzo",
|
|
94
|
+
name: "Hanzo",
|
|
95
|
+
domain: "hanzo.ai",
|
|
96
|
+
iamDomain: "hanzo.id",
|
|
97
|
+
accent: LUX_BRAND.hanzo,
|
|
98
|
+
accentForeground: "#FFFFFF"
|
|
99
|
+
},
|
|
100
|
+
pars: {
|
|
101
|
+
org: "pars",
|
|
102
|
+
name: "Pars",
|
|
103
|
+
domain: "pars.id",
|
|
104
|
+
iamDomain: "pars.id",
|
|
105
|
+
accent: LUX_BRAND.pars,
|
|
106
|
+
accentForeground: PARS_GOLD
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var DOMAIN_ORG = [
|
|
110
|
+
["lux.network", "lux"],
|
|
111
|
+
["lux.cloud", "lux"],
|
|
112
|
+
["lux.id", "lux"],
|
|
113
|
+
["lux.finance", "lux"],
|
|
114
|
+
["zoo.ngo", "zoo"],
|
|
115
|
+
["zoo.network", "zoo"],
|
|
116
|
+
["zoo.cloud", "zoo"],
|
|
117
|
+
["zoo.id", "zoo"],
|
|
118
|
+
["hanzo.ai", "hanzo"],
|
|
119
|
+
["hanzo.cloud", "hanzo"],
|
|
120
|
+
["hanzo.id", "hanzo"],
|
|
121
|
+
["pars.id", "pars"],
|
|
122
|
+
["parsdao.org", "pars"],
|
|
123
|
+
["bootno.de", "bootnode", "platform"]
|
|
124
|
+
];
|
|
125
|
+
var DEFAULT_ORG = "lux";
|
|
126
|
+
function normalizeHost(host) {
|
|
127
|
+
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
128
|
+
return noPort.replace(/\.$/, "");
|
|
129
|
+
}
|
|
130
|
+
function isUnder(host, domain) {
|
|
131
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
132
|
+
}
|
|
133
|
+
function matchDomain(host) {
|
|
134
|
+
let best;
|
|
135
|
+
for (const entry of DOMAIN_ORG) {
|
|
136
|
+
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
137
|
+
best = entry;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return best;
|
|
141
|
+
}
|
|
142
|
+
function appSlug(host, domain, apexApp) {
|
|
143
|
+
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
144
|
+
const leftmost = sub.split(".")[0] ?? "";
|
|
145
|
+
if (leftmost && leftmost !== "www") return leftmost;
|
|
146
|
+
if (apexApp) return apexApp;
|
|
147
|
+
const label = domain.split(".")[0] ?? "";
|
|
148
|
+
const tld = domain.split(".").slice(1).join(".");
|
|
149
|
+
return tld.split(".")[0] || label;
|
|
150
|
+
}
|
|
151
|
+
function isLocal(host) {
|
|
152
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
153
|
+
}
|
|
154
|
+
function resolveWhiteLabel(host) {
|
|
155
|
+
const h = normalizeHost(host ?? "");
|
|
156
|
+
const match = h ? matchDomain(h) : void 0;
|
|
157
|
+
const org = match ? match[1] : DEFAULT_ORG;
|
|
158
|
+
const identity = ORGS[org];
|
|
159
|
+
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
160
|
+
return {
|
|
161
|
+
...identity,
|
|
162
|
+
host: h,
|
|
163
|
+
app,
|
|
164
|
+
theme: `dark_${org}`,
|
|
165
|
+
issuer: `https://${identity.iamDomain}`,
|
|
166
|
+
clientId: `${org}-${app}`
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function currentHost() {
|
|
170
|
+
return typeof window === "undefined" ? "" : window.location.host;
|
|
171
|
+
}
|
|
172
|
+
function orgIdentity(org) {
|
|
173
|
+
return ORGS[org];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/lux.config.ts
|
|
177
|
+
var TRUE_BLACK = "#000000";
|
|
178
|
+
var darkBase = {
|
|
179
|
+
...v5.defaultConfig.themes.dark,
|
|
180
|
+
background: TRUE_BLACK,
|
|
181
|
+
backgroundHover: "#0A0A0A",
|
|
182
|
+
backgroundPress: "#141414",
|
|
183
|
+
backgroundFocus: "#0A0A0A"
|
|
184
|
+
};
|
|
185
|
+
var brandTheme = (accent, extra = {}) => ({
|
|
186
|
+
...darkBase,
|
|
187
|
+
accentBackground: accent,
|
|
188
|
+
accentColor: "#FFFFFF",
|
|
189
|
+
borderColorHover: accent,
|
|
190
|
+
colorHover: accent,
|
|
191
|
+
...extra
|
|
192
|
+
});
|
|
193
|
+
var luxThemes = {
|
|
194
|
+
dark: darkBase,
|
|
195
|
+
dark_lux: brandTheme(LUX_BRAND.lux),
|
|
196
|
+
dark_zoo: brandTheme(LUX_BRAND.zoo),
|
|
197
|
+
dark_hanzo: brandTheme(LUX_BRAND.hanzo),
|
|
198
|
+
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD }),
|
|
199
|
+
dark_bootnode: brandTheme(LUX_BRAND.bootnode)
|
|
200
|
+
};
|
|
201
|
+
var config = gui.createGui({
|
|
202
|
+
...v5.defaultConfig,
|
|
203
|
+
animations: v5Css.animations,
|
|
204
|
+
settings: {
|
|
205
|
+
...v5.defaultConfig.settings,
|
|
206
|
+
onlyAllowShorthands: false
|
|
207
|
+
},
|
|
208
|
+
themes: {
|
|
209
|
+
...v5.defaultConfig.themes,
|
|
210
|
+
...luxThemes
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
var lux_config_default = config;
|
|
214
|
+
var defaultQueryClient = new reactQuery.QueryClient({
|
|
215
|
+
defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
|
|
216
|
+
});
|
|
217
|
+
var FONT_BODY_RESET_ID = "lux-ui-font-body-reset";
|
|
218
|
+
var FONT_BODY_RESET_CSS = "body .font_body{line-height:1.5}";
|
|
219
|
+
var useFontBodyReset = () => {
|
|
220
|
+
React33__namespace.default.useInsertionEffect(() => {
|
|
221
|
+
if (typeof document === "undefined") return;
|
|
222
|
+
if (document.getElementById(FONT_BODY_RESET_ID)) return;
|
|
223
|
+
const style = document.createElement("style");
|
|
224
|
+
style.id = FONT_BODY_RESET_ID;
|
|
225
|
+
style.textContent = FONT_BODY_RESET_CSS;
|
|
226
|
+
document.head.appendChild(style);
|
|
227
|
+
}, []);
|
|
228
|
+
};
|
|
229
|
+
var WhiteLabelContext = React33__namespace.default.createContext(resolveWhiteLabel(""));
|
|
230
|
+
var useWhiteLabel = () => React33__namespace.default.useContext(WhiteLabelContext);
|
|
231
|
+
var useHostWhiteLabel = (host) => {
|
|
232
|
+
const [resolvedHost, setResolvedHost] = React33__namespace.default.useState(host ?? "");
|
|
233
|
+
React33__namespace.default.useEffect(() => {
|
|
234
|
+
if (host !== void 0) return;
|
|
235
|
+
const browserHost = currentHost();
|
|
236
|
+
if (browserHost) setResolvedHost(browserHost);
|
|
237
|
+
}, [host]);
|
|
238
|
+
return React33__namespace.default.useMemo(() => resolveWhiteLabel(resolvedHost), [resolvedHost]);
|
|
239
|
+
};
|
|
240
|
+
var AppProvider = ({
|
|
241
|
+
children,
|
|
242
|
+
queryClient,
|
|
243
|
+
host,
|
|
244
|
+
defaultTheme
|
|
245
|
+
}) => {
|
|
246
|
+
useFontBodyReset();
|
|
247
|
+
const whiteLabel = useHostWhiteLabel(host);
|
|
248
|
+
const theme = defaultTheme ?? whiteLabel.theme;
|
|
249
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WhiteLabelContext.Provider, { value: whiteLabel, children: /* @__PURE__ */ jsxRuntime.jsx(gui.GuiProvider, { config: lux_config_default, defaultTheme: theme, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient ?? defaultQueryClient, children }) }) });
|
|
250
|
+
};
|
|
251
|
+
function cn(...inputs) {
|
|
252
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
253
|
+
}
|
|
254
|
+
var NARROW_PX = 640;
|
|
255
|
+
var TOUCH_PX = 1024;
|
|
256
|
+
function useBelow(px) {
|
|
257
|
+
const [below, setBelow] = React33__namespace.useState(false);
|
|
258
|
+
React33__namespace.useEffect(() => {
|
|
259
|
+
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
260
|
+
const apply = () => setBelow(mql.matches);
|
|
261
|
+
apply();
|
|
262
|
+
mql.addEventListener("change", apply);
|
|
263
|
+
return () => mql.removeEventListener("change", apply);
|
|
264
|
+
}, [px]);
|
|
265
|
+
return below;
|
|
266
|
+
}
|
|
267
|
+
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
268
|
+
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
269
|
+
|
|
270
|
+
// src/iam.ts
|
|
271
|
+
var IamError = class extends Error {
|
|
272
|
+
constructor(message, status, unauthenticated) {
|
|
273
|
+
super(message);
|
|
274
|
+
this.name = "IamError";
|
|
275
|
+
this.status = status;
|
|
276
|
+
this.unauthenticated = unauthenticated;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
280
|
+
function isSignedOut(status, msg) {
|
|
281
|
+
return status === 401 || status === 403 || SIGNED_OUT.test(msg);
|
|
282
|
+
}
|
|
283
|
+
function iamBase(host) {
|
|
284
|
+
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
|
285
|
+
return `${wl.issuer}/v1/iam`;
|
|
286
|
+
}
|
|
287
|
+
async function read(call, verb, params) {
|
|
288
|
+
const url = new URL(`${call.base}/${verb}`);
|
|
289
|
+
for (const [k, v] of Object.entries(params)) url.searchParams.set(k, String(v));
|
|
290
|
+
let res;
|
|
291
|
+
try {
|
|
292
|
+
res = await fetch(url.toString(), {
|
|
293
|
+
method: "GET",
|
|
294
|
+
// The bearer is the whole credential. IAM does not allow credentialed
|
|
295
|
+
// CORS, so sending cookies would only get the response blocked.
|
|
296
|
+
headers: call.token ? { Authorization: `Bearer ${call.token}` } : {},
|
|
297
|
+
signal: call.signal
|
|
298
|
+
});
|
|
299
|
+
} catch (e) {
|
|
300
|
+
throw new IamError(e instanceof Error ? e.message : "IAM unreachable", 0, false);
|
|
301
|
+
}
|
|
302
|
+
const body = await res.json().catch(() => ({}));
|
|
303
|
+
const msg = typeof body.msg === "string" ? body.msg : "";
|
|
304
|
+
if (!res.ok || body.status === "error") {
|
|
305
|
+
throw new IamError(msg || `IAM ${verb} failed (${res.status})`, res.status, isSignedOut(res.status, msg));
|
|
306
|
+
}
|
|
307
|
+
return body.data;
|
|
308
|
+
}
|
|
309
|
+
var IAM_PAGE_SIZE = 20;
|
|
310
|
+
var iam = {
|
|
311
|
+
/** The signed-in principal, or null when there is no session. */
|
|
312
|
+
async account(call) {
|
|
313
|
+
try {
|
|
314
|
+
const data = await read(call, "get-account", {});
|
|
315
|
+
return data && data.name ? data : null;
|
|
316
|
+
} catch (e) {
|
|
317
|
+
if (e instanceof IamError && e.unauthenticated) return null;
|
|
318
|
+
throw e;
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
* One page of the orgs the principal can see. IAM scopes the read to the
|
|
323
|
+
* caller's authority, so a normal member gets their own org and a super
|
|
324
|
+
* admin gets the tenant list — the page never has to decide.
|
|
325
|
+
*/
|
|
326
|
+
async organizations(call, page = 0, query = "", pageSize = IAM_PAGE_SIZE) {
|
|
327
|
+
const params = {
|
|
328
|
+
owner: "admin",
|
|
329
|
+
// IAM orgs live under the reserved `admin` owner
|
|
330
|
+
p: page + 1,
|
|
331
|
+
// the backend page is 1-based
|
|
332
|
+
pageSize,
|
|
333
|
+
sortField: "name",
|
|
334
|
+
sortOrder: "ascending"
|
|
335
|
+
};
|
|
336
|
+
const q = query.trim();
|
|
337
|
+
if (q) {
|
|
338
|
+
params.field = "name";
|
|
339
|
+
params.value = q;
|
|
340
|
+
}
|
|
341
|
+
return await read(call, "get-organizations", params) ?? [];
|
|
342
|
+
},
|
|
343
|
+
/** One organization by name. */
|
|
344
|
+
async organization(call, name) {
|
|
345
|
+
return await read(call, "get-organization", { id: `admin/${name}` }) ?? null;
|
|
346
|
+
},
|
|
347
|
+
/** Members of an organization. */
|
|
348
|
+
async users(call, org) {
|
|
349
|
+
return await read(call, "get-users", { owner: org }) ?? [];
|
|
350
|
+
},
|
|
351
|
+
/** The organization's projects — IAM keys this read by `organization`. */
|
|
352
|
+
async projects(call, org) {
|
|
353
|
+
return await read(call, "get-organization-projects", { organization: org }) ?? [];
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
var IAM_TOKEN_KEY = "hanzo_iam_access_token";
|
|
357
|
+
function storedToken() {
|
|
358
|
+
if (typeof window === "undefined") return null;
|
|
359
|
+
for (const store of [window.sessionStorage, window.localStorage]) {
|
|
360
|
+
try {
|
|
361
|
+
const t = store.getItem(IAM_TOKEN_KEY);
|
|
362
|
+
if (t) return t;
|
|
363
|
+
} catch {
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
function clearStoredTokens() {
|
|
369
|
+
if (typeof window === "undefined") return;
|
|
370
|
+
for (const store of [window.sessionStorage, window.localStorage]) {
|
|
371
|
+
try {
|
|
372
|
+
for (const k of ["access_token", "refresh_token", "id_token", "expires_at"]) {
|
|
373
|
+
store.removeItem(`hanzo_iam_${k}`);
|
|
374
|
+
}
|
|
375
|
+
} catch {
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
var defaultAuth = {};
|
|
380
|
+
var scopeKey = (host, kind) => `lux-ui:${kind}:${host}`;
|
|
381
|
+
function readScope(host, kind) {
|
|
382
|
+
if (typeof window === "undefined") return null;
|
|
383
|
+
try {
|
|
384
|
+
return window.localStorage.getItem(scopeKey(host, kind));
|
|
385
|
+
} catch {
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
function writeScope(host, kind, value) {
|
|
390
|
+
if (typeof window === "undefined") return;
|
|
391
|
+
try {
|
|
392
|
+
window.localStorage.setItem(scopeKey(host, kind), value);
|
|
393
|
+
} catch {
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
var IdentityContext = React33__namespace.createContext(null);
|
|
397
|
+
var IdentityProvider = ({
|
|
398
|
+
children,
|
|
399
|
+
auth = defaultAuth,
|
|
400
|
+
loginPath = "/login"
|
|
401
|
+
}) => {
|
|
402
|
+
const whiteLabel = useWhiteLabel();
|
|
403
|
+
const base = React33__namespace.useMemo(() => iamBase(whiteLabel), [whiteLabel]);
|
|
404
|
+
const [status, setStatus] = React33__namespace.useState("loading");
|
|
405
|
+
const [account, setAccount] = React33__namespace.useState(null);
|
|
406
|
+
const [orgs, setOrgs] = React33__namespace.useState([]);
|
|
407
|
+
const [projects, setProjects] = React33__namespace.useState([]);
|
|
408
|
+
const [error, setError] = React33__namespace.useState(null);
|
|
409
|
+
const [orgName, setOrgName] = React33__namespace.useState(null);
|
|
410
|
+
const [projectName, setProjectName] = React33__namespace.useState(null);
|
|
411
|
+
const [epoch, setEpoch] = React33__namespace.useState(0);
|
|
412
|
+
React33__namespace.useEffect(() => {
|
|
413
|
+
const ac = new AbortController();
|
|
414
|
+
let live = true;
|
|
415
|
+
void (async () => {
|
|
416
|
+
const token = await (auth.token ?? storedToken)();
|
|
417
|
+
if (!live) return;
|
|
418
|
+
if (!token) {
|
|
419
|
+
setStatus("anonymous");
|
|
420
|
+
setAccount(null);
|
|
421
|
+
setOrgs([]);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
const call = { base, token, signal: ac.signal };
|
|
425
|
+
try {
|
|
426
|
+
const me = await iam.account(call);
|
|
427
|
+
if (!live) return;
|
|
428
|
+
if (!me) {
|
|
429
|
+
setStatus("anonymous");
|
|
430
|
+
setAccount(null);
|
|
431
|
+
setOrgs([]);
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
setAccount(me);
|
|
435
|
+
const rows = await iam.organizations(call).catch((e) => {
|
|
436
|
+
if (e instanceof IamError && !e.unauthenticated) return [{ owner: "admin", name: me.owner }];
|
|
437
|
+
throw e;
|
|
438
|
+
});
|
|
439
|
+
if (!live) return;
|
|
440
|
+
setOrgs(rows);
|
|
441
|
+
setStatus("ready");
|
|
442
|
+
setError(null);
|
|
443
|
+
} catch (e) {
|
|
444
|
+
if (!live || ac.signal.aborted) return;
|
|
445
|
+
if (e instanceof IamError && e.unauthenticated) {
|
|
446
|
+
setStatus("anonymous");
|
|
447
|
+
setAccount(null);
|
|
448
|
+
setOrgs([]);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
setStatus("error");
|
|
452
|
+
setError(e instanceof Error ? e.message : "Could not reach IAM.");
|
|
453
|
+
}
|
|
454
|
+
})();
|
|
455
|
+
return () => {
|
|
456
|
+
live = false;
|
|
457
|
+
ac.abort();
|
|
458
|
+
};
|
|
459
|
+
}, [base, auth, epoch]);
|
|
460
|
+
const org = React33__namespace.useMemo(() => {
|
|
461
|
+
if (orgs.length === 0) return null;
|
|
462
|
+
const saved = orgName ?? readScope(whiteLabel.host, "org");
|
|
463
|
+
return orgs.find((o) => o.name === saved) ?? orgs.find((o) => o.name === account?.owner) ?? orgs[0];
|
|
464
|
+
}, [orgs, orgName, account, whiteLabel.host]);
|
|
465
|
+
React33__namespace.useEffect(() => {
|
|
466
|
+
if (!org) {
|
|
467
|
+
setProjects([]);
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
const ac = new AbortController();
|
|
471
|
+
let live = true;
|
|
472
|
+
void (async () => {
|
|
473
|
+
const token = await (auth.token ?? storedToken)();
|
|
474
|
+
if (!live || !token) return;
|
|
475
|
+
const rows = await iam.projects({ base, token, signal: ac.signal }, org.name).catch(() => []);
|
|
476
|
+
if (live) setProjects(rows);
|
|
477
|
+
})();
|
|
478
|
+
return () => {
|
|
479
|
+
live = false;
|
|
480
|
+
ac.abort();
|
|
481
|
+
};
|
|
482
|
+
}, [base, auth, org, epoch]);
|
|
483
|
+
const project = React33__namespace.useMemo(() => {
|
|
484
|
+
if (projects.length === 0) return null;
|
|
485
|
+
const saved = projectName ?? readScope(whiteLabel.host, "project");
|
|
486
|
+
return projects.find((p) => p.name === saved) ?? projects.find((p) => p.isDefault) ?? projects[0];
|
|
487
|
+
}, [projects, projectName, whiteLabel.host]);
|
|
488
|
+
const value = React33__namespace.useMemo(() => ({
|
|
489
|
+
status,
|
|
490
|
+
account,
|
|
491
|
+
orgs,
|
|
492
|
+
org,
|
|
493
|
+
projects,
|
|
494
|
+
project,
|
|
495
|
+
error,
|
|
496
|
+
whiteLabel,
|
|
497
|
+
setOrg: (name) => {
|
|
498
|
+
writeScope(whiteLabel.host, "org", name);
|
|
499
|
+
setOrgName(name);
|
|
500
|
+
setProjectName(null);
|
|
501
|
+
},
|
|
502
|
+
setProject: (name) => {
|
|
503
|
+
writeScope(whiteLabel.host, "project", name);
|
|
504
|
+
setProjectName(name);
|
|
505
|
+
},
|
|
506
|
+
signIn: () => {
|
|
507
|
+
if (auth.signIn) return auth.signIn();
|
|
508
|
+
if (typeof window !== "undefined") window.location.assign(loginPath);
|
|
509
|
+
},
|
|
510
|
+
signOut: () => {
|
|
511
|
+
if (auth.signOut) return auth.signOut();
|
|
512
|
+
clearStoredTokens();
|
|
513
|
+
if (typeof window !== "undefined") window.location.assign(loginPath);
|
|
514
|
+
},
|
|
515
|
+
reload: () => setEpoch((n) => n + 1)
|
|
516
|
+
}), [status, account, orgs, org, projects, project, error, whiteLabel, auth, loginPath]);
|
|
517
|
+
return /* @__PURE__ */ jsxRuntime.jsx(IdentityContext.Provider, { value, children });
|
|
518
|
+
};
|
|
519
|
+
function useIdentity() {
|
|
520
|
+
const ctx = React33__namespace.useContext(IdentityContext);
|
|
521
|
+
const whiteLabel = useWhiteLabel();
|
|
522
|
+
const fallback = React33__namespace.useMemo(() => ({
|
|
523
|
+
status: "anonymous",
|
|
524
|
+
account: null,
|
|
525
|
+
orgs: [],
|
|
526
|
+
org: null,
|
|
527
|
+
projects: [],
|
|
528
|
+
project: null,
|
|
529
|
+
error: null,
|
|
530
|
+
whiteLabel,
|
|
531
|
+
setOrg: () => void 0,
|
|
532
|
+
setProject: () => void 0,
|
|
533
|
+
signIn: () => {
|
|
534
|
+
if (typeof window !== "undefined") window.location.assign("/login");
|
|
535
|
+
},
|
|
536
|
+
signOut: () => void 0,
|
|
537
|
+
reload: () => void 0
|
|
538
|
+
}), [whiteLabel]);
|
|
539
|
+
return ctx ?? fallback;
|
|
540
|
+
}
|
|
541
|
+
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";
|
|
542
|
+
var CloseButtonFrame = gui.styled(gui.View, {
|
|
543
|
+
name: "LuxCloseButton",
|
|
544
|
+
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Close" }),
|
|
545
|
+
role: "button",
|
|
546
|
+
cursor: "pointer",
|
|
547
|
+
display: "inline-flex",
|
|
548
|
+
alignItems: "center",
|
|
549
|
+
justifyContent: "center",
|
|
550
|
+
width: 20,
|
|
551
|
+
height: 20,
|
|
552
|
+
minWidth: 0,
|
|
553
|
+
flexShrink: 1,
|
|
554
|
+
padding: 0,
|
|
555
|
+
borderRadius: 4,
|
|
556
|
+
borderWidth: 0,
|
|
557
|
+
overflow: "hidden",
|
|
558
|
+
backgroundColor: "transparent",
|
|
559
|
+
hoverStyle: {
|
|
560
|
+
backgroundColor: "transparent"
|
|
561
|
+
},
|
|
562
|
+
variants: {
|
|
563
|
+
disabled: {
|
|
564
|
+
true: {
|
|
565
|
+
opacity: 0.4,
|
|
566
|
+
pointerEvents: "none"
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
var CLOSE_BUTTON_CLASSES = [
|
|
572
|
+
"text-[var(--closeButton-fg,currentColor)]",
|
|
573
|
+
"hover:text-[var(--hover-color,currentColor)]",
|
|
574
|
+
"disabled:opacity-40"
|
|
575
|
+
].join(" ");
|
|
576
|
+
var CloseButton = React33__namespace.forwardRef(function CloseButton2(props, ref) {
|
|
577
|
+
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
578
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
579
|
+
CloseButtonFrame,
|
|
580
|
+
{
|
|
581
|
+
ref,
|
|
582
|
+
className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
|
|
583
|
+
...rest,
|
|
584
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
585
|
+
"svg",
|
|
586
|
+
{
|
|
587
|
+
className: "size-5",
|
|
588
|
+
viewBox: "0 0 20 20",
|
|
589
|
+
fill: "none",
|
|
590
|
+
"aria-hidden": "true",
|
|
591
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
592
|
+
"path",
|
|
593
|
+
{
|
|
594
|
+
d: CLOSE_ICON_PATH,
|
|
595
|
+
fill: "currentColor"
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
}
|
|
599
|
+
)
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
});
|
|
603
|
+
var DrawerPlacementContext = React33__namespace.createContext("right");
|
|
604
|
+
var DrawerSizeContext = React33__namespace.createContext("md");
|
|
605
|
+
var DrawerStateContext = React33__namespace.createContext({
|
|
606
|
+
open: false,
|
|
607
|
+
setOpen: () => {
|
|
608
|
+
},
|
|
609
|
+
modal: true
|
|
610
|
+
});
|
|
611
|
+
var DrawerRoot = (props) => {
|
|
612
|
+
const {
|
|
613
|
+
children,
|
|
614
|
+
open,
|
|
615
|
+
defaultOpen,
|
|
616
|
+
onOpenChange,
|
|
617
|
+
placement = "right",
|
|
618
|
+
modal = true,
|
|
619
|
+
size = "md"
|
|
620
|
+
} = props;
|
|
621
|
+
const [uncontrolled, setUncontrolled] = React33__namespace.useState(defaultOpen ?? false);
|
|
622
|
+
const isControlled = open !== void 0;
|
|
623
|
+
const isOpen = isControlled ? open : uncontrolled;
|
|
624
|
+
const setOpen = React33__namespace.useCallback((nextOpen) => {
|
|
625
|
+
if (!isControlled) setUncontrolled(nextOpen);
|
|
626
|
+
onOpenChange?.({ open: nextOpen });
|
|
627
|
+
}, [isControlled, onOpenChange]);
|
|
628
|
+
const state = React33__namespace.useMemo(
|
|
629
|
+
() => ({ open: isOpen, setOpen, modal }),
|
|
630
|
+
[isOpen, setOpen, modal]
|
|
631
|
+
);
|
|
632
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsxRuntime.jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsxRuntime.jsx(DrawerStateContext.Provider, { value: state, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
633
|
+
RadixDialog__namespace.Root,
|
|
634
|
+
{
|
|
635
|
+
open: isOpen,
|
|
636
|
+
onOpenChange: setOpen,
|
|
637
|
+
modal,
|
|
638
|
+
children
|
|
639
|
+
}
|
|
640
|
+
) }) }) });
|
|
641
|
+
};
|
|
642
|
+
var PLACEMENT_CLASSES = {
|
|
643
|
+
right: [
|
|
644
|
+
"inset-y-0 right-0",
|
|
645
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
|
|
646
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
|
|
647
|
+
].join(" "),
|
|
648
|
+
left: [
|
|
649
|
+
"inset-y-0 left-0",
|
|
650
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
|
|
651
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
|
|
652
|
+
].join(" "),
|
|
653
|
+
top: [
|
|
654
|
+
"inset-x-0 top-0",
|
|
655
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
|
|
656
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
|
|
657
|
+
].join(" "),
|
|
658
|
+
bottom: [
|
|
659
|
+
"inset-x-0 bottom-0",
|
|
660
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
|
|
661
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
|
|
662
|
+
].join(" ")
|
|
663
|
+
};
|
|
664
|
+
var SIZE_CLASSES = {
|
|
665
|
+
right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
666
|
+
left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
667
|
+
top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
|
|
668
|
+
bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
|
|
669
|
+
};
|
|
670
|
+
var DrawerContent = React33__namespace.forwardRef(
|
|
671
|
+
function DrawerContent2(props, ref) {
|
|
672
|
+
const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
|
|
673
|
+
const placement = React33__namespace.useContext(DrawerPlacementContext);
|
|
674
|
+
const size = React33__namespace.useContext(DrawerSizeContext);
|
|
675
|
+
const { open, setOpen, modal } = React33__namespace.useContext(DrawerStateContext);
|
|
676
|
+
const isNarrow = useIsNarrow();
|
|
677
|
+
if (isNarrow) {
|
|
678
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
679
|
+
gui.Sheet,
|
|
680
|
+
{
|
|
681
|
+
open,
|
|
682
|
+
onOpenChange: setOpen,
|
|
683
|
+
modal,
|
|
684
|
+
dismissOnSnapToBottom: true,
|
|
685
|
+
snapPointsMode: "percent",
|
|
686
|
+
snapPoints: [88],
|
|
687
|
+
transition: "medium",
|
|
688
|
+
children: [
|
|
689
|
+
backdrop && /* @__PURE__ */ jsxRuntime.jsx(
|
|
690
|
+
gui.Sheet.Overlay,
|
|
691
|
+
{
|
|
692
|
+
transition: "lazy",
|
|
693
|
+
enterStyle: { opacity: 0 },
|
|
694
|
+
exitStyle: { opacity: 0 },
|
|
695
|
+
className: "bg-black/50"
|
|
696
|
+
}
|
|
697
|
+
),
|
|
698
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Sheet.Handle, {}),
|
|
699
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
700
|
+
gui.Sheet.Frame,
|
|
701
|
+
{
|
|
702
|
+
unstyled: true,
|
|
703
|
+
className: cn(
|
|
704
|
+
"flex flex-col rounded-t-2xl bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)]",
|
|
705
|
+
className
|
|
706
|
+
),
|
|
707
|
+
...rest,
|
|
708
|
+
children
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
]
|
|
712
|
+
}
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
716
|
+
backdrop && /* @__PURE__ */ jsxRuntime.jsx(
|
|
717
|
+
RadixDialog__namespace.Overlay,
|
|
718
|
+
{
|
|
719
|
+
className: cn(
|
|
720
|
+
"fixed inset-0 z-50 bg-black/50",
|
|
721
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
722
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
|
|
723
|
+
)
|
|
724
|
+
}
|
|
725
|
+
),
|
|
726
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
727
|
+
RadixDialog__namespace.Content,
|
|
728
|
+
{
|
|
729
|
+
ref,
|
|
730
|
+
className: cn(
|
|
731
|
+
"fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
|
|
732
|
+
PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
|
|
733
|
+
SIZE_CLASSES[placement]?.[size] ?? SIZE_CLASSES.right?.md,
|
|
734
|
+
className
|
|
735
|
+
),
|
|
736
|
+
...rest,
|
|
737
|
+
children
|
|
738
|
+
}
|
|
739
|
+
)
|
|
740
|
+
] });
|
|
741
|
+
if (portalled) {
|
|
742
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
743
|
+
}
|
|
744
|
+
return content;
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
var DrawerCloseTrigger = React33__namespace.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
748
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
+
CloseButton,
|
|
750
|
+
{
|
|
751
|
+
ref,
|
|
752
|
+
className: cn("absolute top-7 right-5", props.className),
|
|
753
|
+
...props
|
|
754
|
+
}
|
|
755
|
+
) });
|
|
756
|
+
});
|
|
757
|
+
var DrawerTrigger = (props) => {
|
|
758
|
+
const { asChild = true, ...rest } = props;
|
|
759
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Trigger, { asChild, ...rest });
|
|
760
|
+
};
|
|
761
|
+
var DrawerHeader = React33__namespace.forwardRef(
|
|
762
|
+
function DrawerHeader2({ className, ...props }, ref) {
|
|
763
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
|
|
764
|
+
}
|
|
765
|
+
);
|
|
766
|
+
var DrawerBody = React33__namespace.forwardRef(
|
|
767
|
+
function DrawerBody2({ className, ...props }, ref) {
|
|
768
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
|
|
769
|
+
}
|
|
770
|
+
);
|
|
771
|
+
var DrawerFooter = React33__namespace.forwardRef(
|
|
772
|
+
function DrawerFooter2({ className, ...props }, ref) {
|
|
773
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
|
|
774
|
+
}
|
|
775
|
+
);
|
|
776
|
+
var DrawerTitle = RadixDialog__namespace.Title;
|
|
777
|
+
var DrawerDescription = RadixDialog__namespace.Description;
|
|
778
|
+
var DrawerActionTrigger = RadixDialog__namespace.Close;
|
|
779
|
+
function parsePlacement(placement) {
|
|
780
|
+
if (!placement) {
|
|
781
|
+
return { side: "bottom", align: "start" };
|
|
782
|
+
}
|
|
783
|
+
const parts = placement.split("-");
|
|
784
|
+
const side = parts[0] ?? "bottom";
|
|
785
|
+
const alignPart = parts[1];
|
|
786
|
+
let align = "center";
|
|
787
|
+
if (alignPart === "start") {
|
|
788
|
+
align = "start";
|
|
789
|
+
} else if (alignPart === "end") {
|
|
790
|
+
align = "end";
|
|
791
|
+
}
|
|
792
|
+
return { side, align };
|
|
793
|
+
}
|
|
794
|
+
var PositioningContext = React33__namespace.createContext({
|
|
795
|
+
side: "bottom",
|
|
796
|
+
align: "start",
|
|
797
|
+
sideOffset: 4,
|
|
798
|
+
alignOffset: 0
|
|
799
|
+
});
|
|
800
|
+
var MenuRoot = (props) => {
|
|
801
|
+
const {
|
|
802
|
+
children,
|
|
803
|
+
open,
|
|
804
|
+
defaultOpen,
|
|
805
|
+
onOpenChange,
|
|
806
|
+
positioning,
|
|
807
|
+
modal = true,
|
|
808
|
+
// lazyMount / unmountOnExit have no direct Radix equivalent; Radix handles
|
|
809
|
+
// mount/unmount automatically.
|
|
810
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
811
|
+
lazyMount: _lazyMount,
|
|
812
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
813
|
+
unmountOnExit: _unmountOnExit
|
|
814
|
+
} = props;
|
|
815
|
+
const mergedPositioning = {
|
|
816
|
+
placement: "bottom-start",
|
|
817
|
+
...positioning,
|
|
818
|
+
offset: {
|
|
819
|
+
mainAxis: 4,
|
|
820
|
+
...positioning?.offset
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
const { side, align } = parsePlacement(mergedPositioning.placement);
|
|
824
|
+
const positioningValue = React33__namespace.useMemo(() => ({
|
|
825
|
+
side,
|
|
826
|
+
align,
|
|
827
|
+
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
828
|
+
alignOffset: mergedPositioning.offset?.crossAxis ?? 0
|
|
829
|
+
}), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
|
|
830
|
+
const handleOpenChange = React33__namespace.useCallback((isOpen) => {
|
|
831
|
+
onOpenChange?.({ open: isOpen });
|
|
832
|
+
}, [onOpenChange]);
|
|
833
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
834
|
+
DropdownMenu__namespace.Root,
|
|
835
|
+
{
|
|
836
|
+
open,
|
|
837
|
+
defaultOpen,
|
|
838
|
+
onOpenChange: handleOpenChange,
|
|
839
|
+
modal,
|
|
840
|
+
children
|
|
841
|
+
}
|
|
842
|
+
) });
|
|
843
|
+
};
|
|
844
|
+
var MenuTrigger = React33__namespace.forwardRef(function MenuTrigger2(props, ref) {
|
|
845
|
+
const { asChild = false, ...rest } = props;
|
|
846
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild, ref, ...rest });
|
|
847
|
+
});
|
|
848
|
+
var MenuContent = React33__namespace.forwardRef(function MenuContent2(props, ref) {
|
|
849
|
+
const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
|
|
850
|
+
const positioning = React33__namespace.useContext(PositioningContext);
|
|
851
|
+
const mergedStyle = {
|
|
852
|
+
...style,
|
|
853
|
+
...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
|
|
854
|
+
...minW !== void 0 ? { minWidth: minW } : {}
|
|
855
|
+
};
|
|
856
|
+
const content = /* @__PURE__ */ jsxRuntime.jsx(
|
|
857
|
+
DropdownMenu__namespace.Content,
|
|
858
|
+
{
|
|
859
|
+
ref,
|
|
860
|
+
side: positioning.side,
|
|
861
|
+
align: positioning.align,
|
|
862
|
+
sideOffset: positioning.sideOffset,
|
|
863
|
+
alignOffset: positioning.alignOffset,
|
|
864
|
+
className: cn(
|
|
865
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-lg p-1",
|
|
866
|
+
"border border-[var(--color-popover-border,var(--color-border-divider))]",
|
|
867
|
+
"bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
|
|
868
|
+
"shadow-[0_4px_12px_var(--color-popover-shadow)]",
|
|
869
|
+
"outline-none",
|
|
870
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
871
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
872
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
873
|
+
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
874
|
+
className
|
|
875
|
+
),
|
|
876
|
+
style: Object.keys(mergedStyle).length > 0 ? mergedStyle : void 0,
|
|
877
|
+
...rest
|
|
878
|
+
}
|
|
879
|
+
);
|
|
880
|
+
if (!portalled) {
|
|
881
|
+
return content;
|
|
882
|
+
}
|
|
883
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
884
|
+
});
|
|
885
|
+
var MenuItem = React33__namespace.forwardRef(function MenuItem2(props, ref) {
|
|
886
|
+
const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
|
|
887
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
888
|
+
DropdownMenu__namespace.Item,
|
|
889
|
+
{
|
|
890
|
+
ref,
|
|
891
|
+
asChild,
|
|
892
|
+
disabled,
|
|
893
|
+
onClick,
|
|
894
|
+
className: cn(
|
|
895
|
+
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
896
|
+
"outline-none transition-colors",
|
|
897
|
+
"text-[var(--color-text-primary,inherit)]",
|
|
898
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
899
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
900
|
+
className
|
|
901
|
+
),
|
|
902
|
+
...rest,
|
|
903
|
+
children
|
|
904
|
+
}
|
|
905
|
+
);
|
|
906
|
+
});
|
|
907
|
+
var MenuItemText = React33__namespace.forwardRef(function MenuItemText2(props, ref) {
|
|
908
|
+
const { className, ...rest } = props;
|
|
909
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, className: cn("flex-1", className), ...rest });
|
|
910
|
+
});
|
|
911
|
+
React33__namespace.forwardRef(function MenuItemCommand2(props, ref) {
|
|
912
|
+
const { className, ...rest } = props;
|
|
913
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
914
|
+
"span",
|
|
915
|
+
{
|
|
916
|
+
ref,
|
|
917
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
918
|
+
...rest
|
|
919
|
+
}
|
|
920
|
+
);
|
|
921
|
+
});
|
|
922
|
+
var MenuSeparator = React33__namespace.forwardRef(function MenuSeparator2(props, ref) {
|
|
923
|
+
const { className, ...rest } = props;
|
|
924
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
925
|
+
DropdownMenu__namespace.Separator,
|
|
926
|
+
{
|
|
927
|
+
ref,
|
|
928
|
+
className: cn("-mx-1 my-1 h-px bg-[var(--color-border-divider)]", className),
|
|
929
|
+
...rest
|
|
930
|
+
}
|
|
931
|
+
);
|
|
932
|
+
});
|
|
933
|
+
var MenuItemGroup = React33__namespace.forwardRef(function MenuItemGroup2(props, ref) {
|
|
934
|
+
const { title, children, className, ...rest } = props;
|
|
935
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Group, { ref, className, ...rest, children: [
|
|
936
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
|
|
937
|
+
children
|
|
938
|
+
] });
|
|
939
|
+
});
|
|
940
|
+
var MenuArrow = React33__namespace.forwardRef(function MenuArrow2(props, ref) {
|
|
941
|
+
const { className, ...rest } = props;
|
|
942
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
943
|
+
DropdownMenu__namespace.Arrow,
|
|
944
|
+
{
|
|
945
|
+
ref,
|
|
946
|
+
className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
|
|
947
|
+
...rest
|
|
948
|
+
}
|
|
949
|
+
);
|
|
950
|
+
});
|
|
951
|
+
var MenuCheckboxItem = React33__namespace.forwardRef(function MenuCheckboxItem2(props, ref) {
|
|
952
|
+
const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
|
|
953
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
954
|
+
DropdownMenu__namespace.CheckboxItem,
|
|
955
|
+
{
|
|
956
|
+
ref,
|
|
957
|
+
checked,
|
|
958
|
+
onCheckedChange,
|
|
959
|
+
onClick,
|
|
960
|
+
className: cn(
|
|
961
|
+
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
962
|
+
"outline-none transition-colors",
|
|
963
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
964
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
965
|
+
className
|
|
966
|
+
),
|
|
967
|
+
...rest,
|
|
968
|
+
children: [
|
|
969
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }),
|
|
970
|
+
children
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
);
|
|
974
|
+
});
|
|
975
|
+
var MenuRadioItemGroup = React33__namespace.forwardRef(function MenuRadioItemGroup2(props, ref) {
|
|
976
|
+
const { value, onValueChange, ...rest } = props;
|
|
977
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
978
|
+
DropdownMenu__namespace.RadioGroup,
|
|
979
|
+
{
|
|
980
|
+
ref,
|
|
981
|
+
value,
|
|
982
|
+
onValueChange,
|
|
983
|
+
...rest
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
});
|
|
987
|
+
var MenuRadioItem = React33__namespace.forwardRef(function MenuRadioItem2(props, ref) {
|
|
988
|
+
const { className, children, value, onClick, ...rest } = props;
|
|
989
|
+
const { value: _v, ...radixRest } = rest;
|
|
990
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
991
|
+
DropdownMenu__namespace.RadioItem,
|
|
992
|
+
{
|
|
993
|
+
ref,
|
|
994
|
+
value,
|
|
995
|
+
onClick,
|
|
996
|
+
className: cn(
|
|
997
|
+
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
998
|
+
"outline-none transition-colors",
|
|
999
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
1000
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
1001
|
+
className
|
|
1002
|
+
),
|
|
1003
|
+
children: [
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }),
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children })
|
|
1006
|
+
]
|
|
1007
|
+
}
|
|
1008
|
+
);
|
|
1009
|
+
});
|
|
1010
|
+
React33__namespace.forwardRef(function MenuContextTrigger2(props, ref) {
|
|
1011
|
+
const { asChild: _asChild, ...rest } = props;
|
|
1012
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, ...rest });
|
|
1013
|
+
});
|
|
1014
|
+
var MenuTriggerItem = React33__namespace.forwardRef(function MenuTriggerItem2(props, ref) {
|
|
1015
|
+
const { startIcon, children, className, ...rest } = props;
|
|
1016
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Sub, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1017
|
+
DropdownMenu__namespace.SubTrigger,
|
|
1018
|
+
{
|
|
1019
|
+
ref,
|
|
1020
|
+
className: cn(
|
|
1021
|
+
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
1022
|
+
"outline-none transition-colors",
|
|
1023
|
+
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
1024
|
+
className
|
|
1025
|
+
),
|
|
1026
|
+
...rest,
|
|
1027
|
+
children: [
|
|
1028
|
+
startIcon,
|
|
1029
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children }),
|
|
1030
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|
|
1031
|
+
]
|
|
1032
|
+
}
|
|
1033
|
+
) });
|
|
1034
|
+
});
|
|
1035
|
+
function initials(label) {
|
|
1036
|
+
return label.split(/[\s._-]+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2).toUpperCase();
|
|
1037
|
+
}
|
|
1038
|
+
var Monogram = ({ label, logo }) => logo ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: "", className: "h-5 w-5 shrink-0 rounded object-contain" }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1039
|
+
"span",
|
|
1040
|
+
{
|
|
1041
|
+
"aria-hidden": "true",
|
|
1042
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded bg-[rgba(127,127,127,0.22)] text-[10px] font-bold",
|
|
1043
|
+
children: initials(label)
|
|
1044
|
+
}
|
|
1045
|
+
);
|
|
1046
|
+
var Row = ({ item, onDone, menu }) => {
|
|
1047
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1048
|
+
item.icon,
|
|
1049
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: item.label }),
|
|
1050
|
+
item.hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs opacity-60", children: item.hint }) : null,
|
|
1051
|
+
item.selected ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { "aria-hidden": "true", className: "h-4 w-4 shrink-0" }) : null
|
|
1052
|
+
] });
|
|
1053
|
+
const className = cn(
|
|
1054
|
+
"flex w-full cursor-pointer select-none items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm",
|
|
1055
|
+
"hover:bg-[rgba(127,127,127,0.14)]",
|
|
1056
|
+
item.danger && "text-[var(--color-text-error,#e5484d)]"
|
|
1057
|
+
);
|
|
1058
|
+
const activate = () => {
|
|
1059
|
+
onDone();
|
|
1060
|
+
item.onSelect?.();
|
|
1061
|
+
};
|
|
1062
|
+
const shared = {
|
|
1063
|
+
"data-testid": `chrome-item-${item.id}`,
|
|
1064
|
+
"aria-current": item.selected ? "true" : void 0,
|
|
1065
|
+
className
|
|
1066
|
+
};
|
|
1067
|
+
const control = item.href ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: item.href, ...shared, onClick: onDone, children: body }) : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", ...shared, onClick: activate, children: body });
|
|
1068
|
+
return menu ? /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { value: item.id, asChild: true, children: control }) : control;
|
|
1069
|
+
};
|
|
1070
|
+
var Switcher = ({
|
|
1071
|
+
title,
|
|
1072
|
+
label,
|
|
1073
|
+
icon,
|
|
1074
|
+
items,
|
|
1075
|
+
footer = [],
|
|
1076
|
+
status = "ready",
|
|
1077
|
+
empty = "Nothing here yet.",
|
|
1078
|
+
onSignIn,
|
|
1079
|
+
signInLabel = "Sign in",
|
|
1080
|
+
error,
|
|
1081
|
+
align = "start",
|
|
1082
|
+
testId
|
|
1083
|
+
}) => {
|
|
1084
|
+
const [open, setOpen] = React33__namespace.useState(false);
|
|
1085
|
+
const narrow = useIsNarrow();
|
|
1086
|
+
const close = React33__namespace.useCallback(() => setOpen(false), []);
|
|
1087
|
+
const message = status === "loading" ? "Loading\u2026" : status === "error" ? error ?? "Could not reach IAM." : status === "anonymous" ? null : items.length === 0 ? empty : null;
|
|
1088
|
+
const rows = status === "anonymous" && onSignIn ? [{ id: "sign-in", label: signInLabel, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { "aria-hidden": "true", className: "h-4 w-4" }), onSelect: onSignIn }] : status === "ready" ? items : [];
|
|
1089
|
+
const panel = (menu) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1090
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-wide opacity-55", children: title }),
|
|
1091
|
+
message ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "chrome-message", className: "px-2 py-2 text-sm opacity-70", children: message }) : null,
|
|
1092
|
+
rows.map((item) => /* @__PURE__ */ jsxRuntime.jsx(Row, { item, onDone: close, menu }, item.id)),
|
|
1093
|
+
footer.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1094
|
+
menu ? /* @__PURE__ */ jsxRuntime.jsx(MenuSeparator, { className: "my-1 h-px bg-[var(--color-border-divider,rgba(127,127,127,0.25))]" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px bg-[var(--color-border-divider,rgba(127,127,127,0.25))]" }),
|
|
1095
|
+
footer.map((item) => /* @__PURE__ */ jsxRuntime.jsx(Row, { item, onDone: close, menu }, item.id))
|
|
1096
|
+
] }) : null
|
|
1097
|
+
] });
|
|
1098
|
+
const trigger = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1099
|
+
"button",
|
|
1100
|
+
{
|
|
1101
|
+
type: "button",
|
|
1102
|
+
"data-testid": testId,
|
|
1103
|
+
"aria-label": title,
|
|
1104
|
+
"aria-haspopup": "menu",
|
|
1105
|
+
"aria-expanded": open,
|
|
1106
|
+
className: cn(
|
|
1107
|
+
"flex max-w-[14rem] items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium",
|
|
1108
|
+
"hover:bg-[rgba(127,127,127,0.14)]"
|
|
1109
|
+
),
|
|
1110
|
+
children: [
|
|
1111
|
+
icon,
|
|
1112
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: label }),
|
|
1113
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0 opacity-60" })
|
|
1114
|
+
]
|
|
1115
|
+
}
|
|
1116
|
+
);
|
|
1117
|
+
if (narrow) {
|
|
1118
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DrawerRoot, { open, onOpenChange: (d) => setOpen(d.open), placement: "bottom", size: "md", children: [
|
|
1119
|
+
React33__namespace.cloneElement(trigger, { onClick: () => setOpen(true) }),
|
|
1120
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DrawerContent, { "data-testid": testId ? `${testId}-panel` : void 0, children: [
|
|
1121
|
+
/* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: title }) }),
|
|
1122
|
+
/* @__PURE__ */ jsxRuntime.jsx(DrawerBody, { children: panel(false) })
|
|
1123
|
+
] })
|
|
1124
|
+
] });
|
|
1125
|
+
}
|
|
1126
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1127
|
+
MenuRoot,
|
|
1128
|
+
{
|
|
1129
|
+
open,
|
|
1130
|
+
onOpenChange: (d) => setOpen(d.open),
|
|
1131
|
+
positioning: { placement: align === "end" ? "bottom-end" : "bottom-start" },
|
|
1132
|
+
children: [
|
|
1133
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuTrigger, { asChild: true, children: trigger }),
|
|
1134
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuContent, { minW: "16rem", "data-testid": testId ? `${testId}-panel` : void 0, children: panel(true) })
|
|
1135
|
+
]
|
|
1136
|
+
}
|
|
1137
|
+
);
|
|
1138
|
+
};
|
|
1139
|
+
var OrgSwitcher = () => {
|
|
1140
|
+
const id = useIdentity();
|
|
1141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1142
|
+
Switcher,
|
|
1143
|
+
{
|
|
1144
|
+
testId: "org-switcher",
|
|
1145
|
+
title: "Organization",
|
|
1146
|
+
label: id.org?.displayName || id.org?.name || id.whiteLabel.name,
|
|
1147
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Monogram, { label: id.org?.displayName || id.org?.name || id.whiteLabel.name, logo: id.org?.logo }),
|
|
1148
|
+
status: id.status,
|
|
1149
|
+
error: id.error,
|
|
1150
|
+
empty: "No organizations for this account.",
|
|
1151
|
+
onSignIn: id.signIn,
|
|
1152
|
+
signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
|
|
1153
|
+
items: id.orgs.map((o) => ({
|
|
1154
|
+
id: o.name,
|
|
1155
|
+
label: o.displayName || o.name,
|
|
1156
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Monogram, { label: o.displayName || o.name, logo: o.logo }),
|
|
1157
|
+
selected: o.name === id.org?.name,
|
|
1158
|
+
onSelect: () => id.setOrg(o.name)
|
|
1159
|
+
}))
|
|
1160
|
+
}
|
|
1161
|
+
);
|
|
1162
|
+
};
|
|
1163
|
+
var ProjectSwitcher = () => {
|
|
1164
|
+
const id = useIdentity();
|
|
1165
|
+
if (id.status === "ready" && id.projects.length === 0) return null;
|
|
1166
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1167
|
+
Switcher,
|
|
1168
|
+
{
|
|
1169
|
+
testId: "project-switcher",
|
|
1170
|
+
title: "Project",
|
|
1171
|
+
label: id.project?.displayName || id.project?.name || "Project",
|
|
1172
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1173
|
+
status: id.status,
|
|
1174
|
+
error: id.error,
|
|
1175
|
+
empty: "No projects in this organization.",
|
|
1176
|
+
onSignIn: id.signIn,
|
|
1177
|
+
items: id.projects.map((p) => ({
|
|
1178
|
+
id: p.name,
|
|
1179
|
+
label: p.displayName || p.name,
|
|
1180
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1181
|
+
selected: p.name === id.project?.name,
|
|
1182
|
+
onSelect: () => id.setProject(p.name)
|
|
1183
|
+
}))
|
|
1184
|
+
}
|
|
1185
|
+
);
|
|
1186
|
+
};
|
|
1187
|
+
var UserMenu = ({ items = [] }) => {
|
|
1188
|
+
const id = useIdentity();
|
|
1189
|
+
const who = id.account?.displayName || id.account?.email || id.account?.name || "Account";
|
|
1190
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1191
|
+
Switcher,
|
|
1192
|
+
{
|
|
1193
|
+
testId: "user-menu",
|
|
1194
|
+
align: "end",
|
|
1195
|
+
title: id.status === "ready" ? who : "Account",
|
|
1196
|
+
label: id.status === "ready" ? who : "Sign in",
|
|
1197
|
+
icon: id.status === "ready" ? /* @__PURE__ */ jsxRuntime.jsx(Monogram, { label: who, logo: id.account?.avatar }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1198
|
+
status: id.status,
|
|
1199
|
+
error: id.error,
|
|
1200
|
+
onSignIn: id.signIn,
|
|
1201
|
+
signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
|
|
1202
|
+
items: [
|
|
1203
|
+
{ id: "account", label: id.account?.email || who, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) },
|
|
1204
|
+
...items
|
|
1205
|
+
],
|
|
1206
|
+
footer: id.status === "ready" ? [{ id: "sign-out", label: "Sign out", danger: true, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { "aria-hidden": "true", className: "h-4 w-4" }), onSelect: id.signOut }] : []
|
|
1207
|
+
}
|
|
1208
|
+
);
|
|
1209
|
+
};
|
|
1210
|
+
var SettingsMenu = ({ items = [], href = "/settings" }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1211
|
+
Switcher,
|
|
1212
|
+
{
|
|
1213
|
+
testId: "settings-menu",
|
|
1214
|
+
align: "end",
|
|
1215
|
+
title: "Settings",
|
|
1216
|
+
label: "Settings",
|
|
1217
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1218
|
+
items,
|
|
1219
|
+
empty: "No settings on this surface.",
|
|
1220
|
+
footer: [{ id: "all-settings", label: "All settings", href, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) }]
|
|
1221
|
+
}
|
|
1222
|
+
);
|
|
1223
|
+
var AppNav = ({
|
|
1224
|
+
brand,
|
|
1225
|
+
home = "/",
|
|
1226
|
+
links = [],
|
|
1227
|
+
org = true,
|
|
1228
|
+
project = false,
|
|
1229
|
+
settings,
|
|
1230
|
+
userItems,
|
|
1231
|
+
children
|
|
1232
|
+
}) => {
|
|
1233
|
+
const id = useIdentity();
|
|
1234
|
+
const narrow = useIsNarrow();
|
|
1235
|
+
const [menu, setMenu] = React33__namespace.useState(false);
|
|
1236
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1237
|
+
"header",
|
|
1238
|
+
{
|
|
1239
|
+
"data-testid": "app-nav",
|
|
1240
|
+
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)]",
|
|
1241
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto flex h-14 max-w-7xl items-center gap-2 px-4", children: [
|
|
1242
|
+
narrow && links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(DrawerRoot, { open: menu, onOpenChange: (d) => setMenu(d.open), placement: "bottom", size: "md", children: [
|
|
1243
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1244
|
+
"button",
|
|
1245
|
+
{
|
|
1246
|
+
type: "button",
|
|
1247
|
+
"aria-label": "Menu",
|
|
1248
|
+
"data-testid": "nav-menu",
|
|
1249
|
+
className: "rounded-md p-2 hover:bg-[rgba(127,127,127,0.14)]",
|
|
1250
|
+
onClick: () => setMenu(true),
|
|
1251
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { "aria-hidden": "true", className: "h-5 w-5" })
|
|
1252
|
+
}
|
|
1253
|
+
),
|
|
1254
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DrawerContent, { "data-testid": "nav-menu-panel", children: [
|
|
1255
|
+
/* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: "Menu" }) }),
|
|
1256
|
+
/* @__PURE__ */ jsxRuntime.jsx(DrawerBody, { children: links.map((l) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1257
|
+
"a",
|
|
1258
|
+
{
|
|
1259
|
+
href: l.href,
|
|
1260
|
+
onClick: () => setMenu(false),
|
|
1261
|
+
"aria-current": l.active ? "page" : void 0,
|
|
1262
|
+
className: "block rounded-md px-2 py-2.5 text-sm hover:bg-[rgba(127,127,127,0.14)]",
|
|
1263
|
+
children: l.label
|
|
1264
|
+
},
|
|
1265
|
+
l.href
|
|
1266
|
+
)) })
|
|
1267
|
+
] })
|
|
1268
|
+
] }) : null,
|
|
1269
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: home, className: "flex items-center gap-2 font-semibold tracking-tight", children: brand ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1270
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Building2, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
|
|
1271
|
+
id.whiteLabel.name
|
|
1272
|
+
] }) }),
|
|
1273
|
+
org ? /* @__PURE__ */ jsxRuntime.jsx(OrgSwitcher, {}) : null,
|
|
1274
|
+
project ? /* @__PURE__ */ jsxRuntime.jsx(ProjectSwitcher, {}) : null,
|
|
1275
|
+
!narrow && links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "flex items-center gap-1", children: links.map((l) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1276
|
+
"a",
|
|
1277
|
+
{
|
|
1278
|
+
href: l.href,
|
|
1279
|
+
"aria-current": l.active ? "page" : void 0,
|
|
1280
|
+
className: cn(
|
|
1281
|
+
"rounded-md px-3 py-1.5 text-sm font-medium",
|
|
1282
|
+
l.active ? "bg-[rgba(127,127,127,0.14)]" : "opacity-75 hover:opacity-100"
|
|
1283
|
+
),
|
|
1284
|
+
children: l.label
|
|
1285
|
+
},
|
|
1286
|
+
l.href
|
|
1287
|
+
)) }) : null,
|
|
1288
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 items-center justify-end gap-1", children: [
|
|
1289
|
+
children,
|
|
1290
|
+
settings ? /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { items: settings }) : null,
|
|
1291
|
+
/* @__PURE__ */ jsxRuntime.jsx(UserMenu, { items: userItems })
|
|
1292
|
+
] })
|
|
1293
|
+
] })
|
|
1294
|
+
}
|
|
1295
|
+
);
|
|
73
1296
|
};
|
|
74
|
-
function cn(...inputs) {
|
|
75
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
76
|
-
}
|
|
77
1297
|
var IndicatorIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
78
|
-
var AccordionRoot =
|
|
1298
|
+
var AccordionRoot = React33__namespace.forwardRef(
|
|
79
1299
|
function AccordionRoot2(props, ref) {
|
|
80
1300
|
const {
|
|
81
1301
|
multiple: _multiple,
|
|
@@ -94,7 +1314,7 @@ var AccordionRoot = React29__namespace.forwardRef(
|
|
|
94
1314
|
borderRadius: _borderRadius,
|
|
95
1315
|
...rest
|
|
96
1316
|
} = props;
|
|
97
|
-
const handleValueChange =
|
|
1317
|
+
const handleValueChange = React33__namespace.useCallback(
|
|
98
1318
|
(next) => {
|
|
99
1319
|
onValueChange?.({ value: next });
|
|
100
1320
|
},
|
|
@@ -122,7 +1342,7 @@ var AccordionRoot = React29__namespace.forwardRef(
|
|
|
122
1342
|
);
|
|
123
1343
|
}
|
|
124
1344
|
);
|
|
125
|
-
var AccordionItem =
|
|
1345
|
+
var AccordionItem = React33__namespace.forwardRef(
|
|
126
1346
|
function AccordionItem2(props, ref) {
|
|
127
1347
|
const { className, as: _as, _first, _last, display: _display, ...rest } = props;
|
|
128
1348
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -138,7 +1358,7 @@ var AccordionItem = React29__namespace.forwardRef(
|
|
|
138
1358
|
);
|
|
139
1359
|
}
|
|
140
1360
|
);
|
|
141
|
-
var AccordionItemTrigger =
|
|
1361
|
+
var AccordionItemTrigger = React33__namespace.forwardRef(function AccordionItemTrigger2(props, ref) {
|
|
142
1362
|
const {
|
|
143
1363
|
children,
|
|
144
1364
|
indicatorPlacement: indicatorPlacementProp,
|
|
@@ -203,7 +1423,7 @@ var AccordionItemTrigger = React29__namespace.forwardRef(function AccordionItemT
|
|
|
203
1423
|
}
|
|
204
1424
|
) }) });
|
|
205
1425
|
});
|
|
206
|
-
var AccordionItemContent =
|
|
1426
|
+
var AccordionItemContent = React33__namespace.forwardRef(function AccordionItemContent2(props, ref) {
|
|
207
1427
|
const { className, children, pb: _pb, pr: _pr, pl: _pl, w: _w, display: _display, flexDir: _flexDir, rowGap: _rowGap, ...rest } = props;
|
|
208
1428
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
209
1429
|
AccordionPrimitive__namespace.Content,
|
|
@@ -221,11 +1441,11 @@ var AccordionItemContent = React29__namespace.forwardRef(function AccordionItemC
|
|
|
221
1441
|
);
|
|
222
1442
|
});
|
|
223
1443
|
function useAccordion(items) {
|
|
224
|
-
const [value, setValue] =
|
|
225
|
-
const onValueChange =
|
|
1444
|
+
const [value, setValue] = React33__namespace.useState([]);
|
|
1445
|
+
const onValueChange = React33__namespace.useCallback(({ value: value2 }) => {
|
|
226
1446
|
setValue(value2);
|
|
227
1447
|
}, []);
|
|
228
|
-
const scrollToItemFromUrl =
|
|
1448
|
+
const scrollToItemFromUrl = React33__namespace.useCallback(() => {
|
|
229
1449
|
const hash = window.location.hash.replace("#", "");
|
|
230
1450
|
if (!hash) {
|
|
231
1451
|
return;
|
|
@@ -239,7 +1459,7 @@ function useAccordion(items) {
|
|
|
239
1459
|
setValue([itemToScroll.id]);
|
|
240
1460
|
}
|
|
241
1461
|
}, [items]);
|
|
242
|
-
return
|
|
1462
|
+
return React33__namespace.useMemo(() => {
|
|
243
1463
|
return {
|
|
244
1464
|
value,
|
|
245
1465
|
onValueChange,
|
|
@@ -247,68 +1467,6 @@ function useAccordion(items) {
|
|
|
247
1467
|
};
|
|
248
1468
|
}, [value, onValueChange, scrollToItemFromUrl]);
|
|
249
1469
|
}
|
|
250
|
-
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";
|
|
251
|
-
var CloseButtonFrame = core.styled(core.View, {
|
|
252
|
-
name: "LuxCloseButton",
|
|
253
|
-
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Close" }),
|
|
254
|
-
role: "button",
|
|
255
|
-
cursor: "pointer",
|
|
256
|
-
display: "inline-flex",
|
|
257
|
-
alignItems: "center",
|
|
258
|
-
justifyContent: "center",
|
|
259
|
-
width: 20,
|
|
260
|
-
height: 20,
|
|
261
|
-
minWidth: 0,
|
|
262
|
-
flexShrink: 1,
|
|
263
|
-
padding: 0,
|
|
264
|
-
borderRadius: 4,
|
|
265
|
-
borderWidth: 0,
|
|
266
|
-
overflow: "hidden",
|
|
267
|
-
backgroundColor: "transparent",
|
|
268
|
-
hoverStyle: {
|
|
269
|
-
backgroundColor: "transparent"
|
|
270
|
-
},
|
|
271
|
-
variants: {
|
|
272
|
-
disabled: {
|
|
273
|
-
true: {
|
|
274
|
-
opacity: 0.4,
|
|
275
|
-
pointerEvents: "none"
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
var CLOSE_BUTTON_CLASSES = [
|
|
281
|
-
"text-[var(--closeButton-fg,currentColor)]",
|
|
282
|
-
"hover:text-[var(--hover-color,currentColor)]",
|
|
283
|
-
"disabled:opacity-40"
|
|
284
|
-
].join(" ");
|
|
285
|
-
var CloseButton = React29__namespace.forwardRef(function CloseButton2(props, ref) {
|
|
286
|
-
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
287
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
288
|
-
CloseButtonFrame,
|
|
289
|
-
{
|
|
290
|
-
ref,
|
|
291
|
-
className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
|
|
292
|
-
...rest,
|
|
293
|
-
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
294
|
-
"svg",
|
|
295
|
-
{
|
|
296
|
-
className: "size-5",
|
|
297
|
-
viewBox: "0 0 20 20",
|
|
298
|
-
fill: "none",
|
|
299
|
-
"aria-hidden": "true",
|
|
300
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
301
|
-
"path",
|
|
302
|
-
{
|
|
303
|
-
d: CLOSE_ICON_PATH,
|
|
304
|
-
fill: "currentColor"
|
|
305
|
-
}
|
|
306
|
-
)
|
|
307
|
-
}
|
|
308
|
-
)
|
|
309
|
-
}
|
|
310
|
-
);
|
|
311
|
-
});
|
|
312
1470
|
var SHIM_PROPS = [
|
|
313
1471
|
"w",
|
|
314
1472
|
"h",
|
|
@@ -429,7 +1587,7 @@ var SKELETON_CLASSES = [
|
|
|
429
1587
|
"bg-[length:200%_100%]"
|
|
430
1588
|
].join(" ");
|
|
431
1589
|
var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
|
|
432
|
-
var Skeleton =
|
|
1590
|
+
var Skeleton = React33__namespace.forwardRef(
|
|
433
1591
|
function Skeleton2(props, ref) {
|
|
434
1592
|
const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
|
|
435
1593
|
const shimStyle = shimToStyle(props);
|
|
@@ -438,10 +1596,10 @@ var Skeleton = React29__namespace.forwardRef(
|
|
|
438
1596
|
const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
|
|
439
1597
|
const htmlRest = stripShims(allRest);
|
|
440
1598
|
if (!loading) {
|
|
441
|
-
if (asChild &&
|
|
1599
|
+
if (asChild && React33__namespace.isValidElement(children)) return children;
|
|
442
1600
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
|
|
443
1601
|
}
|
|
444
|
-
if (asChild &&
|
|
1602
|
+
if (asChild && React33__namespace.isValidElement(children)) {
|
|
445
1603
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
446
1604
|
Component,
|
|
447
1605
|
{
|
|
@@ -467,7 +1625,7 @@ var Skeleton = React29__namespace.forwardRef(
|
|
|
467
1625
|
);
|
|
468
1626
|
}
|
|
469
1627
|
);
|
|
470
|
-
var SkeletonCircle =
|
|
1628
|
+
var SkeletonCircle = React33__namespace.forwardRef(
|
|
471
1629
|
function SkeletonCircle2(props, ref) {
|
|
472
1630
|
const { size = 40, loading = true, className, ...rest } = props;
|
|
473
1631
|
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
@@ -483,7 +1641,7 @@ var SkeletonCircle = React29__namespace.forwardRef(
|
|
|
483
1641
|
);
|
|
484
1642
|
}
|
|
485
1643
|
);
|
|
486
|
-
var SkeletonText =
|
|
1644
|
+
var SkeletonText = React33__namespace.forwardRef(
|
|
487
1645
|
function SkeletonText2(props, ref) {
|
|
488
1646
|
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
489
1647
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -505,7 +1663,7 @@ var STATUS_CLASSES = {
|
|
|
505
1663
|
success: "bg-[var(--color-alert-bg-success)]",
|
|
506
1664
|
error: "bg-[var(--color-alert-bg-error)]"
|
|
507
1665
|
};
|
|
508
|
-
var
|
|
1666
|
+
var SIZE_CLASSES2 = {
|
|
509
1667
|
sm: "gap-2 px-2 py-2 text-xs",
|
|
510
1668
|
md: "gap-2 px-3 py-2 text-base"
|
|
511
1669
|
};
|
|
@@ -513,7 +1671,7 @@ var INDICATOR_SIZE_CLASSES = {
|
|
|
513
1671
|
sm: "w-5 h-5 my-0",
|
|
514
1672
|
md: "w-5 h-5 my-[2px]"
|
|
515
1673
|
};
|
|
516
|
-
var Alert =
|
|
1674
|
+
var Alert = React33__namespace.forwardRef(
|
|
517
1675
|
function Alert2(props, ref) {
|
|
518
1676
|
const {
|
|
519
1677
|
title,
|
|
@@ -538,7 +1696,7 @@ var Alert = React29__namespace.forwardRef(
|
|
|
538
1696
|
if (_mb !== void 0) shimStyle.marginBottom = typeof _mb === "number" ? `${_mb * 4}px` : _mb;
|
|
539
1697
|
if (_mt !== void 0) shimStyle.marginTop = typeof _mt === "number" ? `${_mt * 4}px` : _mt;
|
|
540
1698
|
const alertStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
|
|
541
|
-
const [isOpen, setIsOpen] =
|
|
1699
|
+
const [isOpen, setIsOpen] = React33__namespace.useState(true);
|
|
542
1700
|
const resolvedSize = size ?? "md";
|
|
543
1701
|
const defaultIcon = /* @__PURE__ */ jsxRuntime.jsx(IndicatorIcon2, { className: "w-5 h-5" });
|
|
544
1702
|
const iconElement = (() => {
|
|
@@ -553,7 +1711,7 @@ var Alert = React29__namespace.forwardRef(
|
|
|
553
1711
|
INDICATOR_SIZE_CLASSES[resolvedSize]
|
|
554
1712
|
), children: icon || defaultIcon });
|
|
555
1713
|
})();
|
|
556
|
-
const handleClose =
|
|
1714
|
+
const handleClose = React33__namespace.useCallback(() => {
|
|
557
1715
|
setIsOpen(false);
|
|
558
1716
|
onClose?.();
|
|
559
1717
|
}, [onClose]);
|
|
@@ -584,7 +1742,7 @@ var Alert = React29__namespace.forwardRef(
|
|
|
584
1742
|
"div",
|
|
585
1743
|
{
|
|
586
1744
|
ref,
|
|
587
|
-
className: cn(ALERT_BASE, STATUS_CLASSES[status],
|
|
1745
|
+
className: cn(ALERT_BASE, STATUS_CLASSES[status], SIZE_CLASSES2[resolvedSize], className),
|
|
588
1746
|
style: alertStyle,
|
|
589
1747
|
...alertRest,
|
|
590
1748
|
children: [
|
|
@@ -614,7 +1772,7 @@ var Alert = React29__namespace.forwardRef(
|
|
|
614
1772
|
) });
|
|
615
1773
|
}
|
|
616
1774
|
);
|
|
617
|
-
var
|
|
1775
|
+
var SIZE_CLASSES3 = {
|
|
618
1776
|
xs: "h-6 w-6 text-[10px]",
|
|
619
1777
|
sm: "h-8 w-8 text-xs",
|
|
620
1778
|
md: "h-10 w-10 text-sm",
|
|
@@ -629,11 +1787,11 @@ var VARIANT_CLASSES = {
|
|
|
629
1787
|
};
|
|
630
1788
|
var DEFAULT_SIZE = "md";
|
|
631
1789
|
var DEFAULT_VARIANT = "subtle";
|
|
632
|
-
var AvatarGroupContext =
|
|
1790
|
+
var AvatarGroupContext = React33__namespace.createContext({});
|
|
633
1791
|
function useAvatarGroupContext() {
|
|
634
|
-
return
|
|
1792
|
+
return React33__namespace.useContext(AvatarGroupContext);
|
|
635
1793
|
}
|
|
636
|
-
var Avatar =
|
|
1794
|
+
var Avatar = React33__namespace.forwardRef(
|
|
637
1795
|
function Avatar2(props, ref) {
|
|
638
1796
|
const group = useAvatarGroupContext();
|
|
639
1797
|
const {
|
|
@@ -654,12 +1812,13 @@ var Avatar = React29__namespace.forwardRef(
|
|
|
654
1812
|
const variant = variantProp ?? group.variant ?? DEFAULT_VARIANT;
|
|
655
1813
|
const isBorderless = borderless ?? group.borderless ?? false;
|
|
656
1814
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
657
|
-
|
|
1815
|
+
gui.Avatar,
|
|
658
1816
|
{
|
|
659
1817
|
ref,
|
|
1818
|
+
unstyled: true,
|
|
660
1819
|
className: cn(
|
|
661
1820
|
"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full align-middle",
|
|
662
|
-
|
|
1821
|
+
SIZE_CLASSES3[size],
|
|
663
1822
|
VARIANT_CLASSES[variant],
|
|
664
1823
|
!isBorderless && "ring-2 ring-white dark:ring-gray-900",
|
|
665
1824
|
className
|
|
@@ -667,8 +1826,8 @@ var Avatar = React29__namespace.forwardRef(
|
|
|
667
1826
|
...rest,
|
|
668
1827
|
children: [
|
|
669
1828
|
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { name, icon, children: fallback }),
|
|
670
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
671
|
-
|
|
1829
|
+
src != null && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1830
|
+
gui.Avatar.Image,
|
|
672
1831
|
{
|
|
673
1832
|
className: "h-full w-full rounded-[inherit] object-cover",
|
|
674
1833
|
src,
|
|
@@ -683,13 +1842,14 @@ var Avatar = React29__namespace.forwardRef(
|
|
|
683
1842
|
);
|
|
684
1843
|
}
|
|
685
1844
|
);
|
|
686
|
-
var AvatarFallback =
|
|
1845
|
+
var AvatarFallback = React33__namespace.forwardRef(
|
|
687
1846
|
function AvatarFallback2(props, ref) {
|
|
688
1847
|
const { name, icon, children, className, ...rest } = props;
|
|
689
1848
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
690
|
-
|
|
1849
|
+
gui.Avatar.Fallback,
|
|
691
1850
|
{
|
|
692
1851
|
ref,
|
|
1852
|
+
unstyled: true,
|
|
693
1853
|
className: cn(
|
|
694
1854
|
"flex h-full w-full items-center justify-center font-medium",
|
|
695
1855
|
className
|
|
@@ -710,10 +1870,10 @@ function getInitials(name) {
|
|
|
710
1870
|
const lastName = names.length > 1 ? names[names.length - 1] : "";
|
|
711
1871
|
return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0);
|
|
712
1872
|
}
|
|
713
|
-
var AvatarGroup =
|
|
1873
|
+
var AvatarGroup = React33__namespace.forwardRef(
|
|
714
1874
|
function AvatarGroup2(props, ref) {
|
|
715
1875
|
const { size, variant, borderless, className, ...rest } = props;
|
|
716
|
-
const contextValue =
|
|
1876
|
+
const contextValue = React33__namespace.useMemo(
|
|
717
1877
|
() => ({ size, variant, borderless }),
|
|
718
1878
|
[size, variant, borderless]
|
|
719
1879
|
);
|
|
@@ -727,26 +1887,11 @@ var AvatarGroup = React29__namespace.forwardRef(
|
|
|
727
1887
|
) });
|
|
728
1888
|
}
|
|
729
1889
|
);
|
|
730
|
-
var LG_BREAKPOINT = 1024;
|
|
731
|
-
function useIsMobile() {
|
|
732
|
-
const [isMobile, setIsMobile] = React29__namespace.useState(() => {
|
|
733
|
-
if (typeof window === "undefined") return false;
|
|
734
|
-
return window.innerWidth < LG_BREAKPOINT;
|
|
735
|
-
});
|
|
736
|
-
React29__namespace.useEffect(() => {
|
|
737
|
-
const mql = window.matchMedia(`(max-width: ${LG_BREAKPOINT - 1}px)`);
|
|
738
|
-
const handler = (e) => setIsMobile(e.matches);
|
|
739
|
-
setIsMobile(mql.matches);
|
|
740
|
-
mql.addEventListener("change", handler);
|
|
741
|
-
return () => mql.removeEventListener("change", handler);
|
|
742
|
-
}, []);
|
|
743
|
-
return isMobile;
|
|
744
|
-
}
|
|
745
1890
|
function mapPlacement(p) {
|
|
746
1891
|
if (!p) return void 0;
|
|
747
1892
|
return p;
|
|
748
1893
|
}
|
|
749
|
-
var Tooltip =
|
|
1894
|
+
var Tooltip = React33__namespace.forwardRef(
|
|
750
1895
|
function Tooltip2(props, ref) {
|
|
751
1896
|
const {
|
|
752
1897
|
showArrow: showArrowProp,
|
|
@@ -765,28 +1910,28 @@ var Tooltip = React29__namespace.forwardRef(
|
|
|
765
1910
|
interactive,
|
|
766
1911
|
positioning
|
|
767
1912
|
} = props;
|
|
768
|
-
const [open, setOpen] =
|
|
769
|
-
const timeoutRef =
|
|
770
|
-
const isMobile =
|
|
771
|
-
const handleOpenChange =
|
|
1913
|
+
const [open, setOpen] = React33__namespace.useState(defaultOpen);
|
|
1914
|
+
const timeoutRef = React33__namespace.useRef(null);
|
|
1915
|
+
const isMobile = useIsTouch();
|
|
1916
|
+
const handleOpenChange = React33__namespace.useCallback((nextOpen) => {
|
|
772
1917
|
setOpen(nextOpen);
|
|
773
1918
|
onOpenChange?.({ open: nextOpen });
|
|
774
1919
|
}, [onOpenChange]);
|
|
775
|
-
const handleOpenChangeManual =
|
|
1920
|
+
const handleOpenChangeManual = React33__namespace.useCallback((nextOpen) => {
|
|
776
1921
|
timeoutRef.current && window.clearTimeout(timeoutRef.current);
|
|
777
1922
|
timeoutRef.current = window.setTimeout(() => {
|
|
778
1923
|
setOpen(nextOpen);
|
|
779
1924
|
onOpenChange?.({ open: nextOpen });
|
|
780
1925
|
}, nextOpen ? openDelay : closeDelay);
|
|
781
1926
|
}, [closeDelay, openDelay, onOpenChange]);
|
|
782
|
-
const handleClickAway =
|
|
1927
|
+
const handleClickAway = React33__namespace.useCallback(() => {
|
|
783
1928
|
handleOpenChangeManual(false);
|
|
784
1929
|
}, [handleOpenChangeManual]);
|
|
785
1930
|
const triggerRef = usehooks.useClickAway(handleClickAway);
|
|
786
|
-
const handleTriggerClick =
|
|
1931
|
+
const handleTriggerClick = React33__namespace.useCallback(() => {
|
|
787
1932
|
handleOpenChangeManual(!open);
|
|
788
1933
|
}, [handleOpenChangeManual, open]);
|
|
789
|
-
const handleContentClick =
|
|
1934
|
+
const handleContentClick = React33__namespace.useCallback((event) => {
|
|
790
1935
|
event.stopPropagation();
|
|
791
1936
|
if (interactive) {
|
|
792
1937
|
const closestLink = event.target?.closest("a");
|
|
@@ -795,7 +1940,7 @@ var Tooltip = React29__namespace.forwardRef(
|
|
|
795
1940
|
}
|
|
796
1941
|
}
|
|
797
1942
|
}, [interactive, handleOpenChangeManual]);
|
|
798
|
-
|
|
1943
|
+
React33__namespace.useEffect(() => {
|
|
799
1944
|
return () => {
|
|
800
1945
|
if (timeoutRef.current) {
|
|
801
1946
|
clearTimeout(timeoutRef.current);
|
|
@@ -808,8 +1953,8 @@ var Tooltip = React29__namespace.forwardRef(
|
|
|
808
1953
|
const isPopover = variant === "popover";
|
|
809
1954
|
const placement = mapPlacement(positioning?.placement) ?? "top";
|
|
810
1955
|
const offset = positioning?.offset?.mainAxis ?? 4;
|
|
811
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
812
|
-
|
|
1956
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.TooltipGroup, { delay: openDelay, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1957
|
+
gui.Tooltip,
|
|
813
1958
|
{
|
|
814
1959
|
open,
|
|
815
1960
|
onOpenChange: handleOpenChange,
|
|
@@ -819,7 +1964,7 @@ var Tooltip = React29__namespace.forwardRef(
|
|
|
819
1964
|
unstyled: true,
|
|
820
1965
|
children: [
|
|
821
1966
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
822
|
-
|
|
1967
|
+
gui.Tooltip.Trigger,
|
|
823
1968
|
{
|
|
824
1969
|
ref: open ? triggerRef : void 0,
|
|
825
1970
|
asChild: true,
|
|
@@ -829,7 +1974,7 @@ var Tooltip = React29__namespace.forwardRef(
|
|
|
829
1974
|
}
|
|
830
1975
|
),
|
|
831
1976
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
832
|
-
|
|
1977
|
+
gui.Tooltip.Content,
|
|
833
1978
|
{
|
|
834
1979
|
ref,
|
|
835
1980
|
unstyled: true,
|
|
@@ -846,7 +1991,7 @@ var Tooltip = React29__namespace.forwardRef(
|
|
|
846
1991
|
...contentProps,
|
|
847
1992
|
children: [
|
|
848
1993
|
showArrow && /* @__PURE__ */ jsxRuntime.jsx(
|
|
849
|
-
|
|
1994
|
+
gui.Tooltip.Arrow,
|
|
850
1995
|
{
|
|
851
1996
|
unstyled: true,
|
|
852
1997
|
className: cn(
|
|
@@ -867,7 +2012,7 @@ function TruncatedTextTooltip({ label, children }) {
|
|
|
867
2012
|
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
|
|
868
2013
|
}
|
|
869
2014
|
var BASE_CLASSES = "inline-flex items-center rounded-sm gap-1 font-medium w-fit max-w-full whitespace-nowrap select-text";
|
|
870
|
-
var
|
|
2015
|
+
var SIZE_CLASSES4 = {
|
|
871
2016
|
sm: "text-xs p-1 h-[18px] min-h-[18px]",
|
|
872
2017
|
md: "text-sm px-1 py-0.5 min-h-6",
|
|
873
2018
|
lg: "text-sm px-2 py-1 min-h-7 font-semibold"
|
|
@@ -897,7 +2042,7 @@ var COLOR_PALETTE_CLASSES = {
|
|
|
897
2042
|
bright_pink: "bg-badge-bright-pink-bg text-badge-bright-pink-fg"
|
|
898
2043
|
};
|
|
899
2044
|
var S2 = 4;
|
|
900
|
-
var Badge =
|
|
2045
|
+
var Badge = React33__namespace.default.forwardRef(
|
|
901
2046
|
function Badge2(props, ref) {
|
|
902
2047
|
const {
|
|
903
2048
|
loading,
|
|
@@ -937,7 +2082,7 @@ var Badge = React29__namespace.default.forwardRef(
|
|
|
937
2082
|
ref,
|
|
938
2083
|
className: cn(
|
|
939
2084
|
BASE_CLASSES,
|
|
940
|
-
|
|
2085
|
+
SIZE_CLASSES4[size],
|
|
941
2086
|
COLOR_PALETTE_CLASSES[colorPalette],
|
|
942
2087
|
className
|
|
943
2088
|
),
|
|
@@ -956,7 +2101,7 @@ var Badge = React29__namespace.default.forwardRef(
|
|
|
956
2101
|
return badgeElement;
|
|
957
2102
|
}
|
|
958
2103
|
);
|
|
959
|
-
var SpinnerFrame =
|
|
2104
|
+
var SpinnerFrame = gui.styled(gui.View, {
|
|
960
2105
|
name: "ButtonSpinner",
|
|
961
2106
|
render: /* @__PURE__ */ jsxRuntime.jsx("span", {}),
|
|
962
2107
|
width: 16,
|
|
@@ -980,7 +2125,7 @@ function Spinner({ className }) {
|
|
|
980
2125
|
}
|
|
981
2126
|
);
|
|
982
2127
|
}
|
|
983
|
-
var ButtonFrame =
|
|
2128
|
+
var ButtonFrame = gui.styled(gui.View, {
|
|
984
2129
|
name: "LuxButton",
|
|
985
2130
|
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
|
|
986
2131
|
role: "button",
|
|
@@ -1146,7 +2291,7 @@ function buildShimStyle(props) {
|
|
|
1146
2291
|
if (props.borderTopRightRadius !== void 0) s.borderTopRightRadius = typeof props.borderTopRightRadius === "number" ? `${props.borderTopRightRadius}px` : props.borderTopRightRadius;
|
|
1147
2292
|
return Object.keys(s).length > 0 ? s : void 0;
|
|
1148
2293
|
}
|
|
1149
|
-
var Button =
|
|
2294
|
+
var Button = React33__namespace.forwardRef(
|
|
1150
2295
|
function Button2(props, ref) {
|
|
1151
2296
|
const {
|
|
1152
2297
|
className,
|
|
@@ -1237,7 +2382,7 @@ var Button = React29__namespace.forwardRef(
|
|
|
1237
2382
|
return button;
|
|
1238
2383
|
}
|
|
1239
2384
|
);
|
|
1240
|
-
var
|
|
2385
|
+
var SIZE_CLASSES5 = {
|
|
1241
2386
|
"2xs": "px-2 h-5 min-w-5 text-xs rounded-sm gap-1",
|
|
1242
2387
|
xs: "px-2 h-6 min-w-6 text-sm rounded-sm gap-1",
|
|
1243
2388
|
sm: "px-3 h-8 min-w-8 text-sm rounded-md gap-1",
|
|
@@ -1246,9 +2391,9 @@ var SIZE_CLASSES4 = {
|
|
|
1246
2391
|
function buttonVariants(opts) {
|
|
1247
2392
|
const v = opts?.variant ?? "solid";
|
|
1248
2393
|
const s = opts?.size ?? "md";
|
|
1249
|
-
return [BASE_CLASSES2, VARIANT_CLASSES2[v] ?? "",
|
|
2394
|
+
return [BASE_CLASSES2, VARIANT_CLASSES2[v] ?? "", SIZE_CLASSES5[s] ?? ""].filter(Boolean).join(" ");
|
|
1250
2395
|
}
|
|
1251
|
-
var ButtonGroup =
|
|
2396
|
+
var ButtonGroup = React33__namespace.forwardRef(
|
|
1252
2397
|
function ButtonGroup2(props, ref) {
|
|
1253
2398
|
const { className, ...rest } = props;
|
|
1254
2399
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1262,7 +2407,7 @@ var ButtonGroup = React29__namespace.forwardRef(
|
|
|
1262
2407
|
);
|
|
1263
2408
|
}
|
|
1264
2409
|
);
|
|
1265
|
-
var ButtonGroupRadio =
|
|
2410
|
+
var ButtonGroupRadio = React33__namespace.forwardRef(
|
|
1266
2411
|
function ButtonGroupRadio2(props, ref) {
|
|
1267
2412
|
const {
|
|
1268
2413
|
children,
|
|
@@ -1274,24 +2419,24 @@ var ButtonGroupRadio = React29__namespace.forwardRef(
|
|
|
1274
2419
|
className,
|
|
1275
2420
|
...rest
|
|
1276
2421
|
} = props;
|
|
1277
|
-
const firstChildValue =
|
|
2422
|
+
const firstChildValue = React33__namespace.useMemo(() => {
|
|
1278
2423
|
const firstChild = Array.isArray(children) ? children[0] : void 0;
|
|
1279
2424
|
return typeof firstChild?.props.value === "string" ? firstChild.props.value : void 0;
|
|
1280
2425
|
}, [children]);
|
|
1281
|
-
const [value, setValue] =
|
|
1282
|
-
const handleItemClick =
|
|
2426
|
+
const [value, setValue] = React33__namespace.useState(defaultValue ?? firstChildValue);
|
|
2427
|
+
const handleItemClick = React33__namespace.useCallback((event) => {
|
|
1283
2428
|
const v = event.currentTarget.value;
|
|
1284
2429
|
setValue(v);
|
|
1285
2430
|
onChange?.(v);
|
|
1286
2431
|
}, [onChange]);
|
|
1287
|
-
const clonedChildren =
|
|
1288
|
-
return
|
|
2432
|
+
const clonedChildren = React33__namespace.Children.map(children, (child) => {
|
|
2433
|
+
return React33__namespace.cloneElement(child, {
|
|
1289
2434
|
onClick: handleItemClick,
|
|
1290
2435
|
selected: value === child.props.value,
|
|
1291
2436
|
variant
|
|
1292
2437
|
});
|
|
1293
2438
|
});
|
|
1294
|
-
const childrenLength =
|
|
2439
|
+
const childrenLength = React33__namespace.Children.count(children);
|
|
1295
2440
|
return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1296
2441
|
"div",
|
|
1297
2442
|
{
|
|
@@ -1311,11 +2456,11 @@ var ButtonGroupRadio = React29__namespace.forwardRef(
|
|
|
1311
2456
|
);
|
|
1312
2457
|
var NOOP = () => {
|
|
1313
2458
|
};
|
|
1314
|
-
var CheckboxGroupContext =
|
|
2459
|
+
var CheckboxGroupContext = React33__namespace.createContext(null);
|
|
1315
2460
|
function useCheckboxGroupContext() {
|
|
1316
|
-
return
|
|
2461
|
+
return React33__namespace.useContext(CheckboxGroupContext);
|
|
1317
2462
|
}
|
|
1318
|
-
var CheckboxGroupBase =
|
|
2463
|
+
var CheckboxGroupBase = React33__namespace.forwardRef(
|
|
1319
2464
|
function CheckboxGroup(props, ref) {
|
|
1320
2465
|
const {
|
|
1321
2466
|
children,
|
|
@@ -1327,10 +2472,10 @@ var CheckboxGroupBase = React29__namespace.forwardRef(
|
|
|
1327
2472
|
className,
|
|
1328
2473
|
...rest
|
|
1329
2474
|
} = props;
|
|
1330
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
2475
|
+
const [uncontrolledValue, setUncontrolledValue] = React33__namespace.useState(defaultValue ?? []);
|
|
1331
2476
|
const isControlled = controlledValue !== void 0;
|
|
1332
2477
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
1333
|
-
const toggle =
|
|
2478
|
+
const toggle = React33__namespace.useCallback(
|
|
1334
2479
|
(itemValue) => {
|
|
1335
2480
|
const next = value.includes(itemValue) ? value.filter((v) => v !== itemValue) : [...value, itemValue];
|
|
1336
2481
|
if (!isControlled) {
|
|
@@ -1340,12 +2485,12 @@ var CheckboxGroupBase = React29__namespace.forwardRef(
|
|
|
1340
2485
|
},
|
|
1341
2486
|
[value, isControlled, onValueChange]
|
|
1342
2487
|
);
|
|
1343
|
-
|
|
2488
|
+
React33__namespace.useEffect(() => {
|
|
1344
2489
|
if (isControlled) {
|
|
1345
2490
|
setUncontrolledValue(controlledValue);
|
|
1346
2491
|
}
|
|
1347
2492
|
}, [isControlled, controlledValue]);
|
|
1348
|
-
const ctx =
|
|
2493
|
+
const ctx = React33__namespace.useMemo(() => ({ value, toggle }), [value, toggle]);
|
|
1349
2494
|
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1350
2495
|
"div",
|
|
1351
2496
|
{
|
|
@@ -1363,7 +2508,7 @@ var CheckboxGroupBase = React29__namespace.forwardRef(
|
|
|
1363
2508
|
}
|
|
1364
2509
|
);
|
|
1365
2510
|
var CheckboxGroup2 = CheckboxGroupBase;
|
|
1366
|
-
var
|
|
2511
|
+
var SIZE_CLASSES6 = {
|
|
1367
2512
|
sm: {
|
|
1368
2513
|
root: "gap-1.5",
|
|
1369
2514
|
control: "h-3.5 w-3.5 rounded-sm",
|
|
@@ -1403,7 +2548,7 @@ var IndeterminateIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
1403
2548
|
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0H12V2H0V0Z", fill: "currentColor" })
|
|
1404
2549
|
}
|
|
1405
2550
|
);
|
|
1406
|
-
var CheckboxBase =
|
|
2551
|
+
var CheckboxBase = React33__namespace.forwardRef(
|
|
1407
2552
|
function Checkbox(props, ref) {
|
|
1408
2553
|
const {
|
|
1409
2554
|
icon,
|
|
@@ -1424,8 +2569,8 @@ var CheckboxBase = React29__namespace.forwardRef(
|
|
|
1424
2569
|
...rest
|
|
1425
2570
|
} = props;
|
|
1426
2571
|
const group = useCheckboxGroupContext();
|
|
1427
|
-
const hiddenInputRef =
|
|
1428
|
-
const setHiddenInputRef =
|
|
2572
|
+
const hiddenInputRef = React33__namespace.useRef(null);
|
|
2573
|
+
const setHiddenInputRef = React33__namespace.useCallback(
|
|
1429
2574
|
(node) => {
|
|
1430
2575
|
hiddenInputRef.current = node;
|
|
1431
2576
|
if (typeof ref === "function") {
|
|
@@ -1438,7 +2583,7 @@ var CheckboxBase = React29__namespace.forwardRef(
|
|
|
1438
2583
|
);
|
|
1439
2584
|
const isInGroup = group !== null && value !== void 0;
|
|
1440
2585
|
const groupChecked = isInGroup ? group.value.includes(value) : void 0;
|
|
1441
|
-
const [internalChecked, setInternalChecked] =
|
|
2586
|
+
const [internalChecked, setInternalChecked] = React33__namespace.useState(
|
|
1442
2587
|
defaultChecked ?? false
|
|
1443
2588
|
);
|
|
1444
2589
|
const isControlled = checkedProp !== void 0 || isInGroup;
|
|
@@ -1450,7 +2595,7 @@ var CheckboxBase = React29__namespace.forwardRef(
|
|
|
1450
2595
|
} else {
|
|
1451
2596
|
checkedState = internalChecked;
|
|
1452
2597
|
}
|
|
1453
|
-
const handleCheckedChange =
|
|
2598
|
+
const handleCheckedChange = React33__namespace.useCallback(
|
|
1454
2599
|
(nextChecked) => {
|
|
1455
2600
|
if (readOnly) return;
|
|
1456
2601
|
if (!isControlled) {
|
|
@@ -1473,7 +2618,7 @@ var CheckboxBase = React29__namespace.forwardRef(
|
|
|
1473
2618
|
},
|
|
1474
2619
|
[readOnly, isControlled, isInGroup, group, value, onCheckedChange, onChange]
|
|
1475
2620
|
);
|
|
1476
|
-
const sizeClasses2 =
|
|
2621
|
+
const sizeClasses2 = SIZE_CLASSES6[size];
|
|
1477
2622
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1478
2623
|
"label",
|
|
1479
2624
|
{
|
|
@@ -1491,8 +2636,9 @@ var CheckboxBase = React29__namespace.forwardRef(
|
|
|
1491
2636
|
...rest,
|
|
1492
2637
|
children: [
|
|
1493
2638
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1494
|
-
|
|
2639
|
+
gui.Checkbox,
|
|
1495
2640
|
{
|
|
2641
|
+
unstyled: true,
|
|
1496
2642
|
checked: checkedState,
|
|
1497
2643
|
onCheckedChange: handleCheckedChange,
|
|
1498
2644
|
disabled: disabled || readOnly,
|
|
@@ -1510,7 +2656,7 @@ var CheckboxBase = React29__namespace.forwardRef(
|
|
|
1510
2656
|
"transition-colors duration-150",
|
|
1511
2657
|
sizeClasses2.control
|
|
1512
2658
|
),
|
|
1513
|
-
children: icon ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2659
|
+
children: icon ?? /* @__PURE__ */ jsxRuntime.jsx(gui.Checkbox.Indicator, { className: cn("flex items-center justify-center", sizeClasses2.icon), children: checkedState === "indeterminate" ? /* @__PURE__ */ jsxRuntime.jsx(IndeterminateIcon, { className: sizeClasses2.icon }) : /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: sizeClasses2.icon }) })
|
|
1514
2660
|
}
|
|
1515
2661
|
),
|
|
1516
2662
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1614,7 +2760,7 @@ function resolveSpacing(v) {
|
|
|
1614
2760
|
}
|
|
1615
2761
|
return void 0;
|
|
1616
2762
|
}
|
|
1617
|
-
var Link =
|
|
2763
|
+
var Link = React33__namespace.default.forwardRef(
|
|
1618
2764
|
function Link2(props, ref) {
|
|
1619
2765
|
const {
|
|
1620
2766
|
external,
|
|
@@ -1703,7 +2849,7 @@ var Link = React29__namespace.default.forwardRef(
|
|
|
1703
2849
|
) });
|
|
1704
2850
|
}
|
|
1705
2851
|
);
|
|
1706
|
-
var LinkBox =
|
|
2852
|
+
var LinkBox = React33__namespace.default.forwardRef(
|
|
1707
2853
|
function LinkBox2(props, ref) {
|
|
1708
2854
|
const { className, ...rest } = props;
|
|
1709
2855
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1716,7 +2862,7 @@ var LinkBox = React29__namespace.default.forwardRef(
|
|
|
1716
2862
|
);
|
|
1717
2863
|
}
|
|
1718
2864
|
);
|
|
1719
|
-
var LinkOverlay =
|
|
2865
|
+
var LinkOverlay = React33__namespace.default.forwardRef(
|
|
1720
2866
|
function LinkOverlay2(props, ref) {
|
|
1721
2867
|
const {
|
|
1722
2868
|
children,
|
|
@@ -1797,8 +2943,8 @@ var LinkOverlay = React29__namespace.default.forwardRef(
|
|
|
1797
2943
|
}
|
|
1798
2944
|
);
|
|
1799
2945
|
function useUpdateEffect(effect, deps) {
|
|
1800
|
-
const isFirstMount =
|
|
1801
|
-
|
|
2946
|
+
const isFirstMount = React33__namespace.default.useRef(true);
|
|
2947
|
+
React33__namespace.default.useEffect(() => {
|
|
1802
2948
|
if (isFirstMount.current) {
|
|
1803
2949
|
isFirstMount.current = false;
|
|
1804
2950
|
return;
|
|
@@ -1815,8 +2961,8 @@ function scrollToElement(id) {
|
|
|
1815
2961
|
var CUT_ID = "CollapsibleDetails";
|
|
1816
2962
|
var CollapsibleDetails = (props) => {
|
|
1817
2963
|
const { children, id = CUT_ID, onClick, isExpanded: isExpandedProp = false, text: textProp, loading, noScroll, ...rest } = props;
|
|
1818
|
-
const [isExpanded, setIsExpanded] =
|
|
1819
|
-
const handleClick =
|
|
2964
|
+
const [isExpanded, setIsExpanded] = React33__namespace.default.useState(isExpandedProp);
|
|
2965
|
+
const handleClick = React33__namespace.default.useCallback((event) => {
|
|
1820
2966
|
setIsExpanded((flag) => !flag);
|
|
1821
2967
|
if (!noScroll) {
|
|
1822
2968
|
scrollToElement(id);
|
|
@@ -1847,11 +2993,11 @@ var CollapsibleDetails = (props) => {
|
|
|
1847
2993
|
var CollapsibleList = (props) => {
|
|
1848
2994
|
const CUT_LENGTH = 3;
|
|
1849
2995
|
const { items, renderItem, triggerProps, cutLength = CUT_LENGTH, text: textProp, defaultExpanded = false, className, ...rest } = props;
|
|
1850
|
-
const [isExpanded, setIsExpanded] =
|
|
1851
|
-
|
|
2996
|
+
const [isExpanded, setIsExpanded] = React33__namespace.default.useState(defaultExpanded);
|
|
2997
|
+
React33__namespace.default.useEffect(() => {
|
|
1852
2998
|
setIsExpanded(defaultExpanded);
|
|
1853
2999
|
}, [defaultExpanded]);
|
|
1854
|
-
const handleToggle =
|
|
3000
|
+
const handleToggle = React33__namespace.default.useCallback(() => {
|
|
1855
3001
|
setIsExpanded((flag) => !flag);
|
|
1856
3002
|
}, []);
|
|
1857
3003
|
const text = isExpanded ? textProp?.[1] ?? "Hide" : textProp?.[0] ?? "Show all";
|
|
@@ -1868,10 +3014,10 @@ var CollapsibleList = (props) => {
|
|
|
1868
3014
|
) })
|
|
1869
3015
|
] }) });
|
|
1870
3016
|
};
|
|
1871
|
-
var ColorModeContext =
|
|
3017
|
+
var ColorModeContext = React33__namespace.createContext(void 0);
|
|
1872
3018
|
function ColorModeProvider(props) {
|
|
1873
3019
|
const { children, defaultTheme = "light", value: controlledValue, onValueChange } = props;
|
|
1874
|
-
const [internalMode, setInternalMode] =
|
|
3020
|
+
const [internalMode, setInternalMode] = React33__namespace.useState(() => {
|
|
1875
3021
|
if (controlledValue === "dark" || controlledValue === "light") {
|
|
1876
3022
|
return controlledValue;
|
|
1877
3023
|
}
|
|
@@ -1881,7 +3027,7 @@ function ColorModeProvider(props) {
|
|
|
1881
3027
|
return defaultTheme === "dark" ? "dark" : "light";
|
|
1882
3028
|
});
|
|
1883
3029
|
const colorMode = controlledValue === "dark" || controlledValue === "light" ? controlledValue : internalMode;
|
|
1884
|
-
const setColorMode =
|
|
3030
|
+
const setColorMode = React33__namespace.useCallback((mode) => {
|
|
1885
3031
|
const resolved = mode === "dark" ? "dark" : "light";
|
|
1886
3032
|
setInternalMode(resolved);
|
|
1887
3033
|
onValueChange?.(resolved);
|
|
@@ -1890,19 +3036,19 @@ function ColorModeProvider(props) {
|
|
|
1890
3036
|
document.documentElement.classList.toggle("light", resolved === "light");
|
|
1891
3037
|
}
|
|
1892
3038
|
}, [onValueChange]);
|
|
1893
|
-
const toggleColorMode =
|
|
3039
|
+
const toggleColorMode = React33__namespace.useCallback(() => {
|
|
1894
3040
|
setColorMode(colorMode === "dark" ? "light" : "dark");
|
|
1895
3041
|
}, [colorMode, setColorMode]);
|
|
1896
|
-
const ctx =
|
|
3042
|
+
const ctx = React33__namespace.useMemo(
|
|
1897
3043
|
() => ({ colorMode, setColorMode, toggleColorMode }),
|
|
1898
3044
|
[colorMode, setColorMode, toggleColorMode]
|
|
1899
3045
|
);
|
|
1900
3046
|
return /* @__PURE__ */ jsxRuntime.jsx(ColorModeContext.Provider, { value: ctx, children });
|
|
1901
3047
|
}
|
|
1902
3048
|
function useColorMode() {
|
|
1903
|
-
const ctx =
|
|
3049
|
+
const ctx = React33__namespace.useContext(ColorModeContext);
|
|
1904
3050
|
if (!ctx) {
|
|
1905
|
-
const [mode, setMode] =
|
|
3051
|
+
const [mode, setMode] = React33__namespace.useState(() => {
|
|
1906
3052
|
if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
|
|
1907
3053
|
return "dark";
|
|
1908
3054
|
}
|
|
@@ -1946,9 +3092,9 @@ function BackToButton({ onClick }) {
|
|
|
1946
3092
|
}
|
|
1947
3093
|
);
|
|
1948
3094
|
}
|
|
1949
|
-
var DialogSizeContext =
|
|
3095
|
+
var DialogSizeContext = React33__namespace.createContext({ size: "md" });
|
|
1950
3096
|
function useDialogSizeContext() {
|
|
1951
|
-
return
|
|
3097
|
+
return React33__namespace.useContext(DialogSizeContext);
|
|
1952
3098
|
}
|
|
1953
3099
|
var CONTENT_SIZE_MAP = {
|
|
1954
3100
|
sm: "max-w-[400px]",
|
|
@@ -1980,15 +3126,15 @@ var DialogRoot = ({
|
|
|
1980
3126
|
modal = true
|
|
1981
3127
|
// motionPreset is intentionally unused -- kept for API compat
|
|
1982
3128
|
}) => {
|
|
1983
|
-
const handleOpenChange =
|
|
3129
|
+
const handleOpenChange = React33__namespace.useCallback(
|
|
1984
3130
|
(nextOpen) => {
|
|
1985
3131
|
onOpenChange?.({ open: nextOpen });
|
|
1986
3132
|
},
|
|
1987
3133
|
[onOpenChange]
|
|
1988
3134
|
);
|
|
1989
|
-
const ctx =
|
|
3135
|
+
const ctx = React33__namespace.useMemo(() => ({ size }), [size]);
|
|
1990
3136
|
return /* @__PURE__ */ jsxRuntime.jsx(DialogSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1991
|
-
|
|
3137
|
+
gui.Dialog,
|
|
1992
3138
|
{
|
|
1993
3139
|
open,
|
|
1994
3140
|
defaultOpen,
|
|
@@ -1998,7 +3144,7 @@ var DialogRoot = ({
|
|
|
1998
3144
|
}
|
|
1999
3145
|
) });
|
|
2000
3146
|
};
|
|
2001
|
-
var DialogContent =
|
|
3147
|
+
var DialogContent = React33__namespace.forwardRef(function DialogContent2(props, ref) {
|
|
2002
3148
|
const {
|
|
2003
3149
|
children,
|
|
2004
3150
|
portalled: _portalled = true,
|
|
@@ -2014,9 +3160,9 @@ var DialogContent = React29__namespace.forwardRef(function DialogContent2(props,
|
|
|
2014
3160
|
..._paddingTop !== void 0 ? { paddingTop: typeof _paddingTop === "number" ? `${_paddingTop * 4}px` : _paddingTop } : {}
|
|
2015
3161
|
};
|
|
2016
3162
|
const { size } = useDialogSizeContext();
|
|
2017
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3163
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.Dialog.Portal, { children: [
|
|
2018
3164
|
backdrop && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2019
|
-
|
|
3165
|
+
gui.Dialog.Overlay,
|
|
2020
3166
|
{
|
|
2021
3167
|
unstyled: true,
|
|
2022
3168
|
className: "fixed inset-0 z-[1400] bg-black/80"
|
|
@@ -2031,7 +3177,7 @@ var DialogContent = React29__namespace.forwardRef(function DialogContent2(props,
|
|
|
2031
3177
|
"overflow-hidden"
|
|
2032
3178
|
),
|
|
2033
3179
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2034
|
-
|
|
3180
|
+
gui.Dialog.Content,
|
|
2035
3181
|
{
|
|
2036
3182
|
ref,
|
|
2037
3183
|
unstyled: true,
|
|
@@ -2055,11 +3201,11 @@ var DialogContent = React29__namespace.forwardRef(function DialogContent2(props,
|
|
|
2055
3201
|
)
|
|
2056
3202
|
] });
|
|
2057
3203
|
});
|
|
2058
|
-
var DialogCloseTrigger =
|
|
3204
|
+
var DialogCloseTrigger = React33__namespace.forwardRef(function DialogCloseTrigger2(props, ref) {
|
|
2059
3205
|
const { className, ...rest } = props;
|
|
2060
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3206
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
|
|
2061
3207
|
});
|
|
2062
|
-
var DialogHeader =
|
|
3208
|
+
var DialogHeader = React33__namespace.forwardRef(function DialogHeader2(props, ref) {
|
|
2063
3209
|
const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
|
|
2064
3210
|
const startElement = startElementProp ?? (onBackToClick ? /* @__PURE__ */ jsxRuntime.jsx(BackToButton, { onClick: onBackToClick }) : void 0);
|
|
2065
3211
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2074,7 +3220,7 @@ var DialogHeader = React29__namespace.forwardRef(function DialogHeader2(props, r
|
|
|
2074
3220
|
children: [
|
|
2075
3221
|
startElement,
|
|
2076
3222
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2077
|
-
|
|
3223
|
+
gui.Dialog.Title,
|
|
2078
3224
|
{
|
|
2079
3225
|
unstyled: true,
|
|
2080
3226
|
className: cn(
|
|
@@ -2089,7 +3235,7 @@ var DialogHeader = React29__namespace.forwardRef(function DialogHeader2(props, r
|
|
|
2089
3235
|
}
|
|
2090
3236
|
);
|
|
2091
3237
|
});
|
|
2092
|
-
var DialogBody =
|
|
3238
|
+
var DialogBody = React33__namespace.forwardRef(function DialogBody2({ className, pt, display, flexDir, style: styleProp, ...props }, ref) {
|
|
2093
3239
|
const bodyStyle = {
|
|
2094
3240
|
...styleProp,
|
|
2095
3241
|
...pt !== void 0 ? { paddingTop: typeof pt === "number" ? `${pt * 4}px` : pt } : {},
|
|
@@ -2106,7 +3252,7 @@ var DialogBody = React29__namespace.forwardRef(function DialogBody2({ className,
|
|
|
2106
3252
|
}
|
|
2107
3253
|
);
|
|
2108
3254
|
});
|
|
2109
|
-
var DialogFooter =
|
|
3255
|
+
var DialogFooter = React33__namespace.forwardRef(function DialogFooter2({ className, ...props }, ref) {
|
|
2110
3256
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2111
3257
|
"div",
|
|
2112
3258
|
{
|
|
@@ -2116,140 +3262,17 @@ var DialogFooter = React29__namespace.forwardRef(function DialogFooter2({ classN
|
|
|
2116
3262
|
}
|
|
2117
3263
|
);
|
|
2118
3264
|
});
|
|
2119
|
-
var DialogBackdrop =
|
|
2120
|
-
var DialogTitle =
|
|
2121
|
-
var DialogDescription =
|
|
2122
|
-
var DialogTrigger =
|
|
2123
|
-
var DialogActionTrigger =
|
|
2124
|
-
var DrawerPlacementContext = React29__namespace.createContext("right");
|
|
2125
|
-
var DrawerSizeContext = React29__namespace.createContext("md");
|
|
2126
|
-
var DrawerRoot = (props) => {
|
|
2127
|
-
const {
|
|
2128
|
-
children,
|
|
2129
|
-
open,
|
|
2130
|
-
defaultOpen,
|
|
2131
|
-
onOpenChange,
|
|
2132
|
-
placement = "right",
|
|
2133
|
-
modal = true,
|
|
2134
|
-
size = "md"
|
|
2135
|
-
} = props;
|
|
2136
|
-
const handleOpenChange = React29__namespace.useCallback((nextOpen) => {
|
|
2137
|
-
onOpenChange?.({ open: nextOpen });
|
|
2138
|
-
}, [onOpenChange]);
|
|
2139
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsxRuntime.jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2140
|
-
RadixDialog__namespace.Root,
|
|
2141
|
-
{
|
|
2142
|
-
open,
|
|
2143
|
-
defaultOpen,
|
|
2144
|
-
onOpenChange: handleOpenChange,
|
|
2145
|
-
modal,
|
|
2146
|
-
children
|
|
2147
|
-
}
|
|
2148
|
-
) }) });
|
|
2149
|
-
};
|
|
2150
|
-
var PLACEMENT_CLASSES = {
|
|
2151
|
-
right: [
|
|
2152
|
-
"inset-y-0 right-0",
|
|
2153
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
|
|
2154
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
|
|
2155
|
-
].join(" "),
|
|
2156
|
-
left: [
|
|
2157
|
-
"inset-y-0 left-0",
|
|
2158
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
|
|
2159
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
|
|
2160
|
-
].join(" "),
|
|
2161
|
-
top: [
|
|
2162
|
-
"inset-x-0 top-0",
|
|
2163
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
|
|
2164
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
|
|
2165
|
-
].join(" "),
|
|
2166
|
-
bottom: [
|
|
2167
|
-
"inset-x-0 bottom-0",
|
|
2168
|
-
"data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
|
|
2169
|
-
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
|
|
2170
|
-
].join(" ")
|
|
2171
|
-
};
|
|
2172
|
-
var SIZE_CLASSES6 = {
|
|
2173
|
-
right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
2174
|
-
left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
|
|
2175
|
-
top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
|
|
2176
|
-
bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
|
|
2177
|
-
};
|
|
2178
|
-
var DrawerContent = React29__namespace.forwardRef(
|
|
2179
|
-
function DrawerContent2(props, ref) {
|
|
2180
|
-
const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
|
|
2181
|
-
const placement = React29__namespace.useContext(DrawerPlacementContext);
|
|
2182
|
-
const size = React29__namespace.useContext(DrawerSizeContext);
|
|
2183
|
-
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2184
|
-
backdrop && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2185
|
-
RadixDialog__namespace.Overlay,
|
|
2186
|
-
{
|
|
2187
|
-
className: cn(
|
|
2188
|
-
"fixed inset-0 z-50 bg-black/50",
|
|
2189
|
-
"data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
2190
|
-
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
|
|
2191
|
-
)
|
|
2192
|
-
}
|
|
2193
|
-
),
|
|
2194
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2195
|
-
RadixDialog__namespace.Content,
|
|
2196
|
-
{
|
|
2197
|
-
ref,
|
|
2198
|
-
className: cn(
|
|
2199
|
-
"fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
|
|
2200
|
-
PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
|
|
2201
|
-
SIZE_CLASSES6[placement]?.[size] ?? SIZE_CLASSES6.right?.md,
|
|
2202
|
-
className
|
|
2203
|
-
),
|
|
2204
|
-
...rest,
|
|
2205
|
-
children
|
|
2206
|
-
}
|
|
2207
|
-
)
|
|
2208
|
-
] });
|
|
2209
|
-
if (portalled) {
|
|
2210
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
2211
|
-
}
|
|
2212
|
-
return content;
|
|
2213
|
-
}
|
|
2214
|
-
);
|
|
2215
|
-
var DrawerCloseTrigger = React29__namespace.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
2216
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2217
|
-
CloseButton,
|
|
2218
|
-
{
|
|
2219
|
-
ref,
|
|
2220
|
-
className: cn("absolute top-7 right-5", props.className),
|
|
2221
|
-
...props
|
|
2222
|
-
}
|
|
2223
|
-
) });
|
|
2224
|
-
});
|
|
2225
|
-
var DrawerTrigger = (props) => {
|
|
2226
|
-
const { asChild = true, ...rest } = props;
|
|
2227
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Trigger, { asChild, ...rest });
|
|
2228
|
-
};
|
|
2229
|
-
var DrawerHeader = React29__namespace.forwardRef(
|
|
2230
|
-
function DrawerHeader2({ className, ...props }, ref) {
|
|
2231
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
|
|
2232
|
-
}
|
|
2233
|
-
);
|
|
2234
|
-
var DrawerBody = React29__namespace.forwardRef(
|
|
2235
|
-
function DrawerBody2({ className, ...props }, ref) {
|
|
2236
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
|
|
2237
|
-
}
|
|
2238
|
-
);
|
|
2239
|
-
var DrawerFooter = React29__namespace.forwardRef(
|
|
2240
|
-
function DrawerFooter2({ className, ...props }, ref) {
|
|
2241
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
|
|
2242
|
-
}
|
|
2243
|
-
);
|
|
2244
|
-
var DrawerTitle = RadixDialog__namespace.Title;
|
|
2245
|
-
var DrawerDescription = RadixDialog__namespace.Description;
|
|
2246
|
-
var DrawerActionTrigger = RadixDialog__namespace.Close;
|
|
3265
|
+
var DialogBackdrop = gui.Dialog.Overlay;
|
|
3266
|
+
var DialogTitle = gui.Dialog.Title;
|
|
3267
|
+
var DialogDescription = gui.Dialog.Description;
|
|
3268
|
+
var DialogTrigger = gui.Dialog.Trigger;
|
|
3269
|
+
var DialogActionTrigger = gui.Dialog.Close;
|
|
2247
3270
|
var apos = "\u2019";
|
|
2248
3271
|
function upperFirst(str) {
|
|
2249
3272
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2250
3273
|
}
|
|
2251
3274
|
var ICONS = {};
|
|
2252
|
-
var EmptyState =
|
|
3275
|
+
var EmptyState = React33__namespace.forwardRef(
|
|
2253
3276
|
function EmptyState2(props, ref) {
|
|
2254
3277
|
const { title, description, term, type = "query", icon, children, className, ...rest } = props;
|
|
2255
3278
|
const titleContent = (() => {
|
|
@@ -2309,7 +3332,7 @@ function getComponentDisplayName(type) {
|
|
|
2309
3332
|
if ("displayName" in type) return type.displayName;
|
|
2310
3333
|
return void 0;
|
|
2311
3334
|
}
|
|
2312
|
-
var Field =
|
|
3335
|
+
var Field = React33__namespace.forwardRef(
|
|
2313
3336
|
function Field2(props, ref) {
|
|
2314
3337
|
const {
|
|
2315
3338
|
label,
|
|
@@ -2361,14 +3384,14 @@ var Field = React29__namespace.forwardRef(
|
|
|
2361
3384
|
}
|
|
2362
3385
|
);
|
|
2363
3386
|
const helperTextElement = helperText ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1.5 text-xs text-[var(--color-text-secondary,theme(colors.gray.400))]", children: helperText }) : null;
|
|
2364
|
-
const child2 =
|
|
3387
|
+
const child2 = React33__namespace.Children.only(children);
|
|
2365
3388
|
const isInputGroup = getComponentDisplayName(child2.type) === "InputGroup";
|
|
2366
3389
|
if (isInputGroup) {
|
|
2367
|
-
const inputElement2 =
|
|
2368
|
-
|
|
3390
|
+
const inputElement2 = React33__namespace.cloneElement(
|
|
3391
|
+
React33__namespace.Children.only(child2.props.children),
|
|
2369
3392
|
injectedProps2
|
|
2370
3393
|
);
|
|
2371
|
-
const groupInputElement =
|
|
3394
|
+
const groupInputElement = React33__namespace.cloneElement(
|
|
2372
3395
|
child2,
|
|
2373
3396
|
{},
|
|
2374
3397
|
inputElement2,
|
|
@@ -2391,7 +3414,7 @@ var Field = React29__namespace.forwardRef(
|
|
|
2391
3414
|
}
|
|
2392
3415
|
);
|
|
2393
3416
|
}
|
|
2394
|
-
const inputElement =
|
|
3417
|
+
const inputElement = React33__namespace.cloneElement(child2, injectedProps2);
|
|
2395
3418
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2396
3419
|
"div",
|
|
2397
3420
|
{
|
|
@@ -2413,8 +3436,8 @@ var Field = React29__namespace.forwardRef(
|
|
|
2413
3436
|
const injectedProps = {
|
|
2414
3437
|
size
|
|
2415
3438
|
};
|
|
2416
|
-
const child =
|
|
2417
|
-
const clonedChild =
|
|
3439
|
+
const child = React33__namespace.Children.only(children);
|
|
3440
|
+
const clonedChild = React33__namespace.cloneElement(child, injectedProps);
|
|
2418
3441
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2419
3442
|
"div",
|
|
2420
3443
|
{
|
|
@@ -2450,22 +3473,23 @@ var Field = React29__namespace.forwardRef(
|
|
|
2450
3473
|
);
|
|
2451
3474
|
}
|
|
2452
3475
|
);
|
|
2453
|
-
var LEVEL_TAG = { "1":
|
|
3476
|
+
var LEVEL_TAG = { "1": gui.H1, "2": gui.H2, "3": gui.H3 };
|
|
2454
3477
|
var LEVEL_CLASSES = {
|
|
2455
3478
|
"1": "text-[18px] leading-[24px] font-medium lg:text-[32px] lg:leading-[40px] lg:tracking-[-0.5px]",
|
|
2456
3479
|
"2": "text-[16px] leading-[24px] font-medium lg:text-[24px] lg:leading-[32px]",
|
|
2457
3480
|
"3": "text-[14px] leading-[20px] font-semibold lg:text-[18px] lg:leading-[24px] lg:font-medium"
|
|
2458
3481
|
};
|
|
2459
3482
|
var BASE_CLASSES4 = "font-heading text-heading";
|
|
2460
|
-
var Heading =
|
|
3483
|
+
var Heading = React33__namespace.default.forwardRef(
|
|
2461
3484
|
function Heading2({ level, className, mb, size: _size, style: styleProp, ...rest }, ref) {
|
|
2462
|
-
const Tag3 = level ? LEVEL_TAG[level] :
|
|
3485
|
+
const Tag3 = level ? LEVEL_TAG[level] : gui.H2;
|
|
2463
3486
|
const levelClasses = level ? LEVEL_CLASSES[level] : void 0;
|
|
2464
3487
|
const mergedStyle = mb !== void 0 ? { ...styleProp, marginBottom: typeof mb === "number" ? `${mb * 4}px` : mb } : styleProp;
|
|
2465
3488
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2466
3489
|
Tag3,
|
|
2467
3490
|
{
|
|
2468
3491
|
ref,
|
|
3492
|
+
unstyled: true,
|
|
2469
3493
|
className: cn(BASE_CLASSES4, levelClasses, className),
|
|
2470
3494
|
style: mergedStyle,
|
|
2471
3495
|
...rest
|
|
@@ -2473,7 +3497,7 @@ var Heading = React29__namespace.default.forwardRef(
|
|
|
2473
3497
|
);
|
|
2474
3498
|
}
|
|
2475
3499
|
);
|
|
2476
|
-
var IconButtonFrame =
|
|
3500
|
+
var IconButtonFrame = gui.styled(gui.View, {
|
|
2477
3501
|
name: "LuxIconButton",
|
|
2478
3502
|
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
|
|
2479
3503
|
role: "button",
|
|
@@ -2543,7 +3567,7 @@ var ICON_SIZE_CLASSES = {
|
|
|
2543
3567
|
md: "[&_svg]:size-5"
|
|
2544
3568
|
};
|
|
2545
3569
|
var SP2 = 4;
|
|
2546
|
-
var IconButton =
|
|
3570
|
+
var IconButton = React33__namespace.forwardRef(
|
|
2547
3571
|
function IconButton2(props, ref) {
|
|
2548
3572
|
const {
|
|
2549
3573
|
size,
|
|
@@ -2594,7 +3618,7 @@ var IconButton = React29__namespace.forwardRef(
|
|
|
2594
3618
|
ref,
|
|
2595
3619
|
size,
|
|
2596
3620
|
disabled: !loadingSkeleton && (loading || disabled) || void 0,
|
|
2597
|
-
render: _as ?
|
|
3621
|
+
render: _as ? React33__namespace.createElement(_as) : void 0,
|
|
2598
3622
|
className: combinedClassName,
|
|
2599
3623
|
style: mergedStyle,
|
|
2600
3624
|
...expanded ? { "data-expanded": true } : {},
|
|
@@ -2765,31 +3789,31 @@ function extractStyleProps(props) {
|
|
|
2765
3789
|
}
|
|
2766
3790
|
return { styleProps, rest };
|
|
2767
3791
|
}
|
|
2768
|
-
var
|
|
2769
|
-
function
|
|
3792
|
+
var Image = React33__namespace.default.forwardRef(
|
|
3793
|
+
function Image2(props, ref) {
|
|
2770
3794
|
const { fallback, src, onLoad, onError, skeletonWidth, skeletonHeight, alt, className, style: styleProp, ...allRest } = props;
|
|
2771
3795
|
const { styleProps, rest: extraProps } = extractStyleProps(allRest);
|
|
2772
|
-
const [loading, setLoading] =
|
|
2773
|
-
const [error, setError] =
|
|
2774
|
-
const handleLoadError =
|
|
3796
|
+
const [loading, setLoading] = React33__namespace.default.useState(true);
|
|
3797
|
+
const [error, setError] = React33__namespace.default.useState(false);
|
|
3798
|
+
const handleLoadError = React33__namespace.default.useCallback((event) => {
|
|
2775
3799
|
setError(true);
|
|
2776
3800
|
setLoading(false);
|
|
2777
3801
|
onError?.(event);
|
|
2778
3802
|
}, [onError]);
|
|
2779
|
-
const handleLoadSuccess =
|
|
3803
|
+
const handleLoadSuccess = React33__namespace.default.useCallback((event) => {
|
|
2780
3804
|
setLoading(false);
|
|
2781
3805
|
onLoad?.(event);
|
|
2782
3806
|
}, [onLoad]);
|
|
2783
3807
|
const passthroughProps = allRest;
|
|
2784
3808
|
if (!src && fallback) {
|
|
2785
|
-
if (
|
|
2786
|
-
return
|
|
3809
|
+
if (React33__namespace.default.isValidElement(fallback)) {
|
|
3810
|
+
return React33__namespace.default.cloneElement(fallback, passthroughProps);
|
|
2787
3811
|
}
|
|
2788
3812
|
return fallback;
|
|
2789
3813
|
}
|
|
2790
3814
|
if (error) {
|
|
2791
|
-
if (
|
|
2792
|
-
return
|
|
3815
|
+
if (React33__namespace.default.isValidElement(fallback)) {
|
|
3816
|
+
return React33__namespace.default.cloneElement(fallback, passthroughProps);
|
|
2793
3817
|
}
|
|
2794
3818
|
return fallback;
|
|
2795
3819
|
}
|
|
@@ -2845,14 +3869,23 @@ var INPUT_VARIANT_CLASSES = {
|
|
|
2845
3869
|
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
2846
3870
|
unstyled: "border-0 bg-transparent p-0 h-auto"
|
|
2847
3871
|
};
|
|
2848
|
-
var Input =
|
|
2849
|
-
({ size = "md", variant = "outline", className, ...rest }, ref) => {
|
|
3872
|
+
var Input = React33__namespace.default.forwardRef(
|
|
3873
|
+
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
3874
|
+
const handleChange = React33__namespace.default.useCallback(
|
|
3875
|
+
(event) => {
|
|
3876
|
+
onChange?.(event);
|
|
3877
|
+
onChangeText?.(event.target.value);
|
|
3878
|
+
},
|
|
3879
|
+
[onChange, onChangeText]
|
|
3880
|
+
);
|
|
2850
3881
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2851
|
-
|
|
3882
|
+
gui.Input,
|
|
2852
3883
|
{
|
|
2853
3884
|
ref,
|
|
3885
|
+
unstyled: true,
|
|
2854
3886
|
className: cn(INPUT_BASE, INPUT_SIZE_CLASSES[size], INPUT_VARIANT_CLASSES[variant], className),
|
|
2855
|
-
...rest
|
|
3887
|
+
...rest,
|
|
3888
|
+
onChange: handleChange
|
|
2856
3889
|
}
|
|
2857
3890
|
);
|
|
2858
3891
|
}
|
|
@@ -2863,7 +3896,7 @@ function getComponentDisplayName2(type) {
|
|
|
2863
3896
|
if ("displayName" in type) return type.displayName;
|
|
2864
3897
|
return void 0;
|
|
2865
3898
|
}
|
|
2866
|
-
var InputGroup =
|
|
3899
|
+
var InputGroup = React33__namespace.forwardRef(
|
|
2867
3900
|
function InputGroup2(props, ref) {
|
|
2868
3901
|
const {
|
|
2869
3902
|
startElement,
|
|
@@ -2876,11 +3909,11 @@ var InputGroup = React29__namespace.forwardRef(
|
|
|
2876
3909
|
className,
|
|
2877
3910
|
...rest
|
|
2878
3911
|
} = props;
|
|
2879
|
-
const startElementRef =
|
|
2880
|
-
const endElementRef =
|
|
2881
|
-
const groupRef =
|
|
2882
|
-
const [inlinePaddings, setInlinePaddings] =
|
|
2883
|
-
const calculateInlinePaddings =
|
|
3912
|
+
const startElementRef = React33__namespace.useRef(null);
|
|
3913
|
+
const endElementRef = React33__namespace.useRef(null);
|
|
3914
|
+
const groupRef = React33__namespace.useRef(null);
|
|
3915
|
+
const [inlinePaddings, setInlinePaddings] = React33__namespace.useState();
|
|
3916
|
+
const calculateInlinePaddings = React33__namespace.useCallback(() => {
|
|
2884
3917
|
const startWidth = startElementRef.current?.getBoundingClientRect().width ?? 0;
|
|
2885
3918
|
const endWidth = endElementRef.current?.getBoundingClientRect().width ?? 0;
|
|
2886
3919
|
setInlinePaddings({
|
|
@@ -2888,7 +3921,7 @@ var InputGroup = React29__namespace.forwardRef(
|
|
|
2888
3921
|
end: endWidth
|
|
2889
3922
|
});
|
|
2890
3923
|
}, []);
|
|
2891
|
-
|
|
3924
|
+
React33__namespace.useEffect(() => {
|
|
2892
3925
|
if (!groupRef.current) return;
|
|
2893
3926
|
let timeoutId;
|
|
2894
3927
|
const intersectionObserver = new IntersectionObserver(
|
|
@@ -2908,7 +3941,7 @@ var InputGroup = React29__namespace.forwardRef(
|
|
|
2908
3941
|
}
|
|
2909
3942
|
};
|
|
2910
3943
|
}, [calculateInlinePaddings]);
|
|
2911
|
-
|
|
3944
|
+
React33__namespace.useEffect(() => {
|
|
2912
3945
|
calculateInlinePaddings();
|
|
2913
3946
|
const resizeHandler = esToolkit.debounce(calculateInlinePaddings, 300);
|
|
2914
3947
|
const resizeObserver = new ResizeObserver(resizeHandler);
|
|
@@ -2919,7 +3952,7 @@ var InputGroup = React29__namespace.forwardRef(
|
|
|
2919
3952
|
resizeObserver.disconnect();
|
|
2920
3953
|
};
|
|
2921
3954
|
}, [calculateInlinePaddings]);
|
|
2922
|
-
const combinedRef =
|
|
3955
|
+
const combinedRef = React33__namespace.useCallback((node) => {
|
|
2923
3956
|
groupRef.current = node;
|
|
2924
3957
|
if (typeof ref === "function") {
|
|
2925
3958
|
ref(node);
|
|
@@ -2948,11 +3981,11 @@ var InputGroup = React29__namespace.forwardRef(
|
|
|
2948
3981
|
children: startElement
|
|
2949
3982
|
}
|
|
2950
3983
|
),
|
|
2951
|
-
|
|
3984
|
+
React33__namespace.Children.map(children, (child) => {
|
|
2952
3985
|
if (getComponentDisplayName2(child.type) !== "FieldInput") {
|
|
2953
3986
|
return child;
|
|
2954
3987
|
}
|
|
2955
|
-
return
|
|
3988
|
+
return React33__namespace.cloneElement(child, {
|
|
2956
3989
|
...startElement && { ps: startOffset ?? (inlinePaddings?.start ? `${inlinePaddings.start}px` : void 0) },
|
|
2957
3990
|
...endElement && { pe: endOffset ?? (inlinePaddings?.end ? `${inlinePaddings.end}px` : void 0) },
|
|
2958
3991
|
// hide input value and placeholder for the first render
|
|
@@ -2978,262 +4011,6 @@ var InputGroup = React29__namespace.forwardRef(
|
|
|
2978
4011
|
}
|
|
2979
4012
|
);
|
|
2980
4013
|
InputGroup.displayName = "InputGroup";
|
|
2981
|
-
function parsePlacement(placement) {
|
|
2982
|
-
if (!placement) {
|
|
2983
|
-
return { side: "bottom", align: "start" };
|
|
2984
|
-
}
|
|
2985
|
-
const parts = placement.split("-");
|
|
2986
|
-
const side = parts[0] ?? "bottom";
|
|
2987
|
-
const alignPart = parts[1];
|
|
2988
|
-
let align = "center";
|
|
2989
|
-
if (alignPart === "start") {
|
|
2990
|
-
align = "start";
|
|
2991
|
-
} else if (alignPart === "end") {
|
|
2992
|
-
align = "end";
|
|
2993
|
-
}
|
|
2994
|
-
return { side, align };
|
|
2995
|
-
}
|
|
2996
|
-
var PositioningContext = React29__namespace.createContext({
|
|
2997
|
-
side: "bottom",
|
|
2998
|
-
align: "start",
|
|
2999
|
-
sideOffset: 4,
|
|
3000
|
-
alignOffset: 0
|
|
3001
|
-
});
|
|
3002
|
-
var MenuRoot = (props) => {
|
|
3003
|
-
const {
|
|
3004
|
-
children,
|
|
3005
|
-
open,
|
|
3006
|
-
defaultOpen,
|
|
3007
|
-
onOpenChange,
|
|
3008
|
-
positioning,
|
|
3009
|
-
modal = true,
|
|
3010
|
-
// lazyMount / unmountOnExit have no direct Radix equivalent; Radix handles
|
|
3011
|
-
// mount/unmount automatically.
|
|
3012
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3013
|
-
lazyMount: _lazyMount,
|
|
3014
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3015
|
-
unmountOnExit: _unmountOnExit
|
|
3016
|
-
} = props;
|
|
3017
|
-
const mergedPositioning = {
|
|
3018
|
-
placement: "bottom-start",
|
|
3019
|
-
...positioning,
|
|
3020
|
-
offset: {
|
|
3021
|
-
mainAxis: 4,
|
|
3022
|
-
...positioning?.offset
|
|
3023
|
-
}
|
|
3024
|
-
};
|
|
3025
|
-
const { side, align } = parsePlacement(mergedPositioning.placement);
|
|
3026
|
-
const positioningValue = React29__namespace.useMemo(() => ({
|
|
3027
|
-
side,
|
|
3028
|
-
align,
|
|
3029
|
-
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
3030
|
-
alignOffset: mergedPositioning.offset?.crossAxis ?? 0
|
|
3031
|
-
}), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
|
|
3032
|
-
const handleOpenChange = React29__namespace.useCallback((isOpen) => {
|
|
3033
|
-
onOpenChange?.({ open: isOpen });
|
|
3034
|
-
}, [onOpenChange]);
|
|
3035
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3036
|
-
DropdownMenu__namespace.Root,
|
|
3037
|
-
{
|
|
3038
|
-
open,
|
|
3039
|
-
defaultOpen,
|
|
3040
|
-
onOpenChange: handleOpenChange,
|
|
3041
|
-
modal,
|
|
3042
|
-
children
|
|
3043
|
-
}
|
|
3044
|
-
) });
|
|
3045
|
-
};
|
|
3046
|
-
var MenuTrigger = React29__namespace.forwardRef(function MenuTrigger2(props, ref) {
|
|
3047
|
-
const { asChild = false, ...rest } = props;
|
|
3048
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild, ref, ...rest });
|
|
3049
|
-
});
|
|
3050
|
-
var MenuContent = React29__namespace.forwardRef(function MenuContent2(props, ref) {
|
|
3051
|
-
const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
|
|
3052
|
-
const positioning = React29__namespace.useContext(PositioningContext);
|
|
3053
|
-
const mergedStyle = {
|
|
3054
|
-
...style,
|
|
3055
|
-
...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
|
|
3056
|
-
...minW !== void 0 ? { minWidth: minW } : {}
|
|
3057
|
-
};
|
|
3058
|
-
const content = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3059
|
-
DropdownMenu__namespace.Content,
|
|
3060
|
-
{
|
|
3061
|
-
ref,
|
|
3062
|
-
side: positioning.side,
|
|
3063
|
-
align: positioning.align,
|
|
3064
|
-
sideOffset: positioning.sideOffset,
|
|
3065
|
-
alignOffset: positioning.alignOffset,
|
|
3066
|
-
className: cn(
|
|
3067
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-lg p-1",
|
|
3068
|
-
"border border-[var(--color-popover-border,var(--color-border-divider))]",
|
|
3069
|
-
"bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
|
|
3070
|
-
"shadow-[0_4px_12px_var(--color-popover-shadow)]",
|
|
3071
|
-
"outline-none",
|
|
3072
|
-
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
3073
|
-
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
3074
|
-
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
3075
|
-
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
3076
|
-
className
|
|
3077
|
-
),
|
|
3078
|
-
style: Object.keys(mergedStyle).length > 0 ? mergedStyle : void 0,
|
|
3079
|
-
...rest
|
|
3080
|
-
}
|
|
3081
|
-
);
|
|
3082
|
-
if (!portalled) {
|
|
3083
|
-
return content;
|
|
3084
|
-
}
|
|
3085
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
3086
|
-
});
|
|
3087
|
-
var MenuItem = React29__namespace.forwardRef(function MenuItem2(props, ref) {
|
|
3088
|
-
const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
|
|
3089
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3090
|
-
DropdownMenu__namespace.Item,
|
|
3091
|
-
{
|
|
3092
|
-
ref,
|
|
3093
|
-
asChild,
|
|
3094
|
-
disabled,
|
|
3095
|
-
onClick,
|
|
3096
|
-
className: cn(
|
|
3097
|
-
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
3098
|
-
"outline-none transition-colors",
|
|
3099
|
-
"text-[var(--color-text-primary,inherit)]",
|
|
3100
|
-
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
3101
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3102
|
-
className
|
|
3103
|
-
),
|
|
3104
|
-
...rest,
|
|
3105
|
-
children
|
|
3106
|
-
}
|
|
3107
|
-
);
|
|
3108
|
-
});
|
|
3109
|
-
var MenuItemText = React29__namespace.forwardRef(function MenuItemText2(props, ref) {
|
|
3110
|
-
const { className, ...rest } = props;
|
|
3111
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, className: cn("flex-1", className), ...rest });
|
|
3112
|
-
});
|
|
3113
|
-
React29__namespace.forwardRef(function MenuItemCommand2(props, ref) {
|
|
3114
|
-
const { className, ...rest } = props;
|
|
3115
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3116
|
-
"span",
|
|
3117
|
-
{
|
|
3118
|
-
ref,
|
|
3119
|
-
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
3120
|
-
...rest
|
|
3121
|
-
}
|
|
3122
|
-
);
|
|
3123
|
-
});
|
|
3124
|
-
var MenuSeparator = React29__namespace.forwardRef(function MenuSeparator2(props, ref) {
|
|
3125
|
-
const { className, ...rest } = props;
|
|
3126
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3127
|
-
DropdownMenu__namespace.Separator,
|
|
3128
|
-
{
|
|
3129
|
-
ref,
|
|
3130
|
-
className: cn("-mx-1 my-1 h-px bg-[var(--color-border-divider)]", className),
|
|
3131
|
-
...rest
|
|
3132
|
-
}
|
|
3133
|
-
);
|
|
3134
|
-
});
|
|
3135
|
-
var MenuItemGroup = React29__namespace.forwardRef(function MenuItemGroup2(props, ref) {
|
|
3136
|
-
const { title, children, className, ...rest } = props;
|
|
3137
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Group, { ref, className, ...rest, children: [
|
|
3138
|
-
title && /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
|
|
3139
|
-
children
|
|
3140
|
-
] });
|
|
3141
|
-
});
|
|
3142
|
-
var MenuArrow = React29__namespace.forwardRef(function MenuArrow2(props, ref) {
|
|
3143
|
-
const { className, ...rest } = props;
|
|
3144
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3145
|
-
DropdownMenu__namespace.Arrow,
|
|
3146
|
-
{
|
|
3147
|
-
ref,
|
|
3148
|
-
className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
|
|
3149
|
-
...rest
|
|
3150
|
-
}
|
|
3151
|
-
);
|
|
3152
|
-
});
|
|
3153
|
-
var MenuCheckboxItem = React29__namespace.forwardRef(function MenuCheckboxItem2(props, ref) {
|
|
3154
|
-
const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
|
|
3155
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3156
|
-
DropdownMenu__namespace.CheckboxItem,
|
|
3157
|
-
{
|
|
3158
|
-
ref,
|
|
3159
|
-
checked,
|
|
3160
|
-
onCheckedChange,
|
|
3161
|
-
onClick,
|
|
3162
|
-
className: cn(
|
|
3163
|
-
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
3164
|
-
"outline-none transition-colors",
|
|
3165
|
-
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
3166
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3167
|
-
className
|
|
3168
|
-
),
|
|
3169
|
-
...rest,
|
|
3170
|
-
children: [
|
|
3171
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuCheck, { className: "h-4 w-4" }) }) }),
|
|
3172
|
-
children
|
|
3173
|
-
]
|
|
3174
|
-
}
|
|
3175
|
-
);
|
|
3176
|
-
});
|
|
3177
|
-
var MenuRadioItemGroup = React29__namespace.forwardRef(function MenuRadioItemGroup2(props, ref) {
|
|
3178
|
-
const { value, onValueChange, ...rest } = props;
|
|
3179
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3180
|
-
DropdownMenu__namespace.RadioGroup,
|
|
3181
|
-
{
|
|
3182
|
-
ref,
|
|
3183
|
-
value,
|
|
3184
|
-
onValueChange,
|
|
3185
|
-
...rest
|
|
3186
|
-
}
|
|
3187
|
-
);
|
|
3188
|
-
});
|
|
3189
|
-
var MenuRadioItem = React29__namespace.forwardRef(function MenuRadioItem2(props, ref) {
|
|
3190
|
-
const { className, children, value, onClick, ...rest } = props;
|
|
3191
|
-
const { value: _v, ...radixRest } = rest;
|
|
3192
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3193
|
-
DropdownMenu__namespace.RadioItem,
|
|
3194
|
-
{
|
|
3195
|
-
ref,
|
|
3196
|
-
value,
|
|
3197
|
-
onClick,
|
|
3198
|
-
className: cn(
|
|
3199
|
-
"relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
|
|
3200
|
-
"outline-none transition-colors",
|
|
3201
|
-
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
3202
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3203
|
-
className
|
|
3204
|
-
),
|
|
3205
|
-
children: [
|
|
3206
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuCheck, { className: "h-4 w-4" }) }) }),
|
|
3207
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children })
|
|
3208
|
-
]
|
|
3209
|
-
}
|
|
3210
|
-
);
|
|
3211
|
-
});
|
|
3212
|
-
React29__namespace.forwardRef(function MenuContextTrigger2(props, ref) {
|
|
3213
|
-
const { asChild: _asChild, ...rest } = props;
|
|
3214
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, ...rest });
|
|
3215
|
-
});
|
|
3216
|
-
var MenuTriggerItem = React29__namespace.forwardRef(function MenuTriggerItem2(props, ref) {
|
|
3217
|
-
const { startIcon, children, className, ...rest } = props;
|
|
3218
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Sub, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3219
|
-
DropdownMenu__namespace.SubTrigger,
|
|
3220
|
-
{
|
|
3221
|
-
ref,
|
|
3222
|
-
className: cn(
|
|
3223
|
-
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
|
|
3224
|
-
"outline-none transition-colors",
|
|
3225
|
-
"data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
|
|
3226
|
-
className
|
|
3227
|
-
),
|
|
3228
|
-
...rest,
|
|
3229
|
-
children: [
|
|
3230
|
-
startIcon,
|
|
3231
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children }),
|
|
3232
|
-
/* @__PURE__ */ jsxRuntime.jsx(lu.LuChevronRight, { className: "h-4 w-4" })
|
|
3233
|
-
]
|
|
3234
|
-
}
|
|
3235
|
-
) });
|
|
3236
|
-
});
|
|
3237
4014
|
var INPUT_BASE2 = [
|
|
3238
4015
|
"w-10 h-10",
|
|
3239
4016
|
"text-center text-sm font-medium",
|
|
@@ -3248,7 +4025,7 @@ var INPUT_BASE2 = [
|
|
|
3248
4025
|
].join(" ");
|
|
3249
4026
|
var INPUT_FILLED = "border-[var(--color-input-border)]";
|
|
3250
4027
|
var INPUT_INVALID = "border-[var(--color-border-error)] hover:border-[var(--color-border-error)]";
|
|
3251
|
-
var PinInput =
|
|
4028
|
+
var PinInput = React33__namespace.forwardRef(
|
|
3252
4029
|
function PinInput2(props, ref) {
|
|
3253
4030
|
const {
|
|
3254
4031
|
count = 6,
|
|
@@ -3266,12 +4043,12 @@ var PinInput = React29__namespace.forwardRef(
|
|
|
3266
4043
|
bgColor,
|
|
3267
4044
|
className
|
|
3268
4045
|
} = props;
|
|
3269
|
-
const inputRefs =
|
|
3270
|
-
const values =
|
|
4046
|
+
const inputRefs = React33__namespace.useRef([]);
|
|
4047
|
+
const values = React33__namespace.useMemo(
|
|
3271
4048
|
() => controlledValue ?? Array.from({ length: count }).fill(""),
|
|
3272
4049
|
[controlledValue, count]
|
|
3273
4050
|
);
|
|
3274
|
-
const updateValue =
|
|
4051
|
+
const updateValue = React33__namespace.useCallback((index, char) => {
|
|
3275
4052
|
const next = [...values];
|
|
3276
4053
|
next[index] = char;
|
|
3277
4054
|
onValueChange?.({ value: next });
|
|
@@ -3279,11 +4056,11 @@ var PinInput = React29__namespace.forwardRef(
|
|
|
3279
4056
|
onValueComplete?.({ value: next });
|
|
3280
4057
|
}
|
|
3281
4058
|
}, [values, onValueChange, onValueComplete]);
|
|
3282
|
-
const focusInput =
|
|
4059
|
+
const focusInput = React33__namespace.useCallback((index) => {
|
|
3283
4060
|
const clamped = Math.max(0, Math.min(index, count - 1));
|
|
3284
4061
|
inputRefs.current[clamped]?.focus();
|
|
3285
4062
|
}, [count]);
|
|
3286
|
-
const handleInput =
|
|
4063
|
+
const handleInput = React33__namespace.useCallback((index, e) => {
|
|
3287
4064
|
const target = e.currentTarget;
|
|
3288
4065
|
const char = target.value.slice(-1);
|
|
3289
4066
|
updateValue(index, char);
|
|
@@ -3291,7 +4068,7 @@ var PinInput = React29__namespace.forwardRef(
|
|
|
3291
4068
|
focusInput(index + 1);
|
|
3292
4069
|
}
|
|
3293
4070
|
}, [count, updateValue, focusInput]);
|
|
3294
|
-
const handleKeyDown =
|
|
4071
|
+
const handleKeyDown = React33__namespace.useCallback((index, e) => {
|
|
3295
4072
|
if (e.key === "Backspace") {
|
|
3296
4073
|
if (values[index]) {
|
|
3297
4074
|
updateValue(index, "");
|
|
@@ -3308,7 +4085,7 @@ var PinInput = React29__namespace.forwardRef(
|
|
|
3308
4085
|
e.preventDefault();
|
|
3309
4086
|
}
|
|
3310
4087
|
}, [count, values, updateValue, focusInput]);
|
|
3311
|
-
const handlePaste =
|
|
4088
|
+
const handlePaste = React33__namespace.useCallback((e) => {
|
|
3312
4089
|
e.preventDefault();
|
|
3313
4090
|
const pasted = e.clipboardData.getData("text/plain").trim();
|
|
3314
4091
|
if (!pasted) {
|
|
@@ -3325,18 +4102,18 @@ var PinInput = React29__namespace.forwardRef(
|
|
|
3325
4102
|
}
|
|
3326
4103
|
focusInput(Math.min(chars.length, count - 1));
|
|
3327
4104
|
}, [count, values, onValueChange, onValueComplete, focusInput]);
|
|
3328
|
-
const handleFocus =
|
|
4105
|
+
const handleFocus = React33__namespace.useCallback((e) => {
|
|
3329
4106
|
e.currentTarget.select();
|
|
3330
4107
|
}, []);
|
|
3331
|
-
const handleNoop =
|
|
4108
|
+
const handleNoop = React33__namespace.useCallback(() => {
|
|
3332
4109
|
}, []);
|
|
3333
|
-
const setInputRef =
|
|
4110
|
+
const setInputRef = React33__namespace.useCallback((index) => (el) => {
|
|
3334
4111
|
inputRefs.current[index] = el;
|
|
3335
4112
|
}, []);
|
|
3336
|
-
const onInputAtIndex =
|
|
4113
|
+
const onInputAtIndex = React33__namespace.useCallback((index) => (e) => {
|
|
3337
4114
|
handleInput(index, e);
|
|
3338
4115
|
}, [handleInput]);
|
|
3339
|
-
const onKeyDownAtIndex =
|
|
4116
|
+
const onKeyDownAtIndex = React33__namespace.useCallback((index) => (e) => {
|
|
3340
4117
|
handleKeyDown(index, e);
|
|
3341
4118
|
}, [handleKeyDown]);
|
|
3342
4119
|
const bgStyle = bgColor ? { backgroundColor: `var(--color-${bgColor.replace(/\./g, "-")})` } : void 0;
|
|
@@ -3397,7 +4174,7 @@ function parsePlacement2(placement) {
|
|
|
3397
4174
|
}
|
|
3398
4175
|
return { side, align };
|
|
3399
4176
|
}
|
|
3400
|
-
var PositioningContext2 =
|
|
4177
|
+
var PositioningContext2 = React33__namespace.createContext({
|
|
3401
4178
|
side: "bottom",
|
|
3402
4179
|
align: "start",
|
|
3403
4180
|
sideOffset: 4,
|
|
@@ -3431,7 +4208,7 @@ var PopoverRoot = (props) => {
|
|
|
3431
4208
|
}
|
|
3432
4209
|
};
|
|
3433
4210
|
const { side, align } = parsePlacement2(mergedPositioning.placement);
|
|
3434
|
-
const positioningValue =
|
|
4211
|
+
const positioningValue = React33__namespace.useMemo(() => ({
|
|
3435
4212
|
side,
|
|
3436
4213
|
align,
|
|
3437
4214
|
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
@@ -3448,13 +4225,13 @@ var PopoverRoot = (props) => {
|
|
|
3448
4225
|
autoFocus,
|
|
3449
4226
|
closeOnInteractOutside
|
|
3450
4227
|
]);
|
|
3451
|
-
const handleOpenChange =
|
|
4228
|
+
const handleOpenChange = React33__namespace.useCallback((isOpen) => {
|
|
3452
4229
|
onOpenChange?.({ open: isOpen });
|
|
3453
4230
|
}, [onOpenChange]);
|
|
3454
4231
|
const placement = mergedPositioning.placement ?? "bottom-start";
|
|
3455
4232
|
const offset = mergedPositioning.offset?.mainAxis ?? 4;
|
|
3456
4233
|
return /* @__PURE__ */ jsxRuntime.jsx(PositioningContext2.Provider, { value: positioningValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3457
|
-
|
|
4234
|
+
gui.Popover,
|
|
3458
4235
|
{
|
|
3459
4236
|
open,
|
|
3460
4237
|
defaultOpen,
|
|
@@ -3466,11 +4243,11 @@ var PopoverRoot = (props) => {
|
|
|
3466
4243
|
}
|
|
3467
4244
|
) });
|
|
3468
4245
|
};
|
|
3469
|
-
var PopoverTrigger =
|
|
4246
|
+
var PopoverTrigger = React33__namespace.forwardRef(function PopoverTrigger2(props, ref) {
|
|
3470
4247
|
const { asChild = true, ...rest } = props;
|
|
3471
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4248
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Popover.Trigger, { asChild: asChild ? "except-style" : void 0, ref, ...rest });
|
|
3472
4249
|
});
|
|
3473
|
-
var PopoverContent =
|
|
4250
|
+
var PopoverContent = React33__namespace.forwardRef(function PopoverContent2(props, ref) {
|
|
3474
4251
|
const { portalled = true, portalRef: _portalRef, className, w, minW, maxW, paddingTop, style: styleProp, ...rest } = props;
|
|
3475
4252
|
const resolvedW = typeof w === "object" ? w.base ?? w.lg : w;
|
|
3476
4253
|
const contentStyle = {
|
|
@@ -3481,7 +4258,7 @@ var PopoverContent = React29__namespace.forwardRef(function PopoverContent2(prop
|
|
|
3481
4258
|
...paddingTop !== void 0 ? { paddingTop: typeof paddingTop === "number" ? `${paddingTop * 4}px` : paddingTop } : {}
|
|
3482
4259
|
};
|
|
3483
4260
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3484
|
-
|
|
4261
|
+
gui.Popover.Content,
|
|
3485
4262
|
{
|
|
3486
4263
|
ref,
|
|
3487
4264
|
unstyled: true,
|
|
@@ -3501,10 +4278,10 @@ var PopoverContent = React29__namespace.forwardRef(function PopoverContent2(prop
|
|
|
3501
4278
|
}
|
|
3502
4279
|
);
|
|
3503
4280
|
});
|
|
3504
|
-
var PopoverArrow =
|
|
4281
|
+
var PopoverArrow = React33__namespace.forwardRef(function PopoverArrow2(props, ref) {
|
|
3505
4282
|
const { className, ...rest } = props;
|
|
3506
4283
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3507
|
-
|
|
4284
|
+
gui.Popover.Arrow,
|
|
3508
4285
|
{
|
|
3509
4286
|
ref,
|
|
3510
4287
|
unstyled: true,
|
|
@@ -3513,10 +4290,10 @@ var PopoverArrow = React29__namespace.forwardRef(function PopoverArrow2(props, r
|
|
|
3513
4290
|
}
|
|
3514
4291
|
);
|
|
3515
4292
|
});
|
|
3516
|
-
var PopoverCloseTrigger =
|
|
4293
|
+
var PopoverCloseTrigger = React33__namespace.forwardRef(function PopoverCloseTrigger2(props, ref) {
|
|
3517
4294
|
const { className, ...rest } = props;
|
|
3518
4295
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3519
|
-
|
|
4296
|
+
gui.Popover.Close,
|
|
3520
4297
|
{
|
|
3521
4298
|
unstyled: true,
|
|
3522
4299
|
className: cn("absolute top-1 right-1", className),
|
|
@@ -3527,14 +4304,14 @@ var PopoverCloseTrigger = React29__namespace.forwardRef(function PopoverCloseTri
|
|
|
3527
4304
|
}
|
|
3528
4305
|
);
|
|
3529
4306
|
});
|
|
3530
|
-
var PopoverCloseTriggerWrapper =
|
|
4307
|
+
var PopoverCloseTriggerWrapper = React33__namespace.forwardRef(function PopoverCloseTriggerWrapper2(props, ref) {
|
|
3531
4308
|
const { disabled, children, ...rest } = props;
|
|
3532
4309
|
if (disabled) {
|
|
3533
4310
|
return children;
|
|
3534
4311
|
}
|
|
3535
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4312
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Popover.Close, { ref, ...rest, asChild: true, children });
|
|
3536
4313
|
});
|
|
3537
|
-
var PopoverBody =
|
|
4314
|
+
var PopoverBody = React33__namespace.forwardRef(function PopoverBody2(props, ref) {
|
|
3538
4315
|
const {
|
|
3539
4316
|
className,
|
|
3540
4317
|
style: styleProp,
|
|
@@ -3572,7 +4349,7 @@ var PopoverBody = React29__namespace.forwardRef(function PopoverBody2(props, ref
|
|
|
3572
4349
|
}
|
|
3573
4350
|
);
|
|
3574
4351
|
});
|
|
3575
|
-
var PopoverHeader =
|
|
4352
|
+
var PopoverHeader = React33__namespace.forwardRef(function PopoverHeader2(props, ref) {
|
|
3576
4353
|
const { className, ...rest } = props;
|
|
3577
4354
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3578
4355
|
"div",
|
|
@@ -3583,7 +4360,7 @@ var PopoverHeader = React29__namespace.forwardRef(function PopoverHeader2(props,
|
|
|
3583
4360
|
}
|
|
3584
4361
|
);
|
|
3585
4362
|
});
|
|
3586
|
-
var PopoverFooter =
|
|
4363
|
+
var PopoverFooter = React33__namespace.forwardRef(function PopoverFooter2(props, ref) {
|
|
3587
4364
|
const { className, ...rest } = props;
|
|
3588
4365
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3589
4366
|
"div",
|
|
@@ -3594,7 +4371,7 @@ var PopoverFooter = React29__namespace.forwardRef(function PopoverFooter2(props,
|
|
|
3594
4371
|
}
|
|
3595
4372
|
);
|
|
3596
4373
|
});
|
|
3597
|
-
var PopoverTitle =
|
|
4374
|
+
var PopoverTitle = React33__namespace.forwardRef(function PopoverTitle2(props, ref) {
|
|
3598
4375
|
const { className, ...rest } = props;
|
|
3599
4376
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3600
4377
|
"h3",
|
|
@@ -3605,7 +4382,7 @@ var PopoverTitle = React29__namespace.forwardRef(function PopoverTitle2(props, r
|
|
|
3605
4382
|
}
|
|
3606
4383
|
);
|
|
3607
4384
|
});
|
|
3608
|
-
var PopoverDescription =
|
|
4385
|
+
var PopoverDescription = React33__namespace.forwardRef(function PopoverDescription2(props, ref) {
|
|
3609
4386
|
const { className, ...rest } = props;
|
|
3610
4387
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3611
4388
|
"p",
|
|
@@ -3627,7 +4404,7 @@ function normalizeValue(value, min, max) {
|
|
|
3627
4404
|
if (max <= min) return 0;
|
|
3628
4405
|
return Math.round((value - min) / (max - min) * 100);
|
|
3629
4406
|
}
|
|
3630
|
-
var Progress =
|
|
4407
|
+
var Progress = React33__namespace.forwardRef(
|
|
3631
4408
|
function Progress2(props, ref) {
|
|
3632
4409
|
const {
|
|
3633
4410
|
value,
|
|
@@ -3667,10 +4444,11 @@ var Progress = React29__namespace.forwardRef(
|
|
|
3667
4444
|
style: rootStyle,
|
|
3668
4445
|
...rest,
|
|
3669
4446
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3670
|
-
|
|
4447
|
+
gui.Progress,
|
|
3671
4448
|
{
|
|
3672
4449
|
value: percent,
|
|
3673
4450
|
max: 100,
|
|
4451
|
+
unstyled: true,
|
|
3674
4452
|
className: cn(
|
|
3675
4453
|
"w-full overflow-hidden rounded-full",
|
|
3676
4454
|
"bg-[var(--color-progress-track)]",
|
|
@@ -3679,14 +4457,15 @@ var Progress = React29__namespace.forwardRef(
|
|
|
3679
4457
|
),
|
|
3680
4458
|
style: trackStyle,
|
|
3681
4459
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3682
|
-
|
|
4460
|
+
gui.Progress.Indicator,
|
|
3683
4461
|
{
|
|
4462
|
+
unstyled: true,
|
|
4463
|
+
transition: "slow",
|
|
3684
4464
|
className: cn(
|
|
3685
|
-
"h-full rounded-full
|
|
4465
|
+
"h-full rounded-full",
|
|
3686
4466
|
!color && "bg-[var(--color-progress-indicator)]"
|
|
3687
4467
|
),
|
|
3688
4468
|
style: {
|
|
3689
|
-
width: `${percent}%`,
|
|
3690
4469
|
...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
|
|
3691
4470
|
}
|
|
3692
4471
|
}
|
|
@@ -3704,12 +4483,12 @@ var SIZE_MAP = {
|
|
|
3704
4483
|
lg: { size: 48, thickness: 7, textClass: "text-sm" },
|
|
3705
4484
|
xl: { size: 64, thickness: 8, textClass: "text-sm" }
|
|
3706
4485
|
};
|
|
3707
|
-
var Ctx =
|
|
4486
|
+
var Ctx = React33__namespace.createContext({
|
|
3708
4487
|
value: 0,
|
|
3709
4488
|
size: "md",
|
|
3710
4489
|
colorPalette: "blue"
|
|
3711
4490
|
});
|
|
3712
|
-
var ProgressCircleRoot =
|
|
4491
|
+
var ProgressCircleRoot = React33__namespace.forwardRef(function ProgressCircleRoot2(props, ref) {
|
|
3713
4492
|
const {
|
|
3714
4493
|
value = 0,
|
|
3715
4494
|
size = "md",
|
|
@@ -3718,7 +4497,7 @@ var ProgressCircleRoot = React29__namespace.forwardRef(function ProgressCircleRo
|
|
|
3718
4497
|
children,
|
|
3719
4498
|
...rest
|
|
3720
4499
|
} = props;
|
|
3721
|
-
const ctx =
|
|
4500
|
+
const ctx = React33__namespace.useMemo(
|
|
3722
4501
|
() => ({ value: value ?? null, size, colorPalette }),
|
|
3723
4502
|
[value, size, colorPalette]
|
|
3724
4503
|
);
|
|
@@ -3736,9 +4515,9 @@ var ProgressCircleRoot = React29__namespace.forwardRef(function ProgressCircleRo
|
|
|
3736
4515
|
}
|
|
3737
4516
|
) });
|
|
3738
4517
|
});
|
|
3739
|
-
var ProgressCircleRing =
|
|
4518
|
+
var ProgressCircleRing = React33__namespace.forwardRef(function ProgressCircleRing2(props, ref) {
|
|
3740
4519
|
const { trackColor, cap, color, className, ...rest } = props;
|
|
3741
|
-
const { value, size: sizeKey } =
|
|
4520
|
+
const { value, size: sizeKey } = React33__namespace.useContext(Ctx);
|
|
3742
4521
|
const { size, thickness } = SIZE_MAP[sizeKey];
|
|
3743
4522
|
const radius = size / 2 - thickness / 2;
|
|
3744
4523
|
const circumference = 2 * Math.PI * radius;
|
|
@@ -3793,9 +4572,9 @@ var ProgressCircleRing = React29__namespace.forwardRef(function ProgressCircleRi
|
|
|
3793
4572
|
}
|
|
3794
4573
|
);
|
|
3795
4574
|
});
|
|
3796
|
-
var ProgressCircleValueText =
|
|
4575
|
+
var ProgressCircleValueText = React33__namespace.forwardRef(function ProgressCircleValueText2(props, ref) {
|
|
3797
4576
|
const { className, children, ...rest } = props;
|
|
3798
|
-
const { value, size: sizeKey } =
|
|
4577
|
+
const { value, size: sizeKey } = React33__namespace.useContext(Ctx);
|
|
3799
4578
|
const { textClass } = SIZE_MAP[sizeKey];
|
|
3800
4579
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3801
4580
|
"div",
|
|
@@ -3839,8 +4618,8 @@ var SIZE_CLASSES8 = {
|
|
|
3839
4618
|
label: "text-base"
|
|
3840
4619
|
}
|
|
3841
4620
|
};
|
|
3842
|
-
var RadioSizeContext =
|
|
3843
|
-
var RadioGroupBase =
|
|
4621
|
+
var RadioSizeContext = React33__namespace.createContext("md");
|
|
4622
|
+
var RadioGroupBase = React33__namespace.forwardRef(
|
|
3844
4623
|
function RadioGroup2(props, ref) {
|
|
3845
4624
|
const {
|
|
3846
4625
|
children,
|
|
@@ -3849,7 +4628,8 @@ var RadioGroupBase = React29__namespace.forwardRef(
|
|
|
3849
4628
|
disabled = false,
|
|
3850
4629
|
readOnly = false,
|
|
3851
4630
|
orientation = "vertical",
|
|
3852
|
-
loop
|
|
4631
|
+
// `loop` was a Radix-only knob; gui's roving focus always wraps.
|
|
4632
|
+
loop: _loop = true,
|
|
3853
4633
|
defaultValue,
|
|
3854
4634
|
value,
|
|
3855
4635
|
onValueChange,
|
|
@@ -3857,7 +4637,7 @@ var RadioGroupBase = React29__namespace.forwardRef(
|
|
|
3857
4637
|
className,
|
|
3858
4638
|
...rest
|
|
3859
4639
|
} = props;
|
|
3860
|
-
const handleValueChange =
|
|
4640
|
+
const handleValueChange = React33__namespace.useCallback(
|
|
3861
4641
|
(nextValue) => {
|
|
3862
4642
|
if (readOnly) return;
|
|
3863
4643
|
onValueChange?.({ value: nextValue });
|
|
@@ -3865,14 +4645,14 @@ var RadioGroupBase = React29__namespace.forwardRef(
|
|
|
3865
4645
|
[readOnly, onValueChange]
|
|
3866
4646
|
);
|
|
3867
4647
|
return /* @__PURE__ */ jsxRuntime.jsx(RadioSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3868
|
-
|
|
4648
|
+
gui.RadioGroup,
|
|
3869
4649
|
{
|
|
3870
4650
|
ref,
|
|
4651
|
+
unstyled: true,
|
|
3871
4652
|
name,
|
|
3872
4653
|
required,
|
|
3873
4654
|
disabled: disabled || readOnly,
|
|
3874
4655
|
orientation,
|
|
3875
|
-
loop,
|
|
3876
4656
|
defaultValue,
|
|
3877
4657
|
value: value ?? void 0,
|
|
3878
4658
|
onValueChange: handleValueChange,
|
|
@@ -3890,10 +4670,10 @@ var RadioGroupBase = React29__namespace.forwardRef(
|
|
|
3890
4670
|
var RadioGroup3 = RadioGroupBase;
|
|
3891
4671
|
var NOOP2 = () => {
|
|
3892
4672
|
};
|
|
3893
|
-
var RadioBase =
|
|
4673
|
+
var RadioBase = React33__namespace.forwardRef(
|
|
3894
4674
|
function Radio(props, ref) {
|
|
3895
4675
|
const { children, inputProps, rootRef, value, disabled, className, ...rest } = props;
|
|
3896
|
-
const size =
|
|
4676
|
+
const size = React33__namespace.useContext(RadioSizeContext);
|
|
3897
4677
|
const sizeClasses2 = SIZE_CLASSES8[size];
|
|
3898
4678
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3899
4679
|
"label",
|
|
@@ -3909,8 +4689,9 @@ var RadioBase = React29__namespace.forwardRef(
|
|
|
3909
4689
|
...rest,
|
|
3910
4690
|
children: [
|
|
3911
4691
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3912
|
-
|
|
4692
|
+
gui.RadioGroup.Item,
|
|
3913
4693
|
{
|
|
4694
|
+
unstyled: true,
|
|
3914
4695
|
value,
|
|
3915
4696
|
disabled,
|
|
3916
4697
|
className: cn(
|
|
@@ -3922,8 +4703,9 @@ var RadioBase = React29__namespace.forwardRef(
|
|
|
3922
4703
|
sizeClasses2.control
|
|
3923
4704
|
),
|
|
3924
4705
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3925
|
-
|
|
4706
|
+
gui.RadioGroup.Indicator,
|
|
3926
4707
|
{
|
|
4708
|
+
unstyled: true,
|
|
3927
4709
|
className: cn(
|
|
3928
4710
|
"block rounded-full bg-gray-800 dark:bg-white",
|
|
3929
4711
|
sizeClasses2.indicator
|
|
@@ -3955,23 +4737,23 @@ var RadioBase = React29__namespace.forwardRef(
|
|
|
3955
4737
|
var Radio2 = RadioBase;
|
|
3956
4738
|
var StarFilledIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.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" }) });
|
|
3957
4739
|
var StarOutlineIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.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" }) });
|
|
3958
|
-
var Rating =
|
|
4740
|
+
var Rating = React33__namespace.forwardRef(
|
|
3959
4741
|
function Rating2(props, ref) {
|
|
3960
4742
|
const { count = 5, label: labelProp, defaultValue = 0, onValueChange, readOnly, className, ...rest } = props;
|
|
3961
|
-
const [value, setValue] =
|
|
3962
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4743
|
+
const [value, setValue] = React33__namespace.useState(defaultValue);
|
|
4744
|
+
const [hoveredIndex, setHoveredIndex] = React33__namespace.useState(-1);
|
|
3963
4745
|
const highlightedIndex = hoveredIndex >= 0 && !readOnly ? hoveredIndex + 1 : value;
|
|
3964
4746
|
const label = Array.isArray(labelProp) ? labelProp[highlightedIndex - 1] : labelProp;
|
|
3965
|
-
const handleClick =
|
|
4747
|
+
const handleClick = React33__namespace.useCallback((index) => () => {
|
|
3966
4748
|
if (readOnly) return;
|
|
3967
4749
|
setValue(index);
|
|
3968
4750
|
onValueChange?.({ value: index });
|
|
3969
4751
|
}, [readOnly, onValueChange]);
|
|
3970
|
-
const handleMouseEnter =
|
|
4752
|
+
const handleMouseEnter = React33__namespace.useCallback((index) => () => {
|
|
3971
4753
|
if (readOnly) return;
|
|
3972
4754
|
setHoveredIndex(index);
|
|
3973
4755
|
}, [readOnly]);
|
|
3974
|
-
const handleMouseLeave =
|
|
4756
|
+
const handleMouseLeave = React33__namespace.useCallback(() => {
|
|
3975
4757
|
setHoveredIndex(-1);
|
|
3976
4758
|
}, []);
|
|
3977
4759
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cn("inline-flex items-center gap-1", className), ...rest, children: [
|
|
@@ -3999,14 +4781,14 @@ var Rating = React29__namespace.forwardRef(
|
|
|
3999
4781
|
] });
|
|
4000
4782
|
}
|
|
4001
4783
|
);
|
|
4002
|
-
function createListCollection(
|
|
4003
|
-
return { items:
|
|
4784
|
+
function createListCollection(config2) {
|
|
4785
|
+
return { items: config2.items };
|
|
4004
4786
|
}
|
|
4005
4787
|
var ArrowIcon2 = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
4006
4788
|
var CheckIcon2 = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.667 5L7.5 14.167 3.333 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
4007
4789
|
function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
4008
|
-
const [value, setValue] =
|
|
4009
|
-
const handleChange =
|
|
4790
|
+
const [value, setValue] = React33__namespace.useState(initialValue);
|
|
4791
|
+
const handleChange = React33__namespace.useCallback((e) => {
|
|
4010
4792
|
setValue(e.target.value);
|
|
4011
4793
|
onChange?.(e.target.value);
|
|
4012
4794
|
}, [onChange]);
|
|
@@ -4025,15 +4807,15 @@ function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
|
4025
4807
|
}
|
|
4026
4808
|
);
|
|
4027
4809
|
}
|
|
4028
|
-
var SelectInternalContext =
|
|
4810
|
+
var SelectInternalContext = React33__namespace.createContext(null);
|
|
4029
4811
|
function useSelectInternalContext() {
|
|
4030
|
-
const ctx =
|
|
4812
|
+
const ctx = React33__namespace.useContext(SelectInternalContext);
|
|
4031
4813
|
if (!ctx) {
|
|
4032
4814
|
throw new Error("Select compound components must be rendered inside <SelectRoot>");
|
|
4033
4815
|
}
|
|
4034
4816
|
return ctx;
|
|
4035
4817
|
}
|
|
4036
|
-
var SelectRoot =
|
|
4818
|
+
var SelectRoot = React33__namespace.forwardRef(
|
|
4037
4819
|
function SelectRoot2(props, ref) {
|
|
4038
4820
|
const {
|
|
4039
4821
|
children,
|
|
@@ -4064,21 +4846,21 @@ var SelectRoot = React29__namespace.forwardRef(
|
|
|
4064
4846
|
hideFrom: _hideFrom
|
|
4065
4847
|
} = props;
|
|
4066
4848
|
const collection = collectionProp ?? createListCollection({ items: [] });
|
|
4067
|
-
const [internalValue, setInternalValue] =
|
|
4849
|
+
const [internalValue, setInternalValue] = React33__namespace.useState(defaultValueArr ?? []);
|
|
4068
4850
|
const currentValue = valueProp ?? internalValue;
|
|
4069
|
-
const selectedItems =
|
|
4851
|
+
const selectedItems = React33__namespace.useMemo(() => {
|
|
4070
4852
|
return currentValue.map((v) => collection.items.find((item) => item.value === v)).filter(Boolean);
|
|
4071
4853
|
}, [currentValue, collection.items]);
|
|
4072
|
-
const [open, setOpen] =
|
|
4854
|
+
const [open, setOpen] = React33__namespace.useState(defaultOpen ?? false);
|
|
4073
4855
|
const isOpen = openProp ?? open;
|
|
4074
|
-
const handleOpenChange =
|
|
4856
|
+
const handleOpenChange = React33__namespace.useCallback((nextOpen) => {
|
|
4075
4857
|
setOpen(nextOpen);
|
|
4076
4858
|
onOpenChange?.(nextOpen);
|
|
4077
4859
|
if (!nextOpen) {
|
|
4078
4860
|
onInteractOutside?.();
|
|
4079
4861
|
}
|
|
4080
4862
|
}, [onOpenChange, onInteractOutside]);
|
|
4081
|
-
const handleRadixValueChange =
|
|
4863
|
+
const handleRadixValueChange = React33__namespace.useCallback((radixValue) => {
|
|
4082
4864
|
const nextArr = [radixValue];
|
|
4083
4865
|
if (!valueProp) {
|
|
4084
4866
|
setInternalValue(nextArr);
|
|
@@ -4086,7 +4868,7 @@ var SelectRoot = React29__namespace.forwardRef(
|
|
|
4086
4868
|
const items = collection.items.filter((item) => nextArr.includes(item.value));
|
|
4087
4869
|
onValueChangeProp?.({ value: nextArr, items });
|
|
4088
4870
|
}, [valueProp, collection.items, onValueChangeProp]);
|
|
4089
|
-
const ctxValue =
|
|
4871
|
+
const ctxValue = React33__namespace.useMemo(() => ({
|
|
4090
4872
|
value: currentValue,
|
|
4091
4873
|
selectedItems,
|
|
4092
4874
|
collection,
|
|
@@ -4106,7 +4888,7 @@ var SelectRoot = React29__namespace.forwardRef(
|
|
|
4106
4888
|
if (typeof v === "string") return v;
|
|
4107
4889
|
return v.base ?? v.lg ?? Object.values(v)[0];
|
|
4108
4890
|
};
|
|
4109
|
-
const inlineStyle =
|
|
4891
|
+
const inlineStyle = React33__namespace.useMemo(() => {
|
|
4110
4892
|
const s = { ...style };
|
|
4111
4893
|
const rw = resolveVal(w);
|
|
4112
4894
|
if (rw) s.width = rw;
|
|
@@ -4144,7 +4926,7 @@ var SelectRoot = React29__namespace.forwardRef(
|
|
|
4144
4926
|
) });
|
|
4145
4927
|
}
|
|
4146
4928
|
);
|
|
4147
|
-
var SelectControl =
|
|
4929
|
+
var SelectControl = React33__namespace.forwardRef(
|
|
4148
4930
|
function SelectControl2(props, ref) {
|
|
4149
4931
|
const { children, noIndicator, triggerProps, loading, defaultValue } = props;
|
|
4150
4932
|
const ctx = useSelectInternalContext();
|
|
@@ -4181,11 +4963,11 @@ var SelectControl = React29__namespace.forwardRef(
|
|
|
4181
4963
|
return trigger;
|
|
4182
4964
|
}
|
|
4183
4965
|
);
|
|
4184
|
-
var SelectClearTrigger =
|
|
4966
|
+
var SelectClearTrigger = React33__namespace.forwardRef(
|
|
4185
4967
|
function SelectClearTrigger2(props, ref) {
|
|
4186
4968
|
const { className, ...rest } = props;
|
|
4187
4969
|
const ctx = useSelectInternalContext();
|
|
4188
|
-
const handleClick =
|
|
4970
|
+
const handleClick = React33__namespace.useCallback(() => {
|
|
4189
4971
|
ctx.onValueChange({ value: [], items: [] });
|
|
4190
4972
|
}, [ctx]);
|
|
4191
4973
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4202,7 +4984,7 @@ var SelectClearTrigger = React29__namespace.forwardRef(
|
|
|
4202
4984
|
);
|
|
4203
4985
|
}
|
|
4204
4986
|
);
|
|
4205
|
-
var SelectContent =
|
|
4987
|
+
var SelectContent = React33__namespace.forwardRef(
|
|
4206
4988
|
function SelectContent2(props, ref) {
|
|
4207
4989
|
const { portalled = true, portalRef, children, className, ...rest } = props;
|
|
4208
4990
|
const content = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4229,7 +5011,7 @@ var SelectContent = React29__namespace.forwardRef(
|
|
|
4229
5011
|
return content;
|
|
4230
5012
|
}
|
|
4231
5013
|
);
|
|
4232
|
-
var SelectItem =
|
|
5014
|
+
var SelectItem = React33__namespace.forwardRef(
|
|
4233
5015
|
function SelectItem2(props, ref) {
|
|
4234
5016
|
const { item, children, className, ...rest } = props;
|
|
4235
5017
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4257,7 +5039,7 @@ var SelectItem = React29__namespace.forwardRef(
|
|
|
4257
5039
|
);
|
|
4258
5040
|
}
|
|
4259
5041
|
);
|
|
4260
|
-
var SelectValueText =
|
|
5042
|
+
var SelectValueText = React33__namespace.forwardRef(
|
|
4261
5043
|
function SelectValueText2(props, ref) {
|
|
4262
5044
|
const { children, size, required, invalid, errorText, mode, className, style, placeholder: placeholderProp, ...rest } = props;
|
|
4263
5045
|
const ctx = useSelectInternalContext();
|
|
@@ -4313,7 +5095,7 @@ var SelectValueText = React29__namespace.forwardRef(
|
|
|
4313
5095
|
);
|
|
4314
5096
|
}
|
|
4315
5097
|
);
|
|
4316
|
-
var SelectItemGroup =
|
|
5098
|
+
var SelectItemGroup = React33__namespace.forwardRef(
|
|
4317
5099
|
function SelectItemGroup2(props, ref) {
|
|
4318
5100
|
const { children, label, className, ...rest } = props;
|
|
4319
5101
|
return /* @__PURE__ */ jsxRuntime.jsxs(RadixSelect__namespace.Group, { ref, className: cn("py-1", className), ...rest, children: [
|
|
@@ -4324,7 +5106,7 @@ var SelectItemGroup = React29__namespace.forwardRef(
|
|
|
4324
5106
|
);
|
|
4325
5107
|
var SelectLabel = RadixSelect__namespace.Label;
|
|
4326
5108
|
var SelectItemText = RadixSelect__namespace.ItemText;
|
|
4327
|
-
var Select =
|
|
5109
|
+
var Select = React33__namespace.forwardRef((props, ref) => {
|
|
4328
5110
|
const { collection, placeholder, portalled = true, loading, errorText, contentProps, contentHeader, itemFilter, mode, ...rest } = props;
|
|
4329
5111
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4330
5112
|
SelectRoot,
|
|
@@ -4346,7 +5128,7 @@ var Select = React29__namespace.forwardRef((props, ref) => {
|
|
|
4346
5128
|
) }),
|
|
4347
5129
|
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { portalled, ...contentProps, children: [
|
|
4348
5130
|
contentHeader,
|
|
4349
|
-
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5131
|
+
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxRuntime.jsxs(React33__namespace.Fragment, { children: [
|
|
4350
5132
|
/* @__PURE__ */ jsxRuntime.jsx(SelectItem, { item, children: item.renderLabel ? item.renderLabel("item") : item.label }),
|
|
4351
5133
|
item.afterElement
|
|
4352
5134
|
] }, item.value))
|
|
@@ -4355,19 +5137,19 @@ var Select = React29__namespace.forwardRef((props, ref) => {
|
|
|
4355
5137
|
}
|
|
4356
5138
|
);
|
|
4357
5139
|
});
|
|
4358
|
-
var SelectAsync =
|
|
5140
|
+
var SelectAsync = React33__namespace.forwardRef((props, ref) => {
|
|
4359
5141
|
const { placeholder, portalled = true, loading, loadOptions, extraControls, onValueChange, errorText, mode, contentHeader, ...rest } = props;
|
|
4360
|
-
const [collection, setCollection] =
|
|
4361
|
-
const [inputValue, setInputValue] =
|
|
4362
|
-
const [value, setValue] =
|
|
5142
|
+
const [collection, setCollection] = React33__namespace.useState(createListCollection({ items: [] }));
|
|
5143
|
+
const [inputValue, setInputValue] = React33__namespace.useState("");
|
|
5144
|
+
const [value, setValue] = React33__namespace.useState([]);
|
|
4363
5145
|
const debouncedInputValue = usehooks.useDebounce(inputValue, 300);
|
|
4364
|
-
|
|
5146
|
+
React33__namespace.useEffect(() => {
|
|
4365
5147
|
loadOptions(debouncedInputValue, value).then(setCollection);
|
|
4366
5148
|
}, [debouncedInputValue, loadOptions, value]);
|
|
4367
|
-
const handleFilterChange =
|
|
5149
|
+
const handleFilterChange = React33__namespace.useCallback((val) => {
|
|
4368
5150
|
setInputValue(val);
|
|
4369
5151
|
}, []);
|
|
4370
|
-
const handleValueChange =
|
|
5152
|
+
const handleValueChange = React33__namespace.useCallback(({ value: v, items }) => {
|
|
4371
5153
|
setValue(v);
|
|
4372
5154
|
onValueChange?.({ value: v, items });
|
|
4373
5155
|
}, [onValueChange]);
|
|
@@ -4426,13 +5208,14 @@ var VERTICAL_SIZE_CLASSES = {
|
|
|
4426
5208
|
md: "border-l-2",
|
|
4427
5209
|
lg: "border-l-[3px]"
|
|
4428
5210
|
};
|
|
4429
|
-
var Separator2 =
|
|
5211
|
+
var Separator2 = React33__namespace.default.forwardRef(
|
|
4430
5212
|
function Separator3({ orientation = "horizontal", variant = "solid", size = "sm", className, ...rest }, ref) {
|
|
4431
5213
|
const isVertical = orientation === "vertical";
|
|
4432
5214
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4433
|
-
|
|
5215
|
+
gui.Separator,
|
|
4434
5216
|
{
|
|
4435
5217
|
ref,
|
|
5218
|
+
vertical: isVertical,
|
|
4436
5219
|
role: "separator",
|
|
4437
5220
|
"aria-orientation": orientation,
|
|
4438
5221
|
className: cn(
|
|
@@ -4448,9 +5231,7 @@ var Separator2 = React29__namespace.default.forwardRef(
|
|
|
4448
5231
|
);
|
|
4449
5232
|
}
|
|
4450
5233
|
);
|
|
4451
|
-
var
|
|
4452
|
-
var TRACK_HEIGHT = 6;
|
|
4453
|
-
var Slider = React29__namespace.forwardRef(
|
|
5234
|
+
var Slider = React33__namespace.forwardRef(
|
|
4454
5235
|
function Slider2(props, ref) {
|
|
4455
5236
|
const {
|
|
4456
5237
|
marks: marksProp,
|
|
@@ -4462,7 +5243,7 @@ var Slider = React29__namespace.forwardRef(
|
|
|
4462
5243
|
max = 100,
|
|
4463
5244
|
step,
|
|
4464
5245
|
disabled,
|
|
4465
|
-
orientation,
|
|
5246
|
+
orientation = "horizontal",
|
|
4466
5247
|
name,
|
|
4467
5248
|
onValueChange,
|
|
4468
5249
|
onValueCommit,
|
|
@@ -4474,6 +5255,14 @@ var Slider = React29__namespace.forwardRef(
|
|
|
4474
5255
|
return mark;
|
|
4475
5256
|
});
|
|
4476
5257
|
const hasMarkLabel = Boolean(marks?.some((mark) => mark.label));
|
|
5258
|
+
const latest = React33__namespace.useRef(value ?? defaultValue ?? []);
|
|
5259
|
+
const handleValueChange = React33__namespace.useCallback((next) => {
|
|
5260
|
+
latest.current = next;
|
|
5261
|
+
onValueChange?.(next);
|
|
5262
|
+
}, [onValueChange]);
|
|
5263
|
+
const handleSlideEnd = React33__namespace.useCallback(() => {
|
|
5264
|
+
onValueCommit?.(latest.current);
|
|
5265
|
+
}, [onValueCommit]);
|
|
4477
5266
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
4478
5267
|
label && !showValue && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
|
|
4479
5268
|
label && showValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -4481,9 +5270,10 @@ var Slider = React29__namespace.forwardRef(
|
|
|
4481
5270
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
|
|
4482
5271
|
] }),
|
|
4483
5272
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4484
|
-
|
|
5273
|
+
gui.Slider,
|
|
4485
5274
|
{
|
|
4486
5275
|
ref,
|
|
5276
|
+
unstyled: true,
|
|
4487
5277
|
className: cn(
|
|
4488
5278
|
"relative flex w-full touch-none select-none items-center",
|
|
4489
5279
|
hasMarkLabel && "mb-6"
|
|
@@ -4496,24 +5286,30 @@ var Slider = React29__namespace.forwardRef(
|
|
|
4496
5286
|
disabled,
|
|
4497
5287
|
orientation,
|
|
4498
5288
|
name,
|
|
4499
|
-
onValueChange,
|
|
4500
|
-
|
|
5289
|
+
onValueChange: handleValueChange,
|
|
5290
|
+
onSlideEnd: handleSlideEnd,
|
|
4501
5291
|
children: [
|
|
4502
5292
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4503
|
-
|
|
5293
|
+
gui.Slider.Track,
|
|
4504
5294
|
{
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
5295
|
+
unstyled: true,
|
|
5296
|
+
className: "relative grow h-1.5 rounded-full bg-border-divider",
|
|
5297
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5298
|
+
gui.Slider.TrackActive,
|
|
5299
|
+
{
|
|
5300
|
+
unstyled: true,
|
|
5301
|
+
className: "absolute h-full rounded-full bg-link-primary"
|
|
5302
|
+
}
|
|
5303
|
+
)
|
|
4510
5304
|
}
|
|
4511
5305
|
),
|
|
4512
5306
|
resolvedValue?.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4513
|
-
|
|
5307
|
+
gui.Slider.Thumb,
|
|
4514
5308
|
{
|
|
5309
|
+
index,
|
|
5310
|
+
unstyled: true,
|
|
4515
5311
|
className: cn(
|
|
4516
|
-
|
|
5312
|
+
"block h-5 w-5",
|
|
4517
5313
|
"rounded-full border-2 border-link-primary bg-white",
|
|
4518
5314
|
"shadow-sm transition-colors",
|
|
4519
5315
|
"hover:border-link-primary-hover",
|
|
@@ -4555,21 +5351,21 @@ var NOOP3 = () => {
|
|
|
4555
5351
|
var SIZE_CLASSES9 = {
|
|
4556
5352
|
sm: {
|
|
4557
5353
|
root: "h-4 w-7",
|
|
4558
|
-
thumb: "h-3 w-3
|
|
5354
|
+
thumb: "h-3 w-3",
|
|
4559
5355
|
label: "text-xs"
|
|
4560
5356
|
},
|
|
4561
5357
|
md: {
|
|
4562
5358
|
root: "h-5 w-9",
|
|
4563
|
-
thumb: "h-4 w-4
|
|
5359
|
+
thumb: "h-4 w-4",
|
|
4564
5360
|
label: "text-sm"
|
|
4565
5361
|
},
|
|
4566
5362
|
lg: {
|
|
4567
5363
|
root: "h-6 w-11",
|
|
4568
|
-
thumb: "h-5 w-5
|
|
5364
|
+
thumb: "h-5 w-5",
|
|
4569
5365
|
label: "text-base"
|
|
4570
5366
|
}
|
|
4571
5367
|
};
|
|
4572
|
-
var SwitchBase =
|
|
5368
|
+
var SwitchBase = React33__namespace.forwardRef(
|
|
4573
5369
|
function Switch(props, ref) {
|
|
4574
5370
|
const {
|
|
4575
5371
|
inputProps,
|
|
@@ -4588,17 +5384,15 @@ var SwitchBase = React29__namespace.forwardRef(
|
|
|
4588
5384
|
className,
|
|
4589
5385
|
...rest
|
|
4590
5386
|
} = props;
|
|
4591
|
-
const [internalChecked, setInternalChecked] =
|
|
5387
|
+
const [internalChecked, setInternalChecked] = React33__namespace.useState(defaultChecked ?? false);
|
|
4592
5388
|
const isControlled = checkedProp !== void 0;
|
|
4593
5389
|
const checkedState = isControlled ? checkedProp : internalChecked;
|
|
4594
|
-
const handleCheckedChange =
|
|
5390
|
+
const handleCheckedChange = React33__namespace.useCallback(
|
|
4595
5391
|
(nextChecked) => {
|
|
4596
5392
|
if (!isControlled) {
|
|
4597
5393
|
setInternalChecked(nextChecked);
|
|
4598
5394
|
}
|
|
4599
|
-
|
|
4600
|
-
onCheckedChange({ checked: nextChecked });
|
|
4601
|
-
}
|
|
5395
|
+
onCheckedChange?.({ checked: nextChecked });
|
|
4602
5396
|
},
|
|
4603
5397
|
[isControlled, onCheckedChange]
|
|
4604
5398
|
);
|
|
@@ -4619,8 +5413,9 @@ var SwitchBase = React29__namespace.forwardRef(
|
|
|
4619
5413
|
...rest,
|
|
4620
5414
|
children: [
|
|
4621
5415
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4622
|
-
|
|
5416
|
+
gui.Switch,
|
|
4623
5417
|
{
|
|
5418
|
+
unstyled: true,
|
|
4624
5419
|
checked: checkedState,
|
|
4625
5420
|
onCheckedChange: handleCheckedChange,
|
|
4626
5421
|
disabled,
|
|
@@ -4635,12 +5430,13 @@ var SwitchBase = React29__namespace.forwardRef(
|
|
|
4635
5430
|
children: [
|
|
4636
5431
|
trackLabel && /* @__PURE__ */ jsxRuntime.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 }),
|
|
4637
5432
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4638
|
-
|
|
5433
|
+
gui.Switch.Thumb,
|
|
4639
5434
|
{
|
|
5435
|
+
unstyled: true,
|
|
5436
|
+
"data-thumb": true,
|
|
5437
|
+
transition: "quicker",
|
|
4640
5438
|
className: cn(
|
|
4641
5439
|
"block rounded-full bg-white shadow-sm",
|
|
4642
|
-
"transition-transform duration-200",
|
|
4643
|
-
"translate-x-0.5",
|
|
4644
5440
|
sizeClasses2.thumb
|
|
4645
5441
|
),
|
|
4646
5442
|
children: thumbLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center justify-center h-full w-full text-[8px]", children: checkedState ? thumbLabel.on : thumbLabel.off })
|
|
@@ -4856,7 +5652,7 @@ function resolveResponsive(value) {
|
|
|
4856
5652
|
}
|
|
4857
5653
|
return void 0;
|
|
4858
5654
|
}
|
|
4859
|
-
var TableRoot =
|
|
5655
|
+
var TableRoot = React33__namespace.forwardRef(
|
|
4860
5656
|
function TableRoot2(props, ref) {
|
|
4861
5657
|
const { className, style: styleProp, children, ...other } = props;
|
|
4862
5658
|
const rawMinW = other.minWidth ?? other.minW;
|
|
@@ -4879,7 +5675,7 @@ var TableRoot = React29__namespace.forwardRef(
|
|
|
4879
5675
|
);
|
|
4880
5676
|
}
|
|
4881
5677
|
);
|
|
4882
|
-
var TableHeader =
|
|
5678
|
+
var TableHeader = React33__namespace.forwardRef(
|
|
4883
5679
|
function TableHeader2(props, ref) {
|
|
4884
5680
|
const { className, style: styleProp, children, ...other } = props;
|
|
4885
5681
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4896,7 +5692,7 @@ var TableHeader = React29__namespace.forwardRef(
|
|
|
4896
5692
|
);
|
|
4897
5693
|
}
|
|
4898
5694
|
);
|
|
4899
|
-
var TableBody =
|
|
5695
|
+
var TableBody = React33__namespace.forwardRef(
|
|
4900
5696
|
function TableBody2(props, ref) {
|
|
4901
5697
|
const { className, style: styleProp, children, ...other } = props;
|
|
4902
5698
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4913,7 +5709,7 @@ var TableBody = React29__namespace.forwardRef(
|
|
|
4913
5709
|
);
|
|
4914
5710
|
}
|
|
4915
5711
|
);
|
|
4916
|
-
var TableRow =
|
|
5712
|
+
var TableRow = React33__namespace.forwardRef(
|
|
4917
5713
|
function TableRow2(props, ref) {
|
|
4918
5714
|
const { className, style: styleProp, children, ...other } = props;
|
|
4919
5715
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4930,7 +5726,7 @@ var TableRow = React29__namespace.forwardRef(
|
|
|
4930
5726
|
);
|
|
4931
5727
|
}
|
|
4932
5728
|
);
|
|
4933
|
-
var TableCell =
|
|
5729
|
+
var TableCell = React33__namespace.forwardRef(
|
|
4934
5730
|
function TableCell2(props, ref) {
|
|
4935
5731
|
const { isNumeric, className, style: styleProp, children, ...other } = props;
|
|
4936
5732
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4951,7 +5747,7 @@ var TableCell = React29__namespace.forwardRef(
|
|
|
4951
5747
|
);
|
|
4952
5748
|
}
|
|
4953
5749
|
);
|
|
4954
|
-
var TableColumnHeader =
|
|
5750
|
+
var TableColumnHeader = React33__namespace.forwardRef(
|
|
4955
5751
|
function TableColumnHeader2(props, ref) {
|
|
4956
5752
|
const { isNumeric, className, style: styleProp, children, ...other } = props;
|
|
4957
5753
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4978,7 +5774,7 @@ var TableColumnHeader = React29__namespace.forwardRef(
|
|
|
4978
5774
|
);
|
|
4979
5775
|
var TableColumnHeaderSortable = (props) => {
|
|
4980
5776
|
const { sortField, sortValue, onSortToggle, children, disabled, indicatorPosition = "left", contentAfter, ...rest } = props;
|
|
4981
|
-
const handleSortToggle =
|
|
5777
|
+
const handleSortToggle = React33__namespace.useCallback(() => {
|
|
4982
5778
|
onSortToggle(sortField);
|
|
4983
5779
|
}, [onSortToggle, sortField]);
|
|
4984
5780
|
const isActive = sortValue.includes(sortField);
|
|
@@ -5004,16 +5800,16 @@ var TableColumnHeaderSortable = (props) => {
|
|
|
5004
5800
|
var ACTION_BAR_SHADOW = "0 4px 4px -4px rgb(0 0 0 / 10%), 0 2px 4px -4px rgb(0 0 0 / 6%)";
|
|
5005
5801
|
var TableHeaderSticky = (props) => {
|
|
5006
5802
|
const { top, children, className, style: styleProp, ...rest } = props;
|
|
5007
|
-
const ref =
|
|
5008
|
-
const [isStuck, setIsStuck] =
|
|
5009
|
-
const handleScroll =
|
|
5803
|
+
const ref = React33__namespace.useRef(null);
|
|
5804
|
+
const [isStuck, setIsStuck] = React33__namespace.useState(false);
|
|
5805
|
+
const handleScroll = React33__namespace.useCallback(() => {
|
|
5010
5806
|
if (Number(ref.current?.getBoundingClientRect().y) <= (Number(top) || 0)) {
|
|
5011
5807
|
setIsStuck(true);
|
|
5012
5808
|
} else {
|
|
5013
5809
|
setIsStuck(false);
|
|
5014
5810
|
}
|
|
5015
5811
|
}, [top]);
|
|
5016
|
-
|
|
5812
|
+
React33__namespace.useEffect(() => {
|
|
5017
5813
|
const throttledHandleScroll = esToolkit.throttle(handleScroll, 300);
|
|
5018
5814
|
window.addEventListener("scroll", throttledHandleScroll);
|
|
5019
5815
|
return () => {
|
|
@@ -5035,7 +5831,7 @@ var TableHeaderSticky = (props) => {
|
|
|
5035
5831
|
}
|
|
5036
5832
|
);
|
|
5037
5833
|
};
|
|
5038
|
-
var TableCaption =
|
|
5834
|
+
var TableCaption = React33__namespace.forwardRef(
|
|
5039
5835
|
function TableCaption2(props, ref) {
|
|
5040
5836
|
const { className, style: styleProp, children, ...other } = props;
|
|
5041
5837
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5052,7 +5848,7 @@ var TableCaption = React29__namespace.forwardRef(
|
|
|
5052
5848
|
);
|
|
5053
5849
|
}
|
|
5054
5850
|
);
|
|
5055
|
-
var TableFooter =
|
|
5851
|
+
var TableFooter = React33__namespace.forwardRef(
|
|
5056
5852
|
function TableFooter2(props, ref) {
|
|
5057
5853
|
const { className, style: styleProp, children, ...other } = props;
|
|
5058
5854
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5069,7 +5865,7 @@ var TableFooter = React29__namespace.forwardRef(
|
|
|
5069
5865
|
);
|
|
5070
5866
|
}
|
|
5071
5867
|
);
|
|
5072
|
-
var TableScrollWrapper =
|
|
5868
|
+
var TableScrollWrapper = React33__namespace.forwardRef(
|
|
5073
5869
|
function TableScrollWrapper2(props, ref) {
|
|
5074
5870
|
const { className, children, ...rest } = props;
|
|
5075
5871
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5088,7 +5884,7 @@ var ROOT_SIZE_CLASSES = {
|
|
|
5088
5884
|
md: "[--tabs-height:2.5rem] [--tabs-content-padding:1.5rem]",
|
|
5089
5885
|
free: ""
|
|
5090
5886
|
};
|
|
5091
|
-
var TabsRoot =
|
|
5887
|
+
var TabsRoot = React33__namespace.forwardRef(
|
|
5092
5888
|
function TabsRoot2(props, ref) {
|
|
5093
5889
|
const {
|
|
5094
5890
|
variant = "solid",
|
|
@@ -5100,7 +5896,7 @@ var TabsRoot = React29__namespace.forwardRef(
|
|
|
5100
5896
|
className,
|
|
5101
5897
|
...rest
|
|
5102
5898
|
} = props;
|
|
5103
|
-
const handleValueChange =
|
|
5899
|
+
const handleValueChange = React33__namespace.useCallback(
|
|
5104
5900
|
(value) => {
|
|
5105
5901
|
if (!onValueChange) return;
|
|
5106
5902
|
onValueChange({ value });
|
|
@@ -5125,7 +5921,7 @@ var TabsRoot = React29__namespace.forwardRef(
|
|
|
5125
5921
|
);
|
|
5126
5922
|
}
|
|
5127
5923
|
);
|
|
5128
|
-
var TabsList =
|
|
5924
|
+
var TabsList = React33__namespace.forwardRef(
|
|
5129
5925
|
function TabsList2(props, ref) {
|
|
5130
5926
|
const {
|
|
5131
5927
|
className,
|
|
@@ -5179,7 +5975,7 @@ var TRIGGER_VARIANT_CLASSES = {
|
|
|
5179
5975
|
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",
|
|
5180
5976
|
unstyled: ""
|
|
5181
5977
|
};
|
|
5182
|
-
var TabsTrigger =
|
|
5978
|
+
var TabsTrigger = React33__namespace.forwardRef(
|
|
5183
5979
|
function TabsTrigger2(props, ref) {
|
|
5184
5980
|
const {
|
|
5185
5981
|
className,
|
|
@@ -5199,7 +5995,7 @@ var TabsTrigger = React29__namespace.forwardRef(
|
|
|
5199
5995
|
visibility: _visibility,
|
|
5200
5996
|
...rest
|
|
5201
5997
|
} = props;
|
|
5202
|
-
const internalRef =
|
|
5998
|
+
const internalRef = React33__namespace.useRef(null);
|
|
5203
5999
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
5204
6000
|
const { variant, size, fitted } = useTabsContext(internalRef);
|
|
5205
6001
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5219,7 +6015,7 @@ var TabsTrigger = React29__namespace.forwardRef(
|
|
|
5219
6015
|
);
|
|
5220
6016
|
}
|
|
5221
6017
|
);
|
|
5222
|
-
var TabsContent =
|
|
6018
|
+
var TabsContent = React33__namespace.forwardRef(
|
|
5223
6019
|
function TabsContent2(props, ref) {
|
|
5224
6020
|
const { className, padding: _padding, ...rest } = props;
|
|
5225
6021
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5253,8 +6049,8 @@ var TabsCounter = ({ count }) => {
|
|
|
5253
6049
|
);
|
|
5254
6050
|
};
|
|
5255
6051
|
function useTabsContext(triggerRef) {
|
|
5256
|
-
const [ctx, setCtx] =
|
|
5257
|
-
|
|
6052
|
+
const [ctx, setCtx] = React33__namespace.useState({ variant: "solid", size: "md", fitted: false });
|
|
6053
|
+
React33__namespace.useEffect(() => {
|
|
5258
6054
|
const el = triggerRef.current;
|
|
5259
6055
|
if (!el) return;
|
|
5260
6056
|
const root = el.closest("[data-variant]");
|
|
@@ -5268,7 +6064,7 @@ function useTabsContext(triggerRef) {
|
|
|
5268
6064
|
return ctx;
|
|
5269
6065
|
}
|
|
5270
6066
|
function useMergedRef(...refs) {
|
|
5271
|
-
return
|
|
6067
|
+
return React33__namespace.useCallback(
|
|
5272
6068
|
(instance) => {
|
|
5273
6069
|
for (const ref of refs) {
|
|
5274
6070
|
if (!ref) continue;
|
|
@@ -5306,7 +6102,7 @@ var TAG_SELECTED_CLASSES = [
|
|
|
5306
6102
|
"hover:opacity-76"
|
|
5307
6103
|
].join(" ");
|
|
5308
6104
|
var TAG_DISABLED_CLASSES = "opacity-40 pointer-events-none cursor-not-allowed";
|
|
5309
|
-
var Tag =
|
|
6105
|
+
var Tag = React33__namespace.forwardRef(
|
|
5310
6106
|
function Tag2(props, ref) {
|
|
5311
6107
|
const {
|
|
5312
6108
|
variant,
|
|
@@ -5393,14 +6189,23 @@ var TEXTAREA_VARIANT_CLASSES = {
|
|
|
5393
6189
|
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
5394
6190
|
unstyled: "border-0 bg-transparent p-0"
|
|
5395
6191
|
};
|
|
5396
|
-
var Textarea =
|
|
5397
|
-
({ size = "md", variant = "outline", className, ...rest }, ref) => {
|
|
6192
|
+
var Textarea = React33__namespace.default.forwardRef(
|
|
6193
|
+
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
6194
|
+
const handleChange = React33__namespace.default.useCallback(
|
|
6195
|
+
(event) => {
|
|
6196
|
+
onChange?.(event);
|
|
6197
|
+
onChangeText?.(event.target.value);
|
|
6198
|
+
},
|
|
6199
|
+
[onChange, onChangeText]
|
|
6200
|
+
);
|
|
5398
6201
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5399
|
-
|
|
6202
|
+
gui.TextArea,
|
|
5400
6203
|
{
|
|
5401
6204
|
ref,
|
|
6205
|
+
unstyled: true,
|
|
5402
6206
|
className: cn(TEXTAREA_BASE, TEXTAREA_SIZE_CLASSES[size], TEXTAREA_VARIANT_CLASSES[variant], className),
|
|
5403
|
-
...rest
|
|
6207
|
+
...rest,
|
|
6208
|
+
onChange: handleChange
|
|
5404
6209
|
}
|
|
5405
6210
|
);
|
|
5406
6211
|
}
|
|
@@ -5529,7 +6334,7 @@ function QuoteCell({ value, highlight, align = "right", onClick, className }) {
|
|
|
5529
6334
|
}
|
|
5530
6335
|
var CALL_HEADERS = ["Bid", "Ask", "Last", "Vol", "OI", "IV", "Delta"];
|
|
5531
6336
|
var PUT_HEADERS = ["Delta", "IV", "OI", "Vol", "Last", "Ask", "Bid"];
|
|
5532
|
-
var OptionChain =
|
|
6337
|
+
var OptionChain = React33__namespace.forwardRef(
|
|
5533
6338
|
function OptionChain2(props, ref) {
|
|
5534
6339
|
const {
|
|
5535
6340
|
symbol: _symbol,
|
|
@@ -5540,7 +6345,7 @@ var OptionChain = React29__namespace.forwardRef(
|
|
|
5540
6345
|
className,
|
|
5541
6346
|
...rest
|
|
5542
6347
|
} = props;
|
|
5543
|
-
const handleClick =
|
|
6348
|
+
const handleClick = React33__namespace.useCallback(
|
|
5544
6349
|
(quote, type, strike) => {
|
|
5545
6350
|
if (!quote || !onSelectContract) return;
|
|
5546
6351
|
onSelectContract({
|
|
@@ -5646,7 +6451,7 @@ var OptionChain = React29__namespace.forwardRef(
|
|
|
5646
6451
|
{
|
|
5647
6452
|
className: cn(
|
|
5648
6453
|
"px-2 py-1 text-center font-mono tabular-nums text-xs font-semibold",
|
|
5649
|
-
isATM ? "text-
|
|
6454
|
+
isATM ? "text-[var(--foreground)] bg-[var(--secondary)]" : "text-[var(--muted-foreground)]"
|
|
5650
6455
|
),
|
|
5651
6456
|
children: fmt(row.strike)
|
|
5652
6457
|
}
|
|
@@ -5685,12 +6490,12 @@ var OptionChain = React29__namespace.forwardRef(
|
|
|
5685
6490
|
}
|
|
5686
6491
|
);
|
|
5687
6492
|
var GREEKS = [
|
|
5688
|
-
{ key: "delta", label: "Delta", symbol: "\u0394", color: "text-
|
|
5689
|
-
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "text-
|
|
5690
|
-
{ key: "theta", label: "Theta", symbol: "\u0398", color: "text-
|
|
5691
|
-
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "text-
|
|
5692
|
-
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "text-
|
|
5693
|
-
{ key: "iv", label: "IV", symbol: "\u03C3", color: "text-
|
|
6493
|
+
{ key: "delta", label: "Delta", symbol: "\u0394", color: "text-[var(--foreground)]", barColor: "bg-[var(--foreground)]", decimals: 4, maxMagnitude: 1 },
|
|
6494
|
+
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "text-[var(--chart-1)]", barColor: "bg-[var(--chart-1)]", decimals: 4, maxMagnitude: 0.1 },
|
|
6495
|
+
{ key: "theta", label: "Theta", symbol: "\u0398", color: "text-[var(--chart-4)]", barColor: "bg-[var(--chart-4)]", decimals: 4, maxMagnitude: 1 },
|
|
6496
|
+
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "text-[var(--chart-2)]", barColor: "bg-[var(--chart-2)]", decimals: 4, maxMagnitude: 1 },
|
|
6497
|
+
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "text-[var(--chart-3)]", barColor: "bg-[var(--chart-3)]", decimals: 4, maxMagnitude: 1 },
|
|
6498
|
+
{ key: "iv", label: "IV", symbol: "\u03C3", color: "text-[var(--chart-5)]", barColor: "bg-[var(--chart-5)]", decimals: 1, maxMagnitude: 100 }
|
|
5694
6499
|
];
|
|
5695
6500
|
function GreekItem({ def, value, compact }) {
|
|
5696
6501
|
const magnitude = Math.min(Math.abs(value) / def.maxMagnitude, 1);
|
|
@@ -5720,7 +6525,7 @@ function GreekItem({ def, value, compact }) {
|
|
|
5720
6525
|
}
|
|
5721
6526
|
);
|
|
5722
6527
|
}
|
|
5723
|
-
var GreeksDisplay =
|
|
6528
|
+
var GreeksDisplay = React33__namespace.forwardRef(
|
|
5724
6529
|
function GreeksDisplay2(props, ref) {
|
|
5725
6530
|
const {
|
|
5726
6531
|
delta,
|
|
@@ -5897,7 +6702,8 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
5897
6702
|
type: "button",
|
|
5898
6703
|
className: cn(
|
|
5899
6704
|
"px-2 py-0.5 rounded text-xs font-medium transition-colors",
|
|
5900
|
-
|
|
6705
|
+
// Call vs put is a rank difference, not a hue difference.
|
|
6706
|
+
leg.type === "call" ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
|
|
5901
6707
|
),
|
|
5902
6708
|
onClick: () => update2({ type: leg.type === "call" ? "put" : "call" }),
|
|
5903
6709
|
children: leg.type === "call" ? "CALL" : "PUT"
|
|
@@ -5951,7 +6757,7 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
5951
6757
|
)
|
|
5952
6758
|
] });
|
|
5953
6759
|
}
|
|
5954
|
-
var StrategyBuilder =
|
|
6760
|
+
var StrategyBuilder = React33__namespace.forwardRef(
|
|
5955
6761
|
function StrategyBuilder2(props, ref) {
|
|
5956
6762
|
const {
|
|
5957
6763
|
underlying,
|
|
@@ -5963,12 +6769,12 @@ var StrategyBuilder = React29__namespace.forwardRef(
|
|
|
5963
6769
|
...rest
|
|
5964
6770
|
} = props;
|
|
5965
6771
|
const defaultExp = expirations[0] ?? "";
|
|
5966
|
-
const [strategyType, setStrategyType] =
|
|
5967
|
-
const [legs, setLegs] =
|
|
6772
|
+
const [strategyType, setStrategyType] = React33__namespace.useState("bull_call_spread");
|
|
6773
|
+
const [legs, setLegs] = React33__namespace.useState(() => {
|
|
5968
6774
|
const preset = STRATEGY_PRESETS.find((p) => p.value === "bull_call_spread");
|
|
5969
6775
|
return preset ? preset.buildLegs(strikes, spotPrice, defaultExp) : [];
|
|
5970
6776
|
});
|
|
5971
|
-
const handleStrategyChange =
|
|
6777
|
+
const handleStrategyChange = React33__namespace.useCallback(
|
|
5972
6778
|
(e) => {
|
|
5973
6779
|
const type = e.target.value;
|
|
5974
6780
|
setStrategyType(type);
|
|
@@ -5979,7 +6785,7 @@ var StrategyBuilder = React29__namespace.forwardRef(
|
|
|
5979
6785
|
},
|
|
5980
6786
|
[strikes, spotPrice, defaultExp]
|
|
5981
6787
|
);
|
|
5982
|
-
const handleLegChange =
|
|
6788
|
+
const handleLegChange = React33__namespace.useCallback(
|
|
5983
6789
|
(index, leg) => {
|
|
5984
6790
|
setLegs((prev) => {
|
|
5985
6791
|
const next = [...prev];
|
|
@@ -5989,13 +6795,13 @@ var StrategyBuilder = React29__namespace.forwardRef(
|
|
|
5989
6795
|
},
|
|
5990
6796
|
[]
|
|
5991
6797
|
);
|
|
5992
|
-
const handleLegRemove =
|
|
6798
|
+
const handleLegRemove = React33__namespace.useCallback(
|
|
5993
6799
|
(index) => {
|
|
5994
6800
|
setLegs((prev) => prev.filter((_, i) => i !== index));
|
|
5995
6801
|
},
|
|
5996
6802
|
[]
|
|
5997
6803
|
);
|
|
5998
|
-
const handleAddLeg =
|
|
6804
|
+
const handleAddLeg = React33__namespace.useCallback(() => {
|
|
5999
6805
|
if (legs.length >= 4) return;
|
|
6000
6806
|
const atm = findATM(strikes, spotPrice);
|
|
6001
6807
|
setLegs((prev) => [
|
|
@@ -6003,14 +6809,14 @@ var StrategyBuilder = React29__namespace.forwardRef(
|
|
|
6003
6809
|
{ action: "buy", type: "call", strike: atm, expiration: defaultExp, quantity: 1 }
|
|
6004
6810
|
]);
|
|
6005
6811
|
}, [legs.length, strikes, spotPrice, defaultExp]);
|
|
6006
|
-
const netPremium =
|
|
6812
|
+
const netPremium = React33__namespace.useMemo(() => {
|
|
6007
6813
|
return legs.reduce((sum, leg) => {
|
|
6008
6814
|
if (leg.premium === void 0) return sum;
|
|
6009
6815
|
const sign = leg.action === "buy" ? -1 : 1;
|
|
6010
6816
|
return sum + sign * leg.premium * leg.quantity;
|
|
6011
6817
|
}, 0);
|
|
6012
6818
|
}, [legs]);
|
|
6013
|
-
const handleSubmit =
|
|
6819
|
+
const handleSubmit = React33__namespace.useCallback(() => {
|
|
6014
6820
|
if (!onSubmit || legs.length === 0) return;
|
|
6015
6821
|
onSubmit({
|
|
6016
6822
|
type: strategyType,
|
|
@@ -6130,8 +6936,10 @@ function buildPath(points, vb, width, height) {
|
|
|
6130
6936
|
});
|
|
6131
6937
|
return parts.join(" ");
|
|
6132
6938
|
}
|
|
6133
|
-
var LEG_COLORS = ["
|
|
6134
|
-
var
|
|
6939
|
+
var LEG_COLORS = ["var(--chart-1)", "var(--chart-2)", "var(--chart-3)", "var(--chart-4)"];
|
|
6940
|
+
var BREAKEVEN_COLOR = "var(--chart-1)";
|
|
6941
|
+
var BREAKEVEN_RING = "var(--background)";
|
|
6942
|
+
var PnlDiagram = React33__namespace.forwardRef(
|
|
6135
6943
|
function PnlDiagram2(props, ref) {
|
|
6136
6944
|
const {
|
|
6137
6945
|
legs,
|
|
@@ -6140,10 +6948,10 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6140
6948
|
className,
|
|
6141
6949
|
...rest
|
|
6142
6950
|
} = props;
|
|
6143
|
-
const containerRef =
|
|
6144
|
-
const [hoverX, setHoverX] =
|
|
6145
|
-
const [dims, setDims] =
|
|
6146
|
-
|
|
6951
|
+
const containerRef = React33__namespace.useRef(null);
|
|
6952
|
+
const [hoverX, setHoverX] = React33__namespace.useState(null);
|
|
6953
|
+
const [dims, setDims] = React33__namespace.useState({ width: 600, height: 240 });
|
|
6954
|
+
React33__namespace.useEffect(() => {
|
|
6147
6955
|
const el = containerRef.current;
|
|
6148
6956
|
if (!el) return;
|
|
6149
6957
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -6166,7 +6974,7 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6166
6974
|
const xMax = maxStrike + range * 0.3;
|
|
6167
6975
|
const SAMPLES = 200;
|
|
6168
6976
|
const step = (xMax - xMin) / SAMPLES;
|
|
6169
|
-
const combinedPoints =
|
|
6977
|
+
const combinedPoints = React33__namespace.useMemo(() => {
|
|
6170
6978
|
const pts = [];
|
|
6171
6979
|
for (let i = 0; i <= SAMPLES; i++) {
|
|
6172
6980
|
const price = xMin + i * step;
|
|
@@ -6174,7 +6982,7 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6174
6982
|
}
|
|
6175
6983
|
return pts;
|
|
6176
6984
|
}, [legs, multiplier, xMin, step]);
|
|
6177
|
-
const legPointSets =
|
|
6985
|
+
const legPointSets = React33__namespace.useMemo(() => {
|
|
6178
6986
|
return legs.map((leg) => {
|
|
6179
6987
|
const pts = [];
|
|
6180
6988
|
for (let i = 0; i <= SAMPLES; i++) {
|
|
@@ -6195,7 +7003,7 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6195
7003
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6196
7004
|
const scaleX = (x) => PADDING.left + (x - vb.xMin) / (vb.xMax - vb.xMin) * chartW;
|
|
6197
7005
|
const scaleY = (y) => PADDING.top + chartH - (y - vb.yMin) / (vb.yMax - vb.yMin) * chartH;
|
|
6198
|
-
const breakevens =
|
|
7006
|
+
const breakevens = React33__namespace.useMemo(() => {
|
|
6199
7007
|
const pts = [];
|
|
6200
7008
|
for (let i = 1; i < combinedPoints.length; i++) {
|
|
6201
7009
|
const prev = combinedPoints[i - 1];
|
|
@@ -6212,7 +7020,7 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6212
7020
|
const maxGainPoint = combinedPoints.find((p) => p.y === maxGain);
|
|
6213
7021
|
const maxLossPoint = combinedPoints.find((p) => p.y === maxLoss);
|
|
6214
7022
|
const zeroY = scaleY(0);
|
|
6215
|
-
const handleMouseMove =
|
|
7023
|
+
const handleMouseMove = React33__namespace.useCallback(
|
|
6216
7024
|
(e) => {
|
|
6217
7025
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
6218
7026
|
const mouseX = e.clientX - rect.left;
|
|
@@ -6225,7 +7033,7 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6225
7033
|
},
|
|
6226
7034
|
[vb.xMin, vb.xMax, chartW]
|
|
6227
7035
|
);
|
|
6228
|
-
const handleMouseLeave =
|
|
7036
|
+
const handleMouseLeave = React33__namespace.useCallback(() => setHoverX(null), []);
|
|
6229
7037
|
const hoverPnl = hoverX !== null ? calcTotalPnl(legs, hoverX, multiplier) : null;
|
|
6230
7038
|
buildPath(
|
|
6231
7039
|
combinedPoints.map((p) => ({ x: scaleX(p.x), y: scaleY(p.y) })).map((p) => ({ x: p.x - PADDING.left, y: p.y - PADDING.top })),
|
|
@@ -6372,13 +7180,13 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6372
7180
|
}
|
|
6373
7181
|
),
|
|
6374
7182
|
breakevens.map((be, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
6375
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill:
|
|
7183
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: scaleX(be), cy: zeroY, r: "3", fill: BREAKEVEN_COLOR, stroke: BREAKEVEN_RING, strokeWidth: "1" }),
|
|
6376
7184
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6377
7185
|
"text",
|
|
6378
7186
|
{
|
|
6379
7187
|
x: scaleX(be),
|
|
6380
7188
|
y: PADDING.top + chartH + 14,
|
|
6381
|
-
fill:
|
|
7189
|
+
fill: BREAKEVEN_COLOR,
|
|
6382
7190
|
fontSize: "8",
|
|
6383
7191
|
fontFamily: "monospace",
|
|
6384
7192
|
textAnchor: "middle",
|
|
@@ -6419,7 +7227,7 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6419
7227
|
cy: scaleY(hoverPnl),
|
|
6420
7228
|
r: "3",
|
|
6421
7229
|
fill: hoverPnl >= 0 ? "#22c55e" : "#ef4444",
|
|
6422
|
-
stroke:
|
|
7230
|
+
stroke: BREAKEVEN_RING,
|
|
6423
7231
|
strokeWidth: "1"
|
|
6424
7232
|
}
|
|
6425
7233
|
),
|
|
@@ -6431,7 +7239,7 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6431
7239
|
width: "90",
|
|
6432
7240
|
height: "28",
|
|
6433
7241
|
rx: "3",
|
|
6434
|
-
fill:
|
|
7242
|
+
fill: BREAKEVEN_RING,
|
|
6435
7243
|
stroke: "#3f3f46",
|
|
6436
7244
|
strokeWidth: "1"
|
|
6437
7245
|
}
|
|
@@ -6513,7 +7321,7 @@ var PnlDiagram = React29__namespace.forwardRef(
|
|
|
6513
7321
|
] })
|
|
6514
7322
|
] }, i)),
|
|
6515
7323
|
breakevens.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
6516
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-1.5 rounded-full
|
|
7324
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-1.5 rounded-full", style: { background: BREAKEVEN_COLOR } }),
|
|
6517
7325
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] text-zinc-500", children: [
|
|
6518
7326
|
"BE: ",
|
|
6519
7327
|
breakevens.map((b) => b.toFixed(1)).join(", ")
|
|
@@ -6529,7 +7337,7 @@ function formatDate(date) {
|
|
|
6529
7337
|
const d = new Date(date);
|
|
6530
7338
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
6531
7339
|
}
|
|
6532
|
-
var OptionPositionCard =
|
|
7340
|
+
var OptionPositionCard = React33__namespace.forwardRef(
|
|
6533
7341
|
function OptionPositionCard2(props, ref) {
|
|
6534
7342
|
const {
|
|
6535
7343
|
position,
|
|
@@ -6555,7 +7363,8 @@ var OptionPositionCard = React29__namespace.forwardRef(
|
|
|
6555
7363
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
6556
7364
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(
|
|
6557
7365
|
"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-semibold",
|
|
6558
|
-
|
|
7366
|
+
// Call vs put is a rank difference, not a hue difference.
|
|
7367
|
+
isCall ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
|
|
6559
7368
|
), children: [
|
|
6560
7369
|
position.underlying,
|
|
6561
7370
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono tabular-nums", children: position.strike }),
|
|
@@ -6681,8 +7490,9 @@ function ExpirationPill({ exp, isSelected, onClick }) {
|
|
|
6681
7490
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium whitespace-nowrap", children: formatExpDate(exp.date) }),
|
|
6682
7491
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(
|
|
6683
7492
|
"font-mono tabular-nums text-[10px]",
|
|
6684
|
-
isSelected ? "text-
|
|
6685
|
-
|
|
7493
|
+
isSelected ? "text-[var(--foreground)]" : "text-[var(--muted-foreground)]",
|
|
7494
|
+
// Near expiry is a notice, and a notice in Lux is the loudest neutral.
|
|
7495
|
+
exp.dte <= 7 && !isSelected && "text-[var(--color-status-warn)]"
|
|
6686
7496
|
), children: [
|
|
6687
7497
|
exp.dte,
|
|
6688
7498
|
"d"
|
|
@@ -6691,7 +7501,7 @@ function ExpirationPill({ exp, isSelected, onClick }) {
|
|
|
6691
7501
|
}
|
|
6692
7502
|
);
|
|
6693
7503
|
}
|
|
6694
|
-
var ExpirationSelector =
|
|
7504
|
+
var ExpirationSelector = React33__namespace.forwardRef(
|
|
6695
7505
|
function ExpirationSelector2(props, ref) {
|
|
6696
7506
|
const {
|
|
6697
7507
|
expirations,
|
|
@@ -6701,8 +7511,8 @@ var ExpirationSelector = React29__namespace.forwardRef(
|
|
|
6701
7511
|
className,
|
|
6702
7512
|
...rest
|
|
6703
7513
|
} = props;
|
|
6704
|
-
const scrollRef =
|
|
6705
|
-
|
|
7514
|
+
const scrollRef = React33__namespace.useRef(null);
|
|
7515
|
+
React33__namespace.useEffect(() => {
|
|
6706
7516
|
const container = scrollRef.current;
|
|
6707
7517
|
if (!container) return;
|
|
6708
7518
|
const selectedEl = container.querySelector('[data-selected="true"]');
|
|
@@ -6784,7 +7594,7 @@ var bankColors = {
|
|
|
6784
7594
|
divider: "#222222",
|
|
6785
7595
|
disabled: "#444444"
|
|
6786
7596
|
};
|
|
6787
|
-
var BankCard =
|
|
7597
|
+
var BankCard = gui.styled(gui.View, {
|
|
6788
7598
|
name: "BankCard",
|
|
6789
7599
|
backgroundColor: bankColors.card,
|
|
6790
7600
|
borderRadius: 24,
|
|
@@ -6805,7 +7615,7 @@ var BankCard = core.styled(core.View, {
|
|
|
6805
7615
|
size: "md"
|
|
6806
7616
|
}
|
|
6807
7617
|
});
|
|
6808
|
-
var BankInput =
|
|
7618
|
+
var BankInput = gui.styled(gui.Text, {
|
|
6809
7619
|
name: "BankInput",
|
|
6810
7620
|
render: "input",
|
|
6811
7621
|
backgroundColor: bankColors.input,
|
|
@@ -6841,7 +7651,7 @@ var BankInput = core.styled(core.Text, {
|
|
|
6841
7651
|
size: "md"
|
|
6842
7652
|
}
|
|
6843
7653
|
});
|
|
6844
|
-
var BankButton =
|
|
7654
|
+
var BankButton = gui.styled(gui.View, {
|
|
6845
7655
|
name: "BankButton",
|
|
6846
7656
|
render: "button",
|
|
6847
7657
|
backgroundColor: bankColors.accent,
|
|
@@ -6886,7 +7696,7 @@ var BankButton = core.styled(core.View, {
|
|
|
6886
7696
|
variant: "primary"
|
|
6887
7697
|
}
|
|
6888
7698
|
});
|
|
6889
|
-
var BankButtonText =
|
|
7699
|
+
var BankButtonText = gui.styled(gui.Text, {
|
|
6890
7700
|
name: "BankButtonText",
|
|
6891
7701
|
color: "#000000",
|
|
6892
7702
|
fontSize: 16,
|
|
@@ -6900,7 +7710,7 @@ var BankButtonText = core.styled(core.Text, {
|
|
|
6900
7710
|
}
|
|
6901
7711
|
}
|
|
6902
7712
|
});
|
|
6903
|
-
var BankHeading =
|
|
7713
|
+
var BankHeading = gui.styled(gui.Text, {
|
|
6904
7714
|
name: "BankHeading",
|
|
6905
7715
|
color: bankColors.text,
|
|
6906
7716
|
fontWeight: "700",
|
|
@@ -6917,7 +7727,7 @@ var BankHeading = core.styled(core.Text, {
|
|
|
6917
7727
|
size: "lg"
|
|
6918
7728
|
}
|
|
6919
7729
|
});
|
|
6920
|
-
var BankText =
|
|
7730
|
+
var BankText = gui.styled(gui.Text, {
|
|
6921
7731
|
name: "BankText",
|
|
6922
7732
|
color: bankColors.textMuted,
|
|
6923
7733
|
fontSize: 16,
|
|
@@ -6941,13 +7751,13 @@ function BankField({
|
|
|
6941
7751
|
error,
|
|
6942
7752
|
children
|
|
6943
7753
|
}) {
|
|
6944
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7754
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.View, { gap: 8, width: "100%", children: [
|
|
6945
7755
|
label && /* @__PURE__ */ jsxRuntime.jsx(BankText, { variant: "label", children: label }),
|
|
6946
7756
|
children,
|
|
6947
7757
|
error && /* @__PURE__ */ jsxRuntime.jsx(BankText, { variant: "error", children: error })
|
|
6948
7758
|
] });
|
|
6949
7759
|
}
|
|
6950
|
-
var BankAlert =
|
|
7760
|
+
var BankAlert = gui.styled(gui.View, {
|
|
6951
7761
|
name: "BankAlert",
|
|
6952
7762
|
borderRadius: 12,
|
|
6953
7763
|
padding: 16,
|
|
@@ -6966,7 +7776,7 @@ var BankAlert = core.styled(core.View, {
|
|
|
6966
7776
|
}
|
|
6967
7777
|
}
|
|
6968
7778
|
});
|
|
6969
|
-
var BankAlertText =
|
|
7779
|
+
var BankAlertText = gui.styled(gui.Text, {
|
|
6970
7780
|
name: "BankAlertText",
|
|
6971
7781
|
fontSize: 14,
|
|
6972
7782
|
variants: {
|
|
@@ -6976,7 +7786,7 @@ var BankAlertText = core.styled(core.Text, {
|
|
|
6976
7786
|
}
|
|
6977
7787
|
}
|
|
6978
7788
|
});
|
|
6979
|
-
var BankPinBox =
|
|
7789
|
+
var BankPinBox = gui.styled(gui.Text, {
|
|
6980
7790
|
name: "BankPinBox",
|
|
6981
7791
|
render: "input",
|
|
6982
7792
|
backgroundColor: bankColors.input,
|
|
@@ -6999,13 +7809,13 @@ var BankPinBox = core.styled(core.Text, {
|
|
|
6999
7809
|
}
|
|
7000
7810
|
}
|
|
7001
7811
|
});
|
|
7002
|
-
var BankDivider =
|
|
7812
|
+
var BankDivider = gui.styled(gui.View, {
|
|
7003
7813
|
name: "BankDivider",
|
|
7004
7814
|
height: 1,
|
|
7005
7815
|
width: "100%",
|
|
7006
7816
|
backgroundColor: bankColors.divider
|
|
7007
7817
|
});
|
|
7008
|
-
var BankPage =
|
|
7818
|
+
var BankPage = gui.styled(gui.View, {
|
|
7009
7819
|
name: "BankPage",
|
|
7010
7820
|
backgroundColor: bankColors.bg,
|
|
7011
7821
|
minHeight: "100vh",
|
|
@@ -7019,6 +7829,7 @@ exports.AccordionItemContent = AccordionItemContent;
|
|
|
7019
7829
|
exports.AccordionItemTrigger = AccordionItemTrigger;
|
|
7020
7830
|
exports.AccordionRoot = AccordionRoot;
|
|
7021
7831
|
exports.Alert = Alert;
|
|
7832
|
+
exports.AppNav = AppNav;
|
|
7022
7833
|
exports.AppProvider = AppProvider;
|
|
7023
7834
|
exports.Avatar = Avatar;
|
|
7024
7835
|
exports.AvatarGroup = AvatarGroup;
|
|
@@ -7044,6 +7855,7 @@ exports.CloseButton = CloseButton;
|
|
|
7044
7855
|
exports.CollapsibleDetails = CollapsibleDetails;
|
|
7045
7856
|
exports.CollapsibleList = CollapsibleList;
|
|
7046
7857
|
exports.ColorModeProvider = ColorModeProvider;
|
|
7858
|
+
exports.DEFAULT_ORG = DEFAULT_ORG;
|
|
7047
7859
|
exports.DialogActionTrigger = DialogActionTrigger;
|
|
7048
7860
|
exports.DialogBackdrop = DialogBackdrop;
|
|
7049
7861
|
exports.DialogBody = DialogBody;
|
|
@@ -7070,10 +7882,14 @@ exports.ExpirationSelector = ExpirationSelector;
|
|
|
7070
7882
|
exports.Field = Field;
|
|
7071
7883
|
exports.GreeksDisplay = GreeksDisplay;
|
|
7072
7884
|
exports.Heading = Heading;
|
|
7885
|
+
exports.IAM_PAGE_SIZE = IAM_PAGE_SIZE;
|
|
7886
|
+
exports.IamError = IamError;
|
|
7073
7887
|
exports.IconButton = IconButton;
|
|
7074
|
-
exports.
|
|
7888
|
+
exports.IdentityProvider = IdentityProvider;
|
|
7889
|
+
exports.Image = Image;
|
|
7075
7890
|
exports.Input = Input;
|
|
7076
7891
|
exports.InputGroup = InputGroup;
|
|
7892
|
+
exports.LUX_BRAND = LUX_BRAND;
|
|
7077
7893
|
exports.Link = Link;
|
|
7078
7894
|
exports.LinkBox = LinkBox;
|
|
7079
7895
|
exports.LinkExternalIcon = LinkExternalIcon;
|
|
@@ -7090,8 +7906,11 @@ exports.MenuRoot = MenuRoot;
|
|
|
7090
7906
|
exports.MenuSeparator = MenuSeparator;
|
|
7091
7907
|
exports.MenuTrigger = MenuTrigger;
|
|
7092
7908
|
exports.MenuTriggerItem = MenuTriggerItem;
|
|
7909
|
+
exports.NARROW_PX = NARROW_PX;
|
|
7093
7910
|
exports.OptionChain = OptionChain;
|
|
7094
7911
|
exports.OptionPositionCard = OptionPositionCard;
|
|
7912
|
+
exports.OrgSwitcher = OrgSwitcher;
|
|
7913
|
+
exports.PARS_GOLD = PARS_GOLD;
|
|
7095
7914
|
exports.PinInput = PinInput;
|
|
7096
7915
|
exports.PnlDiagram = PnlDiagram;
|
|
7097
7916
|
exports.PopoverArrow = PopoverArrow;
|
|
@@ -7109,6 +7928,7 @@ exports.Progress = Progress;
|
|
|
7109
7928
|
exports.ProgressCircleRing = ProgressCircleRing;
|
|
7110
7929
|
exports.ProgressCircleRoot = ProgressCircleRoot;
|
|
7111
7930
|
exports.ProgressCircleValueText = ProgressCircleValueText;
|
|
7931
|
+
exports.ProjectSwitcher = ProjectSwitcher;
|
|
7112
7932
|
exports.Radio = Radio2;
|
|
7113
7933
|
exports.RadioGroup = RadioGroup3;
|
|
7114
7934
|
exports.Rating = Rating;
|
|
@@ -7124,12 +7944,15 @@ exports.SelectLabel = SelectLabel;
|
|
|
7124
7944
|
exports.SelectRoot = SelectRoot;
|
|
7125
7945
|
exports.SelectValueText = SelectValueText;
|
|
7126
7946
|
exports.Separator = Separator2;
|
|
7947
|
+
exports.SettingsMenu = SettingsMenu;
|
|
7127
7948
|
exports.Skeleton = Skeleton;
|
|
7128
7949
|
exports.SkeletonCircle = SkeletonCircle;
|
|
7129
7950
|
exports.SkeletonText = SkeletonText;
|
|
7130
7951
|
exports.Slider = Slider;
|
|
7131
7952
|
exports.StrategyBuilder = StrategyBuilder;
|
|
7132
7953
|
exports.Switch = Switch2;
|
|
7954
|
+
exports.Switcher = Switcher;
|
|
7955
|
+
exports.TOUCH_PX = TOUCH_PX;
|
|
7133
7956
|
exports.TableBody = TableBody;
|
|
7134
7957
|
exports.TableCaption = TableCaption;
|
|
7135
7958
|
exports.TableCell = TableCell;
|
|
@@ -7150,11 +7973,27 @@ exports.Tag = Tag;
|
|
|
7150
7973
|
exports.Textarea = Textarea;
|
|
7151
7974
|
exports.Toaster = Toaster;
|
|
7152
7975
|
exports.Tooltip = Tooltip;
|
|
7976
|
+
exports.UserMenu = UserMenu;
|
|
7153
7977
|
exports.bankColors = bankColors;
|
|
7154
7978
|
exports.buttonVariants = buttonVariants;
|
|
7155
7979
|
exports.cn = cn;
|
|
7980
|
+
exports.config = config;
|
|
7156
7981
|
exports.createListCollection = createListCollection;
|
|
7982
|
+
exports.currentHost = currentHost;
|
|
7983
|
+
exports.guiConfig = lux_config_default;
|
|
7984
|
+
exports.iam = iam;
|
|
7985
|
+
exports.iamBase = iamBase;
|
|
7986
|
+
exports.initials = initials;
|
|
7987
|
+
exports.luxThemes = luxThemes;
|
|
7988
|
+
exports.orgIdentity = orgIdentity;
|
|
7989
|
+
exports.orgs = ORGS;
|
|
7990
|
+
exports.resolveWhiteLabel = resolveWhiteLabel;
|
|
7157
7991
|
exports.toaster = toaster;
|
|
7158
7992
|
exports.useAccordion = useAccordion;
|
|
7993
|
+
exports.useBelow = useBelow;
|
|
7159
7994
|
exports.useColorMode = useColorMode;
|
|
7160
7995
|
exports.useColorModeValue = useColorModeValue;
|
|
7996
|
+
exports.useIdentity = useIdentity;
|
|
7997
|
+
exports.useIsNarrow = useIsNarrow;
|
|
7998
|
+
exports.useIsTouch = useIsTouch;
|
|
7999
|
+
exports.useWhiteLabel = useWhiteLabel;
|