@luxfi/ui 7.4.12 → 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.
@@ -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
  });
package/dist/radio.cjs CHANGED
@@ -64,7 +64,6 @@ var RadioGroupBase = React__namespace.forwardRef(
64
64
  gui.RadioGroup,
65
65
  {
66
66
  ref,
67
- unstyled: true,
68
67
  name,
69
68
  required,
70
69
  disabled: disabled || readOnly,
package/dist/radio.js CHANGED
@@ -42,7 +42,6 @@ var RadioGroupBase = React.forwardRef(
42
42
  RadioGroup,
43
43
  {
44
44
  ref,
45
- unstyled: true,
46
45
  name,
47
46
  required,
48
47
  disabled: disabled || readOnly,
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
@@ -73,7 +73,6 @@ var Slider = React__namespace.forwardRef(
73
73
  gui.Slider,
74
74
  {
75
75
  ref,
76
- unstyled: true,
77
76
  position: "relative",
78
77
  flexDirection: "row",
79
78
  width: "100%",
package/dist/slider.js CHANGED
@@ -51,7 +51,6 @@ var Slider = React.forwardRef(
51
51
  Slider$1,
52
52
  {
53
53
  ref,
54
- unstyled: true,
55
54
  position: "relative",
56
55
  flexDirection: "row",
57
56
  width: "100%",