@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/alert.js CHANGED
@@ -1,14 +1,12 @@
1
1
  "use client";
2
+ import { styled, View, XStack, YStack, Text } from '@hanzo/gui';
2
3
  import * as React2 from 'react';
4
+ import { Children, createElement } from 'react';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
6
  import { clsx } from 'clsx';
4
7
  import { twMerge } from 'tailwind-merge';
5
- import { styled, View } from '@hanzo/gui';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
7
8
 
8
9
  // src/alert.tsx
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
12
10
  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";
13
11
  var CloseButtonFrame = styled(View, {
14
12
  name: "LuxCloseButton",
@@ -39,23 +37,19 @@ var CloseButtonFrame = styled(View, {
39
37
  }
40
38
  }
41
39
  });
42
- var CLOSE_BUTTON_CLASSES = [
43
- "text-[var(--closeButton-fg,currentColor)]",
44
- "hover:text-[var(--hover-color,currentColor)]",
45
- "disabled:opacity-40"
46
- ].join(" ");
47
40
  var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
48
41
  const { variant: _variant, size: _size, className, children, ...rest } = props;
49
42
  return /* @__PURE__ */ jsx(
50
43
  CloseButtonFrame,
51
44
  {
52
45
  ref,
53
- className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
46
+ className,
54
47
  ...rest,
55
48
  children: children ?? /* @__PURE__ */ jsx(
56
49
  "svg",
57
50
  {
58
- className: "size-5",
51
+ width: 20,
52
+ height: 20,
59
53
  viewBox: "0 0 20 20",
60
54
  fill: "none",
61
55
  "aria-hidden": "true",
@@ -71,6 +65,17 @@ var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
71
65
  }
72
66
  );
73
67
  });
68
+ var ink = (children, Wrap = Text, props = {}) => {
69
+ let hasText = false;
70
+ Children.forEach(children, (child) => {
71
+ if (typeof child === "string" || typeof child === "number") hasText = true;
72
+ });
73
+ if (!hasText) return children;
74
+ return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
75
+ };
76
+ function cn(...inputs) {
77
+ return twMerge(clsx(inputs));
78
+ }
74
79
  var SHIM_PROPS = [
75
80
  "w",
76
81
  "h",
@@ -254,22 +259,30 @@ React2.forwardRef(
254
259
  )) });
255
260
  }
256
261
  );
