@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/rating.cjs CHANGED
@@ -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) {
@@ -27,11 +26,8 @@ function _interopNamespace(e) {
27
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
27
 
29
28
  // src/rating.tsx
30
- function cn(...inputs) {
31
- return tailwindMerge.twMerge(clsx.clsx(inputs));
32
- }
33
- var StarFilledIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) });
34
- var StarOutlineIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z", strokeWidth: "1.5" }) });
29
+ var StarFilledIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 20, height: 20, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) });
30
+ var StarOutlineIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 20, height: 20, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z", strokeWidth: "1.5" }) });
35
31
  var Rating = React__namespace.forwardRef(
36
32
  function Rating2(props, ref) {
37
33
  const { count = 5, label: labelProp, defaultValue = 0, onValueChange, readOnly, className, ...rest } = props;
@@ -51,28 +47,30 @@ var Rating = React__namespace.forwardRef(
51
47
  const handleMouseLeave = React__namespace.useCallback(() => {
52
48
  setHoveredIndex(-1);
53
49
  }, []);
54
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cn("inline-flex items-center gap-1", className), ...rest, children: [
55
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex items-center", onMouseLeave: handleMouseLeave, children: Array.from({ length: count }).map((_, index) => {
50
+ return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { ref, display: "inline-flex", alignItems: "center", gap: 4, className, ...rest, children: [
51
+ /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { display: "inline-flex", alignItems: "center", onMouseLeave: handleMouseLeave, children: Array.from({ length: count }).map((_, index) => {
56
52
  const filled = index < highlightedIndex;
57
53
  const starIndex = index + 1;
58
54
  return /* @__PURE__ */ jsxRuntime.jsx(
59
- "button",
55
+ gui.View,
60
56
  {
61
- type: "button",
57
+ render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
62
58
  tabIndex: readOnly ? -1 : 0,
63
59
  "aria-label": `Rate ${starIndex} of ${count}`,
64
- className: cn(
65
- "inline-flex items-center justify-center w-5 h-5 text-current",
66
- readOnly ? "cursor-default" : "cursor-pointer"
67
- ),
60
+ display: "inline-flex",
61
+ alignItems: "center",
62
+ justifyContent: "center",
63
+ width: 20,
64
+ height: 20,
65
+ cursor: readOnly ? "default" : "pointer",
68
66
  onClick: handleClick(starIndex),
69
67
  onMouseEnter: handleMouseEnter(index),
70
- children: filled ? /* @__PURE__ */ jsxRuntime.jsx(StarFilledIcon, { className: "w-5 h-5" }) : /* @__PURE__ */ jsxRuntime.jsx(StarOutlineIcon, { className: "w-5 h-5" })
68
+ children: filled ? /* @__PURE__ */ jsxRuntime.jsx(StarFilledIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(StarOutlineIcon, {})
71
69
  },
72
70
  index
73
71
  );
74
72
  }) }),
75
- label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: label })
73
+ label && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 14, children: label })
76
74
  ] });
77
75
  }
78
76
  );
package/dist/rating.js CHANGED
@@ -1,15 +1,11 @@
1
1
  "use client";
2
+ import { XStack, View, 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 } from 'react/jsx-runtime';
6
5
 
7
6
  // src/rating.tsx
