@luxfi/ui 7.4.11 → 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.
- package/dist/alert.cjs +68 -46
- package/dist/alert.js +69 -46
- package/dist/avatar.cjs +49 -46
- package/dist/avatar.js +52 -48
- package/dist/badge.cjs +82 -49
- package/dist/badge.js +83 -50
- package/dist/checkbox.cjs +42 -75
- package/dist/checkbox.js +43 -76
- package/dist/chrome.cjs +3 -7
- package/dist/chrome.js +3 -7
- package/dist/close-button.cjs +3 -7
- package/dist/close-button.js +3 -7
- package/dist/dialog.cjs +3 -7
- package/dist/dialog.js +3 -7
- package/dist/drawer.cjs +3 -7
- package/dist/drawer.js +3 -7
- package/dist/empty-state.cjs +13 -13
- package/dist/empty-state.js +13 -13
- package/dist/expiration-selector.cjs +58 -63
- package/dist/expiration-selector.js +58 -63
- package/dist/greeks-display.cjs +48 -39
- package/dist/greeks-display.js +48 -39
- package/dist/index.cjs +756 -703
- package/dist/index.js +757 -704
- package/dist/option-chain.cjs +89 -67
- package/dist/option-chain.js +89 -67
- package/dist/option-position.cjs +88 -85
- package/dist/option-position.js +88 -85
- package/dist/pnl-diagram.cjs +20 -20
- package/dist/pnl-diagram.js +20 -20
- package/dist/popover.cjs +3 -7
- package/dist/popover.js +3 -7
- package/dist/progress.cjs +15 -22
- package/dist/progress.d.cts +6 -6
- package/dist/progress.d.ts +6 -6
- package/dist/progress.js +15 -22
- package/dist/radio.cjs +35 -67
- package/dist/radio.d.cts +18 -18
- package/dist/radio.d.ts +18 -18
- package/dist/radio.js +36 -68
- package/dist/slider.cjs +33 -49
- package/dist/slider.js +34 -50
- package/dist/switch.cjs +48 -55
- package/dist/switch.js +49 -56
- package/dist/tag.cjs +112 -69
- package/dist/tag.js +113 -69
- package/dist/tooltip.cjs +28 -17
- package/dist/tooltip.js +30 -18
- package/package.json +1 -1
- package/src/alert.tsx +78 -45
- package/src/avatar.tsx +54 -37
- package/src/badge.tsx +65 -44
- package/src/checkbox.tsx +70 -89
- package/src/close-button.tsx +3 -8
- package/src/empty-state.tsx +21 -17
- package/src/expiration-selector.tsx +84 -66
- package/src/greeks-display.tsx +59 -51
- package/src/input-group.tsx +38 -24
- package/src/option-chain.tsx +154 -104
- package/src/option-position.tsx +136 -114
- package/src/pin-input.tsx +37 -29
- package/src/pnl-diagram.tsx +36 -28
- package/src/progress.tsx +17 -21
- package/src/radio.tsx +56 -75
- package/src/slider.tsx +43 -44
- package/src/strategy-builder.tsx +245 -156
- package/src/switch.tsx +63 -64
- package/src/tag.tsx +89 -51
- package/src/tooltip.tsx +21 -13
- package/tokens.css +18 -0
package/dist/pnl-diagram.js
CHANGED
|
@@ -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
|
-
|
|
137
|
+
View,
|
|
142
138
|
{
|
|
143
139
|
ref,
|
|
144
|
-
|
|
140
|
+
unstyled: true,
|
|
141
|
+
width: "100%",
|
|
142
|
+
className,
|
|
145
143
|
...rest,
|
|
146
144
|
children: [
|
|
147
|
-
/* @__PURE__ */ jsx(
|
|
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
|
-
|
|
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(
|
|
393
|
-
/* @__PURE__ */ jsxs(
|
|
394
|
-
/* @__PURE__ */ jsx(
|
|
395
|
-
/* @__PURE__ */ jsx(
|
|
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(
|
|
395
|
+
legs.map((leg, i) => /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 6, children: [
|
|
398
396
|
/* @__PURE__ */ jsx(
|
|
399
|
-
|
|
397
|
+
View,
|
|
400
398
|
{
|
|
401
|
-
|
|
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(
|
|
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(
|
|
420
|
-
/* @__PURE__ */ jsx(
|
|
421
|
-
/* @__PURE__ */ jsxs(
|
|
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
|
|
70
|
+
className,
|
|
76
71
|
...rest,
|
|
77
72
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
73
|
"svg",
|
|
79
74
|
{
|
|
80
|
-
|
|
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
|
|
48
|
+
className,
|
|
54
49
|
...rest,
|
|
55
50
|
children: children ?? /* @__PURE__ */ jsx(
|
|
56
51
|
"svg",
|
|
57
52
|
{
|
|
58
|
-
|
|
53
|
+
width: 20,
|
|
54
|
+
height: 20,
|
|
59
55
|
viewBox: "0 0 20 20",
|
|
60
56
|
fill: "none",
|
|
61
57
|
"aria-hidden": "true",
|
package/dist/progress.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,14 +26,11 @@ function _interopNamespace(e) {
|
|
|
28
26
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
27
|
|
|
30
28
|
// src/progress.tsx
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
md: "h-2",
|
|
37
|
-
lg: "h-3",
|
|
38
|
-
xl: "h-4"
|
|
29
|
+
var SIZE = {
|
|
30
|
+
sm: 4,
|
|
31
|
+
md: 8,
|
|
32
|
+
lg: 12,
|
|
33
|
+
xl: 16
|
|
39
34
|
};
|
|
40
35
|
function normalizeValue(value, min, max) {
|
|
41
36
|
if (value == null) return 0;
|
|
@@ -51,7 +46,6 @@ var Progress = React__namespace.forwardRef(
|
|
|
51
46
|
size = "md",
|
|
52
47
|
color,
|
|
53
48
|
trackProps,
|
|
54
|
-
className,
|
|
55
49
|
style,
|
|
56
50
|
w,
|
|
57
51
|
flex,
|
|
@@ -70,6 +64,7 @@ var Progress = React__namespace.forwardRef(
|
|
|
70
64
|
}
|
|
71
65
|
};
|
|
72
66
|
const rootStyle = {
|
|
67
|
+
position: "relative",
|
|
73
68
|
...style,
|
|
74
69
|
...w !== void 0 && { width: w === "full" ? "100%" : w },
|
|
75
70
|
...flex !== void 0 && { flex }
|
|
@@ -78,7 +73,6 @@ var Progress = React__namespace.forwardRef(
|
|
|
78
73
|
"div",
|
|
79
74
|
{
|
|
80
75
|
ref,
|
|
81
|
-
className: cn("relative", className),
|
|
82
76
|
style: rootStyle,
|
|
83
77
|
...rest,
|
|
84
78
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -87,22 +81,21 @@ var Progress = React__namespace.forwardRef(
|
|
|
87
81
|
value: percent,
|
|
88
82
|
max: 100,
|
|
89
83
|
unstyled: true,
|
|
90
|
-
className:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
),
|
|
84
|
+
className: trackProps?.className,
|
|
85
|
+
width: "100%",
|
|
86
|
+
overflow: "hidden",
|
|
87
|
+
borderRadius: 9999,
|
|
88
|
+
height: SIZE[size],
|
|
89
|
+
backgroundColor: "var(--color-progress-track)",
|
|
96
90
|
style: trackStyle,
|
|
97
91
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
92
|
gui.Progress.Indicator,
|
|
99
93
|
{
|
|
100
94
|
unstyled: true,
|
|
101
95
|
transition: "slow",
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
),
|
|
96
|
+
height: "100%",
|
|
97
|
+
borderRadius: 9999,
|
|
98
|
+
backgroundColor: color ? void 0 : "var(--color-progress-indicator)",
|
|
106
99
|
style: {
|
|
107
100
|
...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
|
|
108
101
|
}
|
package/dist/progress.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
4
|
-
readonly sm:
|
|
5
|
-
readonly md:
|
|
6
|
-
readonly lg:
|
|
7
|
-
readonly xl:
|
|
3
|
+
declare const SIZE: {
|
|
4
|
+
readonly sm: 4;
|
|
5
|
+
readonly md: 8;
|
|
6
|
+
readonly lg: 12;
|
|
7
|
+
readonly xl: 16;
|
|
8
8
|
};
|
|
9
|
-
type Size = keyof typeof
|
|
9
|
+
type Size = keyof typeof SIZE;
|
|
10
10
|
interface TrackProps {
|
|
11
11
|
readonly borderStartRadius?: number | string;
|
|
12
12
|
readonly borderEndRadius?: number | string;
|
package/dist/progress.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
4
|
-
readonly sm:
|
|
5
|
-
readonly md:
|
|
6
|
-
readonly lg:
|
|
7
|
-
readonly xl:
|
|
3
|
+
declare const SIZE: {
|
|
4
|
+
readonly sm: 4;
|
|
5
|
+
readonly md: 8;
|
|
6
|
+
readonly lg: 12;
|
|
7
|
+
readonly xl: 16;
|
|
8
8
|
};
|
|
9
|
-
type Size = keyof typeof
|
|
9
|
+
type Size = keyof typeof SIZE;
|
|
10
10
|
interface TrackProps {
|
|
11
11
|
readonly borderStartRadius?: number | string;
|
|
12
12
|
readonly borderEndRadius?: number | string;
|
package/dist/progress.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Progress as Progress$1 } from '@hanzo/gui';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
6
4
|
import { jsx } from 'react/jsx-runtime';
|
|
7
5
|
|
|
8
6
|
// src/progress.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
md: "h-2",
|
|
15
|
-
lg: "h-3",
|
|
16
|
-
xl: "h-4"
|
|
7
|
+
var SIZE = {
|
|
8
|
+
sm: 4,
|
|
9
|
+
md: 8,
|
|
10
|
+
lg: 12,
|
|
11
|
+
xl: 16
|
|
17
12
|
};
|
|
18
13
|
function normalizeValue(value, min, max) {
|
|
19
14
|
if (value == null) return 0;
|
|
@@ -29,7 +24,6 @@ var Progress = React.forwardRef(
|
|
|
29
24
|
size = "md",
|
|
30
25
|
color,
|
|
31
26
|
trackProps,
|
|
32
|
-
className,
|
|
33
27
|
style,
|
|
34
28
|
w,
|
|
35
29
|
flex,
|
|
@@ -48,6 +42,7 @@ var Progress = React.forwardRef(
|
|
|
48
42
|
}
|
|
49
43
|
};
|
|
50
44
|
const rootStyle = {
|
|
45
|
+
position: "relative",
|
|
51
46
|
...style,
|
|
52
47
|
...w !== void 0 && { width: w === "full" ? "100%" : w },
|
|
53
48
|
...flex !== void 0 && { flex }
|
|
@@ -56,7 +51,6 @@ var Progress = React.forwardRef(
|
|
|
56
51
|
"div",
|
|
57
52
|
{
|
|
58
53
|
ref,
|
|
59
|
-
className: cn("relative", className),
|
|
60
54
|
style: rootStyle,
|
|
61
55
|
...rest,
|
|
62
56
|
children: /* @__PURE__ */ jsx(
|
|
@@ -65,22 +59,21 @@ var Progress = React.forwardRef(
|
|
|
65
59
|
value: percent,
|
|
66
60
|
max: 100,
|
|
67
61
|
unstyled: true,
|
|
68
|
-
className:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
),
|
|
62
|
+
className: trackProps?.className,
|
|
63
|
+
width: "100%",
|
|
64
|
+
overflow: "hidden",
|
|
65
|
+
borderRadius: 9999,
|
|
66
|
+
height: SIZE[size],
|
|
67
|
+
backgroundColor: "var(--color-progress-track)",
|
|
74
68
|
style: trackStyle,
|
|
75
69
|
children: /* @__PURE__ */ jsx(
|
|
76
70
|
Progress$1.Indicator,
|
|
77
71
|
{
|
|
78
72
|
unstyled: true,
|
|
79
73
|
transition: "slow",
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
),
|
|
74
|
+
height: "100%",
|
|
75
|
+
borderRadius: 9999,
|
|
76
|
+
backgroundColor: color ? void 0 : "var(--color-progress-indicator)",
|
|
84
77
|
style: {
|
|
85
78
|
...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
|
|
86
79
|
}
|
package/dist/radio.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,35 +26,15 @@ function _interopNamespace(e) {
|
|
|
28
26
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
27
|
|
|
30
28
|
// src/radio.tsx
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
root: "gap-1.5",
|
|
37
|
-
control: "h-3 w-3",
|
|
38
|
-
indicator: "h-1.5 w-1.5",
|
|
39
|
-
label: "text-xs"
|
|
40
|
-
},
|
|
41
|
-
sm: {
|
|
42
|
-
root: "gap-1.5",
|
|
43
|
-
control: "h-3.5 w-3.5",
|
|
44
|
-
indicator: "h-1.5 w-1.5",
|
|
45
|
-
label: "text-xs"
|
|
46
|
-
},
|
|
47
|
-
md: {
|
|
48
|
-
root: "gap-2",
|
|
49
|
-
control: "h-4 w-4",
|
|
50
|
-
indicator: "h-2 w-2",
|
|
51
|
-
label: "text-sm"
|
|
52
|
-
},
|
|
53
|
-
lg: {
|
|
54
|
-
root: "gap-2.5",
|
|
55
|
-
control: "h-5 w-5",
|
|
56
|
-
indicator: "h-2.5 w-2.5",
|
|
57
|
-
label: "text-base"
|
|
58
|
-
}
|
|
29
|
+
var SIZE = {
|
|
30
|
+
xs: { rootGap: 6, control: 12, indicator: 6, label: 12 },
|
|
31
|
+
sm: { rootGap: 6, control: 14, indicator: 6, label: 12 },
|
|
32
|
+
md: { rootGap: 8, control: 16, indicator: 8, label: 14 },
|
|
33
|
+
lg: { rootGap: 10, control: 20, indicator: 10, label: 16 }
|
|
59
34
|
};
|
|
35
|
+
var INK = "var(--color-text-primary)";
|
|
36
|
+
var RESTING_BORDER = "var(--color-input-border)";
|
|
37
|
+
var OUTLINE = "var(--color-gray-500)";
|
|
60
38
|
var RadioSizeContext = React__namespace.createContext("md");
|
|
61
39
|
var RadioGroupBase = React__namespace.forwardRef(
|
|
62
40
|
function RadioGroup(props, ref) {
|
|
@@ -73,7 +51,6 @@ var RadioGroupBase = React__namespace.forwardRef(
|
|
|
73
51
|
value,
|
|
74
52
|
onValueChange,
|
|
75
53
|
size = "md",
|
|
76
|
-
className,
|
|
77
54
|
...rest
|
|
78
55
|
} = props;
|
|
79
56
|
const handleValueChange = React__namespace.useCallback(
|
|
@@ -95,11 +72,9 @@ var RadioGroupBase = React__namespace.forwardRef(
|
|
|
95
72
|
defaultValue,
|
|
96
73
|
value: value ?? void 0,
|
|
97
74
|
onValueChange: handleValueChange,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
className
|
|
102
|
-
),
|
|
75
|
+
display: "flex",
|
|
76
|
+
flexDirection: orientation === "vertical" ? "column" : "row",
|
|
77
|
+
gap: orientation === "vertical" ? 12 : 24,
|
|
103
78
|
...rest,
|
|
104
79
|
children
|
|
105
80
|
}
|
|
@@ -111,19 +86,20 @@ var NOOP = () => {
|
|
|
111
86
|
};
|
|
112
87
|
var RadioBase = React__namespace.forwardRef(
|
|
113
88
|
function Radio(props, ref) {
|
|
114
|
-
const { children, inputProps, rootRef, value, disabled,
|
|
89
|
+
const { children, inputProps, rootRef, value, disabled, ...rest } = props;
|
|
115
90
|
const size = React__namespace.useContext(RadioSizeContext);
|
|
116
|
-
const
|
|
91
|
+
const s = SIZE[size];
|
|
117
92
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
118
|
-
|
|
93
|
+
gui.Label,
|
|
119
94
|
{
|
|
120
95
|
ref: rootRef,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
96
|
+
unstyled: true,
|
|
97
|
+
flexDirection: "row",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
gap: s.rootGap,
|
|
100
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
101
|
+
userSelect: "none",
|
|
102
|
+
opacity: disabled ? 0.5 : 1,
|
|
127
103
|
"data-disabled": disabled || void 0,
|
|
128
104
|
...rest,
|
|
129
105
|
children: [
|
|
@@ -133,32 +109,24 @@ var RadioBase = React__namespace.forwardRef(
|
|
|
133
109
|
unstyled: true,
|
|
134
110
|
value,
|
|
135
111
|
disabled,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
unstyled: true,
|
|
148
|
-
className: cn(
|
|
149
|
-
"block rounded-full bg-gray-800 dark:bg-white",
|
|
150
|
-
sizeClasses.indicator
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
)
|
|
112
|
+
flexShrink: 0,
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
width: s.control,
|
|
116
|
+
height: s.control,
|
|
117
|
+
borderRadius: 9999,
|
|
118
|
+
borderWidth: 2,
|
|
119
|
+
borderColor: RESTING_BORDER,
|
|
120
|
+
transition: "quicker",
|
|
121
|
+
focusStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: OUTLINE, outlineOffset: 2 },
|
|
122
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.RadioGroup.Indicator, { unstyled: true, borderRadius: 9999, width: s.indicator, height: s.indicator, backgroundColor: INK })
|
|
154
123
|
}
|
|
155
124
|
),
|
|
156
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
157
126
|
"input",
|
|
158
127
|
{
|
|
159
128
|
ref,
|
|
160
129
|
type: "radio",
|
|
161
|
-
className: "sr-only",
|
|
162
130
|
value,
|
|
163
131
|
disabled,
|
|
164
132
|
tabIndex: -1,
|
|
@@ -166,8 +134,8 @@ var RadioBase = React__namespace.forwardRef(
|
|
|
166
134
|
onChange: NOOP,
|
|
167
135
|
...inputProps
|
|
168
136
|
}
|
|
169
|
-
),
|
|
170
|
-
children != null && /* @__PURE__ */ jsxRuntime.jsx(
|
|
137
|
+
) }),
|
|
138
|
+
children != null && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: s.label, children })
|
|
171
139
|
]
|
|
172
140
|
}
|
|
173
141
|
);
|
package/dist/radio.d.cts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
3
|
+
declare const SIZE: {
|
|
4
4
|
readonly xs: {
|
|
5
|
-
readonly
|
|
6
|
-
readonly control:
|
|
7
|
-
readonly indicator:
|
|
8
|
-
readonly label:
|
|
5
|
+
readonly rootGap: 6;
|
|
6
|
+
readonly control: 12;
|
|
7
|
+
readonly indicator: 6;
|
|
8
|
+
readonly label: 12;
|
|
9
9
|
};
|
|
10
10
|
readonly sm: {
|
|
11
|
-
readonly
|
|
12
|
-
readonly control:
|
|
13
|
-
readonly indicator:
|
|
14
|
-
readonly label:
|
|
11
|
+
readonly rootGap: 6;
|
|
12
|
+
readonly control: 14;
|
|
13
|
+
readonly indicator: 6;
|
|
14
|
+
readonly label: 12;
|
|
15
15
|
};
|
|
16
16
|
readonly md: {
|
|
17
|
-
readonly
|
|
18
|
-
readonly control:
|
|
19
|
-
readonly indicator:
|
|
20
|
-
readonly label:
|
|
17
|
+
readonly rootGap: 8;
|
|
18
|
+
readonly control: 16;
|
|
19
|
+
readonly indicator: 8;
|
|
20
|
+
readonly label: 14;
|
|
21
21
|
};
|
|
22
22
|
readonly lg: {
|
|
23
|
-
readonly
|
|
24
|
-
readonly control:
|
|
25
|
-
readonly indicator:
|
|
26
|
-
readonly label:
|
|
23
|
+
readonly rootGap: 10;
|
|
24
|
+
readonly control: 20;
|
|
25
|
+
readonly indicator: 10;
|
|
26
|
+
readonly label: 16;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
type RadioSize = keyof typeof
|
|
29
|
+
type RadioSize = keyof typeof SIZE;
|
|
30
30
|
interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'dir'> {
|
|
31
31
|
name?: string;
|
|
32
32
|
required?: boolean;
|
package/dist/radio.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
3
|
+
declare const SIZE: {
|
|
4
4
|
readonly xs: {
|
|
5
|
-
readonly
|
|
6
|
-
readonly control:
|
|
7
|
-
readonly indicator:
|
|
8
|
-
readonly label:
|
|
5
|
+
readonly rootGap: 6;
|
|
6
|
+
readonly control: 12;
|
|
7
|
+
readonly indicator: 6;
|
|
8
|
+
readonly label: 12;
|
|
9
9
|
};
|
|
10
10
|
readonly sm: {
|
|
11
|
-
readonly
|
|
12
|
-
readonly control:
|
|
13
|
-
readonly indicator:
|
|
14
|
-
readonly label:
|
|
11
|
+
readonly rootGap: 6;
|
|
12
|
+
readonly control: 14;
|
|
13
|
+
readonly indicator: 6;
|
|
14
|
+
readonly label: 12;
|
|
15
15
|
};
|
|
16
16
|
readonly md: {
|
|
17
|
-
readonly
|
|
18
|
-
readonly control:
|
|
19
|
-
readonly indicator:
|
|
20
|
-
readonly label:
|
|
17
|
+
readonly rootGap: 8;
|
|
18
|
+
readonly control: 16;
|
|
19
|
+
readonly indicator: 8;
|
|
20
|
+
readonly label: 14;
|
|
21
21
|
};
|
|
22
22
|
readonly lg: {
|
|
23
|
-
readonly
|
|
24
|
-
readonly control:
|
|
25
|
-
readonly indicator:
|
|
26
|
-
readonly label:
|
|
23
|
+
readonly rootGap: 10;
|
|
24
|
+
readonly control: 20;
|
|
25
|
+
readonly indicator: 10;
|
|
26
|
+
readonly label: 16;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
type RadioSize = keyof typeof
|
|
29
|
+
type RadioSize = keyof typeof SIZE;
|
|
30
30
|
interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'dir'> {
|
|
31
31
|
name?: string;
|
|
32
32
|
required?: boolean;
|