@luxfi/ui 6.1.3 → 7.1.0

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 (241) hide show
  1. package/dist/accordion.cjs +213 -0
  2. package/dist/accordion.d.cts +74 -0
  3. package/dist/accordion.d.ts +74 -0
  4. package/dist/accordion.js +186 -0
  5. package/dist/alert.cjs +430 -0
  6. package/dist/alert.d.cts +30 -0
  7. package/dist/alert.d.ts +30 -0
  8. package/dist/alert.js +408 -0
  9. package/dist/avatar.cjs +149 -0
  10. package/dist/avatar.d.cts +25 -0
  11. package/dist/avatar.d.ts +25 -0
  12. package/dist/avatar.js +125 -0
  13. package/dist/badge.cjs +452 -0
  14. package/dist/badge.d.cts +19 -0
  15. package/dist/badge.d.ts +19 -0
  16. package/dist/badge.js +431 -0
  17. package/dist/bank.cjs +272 -0
  18. package/dist/bank.d.cts +76 -0
  19. package/dist/bank.d.ts +76 -0
  20. package/dist/bank.js +258 -0
  21. package/dist/button.cjs +578 -0
  22. package/dist/button.d.cts +55 -0
  23. package/dist/button.d.ts +55 -0
  24. package/dist/button.js +553 -0
  25. package/dist/checkbox.cjs +265 -0
  26. package/dist/checkbox.d.cts +31 -0
  27. package/dist/checkbox.d.ts +31 -0
  28. package/dist/checkbox.js +241 -0
  29. package/dist/close-button.cjs +92 -0
  30. package/dist/close-button.d.cts +9 -0
  31. package/dist/close-button.d.ts +9 -0
  32. package/dist/close-button.js +70 -0
  33. package/dist/collapsible.cjs +555 -0
  34. package/dist/collapsible.d.cts +23 -0
  35. package/dist/collapsible.d.ts +23 -0
  36. package/dist/collapsible.js +532 -0
  37. package/dist/color-mode.cjs +96 -0
  38. package/dist/color-mode.d.cts +25 -0
  39. package/dist/color-mode.d.ts +25 -0
  40. package/dist/color-mode.js +72 -0
  41. package/dist/dialog.cjs +295 -0
  42. package/dist/dialog.d.cts +65 -0
  43. package/dist/dialog.d.ts +65 -0
  44. package/dist/dialog.js +263 -0
  45. package/dist/drawer.cjs +231 -0
  46. package/dist/drawer.d.cts +36 -0
  47. package/dist/drawer.d.ts +36 -0
  48. package/dist/drawer.js +199 -0
  49. package/dist/empty-state.cjs +93 -0
  50. package/dist/empty-state.d.cts +13 -0
  51. package/dist/empty-state.d.ts +13 -0
  52. package/dist/empty-state.js +71 -0
  53. package/dist/expiration-selector.cjs +138 -0
  54. package/dist/expiration-selector.d.cts +16 -0
  55. package/dist/expiration-selector.d.ts +16 -0
  56. package/dist/expiration-selector.js +116 -0
  57. package/dist/field.cjs +183 -0
  58. package/dist/field.d.cts +24 -0
  59. package/dist/field.d.ts +24 -0
  60. package/dist/field.js +160 -0
  61. package/dist/greeks-display.cjs +114 -0
  62. package/dist/greeks-display.d.cts +14 -0
  63. package/dist/greeks-display.d.ts +14 -0
  64. package/dist/greeks-display.js +92 -0
  65. package/dist/heading.cjs +41 -0
  66. package/dist/heading.d.cts +10 -0
  67. package/dist/heading.d.ts +10 -0
  68. package/dist/heading.js +35 -0
  69. package/dist/icon-button.cjs +367 -0
  70. package/dist/icon-button.d.cts +33 -0
  71. package/dist/icon-button.d.ts +33 -0
  72. package/dist/icon-button.js +345 -0
  73. package/dist/image.cjs +425 -0
  74. package/dist/image.d.cts +57 -0
  75. package/dist/image.d.ts +57 -0
  76. package/dist/image.js +404 -0
  77. package/dist/index.cjs +7220 -0
  78. package/dist/index.d.cts +55 -0
  79. package/dist/index.d.ts +55 -0
  80. package/dist/index.js +7043 -0
  81. package/dist/input-group.cjs +155 -0
  82. package/dist/input-group.d.cts +17 -0
  83. package/dist/input-group.d.ts +17 -0
  84. package/dist/input-group.js +133 -0
  85. package/dist/input.cjs +65 -0
  86. package/dist/input.d.cts +11 -0
  87. package/dist/input.d.ts +11 -0
  88. package/dist/input.js +59 -0
  89. package/dist/link.cjs +483 -0
  90. package/dist/link.d.cts +37 -0
  91. package/dist/link.d.ts +37 -0
  92. package/dist/link.js +459 -0
  93. package/dist/menu.cjs +305 -0
  94. package/dist/menu.d.cts +84 -0
  95. package/dist/menu.d.ts +84 -0
  96. package/dist/menu.js +269 -0
  97. package/dist/option-chain.cjs +221 -0
  98. package/dist/option-chain.d.cts +37 -0
  99. package/dist/option-chain.d.ts +37 -0
  100. package/dist/option-chain.js +199 -0
  101. package/dist/option-position.cjs +164 -0
  102. package/dist/option-position.d.cts +29 -0
  103. package/dist/option-position.d.ts +29 -0
  104. package/dist/option-position.js +142 -0
  105. package/dist/pin-input.cjs +182 -0
  106. package/dist/pin-input.d.cts +25 -0
  107. package/dist/pin-input.d.ts +25 -0
  108. package/dist/pin-input.js +160 -0
  109. package/dist/pnl-diagram.cjs +453 -0
  110. package/dist/pnl-diagram.d.cts +11 -0
  111. package/dist/pnl-diagram.d.ts +11 -0
  112. package/dist/pnl-diagram.js +431 -0
  113. package/dist/popover.cjs +342 -0
  114. package/dist/popover.d.cts +73 -0
  115. package/dist/popover.d.ts +73 -0
  116. package/dist/popover.js +310 -0
  117. package/dist/progress-circle.cjs +152 -0
  118. package/dist/progress-circle.d.cts +47 -0
  119. package/dist/progress-circle.d.ts +47 -0
  120. package/dist/progress-circle.js +128 -0
  121. package/dist/progress.cjs +117 -0
  122. package/dist/progress.d.cts +28 -0
  123. package/dist/progress.d.ts +28 -0
  124. package/dist/progress.js +94 -0
  125. package/dist/provider.cjs +62 -0
  126. package/dist/provider.d.cts +7 -0
  127. package/dist/provider.d.ts +7 -0
  128. package/dist/provider.js +40 -0
  129. package/dist/radio.cjs +177 -0
  130. package/dist/radio.d.cts +53 -0
  131. package/dist/radio.d.ts +53 -0
  132. package/dist/radio.js +153 -0
  133. package/dist/rating.cjs +80 -0
  134. package/dist/rating.d.cts +14 -0
  135. package/dist/rating.d.ts +14 -0
  136. package/dist/rating.js +58 -0
  137. package/dist/select.cjs +644 -0
  138. package/dist/select.d.cts +130 -0
  139. package/dist/select.d.ts +130 -0
  140. package/dist/select.js +610 -0
  141. package/dist/separator.cjs +57 -0
  142. package/dist/separator.d.cts +13 -0
  143. package/dist/separator.d.ts +13 -0
  144. package/dist/separator.js +51 -0
  145. package/dist/skeleton.cjs +223 -0
  146. package/dist/skeleton.d.cts +60 -0
  147. package/dist/skeleton.d.ts +60 -0
  148. package/dist/skeleton.js +199 -0
  149. package/dist/slider.cjs +138 -0
  150. package/dist/slider.d.cts +24 -0
  151. package/dist/slider.d.ts +24 -0
  152. package/dist/slider.js +115 -0
  153. package/dist/strategy-builder.cjs +373 -0
  154. package/dist/strategy-builder.d.cts +26 -0
  155. package/dist/strategy-builder.d.ts +26 -0
  156. package/dist/strategy-builder.js +351 -0
  157. package/dist/switch.cjs +163 -0
  158. package/dist/switch.d.cts +27 -0
  159. package/dist/switch.d.ts +27 -0
  160. package/dist/switch.js +140 -0
  161. package/dist/table.cjs +897 -0
  162. package/dist/table.d.cts +107 -0
  163. package/dist/table.d.ts +107 -0
  164. package/dist/table.js +866 -0
  165. package/dist/tabs.cjs +240 -0
  166. package/dist/tabs.d.cts +78 -0
  167. package/dist/tabs.d.ts +78 -0
  168. package/dist/tabs.js +213 -0
  169. package/dist/tag.cjs +529 -0
  170. package/dist/tag.d.cts +21 -0
  171. package/dist/tag.d.ts +21 -0
  172. package/dist/tag.js +507 -0
  173. package/dist/textarea.cjs +65 -0
  174. package/dist/textarea.d.cts +11 -0
  175. package/dist/textarea.d.ts +11 -0
  176. package/dist/textarea.js +59 -0
  177. package/dist/toaster.cjs +99 -0
  178. package/dist/toaster.d.cts +29 -0
  179. package/dist/toaster.d.ts +29 -0
  180. package/dist/toaster.js +96 -0
  181. package/dist/tooltip.cjs +172 -0
  182. package/dist/tooltip.d.cts +38 -0
  183. package/dist/tooltip.d.ts +38 -0
  184. package/dist/tooltip.js +150 -0
  185. package/dist/utils.cjs +11 -0
  186. package/dist/utils.d.cts +5 -0
  187. package/dist/utils.d.ts +5 -0
  188. package/dist/utils.js +9 -0
  189. package/package.json +284 -89
  190. package/src/accordion.tsx +285 -0
  191. package/src/alert.tsx +221 -0
  192. package/src/avatar.tsx +174 -0
  193. package/src/badge.tsx +147 -0
  194. package/src/bank.tsx +325 -0
  195. package/src/button.tsx +477 -0
  196. package/src/checkbox.tsx +307 -0
  197. package/src/close-button.tsx +77 -0
  198. package/src/collapsible.tsx +126 -0
  199. package/src/color-mode.tsx +125 -0
  200. package/src/dialog.tsx +346 -0
  201. package/src/drawer.tsx +186 -0
  202. package/src/empty-state.tsx +97 -0
  203. package/src/expiration-selector.tsx +163 -0
  204. package/src/field.tsx +202 -0
  205. package/src/greeks-display.tsx +138 -0
  206. package/src/heading.tsx +44 -0
  207. package/src/icon-button.tsx +217 -0
  208. package/src/image.tsx +280 -0
  209. package/src/index.ts +267 -138
  210. package/src/input-group.tsx +159 -0
  211. package/src/input.tsx +60 -0
  212. package/src/link.tsx +326 -0
  213. package/src/menu.tsx +471 -0
  214. package/src/option-chain.tsx +261 -0
  215. package/src/option-position.tsx +200 -0
  216. package/src/pin-input.tsx +187 -0
  217. package/src/pnl-diagram.tsx +458 -0
  218. package/src/popover.tsx +386 -0
  219. package/src/progress-circle.tsx +180 -0
  220. package/src/progress.tsx +109 -0
  221. package/src/provider.tsx +12 -0
  222. package/src/radio.tsx +175 -0
  223. package/src/rating.tsx +79 -0
  224. package/src/select.tsx +696 -0
  225. package/src/separator.tsx +59 -0
  226. package/src/skeleton.tsx +254 -0
  227. package/src/slider.tsx +152 -0
  228. package/src/strategy-builder.tsx +466 -0
  229. package/src/switch.tsx +158 -0
  230. package/src/table.tsx +621 -0
  231. package/src/tabs.tsx +354 -0
  232. package/src/tag.tsx +159 -0
  233. package/src/textarea.tsx +60 -0
  234. package/src/toaster.tsx +117 -0
  235. package/src/tokens.css +438 -0
  236. package/src/tooltip.tsx +191 -0
  237. package/src/utils/cn.ts +7 -0
  238. package/src/utils.ts +6 -0
  239. package/tokens.css +438 -0
  240. package/LICENSE +0 -122
  241. package/README.md +0 -109
