@luxfi/ui 7.4.10 → 7.4.12

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 (137) hide show
  1. package/dist/accordion.cjs +107 -166
  2. package/dist/accordion.d.cts +18 -51
  3. package/dist/accordion.d.ts +18 -51
  4. package/dist/accordion.js +109 -166
  5. package/dist/alert.cjs +68 -46
  6. package/dist/alert.js +69 -46
  7. package/dist/avatar.cjs +49 -46
  8. package/dist/avatar.js +52 -48
  9. package/dist/badge.cjs +82 -49
  10. package/dist/badge.js +83 -50
  11. package/dist/checkbox.cjs +42 -75
  12. package/dist/checkbox.js +43 -76
  13. package/dist/chrome.cjs +196 -386
  14. package/dist/chrome.js +198 -386
  15. package/dist/close-button.cjs +3 -7
  16. package/dist/close-button.js +3 -7
  17. package/dist/collapsible.cjs +35 -26
  18. package/dist/collapsible.d.cts +2 -1
  19. package/dist/collapsible.d.ts +2 -1
  20. package/dist/collapsible.js +34 -24
  21. package/dist/dialog.cjs +3 -7
  22. package/dist/dialog.d.cts +1 -1
  23. package/dist/dialog.d.ts +1 -1
  24. package/dist/dialog.js +3 -7
  25. package/dist/drawer.cjs +95 -122
  26. package/dist/drawer.d.cts +43 -10
  27. package/dist/drawer.d.ts +43 -10
  28. package/dist/drawer.js +97 -122
  29. package/dist/empty-state.cjs +13 -13
  30. package/dist/empty-state.js +13 -13
  31. package/dist/expiration-selector.cjs +58 -63
  32. package/dist/expiration-selector.js +58 -63
  33. package/dist/field.cjs +60 -109
  34. package/dist/field.d.cts +0 -1
  35. package/dist/field.d.ts +0 -1
  36. package/dist/field.js +61 -109
  37. package/dist/greeks-display.cjs +48 -39
  38. package/dist/greeks-display.js +48 -39
  39. package/dist/heading.cjs +10 -17
  40. package/dist/heading.d.cts +0 -2
  41. package/dist/heading.d.ts +0 -2
  42. package/dist/heading.js +10 -17
  43. package/dist/icon-button.cjs +82 -82
  44. package/dist/icon-button.d.cts +16 -12
  45. package/dist/icon-button.d.ts +16 -12
  46. package/dist/icon-button.js +82 -82
  47. package/dist/index.cjs +1812 -2105
  48. package/dist/index.d.cts +1 -5
  49. package/dist/index.d.ts +1 -5
  50. package/dist/index.js +1814 -2100
  51. package/dist/input-group.cjs +11 -12
  52. package/dist/input-group.js +11 -12
  53. package/dist/input.cjs +27 -27
  54. package/dist/input.d.cts +21 -1
  55. package/dist/input.d.ts +21 -1
  56. package/dist/input.js +25 -28
  57. package/dist/menu.cjs +160 -271
  58. package/dist/menu.d.cts +41 -57
  59. package/dist/menu.d.ts +41 -57
  60. package/dist/menu.js +161 -251
  61. package/dist/option-chain.cjs +89 -67
  62. package/dist/option-chain.js +89 -67
  63. package/dist/option-position.cjs +88 -85
  64. package/dist/option-position.js +88 -85
  65. package/dist/pnl-diagram.cjs +20 -20
  66. package/dist/pnl-diagram.js +20 -20
  67. package/dist/popover.cjs +4 -8
  68. package/dist/popover.js +4 -8
  69. package/dist/progress.cjs +15 -22
  70. package/dist/progress.d.cts +6 -6
  71. package/dist/progress.d.ts +6 -6
  72. package/dist/progress.js +15 -22
  73. package/dist/radio.cjs +35 -67
  74. package/dist/radio.d.cts +18 -18
  75. package/dist/radio.d.ts +18 -18
  76. package/dist/radio.js +36 -68
  77. package/dist/select.cjs +40 -39
  78. package/dist/select.d.cts +35 -4
  79. package/dist/select.d.ts +35 -4
  80. package/dist/select.js +40 -38
  81. package/dist/separator.cjs +8 -33
  82. package/dist/separator.js +8 -33
  83. package/dist/slider.cjs +33 -49
  84. package/dist/slider.js +34 -50
  85. package/dist/switch.cjs +48 -55
  86. package/dist/switch.js +49 -56
  87. package/dist/tabs.cjs +108 -197
  88. package/dist/tabs.d.cts +16 -60
  89. package/dist/tabs.d.ts +16 -60
  90. package/dist/tabs.js +109 -196
  91. package/dist/tag.cjs +112 -69
  92. package/dist/tag.js +113 -69
  93. package/dist/textarea.cjs +56 -27
  94. package/dist/textarea.js +57 -28
  95. package/dist/toaster.cjs +97 -79
  96. package/dist/toaster.d.cts +7 -8
  97. package/dist/toaster.d.ts +7 -8
  98. package/dist/toaster.js +78 -80
  99. package/dist/tooltip.cjs +28 -17
  100. package/dist/tooltip.js +30 -18
  101. package/package.json +2 -16
  102. package/src/accordion.tsx +173 -227
  103. package/src/alert.tsx +78 -45
  104. package/src/avatar.tsx +54 -37
  105. package/src/badge.tsx +65 -44
  106. package/src/checkbox.tsx +70 -89
  107. package/src/close-button.tsx +3 -8
  108. package/src/collapsible.tsx +55 -52
  109. package/src/drawer.tsx +123 -115
  110. package/src/empty-state.tsx +21 -17
  111. package/src/expiration-selector.tsx +84 -66
  112. package/src/field.tsx +68 -124
  113. package/src/greeks-display.tsx +59 -51
  114. package/src/heading.tsx +22 -26
  115. package/src/icon-button.tsx +134 -141
  116. package/src/ink.tsx +37 -0
  117. package/src/input-group.tsx +59 -36
  118. package/src/input.tsx +41 -32
  119. package/src/menu.tsx +224 -397
  120. package/src/option-chain.tsx +154 -104
  121. package/src/option-position.tsx +136 -114
  122. package/src/pin-input.tsx +37 -29
  123. package/src/pnl-diagram.tsx +36 -28
  124. package/src/popover.tsx +1 -1
  125. package/src/progress.tsx +17 -21
  126. package/src/radio.tsx +56 -75
  127. package/src/select.tsx +80 -59
  128. package/src/separator.tsx +13 -34
  129. package/src/slider.tsx +43 -44
  130. package/src/strategy-builder.tsx +245 -156
  131. package/src/switch.tsx +63 -64
  132. package/src/tabs.tsx +166 -296
  133. package/src/tag.tsx +89 -51
  134. package/src/textarea.tsx +19 -29
  135. package/src/toaster.tsx +118 -86
  136. package/src/tooltip.tsx +21 -13
  137. package/tokens.css +79 -0
