@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/drawer.cjs CHANGED
@@ -2,10 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var gui = require('@hanzo/gui');
5
- var RadixDialog = require('@radix-ui/react-dialog');
6
5
  var React3 = require('react');
7
- var clsx = require('clsx');
8
- var tailwindMerge = require('tailwind-merge');
9
6
  var jsxRuntime = require('react/jsx-runtime');
10
7
 
11
8
  function _interopNamespace(e) {
@@ -26,26 +23,9 @@ function _interopNamespace(e) {
26
23
  return Object.freeze(n);
27
24
  }
28
25
 
29
- var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
30
26
  var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
31
27
 
32
28
  // src/drawer.tsx
33
- var NARROW_PX = 640;
34
- function useBelow(px) {
35
- const [below, setBelow] = React3__namespace.useState(false);
36
- React3__namespace.useEffect(() => {
37
- const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
38
- const apply = () => setBelow(mql.matches);
39
- apply();
40
- mql.addEventListener("change", apply);
41
- return () => mql.removeEventListener("change", apply);
42
- }, [px]);
43
- return below;
44
- }
45
- var useIsNarrow = () => useBelow(NARROW_PX);
46
- function cn(...inputs) {
47
- return tailwindMerge.twMerge(clsx.clsx(inputs));
48
- }
49
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";
50
30
  var CloseButtonFrame = gui.styled(gui.View, {
51
31
  name: "LuxCloseButton",
@@ -76,23 +56,19 @@ var CloseButtonFrame = gui.styled(gui.View, {
76
56
  }
77
57
  }
78
58
  });
79
- var CLOSE_BUTTON_CLASSES = [
80
- "text-[var(--closeButton-fg,currentColor)]",
81
- "hover:text-[var(--hover-color,currentColor)]",
82
- "disabled:opacity-40"
83
- ].join(" ");
84
59
  var CloseButton = React3__namespace.forwardRef(function CloseButton2(props, ref) {
85
60
  const { variant: _variant, size: _size, className, children, ...rest } = props;
86
61
  return /* @__PURE__ */ jsxRuntime.jsx(
87
62
  CloseButtonFrame,
88
63
  {
89
64
  ref,
90
- className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
65
+ className,
91
66
  ...rest,
92
67
  children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
93
68
  "svg",
94
69
  {
95
- className: "size-5",
70
+ width: 20,
71
+ height: 20,
96
72
  viewBox: "0 0 20 20",
97
73
  fill: "none",
98
74
  "aria-hidden": "true",
@@ -108,13 +84,35 @@ var CloseButton = React3__namespace.forwardRef(function CloseButton2(props, ref)
108
84
  }
109
85
  );
110
86
  });
87
+ var ink = (children, Wrap = gui.Text, props = {}) => {
88
+ let hasText = false;
89
+ React3.Children.forEach(children, (child) => {
90
+ if (typeof child === "string" || typeof child === "number") hasText = true;
91
+ });
92
+ if (!hasText) return children;
93
+ return React3.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React3.createElement(Wrap, props, child) : child);
94
+ };
95
+ var NARROW_PX = 640;
96
+ function useBelow(px) {
97
+ const [below, setBelow] = React3__namespace.useState(false);
98
+ React3__namespace.useEffect(() => {
99
+ const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
100
+ const apply = () => setBelow(mql.matches);
101
+ apply();
102
+ mql.addEventListener("change", apply);
103
+ return () => mql.removeEventListener("change", apply);
104
+ }, [px]);
105
+ return below;
106
+ }
107
+ var useIsNarrow = () => useBelow(NARROW_PX);
111
108
  var DrawerPlacementContext = React3__namespace.createContext("right");
112
109
  var DrawerSizeContext = React3__namespace.createContext("md");
113
110
  var DrawerStateContext = React3__namespace.createContext({
114
111
  open: false,
115
112
  setOpen: () => {
116
113
  },
117
- modal: true
114
+ modal: true,
115
+ narrow: false
118
116
  });
119
117
  var DrawerRoot = (props) => {
120
118
  const {
@@ -129,60 +127,40 @@ var DrawerRoot = (props) => {
129
127
  const [uncontrolled, setUncontrolled] = React3__namespace.useState(defaultOpen ?? false);
130
128
  const isControlled = open !== void 0;
131
129
  const isOpen = isControlled ? open : uncontrolled;
130
+ const narrow = useIsNarrow();
132
131
  const setOpen = React3__namespace.useCallback((nextOpen) => {
133
132
  if (!isControlled) setUncontrolled(nextOpen);
134
133
  onOpenChange?.({ open: nextOpen });
135
134
  }, [isControlled, onOpenChange]);
136
135
  const state = React3__namespace.useMemo(
137
- () => ({ open: isOpen, setOpen, modal }),
138
- [isOpen, setOpen, modal]
136
+ () => ({ open: isOpen, setOpen, modal, narrow }),
137
+ [isOpen, setOpen, modal, narrow]
139
138
  );
140
- 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(
141
- RadixDialog__namespace.Root,
142
- {
143
- open: isOpen,
144
- onOpenChange: setOpen,
145
- modal,
146
- children
147
- }
148
- ) }) }) });
139
+ 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 }) }) }) });
149
140
  };