package/dist/dialog.js ADDED
@@ -0,0 +1,263 @@
1
+ "use client";
2
+ import { Dialog } from '@hanzogui/dialog';
3
+ import * as React2 from 'react';
4
+ import { clsx } from 'clsx';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { styled, View } from '@hanzogui/core';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
+
9
+ // src/dialog.tsx
10
+ function cn(...inputs) {
11
+ return twMerge(clsx(inputs));
12
+ }
13
+ 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";
14
+ var CloseButtonFrame = styled(View, {
15
+ name: "LuxCloseButton",
16
+ render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
17
+ role: "button",
18
+ cursor: "pointer",
19
+ display: "inline-flex",
20
+ alignItems: "center",
21
+ justifyContent: "center",
22
+ width: 20,
23
+ height: 20,
24
+ minWidth: 0,
25
+ flexShrink: 1,
26
+ padding: 0,
27
+ borderRadius: 4,
28
+ borderWidth: 0,
29
+ overflow: "hidden",
30
+ backgroundColor: "transparent",
31
+ hoverStyle: {
32
+ backgroundColor: "transparent"
33
+ },
34
+ variants: {
35
+ disabled: {
36
+ true: {
37
+ opacity: 0.4,
38
+ pointerEvents: "none"
39
+ }
40
+ }
41
+ }
42
+ });
43
+ var CLOSE_BUTTON_CLASSES = [
44
+ "text-[var(--closeButton-fg,currentColor)]",
45
+ "hover:text-[var(--hover-color,currentColor)]",
46
+ "disabled:opacity-40"
47
+ ].join(" ");
48
+ var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
49
+ const { variant: _variant, size: _size, className, children, ...rest } = props;
50
+ return /* @__PURE__ */ jsx(
51
+ CloseButtonFrame,
52
+ {
53
+ ref,
54
+ className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
55
+ ...rest,
56
+ children: children ?? /* @__PURE__ */ jsx(
57
+ "svg",
58
+ {
59
+ className: "size-5",
60
+ viewBox: "0 0 20 20",
61
+ fill: "none",
62
+ "aria-hidden": "true",
63
+ children: /* @__PURE__ */ jsx(
64
+ "path",
65
+ {
66
+ d: CLOSE_ICON_PATH,
67
+ fill: "currentColor"
68
+ }
69
+ )
70
+ }
71
+ )
72
+ }
73
+ );
74
+ });
75
+ function BackToButton({ onClick }) {
76
+ return /* @__PURE__ */ jsx(
77
+ "button",
78
+ {
79
+ type: "button",
80
+ onClick,
81
+ className: "inline-flex items-center justify-center size-8 rounded-md bg-transparent text-current hover:bg-[var(--color-button-subtle-bg)] cursor-pointer",
82
+ "aria-label": "Go back",
83
+ children: /* @__PURE__ */ jsx("svg", { className: "size-5", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M12.5 15L7.5 10L12.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
84
+ }
85
+ );
86
+ }
87
+ var DialogSizeContext = React2.createContext({ size: "md" });
88
+ function useDialogSizeContext() {
89
+ return React2.useContext(DialogSizeContext);
90
+ }
91
+ var CONTENT_SIZE_MAP = {
92
+ sm: "max-w-[400px]",
93
+ md: "max-w-[728px]",
94
+ full: "max-w-[100vw] min-h-dvh rounded-none [--dialog-margin:0]",
95
+ cover: "w-full h-full [--dialog-margin:0]"
96
+ };
97
+ function sizeClasses(size) {
98
+ if (typeof size === "string") {
99
+ return CONTENT_SIZE_MAP[size];
100
+ }
101
+ const parts = [];
102
+ const small = size.base ?? size.lgDown;
103
+ if (small) {
104
+ parts.push(CONTENT_SIZE_MAP[small]);
105
+ }
106
+ if (size.lg) {
107
+ const lgClasses = CONTENT_SIZE_MAP[size.lg].split(" ").map((c) => `lg:${c}`).join(" ");
108
+ parts.push(lgClasses);
109
+ }
110
+ return parts.join(" ");
111
+ }
112
+ var DialogRoot = ({
113
+ children,
114
+ open,
115
+ defaultOpen,
116
+ onOpenChange,
117
+ size = "md",
118
+ modal = true
119
+ // motionPreset is intentionally unused -- kept for API compat
120
+ }) => {
121
+ const handleOpenChange = React2.useCallback(
122
+ (nextOpen) => {
123
+ onOpenChange?.({ open: nextOpen });
124
+ },
125
+ [onOpenChange]
126
+ );
127
+ const ctx = React2.useMemo(() => ({ size }), [size]);
128
+ return /* @__PURE__ */ jsx(DialogSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
129
+ Dialog,
130
+ {
131
+ open,
132
+ defaultOpen,
133
+ onOpenChange: handleOpenChange,
134
+ modal,
135
+ children
136
+ }
137
+ ) });
138
+ };
139
+ var DialogContent = React2.forwardRef(function DialogContent2(props, ref) {
140
+ const {
141
+ children,
142
+ portalled: _portalled = true,
143
+ portalRef: _portalRef,
144
+ backdrop = true,
145
+ className,
146
+ paddingTop: _paddingTop,
147
+ style: styleProp,
148
+ ...rest
149
+ } = props;
150
+ const contentInlineStyle = {
151
+ ...styleProp,
152
+ ..._paddingTop !== void 0 ? { paddingTop: typeof _paddingTop === "number" ? `${_paddingTop * 4}px` : _paddingTop } : {}
153
+ };
154
+ const { size } = useDialogSizeContext();
155
+ return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
156
+ backdrop && /* @__PURE__ */ jsx(
157
+ Dialog.Overlay,
158
+ {
159
+ unstyled: true,
160
+ className: "fixed inset-0 z-[1400] bg-black/80"
161
+ }
162
+ ),
163
+ /* @__PURE__ */ jsx(
164
+ "div",
165
+ {
166
+ className: cn(
167
+ "fixed inset-0 z-[1400] flex w-screen h-dvh",
168
+ "items-start lg:items-center justify-center",
169
+ "overflow-hidden"
170
+ ),
171
+ children: /* @__PURE__ */ jsx(
172
+ Dialog.Content,
173
+ {
174
+ ref,
175
+ unstyled: true,
176
+ className: cn(
177
+ // Base content styles
178
+ "relative flex flex-col w-full p-6 outline-none text-base",
179
+ "bg-dialog-bg text-dialog-fg shadow-lg rounded-xl",
180
+ "my-[var(--dialog-margin,var(--dialog-base-margin))]",
181
+ "mx-auto [--dialog-base-margin:4rem] lg:[--dialog-base-margin:auto]",
182
+ "max-h-[calc(100%-7.5rem)] overflow-hidden",
183
+ // Size variant
184
+ sizeClasses(size),
185
+ className
186
+ ),
187
+ style: Object.keys(contentInlineStyle).length > 0 ? contentInlineStyle : void 0,
188
+ ...rest,
189
+ children
190
+ }
191
+ )
192
+ }
193
+ )
194
+ ] });
195
+ });
196
+ var DialogCloseTrigger = React2.forwardRef(function DialogCloseTrigger2(props, ref) {
197
+ const { className, ...rest } = props;
198
+ return /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
199
+ });
200
+ var DialogHeader = React2.forwardRef(function DialogHeader2(props, ref) {
201
+ const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
202
+ const startElement = startElementProp ?? (onBackToClick ? /* @__PURE__ */ jsx(BackToButton, { onClick: onBackToClick }) : void 0);
203
+ return /* @__PURE__ */ jsxs(
204
+ "div",
205
+ {
206
+ ref,
207
+ className: cn(
208
+ "flex-none p-0 mb-2 flex items-center gap-x-2 min-h-[40px]",
209
+ className
210
+ ),
211
+ ...rest,
212
+ children: [
213
+ startElement,
214
+ /* @__PURE__ */ jsx(
215
+ Dialog.Title,
216
+ {
217
+ unstyled: true,
218
+ className: cn(
219
+ "text-base lg:text-lg font-medium",
220
+ "whitespace-nowrap overflow-hidden text-ellipsis"
221
+ ),
222
+ children
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsx(DialogCloseTrigger, { className: "ml-auto" })
226
+ ]
227
+ }
228
+ );
229
+ });
230
+ var DialogBody = React2.forwardRef(function DialogBody2({ className, pt, display, flexDir, style: styleProp, ...props }, ref) {
231
+ const bodyStyle = {
232
+ ...styleProp,
233
+ ...pt !== void 0 ? { paddingTop: typeof pt === "number" ? `${pt * 4}px` : pt } : {},
234
+ ...display ? { display } : {},
235
+ ...flexDir ? { flexDirection: flexDir } : {}
236
+ };
237
+ return /* @__PURE__ */ jsx(
238
+ "div",
239
+ {
240
+ ref,
241
+ className: cn("flex-1 p-0 overflow-auto", className),
242
+ style: Object.keys(bodyStyle).length > 0 ? bodyStyle : void 0,
243
+ ...props
244
+ }
245
+ );
246
+ });
247
+ var DialogFooter = React2.forwardRef(function DialogFooter2({ className, ...props }, ref) {
248
+ return /* @__PURE__ */ jsx(
249
+ "div",
250
+ {
251
+ ref,
252
+ className: cn("flex items-center justify-start gap-6 p-0 mt-6", className),
253
+ ...props
254
+ }
255
+ );
256
+ });
257
+ var DialogBackdrop = Dialog.Overlay;
258
+ var DialogTitle = Dialog.Title;
259
+ var DialogDescription = Dialog.Description;
260
+ var DialogTrigger = Dialog.Trigger;
261
+ var DialogActionTrigger = Dialog.Close;
262
+
263
+ export { DialogActionTrigger, DialogBackdrop, DialogBody, DialogCloseTrigger, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger };
@@ -0,0 +1,231 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var RadixDialog = require('@radix-ui/react-dialog');
5
+ var React2 = require('react');
6
+ var clsx = require('clsx');
7
+ var tailwindMerge = require('tailwind-merge');
8
+ var core = require('@hanzogui/core');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
30
+ var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
31
+
32
+ // src/drawer.tsx
33
+ function cn(...inputs) {
34
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
35
+ }
36
+ 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";
37
+ var CloseButtonFrame = core.styled(core.View, {
38
+ name: "LuxCloseButton",
39
+ render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Close" }),
40
+ role: "button",
41
+ cursor: "pointer",
42
+ display: "inline-flex",
43
+ alignItems: "center",
44
+ justifyContent: "center",
45
+ width: 20,
46
+ height: 20,
47
+ minWidth: 0,
48
+ flexShrink: 1,
49
+ padding: 0,
50
+ borderRadius: 4,
51
+ borderWidth: 0,
52
+ overflow: "hidden",
53
+ backgroundColor: "transparent",
54
+ hoverStyle: {
55
+ backgroundColor: "transparent"
56
+ },
57
+ variants: {
58
+ disabled: {
59
+ true: {
60
+ opacity: 0.4,
61
+ pointerEvents: "none"
62
+ }
63
+ }
64
+ }
65
+ });
66
+ var CLOSE_BUTTON_CLASSES = [
67
+ "text-[var(--closeButton-fg,currentColor)]",
68
+ "hover:text-[var(--hover-color,currentColor)]",
69
+ "disabled:opacity-40"
70
+ ].join(" ");
71
+ var CloseButton = React2__namespace.forwardRef(function CloseButton2(props, ref) {
72
+ const { variant: _variant, size: _size, className, children, ...rest } = props;
73
+ return /* @__PURE__ */ jsxRuntime.jsx(
74
+ CloseButtonFrame,
75
+ {
76
+ ref,
77
+ className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
78
+ ...rest,
79
+ children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
80
+ "svg",
81
+ {
82
+ className: "size-5",
83
+ viewBox: "0 0 20 20",
84
+ fill: "none",
85
+ "aria-hidden": "true",
86
+ children: /* @__PURE__ */ jsxRuntime.jsx(
87
+ "path",
88
+ {
89
+ d: CLOSE_ICON_PATH,
90
+ fill: "currentColor"
91
+ }
92
+ )
93
+ }
94
+ )
95
+ }
96
+ );
97
+ });
98
+ var DrawerPlacementContext = React2__namespace.createContext("right");
99
+ var DrawerSizeContext = React2__namespace.createContext("md");
100
+ var DrawerRoot = (props) => {
101
+ const {
102
+ children,
103
+ open,
104
+ defaultOpen,
105
+ onOpenChange,
106
+ placement = "right",
107
+ modal = true,
108
+ size = "md"
109
+ } = props;
110
+ const handleOpenChange = React2__namespace.useCallback((nextOpen) => {
111
+ onOpenChange?.({ open: nextOpen });
112
+ }, [onOpenChange]);
113
+ return /* @__PURE__ */ jsxRuntime.jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsxRuntime.jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsxRuntime.jsx(
114
+ RadixDialog__namespace.Root,
115
+ {
116
+ open,
117
+ defaultOpen,
118
+ onOpenChange: handleOpenChange,
119
+ modal,
120
+ children
121
+ }
122
+ ) }) });
123
+ };
124
+ var PLACEMENT_CLASSES = {
125
+ right: [
126
+ "inset-y-0 right-0",
127
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
128
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
129
+ ].join(" "),
130
+ left: [
131
+ "inset-y-0 left-0",
132
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
133
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
134
+ ].join(" "),
135
+ top: [
136
+ "inset-x-0 top-0",
137
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
138
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
139
+ ].join(" "),
140
+ bottom: [
141
+ "inset-x-0 bottom-0",
142
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
143
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
144
+ ].join(" ")
145
+ };
146
+ var SIZE_CLASSES = {
147
+ right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
148
+ left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
149
+ top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
150
+ bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
151
+ };
152
+ var DrawerContent = React2__namespace.forwardRef(
153
+ function DrawerContent2(props, ref) {
154
+ const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
155
+ const placement = React2__namespace.useContext(DrawerPlacementContext);
156
+ const size = React2__namespace.useContext(DrawerSizeContext);
157
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
158
+ backdrop && /* @__PURE__ */ jsxRuntime.jsx(
159
+ RadixDialog__namespace.Overlay,
160
+ {
161
+ className: cn(
162
+ "fixed inset-0 z-50 bg-black/50",
163
+ "data-[state=open]:animate-in data-[state=open]:fade-in-0",
164
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
165
+ )
166
+ }
167
+ ),
168
+ /* @__PURE__ */ jsxRuntime.jsx(
169
+ RadixDialog__namespace.Content,
170
+ {
171
+ ref,
172
+ className: cn(
173
+ "fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
174
+ PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
175
+ SIZE_CLASSES[placement]?.[size] ?? SIZE_CLASSES.right?.md,
176
+ className
177
+ ),
178
+ ...rest,
179
+ children
180
+ }
181
+ )
182
+ ] });
183
+ if (portalled) {
184
+ return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container: portalRef?.current ?? void 0, children: content });
185
+ }
186
+ return content;
187
+ }
188
+ );
189
+ var DrawerCloseTrigger = React2__namespace.forwardRef(function DrawerCloseTrigger2(props, ref) {
190
+ return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
191
+ CloseButton,
192
+ {
193
+ ref,
194
+ className: cn("absolute top-7 right-5", props.className),
195
+ ...props
196
+ }
197
+ ) });
198
+ });
199
+ var DrawerTrigger = (props) => {
200
+ const { asChild = true, ...rest } = props;
201
+ return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Trigger, { asChild, ...rest });
202
+ };
203
+ var DrawerHeader = React2__namespace.forwardRef(
204
+ function DrawerHeader2({ className, ...props }, ref) {
205
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
206
+ }
207
+ );
208
+ var DrawerBody = React2__namespace.forwardRef(
209
+ function DrawerBody2({ className, ...props }, ref) {
210
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
211
+ }
212
+ );
213
+ var DrawerFooter = React2__namespace.forwardRef(
214
+ function DrawerFooter2({ className, ...props }, ref) {
215
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
216
+ }
217
+ );
218
+ var DrawerTitle = RadixDialog__namespace.Title;
219
+ var DrawerDescription = RadixDialog__namespace.Description;
220
+ var DrawerActionTrigger = RadixDialog__namespace.Close;
221
+
222
+ exports.DrawerActionTrigger = DrawerActionTrigger;
223
+ exports.DrawerBody = DrawerBody;
224
+ exports.DrawerCloseTrigger = DrawerCloseTrigger;
225
+ exports.DrawerContent = DrawerContent;
226
+ exports.DrawerDescription = DrawerDescription;
227
+ exports.DrawerFooter = DrawerFooter;
228
+ exports.DrawerHeader = DrawerHeader;
229
+ exports.DrawerRoot = DrawerRoot;
230
+ exports.DrawerTitle = DrawerTitle;
231
+ exports.DrawerTrigger = DrawerTrigger;
@@ -0,0 +1,36 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as RadixDialog from '@radix-ui/react-dialog';
3
+ import * as React from 'react';
4
+
5
+ interface DrawerRootProps {
6
+ children?: React.ReactNode;
7
+ open?: boolean;
8
+ defaultOpen?: boolean;
9
+ onOpenChange?: (details: {
10
+ open: boolean;
11
+ }) => void;
12
+ placement?: 'left' | 'right' | 'top' | 'bottom';
13
+ initialFocusEl?: (() => HTMLElement | null) | React.RefObject<HTMLElement>;
14
+ lazyMount?: boolean;
15
+ unmountOnExit?: boolean;
16
+ modal?: boolean;
17
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
18
+ }
19
+ declare const DrawerRoot: (props: DrawerRootProps) => react_jsx_runtime.JSX.Element;
20
+ interface DrawerContentProps extends React.ComponentPropsWithoutRef<'div'> {
21
+ portalled?: boolean;
22
+ portalRef?: React.RefObject<HTMLElement>;
23
+ offset?: string | number;
24
+ backdrop?: boolean;
25
+ }
26
+ declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
27
+ 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>>;
35
+
36
+ export { DrawerActionTrigger, DrawerBody, DrawerCloseTrigger, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerRoot, type DrawerRootProps, DrawerTitle, DrawerTrigger };
@@ -0,0 +1,36 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as RadixDialog from '@radix-ui/react-dialog';
3
+ import * as React from 'react';
4
+
5
+ interface DrawerRootProps {
6
+ children?: React.ReactNode;
7
+ open?: boolean;
8
+ defaultOpen?: boolean;
9
+ onOpenChange?: (details: {
10
+ open: boolean;
11
+ }) => void;
12
+ placement?: 'left' | 'right' | 'top' | 'bottom';
13
+ initialFocusEl?: (() => HTMLElement | null) | React.RefObject<HTMLElement>;
14
+ lazyMount?: boolean;
15
+ unmountOnExit?: boolean;
16
+ modal?: boolean;
17
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
18
+ }
19
+ declare const DrawerRoot: (props: DrawerRootProps) => react_jsx_runtime.JSX.Element;
20
+ interface DrawerContentProps extends React.ComponentPropsWithoutRef<'div'> {
21
+ portalled?: boolean;
22
+ portalRef?: React.RefObject<HTMLElement>;
23
+ offset?: string | number;
24
+ backdrop?: boolean;
25
+ }
26
+ declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
27
+ 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>>;
35
+
36
+ export { DrawerActionTrigger, DrawerBody, DrawerCloseTrigger, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerRoot, type DrawerRootProps, DrawerTitle, DrawerTrigger };