package/dist/chrome.cjs CHANGED
@@ -1,15 +1,13 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React6 = require('react');
4
+ var React3 = require('react');
5
5
  var lucideReact = require('lucide-react');
6
6
  var gui = require('@hanzo/gui');
7
- var RadixDialog = require('@radix-ui/react-dialog');
8
- var clsx = require('clsx');
9
- var tailwindMerge = require('tailwind-merge');
10
7
  var jsxRuntime = require('react/jsx-runtime');
11
8
  var reactQuery = require('@tanstack/react-query');
12
- var DropdownMenu = require('@radix-ui/react-dropdown-menu');
9
+ var clsx = require('clsx');
10
+ var tailwindMerge = require('tailwind-merge');
13
11
 
14
12
  function _interopNamespace(e) {
15
13
  if (e && e.__esModule) return e;
@@ -29,26 +27,8 @@ function _interopNamespace(e) {
29
27
  return Object.freeze(n);
30
28
  }
31
29
 
32
- var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
33
- var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
34
- var DropdownMenu__namespace = /*#__PURE__*/_interopNamespace(DropdownMenu);
30
+ var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
35
31
 
36
- var NARROW_PX = 640;
37
- function useBelow(px) {
38
- const [below, setBelow] = React6__namespace.useState(false);
39
- React6__namespace.useEffect(() => {
40
- const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
41
- const apply = () => setBelow(mql.matches);
42
- apply();
43
- mql.addEventListener("change", apply);
44
- return () => mql.removeEventListener("change", apply);
45
- }, [px]);
46
- return below;
47
- }
48
- var useIsNarrow = () => useBelow(NARROW_PX);
49
- function cn(...inputs) {
50
- return tailwindMerge.twMerge(clsx.clsx(inputs));
51
- }
52
32
  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";
53
33
  var CloseButtonFrame = gui.styled(gui.View, {
54
34
  name: "LuxCloseButton",
@@ -79,23 +59,19 @@ var CloseButtonFrame = gui.styled(gui.View, {
79
59
  }
80
60
  }
81
61
  });
82
- var CLOSE_BUTTON_CLASSES = [
83
- "text-[var(--closeButton-fg,currentColor)]",
84
- "hover:text-[var(--hover-color,currentColor)]",
85
- "disabled:opacity-40"
86
- ].join(" ");
87
- var CloseButton = React6__namespace.forwardRef(function CloseButton2(props, ref) {
62
+ var CloseButton = React3__namespace.forwardRef(function CloseButton2(props, ref) {
88
63
  const { variant: _variant, size: _size, className, children, ...rest } = props;
89
64
  return /* @__PURE__ */ jsxRuntime.jsx(
90
65
  CloseButtonFrame,
91
66
  {
92
67
  ref,
93
- className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
68
+ className,
94
69
  ...rest,
95
70
  children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
96
71
  "svg",
97
72
  {
98
- className: "size-5",
73
+ width: 20,
74
+ height: 20,
99
75
  viewBox: "0 0 20 20",
100
76
  fill: "none",
101
77
  "aria-hidden": "true",
@@ -111,13 +87,35 @@ var CloseButton = React6__namespace.forwardRef(function CloseButton2(props, ref)
111
87
  }
112
88
  );
113
89
  });
114
- var DrawerPlacementContext = React6__namespace.createContext("right");
115
- var DrawerSizeContext = React6__namespace.createContext("md");
116
- var DrawerStateContext = React6__namespace.createContext({
90
+ var ink = (children, Wrap = gui.Text, props = {}) => {
91
+ let hasText = false;
92
+ React3.Children.forEach(children, (child) => {
93
+ if (typeof child === "string" || typeof child === "number") hasText = true;
94
+ });
95
+ if (!hasText) return children;
96
+ return React3.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React3.createElement(Wrap, props, child) : child);
97
+ };
98
+ var NARROW_PX = 640;
99
+ function useBelow(px) {
100
+ const [below, setBelow] = React3__namespace.useState(false);
101
+ React3__namespace.useEffect(() => {
102
+ const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
103
+ const apply = () => setBelow(mql.matches);
104
+ apply();
105
+ mql.addEventListener("change", apply);
106
+ return () => mql.removeEventListener("change", apply);
107
+ }, [px]);
108
+ return below;
109
+ }
110
+ var useIsNarrow = () => useBelow(NARROW_PX);
111
+ var DrawerPlacementContext = React3__namespace.createContext("right");
112
+ var DrawerSizeContext = React3__namespace.createContext("md");
113
+ var DrawerStateContext = React3__namespace.createContext({
117
114
  open: false,
118
115
  setOpen: () => {
119
116
  },
120
- modal: true
117
+ modal: true,
118
+ narrow: false
121
119
  });
122
120
  var DrawerRoot = (props) => {
123
121
  const {
@@ -129,63 +127,43 @@ var DrawerRoot = (props) => {
129
127
  modal = true,
130
128
  size = "md"
131
129
  } = props;
132
- const [uncontrolled, setUncontrolled] = React6__namespace.useState(defaultOpen ?? false);
130
+ const [uncontrolled, setUncontrolled] = React3__namespace.useState(defaultOpen ?? false);
133
131
  const isControlled = open !== void 0;
134
132
  const isOpen = isControlled ? open : uncontrolled;
135
- const setOpen = React6__namespace.useCallback((nextOpen) => {
133
+ const narrow = useIsNarrow();
134
+ const setOpen = React3__namespace.useCallback((nextOpen) => {
136
135
  if (!isControlled) setUncontrolled(nextOpen);
137
136
  onOpenChange?.({ open: nextOpen });
138
137
  }, [isControlled, onOpenChange]);
139
- const state = React6__namespace.useMemo(
140
- () => ({ open: isOpen, setOpen, modal }),
141
- [isOpen, setOpen, modal]
138
+ const state = React3__namespace.useMemo(
139
+ () => ({ open: isOpen, setOpen, modal, narrow }),
140
+ [isOpen, setOpen, modal, narrow]
142
141
  );
143
- 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(
144
- RadixDialog__namespace.Root,
145
- {
146
- open: isOpen,
147
- onOpenChange: setOpen,
148
- modal,
149
- children
150
- }
151
- ) }) }) });
142
+ 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: narrow ? children : /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog, { open: isOpen, onOpenChange: setOpen, modal, children }) }) }) });
152
143
  };
