@luxfi/ui 7.4.0 → 7.4.3
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 +7 -6
- package/dist/avatar.js +7 -5
- package/dist/badge.cjs +33 -35
- package/dist/badge.js +33 -35
- package/dist/bank.d.cts +3 -3
- package/dist/bank.d.ts +3 -3
- package/dist/checkbox.cjs +4 -4
- package/dist/checkbox.d.cts +3 -2
- package/dist/checkbox.d.ts +3 -2
- package/dist/checkbox.js +5 -4
- package/dist/chrome.cjs +960 -0
- package/dist/chrome.d.cts +93 -0
- package/dist/chrome.d.ts +93 -0
- package/dist/chrome.js +931 -0
- package/dist/drawer.cjs +86 -20
- package/dist/drawer.js +85 -19
- package/dist/expiration-selector.cjs +3 -2
- package/dist/expiration-selector.js +3 -2
- package/dist/greeks-display.cjs +6 -6
- package/dist/greeks-display.js +6 -6
- package/dist/gui.cjs +13 -0
- package/dist/gui.d.cts +2 -0
- package/dist/gui.d.ts +2 -0
- package/dist/gui.js +2 -0
- package/dist/heading.cjs +4 -2
- package/dist/heading.js +4 -2
- package/dist/iam.cjs +216 -0
- package/dist/iam.d.cts +65 -0
- package/dist/iam.d.ts +65 -0
- package/dist/iam.js +211 -0
- package/dist/icons.cjs +13 -0
- package/dist/icons.d.cts +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/identity.cjs +430 -0
- package/dist/identity.d.cts +64 -0
- package/dist/identity.d.ts +64 -0
- package/dist/identity.js +408 -0
- package/dist/index.cjs +1610 -836
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1587 -831
- package/dist/input.cjs +3 -1
- package/dist/input.d.cts +3 -5
- package/dist/input.d.ts +3 -5
- package/dist/input.js +3 -1
- package/dist/lux.config.cjs +23 -2
- package/dist/lux.config.d.cts +28 -10
- package/dist/lux.config.d.ts +28 -10
- package/dist/lux.config.js +23 -2
- package/dist/menu.cjs +4 -4
- package/dist/menu.js +4 -4
- package/dist/next.cjs +132 -0
- package/dist/next.d.cts +32 -0
- package/dist/next.d.ts +32 -0
- package/dist/next.js +129 -0
- package/dist/option-chain.cjs +1 -1
- package/dist/option-chain.js +1 -1
- package/dist/option-position.cjs +2 -1
- package/dist/option-position.js +2 -1
- package/dist/pnl-diagram.cjs +8 -6
- package/dist/pnl-diagram.js +8 -6
- package/dist/progress.cjs +7 -6
- package/dist/progress.js +7 -5
- package/dist/provider.cjs +146 -4
- package/dist/provider.d.cts +15 -3
- package/dist/provider.d.ts +15 -3
- package/dist/provider.js +146 -5
- package/dist/radio.cjs +9 -7
- package/dist/radio.js +10 -7
- package/dist/separator.cjs +3 -1
- package/dist/separator.js +3 -1
- package/dist/slider.cjs +28 -16
- package/dist/slider.js +28 -15
- package/dist/strategy-builder.cjs +2 -1
- package/dist/strategy-builder.js +2 -1
- package/dist/switch.cjs +11 -12
- package/dist/switch.js +12 -12
- package/dist/tag.cjs +34 -36
- package/dist/tag.js +33 -35
- package/dist/textarea.cjs +3 -1
- package/dist/textarea.js +3 -1
- package/dist/tooltip.cjs +28 -30
- package/dist/tooltip.js +27 -29
- package/dist/use-narrow.cjs +46 -0
- package/dist/use-narrow.d.cts +12 -0
- package/dist/use-narrow.d.ts +12 -0
- package/dist/use-narrow.js +20 -0
- package/dist/vite.cjs +109 -0
- package/dist/vite.d.cts +29 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.js +107 -0
- package/dist/white-label.cjs +142 -0
- package/dist/white-label.d.cts +59 -0
- package/dist/white-label.d.ts +59 -0
- package/dist/white-label.js +134 -0
- package/package.json +85 -19
- package/src/avatar.tsx +22 -16
- package/src/checkbox.tsx +15 -10
- package/src/chrome.tsx +459 -0
- package/src/drawer.tsx +83 -10
- package/src/engine.ts +130 -0
- package/src/expiration-selector.tsx +3 -2
- package/src/greeks-display.tsx +9 -6
- package/src/gui.ts +17 -0
- package/src/heading.tsx +12 -8
- package/src/iam.ts +170 -0
- package/src/icons.ts +18 -0
- package/src/identity.tsx +318 -0
- package/src/index.ts +44 -1
- package/src/input.tsx +13 -9
- package/src/lux.config.ts +16 -15
- package/src/menu.tsx +4 -4
- package/src/next.ts +89 -0
- package/src/option-chain.tsx +1 -1
- package/src/option-position.tsx +2 -1
- package/src/pnl-diagram.tsx +11 -6
- package/src/progress.tsx +15 -8
- package/src/provider.tsx +48 -7
- package/src/radio.tsx +15 -11
- package/src/separator.tsx +8 -3
- package/src/slider.tsx +35 -19
- package/src/strategy-builder.tsx +3 -2
- package/src/switch.tsx +17 -16
- package/src/textarea.tsx +8 -4
- package/src/tooltip.tsx +15 -24
- package/src/use-narrow.ts +40 -0
- package/src/vite.ts +80 -0
- package/src/white-label.ts +254 -0
- package/tokens.css +613 -319
- package/src/tokens.css +0 -438
package/dist/provider.js
CHANGED
|
@@ -4,15 +4,140 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
|
4
4
|
export { QueryClient, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { defaultConfig } from '@hanzogui/config/v5';
|
|
7
|
+
import { animations } from '@hanzogui/config/v5-css';
|
|
7
8
|
import { jsx } from 'react/jsx-runtime';
|
|
8
9
|
|
|
10
|
+
// src/white-label.ts
|
|
9
11
|
var LUX_BRAND = {
|
|
10
12
|
lux: "#7000FF",
|
|
11
13
|
zoo: "#6C5EFB",
|
|
12
14
|
hanzo: "#EA580C",
|
|
13
|
-
pars: "#1C3879"
|
|
15
|
+
pars: "#1C3879",
|
|
16
|
+
// bootno.de is its own white label with its own IdP (id.bootno.de) — accent
|
|
17
|
+
// taken from the bootnode console's own brand default, not invented here.
|
|
18
|
+
bootnode: "#3B82F6"
|
|
14
19
|
};
|
|
15
20
|
var PARS_GOLD = "#C8A45C";
|
|
21
|
+
var ORGS = {
|
|
22
|
+
lux: {
|
|
23
|
+
org: "lux",
|
|
24
|
+
name: "Lux",
|
|
25
|
+
domain: "lux.network",
|
|
26
|
+
iamDomain: "lux.id",
|
|
27
|
+
accent: LUX_BRAND.lux,
|
|
28
|
+
accentForeground: "#FFFFFF"
|
|
29
|
+
},
|
|
30
|
+
zoo: {
|
|
31
|
+
org: "zoo",
|
|
32
|
+
name: "Zoo",
|
|
33
|
+
domain: "zoo.ngo",
|
|
34
|
+
// Zoo's issuer is `zoolabs.id` — the one row where it is not `<org>.id`,
|
|
35
|
+
// and the one every hand-rolled branding map gets wrong. `id.zoo.network`
|
|
36
|
+
// ANSWERS, which is why it keeps being copied around, but it is an alias:
|
|
37
|
+
// its own discovery document advertises
|
|
38
|
+
// issuer https://zoolabs.id
|
|
39
|
+
// authorization_endpoint https://zoolabs.id/v1/iam/oauth/authorize
|
|
40
|
+
// jwks_uri https://zoolabs.id/v1/iam/.well-known/jwks
|
|
41
|
+
// so a client configured on the alias validates `iss` against a string the
|
|
42
|
+
// IdP never emits and rejects every token it is given — the exact shape of
|
|
43
|
+
// the lux.id outage. `zoo.id` is not an IdP at all (no discovery document).
|
|
44
|
+
iamDomain: "zoolabs.id",
|
|
45
|
+
accent: LUX_BRAND.zoo,
|
|
46
|
+
accentForeground: "#FFFFFF"
|
|
47
|
+
},
|
|
48
|
+
bootnode: {
|
|
49
|
+
org: "bootnode",
|
|
50
|
+
name: "Bootnode",
|
|
51
|
+
domain: "bootno.de",
|
|
52
|
+
iamDomain: "id.bootno.de",
|
|
53
|
+
accent: LUX_BRAND.lux,
|
|
54
|
+
accentForeground: "#FFFFFF"
|
|
55
|
+
},
|
|
56
|
+
hanzo: {
|
|
57
|
+
org: "hanzo",
|
|
58
|
+
name: "Hanzo",
|
|
59
|
+
domain: "hanzo.ai",
|
|
60
|
+
iamDomain: "hanzo.id",
|
|
61
|
+
accent: LUX_BRAND.hanzo,
|
|
62
|
+
accentForeground: "#FFFFFF"
|
|
63
|
+
},
|
|
64
|
+
pars: {
|
|
65
|
+
org: "pars",
|
|
66
|
+
name: "Pars",
|
|
67
|
+
domain: "pars.id",
|
|
68
|
+
iamDomain: "pars.id",
|
|
69
|
+
accent: LUX_BRAND.pars,
|
|
70
|
+
accentForeground: PARS_GOLD
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var DOMAIN_ORG = [
|
|
74
|
+
["lux.network", "lux"],
|
|
75
|
+
["lux.cloud", "lux"],
|
|
76
|
+
["lux.id", "lux"],
|
|
77
|
+
["lux.finance", "lux"],
|
|
78
|
+
["lux.market", "lux"],
|
|
79
|
+
["lux.exchange", "lux"],
|
|
80
|
+
["zoo.ngo", "zoo"],
|
|
81
|
+
["zoo.network", "zoo"],
|
|
82
|
+
["zoo.cloud", "zoo"],
|
|
83
|
+
["zoolabs.id", "zoo"],
|
|
84
|
+
["hanzo.ai", "hanzo"],
|
|
85
|
+
["hanzo.cloud", "hanzo"],
|
|
86
|
+
["hanzo.id", "hanzo"],
|
|
87
|
+
["pars.id", "pars", "app"],
|
|
88
|
+
["pars.network", "pars", "app"],
|
|
89
|
+
["parsdao.org", "pars", "app"],
|
|
90
|
+
["bootno.de", "bootnode", "platform"]
|
|
91
|
+
];
|
|
92
|
+
var DEFAULT_ORG = "lux";
|
|
93
|
+
function normalizeHost(host) {
|
|
94
|
+
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
95
|
+
return noPort.replace(/\.$/, "");
|
|
96
|
+
}
|
|
97
|
+
function isUnder(host, domain) {
|
|
98
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
99
|
+
}
|
|
100
|
+
function matchDomain(host) {
|
|
101
|
+
let best;
|
|
102
|
+
for (const entry of DOMAIN_ORG) {
|
|
103
|
+
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
104
|
+
best = entry;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return best;
|
|
108
|
+
}
|
|
109
|
+
function appSlug(host, domain, pinned) {
|
|
110
|
+
if (pinned) return pinned;
|
|
111
|
+
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
112
|
+
const leftmost = sub.split(".")[0] ?? "";
|
|
113
|
+
if (leftmost && leftmost !== "www") return leftmost;
|
|
114
|
+
const label = domain.split(".")[0] ?? "";
|
|
115
|
+
const tld = domain.split(".").slice(1).join(".");
|
|
116
|
+
return tld.split(".")[0] || label;
|
|
117
|
+
}
|
|
118
|
+
function isLocal(host) {
|
|
119
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
120
|
+
}
|
|
121
|
+
function resolveWhiteLabel(host) {
|
|
122
|
+
const h = normalizeHost(host ?? "");
|
|
123
|
+
const match = h ? matchDomain(h) : void 0;
|
|
124
|
+
const org = match ? match[1] : DEFAULT_ORG;
|
|
125
|
+
const identity = ORGS[org];
|
|
126
|
+
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
127
|
+
return {
|
|
128
|
+
...identity,
|
|
129
|
+
host: h,
|
|
130
|
+
app,
|
|
131
|
+
theme: `dark_${org}`,
|
|
132
|
+
issuer: `https://${identity.iamDomain}`,
|
|
133
|
+
clientId: `${org}-${app}`
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function currentHost() {
|
|
137
|
+
return typeof window === "undefined" ? "" : window.location.host;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/lux.config.ts
|
|
16
141
|
var TRUE_BLACK = "#000000";
|
|
17
142
|
var darkBase = {
|
|
18
143
|
...defaultConfig.themes.dark,
|
|
@@ -34,10 +159,12 @@ var luxThemes = {
|
|
|
34
159
|
dark_lux: brandTheme(LUX_BRAND.lux),
|
|
35
160
|
dark_zoo: brandTheme(LUX_BRAND.zoo),
|
|
36
161
|
dark_hanzo: brandTheme(LUX_BRAND.hanzo),
|
|
37
|
-
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD })
|
|
162
|
+
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD }),
|
|
163
|
+
dark_bootnode: brandTheme(LUX_BRAND.bootnode)
|
|
38
164
|
};
|
|
39
165
|
var config = createGui({
|
|
40
166
|
...defaultConfig,
|
|
167
|
+
animations,
|
|
41
168
|
settings: {
|
|
42
169
|
...defaultConfig.settings,
|
|
43
170
|
onlyAllowShorthands: false
|
|
@@ -63,13 +190,27 @@ var useFontBodyReset = () => {
|
|
|
63
190
|
document.head.appendChild(style);
|
|
64
191
|
}, []);
|
|
65
192
|
};
|
|
193
|
+
var WhiteLabelContext = React.createContext(resolveWhiteLabel(""));
|
|
194
|
+
var useWhiteLabel = () => React.useContext(WhiteLabelContext);
|
|
195
|
+
var useHostWhiteLabel = (host) => {
|
|
196
|
+
const [resolvedHost, setResolvedHost] = React.useState(host ?? "");
|
|
197
|
+
React.useEffect(() => {
|
|
198
|
+
if (host !== void 0) return;
|
|
199
|
+
const browserHost = currentHost();
|
|
200
|
+
if (browserHost) setResolvedHost(browserHost);
|
|
201
|
+
}, [host]);
|
|
202
|
+
return React.useMemo(() => resolveWhiteLabel(resolvedHost), [resolvedHost]);
|
|
203
|
+
};
|
|
66
204
|
var AppProvider = ({
|
|
67
205
|
children,
|
|
68
206
|
queryClient,
|
|
69
|
-
|
|
207
|
+
host,
|
|
208
|
+
defaultTheme
|
|
70
209
|
}) => {
|
|
71
210
|
useFontBodyReset();
|
|
72
|
-
|
|
211
|
+
const whiteLabel = useHostWhiteLabel(host);
|
|
212
|
+
const theme = defaultTheme ?? whiteLabel.theme;
|
|
213
|
+
return /* @__PURE__ */ jsx(WhiteLabelContext.Provider, { value: whiteLabel, children: /* @__PURE__ */ jsx(GuiProvider, { config: lux_config_default, defaultTheme: theme, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient ?? defaultQueryClient, children }) }) });
|
|
73
214
|
};
|
|
74
215
|
|
|
75
|
-
export { AppProvider };
|
|
216
|
+
export { AppProvider, useWhiteLabel };
|
package/dist/radio.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var gui = require('@hanzo/gui');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -25,7 +25,6 @@ function _interopNamespace(e) {
|
|
|
25
25
|
return Object.freeze(n);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
var RadixRadioGroup__namespace = /*#__PURE__*/_interopNamespace(RadixRadioGroup);
|
|
29
28
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
29
|
|
|
31
30
|
// src/radio.tsx
|
|
@@ -68,7 +67,8 @@ var RadioGroupBase = React__namespace.forwardRef(
|
|
|
68
67
|
disabled = false,
|
|
69
68
|
readOnly = false,
|
|
70
69
|
orientation = "vertical",
|
|
71
|
-
loop
|
|
70
|
+
// `loop` was a Radix-only knob; gui's roving focus always wraps.
|
|
71
|
+
loop: _loop = true,
|
|
72
72
|
defaultValue,
|
|
73
73
|
value,
|
|
74
74
|
onValueChange,
|
|
@@ -84,14 +84,14 @@ var RadioGroupBase = React__namespace.forwardRef(
|
|
|
84
84
|
[readOnly, onValueChange]
|
|
85
85
|
);
|
|
86
86
|
return /* @__PURE__ */ jsxRuntime.jsx(RadioSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
-
|
|
87
|
+
gui.RadioGroup,
|
|
88
88
|
{
|
|
89
89
|
ref,
|
|
90
|
+
unstyled: true,
|
|
90
91
|
name,
|
|
91
92
|
required,
|
|
92
93
|
disabled: disabled || readOnly,
|
|
93
94
|
orientation,
|
|
94
|
-
loop,
|
|
95
95
|
defaultValue,
|
|
96
96
|
value: value ?? void 0,
|
|
97
97
|
onValueChange: handleValueChange,
|
|
@@ -128,8 +128,9 @@ var RadioBase = React__namespace.forwardRef(
|
|
|
128
128
|
...rest,
|
|
129
129
|
children: [
|
|
130
130
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
-
|
|
131
|
+
gui.RadioGroup.Item,
|
|
132
132
|
{
|
|
133
|
+
unstyled: true,
|
|
133
134
|
value,
|
|
134
135
|
disabled,
|
|
135
136
|
className: cn(
|
|
@@ -141,8 +142,9 @@ var RadioBase = React__namespace.forwardRef(
|
|
|
141
142
|
sizeClasses.control
|
|
142
143
|
),
|
|
143
144
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
144
|
-
|
|
145
|
+
gui.RadioGroup.Indicator,
|
|
145
146
|
{
|
|
147
|
+
unstyled: true,
|
|
146
148
|
className: cn(
|
|
147
149
|
"block rounded-full bg-gray-800 dark:bg-white",
|
|
148
150
|
sizeClasses.indicator
|
package/dist/radio.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import { RadioGroup } from '@hanzo/gui';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -37,7 +37,7 @@ var SIZE_CLASSES = {
|
|
|
37
37
|
};
|
|
38
38
|
var RadioSizeContext = React.createContext("md");
|
|
39
39
|
var RadioGroupBase = React.forwardRef(
|
|
40
|
-
function RadioGroup(props, ref) {
|
|
40
|
+
function RadioGroup$1(props, ref) {
|
|
41
41
|
const {
|
|
42
42
|
children,
|
|
43
43
|
name,
|
|
@@ -45,7 +45,8 @@ var RadioGroupBase = React.forwardRef(
|
|
|
45
45
|
disabled = false,
|
|
46
46
|
readOnly = false,
|
|
47
47
|
orientation = "vertical",
|
|
48
|
-
loop
|
|
48
|
+
// `loop` was a Radix-only knob; gui's roving focus always wraps.
|
|
49
|
+
loop: _loop = true,
|
|
49
50
|
defaultValue,
|
|
50
51
|
value,
|
|
51
52
|
onValueChange,
|
|
@@ -61,14 +62,14 @@ var RadioGroupBase = React.forwardRef(
|
|
|
61
62
|
[readOnly, onValueChange]
|
|
62
63
|
);
|
|
63
64
|
return /* @__PURE__ */ jsx(RadioSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(
|
|
64
|
-
|
|
65
|
+
RadioGroup,
|
|
65
66
|
{
|
|
66
67
|
ref,
|
|
68
|
+
unstyled: true,
|
|
67
69
|
name,
|
|
68
70
|
required,
|
|
69
71
|
disabled: disabled || readOnly,
|
|
70
72
|
orientation,
|
|
71
|
-
loop,
|
|
72
73
|
defaultValue,
|
|
73
74
|
value: value ?? void 0,
|
|
74
75
|
onValueChange: handleValueChange,
|
|
@@ -105,8 +106,9 @@ var RadioBase = React.forwardRef(
|
|
|
105
106
|
...rest,
|
|
106
107
|
children: [
|
|
107
108
|
/* @__PURE__ */ jsx(
|
|
108
|
-
|
|
109
|
+
RadioGroup.Item,
|
|
109
110
|
{
|
|
111
|
+
unstyled: true,
|
|
110
112
|
value,
|
|
111
113
|
disabled,
|
|
112
114
|
className: cn(
|
|
@@ -118,8 +120,9 @@ var RadioBase = React.forwardRef(
|
|
|
118
120
|
sizeClasses.control
|
|
119
121
|
),
|
|
120
122
|
children: /* @__PURE__ */ jsx(
|
|
121
|
-
|
|
123
|
+
RadioGroup.Indicator,
|
|
122
124
|
{
|
|
125
|
+
unstyled: true,
|
|
123
126
|
className: cn(
|
|
124
127
|
"block rounded-full bg-gray-800 dark:bg-white",
|
|
125
128
|
sizeClasses.indicator
|
package/dist/separator.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var gui = require('@hanzo/gui');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var clsx = require('clsx');
|
|
6
7
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -35,9 +36,10 @@ var Separator = React__default.default.forwardRef(
|
|
|
35
36
|
function Separator2({ orientation = "horizontal", variant = "solid", size = "sm", className, ...rest }, ref) {
|
|
36
37
|
const isVertical = orientation === "vertical";
|
|
37
38
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
-
|
|
39
|
+
gui.Separator,
|
|
39
40
|
{
|
|
40
41
|
ref,
|
|
42
|
+
vertical: isVertical,
|
|
41
43
|
role: "separator",
|
|
42
44
|
"aria-orientation": orientation,
|
|
43
45
|
className: cn(
|
package/dist/separator.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { Separator as Separator$1 } from '@hanzo/gui';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { clsx } from 'clsx';
|
|
4
5
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -29,9 +30,10 @@ var Separator = React.forwardRef(
|
|
|
29
30
|
function Separator2({ orientation = "horizontal", variant = "solid", size = "sm", className, ...rest }, ref) {
|
|
30
31
|
const isVertical = orientation === "vertical";
|
|
31
32
|
return /* @__PURE__ */ jsx(
|
|
32
|
-
|
|
33
|
+
Separator$1,
|
|
33
34
|
{
|
|
34
35
|
ref,
|
|
36
|
+
vertical: isVertical,
|
|
35
37
|
role: "separator",
|
|
36
38
|
"aria-orientation": orientation,
|
|
37
39
|
className: cn(
|
package/dist/slider.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var gui = require('@hanzo/gui');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -25,15 +25,12 @@ function _interopNamespace(e) {
|
|
|
25
25
|
return Object.freeze(n);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
var RadixSlider__namespace = /*#__PURE__*/_interopNamespace(RadixSlider);
|
|
29
28
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
29
|
|
|
31
30
|
// src/slider.tsx
|
|
32
31
|
function cn(...inputs) {
|
|
33
32
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
34
33
|
}
|
|
35
|
-
var THUMB_SIZE = 20;
|
|
36
|
-
var TRACK_HEIGHT = 6;
|
|
37
34
|
var Slider = React__namespace.forwardRef(
|
|
38
35
|
function Slider2(props, ref) {
|
|
39
36
|
const {
|
|
@@ -46,7 +43,7 @@ var Slider = React__namespace.forwardRef(
|
|
|
46
43
|
max = 100,
|
|
47
44
|
step,
|
|
48
45
|
disabled,
|
|
49
|
-
orientation,
|
|
46
|
+
orientation = "horizontal",
|
|
50
47
|
name,
|
|
51
48
|
onValueChange,
|
|
52
49
|
onValueCommit,
|
|
@@ -58,6 +55,14 @@ var Slider = React__namespace.forwardRef(
|
|
|
58
55
|
return mark;
|
|
59
56
|
});
|
|
60
57
|
const hasMarkLabel = Boolean(marks?.some((mark) => mark.label));
|
|
58
|
+
const latest = React__namespace.useRef(value ?? defaultValue ?? []);
|
|
59
|
+
const handleValueChange = React__namespace.useCallback((next) => {
|
|
60
|
+
latest.current = next;
|
|
61
|
+
onValueChange?.(next);
|
|
62
|
+
}, [onValueChange]);
|
|
63
|
+
const handleSlideEnd = React__namespace.useCallback(() => {
|
|
64
|
+
onValueCommit?.(latest.current);
|
|
65
|
+
}, [onValueCommit]);
|
|
61
66
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
62
67
|
label && !showValue && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
|
|
63
68
|
label && showValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -65,9 +70,10 @@ var Slider = React__namespace.forwardRef(
|
|
|
65
70
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
|
|
66
71
|
] }),
|
|
67
72
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
68
|
-
|
|
73
|
+
gui.Slider,
|
|
69
74
|
{
|
|
70
75
|
ref,
|
|
76
|
+
unstyled: true,
|
|
71
77
|
className: cn(
|
|
72
78
|
"relative flex w-full touch-none select-none items-center",
|
|
73
79
|
hasMarkLabel && "mb-6"
|
|
@@ -80,24 +86,30 @@ var Slider = React__namespace.forwardRef(
|
|
|
80
86
|
disabled,
|
|
81
87
|
orientation,
|
|
82
88
|
name,
|
|
83
|
-
onValueChange,
|
|
84
|
-
|
|
89
|
+
onValueChange: handleValueChange,
|
|
90
|
+
onSlideEnd: handleSlideEnd,
|
|
85
91
|
children: [
|
|
86
92
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
-
|
|
93
|
+
gui.Slider.Track,
|
|
88
94
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
unstyled: true,
|
|
96
|
+
className: "relative grow h-1.5 rounded-full bg-border-divider",
|
|
97
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
gui.Slider.TrackActive,
|
|
99
|
+
{
|
|
100
|
+
unstyled: true,
|
|
101
|
+
className: "absolute h-full rounded-full bg-link-primary"
|
|
102
|
+
}
|
|
103
|
+
)
|
|
94
104
|
}
|
|
95
105
|
),
|
|
96
106
|
resolvedValue?.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
-
|
|
107
|
+
gui.Slider.Thumb,
|
|
98
108
|
{
|
|
109
|
+
index,
|
|
110
|
+
unstyled: true,
|
|
99
111
|
className: cn(
|
|
100
|
-
|
|
112
|
+
"block h-5 w-5",
|
|
101
113
|
"rounded-full border-2 border-link-primary bg-white",
|
|
102
114
|
"shadow-sm transition-colors",
|
|
103
115
|
"hover:border-link-primary-hover",
|
package/dist/slider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import { Slider as Slider$1 } from '@hanzo/gui';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -9,8 +9,6 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
9
9
|
function cn(...inputs) {
|
|
10
10
|
return twMerge(clsx(inputs));
|
|
11
11
|
}
|
|
12
|
-
var THUMB_SIZE = 20;
|
|
13
|
-
var TRACK_HEIGHT = 6;
|
|
14
12
|
var Slider = React.forwardRef(
|
|
15
13
|
function Slider2(props, ref) {
|
|
16
14
|
const {
|
|
@@ -23,7 +21,7 @@ var Slider = React.forwardRef(
|
|
|
23
21
|
max = 100,
|
|
24
22
|
step,
|
|
25
23
|
disabled,
|
|
26
|
-
orientation,
|
|
24
|
+
orientation = "horizontal",
|
|
27
25
|
name,
|
|
28
26
|
onValueChange,
|
|
29
27
|
onValueCommit,
|
|
@@ -35,6 +33,14 @@ var Slider = React.forwardRef(
|
|
|
35
33
|
return mark;
|
|
36
34
|
});
|
|
37
35
|
const hasMarkLabel = Boolean(marks?.some((mark) => mark.label));
|
|
36
|
+
const latest = React.useRef(value ?? defaultValue ?? []);
|
|
37
|
+
const handleValueChange = React.useCallback((next) => {
|
|
38
|
+
latest.current = next;
|
|
39
|
+
onValueChange?.(next);
|
|
40
|
+
}, [onValueChange]);
|
|
41
|
+
const handleSlideEnd = React.useCallback(() => {
|
|
42
|
+
onValueCommit?.(latest.current);
|
|
43
|
+
}, [onValueCommit]);
|
|
38
44
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
39
45
|
label && !showValue && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
|
|
40
46
|
label && showValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -42,9 +48,10 @@ var Slider = React.forwardRef(
|
|
|
42
48
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
|
|
43
49
|
] }),
|
|
44
50
|
/* @__PURE__ */ jsxs(
|
|
45
|
-
|
|
51
|
+
Slider$1,
|
|
46
52
|
{
|
|
47
53
|
ref,
|
|
54
|
+
unstyled: true,
|
|
48
55
|
className: cn(
|
|
49
56
|
"relative flex w-full touch-none select-none items-center",
|
|
50
57
|
hasMarkLabel && "mb-6"
|
|
@@ -57,24 +64,30 @@ var Slider = React.forwardRef(
|
|
|
57
64
|
disabled,
|
|
58
65
|
orientation,
|
|
59
66
|
name,
|
|
60
|
-
onValueChange,
|
|
61
|
-
|
|
67
|
+
onValueChange: handleValueChange,
|
|
68
|
+
onSlideEnd: handleSlideEnd,
|
|
62
69
|
children: [
|
|
63
70
|
/* @__PURE__ */ jsx(
|
|
64
|
-
|
|
71
|
+
Slider$1.Track,
|
|
65
72
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
unstyled: true,
|
|
74
|
+
className: "relative grow h-1.5 rounded-full bg-border-divider",
|
|
75
|
+
children: /* @__PURE__ */ jsx(
|
|
76
|
+
Slider$1.TrackActive,
|
|
77
|
+
{
|
|
78
|
+
unstyled: true,
|
|
79
|
+
className: "absolute h-full rounded-full bg-link-primary"
|
|
80
|
+
}
|
|
81
|
+
)
|
|
71
82
|
}
|
|
72
83
|
),
|
|
73
84
|
resolvedValue?.map((_, index) => /* @__PURE__ */ jsx(
|
|
74
|
-
|
|
85
|
+
Slider$1.Thumb,
|
|
75
86
|
{
|
|
87
|
+
index,
|
|
88
|
+
unstyled: true,
|
|
76
89
|
className: cn(
|
|
77
|
-
|
|
90
|
+
"block h-5 w-5",
|
|
78
91
|
"rounded-full border-2 border-link-primary bg-white",
|
|
79
92
|
"shadow-sm transition-colors",
|
|
80
93
|
"hover:border-link-primary-hover",
|
|
@@ -161,7 +161,8 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
161
161
|
type: "button",
|
|
162
162
|
className: cn(
|
|
163
163
|
"px-2 py-0.5 rounded text-xs font-medium transition-colors",
|
|
164
|
-
|
|
164
|
+
// Call vs put is a rank difference, not a hue difference.
|
|
165
|
+
leg.type === "call" ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
|
|
165
166
|
),
|
|
166
167
|
onClick: () => update({ type: leg.type === "call" ? "put" : "call" }),
|
|
167
168
|
children: leg.type === "call" ? "CALL" : "PUT"
|
package/dist/strategy-builder.js
CHANGED
|
@@ -139,7 +139,8 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
139
139
|
type: "button",
|
|
140
140
|
className: cn(
|
|
141
141
|
"px-2 py-0.5 rounded text-xs font-medium transition-colors",
|
|
142
|
-
|
|
142
|
+
// Call vs put is a rank difference, not a hue difference.
|
|
143
|
+
leg.type === "call" ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
|
|
143
144
|
),
|
|
144
145
|
onClick: () => update({ type: leg.type === "call" ? "put" : "call" }),
|
|
145
146
|
children: leg.type === "call" ? "CALL" : "PUT"
|
package/dist/switch.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var gui = require('@hanzo/gui');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -25,7 +25,6 @@ function _interopNamespace(e) {
|
|
|
25
25
|
return Object.freeze(n);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
var RadixSwitch__namespace = /*#__PURE__*/_interopNamespace(RadixSwitch);
|
|
29
28
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
29
|
|
|
31
30
|
// src/switch.tsx
|
|
@@ -37,17 +36,17 @@ var NOOP = () => {
|
|
|
37
36
|
var SIZE_CLASSES = {
|
|
38
37
|
sm: {
|
|
39
38
|
root: "h-4 w-7",
|
|
40
|
-
thumb: "h-3 w-3
|
|
39
|
+
thumb: "h-3 w-3",
|
|
41
40
|
label: "text-xs"
|
|
42
41
|
},
|
|
43
42
|
md: {
|
|
44
43
|
root: "h-5 w-9",
|
|
45
|
-
thumb: "h-4 w-4
|
|
44
|
+
thumb: "h-4 w-4",
|
|
46
45
|
label: "text-sm"
|
|
47
46
|
},
|
|
48
47
|
lg: {
|
|
49
48
|
root: "h-6 w-11",
|
|
50
|
-
thumb: "h-5 w-5
|
|
49
|
+
thumb: "h-5 w-5",
|
|
51
50
|
label: "text-base"
|
|
52
51
|
}
|
|
53
52
|
};
|
|
@@ -78,9 +77,7 @@ var SwitchBase = React__namespace.forwardRef(
|
|
|
78
77
|
if (!isControlled) {
|
|
79
78
|
setInternalChecked(nextChecked);
|
|
80
79
|
}
|
|
81
|
-
|
|
82
|
-
onCheckedChange({ checked: nextChecked });
|
|
83
|
-
}
|
|
80
|
+
onCheckedChange?.({ checked: nextChecked });
|
|
84
81
|
},
|
|
85
82
|
[isControlled, onCheckedChange]
|
|
86
83
|
);
|
|
@@ -101,8 +98,9 @@ var SwitchBase = React__namespace.forwardRef(
|
|
|
101
98
|
...rest,
|
|
102
99
|
children: [
|
|
103
100
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
104
|
-
|
|
101
|
+
gui.Switch,
|
|
105
102
|
{
|
|
103
|
+
unstyled: true,
|
|
106
104
|
checked: checkedState,
|
|
107
105
|
onCheckedChange: handleCheckedChange,
|
|
108
106
|
disabled,
|
|
@@ -117,12 +115,13 @@ var SwitchBase = React__namespace.forwardRef(
|
|
|
117
115
|
children: [
|
|
118
116
|
trackLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-bold text-white pointer-events-none", children: checkedState ? trackLabel.on : trackLabel.off }),
|
|
119
117
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
-
|
|
118
|
+
gui.Switch.Thumb,
|
|
121
119
|
{
|
|
120
|
+
unstyled: true,
|
|
121
|
+
"data-thumb": true,
|
|
122
|
+
transition: "quicker",
|
|
122
123
|
className: cn(
|
|
123
124
|
"block rounded-full bg-white shadow-sm",
|
|
124
|
-
"transition-transform duration-200",
|
|
125
|
-
"translate-x-0.5",
|
|
126
125
|
sizeClasses.thumb
|
|
127
126
|
),
|
|
128
127
|
children: thumbLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center justify-center h-full w-full text-[8px]", children: checkedState ? thumbLabel.on : thumbLabel.off })
|