@luxfi/ui 7.4.0 → 7.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/avatar.cjs +7 -6
  2. package/dist/avatar.js +7 -5
  3. package/dist/badge.cjs +30 -32
  4. package/dist/badge.js +30 -32
  5. package/dist/bank.d.cts +3 -3
  6. package/dist/bank.d.ts +3 -3
  7. package/dist/checkbox.cjs +4 -4
  8. package/dist/checkbox.d.cts +3 -2
  9. package/dist/checkbox.d.ts +3 -2
  10. package/dist/checkbox.js +5 -4
  11. package/dist/chrome.cjs +950 -0
  12. package/dist/chrome.d.cts +93 -0
  13. package/dist/chrome.d.ts +93 -0
  14. package/dist/chrome.js +921 -0
  15. package/dist/drawer.cjs +86 -20
  16. package/dist/drawer.js +85 -19
  17. package/dist/expiration-selector.cjs +3 -2
  18. package/dist/expiration-selector.js +3 -2
  19. package/dist/greeks-display.cjs +6 -6
  20. package/dist/greeks-display.js +6 -6
  21. package/dist/gui.cjs +13 -0
  22. package/dist/gui.d.cts +2 -0
  23. package/dist/gui.d.ts +2 -0
  24. package/dist/gui.js +2 -0
  25. package/dist/heading.cjs +4 -2
  26. package/dist/heading.js +4 -2
  27. package/dist/iam.cjs +206 -0
  28. package/dist/iam.d.cts +65 -0
  29. package/dist/iam.d.ts +65 -0
  30. package/dist/iam.js +201 -0
  31. package/dist/icons.cjs +13 -0
  32. package/dist/icons.d.cts +1 -0
  33. package/dist/icons.d.ts +1 -0
  34. package/dist/icons.js +2 -0
  35. package/dist/identity.cjs +420 -0
  36. package/dist/identity.d.cts +64 -0
  37. package/dist/identity.d.ts +64 -0
  38. package/dist/identity.js +398 -0
  39. package/dist/index.cjs +1597 -833
  40. package/dist/index.d.cts +7 -3
  41. package/dist/index.d.ts +7 -3
  42. package/dist/index.js +1574 -828
  43. package/dist/input.cjs +3 -1
  44. package/dist/input.d.cts +3 -5
  45. package/dist/input.d.ts +3 -5
  46. package/dist/input.js +3 -1
  47. package/dist/lux.config.cjs +23 -2
  48. package/dist/lux.config.d.cts +28 -10
  49. package/dist/lux.config.d.ts +28 -10
  50. package/dist/lux.config.js +23 -2
  51. package/dist/menu.cjs +4 -4
  52. package/dist/menu.js +4 -4
  53. package/dist/next.cjs +99 -0
  54. package/dist/next.d.cts +29 -0
  55. package/dist/next.d.ts +29 -0
  56. package/dist/next.js +96 -0
  57. package/dist/option-chain.cjs +1 -1
  58. package/dist/option-chain.js +1 -1
  59. package/dist/option-position.cjs +2 -1
  60. package/dist/option-position.js +2 -1
  61. package/dist/pnl-diagram.cjs +8 -6
  62. package/dist/pnl-diagram.js +8 -6
  63. package/dist/progress.cjs +7 -6
  64. package/dist/progress.js +7 -5
  65. package/dist/provider.cjs +136 -4
  66. package/dist/provider.d.cts +15 -3
  67. package/dist/provider.d.ts +15 -3
  68. package/dist/provider.js +136 -5
  69. package/dist/radio.cjs +9 -7
  70. package/dist/radio.js +10 -7
  71. package/dist/separator.cjs +3 -1
  72. package/dist/separator.js +3 -1
  73. package/dist/slider.cjs +28 -16
  74. package/dist/slider.js +28 -15
  75. package/dist/strategy-builder.cjs +2 -1
  76. package/dist/strategy-builder.js +2 -1
  77. package/dist/switch.cjs +11 -12
  78. package/dist/switch.js +12 -12
  79. package/dist/tag.cjs +31 -33
  80. package/dist/tag.js +30 -32
  81. package/dist/textarea.cjs +3 -1
  82. package/dist/textarea.js +3 -1
  83. package/dist/tooltip.cjs +25 -27
  84. package/dist/tooltip.js +24 -26
  85. package/dist/use-narrow.cjs +46 -0
  86. package/dist/use-narrow.d.cts +12 -0
  87. package/dist/use-narrow.d.ts +12 -0
  88. package/dist/use-narrow.js +20 -0
  89. package/dist/vite.cjs +40 -0
  90. package/dist/vite.d.cts +29 -0
  91. package/dist/vite.d.ts +29 -0
  92. package/dist/vite.js +38 -0
  93. package/dist/white-label.cjs +132 -0
  94. package/dist/white-label.d.cts +59 -0
  95. package/dist/white-label.d.ts +59 -0
  96. package/dist/white-label.js +124 -0
  97. package/package.json +85 -19
  98. package/src/avatar.tsx +22 -16
  99. package/src/checkbox.tsx +15 -10
  100. package/src/chrome.tsx +459 -0
  101. package/src/drawer.tsx +83 -10
  102. package/src/expiration-selector.tsx +3 -2
  103. package/src/greeks-display.tsx +9 -6
  104. package/src/gui.ts +17 -0
  105. package/src/heading.tsx +12 -8
  106. package/src/iam.ts +170 -0
  107. package/src/icons.ts +18 -0
  108. package/src/identity.tsx +318 -0
  109. package/src/index.ts +44 -1
  110. package/src/input.tsx +13 -9
  111. package/src/lux.config.ts +16 -15
  112. package/src/menu.tsx +4 -4
  113. package/src/next.ts +142 -0
  114. package/src/option-chain.tsx +1 -1
  115. package/src/option-position.tsx +2 -1
  116. package/src/pnl-diagram.tsx +11 -6
  117. package/src/progress.tsx +15 -8
  118. package/src/provider.tsx +48 -7
  119. package/src/radio.tsx +15 -11
  120. package/src/separator.tsx +8 -3
  121. package/src/slider.tsx +35 -19
  122. package/src/strategy-builder.tsx +3 -2
  123. package/src/switch.tsx +17 -16
  124. package/src/textarea.tsx +8 -4
  125. package/src/tooltip.tsx +2 -21
  126. package/src/use-narrow.ts +40 -0
  127. package/src/vite.ts +78 -0
  128. package/src/white-label.ts +240 -0
  129. package/tokens.css +544 -319
  130. package/src/tokens.css +0 -438
