@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/option-position.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,13 +25,11 @@ 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 formatDate(date) {
|
|
33
29
|
const d = new Date(date);
|
|
34
30
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
35
31
|
}
|
|
32
|
+
var MONO = { fontFamily: "monospace" };
|
|
36
33
|
var OptionPositionCard = React__namespace.forwardRef(
|
|
37
34
|
function OptionPositionCard2(props, ref) {
|
|
38
35
|
const {
|
|
@@ -46,64 +43,76 @@ var OptionPositionCard = React__namespace.forwardRef(
|
|
|
46
43
|
const isLong = position.quantity > 0;
|
|
47
44
|
const isCall = position.type === "call";
|
|
48
45
|
const isProfitable = position.pnl >= 0;
|
|
46
|
+
const pnlColor = isProfitable ? "var(--color-status-good)" : "var(--color-status-bad)";
|
|
49
47
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
50
|
-
|
|
48
|
+
gui.YStack,
|
|
51
49
|
{
|
|
52
50
|
ref,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
),
|
|
51
|
+
gap: 8,
|
|
52
|
+
borderRadius: 8,
|
|
53
|
+
borderWidth: 1,
|
|
54
|
+
borderColor: "var(--color-border-divider)",
|
|
55
|
+
backgroundColor: "var(--card)",
|
|
56
|
+
padding: 12,
|
|
57
|
+
className,
|
|
57
58
|
...rest,
|
|
58
59
|
children: [
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
60
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", justifyContent: "space-between", children: [
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { alignItems: "center", gap: 8, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62
|
+
gui.XStack,
|
|
63
|
+
{
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
gap: 4,
|
|
66
|
+
borderRadius: 4,
|
|
67
|
+
paddingHorizontal: 6,
|
|
68
|
+
paddingVertical: 2,
|
|
69
|
+
backgroundColor: isCall ? "var(--secondary)" : "var(--muted)",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, fontWeight: "600", color: isCall ? "var(--foreground)" : "var(--muted-foreground)", children: position.underlying }),
|
|
72
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, fontWeight: "600", style: MONO, fontVariant: ["tabular-nums"], color: isCall ? "var(--foreground)" : "var(--muted-foreground)", children: position.strike }),
|
|
73
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, fontWeight: "600", textTransform: "uppercase", color: isCall ? "var(--foreground)" : "var(--muted-foreground)", children: position.type === "call" ? "C" : "P" }),
|
|
74
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, fontWeight: "400", color: "var(--color-text-secondary)", children: formatDate(position.expiration) })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) }),
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
79
|
+
gui.Text,
|
|
80
|
+
{
|
|
81
|
+
fontSize: 12,
|
|
82
|
+
fontWeight: "600",
|
|
83
|
+
style: MONO,
|
|
84
|
+
fontVariant: ["tabular-nums"],
|
|
85
|
+
color: isLong ? "var(--color-status-good)" : "var(--color-status-bad)",
|
|
86
|
+
children: [
|
|
87
|
+
isLong ? "+" : "",
|
|
88
|
+
position.quantity
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
)
|
|
77
92
|
] }),
|
|
78
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
79
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
80
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: 12, children: [
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { flex: 1, gap: 2, children: [
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 10, textTransform: "uppercase", letterSpacing: 0.5, color: "var(--color-text-secondary)", children: "Avg Cost" }),
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: 12, style: MONO, fontVariant: ["tabular-nums"], color: "var(--color-text-primary)", children: [
|
|
82
97
|
"$",
|
|
83
98
|
position.avgCost.toFixed(2)
|
|
84
99
|
] })
|
|
85
100
|
] }),
|
|
86
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
87
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
101
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { flex: 1, gap: 2, children: [
|
|
102
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 10, textTransform: "uppercase", letterSpacing: 0.5, color: "var(--color-text-secondary)", children: "Value" }),
|
|
103
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: 12, style: MONO, fontVariant: ["tabular-nums"], color: "var(--color-text-primary)", children: [
|
|
89
104
|
"$",
|
|
90
105
|
position.currentValue.toFixed(2)
|
|
91
106
|
] })
|
|
92
107
|
] }),
|
|
93
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
94
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
95
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
96
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
97
|
-
"font-mono tabular-nums text-xs font-semibold",
|
|
98
|
-
isProfitable ? "text-emerald-400" : "text-red-400"
|
|
99
|
-
), children: [
|
|
108
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { flex: 1, gap: 2, alignItems: "flex-end", children: [
|
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 10, textTransform: "uppercase", letterSpacing: 0.5, color: "var(--color-text-secondary)", children: "P/L" }),
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", gap: 4, children: [
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: 12, fontWeight: "600", style: MONO, fontVariant: ["tabular-nums"], color: pnlColor, children: [
|
|
100
112
|
isProfitable ? "+" : "",
|
|
101
113
|
position.pnl.toFixed(2)
|
|
102
114
|
] }),
|
|
103
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
104
|
-
"font-mono tabular-nums text-[10px]",
|
|
105
|
-
isProfitable ? "text-emerald-500/70" : "text-red-500/70"
|
|
106
|
-
), children: [
|
|
115
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: 10, style: MONO, fontVariant: ["tabular-nums"], color: pnlColor, opacity: 0.7, children: [
|
|
107
116
|
"(",
|
|
108
117
|
isProfitable ? "+" : "",
|
|
109
118
|
position.pnlPercent.toFixed(1),
|
|
@@ -112,53 +121,47 @@ var OptionPositionCard = React__namespace.forwardRef(
|
|
|
112
121
|
] })
|
|
113
122
|
] })
|
|
114
123
|
] }),
|
|
115
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
116
|
-
/* @__PURE__ */ jsxRuntime.jsx(GreekPill, { label: "\u0394", value: position.greeks.delta, color: "
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(GreekPill, { label: "\u0393", value: position.greeks.gamma, color: "
|
|
118
|
-
/* @__PURE__ */ jsxRuntime.jsx(GreekPill, { label: "\u0398", value: position.greeks.theta, color: "
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(GreekPill, { label: "\u03BD", value: position.greeks.vega, color: "
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", gap: 12, borderTopWidth: 1, borderColor: "var(--color-border-divider)", paddingTop: 8, children: [
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(GreekPill, { label: "\u0394", value: position.greeks.delta, color: "var(--foreground)" }),
|
|
126
|
+
/* @__PURE__ */ jsxRuntime.jsx(GreekPill, { label: "\u0393", value: position.greeks.gamma, color: "var(--chart-1)" }),
|
|
127
|
+
/* @__PURE__ */ jsxRuntime.jsx(GreekPill, { label: "\u0398", value: position.greeks.theta, color: "var(--chart-4)" }),
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(GreekPill, { label: "\u03BD", value: position.greeks.vega, color: "var(--chart-2)" })
|
|
120
129
|
] }),
|
|
121
|
-
(onClose || onExercise || onRoll) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
122
|
-
onClose && /* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
type: "button",
|
|
126
|
-
onClick: () => onClose(position),
|
|
127
|
-
className: "flex-1 rounded-md bg-zinc-800 px-2 py-1 text-xs font-medium text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100 transition-colors",
|
|
128
|
-
children: "Close"
|
|
129
|
-
}
|
|
130
|
-
),
|
|
131
|
-
onExercise && /* @__PURE__ */ jsxRuntime.jsx(
|
|
132
|
-
"button",
|
|
133
|
-
{
|
|
134
|
-
type: "button",
|
|
135
|
-
onClick: () => onExercise(position),
|
|
136
|
-
className: "flex-1 rounded-md bg-zinc-800 px-2 py-1 text-xs font-medium text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100 transition-colors",
|
|
137
|
-
children: "Exercise"
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
onRoll && /* @__PURE__ */ jsxRuntime.jsx(
|
|
141
|
-
"button",
|
|
142
|
-
{
|
|
143
|
-
type: "button",
|
|
144
|
-
onClick: () => onRoll(position),
|
|
145
|
-
className: "flex-1 rounded-md bg-zinc-800 px-2 py-1 text-xs font-medium text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100 transition-colors",
|
|
146
|
-
children: "Roll"
|
|
147
|
-
}
|
|
148
|
-
)
|
|
130
|
+
(onClose || onExercise || onRoll) && /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", gap: 8, borderTopWidth: 1, borderColor: "var(--color-border-divider)", paddingTop: 8, children: [
|
|
131
|
+
onClose && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { onClick: () => onClose(position), children: "Close" }),
|
|
132
|
+
onExercise && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { onClick: () => onExercise(position), children: "Exercise" }),
|
|
133
|
+
onRoll && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { onClick: () => onRoll(position), children: "Roll" })
|
|
149
134
|
] })
|
|
150
135
|
]
|
|
151
136
|
}
|
|
152
137
|
);
|
|
153
138
|
}
|
|
154
139
|
);
|
|
140
|
+
function ActionButton({ onClick, children }) {
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
+
gui.XStack,
|
|
143
|
+
{
|
|
144
|
+
unstyled: true,
|
|
145
|
+
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
|
|
146
|
+
onClick,
|
|
147
|
+
flex: 1,
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
justifyContent: "center",
|
|
150
|
+
borderRadius: 6,
|
|
151
|
+
borderWidth: 0,
|
|
152
|
+
paddingHorizontal: 8,
|
|
153
|
+
paddingVertical: 4,
|
|
154
|
+
backgroundColor: "var(--color-button-subtle-bg)",
|
|
155
|
+
cursor: "pointer",
|
|
156
|
+
hoverStyle: { color: "var(--color-hover)" },
|
|
157
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, fontWeight: "500", color: "var(--color-button-subtle-fg)", children })
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
155
161
|
function GreekPill({ label, value, color }) {
|
|
156
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
157
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
158
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
159
|
-
"font-mono tabular-nums text-[11px]",
|
|
160
|
-
value < 0 ? "text-red-400" : "text-zinc-400"
|
|
161
|
-
), children: value.toFixed(4) })
|
|
162
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { alignItems: "center", gap: 4, children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 10, fontWeight: "600", color, children: label }),
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 11, style: MONO, fontVariant: ["tabular-nums"], color: value < 0 ? "var(--color-status-bad)" : "var(--color-text-secondary)", children: value.toFixed(4) })
|
|
162
165
|
] });
|
|
163
166
|
}
|
|
164
167
|
|
package/dist/option-position.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { YStack, 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 } from 'react/jsx-runtime';
|
|
6
5
|
|
|
7
|
-
function cn(...inputs) {
|
|
8
|
-
return twMerge(clsx(inputs));
|
|
9
|
-
}
|
|
10
6
|
function formatDate(date) {
|
|
11
7
|
const d = new Date(date);
|
|
12
8
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
13
9
|
}
|
|
10
|
+
var MONO = { fontFamily: "monospace" };
|
|
14
11
|
var OptionPositionCard = React.forwardRef(
|
|
15
12
|
function OptionPositionCard2(props, ref) {
|
|
16
13
|
const {
|
|
@@ -24,64 +21,76 @@ var OptionPositionCard = React.forwardRef(
|
|
|
24
21
|
const isLong = position.quantity > 0;
|
|
25
22
|
const isCall = position.type === "call";
|
|
26
23
|
const isProfitable = position.pnl >= 0;
|
|
24
|
+
const pnlColor = isProfitable ? "var(--color-status-good)" : "var(--color-status-bad)";
|
|
27
25
|
return /* @__PURE__ */ jsxs(
|
|
28
|
-
|
|
26
|
+
YStack,
|
|
29
27
|
{
|
|
30
28
|
ref,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
),
|
|
29
|
+
gap: 8,
|
|
30
|
+
borderRadius: 8,
|
|
31
|
+
borderWidth: 1,
|
|
32
|
+
borderColor: "var(--color-border-divider)",
|
|
33
|
+
backgroundColor: "var(--card)",
|
|
34
|
+
padding: 12,
|
|
35
|
+
className,
|
|
35
36
|
...rest,
|
|
36
37
|
children: [
|
|
37
|
-
/* @__PURE__ */ jsxs(
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
/* @__PURE__ */ jsxs(XStack, { alignItems: "center", justifyContent: "space-between", children: [
|
|
39
|
+
/* @__PURE__ */ jsx(XStack, { alignItems: "center", gap: 8, children: /* @__PURE__ */ jsxs(
|
|
40
|
+
XStack,
|
|
41
|
+
{
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
gap: 4,
|
|
44
|
+
borderRadius: 4,
|
|
45
|
+
paddingHorizontal: 6,
|
|
46
|
+
paddingVertical: 2,
|
|
47
|
+
backgroundColor: isCall ? "var(--secondary)" : "var(--muted)",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "600", color: isCall ? "var(--foreground)" : "var(--muted-foreground)", children: position.underlying }),
|
|
50
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "600", style: MONO, fontVariant: ["tabular-nums"], color: isCall ? "var(--foreground)" : "var(--muted-foreground)", children: position.strike }),
|
|
51
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "600", textTransform: "uppercase", color: isCall ? "var(--foreground)" : "var(--muted-foreground)", children: position.type === "call" ? "C" : "P" }),
|
|
52
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "400", color: "var(--color-text-secondary)", children: formatDate(position.expiration) })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
) }),
|
|
56
|
+
/* @__PURE__ */ jsxs(
|
|
57
|
+
Text,
|
|
58
|
+
{
|
|
59
|
+
fontSize: 12,
|
|
60
|
+
fontWeight: "600",
|
|
61
|
+
style: MONO,
|
|
62
|
+
fontVariant: ["tabular-nums"],
|
|
63
|
+
color: isLong ? "var(--color-status-good)" : "var(--color-status-bad)",
|
|
64
|
+
children: [
|
|
65
|
+
isLong ? "+" : "",
|
|
66
|
+
position.quantity
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
)
|
|
55
70
|
] }),
|
|
56
|
-
/* @__PURE__ */ jsxs(
|
|
57
|
-
/* @__PURE__ */ jsxs(
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
/* @__PURE__ */ jsxs(
|
|
71
|
+
/* @__PURE__ */ jsxs(XStack, { gap: 12, children: [
|
|
72
|
+
/* @__PURE__ */ jsxs(YStack, { flex: 1, gap: 2, children: [
|
|
73
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 10, textTransform: "uppercase", letterSpacing: 0.5, color: "var(--color-text-secondary)", children: "Avg Cost" }),
|
|
74
|
+
/* @__PURE__ */ jsxs(Text, { fontSize: 12, style: MONO, fontVariant: ["tabular-nums"], color: "var(--color-text-primary)", children: [
|
|
60
75
|
"$",
|
|
61
76
|
position.avgCost.toFixed(2)
|
|
62
77
|
] })
|
|
63
78
|
] }),
|
|
64
|
-
/* @__PURE__ */ jsxs(
|
|
65
|
-
/* @__PURE__ */ jsx(
|
|
66
|
-
/* @__PURE__ */ jsxs(
|
|
79
|
+
/* @__PURE__ */ jsxs(YStack, { flex: 1, gap: 2, children: [
|
|
80
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 10, textTransform: "uppercase", letterSpacing: 0.5, color: "var(--color-text-secondary)", children: "Value" }),
|
|
81
|
+
/* @__PURE__ */ jsxs(Text, { fontSize: 12, style: MONO, fontVariant: ["tabular-nums"], color: "var(--color-text-primary)", children: [
|
|
67
82
|
"$",
|
|
68
83
|
position.currentValue.toFixed(2)
|
|
69
84
|
] })
|
|
70
85
|
] }),
|
|
71
|
-
/* @__PURE__ */ jsxs(
|
|
72
|
-
/* @__PURE__ */ jsx(
|
|
73
|
-
/* @__PURE__ */ jsxs(
|
|
74
|
-
/* @__PURE__ */ jsxs("
|
|
75
|
-
"font-mono tabular-nums text-xs font-semibold",
|
|
76
|
-
isProfitable ? "text-emerald-400" : "text-red-400"
|
|
77
|
-
), children: [
|
|
86
|
+
/* @__PURE__ */ jsxs(YStack, { flex: 1, gap: 2, alignItems: "flex-end", children: [
|
|
87
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 10, textTransform: "uppercase", letterSpacing: 0.5, color: "var(--color-text-secondary)", children: "P/L" }),
|
|
88
|
+
/* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 4, children: [
|
|
89
|
+
/* @__PURE__ */ jsxs(Text, { fontSize: 12, fontWeight: "600", style: MONO, fontVariant: ["tabular-nums"], color: pnlColor, children: [
|
|
78
90
|
isProfitable ? "+" : "",
|
|
79
91
|
position.pnl.toFixed(2)
|
|
80
92
|
] }),
|
|
81
|
-
/* @__PURE__ */ jsxs("
|
|
82
|
-
"font-mono tabular-nums text-[10px]",
|
|
83
|
-
isProfitable ? "text-emerald-500/70" : "text-red-500/70"
|
|
84
|
-
), children: [
|
|
93
|
+
/* @__PURE__ */ jsxs(Text, { fontSize: 10, style: MONO, fontVariant: ["tabular-nums"], color: pnlColor, opacity: 0.7, children: [
|
|
85
94
|
"(",
|
|
86
95
|
isProfitable ? "+" : "",
|
|
87
96
|
position.pnlPercent.toFixed(1),
|
|
@@ -90,53 +99,47 @@ var OptionPositionCard = React.forwardRef(
|
|
|
90
99
|
] })
|
|
91
100
|
] })
|
|
92
101
|
] }),
|
|
93
|
-
/* @__PURE__ */ jsxs(
|
|
94
|
-
/* @__PURE__ */ jsx(GreekPill, { label: "\u0394", value: position.greeks.delta, color: "
|
|
95
|
-
/* @__PURE__ */ jsx(GreekPill, { label: "\u0393", value: position.greeks.gamma, color: "
|
|
96
|
-
/* @__PURE__ */ jsx(GreekPill, { label: "\u0398", value: position.greeks.theta, color: "
|
|
97
|
-
/* @__PURE__ */ jsx(GreekPill, { label: "\u03BD", value: position.greeks.vega, color: "
|
|
102
|
+
/* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 12, borderTopWidth: 1, borderColor: "var(--color-border-divider)", paddingTop: 8, children: [
|
|
103
|
+
/* @__PURE__ */ jsx(GreekPill, { label: "\u0394", value: position.greeks.delta, color: "var(--foreground)" }),
|
|
104
|
+
/* @__PURE__ */ jsx(GreekPill, { label: "\u0393", value: position.greeks.gamma, color: "var(--chart-1)" }),
|
|
105
|
+
/* @__PURE__ */ jsx(GreekPill, { label: "\u0398", value: position.greeks.theta, color: "var(--chart-4)" }),
|
|
106
|
+
/* @__PURE__ */ jsx(GreekPill, { label: "\u03BD", value: position.greeks.vega, color: "var(--chart-2)" })
|
|
98
107
|
] }),
|
|
99
|
-
(onClose || onExercise || onRoll) && /* @__PURE__ */ jsxs(
|
|
100
|
-
onClose && /* @__PURE__ */ jsx(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
type: "button",
|
|
104
|
-
onClick: () => onClose(position),
|
|
105
|
-
className: "flex-1 rounded-md bg-zinc-800 px-2 py-1 text-xs font-medium text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100 transition-colors",
|
|
106
|
-
children: "Close"
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
onExercise && /* @__PURE__ */ jsx(
|
|
110
|
-
"button",
|
|
111
|
-
{
|
|
112
|
-
type: "button",
|
|
113
|
-
onClick: () => onExercise(position),
|
|
114
|
-
className: "flex-1 rounded-md bg-zinc-800 px-2 py-1 text-xs font-medium text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100 transition-colors",
|
|
115
|
-
children: "Exercise"
|
|
116
|
-
}
|
|
117
|
-
),
|
|
118
|
-
onRoll && /* @__PURE__ */ jsx(
|
|
119
|
-
"button",
|
|
120
|
-
{
|
|
121
|
-
type: "button",
|
|
122
|
-
onClick: () => onRoll(position),
|
|
123
|
-
className: "flex-1 rounded-md bg-zinc-800 px-2 py-1 text-xs font-medium text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100 transition-colors",
|
|
124
|
-
children: "Roll"
|
|
125
|
-
}
|
|
126
|
-
)
|
|
108
|
+
(onClose || onExercise || onRoll) && /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 8, borderTopWidth: 1, borderColor: "var(--color-border-divider)", paddingTop: 8, children: [
|
|
109
|
+
onClose && /* @__PURE__ */ jsx(ActionButton, { onClick: () => onClose(position), children: "Close" }),
|
|
110
|
+
onExercise && /* @__PURE__ */ jsx(ActionButton, { onClick: () => onExercise(position), children: "Exercise" }),
|
|
111
|
+
onRoll && /* @__PURE__ */ jsx(ActionButton, { onClick: () => onRoll(position), children: "Roll" })
|
|
127
112
|
] })
|
|
128
113
|
]
|
|
129
114
|
}
|
|
130
115
|
);
|
|
131
116
|
}
|
|
132
117
|
);
|
|
118
|
+
function ActionButton({ onClick, children }) {
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
XStack,
|
|
121
|
+
{
|
|
122
|
+
unstyled: true,
|
|
123
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
124
|
+
onClick,
|
|
125
|
+
flex: 1,
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
justifyContent: "center",
|
|
128
|
+
borderRadius: 6,
|
|
129
|
+
borderWidth: 0,
|
|
130
|
+
paddingHorizontal: 8,
|
|
131
|
+
paddingVertical: 4,
|
|
132
|
+
backgroundColor: "var(--color-button-subtle-bg)",
|
|
133
|
+
cursor: "pointer",
|
|
134
|
+
hoverStyle: { color: "var(--color-hover)" },
|
|
135
|
+
children: /* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "500", color: "var(--color-button-subtle-fg)", children })
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
133
139
|
function GreekPill({ label, value, color }) {
|
|
134
|
-
return /* @__PURE__ */ jsxs(
|
|
135
|
-
/* @__PURE__ */ jsx(
|
|
136
|
-
/* @__PURE__ */ jsx("
|
|
137
|
-
"font-mono tabular-nums text-[11px]",
|
|
138
|
-
value < 0 ? "text-red-400" : "text-zinc-400"
|
|
139
|
-
), children: value.toFixed(4) })
|
|
140
|
+
return /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 4, children: [
|
|
141
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 10, fontWeight: "600", color, children: label }),
|
|
142
|
+
/* @__PURE__ */ jsx(Text, { fontSize: 11, style: MONO, fontVariant: ["tabular-nums"], color: value < 0 ? "var(--color-status-bad)" : "var(--color-text-secondary)", children: value.toFixed(4) })
|
|
140
143
|
] });
|
|
141
144
|
}
|
|
142
145
|
|
package/dist/pin-input.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,23 +26,26 @@ function _interopNamespace(e) {
|
|
|
27
26
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
27
|
|
|
29
28
|
// src/pin-input.tsx
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
var BOX = {
|
|
30
|
+
width: 40,
|
|
31
|
+
height: 40,
|
|
32
|
+
textAlign: "center",
|
|
33
|
+
fontSize: 14,
|
|
34
|
+
fontWeight: 500,
|
|
35
|
+
borderRadius: 6,
|
|
36
|
+
borderWidth: 2,
|
|
37
|
+
borderStyle: "solid",
|
|
38
|
+
outlineWidth: 0,
|
|
39
|
+
backgroundColor: "var(--color-input-bg)",
|
|
40
|
+
color: "var(--color-input-fg)",
|
|
41
|
+
borderColor: "var(--color-input-border)",
|
|
42
|
+
hoverStyle: { borderColor: "var(--color-input-border-hover)" },
|
|
43
|
+
focusStyle: {
|
|
44
|
+
borderColor: "var(--color-input-border-focus)",
|
|
45
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
|
|
46
|
+
},
|
|
47
|
+
disabledStyle: { opacity: 0.4 }
|
|
48
|
+
};
|
|
47
49
|
var PinInput = React__namespace.forwardRef(
|
|
48
50
|
function PinInput2(props, ref) {
|
|
49
51
|
const {
|
|
@@ -135,8 +137,8 @@ var PinInput = React__namespace.forwardRef(
|
|
|
135
137
|
const onKeyDownAtIndex = React__namespace.useCallback((index) => (e) => {
|
|
136
138
|
handleKeyDown(index, e);
|
|
137
139
|
}, [handleKeyDown]);
|
|
138
|
-
const
|
|
139
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
140
|
+
const boxBackground = bgColor ? `var(--color-${bgColor.replace(/\./g, "-")})` : BOX.backgroundColor;
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { ref: rootRef, alignItems: "center", gap: attached ? 0 : 8, className, children: [
|
|
140
142
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
141
143
|
"input",
|
|
142
144
|
{
|
|
@@ -148,9 +150,10 @@ var PinInput = React__namespace.forwardRef(
|
|
|
148
150
|
}
|
|
149
151
|
),
|
|
150
152
|
Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
151
|
-
|
|
153
|
+
gui.Input,
|
|
152
154
|
{
|
|
153
155
|
ref: setInputRef(index),
|
|
156
|
+
unstyled: true,
|
|
154
157
|
type: "text",
|
|
155
158
|
inputMode: "numeric",
|
|
156
159
|
autoComplete: otp ? "one-time-code" : "off",
|
|
@@ -159,14 +162,12 @@ var PinInput = React__namespace.forwardRef(
|
|
|
159
162
|
placeholder,
|
|
160
163
|
disabled,
|
|
161
164
|
"aria-invalid": invalid || void 0,
|
|
165
|
+
"data-invalid": invalid || void 0,
|
|
162
166
|
value: values[index] || "",
|
|
163
|
-
className:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
attached && index > 0 && "-ml-0.5"
|
|
168
|
-
),
|
|
169
|
-
style: bgStyle,
|
|
167
|
+
className: "lux-control",
|
|
168
|
+
...BOX,
|
|
169
|
+
backgroundColor: boxBackground,
|
|
170
|
+
marginLeft: attached && index > 0 ? -2 : void 0,
|
|
170
171
|
onInput: onInputAtIndex(index),
|
|
171
172
|
onKeyDown: onKeyDownAtIndex(index),
|
|
172
173
|
onPaste: handlePaste,
|