@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/alert.js ADDED
@@ -0,0 +1,408 @@
1
+ "use client";
2
+ import { cva } from 'class-variance-authority';
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/alert.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
+ var SHIM_PROPS = [
76
+ "w",
77
+ "h",
78
+ "minW",
79
+ "maxW",
80
+ "display",
81
+ "flexGrow",
82
+ "flexShrink",
83
+ "flexBasis",
84
+ "fontWeight",
85
+ "textStyle",
86
+ "borderRadius",
87
+ "alignSelf",
88
+ "alignItems",
89
+ "justifyContent",
90
+ "color",
91
+ "mt",
92
+ "mb",
93
+ "ml",
94
+ "mr",
95
+ "height",
96
+ "overflow",
97
+ "whiteSpace",
98
+ "textOverflow",
99
+ "textTransform",
100
+ "gap",
101
+ "gridTemplateColumns",
102
+ "minWidth",
103
+ "boxSize",
104
+ "py",
105
+ "px",
106
+ "p",
107
+ "hideBelow",
108
+ "fontSize",
109
+ "flexWrap",
110
+ "wordBreak",
111
+ "lineHeight",
112
+ "marginRight",
113
+ "position",
114
+ "background"
115
+ ];
116
+ var S = 4;
117
+ function dim(v) {
118
+ if (v == null) return void 0;
119
+ if (typeof v === "number") return `${v * S}px`;
120
+ if (typeof v === "string") return v;
121
+ if (typeof v === "object") {
122
+ const o = v;
123
+ return o.base ?? o.lg ?? o.xl ?? Object.values(o)[0];
124
+ }
125
+ return void 0;
126
+ }
127
+ function sp(v) {
128
+ if (v === void 0) return void 0;
129
+ return typeof v === "number" ? `${v * S}px` : v;
130
+ }
131
+ function shimToStyle(props) {
132
+ const s = {};
133
+ if (props.w !== void 0) s.width = dim(props.w);
134
+ if (props.h !== void 0) s.height = dim(props.h);
135
+ if (props.minW !== void 0) s.minWidth = dim(props.minW);
136
+ if (props.maxW !== void 0) s.maxWidth = dim(props.maxW);
137
+ if (props.display !== void 0) s.display = props.display;
138
+ if (props.flexGrow !== void 0) s.flexGrow = props.flexGrow;
139
+ if (props.flexShrink !== void 0) s.flexShrink = props.flexShrink;
140
+ if (props.flexBasis !== void 0) s.flexBasis = props.flexBasis;
141
+ if (props.fontWeight !== void 0) s.fontWeight = props.fontWeight;
142
+ if (props.borderRadius !== void 0) s.borderRadius = props.borderRadius;
143
+ if (props.alignSelf !== void 0) s.alignSelf = props.alignSelf;
144
+ if (props.alignItems !== void 0) s.alignItems = props.alignItems;
145
+ if (props.justifyContent !== void 0) s.justifyContent = props.justifyContent;
146
+ if (props.color !== void 0) s.color = props.color;
147
+ if (props.mt !== void 0) s.marginTop = sp(props.mt);
148
+ if (props.mb !== void 0) s.marginBottom = sp(props.mb);
149
+ if (props.ml !== void 0) s.marginLeft = sp(props.ml);
150
+ if (props.mr !== void 0) s.marginRight = sp(props.mr);
151
+ if (props.height !== void 0) s.height = props.height;
152
+ if (props.overflow !== void 0) s.overflow = props.overflow;
153
+ if (props.whiteSpace !== void 0) s.whiteSpace = props.whiteSpace;
154
+ if (props.textOverflow !== void 0) s.textOverflow = props.textOverflow;
155
+ if (props.textTransform !== void 0) s.textTransform = props.textTransform;
156
+ if (props.gap !== void 0) s.gap = sp(props.gap);
157
+ if (props.gridTemplateColumns !== void 0) s.gridTemplateColumns = props.gridTemplateColumns;
158
+ if (props.minWidth !== void 0) s.minWidth = props.minWidth;
159
+ if (props.boxSize !== void 0) {
160
+ const v = typeof props.boxSize === "number" ? `${props.boxSize * S}px` : props.boxSize;
161
+ s.width = v;
162
+ s.height = v;
163
+ }
164
+ if (props.py !== void 0) {
165
+ const v = sp(props.py);
166
+ s.paddingTop = v;
167
+ s.paddingBottom = v;
168
+ }
169
+ if (props.px !== void 0) {
170
+ const v = sp(props.px);
171
+ s.paddingLeft = v;
172
+ s.paddingRight = v;
173
+ }
174
+ if (props.p !== void 0) s.padding = sp(props.p);
175
+ if (props.fontSize !== void 0) s.fontSize = props.fontSize;
176
+ if (props.flexWrap !== void 0) s.flexWrap = props.flexWrap;
177
+ if (props.wordBreak !== void 0) s.wordBreak = props.wordBreak;
178
+ if (props.lineHeight !== void 0) s.lineHeight = props.lineHeight;
179
+ if (props.marginRight !== void 0) s.marginRight = props.marginRight;
180
+ if (props.position !== void 0) s.position = props.position;
181
+ if (props.background !== void 0) s.background = props.background;
182
+ return s;
183
+ }
184
+ function stripShims(props) {
185
+ const out = { ...props };
186
+ for (const k of SHIM_PROPS) delete out[k];
187
+ return out;
188
+ }
189
+ var SKELETON_CLASSES = [
190
+ "animate-skeleton-shimmer rounded-sm",
191
+ "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
192
+ "bg-[length:200%_100%]"
193
+ ].join(" ");
194
+ var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
195
+ var Skeleton = React2.forwardRef(
196
+ function Skeleton2(props, ref) {
197
+ const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
198
+ const shimStyle = shimToStyle(props);
199
+ const mergedStyle = Object.keys(shimStyle).length > 0 || styleProp ? { ...shimStyle, ...styleProp } : void 0;
200
+ const hideBelowClass = props.hideBelow ? HIDE_BELOW_MAP[props.hideBelow] : void 0;
201
+ const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
202
+ const htmlRest = stripShims(allRest);
203
+ if (!loading) {
204
+ if (asChild && React2.isValidElement(children)) return children;
205
+ return /* @__PURE__ */ jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
206
+ }
207
+ if (asChild && React2.isValidElement(children)) {
208
+ return /* @__PURE__ */ jsx(
209
+ Component,
210
+ {
211
+ ref,
212
+ "data-loading": true,
213
+ className: cn(SKELETON_CLASSES, "text-transparent [&_*]:invisible", cls),
214
+ style: mergedStyle,
215
+ ...htmlRest,
216
+ children
217
+ }
218
+ );
219
+ }
220
+ return /* @__PURE__ */ jsx(
221
+ Component,
222
+ {
223
+ ref,
224
+ "data-loading": true,
225
+ className: cn(SKELETON_CLASSES, children ? "text-transparent [&_*]:invisible" : "min-h-5", cls),
226
+ style: mergedStyle,
227
+ ...htmlRest,
228
+ children
229
+ }
230
+ );
231
+ }
232
+ );
233
+ React2.forwardRef(
234
+ function SkeletonCircle2(props, ref) {
235
+ const { size = 40, loading = true, className, ...rest } = props;
236
+ const dimension = typeof size === "number" ? `${size}px` : size;
237
+ return /* @__PURE__ */ jsx(
238
+ Skeleton,
239
+ {
240
+ ref,
241
+ loading,
242
+ className: cn("rounded-full shrink-0", className),
243
+ style: { width: dimension, height: dimension, ...rest.style },
244
+ ...rest
245
+ }
246
+ );
247
+ }
248
+ );
249
+ React2.forwardRef(
250
+ function SkeletonText2(props, ref) {
251
+ const { noOfLines = 3, loading = true, className, ...rest } = props;
252
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx(
253
+ Skeleton,
254
+ {
255
+ loading,
256
+ className: cn("h-4", index === noOfLines - 1 && "max-w-[80%]")
257
+ },
258
+ index
259
+ )) });
260
+ }
261
+ );
262
+ var IndicatorIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm.75-11.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM9.25 10a.75.75 0 011.5 0v3a.75.75 0 01-1.5 0v-3z" }) });
263
+ var alertRoot = cva(
264
+ // base
265
+ "w-full flex items-start relative rounded text-[var(--color-alert-fg)]",
266
+ {
267
+ variants: {
268
+ status: {
269
+ info: "bg-[var(--color-alert-bg-info)]",
270
+ warning: "bg-[var(--color-alert-bg-warning)]",
271
+ warning_table: "bg-[var(--color-alert-bg-warning-table)]",
272
+ success: "bg-[var(--color-alert-bg-success)]",
273
+ error: "bg-[var(--color-alert-bg-error)]"
274
+ },
275
+ size: {
276
+ sm: "gap-2 px-2 py-2 text-xs",
277
+ md: "gap-2 px-3 py-2 text-base"
278
+ }
279
+ },
280
+ defaultVariants: {
281
+ status: "info",
282
+ size: "md"
283
+ }
284
+ }
285
+ );
286
+ var alertContent = cva("flex flex-1", {
287
+ variants: {
288
+ inline: {
289
+ "true": "inline-flex flex-row items-center",
290
+ "false": "flex flex-col"
291
+ }
292
+ },
293
+ defaultVariants: {
294
+ inline: true
295
+ }
296
+ });
297
+ var INDICATOR_BASE = "inline-flex items-center justify-center shrink-0 w-5 h-5 text-[var(--color-alert-fg)] [&>svg]:w-full [&>svg]:h-full";
298
+ var indicatorVariants = cva(INDICATOR_BASE, {
299
+ variants: {
300
+ size: {
301
+ sm: "w-5 h-5 my-0",
302
+ md: "w-5 h-5 my-[2px]"
303
+ }
304
+ },
305
+ defaultVariants: {
306
+ size: "md"
307
+ }
308
+ });
309
+ var Alert = React2.forwardRef(
310
+ function Alert2(props, ref) {
311
+ const {
312
+ title,
313
+ children,
314
+ icon,
315
+ closable,
316
+ onClose,
317
+ startElement,
318
+ endElement,
319
+ loading,
320
+ size,
321
+ inline = true,
322
+ showIcon = false,
323
+ descriptionProps,
324
+ status = "info",
325
+ className,
326
+ ...rest
327
+ } = props;
328
+ const { whiteSpace: _whiteSpace, mb: _mb, mt: _mt, style: styleProp, ...alertRest } = rest;
329
+ const shimStyle = { ...styleProp };
330
+ if (_whiteSpace) shimStyle.whiteSpace = _whiteSpace;
331
+ if (_mb !== void 0) shimStyle.marginBottom = typeof _mb === "number" ? `${_mb * 4}px` : _mb;
332
+ if (_mt !== void 0) shimStyle.marginTop = typeof _mt === "number" ? `${_mt * 4}px` : _mt;
333
+ const alertStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
334
+ const [isOpen, setIsOpen] = React2.useState(true);
335
+ const resolvedSize = size ?? "md";
336
+ const defaultIcon = /* @__PURE__ */ jsx(IndicatorIcon, { className: "w-5 h-5" });
337
+ const iconElement = (() => {
338
+ if (startElement !== void 0) {
339
+ return startElement;
340
+ }
341
+ if (!showIcon && icon === void 0) {
342
+ return null;
343
+ }
344
+ return /* @__PURE__ */ jsx("span", { className: indicatorVariants({ size: resolvedSize }), children: icon || defaultIcon });
345
+ })();
346
+ const handleClose = React2.useCallback(() => {
347
+ setIsOpen(false);
348
+ onClose?.();
349
+ }, [onClose]);
350
+ if (closable && !isOpen) {
351
+ return null;
352
+ }
353
+ const {
354
+ className: descClassName,
355
+ whiteSpace: descWhiteSpace,
356
+ alignItems: descAlignItems,
357
+ flexDir: descFlexDir,
358
+ flexWrap: descFlexWrap,
359
+ rowGap: descRowGap,
360
+ columnGap: descColumnGap,
361
+ style: descStyleProp,
362
+ ...descRest
363
+ } = descriptionProps ?? {};
364
+ const descStyle = {
365
+ ...descStyleProp,
366
+ ...descWhiteSpace ? { whiteSpace: descWhiteSpace } : {},
367
+ ...descAlignItems ? { alignItems: descAlignItems } : {},
368
+ ...descFlexDir ? { flexDirection: descFlexDir } : {},
369
+ ...descFlexWrap ? { flexWrap: descFlexWrap } : {},
370
+ ...descRowGap !== void 0 ? { rowGap: typeof descRowGap === "number" ? `${descRowGap * 4}px` : descRowGap } : {},
371
+ ...descColumnGap !== void 0 ? { columnGap: typeof descColumnGap === "number" ? `${descColumnGap * 4}px` : descColumnGap } : {}
372
+ };
373
+ return /* @__PURE__ */ jsx(Skeleton, { loading, children: /* @__PURE__ */ jsxs(
374
+ "div",
375
+ {
376
+ ref,
377
+ className: cn(alertRoot({ status, size: resolvedSize }), className),
378
+ style: alertStyle,
379
+ ...alertRest,
380
+ children: [
381
+ iconElement,
382
+ children ? /* @__PURE__ */ jsxs("div", { className: alertContent({ inline }), children: [
383
+ title && /* @__PURE__ */ jsx("div", { className: "font-semibold", children: title }),
384
+ /* @__PURE__ */ jsx(
385
+ "div",
386
+ {
387
+ className: cn("inline-flex flex-wrap", descClassName),
388
+ style: Object.keys(descStyle).length > 0 ? descStyle : void 0,
389
+ ...descRest,
390
+ children
391
+ }
392
+ )
393
+ ] }) : /* @__PURE__ */ jsx("div", { className: "font-semibold flex-1", children: title }),
394
+ endElement,
395
+ closable && /* @__PURE__ */ jsx(
396
+ CloseButton,
397
+ {
398
+ className: "relative self-start",
399
+ onClick: handleClose
400
+ }
401
+ )
402
+ ]
403
+ }
404
+ ) });
405
+ }
406
+ );
407
+
408
+ export { Alert };
@@ -0,0 +1,149 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var RadixAvatar = require('@radix-ui/react-avatar');
5
+ var React = require('react');
6
+ var clsx = require('clsx');
7
+ var tailwindMerge = require('tailwind-merge');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var RadixAvatar__namespace = /*#__PURE__*/_interopNamespace(RadixAvatar);
29
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
+
31
+ function cn(...inputs) {
32
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
33
+ }
34
+ var SIZE_CLASSES = {
35
+ xs: "h-6 w-6 text-[10px]",
36
+ sm: "h-8 w-8 text-xs",
37
+ md: "h-10 w-10 text-sm",
38
+ lg: "h-12 w-12 text-base",
39
+ xl: "h-16 w-16 text-lg",
40
+ "2xl": "h-20 w-20 text-xl"
41
+ };
42
+ var VARIANT_CLASSES = {
43
+ solid: "bg-gray-500 text-white",
44
+ subtle: "bg-gray-200 text-gray-700 dark:bg-gray-700 dark:text-gray-200",
45
+ outline: "border-2 border-gray-300 bg-transparent text-gray-700 dark:border-gray-600 dark:text-gray-200"
46
+ };
47
+ var DEFAULT_SIZE = "md";
48
+ var DEFAULT_VARIANT = "subtle";
49
+ var AvatarGroupContext = React__namespace.createContext({});
50
+ function useAvatarGroupContext() {
51
+ return React__namespace.useContext(AvatarGroupContext);
52
+ }
53
+ var Avatar = React__namespace.forwardRef(
54
+ function Avatar2(props, ref) {
55
+ const group = useAvatarGroupContext();
56
+ const {
57
+ name,
58
+ src,
59
+ srcSet,
60
+ loading,
61
+ icon,
62
+ fallback,
63
+ children,
64
+ className,
65
+ size: sizeProp,
66
+ variant: variantProp,
67
+ borderless,
68
+ ...rest
69
+ } = props;
70
+ const size = sizeProp ?? group.size ?? DEFAULT_SIZE;
71
+ const variant = variantProp ?? group.variant ?? DEFAULT_VARIANT;
72
+ const isBorderless = borderless ?? group.borderless ?? false;
73
+ return /* @__PURE__ */ jsxRuntime.jsxs(
74
+ RadixAvatar__namespace.Root,
75
+ {
76
+ ref,
77
+ className: cn(
78
+ "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full align-middle",
79
+ SIZE_CLASSES[size],
80
+ VARIANT_CLASSES[variant],
81
+ !isBorderless && "ring-2 ring-white dark:ring-gray-900",
82
+ className
83
+ ),
84
+ ...rest,
85
+ children: [
86
+ /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { name, icon, children: fallback }),
87
+ /* @__PURE__ */ jsxRuntime.jsx(
88
+ RadixAvatar__namespace.Image,
89
+ {
90
+ className: "h-full w-full rounded-[inherit] object-cover",
91
+ src,
92
+ srcSet,
93
+ loading,
94
+ alt: name ?? ""
95
+ }
96
+ ),
97
+ children
98
+ ]
99
+ }
100
+ );
101
+ }
102
+ );
103
+ var AvatarFallback = React__namespace.forwardRef(
104
+ function AvatarFallback2(props, ref) {
105
+ const { name, icon, children, className, ...rest } = props;
106
+ return /* @__PURE__ */ jsxRuntime.jsxs(
107
+ RadixAvatar__namespace.Fallback,
108
+ {
109
+ ref,
110
+ className: cn(
111
+ "flex h-full w-full items-center justify-center font-medium",
112
+ className
113
+ ),
114
+ ...rest,
115
+ children: [
116
+ children,
117
+ name != null && children == null && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: getInitials(name) }),
118
+ name == null && children == null && icon
119
+ ]
120
+ }
121
+ );
122
+ }
123
+ );
124
+ function getInitials(name) {
125
+ const names = name.trim().split(" ");
126
+ const firstName = names[0] != null ? names[0] : "";
127
+ const lastName = names.length > 1 ? names[names.length - 1] : "";
128
+ return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0);
129
+ }
130
+ var AvatarGroup = React__namespace.forwardRef(
131
+ function AvatarGroup2(props, ref) {
132
+ const { size, variant, borderless, className, ...rest } = props;
133
+ const contextValue = React__namespace.useMemo(
134
+ () => ({ size, variant, borderless }),
135
+ [size, variant, borderless]
136
+ );
137
+ return /* @__PURE__ */ jsxRuntime.jsx(AvatarGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
138
+ "div",
139
+ {
140
+ ref,
141
+ className: cn("flex -space-x-3", className),
142
+ ...rest
143
+ }
144
+ ) });
145
+ }
146
+ );
147
+
148
+ exports.Avatar = Avatar;
149
+ exports.AvatarGroup = AvatarGroup;
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+
3
+ type ImageProps = React.ImgHTMLAttributes<HTMLImageElement>;
4
+ type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
5
+ type AvatarVariant = 'solid' | 'subtle' | 'outline';
6
+ interface AvatarProps extends React.ComponentPropsWithoutRef<'span'> {
7
+ name?: string;
8
+ src?: string;
9
+ srcSet?: string;
10
+ loading?: ImageProps['loading'];
11
+ icon?: React.ReactElement;
12
+ fallback?: React.ReactNode;
13
+ size?: AvatarSize;
14
+ variant?: AvatarVariant;
15
+ borderless?: boolean;
16
+ }
17
+ declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
18
+ interface AvatarGroupProps extends React.ComponentPropsWithoutRef<'div'> {
19
+ size?: AvatarSize;
20
+ variant?: AvatarVariant;
21
+ borderless?: boolean;
22
+ }
23
+ declare const AvatarGroup: React.ForwardRefExoticComponent<AvatarGroupProps & React.RefAttributes<HTMLDivElement>>;
24
+
25
+ export { Avatar, AvatarGroup, type AvatarProps };
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+
3
+ type ImageProps = React.ImgHTMLAttributes<HTMLImageElement>;
4
+ type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
5
+ type AvatarVariant = 'solid' | 'subtle' | 'outline';
6
+ interface AvatarProps extends React.ComponentPropsWithoutRef<'span'> {
7
+ name?: string;
8
+ src?: string;
9
+ srcSet?: string;
10
+ loading?: ImageProps['loading'];
11
+ icon?: React.ReactElement;
12
+ fallback?: React.ReactNode;
13
+ size?: AvatarSize;
14
+ variant?: AvatarVariant;
15
+ borderless?: boolean;
16
+ }
17
+ declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
18
+ interface AvatarGroupProps extends React.ComponentPropsWithoutRef<'div'> {
19
+ size?: AvatarSize;
20
+ variant?: AvatarVariant;
21
+ borderless?: boolean;
22
+ }
23
+ declare const AvatarGroup: React.ForwardRefExoticComponent<AvatarGroupProps & React.RefAttributes<HTMLDivElement>>;
24
+
25
+ export { Avatar, AvatarGroup, type AvatarProps };