150
- var PLACEMENT_CLASSES = {
151
- right: [
152
- "inset-y-0 right-0",
153
- "data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
154
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
155
- ].join(" "),
156
- left: [
157
- "inset-y-0 left-0",
158
- "data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
159
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
160
- ].join(" "),
161
- top: [
162
- "inset-x-0 top-0",
163
- "data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
164
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
165
- ].join(" "),
166
- bottom: [
167
- "inset-x-0 bottom-0",
168
- "data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
169
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
170
- ].join(" ")
141
+ var ANCHOR = {
142
+ right: { top: 0, bottom: 0, right: 0, enterStyle: { x: 24, opacity: 0 }, exitStyle: { x: 24, opacity: 0 } },
143
+ left: { top: 0, bottom: 0, left: 0, enterStyle: { x: -24, opacity: 0 }, exitStyle: { x: -24, opacity: 0 } },
144
+ top: { left: 0, right: 0, top: 0, enterStyle: { y: -24, opacity: 0 }, exitStyle: { y: -24, opacity: 0 } },
145
+ bottom: { left: 0, right: 0, bottom: 0, enterStyle: { y: 24, opacity: 0 }, exitStyle: { y: 24, opacity: 0 } }
171
146
  };
172
- var SIZE_CLASSES = {
173
- right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
174
- left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
175
- top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
176
- bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
147
+ var ACROSS = {
148
+ xs: 240,
149
+ sm: 320,
150
+ md: 384,
151
+ lg: 480,
152
+ xl: 640,
153
+ full: "100%"
177
154
  };
155
+ var extent = (placement, size) => placement === "left" || placement === "right" ? { width: ACROSS[size], maxWidth: "100%" } : { height: ACROSS[size], maxHeight: "100%" };
156
+ var SCRIM = "rgba(0,0,0,0.5)";
178
157
  var DrawerContent = React3__namespace.forwardRef(
179
158
  function DrawerContent2(props, ref) {
180
- const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
159
+ const { children, portalled = true, portalRef: _portalRef, offset: _offset, backdrop = true, ...rest } = props;
181
160
  const placement = React3__namespace.useContext(DrawerPlacementContext);
182
161
  const size = React3__namespace.useContext(DrawerSizeContext);
183
- const { open, setOpen, modal } = React3__namespace.useContext(DrawerStateContext);
184
- const isNarrow = useIsNarrow();
185
- if (isNarrow) {
162
+ const { open, setOpen, modal, narrow } = React3__namespace.useContext(DrawerStateContext);
163
+ if (narrow) {
186
164
  return /* @__PURE__ */ jsxRuntime.jsxs(
187
165
  gui.Sheet,
188
166
  {
@@ -200,7 +178,7 @@ var DrawerContent = React3__namespace.forwardRef(
200
178
  transition: "lazy",
201
179
  enterStyle: { opacity: 0 },
202
180
  exitStyle: { opacity: 0 },
203
- className: "bg-black/50"
181
+ backgroundColor: SCRIM
204
182
  }
205
183
  ),
206
184
  /* @__PURE__ */ jsxRuntime.jsx(gui.Sheet.Handle, {}),
@@ -208,10 +186,11 @@ var DrawerContent = React3__namespace.forwardRef(
208
186
  gui.Sheet.Frame,
209
187
  {
210
188
  unstyled: true,
211
- className: cn(
212
- "flex flex-col rounded-t-2xl bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)]",
213
- className
214
- ),
189
+ flexDirection: "column",
190
+ borderTopLeftRadius: 16,
191
+ borderTopRightRadius: 16,
192
+ backgroundColor: "var(--color-drawer-bg)",
193
+ shadowColor: "var(--shadow-drawer)",
215
194
  ...rest,
216
195
  children
217
196
  }
@@ -222,68 +201,62 @@ var DrawerContent = React3__namespace.forwardRef(
222
201
  }
223
202
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
224
203
  backdrop && /* @__PURE__ */ jsxRuntime.jsx(
225
- RadixDialog__namespace.Overlay,
204
+ gui.Dialog.Overlay,
226
205
  {
227
- className: cn(
228
- "fixed inset-0 z-50 bg-black/50",
229
- "data-[state=open]:animate-in data-[state=open]:fade-in-0",
230
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
231
- )
232
- }
206
+ position: "fixed",
207
+ top: 0,
208
+ right: 0,
209
+ bottom: 0,
210
+ left: 0,
211
+ zIndex: 50,
212
+ backgroundColor: SCRIM,
213
+ transition: "lazy",
214
+ enterStyle: { opacity: 0 },
215
+ exitStyle: { opacity: 0 }
216
+ },
217
+ "overlay"
233
218
  ),
234
219
  /* @__PURE__ */ jsxRuntime.jsx(
235
- RadixDialog__namespace.Content,
220
+ gui.Dialog.Content,
236
221
  {
237
222
  ref,
238
- className: cn(
239
- "fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
240
- PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
241
- SIZE_CLASSES[placement]?.[size] ?? SIZE_CLASSES.right?.md,
242
- className
243
- ),
223
+ unstyled: true,
224
+ position: "fixed",
225
+ zIndex: 50,
226
+ flexDirection: "column",
227
+ backgroundColor: "var(--color-drawer-bg)",
228
+ transition: "medium",
229
+ ...ANCHOR[placement],
230
+ ...extent(placement, size),
244
231
  ...rest,
245
232
  children
246
- }
233
+ },
234
+ "content"
247
235
  )
248
236
  ] });
249
- if (portalled) {
250
- return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container: portalRef?.current ?? void 0, children: content });
251
- }
252
- return content;
237
+ return portalled ? /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Portal, { children: content }) : content;
253
238
  }
