@luxfi/ui 7.4.11 → 7.4.13

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 (84) hide show
  1. package/dist/alert.cjs +68 -46
  2. package/dist/alert.js +69 -46
  3. package/dist/avatar.cjs +49 -47
  4. package/dist/avatar.js +52 -49
  5. package/dist/badge.cjs +82 -49
  6. package/dist/badge.js +83 -50
  7. package/dist/checkbox.cjs +42 -75
  8. package/dist/checkbox.js +43 -76
  9. package/dist/chrome.cjs +3 -7
  10. package/dist/chrome.js +3 -7
  11. package/dist/close-button.cjs +3 -7
  12. package/dist/close-button.js +3 -7
  13. package/dist/dialog.cjs +3 -7
  14. package/dist/dialog.js +3 -7
  15. package/dist/drawer.cjs +3 -7
  16. package/dist/drawer.js +3 -7
  17. package/dist/empty-state.cjs +13 -13
  18. package/dist/empty-state.js +13 -13
  19. package/dist/expiration-selector.cjs +58 -63
  20. package/dist/expiration-selector.js +58 -63
  21. package/dist/greeks-display.cjs +48 -39
  22. package/dist/greeks-display.js +48 -39
  23. package/dist/index.cjs +1053 -888
  24. package/dist/index.js +1054 -889
  25. package/dist/input-group.cjs +36 -19
  26. package/dist/input-group.js +37 -19
  27. package/dist/option-chain.cjs +89 -67
  28. package/dist/option-chain.js +89 -67
  29. package/dist/option-position.cjs +88 -85
  30. package/dist/option-position.js +88 -85
  31. package/dist/pin-input.cjs +30 -29
  32. package/dist/pin-input.js +30 -29
  33. package/dist/pnl-diagram.cjs +20 -20
  34. package/dist/pnl-diagram.js +20 -20
  35. package/dist/popover.cjs +3 -7
  36. package/dist/popover.js +3 -7
  37. package/dist/progress-circle.cjs +40 -22
  38. package/dist/progress-circle.d.cts +5 -5
  39. package/dist/progress-circle.d.ts +5 -5
  40. package/dist/progress-circle.js +41 -22
  41. package/dist/progress.cjs +15 -22
  42. package/dist/progress.d.cts +6 -6
  43. package/dist/progress.d.ts +6 -6
  44. package/dist/progress.js +15 -22
  45. package/dist/radio.cjs +35 -68
  46. package/dist/radio.d.cts +18 -18
  47. package/dist/radio.d.ts +18 -18
  48. package/dist/radio.js +36 -69
  49. package/dist/rating.cjs +15 -17
  50. package/dist/rating.js +15 -17
  51. package/dist/slider.cjs +33 -50
  52. package/dist/slider.js +34 -51
  53. package/dist/strategy-builder.cjs +194 -115
  54. package/dist/strategy-builder.js +194 -115
  55. package/dist/switch.cjs +48 -55
  56. package/dist/switch.js +49 -56
  57. package/dist/tag.cjs +115 -69
  58. package/dist/tag.js +116 -69
  59. package/dist/tooltip.cjs +28 -17
  60. package/dist/tooltip.js +30 -18
  61. package/package.json +1 -1
  62. package/src/alert.tsx +78 -45
  63. package/src/avatar.tsx +54 -38
  64. package/src/badge.tsx +65 -44
  65. package/src/checkbox.tsx +70 -89
  66. package/src/close-button.tsx +3 -8
  67. package/src/empty-state.tsx +21 -17
  68. package/src/expiration-selector.tsx +84 -66
  69. package/src/greeks-display.tsx +59 -51
  70. package/src/input-group.tsx +38 -24
  71. package/src/option-chain.tsx +154 -104
  72. package/src/option-position.tsx +143 -114
  73. package/src/pin-input.tsx +37 -29
  74. package/src/pnl-diagram.tsx +36 -28
  75. package/src/progress-circle.tsx +52 -28
  76. package/src/progress.tsx +17 -21
  77. package/src/radio.tsx +56 -76
  78. package/src/rating.tsx +22 -20
  79. package/src/slider.tsx +43 -45
  80. package/src/strategy-builder.tsx +260 -162
  81. package/src/switch.tsx +63 -64
  82. package/src/tag.tsx +89 -51
  83. package/src/tooltip.tsx +21 -13
  84. package/tokens.css +18 -0