257
- 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" }) });
258
- var ALERT_BASE = "w-full flex items-start relative rounded text-[var(--color-alert-fg)]";
259
- var STATUS_CLASSES = {
260
- info: "bg-[var(--color-alert-bg-info)]",
261
- warning: "bg-[var(--color-alert-bg-warning)]",
262
- warning_table: "bg-[var(--color-alert-bg-warning-table)]",
263
- success: "bg-[var(--color-alert-bg-success)]",
264
- error: "bg-[var(--color-alert-bg-error)]"
262
+ var IndicatorIcon = () => /* @__PURE__ */ jsx("svg", { width: 20, height: 20, 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 ALERT_BASE = {
264
+ width: "100%",
265
+ position: "relative",
266
+ alignItems: "flex-start",
267
+ borderRadius: 4,
268
+ gap: 8,
269
+ paddingVertical: 8
270
+ };
271
+ var ALERT_FG = "var(--color-alert-fg)";
272
+ var STATUS_BG = {
273
+ info: "var(--color-alert-bg-info)",
274
+ warning: "var(--color-alert-bg-warning)",
275
+ warning_table: "var(--color-alert-bg-warning-table)",
276
+ success: "var(--color-alert-bg-success)",
277
+ error: "var(--color-alert-bg-error)"
265
278
  };
266
- var SIZE_CLASSES = {
267
- sm: "gap-2 px-2 py-2 text-xs",
268
- md: "gap-2 px-3 py-2 text-base"
279
+ var SIZE = {
280
+ sm: { paddingHorizontal: 8, fontSize: 12 },
281
+ md: { paddingHorizontal: 12, fontSize: 16 }
269
282
  };
270
- var INDICATOR_SIZE_CLASSES = {
271
- sm: "w-5 h-5 my-0",
272
- md: "w-5 h-5 my-[2px]"
283
+ var INDICATOR_SIZE = {
284
+ sm: { marginVertical: 0 },
285
+ md: { marginVertical: 2 }
273
286
  };
274
287
  var Alert = React2.forwardRef(
275
288
  function Alert2(props, ref) {
@@ -298,7 +311,8 @@ var Alert = React2.forwardRef(
298
311
  const alertStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
299
312
  const [isOpen, setIsOpen] = React2.useState(true);
300
313
  const resolvedSize = size ?? "md";
301
- const defaultIcon = /* @__PURE__ */ jsx(IndicatorIcon, { className: "w-5 h-5" });
314
+ const fontSize = SIZE[resolvedSize].fontSize;
315
+ const defaultIcon = /* @__PURE__ */ jsx(IndicatorIcon, {});
302
316
  const iconElement = (() => {
303
317
  if (startElement !== void 0) {
304
318
  return startElement;
@@ -306,10 +320,20 @@ var Alert = React2.forwardRef(
306
320
  if (!showIcon && icon === void 0) {
307
321
  return null;
308
322
  }
309
- return /* @__PURE__ */ jsx("span", { className: cn(
310
- "inline-flex items-center justify-center shrink-0 text-[var(--color-alert-fg)] [&>svg]:w-full [&>svg]:h-full",
311
- INDICATOR_SIZE_CLASSES[resolvedSize]
312
- ), children: icon || defaultIcon });
323
+ return /* @__PURE__ */ jsx(
324
+ XStack,
325
+ {
326
+ alignItems: "center",
327
+ justifyContent: "center",
328
+ flexShrink: 0,
329
+ width: 20,
330
+ height: 20,
331
+ ...INDICATOR_SIZE[resolvedSize],
332
+ className: "lux-icon",
333
+ style: { color: ALERT_FG },
334
+ children: icon || defaultIcon
335
+ }
336
+ );
313
337
  })();
314
338
  const handleClose = React2.useCallback(() => {
315
339
  setIsOpen(false);
@@ -338,35 +362,34 @@ var Alert = React2.forwardRef(
338
362
  ...descRowGap !== void 0 ? { rowGap: typeof descRowGap === "number" ? `${descRowGap * 4}px` : descRowGap } : {},
339
363
  ...descColumnGap !== void 0 ? { columnGap: typeof descColumnGap === "number" ? `${descColumnGap * 4}px` : descColumnGap } : {}
340
364
  };
365
+ const ContentFrame = inline ? XStack : YStack;
341
366
  return /* @__PURE__ */ jsx(Skeleton, { loading, children: /* @__PURE__ */ jsxs(
342
- "div",
367
+ XStack,
343
368
  {
344
369
  ref,
345
- className: cn(ALERT_BASE, STATUS_CLASSES[status], SIZE_CLASSES[resolvedSize], className),
370
+ ...ALERT_BASE,
371
+ paddingHorizontal: SIZE[resolvedSize].paddingHorizontal,
372
+ backgroundColor: STATUS_BG[status],
373
+ className,
346
374
  style: alertStyle,
347
375
  ...alertRest,
348
376
  children: [
349
377
  iconElement,
350
- children ? /* @__PURE__ */ jsxs("div", { className: cn("flex flex-1", inline ? "inline-flex flex-row items-center" : "flex flex-col"), children: [
351
- title && /* @__PURE__ */ jsx("div", { className: "font-semibold", children: title }),
378
+ children ? /* @__PURE__ */ jsxs(ContentFrame, { flex: 1, alignItems: inline ? "center" : void 0, children: [
379
+ title && /* @__PURE__ */ jsx(Text, { fontWeight: "600", fontSize, color: ALERT_FG, children: title }),
352
380
  /* @__PURE__ */ jsx(
353
- "div",
381
+ XStack,
354
382
  {
355
- className: cn("inline-flex flex-wrap", descClassName),
383
+ flexWrap: "wrap",
384
+ className: descClassName,
356
385
  style: Object.keys(descStyle).length > 0 ? descStyle : void 0,
357
386
  ...descRest,
358
- children
387
+ children: ink(children, void 0, { fontSize, color: ALERT_FG })
359
388
  }
360
389
  )
361
- ] }) : /* @__PURE__ */ jsx("div", { className: "font-semibold flex-1", children: title }),
390
+ ] }) : /* @__PURE__ */ jsx(Text, { flex: 1, fontWeight: "600", fontSize, color: ALERT_FG, children: title }),
362
391
  endElement,
363
- closable && /* @__PURE__ */ jsx(
364
- CloseButton,
365
- {
366
- className: "relative self-start",
367
- onClick: handleClose
368
- }
369
- )
392
+ closable && /* @__PURE__ */ jsx(View, { position: "relative", alignSelf: "flex-start", children: /* @__PURE__ */ jsx(CloseButton, { onClick: handleClose }) })
370
393
  ]
371
394
  }
372
395
  ) });
package/dist/avatar.cjs CHANGED
@@ -3,8 +3,6 @@
3
3
 
4
4
  var gui = require('@hanzo/gui');
5
5
  var React = require('react');
6
- var clsx = require('clsx');
7
- var tailwindMerge = require('tailwind-merge');
8
6
  var jsxRuntime = require('react/jsx-runtime');
9
7
 
10
8
  function _interopNamespace(e) {
@@ -27,21 +25,32 @@ function _interopNamespace(e) {
27
25
 
28
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
27
 
30
- function cn(...inputs) {
31
- return tailwindMerge.twMerge(clsx.clsx(inputs));
32
- }
33
- var SIZE_CLASSES = {
34
- xs: "h-6 w-6 text-[10px]",
35
- sm: "h-8 w-8 text-xs",
36
- md: "h-10 w-10 text-sm",
37
- lg: "h-12 w-12 text-base",
38
- xl: "h-16 w-16 text-lg",
39
- "2xl": "h-20 w-20 text-xl"
28
+ var ink = (children, Wrap = gui.Text, props = {}) => {
29
+ let hasText = false;
30
+ React.Children.forEach(children, (child) => {
31
+ if (typeof child === "string" || typeof child === "number") hasText = true;
32
+ });
33
+ if (!hasText) return children;
34
+ return React.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React.createElement(Wrap, props, child) : child);
35
+ };
36
+ var SIZE = {
37
+ xs: { width: 24, height: 24, fontSize: 10 },
38
+ sm: { width: 32, height: 32, fontSize: 12 },
39
+ md: { width: 40, height: 40, fontSize: 14 },
40
+ lg: { width: 48, height: 48, fontSize: 16 },
41
+ xl: { width: 64, height: 64, fontSize: 18 },
42
+ "2xl": { width: 80, height: 80, fontSize: 20 }
40
43
  };
41
- var VARIANT_CLASSES = {
42
- solid: "bg-gray-500 text-white",
43
- subtle: "bg-gray-200 text-gray-700 dark:bg-gray-700 dark:text-gray-200",
44
- outline: "border-2 border-gray-300 bg-transparent text-gray-700 dark:border-gray-600 dark:text-gray-200"
44
+ var RING = "var(--color-bg-body)";
45
+ var VARIANT = {
46
+ solid: { backgroundColor: "var(--color-gray-500)", color: "var(--color-white)" },
47
+ subtle: { backgroundColor: "var(--color-badge-gray-bg)", color: "var(--color-badge-gray-fg)" },
48
+ outline: {
49
+ borderWidth: 2,
50
+ borderColor: "var(--color-input-border)",
51
+ backgroundColor: "transparent",
52
+ color: "var(--color-text-secondary)"
53
+ }
45
54
  };
46
55
  var DEFAULT_SIZE = "md";
47
56
  var DEFAULT_VARIANT = "subtle";
@@ -60,7 +69,6 @@ var Avatar = React__namespace.forwardRef(
60
69
  icon,
61
70
  fallback,
62
71
  children,
63
- className,
64
72
  size: sizeProp,
65
73
  variant: variantProp,
66
74
  borderless,
@@ -74,20 +82,26 @@ var Avatar = React__namespace.forwardRef(
74
82
  {
75
83
  ref,
76
84
  unstyled: true,
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
- ),
85
+ position: "relative",
86
+ display: "inline-flex",
87
+ flexShrink: 0,
88
+ alignItems: "center",
89
+ justifyContent: "center",
90
+ overflow: "hidden",
91
+ borderRadius: 9999,
92
+ ...SIZE[size],
93
+ ...VARIANT[variant],
94
+ boxShadow: isBorderless ? void 0 : `0 0 0 2px ${RING}`,
84
95
  ...rest,
85
96
  children: [
86
97
  /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { name, icon, children: fallback }),
87
98
  src != null && /* @__PURE__ */ jsxRuntime.jsx(
88
99
  gui.Avatar.Image,
89
100
  {
90
- className: "h-full w-full rounded-[inherit] object-cover",
101
+ width: "100%",
102
+ height: "100%",
103
+ borderRadius: 9999,
104
+ objectFit: "cover",
91
105
  src,
92
106
  srcSet,
93
107
  loading,
@@ -102,22 +116,18 @@ var Avatar = React__namespace.forwardRef(
102
116
  );
103
117
  var AvatarFallback = React__namespace.forwardRef(
104
118
  function AvatarFallback2(props, ref) {
105
- const { name, icon, children, className, ...rest } = props;
106
- return /* @__PURE__ */ jsxRuntime.jsxs(
119
+ const { name, icon, children, ...rest } = props;
120
+ return /* @__PURE__ */ jsxRuntime.jsx(
107
121
  gui.Avatar.Fallback,
108
122
  {
109
123
  ref,
110
- unstyled: true,
111
- className: cn(
112
- "flex h-full w-full items-center justify-center font-medium",
113
- className
114
- ),
124
+ display: "flex",
125
+ width: "100%",
126
+ height: "100%",
127
+ alignItems: "center",
128
+ justifyContent: "center",
115
129
  ...rest,
116
- children: [
117
- children,
118
- name != null && children == null && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: getInitials(name) }),
119
- name == null && children == null && icon
120
- ]
130
+ children: ink(children ?? (name != null ? getInitials(name) : icon), void 0, { fontWeight: "500" })
121
131
  }
122
132
  );
123
133
  }
@@ -130,19 +140,12 @@ function getInitials(name) {
130
140
  }
131
141
  var AvatarGroup = React__namespace.forwardRef(
132
142
  function AvatarGroup2(props, ref) {
133
- const { size, variant, borderless, className, ...rest } = props;
143
+ const { size, variant, borderless, children, ...rest } = props;
134
144
  const contextValue = React__namespace.useMemo(
135
145
  () => ({ size, variant, borderless }),
136
146
  [size, variant, borderless]
137
147
  );
138
- return /* @__PURE__ */ jsxRuntime.jsx(AvatarGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
139
- "div",
140
- {
141
- ref,
142
- className: cn("flex -space-x-3", className),
143
- ...rest
144
- }
145
- ) });
148
+ return /* @__PURE__ */ jsxRuntime.jsx(AvatarGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { ref, ...rest, children: React__namespace.Children.map(children, (child, index) => index === 0 || !React__namespace.isValidElement(child) ? child : React__namespace.cloneElement(child, { marginLeft: -12 })) }) });
146
149
  }
147
150
  );
148
151
 
package/dist/avatar.js CHANGED
@@ -1,25 +1,35 @@
1
1
  "use client";
2
- import { Avatar as Avatar$1 } from '@hanzo/gui';
2
+ import { Avatar as Avatar$1, Text, XStack } from '@hanzo/gui';
3
3
  import * as React from 'react';
4
- import { clsx } from 'clsx';
5
- import { twMerge } from 'tailwind-merge';
6
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
+ import { Children, createElement } from 'react';
5
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
6
 
8
- function cn(...inputs) {
9
- return twMerge(clsx(inputs));
10
- }
11
- var SIZE_CLASSES = {
12
- xs: "h-6 w-6 text-[10px]",
13
- sm: "h-8 w-8 text-xs",
14
- md: "h-10 w-10 text-sm",
15
- lg: "h-12 w-12 text-base",
16
- xl: "h-16 w-16 text-lg",
17
- "2xl": "h-20 w-20 text-xl"
7
+ var ink = (children, Wrap = Text, props = {}) => {
8
+ let hasText = false;
9
+ Children.forEach(children, (child) => {
10
+ if (typeof child === "string" || typeof child === "number") hasText = true;
11
+ });
12
+ if (!hasText) return children;
13
+ return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
14
+ };
15
+ var SIZE = {
16
+ xs: { width: 24, height: 24, fontSize: 10 },
17
+ sm: { width: 32, height: 32, fontSize: 12 },
18
+ md: { width: 40, height: 40, fontSize: 14 },
19
+ lg: { width: 48, height: 48, fontSize: 16 },
20
+ xl: { width: 64, height: 64, fontSize: 18 },
21
+ "2xl": { width: 80, height: 80, fontSize: 20 }
18
22
  };
19
- var VARIANT_CLASSES = {
20
- solid: "bg-gray-500 text-white",
21
- subtle: "bg-gray-200 text-gray-700 dark:bg-gray-700 dark:text-gray-200",
22
- outline: "border-2 border-gray-300 bg-transparent text-gray-700 dark:border-gray-600 dark:text-gray-200"
23
+ var RING = "var(--color-bg-body)";
24
+ var VARIANT = {
25
+ solid: { backgroundColor: "var(--color-gray-500)", color: "var(--color-white)" },
26
+ subtle: { backgroundColor: "var(--color-badge-gray-bg)", color: "var(--color-badge-gray-fg)" },
27
+ outline: {
28
+ borderWidth: 2,
29
+ borderColor: "var(--color-input-border)",
30
+ backgroundColor: "transparent",
31
+ color: "var(--color-text-secondary)"
32
+ }
23
33
  };
24
34
  var DEFAULT_SIZE = "md";
25
35
  var DEFAULT_VARIANT = "subtle";
@@ -38,7 +48,6 @@ var Avatar = React.forwardRef(
38
48
  icon,
39
49
  fallback,
40
50
  children,
41
- className,
42
51
  size: sizeProp,
43
52
  variant: variantProp,
44
53
  borderless,
@@ -52,20 +61,26 @@ var Avatar = React.forwardRef(
52
61
  {
53
62
  ref,
54
63
  unstyled: true,
55
- className: cn(
56
- "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full align-middle",
57
- SIZE_CLASSES[size],
58
- VARIANT_CLASSES[variant],
59
- !isBorderless && "ring-2 ring-white dark:ring-gray-900",
60
- className
61
- ),
64
+ position: "relative",
65
+ display: "inline-flex",
66
+ flexShrink: 0,
67
+ alignItems: "center",
68
+ justifyContent: "center",
69
+ overflow: "hidden",
70
+ borderRadius: 9999,
71
+ ...SIZE[size],
72
+ ...VARIANT[variant],
73
+ boxShadow: isBorderless ? void 0 : `0 0 0 2px ${RING}`,
62
74
  ...rest,
63
75
  children: [
64
76
  /* @__PURE__ */ jsx(AvatarFallback, { name, icon, children: fallback }),
65
77
  src != null && /* @__PURE__ */ jsx(
66
78
  Avatar$1.Image,
67
79
  {
68
- className: "h-full w-full rounded-[inherit] object-cover",
80
+ width: "100%",
81
+ height: "100%",
82
+ borderRadius: 9999,
83
+ objectFit: "cover",
69
84
  src,
70
85
  srcSet,
71
86
  loading,
@@ -80,22 +95,18 @@ var Avatar = React.forwardRef(
80
95
  );
81
96
  var AvatarFallback = React.forwardRef(
82
97
  function AvatarFallback2(props, ref) {
83
- const { name, icon, children, className, ...rest } = props;
84
- return /* @__PURE__ */ jsxs(
98
+ const { name, icon, children, ...rest } = props;
99
+ return /* @__PURE__ */ jsx(
85
100
  Avatar$1.Fallback,
86
101
  {
87
102
  ref,
88
- unstyled: true,
89
- className: cn(
90
- "flex h-full w-full items-center justify-center font-medium",
91
- className
92
- ),
103
+ display: "flex",
104
+ width: "100%",
105
+ height: "100%",
106
+ alignItems: "center",
107
+ justifyContent: "center",
93
108
  ...rest,
94
- children: [
95
- children,
96
- name != null && children == null && /* @__PURE__ */ jsx(Fragment, { children: getInitials(name) }),
97
- name == null && children == null && icon
98
- ]
109
+ children: ink(children ?? (name != null ? getInitials(name) : icon), void 0, { fontWeight: "500" })
99
110
  }
100
111
  );
101
112
  }
@@ -108,19 +119,12 @@ function getInitials(name) {
108
119
  }
109
120
  var AvatarGroup = React.forwardRef(
110
121
  function AvatarGroup2(props, ref) {
111
- const { size, variant, borderless, className, ...rest } = props;
122
+ const { size, variant, borderless, children, ...rest } = props;
112
123
  const contextValue = React.useMemo(
113
124
  () => ({ size, variant, borderless }),
114
125
  [size, variant, borderless]
115
126
  );
116
- return /* @__PURE__ */ jsx(AvatarGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
117
- "div",
118
- {
119
- ref,
120
- className: cn("flex -space-x-3", className),
121
- ...rest
122
- }
123
- ) });
127
+ return /* @__PURE__ */ jsx(AvatarGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(XStack, { ref, ...rest, children: React.Children.map(children, (child, index) => index === 0 || !React.isValidElement(child) ? child : React.cloneElement(child, { marginLeft: -12 })) }) });
124
128
  }
125
129
  );
126
130