@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.
- package/dist/avatar.cjs +0 -1
- package/dist/avatar.js +0 -1
- package/dist/index.cjs +320 -208
- package/dist/index.js +320 -208
- package/dist/input-group.cjs +36 -19
- package/dist/input-group.js +37 -19
- package/dist/pin-input.cjs +30 -29
- package/dist/pin-input.js +30 -29
- package/dist/progress-circle.cjs +40 -22
- package/dist/progress-circle.d.cts +5 -5
- package/dist/progress-circle.d.ts +5 -5
- package/dist/progress-circle.js +41 -22
- package/dist/radio.cjs +0 -1
- package/dist/radio.js +0 -1
- package/dist/rating.cjs +15 -17
- package/dist/rating.js +15 -17
- package/dist/slider.cjs +0 -1
- package/dist/slider.js +0 -1
- package/dist/strategy-builder.cjs +194 -115
- package/dist/strategy-builder.js +194 -115
- package/dist/tag.cjs +18 -15
- package/dist/tag.js +18 -15
- package/package.json +1 -1
- package/src/avatar.tsx +1 -2
- package/src/expiration-selector.tsx +6 -6
- package/src/input-group.tsx +2 -2
- package/src/option-position.tsx +9 -2
- package/src/progress-circle.tsx +52 -28
- package/src/radio.tsx +0 -1
- package/src/rating.tsx +22 -20
- package/src/slider.tsx +0 -1
- package/src/strategy-builder.tsx +51 -42
package/dist/progress-circle.js
CHANGED
|
@@ -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,
|
|
13
|
-
sm: { size: 32, thickness: 5,
|
|
14
|
-
md: { size: 40, thickness: 6,
|
|
15
|
-
lg: { size: 48, thickness: 7,
|
|
16
|
-
xl: { size: 64, thickness: 8,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
119
|
+
const { fontSize } = SIZE_MAP[sizeKey];
|
|
111
120
|
return /* @__PURE__ */ jsx(
|
|
112
|
-
|
|
121
|
+
View,
|
|
113
122
|
{
|
|
114
123
|
ref,
|
|
115
124
|
"aria-live": "polite",
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
package/dist/radio.js
CHANGED
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
|
-
|
|
31
|
-
|
|
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(
|
|
55
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
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
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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, {
|
|
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(
|
|
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
|
-
|
|
9
|
-
|
|
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(
|
|
33
|
-
/* @__PURE__ */ jsx(
|
|
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
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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, {
|
|
46
|
+
children: filled ? /* @__PURE__ */ jsx(StarFilledIcon, {}) : /* @__PURE__ */ jsx(StarOutlineIcon, {})
|
|
49
47
|
},
|
|
50
48
|
index
|
|
51
49
|
);
|
|
52
50
|
}) }),
|
|
53
|
-
label && /* @__PURE__ */ jsx(
|
|
51
|
+
label && /* @__PURE__ */ jsx(Text, { fontSize: 14, children: label })
|
|
54
52
|
] });
|
|
55
53
|
}
|
|
56
54
|
);
|
package/dist/slider.cjs
CHANGED