package/dist/pin-input.js CHANGED
@@ -1,27 +1,29 @@
1
1
  "use client";
2
+ import { XStack, Input } from '@hanzo/gui';
2
3
  import * as React from 'react';
3
- import { clsx } from 'clsx';
4
- import { twMerge } from 'tailwind-merge';
5
4
  import { jsxs, jsx } from 'react/jsx-runtime';
6
5
 
7
6
  // src/pin-input.tsx
8
- function cn(...inputs) {
9
- return twMerge(clsx(inputs));
10
- }
11
- var INPUT_BASE = [
12
- "w-10 h-10",
13
- "text-center text-sm font-medium",
14
- "border-2 rounded-md",
15
- "outline-none appearance-none",
16
- "bg-[var(--color-input-bg)] text-[var(--color-input-fg)]",
17
- "border-[var(--color-input-border)]",
18
- "placeholder:text-[var(--color-input-placeholder)]",
19
- "hover:border-[var(--color-input-border-hover)]",
20
- "focus:border-[var(--color-input-border-focus)] focus:shadow-md",
21
- "disabled:opacity-40"
22
- ].join(" ");
23
- var INPUT_FILLED = "border-[var(--color-input-border)]";
24
- var INPUT_INVALID = "border-[var(--color-border-error)] hover:border-[var(--color-border-error)]";
7
+ var BOX = {
8
+ width: 40,
9
+ height: 40,
10
+ textAlign: "center",
11
+ fontSize: 14,
12
+ fontWeight: 500,
13
+ borderRadius: 6,
14
+ borderWidth: 2,
15
+ borderStyle: "solid",
16
+ outlineWidth: 0,
17
+ backgroundColor: "var(--color-input-bg)",
18
+ color: "var(--color-input-fg)",
19
+ borderColor: "var(--color-input-border)",
20
+ hoverStyle: { borderColor: "var(--color-input-border-hover)" },
21
+ focusStyle: {
22
+ borderColor: "var(--color-input-border-focus)",
23
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
24
+ },
25
+ disabledStyle: { opacity: 0.4 }
26
+ };
25
27
  var PinInput = React.forwardRef(
26
28
  function PinInput2(props, ref) {
27
29
  const {
@@ -113,8 +115,8 @@ var PinInput = React.forwardRef(
113
115
  const onKeyDownAtIndex = React.useCallback((index) => (e) => {
114
116
  handleKeyDown(index, e);
115
117
  }, [handleKeyDown]);
116
- const bgStyle = bgColor ? { backgroundColor: `var(--color-${bgColor.replace(/\./g, "-")})` } : void 0;
117
- return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("inline-flex items-center", attached ? "gap-0" : "gap-2", className), children: [
118
+ const boxBackground = bgColor ? `var(--color-${bgColor.replace(/\./g, "-")})` : BOX.backgroundColor;
119
+ return /* @__PURE__ */ jsxs(XStack, { ref: rootRef, alignItems: "center", gap: attached ? 0 : 8, className, children: [
118
120
  /* @__PURE__ */ jsx(
119
121
  "input",
120
122
  {
@@ -126,9 +128,10 @@ var PinInput = React.forwardRef(
126
128
  }
127
129
  ),
128
130
  Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsx(
129
- "input",
131
+ Input,
130
132
  {
131
133
  ref: setInputRef(index),
134
+ unstyled: true,
132
135
  type: "text",
133
136
  inputMode: "numeric",
134
137
  autoComplete: otp ? "one-time-code" : "off",
@@ -137,14 +140,12 @@ var PinInput = React.forwardRef(
137
140
  placeholder,
138
141
  disabled,
139
142
  "aria-invalid": invalid || void 0,
143
+ "data-invalid": invalid || void 0,
140
144
  value: values[index] || "",
141
- className: cn(
142
- INPUT_BASE,
143
- values[index] && INPUT_FILLED,
144
- invalid && INPUT_INVALID,
145
- attached && index > 0 && "-ml-0.5"
146
- ),
147
- style: bgStyle,
145
+ className: "lux-control",
146
+ ...BOX,
147
+ backgroundColor: boxBackground,
148
+ marginLeft: attached && index > 0 ? -2 : void 0,
148
149
  onInput: onInputAtIndex(index),
149
150
  onKeyDown: onKeyDownAtIndex(index),
150
151
  onPaste: handlePaste,
@@ -1,9 +1,8 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
+ var gui = require('@hanzo/gui');
4
5
  var React = require('react');
5
- var clsx = require('clsx');
6
- var tailwindMerge = require('tailwind-merge');
7
6
  var jsxRuntime = require('react/jsx-runtime');
8
7
 
9
8
  function _interopNamespace(e) {
@@ -26,9 +25,6 @@ function _interopNamespace(e) {
26
25
 
27
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
27
 
29
- function cn(...inputs) {
30
- return tailwindMerge.twMerge(clsx.clsx(inputs));
31
- }
32
28
  function calcLegPnl(leg, price, multiplier) {
33
29
  const premium = leg.premium ?? 0;
34
30
  let intrinsic;
@@ -160,19 +156,21 @@ var PnlDiagram = React__namespace.forwardRef(
160
156
  chartH
161
157
  );
162
158
  return /* @__PURE__ */ jsxRuntime.jsxs(
163
- "div",
159
+ gui.View,
164
160
  {
165
161
  ref,
166
- className: cn("w-full", className),
162
+ unstyled: true,
163
+ width: "100%",
164
+ className,
167
165
  ...rest,
168
166
  children: [
169
- /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: "w-full h-full min-h-[200px]", children: /* @__PURE__ */ jsxRuntime.jsxs(
167
+ /* @__PURE__ */ jsxRuntime.jsx(gui.View, { unstyled: true, ref: containerRef, width: "100%", height: "100%", minHeight: 200, children: /* @__PURE__ */ jsxRuntime.jsxs(
170
168
  "svg",
171
169
  {
172
170
  width,
173
171
  height,
174
172
  viewBox: `0 0 ${width} ${height}`,
175
- className: "select-none",
173
+ style: { userSelect: "none" },
176
174
  onMouseMove: handleMouseMove,
177
175
  onMouseLeave: handleMouseLeave,
178
176
  children: [
@@ -411,16 +409,18 @@ var PnlDiagram = React__namespace.forwardRef(
411
409
  ]
412
410
  }
413
411
  ) }),
414
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-4 px-2 pt-1", children: [
415
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
416
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-0.5 w-4 bg-zinc-200 rounded" }),
417
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-zinc-400", children: "Combined" })
412
+ /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { flexWrap: "wrap", alignItems: "center", gap: 16, paddingHorizontal: 8, paddingTop: 4, children: [
413
+ /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", gap: 6, children: [
414
+ /* @__PURE__ */ jsxRuntime.jsx(gui.View, { height: 2, width: 16, borderRadius: 4, backgroundColor: "var(--color-gray-200)" }),
415
+ /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 10, color: "var(--color-text-secondary)", children: "Combined" })
418
416
  ] }),
419
- legs.map((leg, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
417
+ legs.map((leg, i) => /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", gap: 6, children: [
420
418
  /* @__PURE__ */ jsxRuntime.jsx(
421
- "div",
419
+ gui.View,
422
420
  {
423
- className: "h-0.5 w-4 rounded",
421
+ height: 2,
422
+ width: 16,
423
+ borderRadius: 4,
424
424
  style: {
425
425
  backgroundColor: LEG_COLORS[i % LEG_COLORS.length],
426
426
  opacity: 0.6,
@@ -428,7 +428,7 @@ var PnlDiagram = React__namespace.forwardRef(
428
428
  }
429
429
  }
430
430
  ),
431
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] text-zinc-500", children: [
431
+ /* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: 10, color: "var(--color-text-secondary)", children: [
432
432
  leg.action === "buy" ? "B" : "S",
433
433
  " ",
434
434
  leg.quantity,
@@ -438,9 +438,9 @@ var PnlDiagram = React__namespace.forwardRef(
438
438
  leg.type === "call" ? "C" : "P"
439
439
  ] })
440
440
  ] }, i)),
441
- breakevens.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
442
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-1.5 rounded-full", style: { background: BREAKEVEN_COLOR } }),
443
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] text-zinc-500", children: [
441
+ breakevens.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", gap: 6, children: [
442
+ /* @__PURE__ */ jsxRuntime.jsx(gui.View, { width: 6, height: 6, borderRadius: 9999, style: { background: BREAKEVEN_COLOR } }),
443
+ /* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: 10, color: "var(--color-text-secondary)", children: [
444
444
  "BE: ",
445
445
  breakevens.map((b) => b.toFixed(1)).join(", ")
446
446
  ] })
@@ -1,12 +1,8 @@
1
1
  "use client";
2
+ import { View, XStack, Text } from '@hanzo/gui';
2
3
  import * as React from 'react';
3
- import { clsx } from 'clsx';
4
- import { twMerge } from 'tailwind-merge';
5
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
5
 
7
- function cn(...inputs) {
8
- return twMerge(clsx(inputs));
9
- }
10
6
  function calcLegPnl(leg, price, multiplier) {
11
7
  const premium = leg.premium ?? 0;
12
8
  let intrinsic;
@@ -138,19 +134,21 @@ var PnlDiagram = React.forwardRef(
138
134
  chartH
139
135
  );
140
136
  return /* @__PURE__ */ jsxs(
141
- "div",
137
+ View,
142
138
  {
143
139
  ref,
144
- className: cn("w-full", className),
140
+ unstyled: true,
141
+ width: "100%",
142
+ className,
145
143
  ...rest,
146
144
  children: [
147
- /* @__PURE__ */ jsx("div", { ref: containerRef, className: "w-full h-full min-h-[200px]", children: /* @__PURE__ */ jsxs(
145
+ /* @__PURE__ */ jsx(View, { unstyled: true, ref: containerRef, width: "100%", height: "100%", minHeight: 200, children: /* @__PURE__ */ jsxs(
148
146
  "svg",
149
147
  {
150
148
  width,
151
149
  height,
152
150
  viewBox: `0 0 ${width} ${height}`,
153
- className: "select-none",
151
+ style: { userSelect: "none" },
154
152
  onMouseMove: handleMouseMove,
155
153
  onMouseLeave: handleMouseLeave,
156
154
  children: [
@@ -389,16 +387,18 @@ var PnlDiagram = React.forwardRef(
389
387
  ]
390
388
  }
391
389
  ) }),
392
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4 px-2 pt-1", children: [
393
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
394
- /* @__PURE__ */ jsx("div", { className: "h-0.5 w-4 bg-zinc-200 rounded" }),
395
- /* @__PURE__ */ jsx("span", { className: "text-[10px] text-zinc-400", children: "Combined" })
390
+ /* @__PURE__ */ jsxs(XStack, { flexWrap: "wrap", alignItems: "center", gap: 16, paddingHorizontal: 8, paddingTop: 4, children: [
391
+ /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 6, children: [
392
+ /* @__PURE__ */ jsx(View, { height: 2, width: 16, borderRadius: 4, backgroundColor: "var(--color-gray-200)" }),
393
+ /* @__PURE__ */ jsx(Text, { fontSize: 10, color: "var(--color-text-secondary)", children: "Combined" })
396
394
  ] }),
397
- legs.map((leg, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
395
+ legs.map((leg, i) => /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 6, children: [
398
396
  /* @__PURE__ */ jsx(
399
- "div",
397
+ View,
400
398
  {
401
- className: "h-0.5 w-4 rounded",
399
+ height: 2,
400
+ width: 16,
401
+ borderRadius: 4,
402
402
  style: {
403
403
  backgroundColor: LEG_COLORS[i % LEG_COLORS.length],
404
404
  opacity: 0.6,
@@ -406,7 +406,7 @@ var PnlDiagram = React.forwardRef(
406
406
  }
407
407
  }
408
408
  ),
409
- /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-zinc-500", children: [
409
+ /* @__PURE__ */ jsxs(Text, { fontSize: 10, color: "var(--color-text-secondary)", children: [
410
410
  leg.action === "buy" ? "B" : "S",
411
411
  " ",
412
412
  leg.quantity,
@@ -416,9 +416,9 @@ var PnlDiagram = React.forwardRef(
416
416
  leg.type === "call" ? "C" : "P"
417
417
  ] })
418
418
  ] }, i)),
419
- breakevens.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
420
- /* @__PURE__ */ jsx("div", { className: "h-1.5 w-1.5 rounded-full", style: { background: BREAKEVEN_COLOR } }),
421
- /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-zinc-500", children: [
419
+ breakevens.length > 0 && /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 6, children: [
420
+ /* @__PURE__ */ jsx(View, { width: 6, height: 6, borderRadius: 9999, style: { background: BREAKEVEN_COLOR } }),
421
+ /* @__PURE__ */ jsxs(Text, { fontSize: 10, color: "var(--color-text-secondary)", children: [
422
422
  "BE: ",
423
423
  breakevens.map((b) => b.toFixed(1)).join(", ")
424
424
  ] })
package/dist/popover.cjs CHANGED
@@ -61,23 +61,19 @@ var CloseButtonFrame = gui.styled(gui.View, {
61
61
  }
62
62
  }
63
63
  });
64
- var CLOSE_BUTTON_CLASSES = [
65
- "text-[var(--closeButton-fg,currentColor)]",
66
- "hover:text-[var(--hover-color,currentColor)]",
67
- "disabled:opacity-40"
68
- ].join(" ");
69
64
  var CloseButton = React2__namespace.forwardRef(function CloseButton2(props, ref) {
70
65
  const { variant: _variant, size: _size, className, children, ...rest } = props;
71
66
  return /* @__PURE__ */ jsxRuntime.jsx(
72
67
  CloseButtonFrame,
73
68
  {
74
69
  ref,
75
- className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
70
+ className,
76
71
  ...rest,
77
72
  children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
78
73
  "svg",
79
74
  {
80
- className: "size-5",
75
+ width: 20,
76
+ height: 20,
81
77
  viewBox: "0 0 20 20",
82
78
  fill: "none",
83
79
  "aria-hidden": "true",
package/dist/popover.js CHANGED
@@ -39,23 +39,19 @@ var CloseButtonFrame = styled(View, {
39
39
  }
40
40
  }
41
41
  });
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
42
  var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
48
43
  const { variant: _variant, size: _size, className, children, ...rest } = props;
49
44
  return /* @__PURE__ */ jsx(
50
45
  CloseButtonFrame,
51
46
  {
52
47
  ref,
53
- className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
48
+ className,
54
49
  ...rest,
55
50
  children: children ?? /* @__PURE__ */ jsx(
56
51
  "svg",
57
52
  {
58
- className: "size-5",
53
+ width: 20,
54
+ height: 20,
59
55
  viewBox: "0 0 20 20",
60
56
  fill: "none",
61
57
  "aria-hidden": "true",
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
+ var gui = require('@hanzo/gui');
4
5
  var React = require('react');
5
6
  var clsx = require('clsx');
6
7
  var tailwindMerge = require('tailwind-merge');
@@ -27,15 +28,23 @@ function _interopNamespace(e) {
27
28
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
29
 
29
30
  // src/progress-circle.tsx
31
+ var ink = (children, Wrap = gui.Text, props = {}) => {
32
+ let hasText = false;
33
+ React.Children.forEach(children, (child) => {
34
+ if (typeof child === "string" || typeof child === "number") hasText = true;
35
+ });
36
+ if (!hasText) return children;
37
+ return React.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React.createElement(Wrap, props, child) : child);
38
+ };
30
39
  function cn(...inputs) {
31
40
  return tailwindMerge.twMerge(clsx.clsx(inputs));
32
41
  }
33
42
  var SIZE_MAP = {
34
- xs: { size: 24, thickness: 4, textClass: "text-[10px]" },
35
- sm: { size: 32, thickness: 5, textClass: "text-[10px]" },
36
- md: { size: 40, thickness: 6, textClass: "text-xs" },
37
- lg: { size: 48, thickness: 7, textClass: "text-sm" },
38
- xl: { size: 64, thickness: 8, textClass: "text-sm" }
43
+ xs: { size: 24, thickness: 4, fontSize: 10 },
44
+ sm: { size: 32, thickness: 5, fontSize: 10 },
45
+ md: { size: 40, thickness: 6, fontSize: 12 },
46
+ lg: { size: 48, thickness: 7, fontSize: 14 },
47
+ xl: { size: 64, thickness: 8, fontSize: 14 }
39
48
  };
40
49
  var Ctx = React__namespace.createContext({
41
50
  value: 0,
@@ -56,16 +65,18 @@ var ProgressCircleRoot = React__namespace.forwardRef(function ProgressCircleRoot
56
65
  [value, size, colorPalette]
57
66
  );
58
67
  return /* @__PURE__ */ jsxRuntime.jsx(Ctx.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
59
- "div",
68
+ gui.View,
60
69
  {
61
70
  ref,
62
71
  role: "progressbar",
63
72
  "aria-valuenow": value ?? void 0,
64
73
  "aria-valuemin": 0,
65
74
  "aria-valuemax": 100,
66
- className: cn("relative inline-flex text-sm", className),
75
+ position: "relative",
76
+ style: { display: "inline-flex", fontSize: 14 },
77
+ className,
67
78
  ...rest,
68
- children
79
+ children: ink(children)
69
80
  }
70
81
  ) });
71
82
  });
@@ -84,10 +95,7 @@ var ProgressCircleRing = React__namespace.forwardRef(function ProgressCircleRing
84
95
  width: size,
85
96
  height: size,
86
97
  viewBox: `0 0 ${size} ${size}`,
87
- className: cn(
88
- value === null && "animate-spin",
89
- className
90
- ),
98
+ className: value === null ? cn("lux-spin", className) : className,
91
99
  ...rest,
92
100
  children: [
93
101
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -99,7 +107,7 @@ var ProgressCircleRing = React__namespace.forwardRef(function ProgressCircleRing
99
107
  fill: "transparent",
100
108
  strokeWidth: thickness,
101
109
  stroke: trackColor ?? "currentColor",
102
- className: !trackColor ? "opacity-20" : void 0
110
+ opacity: !trackColor ? 0.2 : void 0
103
111
  }
104
112
  ),
105
113
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -129,20 +137,30 @@ var ProgressCircleRing = React__namespace.forwardRef(function ProgressCircleRing
129
137
  var ProgressCircleValueText = React__namespace.forwardRef(function ProgressCircleValueText2(props, ref) {
130
138
  const { className, children, ...rest } = props;
131
139
  const { value, size: sizeKey } = React__namespace.useContext(Ctx);
132
- const { textClass } = SIZE_MAP[sizeKey];
140
+ const { fontSize } = SIZE_MAP[sizeKey];
133
141
  return /* @__PURE__ */ jsxRuntime.jsx(
134
- "div",
142
+ gui.View,
135
143
  {
136
144
  ref,
137
145
  "aria-live": "polite",
138
- className: cn(
139
- "absolute inset-0 flex items-center justify-center",
140
- "font-medium tracking-tight tabular-nums leading-none",
141
- textClass,
142
- className
143
- ),
146
+ position: "absolute",
147
+ top: 0,
148
+ left: 0,
149
+ right: 0,
150
+ bottom: 0,
151
+ display: "flex",
152
+ alignItems: "center",
153
+ justifyContent: "center",
154
+ style: {
155
+ fontWeight: 500,
156
+ fontSize,
157
+ lineHeight: `${fontSize}px`,
158
+ letterSpacing: fontSize * -0.025,
159
+ fontVariantNumeric: "tabular-nums"
160
+ },
161
+ className,
144
162
  ...rest,
145
- children: children ?? `${Math.round(value ?? 0)}%`
163
+ children: ink(children ?? `${Math.round(value ?? 0)}%`)
146
164
  }
147
165
  );
148
166
  });
@@ -4,27 +4,27 @@ declare const SIZE_MAP: {
4
4
  readonly xs: {
5
5
  readonly size: 24;
6
6
  readonly thickness: 4;
7
- readonly textClass: "text-[10px]";
7
+ readonly fontSize: 10;
8
8
  };
9
9
  readonly sm: {
10
10
  readonly size: 32;
11
11
  readonly thickness: 5;
12
- readonly textClass: "text-[10px]";
12
+ readonly fontSize: 10;
13
13
  };
14
14
  readonly md: {
15
15
  readonly size: 40;
16
16
  readonly thickness: 6;
17
- readonly textClass: "text-xs";
17
+ readonly fontSize: 12;
18
18
  };
19
19
  readonly lg: {
20
20
  readonly size: 48;
21
21
  readonly thickness: 7;
22
- readonly textClass: "text-sm";
22
+ readonly fontSize: 14;
23
23
  };
24
24
  readonly xl: {
25
25
  readonly size: 64;
26
26
  readonly thickness: 8;
27
- readonly textClass: "text-sm";
27
+ readonly fontSize: 14;
28
28
  };
29
29
  };
30
30
  type Size = keyof typeof SIZE_MAP;
@@ -4,27 +4,27 @@ declare const SIZE_MAP: {
4
4
  readonly xs: {
5
5
  readonly size: 24;
6
6
  readonly thickness: 4;
7
- readonly textClass: "text-[10px]";
7
+ readonly fontSize: 10;
8
8
  };
9
9
  readonly sm: {
10
10
  readonly size: 32;
11
11
  readonly thickness: 5;
12
- readonly textClass: "text-[10px]";
12
+ readonly fontSize: 10;
13
13
  };
14
14
  readonly md: {
15
15
  readonly size: 40;
16
16
  readonly thickness: 6;
17
- readonly textClass: "text-xs";
17
+ readonly fontSize: 12;
18
18
  };
19
19
  readonly lg: {
20
20
  readonly size: 48;
21
21
  readonly thickness: 7;
22
- readonly textClass: "text-sm";
22
+ readonly fontSize: 14;
23
23
  };
24
24
  readonly xl: {
25
25
  readonly size: 64;
26
26
  readonly thickness: 8;
27
- readonly textClass: "text-sm";
27
+ readonly fontSize: 14;
28
28
  };
29
29
  };
30
30
  type Size = keyof typeof SIZE_MAP;
@@ -1,19 +1,29 @@
1
1
  "use client";
2
+ import { View, Text } from '@hanzo/gui';
2
3
  import * as React from 'react';
4
+ import { Children, createElement } from 'react';
3
5
  import { clsx } from 'clsx';
4
6
  import { twMerge } from 'tailwind-merge';
5
7
  import { jsx, jsxs } from 'react/jsx-runtime';
6
8
 
7
9
  // src/progress-circle.tsx
10
+ var ink = (children, Wrap = Text, props = {}) => {
11
+ let hasText = false;
12
+ Children.forEach(children, (child) => {
13
+ if (typeof child === "string" || typeof child === "number") hasText = true;
14
+ });
15
+ if (!hasText) return children;
16
+ return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
17
+ };
8
18
  function cn(...inputs) {
9
19
  return twMerge(clsx(inputs));
10
20
  }
11
21
  var SIZE_MAP = {
12
- xs: { size: 24, thickness: 4, textClass: "text-[10px]" },
13
- sm: { size: 32, thickness: 5, textClass: "text-[10px]" },
14
- md: { size: 40, thickness: 6, textClass: "text-xs" },
15
- lg: { size: 48, thickness: 7, textClass: "text-sm" },
16
- xl: { size: 64, thickness: 8, textClass: "text-sm" }
22
+ xs: { size: 24, thickness: 4, fontSize: 10 },
23
+ sm: { size: 32, thickness: 5, fontSize: 10 },
24
+ md: { size: 40, thickness: 6, fontSize: 12 },
25
+ lg: { size: 48, thickness: 7, fontSize: 14 },
26
+ xl: { size: 64, thickness: 8, fontSize: 14 }
17
27
  };
18
28
  var Ctx = React.createContext({
19
29
  value: 0,
@@ -34,16 +44,18 @@ var ProgressCircleRoot = React.forwardRef(function ProgressCircleRoot2(props, re
34
44
  [value, size, colorPalette]
35
45
  );
36
46
  return /* @__PURE__ */ jsx(Ctx.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
37
- "div",
47
+ View,
38
48
  {
39
49
  ref,
40
50
  role: "progressbar",
41
51
  "aria-valuenow": value ?? void 0,
42
52
  "aria-valuemin": 0,
43
53
  "aria-valuemax": 100,
44
- className: cn("relative inline-flex text-sm", className),
54
+ position: "relative",
55
+ style: { display: "inline-flex", fontSize: 14 },
56
+ className,
45
57
  ...rest,
46
- children
58
+ children: ink(children)
47
59
  }
48
60
  ) });
49
61
  });
@@ -62,10 +74,7 @@ var ProgressCircleRing = React.forwardRef(function ProgressCircleRing2(props, re
62
74
  width: size,
63
75
  height: size,
64
76
  viewBox: `0 0 ${size} ${size}`,
65
- className: cn(
66
- value === null && "animate-spin",
67
- className
68
- ),
77
+ className: value === null ? cn("lux-spin", className) : className,
69
78
  ...rest,
70
79
  children: [
71
80
  /* @__PURE__ */ jsx(
@@ -77,7 +86,7 @@ var ProgressCircleRing = React.forwardRef(function ProgressCircleRing2(props, re
77
86
  fill: "transparent",
78
87
  strokeWidth: thickness,
79
88
  stroke: trackColor ?? "currentColor",
80
- className: !trackColor ? "opacity-20" : void 0
89
+ opacity: !trackColor ? 0.2 : void 0
81
90
  }
82
91
  ),
83
92
  /* @__PURE__ */ jsx(
@@ -107,20 +116,30 @@ var ProgressCircleRing = React.forwardRef(function ProgressCircleRing2(props, re
107
116
  var ProgressCircleValueText = React.forwardRef(function ProgressCircleValueText2(props, ref) {
108
117
  const { className, children, ...rest } = props;
109
118
  const { value, size: sizeKey } = React.useContext(Ctx);
110
- const { textClass } = SIZE_MAP[sizeKey];
119
+ const { fontSize } = SIZE_MAP[sizeKey];
111
120
  return /* @__PURE__ */ jsx(
112
- "div",
121
+ View,
113
122
  {
114
123
  ref,
115
124
  "aria-live": "polite",
116
- className: cn(
117
- "absolute inset-0 flex items-center justify-center",
118
- "font-medium tracking-tight tabular-nums leading-none",
119
- textClass,
120
- className
121
- ),
125
+ position: "absolute",
126
+ top: 0,
127
+ left: 0,
128
+ right: 0,
129
+ bottom: 0,
130
+ display: "flex",
131
+ alignItems: "center",
132
+ justifyContent: "center",
133
+ style: {
134
+ fontWeight: 500,
135
+ fontSize,
136
+ lineHeight: `${fontSize}px`,
137
+ letterSpacing: fontSize * -0.025,
138
+ fontVariantNumeric: "tabular-nums"
139
+ },
140
+ className,
122
141
  ...rest,
123
- children: children ?? `${Math.round(value ?? 0)}%`
142
+ children: ink(children ?? `${Math.round(value ?? 0)}%`)
124
143
  }
125
144
  );
126
145
  });