153
- var PLACEMENT_CLASSES = {
154
- right: [
155
- "inset-y-0 right-0",
156
- "data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
157
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
158
- ].join(" "),
159
- left: [
160
- "inset-y-0 left-0",
161
- "data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
162
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
163
- ].join(" "),
164
- top: [
165
- "inset-x-0 top-0",
166
- "data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
167
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
168
- ].join(" "),
169
- bottom: [
170
- "inset-x-0 bottom-0",
171
- "data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
172
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
173
- ].join(" ")
144
+ var ANCHOR = {
145
+ right: { top: 0, bottom: 0, right: 0, enterStyle: { x: 24, opacity: 0 }, exitStyle: { x: 24, opacity: 0 } },
146
+ left: { top: 0, bottom: 0, left: 0, enterStyle: { x: -24, opacity: 0 }, exitStyle: { x: -24, opacity: 0 } },
147
+ top: { left: 0, right: 0, top: 0, enterStyle: { y: -24, opacity: 0 }, exitStyle: { y: -24, opacity: 0 } },
148
+ bottom: { left: 0, right: 0, bottom: 0, enterStyle: { y: 24, opacity: 0 }, exitStyle: { y: 24, opacity: 0 } }
174
149
  };
175
- var SIZE_CLASSES = {
176
- right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
177
- left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
178
- top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
179
- bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
150
+ var ACROSS = {
151
+ xs: 240,
152
+ sm: 320,
153
+ md: 384,
154
+ lg: 480,
155
+ xl: 640,
156
+ full: "100%"
180
157
  };
181
- var DrawerContent = React6__namespace.forwardRef(
158
+ var extent = (placement, size) => placement === "left" || placement === "right" ? { width: ACROSS[size], maxWidth: "100%" } : { height: ACROSS[size], maxHeight: "100%" };
159
+ var SCRIM = "rgba(0,0,0,0.5)";
160
+ var DrawerContent = React3__namespace.forwardRef(
182
161
  function DrawerContent2(props, ref) {
183
- const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
184
- const placement = React6__namespace.useContext(DrawerPlacementContext);
185
- const size = React6__namespace.useContext(DrawerSizeContext);
186
- const { open, setOpen, modal } = React6__namespace.useContext(DrawerStateContext);
187
- const isNarrow = useIsNarrow();
188
- if (isNarrow) {
162
+ const { children, portalled = true, portalRef: _portalRef, offset: _offset, backdrop = true, ...rest } = props;
163
+ const placement = React3__namespace.useContext(DrawerPlacementContext);
164
+ const size = React3__namespace.useContext(DrawerSizeContext);
165
+ const { open, setOpen, modal, narrow } = React3__namespace.useContext(DrawerStateContext);
166
+ if (narrow) {
189
167
  return /* @__PURE__ */ jsxRuntime.jsxs(
190
168
  gui.Sheet,
191
169
  {
@@ -203,7 +181,7 @@ var DrawerContent = React6__namespace.forwardRef(
203
181
  transition: "lazy",
204
182
  enterStyle: { opacity: 0 },
205
183
  exitStyle: { opacity: 0 },
206
- className: "bg-black/50"
184
+ backgroundColor: SCRIM
207
185
  }
208
186
  ),
209
187
  /* @__PURE__ */ jsxRuntime.jsx(gui.Sheet.Handle, {}),
@@ -211,10 +189,11 @@ var DrawerContent = React6__namespace.forwardRef(
211
189
  gui.Sheet.Frame,
212
190
  {
213
191
  unstyled: true,
214
- className: cn(
215
- "flex flex-col rounded-t-2xl bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)]",
216
- className
217
- ),
192
+ flexDirection: "column",
193
+ borderTopLeftRadius: 16,
194
+ borderTopRightRadius: 16,
195
+ backgroundColor: "var(--color-drawer-bg)",
196
+ shadowColor: "var(--shadow-drawer)",
218
197
  ...rest,
219
198
  children
220
199
  }
@@ -225,62 +204,54 @@ var DrawerContent = React6__namespace.forwardRef(
225
204
  }
226
205
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
227
206
  backdrop && /* @__PURE__ */ jsxRuntime.jsx(
228
- RadixDialog__namespace.Overlay,
207
+ gui.Dialog.Overlay,
229
208
  {
230
- className: cn(
231
- "fixed inset-0 z-50 bg-black/50",
232
- "data-[state=open]:animate-in data-[state=open]:fade-in-0",
233
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
234
- )
235
- }
209
+ position: "fixed",
210
+ top: 0,
211
+ right: 0,
212
+ bottom: 0,
213
+ left: 0,
214
+ zIndex: 50,
215
+ backgroundColor: SCRIM,
216
+ transition: "lazy",
217
+ enterStyle: { opacity: 0 },
218
+ exitStyle: { opacity: 0 }
219
+ },
220
+ "overlay"
236
221
  ),
237
222
  /* @__PURE__ */ jsxRuntime.jsx(
238
- RadixDialog__namespace.Content,
223
+ gui.Dialog.Content,
239
224
  {
240
225
  ref,
241
- className: cn(
242
- "fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
243
- PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
244
- SIZE_CLASSES[placement]?.[size] ?? SIZE_CLASSES.right?.md,
245
- className
246
- ),
226
+ unstyled: true,
227
+ position: "fixed",
228
+ zIndex: 50,
229
+ flexDirection: "column",
230
+ backgroundColor: "var(--color-drawer-bg)",
231
+ transition: "medium",
232
+ ...ANCHOR[placement],
233
+ ...extent(placement, size),
247
234
  ...rest,
248
235
  children
249
- }
236
+ },
237
+ "content"
250
238
  )
251
239
  ] });
252
- if (portalled) {
253
- return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container: portalRef?.current ?? void 0, children: content });
254
- }
255
- return content;
240
+ return portalled ? /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Portal, { children: content }) : content;
256
241
  }