254
239
  );
255
240
  var DrawerCloseTrigger = React3__namespace.forwardRef(function DrawerCloseTrigger2(props, ref) {
256
- return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
257
- CloseButton,
258
- {
259
- ref,
260
- className: cn("absolute top-7 right-5", props.className),
261
- ...props
262
- }
263
- ) });
241
+ return (
242
+ // Placement belongs to the surrounding box, not to the button: CloseButton
243
+ // is a fixed 20px control and has no opinion about where it sits.
244
+ /* @__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 }) }) })
245
+ );
264
246
  });
265
- var DrawerTrigger = (props) => {
266
- const { asChild = true, ...rest } = props;
267
- return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Trigger, { asChild, ...rest });
268
- };
269
- var DrawerHeader = React3__namespace.forwardRef(
270
- function DrawerHeader2({ className, ...props }, ref) {
271
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
247
+ var DrawerTrigger = ({ asChild = true, children, ...rest }) => {
248
+ const { setOpen, narrow } = React3__namespace.useContext(DrawerStateContext);
249
+ if (narrow) {
250
+ return React3__namespace.isValidElement(children) ? React3__namespace.cloneElement(children, { onClick: () => setOpen(true) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
272
251
  }
273
- );
274
- var DrawerBody = React3__namespace.forwardRef(
275
- function DrawerBody2({ className, ...props }, ref) {
276
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
277
- }
278
- );
279
- var DrawerFooter = React3__namespace.forwardRef(
280
- function DrawerFooter2({ className, ...props }, ref) {
281
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
282
- }
283
- );
284
- var DrawerTitle = RadixDialog__namespace.Title;
285
- var DrawerDescription = RadixDialog__namespace.Description;
286
- var DrawerActionTrigger = RadixDialog__namespace.Close;
252
+ return /* @__PURE__ */ jsxRuntime.jsx(gui.Dialog.Trigger, { asChild, ...rest, children });
253
+ };
254
+ var DrawerHeader = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: 6, padding: 24, paddingBottom: 0, ...props, children: ink(children) });
255
+ var DrawerBody = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { flex: 1, overflow: "scroll", padding: 24, ...props, children: ink(children) });
256
+ var DrawerFooter = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { alignItems: "center", justifyContent: "flex-end", gap: 8, padding: 24, paddingTop: 0, ...props, children: ink(children) });
257
+ var DrawerTitle = gui.Dialog.Title;
258
+ var DrawerDescription = gui.Dialog.Description;
259
+ var DrawerActionTrigger = gui.Dialog.Close;
287
260
 