8
- function cn(...inputs) {
9
- return twMerge(clsx(inputs));
10
- }
11
- var StarFilledIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) });
12
- var StarOutlineIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z", strokeWidth: "1.5" }) });
7
+ var StarFilledIcon = () => /* @__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", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) });
8
+ var StarOutlineIcon = () => /* @__PURE__ */ jsx("svg", { width: 20, height: 20, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z", strokeWidth: "1.5" }) });
13
9
  var Rating = React.forwardRef(
14
10
  function Rating2(props, ref) {
15
11
  const { count = 5, label: labelProp, defaultValue = 0, onValueChange, readOnly, className, ...rest } = props;
@@ -29,28 +25,30 @@ var Rating = React.forwardRef(
29
25
  const handleMouseLeave = React.useCallback(() => {
30
26
  setHoveredIndex(-1);
31
27
  }, []);
32
- return /* @__PURE__ */ jsxs("div", { ref, className: cn("inline-flex items-center gap-1", className), ...rest, children: [
33
- /* @__PURE__ */ jsx("div", { className: "inline-flex items-center", onMouseLeave: handleMouseLeave, children: Array.from({ length: count }).map((_, index) => {
28
+ return /* @__PURE__ */ jsxs(XStack, { ref, display: "inline-flex", alignItems: "center", gap: 4, className, ...rest, children: [
29
+ /* @__PURE__ */ jsx(XStack, { display: "inline-flex", alignItems: "center", onMouseLeave: handleMouseLeave, children: Array.from({ length: count }).map((_, index) => {
34
30
  const filled = index < highlightedIndex;
35
31
  const starIndex = index + 1;
36
32
  return /* @__PURE__ */ jsx(
37
- "button",
33
+ View,
38
34
  {
39
- type: "button",
35
+ render: /* @__PURE__ */ jsx("button", { type: "button" }),
40
36
  tabIndex: readOnly ? -1 : 0,
41
37
  "aria-label": `Rate ${starIndex} of ${count}`,
42
- className: cn(
43
- "inline-flex items-center justify-center w-5 h-5 text-current",
44
- readOnly ? "cursor-default" : "cursor-pointer"
45
- ),
38
+ display: "inline-flex",
39
+ alignItems: "center",
40
+ justifyContent: "center",
41
+ width: 20,
42
+ height: 20,
43
+ cursor: readOnly ? "default" : "pointer",
46
44
  onClick: handleClick(starIndex),
47
45
  onMouseEnter: handleMouseEnter(index),
48
- children: filled ? /* @__PURE__ */ jsx(StarFilledIcon, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx(StarOutlineIcon, { className: "w-5 h-5" })
46
+ children: filled ? /* @__PURE__ */ jsx(StarFilledIcon, {}) : /* @__PURE__ */ jsx(StarOutlineIcon, {})
49
47
  },
50
48
  index
51
49
  );
52
50
  }) }),
53
- label && /* @__PURE__ */ jsx("span", { className: "text-sm", children: label })
51
+ label && /* @__PURE__ */ jsx(Text, { fontSize: 14, children: label })
54
52
  ] });
55
53
  }
56
54
  );
package/dist/slider.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) {
@@ -28,9 +26,11 @@ function _interopNamespace(e) {
28
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
27
 
30
28
  // src/slider.tsx
31
- function cn(...inputs) {
32
- return tailwindMerge.twMerge(clsx.clsx(inputs));
33
- }
29
+ var MUTED = "var(--color-text-secondary)";
30
+ var TRACK = "var(--color-border-divider)";
31
+ var ACTIVE = "var(--color-link-primary)";
32
+ var ACTIVE_HOVER = "var(--color-link-primary-hover)";
33
+ var WHITE = "var(--color-white)";
34
34
  var Slider = React__namespace.forwardRef(
35
35
  function Slider2(props, ref) {
36
36
  const {
@@ -63,21 +63,22 @@ var Slider = React__namespace.forwardRef(
63
63
  const handleSlideEnd = React__namespace.useCallback(() => {
64
64
  onValueCommit?.(latest.current);
65
65
  }, [onValueCommit]);
66
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
67
- label && !showValue && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
68
- label && showValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
69
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
70
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
66
+ return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { className, gap: 4, children: [
67
+ label && !showValue && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 14, fontWeight: "500", color: MUTED, children: label }),
68
+ label && showValue && /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", justifyContent: "space-between", children: [
69
+ /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 14, fontWeight: "500", color: MUTED, children: label }),
70
+ /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 14, color: MUTED, children: (value ?? defaultValue ?? [])?.join(", ") })
71
71
  ] }),
72
72
  /* @__PURE__ */ jsxRuntime.jsxs(
73
73
  gui.Slider,
74
74
  {
75
75
  ref,
76
- unstyled: true,
77
- className: cn(
78
- "relative flex w-full touch-none select-none items-center",
79
- hasMarkLabel && "mb-6"
80
- ),
76
+ position: "relative",
77
+ flexDirection: "row",
78
+ width: "100%",
79
+ userSelect: "none",
80
+ alignItems: "center",
81
+ marginBottom: hasMarkLabel ? 24 : 0,
81
82
  value,
82
83
  defaultValue,
83
84
  min,
@@ -89,33 +90,23 @@ var Slider = React__namespace.forwardRef(
89
90
  onValueChange: handleValueChange,
90
91
  onSlideEnd: handleSlideEnd,
91
92
  children: [
92
- /* @__PURE__ */ jsxRuntime.jsx(
93
- gui.Slider.Track,
94
- {
95
- unstyled: true,
96
- className: "relative grow h-1.5 rounded-full bg-border-divider",
97
- children: /* @__PURE__ */ jsxRuntime.jsx(
98
- gui.Slider.TrackActive,
99
- {
100
- unstyled: true,
101
- className: "absolute h-full rounded-full bg-link-primary"
102
- }
103
- )
104
- }
105
- ),
93
+ /* @__PURE__ */ jsxRuntime.jsx(gui.Slider.Track, { unstyled: true, position: "relative", flexGrow: 1, height: 6, borderRadius: 9999, backgroundColor: TRACK, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Slider.TrackActive, { unstyled: true, position: "absolute", height: "100%", borderRadius: 9999, backgroundColor: ACTIVE }) }),
106
94
  resolvedValue?.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
107
95
  gui.Slider.Thumb,
108
96
  {
109
97
  index,
110
98
  unstyled: true,
111
- className: cn(
112
- "block h-5 w-5",
113
- "rounded-full border-2 border-link-primary bg-white",
114
- "shadow-sm transition-colors",
115
- "hover:border-link-primary-hover",
116
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-link-primary focus-visible:ring-offset-2",
117
- "disabled:pointer-events-none disabled:opacity-50"
118
- )
99
+ width: 20,
100
+ height: 20,
101
+ borderRadius: 9999,
102
+ borderWidth: 2,
103
+ borderColor: ACTIVE,
104
+ backgroundColor: WHITE,
105
+ boxShadow: "0 1px 2px 0 rgba(0,0,0,0.05)",
106
+ transition: "quick",
107
+ hoverStyle: { borderColor: ACTIVE_HOVER },
108
+ focusStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: ACTIVE, outlineOffset: 2 },
109
+ disabledStyle: { pointerEvents: "none", opacity: 0.5 }
119
110
  },
120
111
  index
121
112
  ))
@@ -130,20 +121,12 @@ function SliderMarks(props) {
130
121
  const { marks, min, max } = props;
131
122
  if (!marks?.length) return null;
132
123
  const range = max - min;
133
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full h-4", children: marks.map((mark, index) => {
124
+ return /* @__PURE__ */ jsxRuntime.jsx(gui.View, { position: "relative", width: "100%", height: 16, children: marks.map((mark, index) => {
134
125
  const percent = (mark.value - min) / range * 100;
135
- return /* @__PURE__ */ jsxRuntime.jsxs(
136
- "div",
137
- {
138
- className: "absolute flex flex-col items-center -translate-x-1/2",
139
- style: { left: `${percent}%` },
140
- children: [
141
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-0.5 bg-border-divider" }),
142
- mark.label != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 text-xs text-text-secondary whitespace-nowrap", children: mark.label })
143
- ]
144
- },
145
- index
146
- );
126
+ return /* @__PURE__ */ jsxRuntime.jsxs(gui.View, { position: "absolute", left: `${percent}%`, alignItems: "center", children: [
127
+ /* @__PURE__ */ jsxRuntime.jsx(gui.View, { width: 2, height: 6, backgroundColor: TRACK }),
128
+ mark.label != null && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { marginTop: 2, fontSize: 12, color: MUTED, children: mark.label })
129
+ ] }, index);
147
130
  }) });
148
131
  }
149
132
 
package/dist/slider.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use client";
2
- import { Slider as Slider$1 } from '@hanzo/gui';
2
+ import { YStack, Text, XStack, Slider as Slider$1, View } from '@hanzo/gui';
3
3
  import * as React from 'react';
4
- import { clsx } from 'clsx';
5
- import { twMerge } from 'tailwind-merge';
6
4
  import { jsxs, jsx } from 'react/jsx-runtime';
7
5
 
8
6
  // src/slider.tsx
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
7
+ var MUTED = "var(--color-text-secondary)";
8
+ var TRACK = "var(--color-border-divider)";
9
+ var ACTIVE = "var(--color-link-primary)";
10
+ var ACTIVE_HOVER = "var(--color-link-primary-hover)";
11
+ var WHITE = "var(--color-white)";
12
12
  var Slider = React.forwardRef(
13
13
  function Slider2(props, ref) {
14
14
  const {
@@ -41,21 +41,22 @@ var Slider = React.forwardRef(
41
41
  const handleSlideEnd = React.useCallback(() => {
42
42
  onValueCommit?.(latest.current);
43
43
  }, [onValueCommit]);
44
- return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
45
- label && !showValue && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
46
- label && showValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
47
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
48
- /* @__PURE__ */ jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
44
+ return /* @__PURE__ */ jsxs(YStack, { className, gap: 4, children: [
45
+ label && !showValue && /* @__PURE__ */ jsx(Text, { fontSize: 14, fontWeight: "500", color: MUTED, children: label }),
46
+ label && showValue && /* @__PURE__ */ jsxs(XStack, { alignItems: "center", justifyContent: "space-between", children: [
47
+ /* @__PURE__ */ jsx(Text, { fontSize: 14, fontWeight: "500", color: MUTED, children: label }),
48
+ /* @__PURE__ */ jsx(Text, { fontSize: 14, color: MUTED, children: (value ?? defaultValue ?? [])?.join(", ") })
49
49
  ] }),
50
50
  /* @__PURE__ */ jsxs(
51
51
  Slider$1,
52
52
  {
53
53
  ref,
54
- unstyled: true,
55
- className: cn(
56
- "relative flex w-full touch-none select-none items-center",
57
- hasMarkLabel && "mb-6"
58
- ),
54
+ position: "relative",
55
+ flexDirection: "row",
56
+ width: "100%",
57
+ userSelect: "none",
58
+ alignItems: "center",
59
+ marginBottom: hasMarkLabel ? 24 : 0,
59
60
  value,
60
61
  defaultValue,
61
62
  min,
@@ -67,33 +68,23 @@ var Slider = React.forwardRef(
67
68
  onValueChange: handleValueChange,
68
69
  onSlideEnd: handleSlideEnd,
69
70
  children: [
70
- /* @__PURE__ */ jsx(
71
- Slider$1.Track,
72
- {
73
- unstyled: true,
74
- className: "relative grow h-1.5 rounded-full bg-border-divider",
75
- children: /* @__PURE__ */ jsx(
76
- Slider$1.TrackActive,
77
- {
78
- unstyled: true,
79
- className: "absolute h-full rounded-full bg-link-primary"
80
- }
81
- )
82
- }
83
- ),
71
+ /* @__PURE__ */ jsx(Slider$1.Track, { unstyled: true, position: "relative", flexGrow: 1, height: 6, borderRadius: 9999, backgroundColor: TRACK, children: /* @__PURE__ */ jsx(Slider$1.TrackActive, { unstyled: true, position: "absolute", height: "100%", borderRadius: 9999, backgroundColor: ACTIVE }) }),
84
72
  resolvedValue?.map((_, index) => /* @__PURE__ */ jsx(
85
73
  Slider$1.Thumb,
86
74
  {
87
75
  index,
88
76
  unstyled: true,
89
- className: cn(
90
- "block h-5 w-5",
91
- "rounded-full border-2 border-link-primary bg-white",
92
- "shadow-sm transition-colors",
93
- "hover:border-link-primary-hover",
94
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-link-primary focus-visible:ring-offset-2",
95
- "disabled:pointer-events-none disabled:opacity-50"
96
- )
77
+ width: 20,
78
+ height: 20,
79
+ borderRadius: 9999,
80
+ borderWidth: 2,
81
+ borderColor: ACTIVE,
82
+ backgroundColor: WHITE,
83
+ boxShadow: "0 1px 2px 0 rgba(0,0,0,0.05)",
84
+ transition: "quick",
85
+ hoverStyle: { borderColor: ACTIVE_HOVER },
86
+ focusStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: ACTIVE, outlineOffset: 2 },
87
+ disabledStyle: { pointerEvents: "none", opacity: 0.5 }
97
88
  },
98
89
  index
99
90
  ))
@@ -108,20 +99,12 @@ function SliderMarks(props) {
108
99
  const { marks, min, max } = props;
109
100
  if (!marks?.length) return null;
110
101
  const range = max - min;
111
- return /* @__PURE__ */ jsx("div", { className: "relative w-full h-4", children: marks.map((mark, index) => {
102
+ return /* @__PURE__ */ jsx(View, { position: "relative", width: "100%", height: 16, children: marks.map((mark, index) => {
112
103
  const percent = (mark.value - min) / range * 100;
113
- return /* @__PURE__ */ jsxs(
114
- "div",
115
- {
116
- className: "absolute flex flex-col items-center -translate-x-1/2",
117
- style: { left: `${percent}%` },
118
- children: [
119
- /* @__PURE__ */ jsx("div", { className: "h-1.5 w-0.5 bg-border-divider" }),
120
- mark.label != null && /* @__PURE__ */ jsx("span", { className: "mt-0.5 text-xs text-text-secondary whitespace-nowrap", children: mark.label })
121
- ]
122
- },
123
- index
124
- );
104
+ return /* @__PURE__ */ jsxs(View, { position: "absolute", left: `${percent}%`, alignItems: "center", children: [
105
+ /* @__PURE__ */ jsx(View, { width: 2, height: 6, backgroundColor: TRACK }),
106
+ mark.label != null && /* @__PURE__ */ jsx(Text, { marginTop: 2, fontSize: 12, color: MUTED, children: mark.label })
107
+ ] }, index);
125
108
  }) });
126
109
  }
127
110