package/dist/chrome.js ADDED
@@ -0,0 +1,921 @@
1
+ "use client";
2
+ import * as React6 from 'react';
3
+ import React6__default from 'react';
4
+ import { Check, ChevronRight, ChevronsUpDown, Folder, LogOut, User, Settings, Menu, Building2 } from 'lucide-react';
5
+ import { styled, View, Sheet } from '@hanzo/gui';
6
+ import * as RadixDialog from '@radix-ui/react-dialog';
7
+ import { clsx } from 'clsx';
8
+ import { twMerge } from 'tailwind-merge';
9
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
+ import { QueryClient } from '@tanstack/react-query';
11
+ import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
12
+
13
+ var NARROW_PX = 640;
14
+ function useBelow(px) {
15
+ const [below, setBelow] = React6.useState(false);
16
+ React6.useEffect(() => {
17
+ const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
18
+ const apply = () => setBelow(mql.matches);
19
+ apply();
20
+ mql.addEventListener("change", apply);
21
+ return () => mql.removeEventListener("change", apply);
22
+ }, [px]);
23
+ return below;
24
+ }
25
+ var useIsNarrow = () => useBelow(NARROW_PX);
26
+ function cn(...inputs) {
27
+ return twMerge(clsx(inputs));
28
+ }
29
+ 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";
30
+ var CloseButtonFrame = styled(View, {
31
+ name: "LuxCloseButton",
32
+ render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
33
+ role: "button",
34
+ cursor: "pointer",
35
+ display: "inline-flex",
36
+ alignItems: "center",
37
+ justifyContent: "center",
38
+ width: 20,
39
+ height: 20,
40
+ minWidth: 0,
41
+ flexShrink: 1,
42
+ padding: 0,
43
+ borderRadius: 4,
44
+ borderWidth: 0,
45
+ overflow: "hidden",
46
+ backgroundColor: "transparent",
47
+ hoverStyle: {
48
+ backgroundColor: "transparent"
49
+ },
50
+ variants: {
51
+ disabled: {
52
+ true: {
53
+ opacity: 0.4,
54
+ pointerEvents: "none"
55
+ }
56
+ }
57
+ }
58
+ });
59
+ var CLOSE_BUTTON_CLASSES = [
60
+ "text-[var(--closeButton-fg,currentColor)]",
61
+ "hover:text-[var(--hover-color,currentColor)]",
62
+ "disabled:opacity-40"
63
+ ].join(" ");
64
+ var CloseButton = React6.forwardRef(function CloseButton2(props, ref) {
65
+ const { variant: _variant, size: _size, className, children, ...rest } = props;
66
+ return /* @__PURE__ */ jsx(
67
+ CloseButtonFrame,
68
+ {
69
+ ref,
70
+ className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
71
+ ...rest,
72
+ children: children ?? /* @__PURE__ */ jsx(
73
+ "svg",
74
+ {
75
+ className: "size-5",
76
+ viewBox: "0 0 20 20",
77
+ fill: "none",
78
+ "aria-hidden": "true",
79
+ children: /* @__PURE__ */ jsx(
80
+ "path",
81
+ {
82
+ d: CLOSE_ICON_PATH,
83
+ fill: "currentColor"
84
+ }
85
+ )
86
+ }
87
+ )
88
+ }
89
+ );
90
+ });
91
+ var DrawerPlacementContext = React6.createContext("right");
92
+ var DrawerSizeContext = React6.createContext("md");
93
+ var DrawerStateContext = React6.createContext({
94
+ open: false,
95
+ setOpen: () => {
96
+ },
97
+ modal: true
98
+ });
99
+ var DrawerRoot = (props) => {
100
+ const {
101
+ children,
102
+ open,
103
+ defaultOpen,
104
+ onOpenChange,
105
+ placement = "right",
106
+ modal = true,
107
+ size = "md"
108
+ } = props;
109
+ const [uncontrolled, setUncontrolled] = React6.useState(defaultOpen ?? false);
110
+ const isControlled = open !== void 0;
111
+ const isOpen = isControlled ? open : uncontrolled;
112
+ const setOpen = React6.useCallback((nextOpen) => {
113
+ if (!isControlled) setUncontrolled(nextOpen);
114
+ onOpenChange?.({ open: nextOpen });
115
+ }, [isControlled, onOpenChange]);
116
+ const state = React6.useMemo(
117
+ () => ({ open: isOpen, setOpen, modal }),
118
+ [isOpen, setOpen, modal]
119
+ );
120
+ return /* @__PURE__ */ jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(DrawerStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(
121
+ RadixDialog.Root,
122
+ {
123
+ open: isOpen,
124
+ onOpenChange: setOpen,
125
+ modal,
126
+ children
127
+ }
128
+ ) }) }) });
129
+ };
130
+ var PLACEMENT_CLASSES = {
131
+ right: [
132
+ "inset-y-0 right-0",
133
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
134
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
135
+ ].join(" "),
136
+ left: [
137
+ "inset-y-0 left-0",
138
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
139
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
140
+ ].join(" "),
141
+ top: [
142
+ "inset-x-0 top-0",
143
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
144
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
145
+ ].join(" "),
146
+ bottom: [
147
+ "inset-x-0 bottom-0",
148
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
149
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
150
+ ].join(" ")
151
+ };
152
+ var SIZE_CLASSES = {
153
+ right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
154
+ left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
155
+ top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
156
+ bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
157
+ };
158
+ var DrawerContent = React6.forwardRef(
159
+ function DrawerContent2(props, ref) {
160
+ const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
161
+ const placement = React6.useContext(DrawerPlacementContext);
162
+ const size = React6.useContext(DrawerSizeContext);
163
+ const { open, setOpen, modal } = React6.useContext(DrawerStateContext);
164
+ const isNarrow = useIsNarrow();
165
+ if (isNarrow) {
166
+ return /* @__PURE__ */ jsxs(
167
+ Sheet,
168
+ {
169
+ open,
170
+ onOpenChange: setOpen,
171
+ modal,
172
+ dismissOnSnapToBottom: true,
173
+ snapPointsMode: "percent",
174
+ snapPoints: [88],
175
+ transition: "medium",
176
+ children: [
177
+ backdrop && /* @__PURE__ */ jsx(
178
+ Sheet.Overlay,
179
+ {
180
+ transition: "lazy",
181
+ enterStyle: { opacity: 0 },
182
+ exitStyle: { opacity: 0 },
183
+ className: "bg-black/50"
184
+ }
185
+ ),
186
+ /* @__PURE__ */ jsx(Sheet.Handle, {}),
187
+ /* @__PURE__ */ jsx(
188
+ Sheet.Frame,
189
+ {
190
+ unstyled: true,
191
+ className: cn(
192
+ "flex flex-col rounded-t-2xl bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)]",
193
+ className
194
+ ),
195
+ ...rest,
196
+ children
197
+ }
198
+ )
199
+ ]
200
+ }
201
+ );
202
+ }
203
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
204
+ backdrop && /* @__PURE__ */ jsx(
205
+ RadixDialog.Overlay,
206
+ {
207
+ className: cn(
208
+ "fixed inset-0 z-50 bg-black/50",
209
+ "data-[state=open]:animate-in data-[state=open]:fade-in-0",
210
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
211
+ )
212
+ }
213
+ ),
214
+ /* @__PURE__ */ jsx(
215
+ RadixDialog.Content,
216
+ {
217
+ ref,
218
+ className: cn(
219
+ "fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
220
+ PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
221
+ SIZE_CLASSES[placement]?.[size] ?? SIZE_CLASSES.right?.md,
222
+ className
223
+ ),
224
+ ...rest,
225
+ children
226
+ }
227
+ )
228
+ ] });
229
+ if (portalled) {
230
+ return /* @__PURE__ */ jsx(RadixDialog.Portal, { container: portalRef?.current ?? void 0, children: content });
231
+ }
232
+ return content;
233
+ }
234
+ );
235
+ React6.forwardRef(function DrawerCloseTrigger2(props, ref) {
236
+ return /* @__PURE__ */ jsx(RadixDialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(
237
+ CloseButton,
238
+ {
239
+ ref,
240
+ className: cn("absolute top-7 right-5", props.className),
241
+ ...props
242
+ }
243
+ ) });
244
+ });
245
+ var DrawerHeader = React6.forwardRef(
246
+ function DrawerHeader2({ className, ...props }, ref) {
247
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
248
+ }
249
+ );
250
+ var DrawerBody = React6.forwardRef(
251
+ function DrawerBody2({ className, ...props }, ref) {
252
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
253
+ }
254
+ );
255
+ React6.forwardRef(
256
+ function DrawerFooter2({ className, ...props }, ref) {
257
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
258
+ }
259
+ );
260
+ var DrawerTitle = RadixDialog.Title;
261
+
262
+ // src/white-label.ts
263
+ var LUX_BRAND = {
264
+ lux: "#7000FF",
265
+ zoo: "#6C5EFB",
266
+ hanzo: "#EA580C",
267
+ pars: "#1C3879"};
268
+ var PARS_GOLD = "#C8A45C";
269
+ var ORGS = {
270
+ lux: {
271
+ org: "lux",
272
+ name: "Lux",
273
+ domain: "lux.network",
274
+ iamDomain: "lux.id",
275
+ accent: LUX_BRAND.lux,
276
+ accentForeground: "#FFFFFF"
277
+ },
278
+ zoo: {
279
+ org: "zoo",
280
+ name: "Zoo",
281
+ domain: "zoo.ngo",
282
+ // Zoo's IdP is `id.zoo.network`, not a `zoo.id` apex — the one row in this
283
+ // table where the issuer is not `<org>.id`, and the one every hand-rolled
284
+ // per-app branding map got wrong.
285
+ iamDomain: "id.zoo.network",
286
+ accent: LUX_BRAND.zoo,
287
+ accentForeground: "#FFFFFF"
288
+ },
289
+ bootnode: {
290
+ org: "bootnode",
291
+ name: "Bootnode",
292
+ domain: "bootno.de",
293
+ iamDomain: "id.bootno.de",
294
+ accent: LUX_BRAND.lux,
295
+ accentForeground: "#FFFFFF"
296
+ },
297
+ hanzo: {
298
+ org: "hanzo",
299
+ name: "Hanzo",
300
+ domain: "hanzo.ai",
301
+ iamDomain: "hanzo.id",
302
+ accent: LUX_BRAND.hanzo,
303
+ accentForeground: "#FFFFFF"
304
+ },
305
+ pars: {
306
+ org: "pars",
307
+ name: "Pars",
308
+ domain: "pars.id",
309
+ iamDomain: "pars.id",
310
+ accent: LUX_BRAND.pars,
311
+ accentForeground: PARS_GOLD
312
+ }
313
+ };
314
+ var DOMAIN_ORG = [
315
+ ["lux.network", "lux"],
316
+ ["lux.cloud", "lux"],
317
+ ["lux.id", "lux"],
318
+ ["lux.finance", "lux"],
319
+ ["zoo.ngo", "zoo"],
320
+ ["zoo.network", "zoo"],
321
+ ["zoo.cloud", "zoo"],
322
+ ["zoo.id", "zoo"],
323
+ ["hanzo.ai", "hanzo"],
324
+ ["hanzo.cloud", "hanzo"],
325
+ ["hanzo.id", "hanzo"],
326
+ ["pars.id", "pars"],
327
+ ["parsdao.org", "pars"],
328
+ ["bootno.de", "bootnode", "platform"]
329
+ ];
330
+ var DEFAULT_ORG = "lux";
331
+ function normalizeHost(host) {
332
+ const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
333
+ return noPort.replace(/\.$/, "");
334
+ }
335
+ function isUnder(host, domain) {
336
+ return host === domain || host.endsWith(`.${domain}`);
337
+ }
338
+ function matchDomain(host) {
339
+ let best;
340
+ for (const entry of DOMAIN_ORG) {
341
+ if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
342
+ best = entry;
343
+ }
344
+ }
345
+ return best;
346
+ }
347
+ function appSlug(host, domain, apexApp) {
348
+ const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
349
+ const leftmost = sub.split(".")[0] ?? "";
350
+ if (leftmost && leftmost !== "www") return leftmost;
351
+ if (apexApp) return apexApp;
352
+ const label = domain.split(".")[0] ?? "";
353
+ const tld = domain.split(".").slice(1).join(".");
354
+ return tld.split(".")[0] || label;
355
+ }
356
+ function isLocal(host) {
357
+ return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
358
+ }
359
+ function resolveWhiteLabel(host) {
360
+ const h = normalizeHost(host);
361
+ const match = h ? matchDomain(h) : void 0;
362
+ const org = match ? match[1] : DEFAULT_ORG;
363
+ const identity = ORGS[org];
364
+ const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
365
+ return {
366
+ ...identity,
367
+ host: h,
368
+ app,
369
+ theme: `dark_${org}`,
370
+ issuer: `https://${identity.iamDomain}`,
371
+ clientId: `${org}-${app}`
372
+ };
373
+ }
374
+ new QueryClient({
375
+ defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
376
+ });
377
+ var WhiteLabelContext = React6__default.createContext(resolveWhiteLabel(""));
378
+ var useWhiteLabel = () => React6__default.useContext(WhiteLabelContext);
379
+ var IdentityContext = React6.createContext(null);
380
+ function useIdentity() {
381
+ const ctx = React6.useContext(IdentityContext);
382
+ const whiteLabel = useWhiteLabel();
383
+ const fallback = React6.useMemo(() => ({
384
+ status: "anonymous",
385
+ account: null,
386
+ orgs: [],
387
+ org: null,
388
+ projects: [],
389
+ project: null,
390
+ error: null,
391
+ whiteLabel,
392
+ setOrg: () => void 0,
393
+ setProject: () => void 0,
394
+ signIn: () => {
395
+ if (typeof window !== "undefined") window.location.assign("/login");
396
+ },
397
+ signOut: () => void 0,
398
+ reload: () => void 0
399
+ }), [whiteLabel]);
400
+ return ctx ?? fallback;
401
+ }
402
+ function parsePlacement(placement) {
403
+ if (!placement) {
404
+ return { side: "bottom", align: "start" };
405
+ }
406
+ const parts = placement.split("-");
407
+ const side = parts[0] ?? "bottom";
408
+ const alignPart = parts[1];
409
+ let align = "center";
410
+ if (alignPart === "start") {
411
+ align = "start";
412
+ } else if (alignPart === "end") {
413
+ align = "end";
414
+ }
415
+ return { side, align };
416
+ }
417
+ var PositioningContext = React6.createContext({
418
+ side: "bottom",
419
+ align: "start",
420
+ sideOffset: 4,
421
+ alignOffset: 0
422
+ });
423
+ var MenuRoot = (props) => {
424
+ const {
425
+ children,
426
+ open,
427
+ defaultOpen,
428
+ onOpenChange,
429
+ positioning,
430
+ modal = true,
431
+ // lazyMount / unmountOnExit have no direct Radix equivalent; Radix handles
432
+ // mount/unmount automatically.
433
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
434
+ lazyMount: _lazyMount,
435
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
436
+ unmountOnExit: _unmountOnExit
437
+ } = props;
438
+ const mergedPositioning = {
439
+ placement: "bottom-start",
440
+ ...positioning,
441
+ offset: {
442
+ mainAxis: 4,
443
+ ...positioning?.offset
444
+ }
445
+ };
446
+ const { side, align } = parsePlacement(mergedPositioning.placement);
447
+ const positioningValue = React6.useMemo(() => ({
448
+ side,
449
+ align,
450
+ sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
451
+ alignOffset: mergedPositioning.offset?.crossAxis ?? 0
452
+ }), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
453
+ const handleOpenChange = React6.useCallback((isOpen) => {
454
+ onOpenChange?.({ open: isOpen });
455
+ }, [onOpenChange]);
456
+ return /* @__PURE__ */ jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsx(
457
+ DropdownMenu.Root,
458
+ {
459
+ open,
460
+ defaultOpen,
461
+ onOpenChange: handleOpenChange,
462
+ modal,
463
+ children
464
+ }
465
+ ) });
466
+ };
467
+ var MenuTrigger = React6.forwardRef(function MenuTrigger2(props, ref) {
468
+ const { asChild = false, ...rest } = props;
469
+ return /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild, ref, ...rest });
470
+ });
471
+ var MenuContent = React6.forwardRef(function MenuContent2(props, ref) {
472
+ const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
473
+ const positioning = React6.useContext(PositioningContext);
474
+ const mergedStyle = {
475
+ ...style,
476
+ ...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
477
+ ...minW !== void 0 ? { minWidth: minW } : {}
478
+ };
479
+ const content = /* @__PURE__ */ jsx(
480
+ DropdownMenu.Content,
481
+ {
482
+ ref,
483
+ side: positioning.side,
484
+ align: positioning.align,
485
+ sideOffset: positioning.sideOffset,
486
+ alignOffset: positioning.alignOffset,
487
+ className: cn(
488
+ "z-50 min-w-[8rem] overflow-hidden rounded-lg p-1",
489
+ "border border-[var(--color-popover-border,var(--color-border-divider))]",
490
+ "bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
491
+ "shadow-[0_4px_12px_var(--color-popover-shadow)]",
492
+ "outline-none",
493
+ "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
494
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
495
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
496
+ "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
497
+ className
498
+ ),
499
+ style: Object.keys(mergedStyle).length > 0 ? mergedStyle : void 0,
500
+ ...rest
501
+ }
502
+ );
503
+ if (!portalled) {
504
+ return content;
505
+ }
506
+ return /* @__PURE__ */ jsx(DropdownMenu.Portal, { container: portalRef?.current ?? void 0, children: content });
507
+ });
508
+ var MenuItem = React6.forwardRef(function MenuItem2(props, ref) {
509
+ const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
510
+ return /* @__PURE__ */ jsx(
511
+ DropdownMenu.Item,
512
+ {
513
+ ref,
514
+ asChild,
515
+ disabled,
516
+ onClick,
517
+ className: cn(
518
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
519
+ "outline-none transition-colors",
520
+ "text-[var(--color-text-primary,inherit)]",
521
+ "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
522
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
523
+ className
524
+ ),
525
+ ...rest,
526
+ children
527
+ }
528
+ );
529
+ });
530
+ React6.forwardRef(function MenuItemText2(props, ref) {
531
+ const { className, ...rest } = props;
532
+ return /* @__PURE__ */ jsx("span", { ref, className: cn("flex-1", className), ...rest });
533
+ });
534
+ React6.forwardRef(function MenuItemCommand2(props, ref) {
535
+ const { className, ...rest } = props;
536
+ return /* @__PURE__ */ jsx(
537
+ "span",
538
+ {
539
+ ref,
540
+ className: cn("ml-auto text-xs tracking-widest opacity-60", className),
541
+ ...rest
542
+ }
543
+ );
544
+ });
545
+ var MenuSeparator = React6.forwardRef(function MenuSeparator2(props, ref) {
546
+ const { className, ...rest } = props;
547
+ return /* @__PURE__ */ jsx(
548
+ DropdownMenu.Separator,
549
+ {
550
+ ref,
551
+ className: cn("-mx-1 my-1 h-px bg-[var(--color-border-divider)]", className),
552
+ ...rest
553
+ }
554
+ );
555
+ });
556
+ React6.forwardRef(function MenuItemGroup2(props, ref) {
557
+ const { title, children, className, ...rest } = props;
558
+ return /* @__PURE__ */ jsxs(DropdownMenu.Group, { ref, className, ...rest, children: [
559
+ title && /* @__PURE__ */ jsx(DropdownMenu.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
560
+ children
561
+ ] });
562
+ });
563
+ React6.forwardRef(function MenuArrow2(props, ref) {
564
+ const { className, ...rest } = props;
565
+ return /* @__PURE__ */ jsx(
566
+ DropdownMenu.Arrow,
567
+ {
568
+ ref,
569
+ className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
570
+ ...rest
571
+ }
572
+ );
573
+ });
574
+ React6.forwardRef(function MenuCheckboxItem2(props, ref) {
575
+ const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
576
+ return /* @__PURE__ */ jsxs(
577
+ DropdownMenu.CheckboxItem,
578
+ {
579
+ ref,
580
+ checked,
581
+ onCheckedChange,
582
+ onClick,
583
+ className: cn(
584
+ "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
585
+ "outline-none transition-colors",
586
+ "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
587
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
588
+ className
589
+ ),
590
+ ...rest,
591
+ children: [
592
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
593
+ children
594
+ ]
595
+ }
596
+ );
597
+ });
598
+ React6.forwardRef(function MenuRadioItemGroup2(props, ref) {
599
+ const { value, onValueChange, ...rest } = props;
600
+ return /* @__PURE__ */ jsx(
601
+ DropdownMenu.RadioGroup,
602
+ {
603
+ ref,
604
+ value,
605
+ onValueChange,
606
+ ...rest
607
+ }
608
+ );
609
+ });
610
+ React6.forwardRef(function MenuRadioItem2(props, ref) {
611
+ const { className, children, value, onClick, ...rest } = props;
612
+ const { value: _v, ...radixRest } = rest;
613
+ return /* @__PURE__ */ jsxs(
614
+ DropdownMenu.RadioItem,
615
+ {
616
+ ref,
617
+ value,
618
+ onClick,
619
+ className: cn(
620
+ "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
621
+ "outline-none transition-colors",
622
+ "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
623
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
624
+ className
625
+ ),
626
+ children: [
627
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
628
+ /* @__PURE__ */ jsx("span", { children })
629
+ ]
630
+ }
631
+ );
632
+ });
633
+ React6.forwardRef(function MenuContextTrigger2(props, ref) {
634
+ const { asChild: _asChild, ...rest } = props;
635
+ return /* @__PURE__ */ jsx("span", { ref, ...rest });
636
+ });
637
+ React6.forwardRef(function MenuTriggerItem2(props, ref) {
638
+ const { startIcon, children, className, ...rest } = props;
639
+ return /* @__PURE__ */ jsx(DropdownMenu.Sub, { children: /* @__PURE__ */ jsxs(
640
+ DropdownMenu.SubTrigger,
641
+ {
642
+ ref,
643
+ className: cn(
644
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
645
+ "outline-none transition-colors",
646
+ "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
647
+ className
648
+ ),
649
+ ...rest,
650
+ children: [
651
+ startIcon,
652
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children }),
653
+ /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
654
+ ]
655
+ }
656
+ ) });
657
+ });
658
+ function initials(label) {
659
+ return label.split(/[\s._-]+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2).toUpperCase();
660
+ }
661
+ var Monogram = ({ label, logo }) => logo ? /* @__PURE__ */ jsx("img", { src: logo, alt: "", className: "h-5 w-5 shrink-0 rounded object-contain" }) : /* @__PURE__ */ jsx(
662
+ "span",
663
+ {
664
+ "aria-hidden": "true",
665
+ className: "flex h-5 w-5 shrink-0 items-center justify-center rounded bg-[rgba(127,127,127,0.22)] text-[10px] font-bold",
666
+ children: initials(label)
667
+ }
668
+ );
669
+ var Row = ({ item, onDone, menu }) => {
670
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
671
+ item.icon,
672
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: item.label }),
673
+ item.hint ? /* @__PURE__ */ jsx("span", { className: "text-xs opacity-60", children: item.hint }) : null,
674
+ item.selected ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "h-4 w-4 shrink-0" }) : null
675
+ ] });
676
+ const className = cn(
677
+ "flex w-full cursor-pointer select-none items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm",
678
+ "hover:bg-[rgba(127,127,127,0.14)]",
679
+ item.danger && "text-[var(--color-text-error,#e5484d)]"
680
+ );
681
+ const activate = () => {
682
+ onDone();
683
+ item.onSelect?.();
684
+ };
685
+ const shared = {
686
+ "data-testid": `chrome-item-${item.id}`,
687
+ "aria-current": item.selected ? "true" : void 0,
688
+ className
689
+ };
690
+ const control = item.href ? /* @__PURE__ */ jsx("a", { href: item.href, ...shared, onClick: onDone, children: body }) : /* @__PURE__ */ jsx("button", { type: "button", ...shared, onClick: activate, children: body });
691
+ return menu ? /* @__PURE__ */ jsx(MenuItem, { value: item.id, asChild: true, children: control }) : control;
692
+ };
693
+ var Switcher = ({
694
+ title,
695
+ label,
696
+ icon,
697
+ items,
698
+ footer = [],
699
+ status = "ready",
700
+ empty = "Nothing here yet.",
701
+ onSignIn,
702
+ signInLabel = "Sign in",
703
+ error,
704
+ align = "start",
705
+ testId
706
+ }) => {
707
+ const [open, setOpen] = React6.useState(false);
708
+ const narrow = useIsNarrow();
709
+ const close = React6.useCallback(() => setOpen(false), []);
710
+ const message = status === "loading" ? "Loading\u2026" : status === "error" ? error ?? "Could not reach IAM." : status === "anonymous" ? null : items.length === 0 ? empty : null;
711
+ const rows = status === "anonymous" && onSignIn ? [{ id: "sign-in", label: signInLabel, icon: /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4" }), onSelect: onSignIn }] : status === "ready" ? items : [];
712
+ const panel = (menu) => /* @__PURE__ */ jsxs(Fragment, { children: [
713
+ /* @__PURE__ */ jsx("div", { className: "px-2 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-wide opacity-55", children: title }),
714
+ message ? /* @__PURE__ */ jsx("div", { "data-testid": "chrome-message", className: "px-2 py-2 text-sm opacity-70", children: message }) : null,
715
+ rows.map((item) => /* @__PURE__ */ jsx(Row, { item, onDone: close, menu }, item.id)),
716
+ footer.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
717
+ menu ? /* @__PURE__ */ jsx(MenuSeparator, { className: "my-1 h-px bg-[var(--color-border-divider,rgba(127,127,127,0.25))]" }) : /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-[var(--color-border-divider,rgba(127,127,127,0.25))]" }),
718
+ footer.map((item) => /* @__PURE__ */ jsx(Row, { item, onDone: close, menu }, item.id))
719
+ ] }) : null
720
+ ] });
721
+ const trigger = /* @__PURE__ */ jsxs(
722
+ "button",
723
+ {
724
+ type: "button",
725
+ "data-testid": testId,
726
+ "aria-label": title,
727
+ "aria-haspopup": "menu",
728
+ "aria-expanded": open,
729
+ className: cn(
730
+ "flex max-w-[14rem] items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium",
731
+ "hover:bg-[rgba(127,127,127,0.14)]"
732
+ ),
733
+ children: [
734
+ icon,
735
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: label }),
736
+ /* @__PURE__ */ jsx(ChevronsUpDown, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0 opacity-60" })
737
+ ]
738
+ }
739
+ );
740
+ if (narrow) {
741
+ return /* @__PURE__ */ jsxs(DrawerRoot, { open, onOpenChange: (d) => setOpen(d.open), placement: "bottom", size: "md", children: [
742
+ React6.cloneElement(trigger, { onClick: () => setOpen(true) }),
743
+ /* @__PURE__ */ jsxs(DrawerContent, { "data-testid": testId ? `${testId}-panel` : void 0, children: [
744
+ /* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: title }) }),
745
+ /* @__PURE__ */ jsx(DrawerBody, { children: panel(false) })
746
+ ] })
747
+ ] });
748
+ }
749
+ return /* @__PURE__ */ jsxs(
750
+ MenuRoot,
751
+ {
752
+ open,
753
+ onOpenChange: (d) => setOpen(d.open),
754
+ positioning: { placement: align === "end" ? "bottom-end" : "bottom-start" },
755
+ children: [
756
+ /* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: trigger }),
757
+ /* @__PURE__ */ jsx(MenuContent, { minW: "16rem", "data-testid": testId ? `${testId}-panel` : void 0, children: panel(true) })
758
+ ]
759
+ }
760
+ );
761
+ };
762
+ var OrgSwitcher = () => {
763
+ const id = useIdentity();
764
+ return /* @__PURE__ */ jsx(
765
+ Switcher,
766
+ {
767
+ testId: "org-switcher",
768
+ title: "Organization",
769
+ label: id.org?.displayName || id.org?.name || id.whiteLabel.name,
770
+ icon: /* @__PURE__ */ jsx(Monogram, { label: id.org?.displayName || id.org?.name || id.whiteLabel.name, logo: id.org?.logo }),
771
+ status: id.status,
772
+ error: id.error,
773
+ empty: "No organizations for this account.",
774
+ onSignIn: id.signIn,
775
+ signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
776
+ items: id.orgs.map((o) => ({
777
+ id: o.name,
778
+ label: o.displayName || o.name,
779
+ icon: /* @__PURE__ */ jsx(Monogram, { label: o.displayName || o.name, logo: o.logo }),
780
+ selected: o.name === id.org?.name,
781
+ onSelect: () => id.setOrg(o.name)
782
+ }))
783
+ }
784
+ );
785
+ };
786
+ var ProjectSwitcher = () => {
787
+ const id = useIdentity();
788
+ if (id.status === "ready" && id.projects.length === 0) return null;
789
+ return /* @__PURE__ */ jsx(
790
+ Switcher,
791
+ {
792
+ testId: "project-switcher",
793
+ title: "Project",
794
+ label: id.project?.displayName || id.project?.name || "Project",
795
+ icon: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
796
+ status: id.status,
797
+ error: id.error,
798
+ empty: "No projects in this organization.",
799
+ onSignIn: id.signIn,
800
+ items: id.projects.map((p) => ({
801
+ id: p.name,
802
+ label: p.displayName || p.name,
803
+ icon: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
804
+ selected: p.name === id.project?.name,
805
+ onSelect: () => id.setProject(p.name)
806
+ }))
807
+ }
808
+ );
809
+ };
810
+ var UserMenu = ({ items = [] }) => {
811
+ const id = useIdentity();
812
+ const who = id.account?.displayName || id.account?.email || id.account?.name || "Account";
813
+ return /* @__PURE__ */ jsx(
814
+ Switcher,
815
+ {
816
+ testId: "user-menu",
817
+ align: "end",
818
+ title: id.status === "ready" ? who : "Account",
819
+ label: id.status === "ready" ? who : "Sign in",
820
+ icon: id.status === "ready" ? /* @__PURE__ */ jsx(Monogram, { label: who, logo: id.account?.avatar }) : /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
821
+ status: id.status,
822
+ error: id.error,
823
+ onSignIn: id.signIn,
824
+ signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
825
+ items: [
826
+ { id: "account", label: id.account?.email || who, icon: /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) },
827
+ ...items
828
+ ],
829
+ footer: id.status === "ready" ? [{ id: "sign-out", label: "Sign out", danger: true, icon: /* @__PURE__ */ jsx(LogOut, { "aria-hidden": "true", className: "h-4 w-4" }), onSelect: id.signOut }] : []
830
+ }
831
+ );
832
+ };
833
+ var SettingsMenu = ({ items = [], href = "/settings" }) => /* @__PURE__ */ jsx(
834
+ Switcher,
835
+ {
836
+ testId: "settings-menu",
837
+ align: "end",
838
+ title: "Settings",
839
+ label: "Settings",
840
+ icon: /* @__PURE__ */ jsx(Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
841
+ items,
842
+ empty: "No settings on this surface.",
843
+ footer: [{ id: "all-settings", label: "All settings", href, icon: /* @__PURE__ */ jsx(Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) }]
844
+ }
845
+ );
846
+ var AppNav = ({
847
+ brand,
848
+ home = "/",
849
+ links = [],
850
+ org = true,
851
+ project = false,
852
+ settings,
853
+ userItems,
854
+ children
855
+ }) => {
856
+ const id = useIdentity();
857
+ const narrow = useIsNarrow();
858
+ const [menu, setMenu] = React6.useState(false);
859
+ return /* @__PURE__ */ jsx(
860
+ "header",
861
+ {
862
+ "data-testid": "app-nav",
863
+ 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)]",
864
+ children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-14 max-w-7xl items-center gap-2 px-4", children: [
865
+ narrow && links.length > 0 ? /* @__PURE__ */ jsxs(DrawerRoot, { open: menu, onOpenChange: (d) => setMenu(d.open), placement: "bottom", size: "md", children: [
866
+ /* @__PURE__ */ jsx(
867
+ "button",
868
+ {
869
+ type: "button",
870
+ "aria-label": "Menu",
871
+ "data-testid": "nav-menu",
872
+ className: "rounded-md p-2 hover:bg-[rgba(127,127,127,0.14)]",
873
+ onClick: () => setMenu(true),
874
+ children: /* @__PURE__ */ jsx(Menu, { "aria-hidden": "true", className: "h-5 w-5" })
875
+ }
876
+ ),
877
+ /* @__PURE__ */ jsxs(DrawerContent, { "data-testid": "nav-menu-panel", children: [
878
+ /* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: "Menu" }) }),
879
+ /* @__PURE__ */ jsx(DrawerBody, { children: links.map((l) => /* @__PURE__ */ jsx(
880
+ "a",
881
+ {
882
+ href: l.href,
883
+ onClick: () => setMenu(false),
884
+ "aria-current": l.active ? "page" : void 0,
885
+ className: "block rounded-md px-2 py-2.5 text-sm hover:bg-[rgba(127,127,127,0.14)]",
886
+ children: l.label
887
+ },
888
+ l.href
889
+ )) })
890
+ ] })
891
+ ] }) : null,
892
+ /* @__PURE__ */ jsx("a", { href: home, className: "flex items-center gap-2 font-semibold tracking-tight", children: brand ?? /* @__PURE__ */ jsxs(Fragment, { children: [
893
+ /* @__PURE__ */ jsx(Building2, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
894
+ id.whiteLabel.name
895
+ ] }) }),
896
+ org ? /* @__PURE__ */ jsx(OrgSwitcher, {}) : null,
897
+ project ? /* @__PURE__ */ jsx(ProjectSwitcher, {}) : null,
898
+ !narrow && links.length > 0 ? /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-1", children: links.map((l) => /* @__PURE__ */ jsx(
899
+ "a",
900
+ {
901
+ href: l.href,
902
+ "aria-current": l.active ? "page" : void 0,
903
+ className: cn(
904
+ "rounded-md px-3 py-1.5 text-sm font-medium",
905
+ l.active ? "bg-[rgba(127,127,127,0.14)]" : "opacity-75 hover:opacity-100"
906
+ ),
907
+ children: l.label
908
+ },
909
+ l.href
910
+ )) }) : null,
911
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center justify-end gap-1", children: [
912
+ children,
913
+ settings ? /* @__PURE__ */ jsx(SettingsMenu, { items: settings }) : null,
914
+ /* @__PURE__ */ jsx(UserMenu, { items: userItems })
915
+ ] })
916
+ ] })
917
+ }
918
+ );
919
+ };
920
+
921
+ export { AppNav, OrgSwitcher, ProjectSwitcher, SettingsMenu, Switcher, UserMenu, initials };