288
261
  exports.DrawerActionTrigger = DrawerActionTrigger;
289
262
  exports.DrawerBody = DrawerBody;
package/dist/drawer.d.cts CHANGED
@@ -1,5 +1,8 @@
1
+ import * as _hanzogui_core from '@hanzogui/core';
2
+ import * as _hanzo_gui from '@hanzo/gui';
3
+ import { Dialog, YStack, XStack } from '@hanzo/gui';
4
+ import * as _hanzogui_web from '@hanzogui/web';
1
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as RadixDialog from '@radix-ui/react-dialog';
3
6
  import * as React from 'react';
4
7
 
5
8
  interface DrawerRootProps {
@@ -9,13 +12,15 @@ interface DrawerRootProps {
9
12
  onOpenChange?: (details: {
10
13
  open: boolean;
11
14
  }) => void;
12
- placement?: 'left' | 'right' | 'top' | 'bottom';
15
+ placement?: Placement;
13
16
  initialFocusEl?: (() => HTMLElement | null) | React.RefObject<HTMLElement>;
14
17
  lazyMount?: boolean;
15
18
  unmountOnExit?: boolean;
16
19
  modal?: boolean;
17
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
20
+ size?: Size;
18
21
  }
22
+ type Placement = 'left' | 'right' | 'top' | 'bottom';
23
+ type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
19
24
  declare const DrawerRoot: (props: DrawerRootProps) => react_jsx_runtime.JSX.Element;
20
25
  interface DrawerContentProps extends React.ComponentPropsWithoutRef<'div'> {
21
26
  portalled?: boolean;
@@ -25,12 +30,40 @@ interface DrawerContentProps extends React.ComponentPropsWithoutRef<'div'> {
25
30
  }
26
31
  declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
27
32
  declare const DrawerCloseTrigger: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
28
- declare const DrawerTrigger: (props: React.ComponentPropsWithoutRef<typeof RadixDialog.Trigger>) => react_jsx_runtime.JSX.Element;
29
- declare const DrawerHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
- declare const DrawerBody: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
- declare const DrawerFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
32
- declare const DrawerTitle: React.ForwardRefExoticComponent<RadixDialog.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
33
- declare const DrawerDescription: React.ForwardRefExoticComponent<RadixDialog.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
34
- declare const DrawerActionTrigger: React.ForwardRefExoticComponent<RadixDialog.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
33
+ declare const DrawerTrigger: ({ asChild, children, ...rest }: React.ComponentProps<typeof Dialog.Trigger>) => react_jsx_runtime.JSX.Element;
34
+ declare const DrawerHeader: ({ children, ...props }: React.ComponentProps<typeof YStack>) => react_jsx_runtime.JSX.Element;
35
+ declare const DrawerBody: ({ children, ...props }: React.ComponentProps<typeof YStack>) => react_jsx_runtime.JSX.Element;
36
+ declare const DrawerFooter: ({ children, ...props }: React.ComponentProps<typeof XStack>) => react_jsx_runtime.JSX.Element;
37
+ declare const DrawerTitle: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_web.TextNonStyleProps, _hanzogui_web.TextStylePropsBase, {
38
+ unstyled?: boolean | undefined;
39
+ size?: _hanzogui_web.FontSizeTokens | undefined;
40
+ }>, "scope"> & {
41
+ scope?: _hanzo_gui.DialogScopes;
42
+ }, _hanzogui_web.GuiTextElement, _hanzogui_web.TextNonStyleProps & {
43
+ scope?: _hanzo_gui.DialogScopes;
44
+ }, _hanzogui_web.TextStylePropsBase, {
45
+ unstyled?: boolean | undefined;
46
+ size?: _hanzogui_web.FontSizeTokens | undefined;
47
+ }, _hanzogui_web.StaticConfigPublic>;
48
+ declare const DrawerDescription: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_web.TextNonStyleProps, _hanzogui_web.TextStylePropsBase, {
49
+ unstyled?: boolean | undefined;
50
+ size?: _hanzogui_web.FontSizeTokens | undefined;
51
+ }>, "scope"> & {
52
+ scope?: _hanzo_gui.DialogScopes;
53
+ }, _hanzogui_web.GuiTextElement, _hanzogui_web.TextNonStyleProps & {
54
+ scope?: _hanzo_gui.DialogScopes;
55
+ }, _hanzogui_web.TextStylePropsBase, {
56
+ unstyled?: boolean | undefined;
57
+ size?: _hanzogui_web.FontSizeTokens | undefined;
58
+ }, _hanzogui_web.StaticConfigPublic>;
59
+ declare const DrawerActionTrigger: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_core.RNViewNonStyleProps, _hanzogui_web.StackStyleBase, {}>, "scope" | "displayWhenAdapted"> & {
60
+ displayWhenAdapted?: boolean;
61
+ } & {
62
+ scope?: _hanzo_gui.DialogScopes;
63
+ }, _hanzogui_web.GuiElement, _hanzogui_core.RNViewNonStyleProps & {
64
+ displayWhenAdapted?: boolean;
65
+ } & {
66
+ scope?: _hanzo_gui.DialogScopes;
67
+ }, _hanzogui_web.StackStyleBase, {}, _hanzogui_web.StaticConfigPublic>;
35
68
 
36
69
  export { DrawerActionTrigger, DrawerBody, DrawerCloseTrigger, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerRoot, type DrawerRootProps, DrawerTitle, DrawerTrigger };
package/dist/drawer.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import * as _hanzogui_core from '@hanzogui/core';
2
+ import * as _hanzo_gui from '@hanzo/gui';
3
+ import { Dialog, YStack, XStack } from '@hanzo/gui';
4
+ import * as _hanzogui_web from '@hanzogui/web';
1
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as RadixDialog from '@radix-ui/react-dialog';
3
6
  import * as React from 'react';
4
7
 
5
8
  interface DrawerRootProps {
@@ -9,13 +12,15 @@ interface DrawerRootProps {
9
12
  onOpenChange?: (details: {
10
13
  open: boolean;
11
14
  }) => void;
12
- placement?: 'left' | 'right' | 'top' | 'bottom';
15
+ placement?: Placement;
13
16
  initialFocusEl?: (() => HTMLElement | null) | React.RefObject<HTMLElement>;
14
17
  lazyMount?: boolean;
15
18
  unmountOnExit?: boolean;
16
19
  modal?: boolean;
17
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
20
+ size?: Size;
18
21
  }
22
+ type Placement = 'left' | 'right' | 'top' | 'bottom';
23
+ type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
19
24
  declare const DrawerRoot: (props: DrawerRootProps) => react_jsx_runtime.JSX.Element;
20
25
  interface DrawerContentProps extends React.ComponentPropsWithoutRef<'div'> {
21
26
  portalled?: boolean;
@@ -25,12 +30,40 @@ interface DrawerContentProps extends React.ComponentPropsWithoutRef<'div'> {
25
30
  }
26
31
  declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
27
32
  declare const DrawerCloseTrigger: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
28
- declare const DrawerTrigger: (props: React.ComponentPropsWithoutRef<typeof RadixDialog.Trigger>) => react_jsx_runtime.JSX.Element;
29
- declare const DrawerHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
- declare const DrawerBody: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
- declare const DrawerFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
32
- declare const DrawerTitle: React.ForwardRefExoticComponent<RadixDialog.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
33
- declare const DrawerDescription: React.ForwardRefExoticComponent<RadixDialog.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
34
- declare const DrawerActionTrigger: React.ForwardRefExoticComponent<RadixDialog.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
33
+ declare const DrawerTrigger: ({ asChild, children, ...rest }: React.ComponentProps<typeof Dialog.Trigger>) => react_jsx_runtime.JSX.Element;
34
+ declare const DrawerHeader: ({ children, ...props }: React.ComponentProps<typeof YStack>) => react_jsx_runtime.JSX.Element;
35
+ declare const DrawerBody: ({ children, ...props }: React.ComponentProps<typeof YStack>) => react_jsx_runtime.JSX.Element;
36
+ declare const DrawerFooter: ({ children, ...props }: React.ComponentProps<typeof XStack>) => react_jsx_runtime.JSX.Element;
37
+ declare const DrawerTitle: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_web.TextNonStyleProps, _hanzogui_web.TextStylePropsBase, {
38
+ unstyled?: boolean | undefined;
39
+ size?: _hanzogui_web.FontSizeTokens | undefined;
40
+ }>, "scope"> & {
41
+ scope?: _hanzo_gui.DialogScopes;
42
+ }, _hanzogui_web.GuiTextElement, _hanzogui_web.TextNonStyleProps & {
43
+ scope?: _hanzo_gui.DialogScopes;
44
+ }, _hanzogui_web.TextStylePropsBase, {
45
+ unstyled?: boolean | undefined;
46
+ size?: _hanzogui_web.FontSizeTokens | undefined;
47
+ }, _hanzogui_web.StaticConfigPublic>;
48
+ declare const DrawerDescription: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_web.TextNonStyleProps, _hanzogui_web.TextStylePropsBase, {
49
+ unstyled?: boolean | undefined;
50
+ size?: _hanzogui_web.FontSizeTokens | undefined;
51
+ }>, "scope"> & {
52
+ scope?: _hanzo_gui.DialogScopes;
53
+ }, _hanzogui_web.GuiTextElement, _hanzogui_web.TextNonStyleProps & {
54
+ scope?: _hanzo_gui.DialogScopes;
55
+ }, _hanzogui_web.TextStylePropsBase, {
56
+ unstyled?: boolean | undefined;
57
+ size?: _hanzogui_web.FontSizeTokens | undefined;
58
+ }, _hanzogui_web.StaticConfigPublic>;
59
+ declare const DrawerActionTrigger: _hanzogui_web.GuiComponent<Omit<_hanzogui_web.GetFinalProps<_hanzogui_core.RNViewNonStyleProps, _hanzogui_web.StackStyleBase, {}>, "scope" | "displayWhenAdapted"> & {
60
+ displayWhenAdapted?: boolean;
61
+ } & {
62
+ scope?: _hanzo_gui.DialogScopes;
63
+ }, _hanzogui_web.GuiElement, _hanzogui_core.RNViewNonStyleProps & {
64
+ displayWhenAdapted?: boolean;
65
+ } & {
66
+ scope?: _hanzo_gui.DialogScopes;
67
+ }, _hanzogui_web.StackStyleBase, {}, _hanzogui_web.StaticConfigPublic>;
35
68
 
36
69
  export { DrawerActionTrigger, DrawerBody, DrawerCloseTrigger, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerRoot, type DrawerRootProps, DrawerTitle, DrawerTrigger };