257
242
  );
258
- React6__namespace.forwardRef(function DrawerCloseTrigger2(props, ref) {
259
- return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
260
- CloseButton,
261
- {
262
- ref,
263
- className: cn("absolute top-7 right-5", props.className),
264
- ...props
265
- }
266
- ) });
243
+ React3__namespace.forwardRef(function DrawerCloseTrigger2(props, ref) {
244
+ return (
245
+ // Placement belongs to the surrounding box, not to the button: CloseButton
246
+ // is a fixed 20px control and has no opinion about where it sits.
247
+ /* @__PURE__ */ jsxRuntime.jsx(gui.View, { position: "absolute", top: 28, right: 20, zIndex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { ref, ...props }) }) })
248
+ );
267
249
  });
268
- var DrawerHeader = React6__namespace.forwardRef(
269
- function DrawerHeader2({ className, ...props }, ref) {
270
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
271
- }
272
- );
273
- var DrawerBody = React6__namespace.forwardRef(
274
- function DrawerBody2({ className, ...props }, ref) {
275
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
276
- }
277
- );
278
- React6__namespace.forwardRef(
279
- function DrawerFooter2({ className, ...props }, ref) {
280
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
281
- }
282
- );
283
- var DrawerTitle = RadixDialog__namespace.Title;
250
+ var DrawerHeader = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: 6, padding: 24, paddingBottom: 0, ...props, children: ink(children) });
251
+ var DrawerBody = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { flex: 1, overflow: "scroll", padding: 24, ...props, children: ink(children) });
252
+ var DrawerTitle = gui.Dialog.Title;
253
+ gui.Dialog.Description;
254
+ gui.Dialog.Close;
284
255
 
