@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.
- package/dist/alert.cjs +68 -46
- package/dist/alert.js +69 -46
- package/dist/avatar.cjs +49 -47
- package/dist/avatar.js +52 -49
- 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 +1053 -888
- package/dist/index.js +1054 -889
- package/dist/input-group.cjs +36 -19
- package/dist/input-group.js +37 -19
- 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/pin-input.cjs +30 -29
- package/dist/pin-input.js +30 -29
- 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-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/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 -68
- package/dist/radio.d.cts +18 -18
- package/dist/radio.d.ts +18 -18
- package/dist/radio.js +36 -69
- package/dist/rating.cjs +15 -17
- package/dist/rating.js +15 -17
- package/dist/slider.cjs +33 -50
- package/dist/slider.js +34 -51
- package/dist/strategy-builder.cjs +194 -115
- package/dist/strategy-builder.js +194 -115
- package/dist/switch.cjs +48 -55
- package/dist/switch.js +49 -56
- package/dist/tag.cjs +115 -69
- package/dist/tag.js +116 -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 -38
- 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 +143 -114
- package/src/pin-input.tsx +37 -29
- package/src/pnl-diagram.tsx +36 -28
- package/src/progress-circle.tsx +52 -28
- package/src/progress.tsx +17 -21
- package/src/radio.tsx +56 -76
- package/src/rating.tsx +22 -20
- package/src/slider.tsx +43 -45
- package/src/strategy-builder.tsx +260 -162
- 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/empty-state.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { XStack, YStack, 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 { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
5
|
|
|
7
6
|
// src/empty-state.tsx
|
|
8
|
-
function cn(...inputs) {
|
|
9
|
-
return twMerge(clsx(inputs));
|
|
10
|
-
}
|
|
11
7
|
var apos = "\u2019";
|
|
12
8
|
function upperFirst(str) {
|
|
13
9
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
14
10
|
}
|
|
15
11
|
var ICONS = {};
|
|
12
|
+
var MUTED = "var(--color-text-secondary)";
|
|
16
13
|
var EmptyState = React.forwardRef(
|
|
17
14
|
function EmptyState2(props, ref) {
|
|
18
15
|
const { title, description, term, type = "query", icon, children, className, ...rest } = props;
|
|
@@ -50,17 +47,20 @@ var EmptyState = React.forwardRef(
|
|
|
50
47
|
return icon;
|
|
51
48
|
})();
|
|
52
49
|
return /* @__PURE__ */ jsx(
|
|
53
|
-
|
|
50
|
+
XStack,
|
|
54
51
|
{
|
|
55
52
|
ref,
|
|
56
|
-
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
justifyContent: "center",
|
|
55
|
+
paddingVertical: 40,
|
|
56
|
+
className,
|
|
57
57
|
...rest,
|
|
58
|
-
children: /* @__PURE__ */ jsxs(
|
|
59
|
-
iconContent && /* @__PURE__ */ jsx(
|
|
60
|
-
descriptionContent ? /* @__PURE__ */ jsxs(
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
/* @__PURE__ */ jsx(
|
|
63
|
-
] }) : /* @__PURE__ */ jsx(
|
|
58
|
+
children: /* @__PURE__ */ jsxs(YStack, { alignItems: "center", gap: 20, children: [
|
|
59
|
+
iconContent && /* @__PURE__ */ jsx(XStack, { alignItems: "center", justifyContent: "center", children: iconContent }),
|
|
60
|
+
descriptionContent ? /* @__PURE__ */ jsxs(YStack, { alignItems: "center", gap: 8, children: [
|
|
61
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 18, fontWeight: "600", textAlign: "center", color: MUTED, children: titleContent }),
|
|
62
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 14, textAlign: "center", color: MUTED, children: descriptionContent })
|
|
63
|
+
] }) : /* @__PURE__ */ jsx(Text, { fontSize: 18, fontWeight: "600", textAlign: "center", color: MUTED, children: titleContent }),
|
|
64
64
|
children
|
|
65
65
|
] })
|
|
66
66
|
}
|
|
@@ -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 formatExpDate(date) {
|
|
33
29
|
const d = new Date(date);
|
|
34
30
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
@@ -39,28 +35,53 @@ var GROUP_LABELS = {
|
|
|
39
35
|
monthly: "Monthly",
|
|
40
36
|
quarterly: "Quarterly"
|
|
41
37
|
};
|
|
38
|
+
var SHAPE = {
|
|
39
|
+
selected: {
|
|
40
|
+
borderColor: "transparent",
|
|
41
|
+
backgroundColor: "var(--color-selected-control-bg)",
|
|
42
|
+
color: "var(--color-selected-control-text)"
|
|
43
|
+
},
|
|
44
|
+
resting: {
|
|
45
|
+
borderColor: "var(--color-border-divider)",
|
|
46
|
+
backgroundColor: "var(--card)",
|
|
47
|
+
color: "var(--color-text-secondary)",
|
|
48
|
+
hoverStyle: { borderColor: "var(--color-hover)", color: "var(--color-hover)" }
|
|
49
|
+
}
|
|
50
|
+
};
|
|
42
51
|
function ExpirationPill({ exp, isSelected, onClick }) {
|
|
52
|
+
const shape = isSelected ? SHAPE.selected : SHAPE.resting;
|
|
53
|
+
const dteColor = exp.dte <= 7 && !isSelected ? "var(--color-status-warn)" : isSelected ? "var(--color-selected-control-text)" : "var(--muted-foreground)";
|
|
43
54
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
44
|
-
|
|
55
|
+
gui.YStack,
|
|
45
56
|
{
|
|
46
|
-
|
|
57
|
+
unstyled: true,
|
|
58
|
+
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
|
|
47
59
|
onClick,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
gap: 2,
|
|
62
|
+
borderRadius: 6,
|
|
63
|
+
paddingHorizontal: 12,
|
|
64
|
+
paddingVertical: 6,
|
|
65
|
+
flexShrink: 0,
|
|
66
|
+
borderWidth: 1,
|
|
67
|
+
borderStyle: "solid",
|
|
68
|
+
cursor: "pointer",
|
|
69
|
+
...shape,
|
|
53
70
|
children: [
|
|
54
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
55
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
71
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { unstyled: true, fontSize: 12, fontWeight: "500", style: { whiteSpace: "nowrap" }, children: formatExpDate(exp.date) }),
|
|
72
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
73
|
+
gui.Text,
|
|
74
|
+
{
|
|
75
|
+
fontVariant: ["tabular-nums"],
|
|
76
|
+
style: { fontFamily: "monospace" },
|
|
77
|
+
fontSize: 10,
|
|
78
|
+
color: dteColor,
|
|
79
|
+
children: [
|
|
80
|
+
exp.dte,
|
|
81
|
+
"d"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
)
|
|
64
85
|
]
|
|
65
86
|
}
|
|
66
87
|
);
|
|
@@ -90,49 +111,23 @@ var ExpirationSelector = React__namespace.forwardRef(
|
|
|
90
111
|
label: GROUP_LABELS[type],
|
|
91
112
|
items: expirations.filter((e) => e.type === type)
|
|
92
113
|
})).filter((g) => g.items.length > 0);
|
|
93
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
ref,
|
|
97
|
-
className: cn("flex flex-col gap-2", className),
|
|
98
|
-
...rest,
|
|
99
|
-
children: grouped.map((group) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
100
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-semibold uppercase tracking-wider text-zinc-600 px-1", children: group.label }),
|
|
101
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 overflow-x-auto no-scrollbar", children: group.items.map((exp) => /* @__PURE__ */ jsxRuntime.jsx("div", { "data-selected": exp.date === selected || void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
102
|
-
ExpirationPill,
|
|
103
|
-
{
|
|
104
|
-
exp,
|
|
105
|
-
isSelected: exp.date === selected,
|
|
106
|
-
onClick: () => onSelect(exp.date)
|
|
107
|
-
}
|
|
108
|
-
) }, exp.date)) })
|
|
109
|
-
] }, group.type))
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
|
-
"div",
|
|
115
|
-
{
|
|
116
|
-
ref,
|
|
117
|
-
className: cn("flex items-center gap-1", className),
|
|
118
|
-
...rest,
|
|
119
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
-
"div",
|
|
114
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { ref, gap: 8, className, ...rest, children: grouped.map((group) => /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: 4, children: [
|
|
115
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
116
|
+
gui.Text,
|
|
121
117
|
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
onClick: () => onSelect(exp.date)
|
|
130
|
-
}
|
|
131
|
-
) }, exp.date))
|
|
118
|
+
fontSize: 10,
|
|
119
|
+
fontWeight: "600",
|
|
120
|
+
textTransform: "uppercase",
|
|
121
|
+
letterSpacing: 0.5,
|
|
122
|
+
paddingHorizontal: 4,
|
|
123
|
+
color: "var(--color-text-secondary)",
|
|
124
|
+
children: group.label
|
|
132
125
|
}
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { gap: 6, overflowX: "auto", overflowY: "hidden", className: "lux-no-scrollbar", children: group.items.map((exp) => /* @__PURE__ */ jsxRuntime.jsx("div", { "data-selected": exp.date === selected || void 0, children: /* @__PURE__ */ jsxRuntime.jsx(ExpirationPill, { exp, isSelected: exp.date === selected, onClick: () => onSelect(exp.date) }) }, exp.date)) })
|
|
128
|
+
] }, group.type)) });
|
|
129
|
+
}
|
|
130
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { ref, alignItems: "center", gap: 4, className, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { ref: scrollRef, gap: 6, overflowX: "auto", overflowY: "hidden", className: "lux-no-scrollbar", children: expirations.map((exp) => /* @__PURE__ */ jsxRuntime.jsx("div", { "data-selected": exp.date === selected || void 0, children: /* @__PURE__ */ jsxRuntime.jsx(ExpirationPill, { exp, isSelected: exp.date === selected, onClick: () => onSelect(exp.date) }) }, exp.date)) }) });
|
|
136
131
|
}
|
|
137
132
|
);
|
|
138
133
|
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { YStack, Text, XStack } from '@hanzo/gui';
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
|
-
import { twMerge } from 'tailwind-merge';
|
|
5
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
5
|
|
|
7
|
-
function cn(...inputs) {
|
|
8
|
-
return twMerge(clsx(inputs));
|
|
9
|
-
}
|
|
10
6
|
function formatExpDate(date) {
|
|
11
7
|
const d = new Date(date);
|
|
12
8
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
@@ -17,28 +13,53 @@ var GROUP_LABELS = {
|
|
|
17
13
|
monthly: "Monthly",
|
|
18
14
|
quarterly: "Quarterly"
|
|
19
15
|
};
|
|
16
|
+
var SHAPE = {
|
|
17
|
+
selected: {
|
|
18
|
+
borderColor: "transparent",
|
|
19
|
+
backgroundColor: "var(--color-selected-control-bg)",
|
|
20
|
+
color: "var(--color-selected-control-text)"
|
|
21
|
+
},
|
|
22
|
+
resting: {
|
|
23
|
+
borderColor: "var(--color-border-divider)",
|
|
24
|
+
backgroundColor: "var(--card)",
|
|
25
|
+
color: "var(--color-text-secondary)",
|
|
26
|
+
hoverStyle: { borderColor: "var(--color-hover)", color: "var(--color-hover)" }
|
|
27
|
+
}
|
|
28
|
+
};
|
|
20
29
|
function ExpirationPill({ exp, isSelected, onClick }) {
|
|
30
|
+
const shape = isSelected ? SHAPE.selected : SHAPE.resting;
|
|
31
|
+
const dteColor = exp.dte <= 7 && !isSelected ? "var(--color-status-warn)" : isSelected ? "var(--color-selected-control-text)" : "var(--muted-foreground)";
|
|
21
32
|
return /* @__PURE__ */ jsxs(
|
|
22
|
-
|
|
33
|
+
YStack,
|
|
23
34
|
{
|
|
24
|
-
|
|
35
|
+
unstyled: true,
|
|
36
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
25
37
|
onClick,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
gap: 2,
|
|
40
|
+
borderRadius: 6,
|
|
41
|
+
paddingHorizontal: 12,
|
|
42
|
+
paddingVertical: 6,
|
|
43
|
+
flexShrink: 0,
|
|
44
|
+
borderWidth: 1,
|
|
45
|
+
borderStyle: "solid",
|
|
46
|
+
cursor: "pointer",
|
|
47
|
+
...shape,
|
|
31
48
|
children: [
|
|
32
|
-
/* @__PURE__ */ jsx("
|
|
33
|
-
/* @__PURE__ */ jsxs(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
/* @__PURE__ */ jsx(Text, { unstyled: true, fontSize: 12, fontWeight: "500", style: { whiteSpace: "nowrap" }, children: formatExpDate(exp.date) }),
|
|
50
|
+
/* @__PURE__ */ jsxs(
|
|
51
|
+
Text,
|
|
52
|
+
{
|
|
53
|
+
fontVariant: ["tabular-nums"],
|
|
54
|
+
style: { fontFamily: "monospace" },
|
|
55
|
+
fontSize: 10,
|
|
56
|
+
color: dteColor,
|
|
57
|
+
children: [
|
|
58
|
+
exp.dte,
|
|
59
|
+
"d"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
)
|
|
42
63
|
]
|
|
43
64
|
}
|
|
44
65
|
);
|
|
@@ -68,49 +89,23 @@ var ExpirationSelector = React.forwardRef(
|
|
|
68
89
|
label: GROUP_LABELS[type],
|
|
69
90
|
items: expirations.filter((e) => e.type === type)
|
|
70
91
|
})).filter((g) => g.items.length > 0);
|
|
71
|
-
return /* @__PURE__ */ jsx(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
ref,
|
|
75
|
-
className: cn("flex flex-col gap-2", className),
|
|
76
|
-
...rest,
|
|
77
|
-
children: grouped.map((group) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
78
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-semibold uppercase tracking-wider text-zinc-600 px-1", children: group.label }),
|
|
79
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-1.5 overflow-x-auto no-scrollbar", children: group.items.map((exp) => /* @__PURE__ */ jsx("div", { "data-selected": exp.date === selected || void 0, children: /* @__PURE__ */ jsx(
|
|
80
|
-
ExpirationPill,
|
|
81
|
-
{
|
|
82
|
-
exp,
|
|
83
|
-
isSelected: exp.date === selected,
|
|
84
|
-
onClick: () => onSelect(exp.date)
|
|
85
|
-
}
|
|
86
|
-
) }, exp.date)) })
|
|
87
|
-
] }, group.type))
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
return /* @__PURE__ */ jsx(
|
|
92
|
-
"div",
|
|
93
|
-
{
|
|
94
|
-
ref,
|
|
95
|
-
className: cn("flex items-center gap-1", className),
|
|
96
|
-
...rest,
|
|
97
|
-
children: /* @__PURE__ */ jsx(
|
|
98
|
-
"div",
|
|
92
|
+
return /* @__PURE__ */ jsx(YStack, { ref, gap: 8, className, ...rest, children: grouped.map((group) => /* @__PURE__ */ jsxs(YStack, { gap: 4, children: [
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
Text,
|
|
99
95
|
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
onClick: () => onSelect(exp.date)
|
|
108
|
-
}
|
|
109
|
-
) }, exp.date))
|
|
96
|
+
fontSize: 10,
|
|
97
|
+
fontWeight: "600",
|
|
98
|
+
textTransform: "uppercase",
|
|
99
|
+
letterSpacing: 0.5,
|
|
100
|
+
paddingHorizontal: 4,
|
|
101
|
+
color: "var(--color-text-secondary)",
|
|
102
|
+
children: group.label
|
|
110
103
|
}
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(XStack, { gap: 6, overflowX: "auto", overflowY: "hidden", className: "lux-no-scrollbar", children: group.items.map((exp) => /* @__PURE__ */ jsx("div", { "data-selected": exp.date === selected || void 0, children: /* @__PURE__ */ jsx(ExpirationPill, { exp, isSelected: exp.date === selected, onClick: () => onSelect(exp.date) }) }, exp.date)) })
|
|
106
|
+
] }, group.type)) });
|
|
107
|
+
}
|
|
108
|
+
return /* @__PURE__ */ jsx(XStack, { ref, alignItems: "center", gap: 4, className, ...rest, children: /* @__PURE__ */ jsx(XStack, { ref: scrollRef, gap: 6, overflowX: "auto", overflowY: "hidden", className: "lux-no-scrollbar", children: expirations.map((exp) => /* @__PURE__ */ jsx("div", { "data-selected": exp.date === selected || void 0, children: /* @__PURE__ */ jsx(ExpirationPill, { exp, isSelected: exp.date === selected, onClick: () => onSelect(exp.date) }) }, exp.date)) }) });
|
|
114
109
|
}
|
|
115
110
|
);
|
|
116
111
|
|
package/dist/greeks-display.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) {
|
|
@@ -26,44 +25,55 @@ 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
|
var GREEKS = [
|
|
33
|
-
{ key: "delta", label: "Delta", symbol: "\u0394", color: "
|
|
34
|
-
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "
|
|
35
|
-
{ key: "theta", label: "Theta", symbol: "\u0398", color: "
|
|
36
|
-
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "
|
|
37
|
-
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "
|
|
38
|
-
{ key: "iv", label: "IV", symbol: "\u03C3", color: "
|
|
29
|
+
{ key: "delta", label: "Delta", symbol: "\u0394", color: "var(--foreground)", barColor: "var(--foreground)", decimals: 4, maxMagnitude: 1 },
|
|
30
|
+
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "var(--chart-1)", barColor: "var(--chart-1)", decimals: 4, maxMagnitude: 0.1 },
|
|
31
|
+
{ key: "theta", label: "Theta", symbol: "\u0398", color: "var(--chart-4)", barColor: "var(--chart-4)", decimals: 4, maxMagnitude: 1 },
|
|
32
|
+
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "var(--chart-2)", barColor: "var(--chart-2)", decimals: 4, maxMagnitude: 1 },
|
|
33
|
+
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "var(--chart-3)", barColor: "var(--chart-3)", decimals: 4, maxMagnitude: 1 },
|
|
34
|
+
{ key: "iv", label: "IV", symbol: "\u03C3", color: "var(--chart-5)", barColor: "var(--chart-5)", decimals: 1, maxMagnitude: 100 }
|
|
39
35
|
];
|
|
40
36
|
function GreekItem({ def, value, compact }) {
|
|
41
37
|
const magnitude = Math.min(Math.abs(value) / def.maxMagnitude, 1);
|
|
42
38
|
const displayValue = def.key === "iv" ? `${(value * 100).toFixed(def.decimals)}%` : value.toFixed(def.decimals);
|
|
43
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
44
|
-
"
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", gap: 6, minWidth: compact ? 0 : 100, children: [
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 10, fontWeight: "600", flexShrink: 0, color: def.color, children: def.symbol }),
|
|
41
|
+
!compact && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 10, flexShrink: 0, width: 34, color: "var(--color-text-secondary)", children: def.label }),
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
+
gui.Text,
|
|
44
|
+
{
|
|
45
|
+
fontSize: 12,
|
|
46
|
+
flexShrink: 0,
|
|
47
|
+
style: { fontFamily: "monospace" },
|
|
48
|
+
fontVariant: ["tabular-nums"],
|
|
49
|
+
color: value < 0 ? "var(--color-status-bad)" : "var(--color-text-primary)",
|
|
50
|
+
children: displayValue
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
!compact && /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
+
gui.View,
|
|
55
|
+
{
|
|
56
|
+
flex: 1,
|
|
57
|
+
height: 4,
|
|
58
|
+
borderRadius: 9999,
|
|
59
|
+
minWidth: 24,
|
|
60
|
+
maxWidth: 48,
|
|
61
|
+
overflow: "hidden",
|
|
62
|
+
backgroundColor: "var(--color-progress-track)",
|
|
63
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
gui.View,
|
|
59
65
|
{
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
height: "100%",
|
|
67
|
+
borderRadius: 9999,
|
|
68
|
+
transition: "quick",
|
|
69
|
+
width: `${magnitude * 100}%`,
|
|
70
|
+
opacity: 0.7,
|
|
71
|
+
backgroundColor: def.barColor
|
|
62
72
|
}
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
);
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] });
|
|
67
77
|
}
|
|
68
78
|
var GreeksDisplay = React__namespace.forwardRef(
|
|
69
79
|
function GreeksDisplay2(props, ref) {
|
|
@@ -88,14 +98,13 @@ var GreeksDisplay = React__namespace.forwardRef(
|
|
|
88
98
|
};
|
|
89
99
|
const activeGreeks = GREEKS.filter((g) => values[g.key] !== void 0);
|
|
90
100
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
-
|
|
101
|
+
gui.XStack,
|
|
92
102
|
{
|
|
93
103
|
ref,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
),
|
|
104
|
+
flexWrap: "wrap",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
gap: compact ? 12 : 16,
|
|
107
|
+
className,
|
|
99
108
|
...rest,
|
|
100
109
|
children: activeGreeks.map((g) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
110
|
GreekItem,
|
package/dist/greeks-display.js
CHANGED
|
@@ -1,47 +1,57 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { XStack, Text, View } from '@hanzo/gui';
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
|
-
import { twMerge } from 'tailwind-merge';
|
|
5
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
5
|
|
|
7
|
-
function cn(...inputs) {
|
|
8
|
-
return twMerge(clsx(inputs));
|
|
9
|
-
}
|
|
10
6
|
var GREEKS = [
|
|
11
|
-
{ key: "delta", label: "Delta", symbol: "\u0394", color: "
|
|
12
|
-
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "
|
|
13
|
-
{ key: "theta", label: "Theta", symbol: "\u0398", color: "
|
|
14
|
-
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "
|
|
15
|
-
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "
|
|
16
|
-
{ key: "iv", label: "IV", symbol: "\u03C3", color: "
|
|
7
|
+
{ key: "delta", label: "Delta", symbol: "\u0394", color: "var(--foreground)", barColor: "var(--foreground)", decimals: 4, maxMagnitude: 1 },
|
|
8
|
+
{ key: "gamma", label: "Gamma", symbol: "\u0393", color: "var(--chart-1)", barColor: "var(--chart-1)", decimals: 4, maxMagnitude: 0.1 },
|
|
9
|
+
{ key: "theta", label: "Theta", symbol: "\u0398", color: "var(--chart-4)", barColor: "var(--chart-4)", decimals: 4, maxMagnitude: 1 },
|
|
10
|
+
{ key: "vega", label: "Vega", symbol: "\u03BD", color: "var(--chart-2)", barColor: "var(--chart-2)", decimals: 4, maxMagnitude: 1 },
|
|
11
|
+
{ key: "rho", label: "Rho", symbol: "\u03C1", color: "var(--chart-3)", barColor: "var(--chart-3)", decimals: 4, maxMagnitude: 1 },
|
|
12
|
+
{ key: "iv", label: "IV", symbol: "\u03C3", color: "var(--chart-5)", barColor: "var(--chart-5)", decimals: 1, maxMagnitude: 100 }
|
|
17
13
|
];
|
|
18
14
|
function GreekItem({ def, value, compact }) {
|
|
19
15
|
const magnitude = Math.min(Math.abs(value) / def.maxMagnitude, 1);
|
|
20
16
|
const displayValue = def.key === "iv" ? `${(value * 100).toFixed(def.decimals)}%` : value.toFixed(def.decimals);
|
|
21
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
-
"
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
return /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 6, minWidth: compact ? 0 : 100, children: [
|
|
18
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 10, fontWeight: "600", flexShrink: 0, color: def.color, children: def.symbol }),
|
|
19
|
+
!compact && /* @__PURE__ */ jsx(Text, { fontSize: 10, flexShrink: 0, width: 34, color: "var(--color-text-secondary)", children: def.label }),
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
Text,
|
|
22
|
+
{
|
|
23
|
+
fontSize: 12,
|
|
24
|
+
flexShrink: 0,
|
|
25
|
+
style: { fontFamily: "monospace" },
|
|
26
|
+
fontVariant: ["tabular-nums"],
|
|
27
|
+
color: value < 0 ? "var(--color-status-bad)" : "var(--color-text-primary)",
|
|
28
|
+
children: displayValue
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
!compact && /* @__PURE__ */ jsx(
|
|
32
|
+
View,
|
|
33
|
+
{
|
|
34
|
+
flex: 1,
|
|
35
|
+
height: 4,
|
|
36
|
+
borderRadius: 9999,
|
|
37
|
+
minWidth: 24,
|
|
38
|
+
maxWidth: 48,
|
|
39
|
+
overflow: "hidden",
|
|
40
|
+
backgroundColor: "var(--color-progress-track)",
|
|
41
|
+
children: /* @__PURE__ */ jsx(
|
|
42
|
+
View,
|
|
37
43
|
{
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
height: "100%",
|
|
45
|
+
borderRadius: 9999,
|
|
46
|
+
transition: "quick",
|
|
47
|
+
width: `${magnitude * 100}%`,
|
|
48
|
+
opacity: 0.7,
|
|
49
|
+
backgroundColor: def.barColor
|
|
40
50
|
}
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] });
|
|
45
55
|
}
|
|
46
56
|
var GreeksDisplay = React.forwardRef(
|
|
47
57
|
function GreeksDisplay2(props, ref) {
|
|
@@ -66,14 +76,13 @@ var GreeksDisplay = React.forwardRef(
|
|
|
66
76
|
};
|
|
67
77
|
const activeGreeks = GREEKS.filter((g) => values[g.key] !== void 0);
|
|
68
78
|
return /* @__PURE__ */ jsx(
|
|
69
|
-
|
|
79
|
+
XStack,
|
|
70
80
|
{
|
|
71
81
|
ref,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
),
|
|
82
|
+
flexWrap: "wrap",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
gap: compact ? 12 : 16,
|
|
85
|
+
className,
|
|
77
86
|
...rest,
|
|
78
87
|
children: activeGreeks.map((g) => /* @__PURE__ */ jsx(
|
|
79
88
|
GreekItem,
|