285
256
  // src/white-label.ts
286
257
  var LUX_BRAND = {
@@ -407,13 +378,13 @@ function resolveWhiteLabel(host) {
407
378
  new reactQuery.QueryClient({
408
379
  defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
409
380
  });
410
- var WhiteLabelContext = React6__namespace.default.createContext(resolveWhiteLabel(""));
411
- var useWhiteLabel = () => React6__namespace.default.useContext(WhiteLabelContext);
412
- var IdentityContext = React6__namespace.createContext(null);
381
+ var WhiteLabelContext = React3__namespace.default.createContext(resolveWhiteLabel(""));
382
+ var useWhiteLabel = () => React3__namespace.default.useContext(WhiteLabelContext);
383
+ var IdentityContext = React3__namespace.createContext(null);
413
384
  function useIdentity() {
414
- const ctx = React6__namespace.useContext(IdentityContext);
385
+ const ctx = React3__namespace.useContext(IdentityContext);
415
386
  const whiteLabel = useWhiteLabel();
416
- const fallback = React6__namespace.useMemo(() => ({
387
+ const fallback = React3__namespace.useMemo(() => ({
417
388
  status: "anonymous",
418
389
  account: null,
419
390
  orgs: [],
@@ -432,262 +403,101 @@ function useIdentity() {
432
403
  }), [whiteLabel]);
433
404
  return ctx ?? fallback;
434
405
  }
435
- function parsePlacement(placement) {
436
- if (!placement) {
437
- return { side: "bottom", align: "start" };
438
- }
439
- const parts = placement.split("-");
440
- const side = parts[0] ?? "bottom";
441
- const alignPart = parts[1];
442
- let align = "center";
443
- if (alignPart === "start") {
444
- align = "start";
445
- } else if (alignPart === "end") {
446
- align = "end";
447
- }
448
- return { side, align };
449
- }
450
- var PositioningContext = React6__namespace.createContext({
451
- side: "bottom",
452
- align: "start",
453
- sideOffset: 4,
454
- alignOffset: 0
455
- });
456
- var MenuRoot = (props) => {
457
- const {
458
- children,
406
+ var ITEM_HOVER = "var(--color-popover-item-hover)";
407
+ var TEXT = "var(--color-text-primary)";
408
+ var ROW = {
409
+ position: "relative",
410
+ flexDirection: "row",
411
+ alignItems: "center",
412
+ cursor: "pointer",
413
+ userSelect: "none",
414
+ borderRadius: 6,
415
+ fontSize: 14,
416
+ backgroundColor: "transparent",
417
+ hoverStyle: { backgroundColor: ITEM_HOVER },
418
+ focusStyle: { backgroundColor: ITEM_HOVER }
419
+ };
420
+ var MenuRoot = ({
421
+ children,
422
+ open,
423
+ defaultOpen,
424
+ onOpenChange,
425
+ positioning,
426
+ modal = true
427
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
428
+ gui.Menu,
429
+ {
459
430
  open,
460
431
  defaultOpen,
461
- onOpenChange,
462
- positioning,
463
- modal = true,
464
- // lazyMount / unmountOnExit have no direct Radix equivalent; Radix handles
465
- // mount/unmount automatically.
466
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
467
- lazyMount: _lazyMount,
468
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
469
- unmountOnExit: _unmountOnExit
470
- } = props;
471
- const mergedPositioning = {
472
- placement: "bottom-start",
473
- ...positioning,
474
- offset: {
475
- mainAxis: 4,
476
- ...positioning?.offset
477
- }
478
- };
479
- const { side, align } = parsePlacement(mergedPositioning.placement);
480
- const positioningValue = React6__namespace.useMemo(() => ({
481
- side,
482
- align,
483
- sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
484
- alignOffset: mergedPositioning.offset?.crossAxis ?? 0
485
- }), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
486
- const handleOpenChange = React6__namespace.useCallback((isOpen) => {
487
- onOpenChange?.({ open: isOpen });
488
- }, [onOpenChange]);
489
- return /* @__PURE__ */ jsxRuntime.jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsxRuntime.jsx(
490
- DropdownMenu__namespace.Root,
491
- {
492
- open,
493
- defaultOpen,
494
- onOpenChange: handleOpenChange,
495
- modal,
496
- children
497
- }
498
- ) });
499
- };
500
- var MenuTrigger = React6__namespace.forwardRef(function MenuTrigger2(props, ref) {
501
- const { asChild = false, ...rest } = props;
502
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild, ref, ...rest });
503
- });
504
- var MenuContent = React6__namespace.forwardRef(function MenuContent2(props, ref) {
505
- const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
506
- const positioning = React6__namespace.useContext(PositioningContext);
507
- const mergedStyle = {
508
- ...style,
509
- ...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
510
- ...minW !== void 0 ? { minWidth: minW } : {}
511
- };
512
- const content = /* @__PURE__ */ jsxRuntime.jsx(
513
- DropdownMenu__namespace.Content,
514
- {
515
- ref,
516
- side: positioning.side,
517
- align: positioning.align,
518
- sideOffset: positioning.sideOffset,
519
- alignOffset: positioning.alignOffset,
520
- className: cn(
521
- "z-50 min-w-[8rem] overflow-hidden rounded-lg p-1",
522
- "border border-[var(--color-popover-border,var(--color-border-divider))]",
523
- "bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
524
- "shadow-[0_4px_12px_var(--color-popover-shadow)]",
525
- "outline-none",
526
- "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
527
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
528
- "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
529
- "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
530
- className
531
- ),
532
- style: Object.keys(mergedStyle).length > 0 ? mergedStyle : void 0,
533
- ...rest
534
- }
535
- );
536
- if (!portalled) {
537
- return content;
432
+ onOpenChange: onOpenChange ? (isOpen) => onOpenChange({ open: isOpen }) : void 0,
433
+ modal,
434
+ placement: positioning?.placement ?? "bottom-start",
435
+ offset: positioning?.offset?.mainAxis ?? 4,
436
+ children
538
437
  }
539
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { container: portalRef?.current ?? void 0, children: content });
540
- });
541
- var MenuItem = React6__namespace.forwardRef(function MenuItem2(props, ref) {
542
- const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
543
- return /* @__PURE__ */ jsxRuntime.jsx(
544
- DropdownMenu__namespace.Item,
438
+ );
439
+ var MenuTrigger = ({ asChild = false, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(gui.Menu.Trigger, { asChild, ...rest });
440
+ var MenuContent = ({
441
+ portalled = true,
442
+ minW,
443
+ children,
444
+ ...rest
445
+ }) => {
446
+ const content = /* @__PURE__ */ jsxRuntime.jsx(
447
+ gui.Menu.Content,
545
448
  {
546
- ref,
547
- asChild,
548
- disabled,
549
- onClick,
550
- className: cn(
551
- "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
552
- "outline-none transition-colors",
553
- "text-[var(--color-text-primary,inherit)]",
554
- "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
555
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
556
- className
557
- ),
449
+ unstyled: true,
450
+ zIndex: 50,
451
+ minWidth: minW ?? 128,
452
+ overflow: "hidden",
453
+ borderRadius: 8,
454
+ padding: 4,
455
+ borderWidth: 1,
456
+ borderColor: "var(--color-popover-border)",
457
+ backgroundColor: "var(--color-popover-bg)",
458
+ transition: "quick",
459
+ enterStyle: { opacity: 0, scale: 0.95 },
460
+ exitStyle: { opacity: 0, scale: 0.95 },
558
461
  ...rest,
559
462
  children
560
463
  }
561
464
  );
562
- });
563
- React6__namespace.forwardRef(function MenuItemText2(props, ref) {
564
- const { className, ...rest } = props;
565
- return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, className: cn("flex-1", className), ...rest });
566
- });
567
- React6__namespace.forwardRef(function MenuItemCommand2(props, ref) {
568
- const { className, ...rest } = props;
569
- return /* @__PURE__ */ jsxRuntime.jsx(
570
- "span",
571
- {
572
- ref,
573
- className: cn("ml-auto text-xs tracking-widest opacity-60", className),
574
- ...rest
575
- }
576
- );
577
- });
578
- var MenuSeparator = React6__namespace.forwardRef(function MenuSeparator2(props, ref) {
579
- const { className, ...rest } = props;
580
- return /* @__PURE__ */ jsxRuntime.jsx(
581
- DropdownMenu__namespace.Separator,
582
- {
583
- ref,
584
- className: cn("-mx-1 my-1 h-px bg-[var(--color-border-divider)]", className),
585
- ...rest
586
- }
587
- );
588
- });
589
- React6__namespace.forwardRef(function MenuItemGroup2(props, ref) {
590
- const { title, children, className, ...rest } = props;
591
- return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Group, { ref, className, ...rest, children: [
592
- title && /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
593
- children
594
- ] });
595
- });
596
- React6__namespace.forwardRef(function MenuArrow2(props, ref) {
597
- const { className, ...rest } = props;
598
- return /* @__PURE__ */ jsxRuntime.jsx(
599
- DropdownMenu__namespace.Arrow,
600
- {
601
- ref,
602
- className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
603
- ...rest
604
- }
605
- );
606
- });
607
- React6__namespace.forwardRef(function MenuCheckboxItem2(props, ref) {
608
- const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
609
- return /* @__PURE__ */ jsxRuntime.jsxs(
610
- DropdownMenu__namespace.CheckboxItem,
611
- {
612
- ref,
613
- checked,
614
- onCheckedChange,
615
- onClick,
616
- className: cn(
617
- "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
618
- "outline-none transition-colors",
619
- "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
620
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
621
- className
622
- ),
623
- ...rest,
624
- children: [
625
- /* @__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" }) }) }),
626
- children
627
- ]
628
- }
629
- );
630
- });
631
- React6__namespace.forwardRef(function MenuRadioItemGroup2(props, ref) {
632
- const { value, onValueChange, ...rest } = props;
633
- return /* @__PURE__ */ jsxRuntime.jsx(
634
- DropdownMenu__namespace.RadioGroup,
635
- {
636
- ref,
637
- value,
638
- onValueChange,
639
- ...rest
640
- }
641
- );
642
- });
643
- React6__namespace.forwardRef(function MenuRadioItem2(props, ref) {
644
- const { className, children, value, onClick, ...rest } = props;
645
- const { value: _v, ...radixRest } = rest;
646
- return /* @__PURE__ */ jsxRuntime.jsxs(
647
- DropdownMenu__namespace.RadioItem,
648
- {
649
- ref,
650
- value,
651
- onClick,
652
- className: cn(
653
- "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
654
- "outline-none transition-colors",
655
- "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
656
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
657
- className
658
- ),
659
- children: [
660
- /* @__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" }) }) }),
661
- /* @__PURE__ */ jsxRuntime.jsx("span", { children })
662
- ]
663
- }
664
- );
665
- });
666
- React6__namespace.forwardRef(function MenuContextTrigger2(props, ref) {
667
- const { asChild: _asChild, ...rest } = props;
668
- return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, ...rest });
669
- });
670
- React6__namespace.forwardRef(function MenuTriggerItem2(props, ref) {
671
- const { startIcon, children, className, ...rest } = props;
672
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Sub, { children: /* @__PURE__ */ jsxRuntime.jsxs(
673
- DropdownMenu__namespace.SubTrigger,
465
+ return portalled ? /* @__PURE__ */ jsxRuntime.jsx(gui.Menu.Portal, { children: content }) : content;
466
+ };
467
+ var MenuItem = ({ children, value: _value, asChild, ...rest }) => (
468
+ // `asChild` means the caller brought its own element and owns the look. Its
469
+ // props are then forwarded to that element verbatim, so the skin must NOT be
470
+ // applied: `unstyled` and friends are not DOM attributes and React rejects
471
+ // them out loud ("Received `true` for a non-boolean attribute `unstyled`").
472
+ // Two shapes, said once, rather than one shape that is wrong in one of them.
473
+ asChild ? /* @__PURE__ */ jsxRuntime.jsx(gui.Menu.Item, { asChild: true, ...rest, children }) : /* @__PURE__ */ jsxRuntime.jsx(
474
+ gui.Menu.Item,
674
475
  {
675
- ref,
676
- className: cn(
677
- "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
678
- "outline-none transition-colors",
679
- "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
680
- className
681
- ),
476
+ unstyled: true,
477
+ ...ROW,
478
+ gap: 8,
479
+ paddingHorizontal: 8,
480
+ paddingVertical: 6,
481
+ disabledStyle: { opacity: 0.5, pointerEvents: "none" },
682
482
  ...rest,
683
- children: [
684
- startIcon,
685
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children }),
686
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
687
- ]
483
+ children: ink(children, void 0, { fontSize: 14, color: TEXT })
688
484
  }
689
- ) });
690
- });
485
+ )
486
+ );
487
+ var MenuSeparator = (props) => /* @__PURE__ */ jsxRuntime.jsx(
488
+ gui.Menu.Separator,
489
+ {
490
+ unstyled: true,
491
+ height: 1,
492
+ marginVertical: 4,
493
+ marginHorizontal: -4,
494
+ backgroundColor: "var(--color-border-divider)",
495
+ ...props
496
+ }
497
+ );
498
+ function cn(...inputs) {
499
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
500
+ }
691
501
  function initials(label) {
692
502
  return label.split(/[\s._-]+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2).toUpperCase();
693
503
  }
@@ -737,9 +547,9 @@ var Switcher = ({
737
547
  align = "start",
738
548
  testId
739
549
  }) => {
740
- const [open, setOpen] = React6__namespace.useState(false);
550
+ const [open, setOpen] = React3__namespace.useState(false);
741
551
  const narrow = useIsNarrow();
742
- const close = React6__namespace.useCallback(() => setOpen(false), []);
552
+ const close = React3__namespace.useCallback(() => setOpen(false), []);
743
553
  const message = status === "loading" ? "Loading\u2026" : status === "error" ? error ?? "Could not reach IAM." : status === "anonymous" ? null : items.length === 0 ? empty : null;
744
554
  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 : [];
745
555
  const panel = (menu) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -772,7 +582,7 @@ var Switcher = ({
772
582
  );
773
583
  if (narrow) {
774
584
  return /* @__PURE__ */ jsxRuntime.jsxs(DrawerRoot, { open, onOpenChange: (d) => setOpen(d.open), placement: "bottom", size: "md", children: [
775
- React6__namespace.cloneElement(trigger, { onClick: () => setOpen(true) }),
585
+ React3__namespace.cloneElement(trigger, { onClick: () => setOpen(true) }),
776
586
  /* @__PURE__ */ jsxRuntime.jsxs(DrawerContent, { "data-testid": testId ? `${testId}-panel` : void 0, children: [
777
587
  /* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: title }) }),
778
588
  /* @__PURE__ */ jsxRuntime.jsx(DrawerBody, { children: panel(false) })
@@ -888,7 +698,7 @@ var AppNav = ({
888
698
  }) => {
889
699
  const id = useIdentity();
890
700
  const narrow = useIsNarrow();
891
- const [menu, setMenu] = React6__namespace.useState(false);
701
+ const [menu, setMenu] = React3__namespace.useState(false);
892
702
  return /* @__PURE__ */ jsxRuntime.jsx(
893
703
  "header",
894
704
  {