@luxfi/ui 7.3.2 → 7.4.2
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 +2 -2
- package/dist/alert.js +1 -1
- package/dist/avatar.cjs +7 -6
- package/dist/avatar.js +7 -5
- package/dist/badge.cjs +36 -38
- package/dist/badge.js +31 -33
- package/dist/bank.cjs +13 -13
- package/dist/bank.d.cts +31 -24
- package/dist/bank.d.ts +31 -24
- package/dist/bank.js +1 -1
- package/dist/button.cjs +3 -3
- package/dist/button.js +1 -1
- 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 +950 -0
- package/dist/chrome.d.cts +93 -0
- package/dist/chrome.d.ts +93 -0
- package/dist/chrome.js +921 -0
- package/dist/close-button.cjs +2 -2
- package/dist/close-button.js +1 -1
- package/dist/dialog.cjs +13 -14
- package/dist/dialog.d.cts +58 -5
- package/dist/dialog.d.ts +58 -5
- package/dist/dialog.js +1 -2
- package/dist/drawer.cjs +87 -21
- 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 +206 -0
- package/dist/iam.d.cts +65 -0
- package/dist/iam.d.ts +65 -0
- package/dist/iam.js +201 -0
- package/dist/icon-button.cjs +2 -2
- package/dist/icon-button.js +1 -1
- 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 +420 -0
- package/dist/identity.d.cts +64 -0
- package/dist/identity.d.ts +64 -0
- package/dist/identity.js +398 -0
- package/dist/index.cjs +1699 -860
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +1618 -802
- package/dist/input.cjs +13 -3
- package/dist/input.d.cts +6 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.js +13 -3
- package/dist/lux.config.cjs +77 -0
- package/dist/lux.config.d.cts +433 -0
- package/dist/lux.config.d.ts +433 -0
- package/dist/lux.config.js +69 -0
- package/dist/menu.cjs +4 -4
- package/dist/menu.js +4 -4
- package/dist/next.cjs +99 -0
- package/dist/next.d.cts +29 -0
- package/dist/next.d.ts +29 -0
- package/dist/next.js +96 -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/popover.cjs +8 -9
- package/dist/popover.js +1 -2
- package/dist/progress.cjs +7 -6
- package/dist/progress.js +7 -5
- package/dist/provider.cjs +199 -5
- package/dist/provider.d.cts +16 -3
- package/dist/provider.d.ts +16 -3
- package/dist/provider.js +195 -6
- 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 +38 -41
- package/dist/tag.js +31 -34
- package/dist/textarea.cjs +13 -3
- package/dist/textarea.d.cts +2 -0
- package/dist/textarea.d.ts +2 -0
- package/dist/textarea.js +13 -3
- package/dist/tooltip.cjs +31 -33
- package/dist/tooltip.js +25 -27
- 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 +40 -0
- package/dist/vite.d.cts +29 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.js +38 -0
- package/dist/white-label.cjs +132 -0
- package/dist/white-label.d.cts +59 -0
- package/dist/white-label.d.ts +59 -0
- package/dist/white-label.js +124 -0
- package/package.json +95 -17
- package/src/avatar.tsx +22 -16
- package/src/bank.tsx +2 -2
- package/src/button.tsx +1 -1
- package/src/checkbox.tsx +15 -10
- package/src/chrome.tsx +459 -0
- package/src/close-button.tsx +1 -1
- package/src/dialog.tsx +1 -1
- package/src/drawer.tsx +83 -10
- 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/icon-button.tsx +1 -1
- package/src/icons.ts +18 -0
- package/src/identity.tsx +318 -0
- package/src/index.ts +50 -1
- package/src/input.tsx +24 -4
- package/src/lux.config.ts +82 -0
- package/src/menu.tsx +4 -4
- package/src/next.ts +142 -0
- package/src/option-chain.tsx +1 -1
- package/src/option-position.tsx +2 -1
- package/src/pnl-diagram.tsx +11 -6
- package/src/popover.tsx +1 -1
- package/src/progress.tsx +15 -8
- package/src/provider.tsx +92 -12
- 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 +18 -4
- package/src/tooltip.tsx +4 -23
- package/src/use-narrow.ts +40 -0
- package/src/vite.ts +78 -0
- package/src/white-label.ts +240 -0
- package/tokens.css +544 -319
- package/src/tokens.css +0 -438
package/dist/provider.d.cts
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
2
|
export { QueryClient, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
4
3
|
import React__default from 'react';
|
|
4
|
+
import { WhiteLabel } from './white-label.cjs';
|
|
5
5
|
|
|
6
|
+
/** The white-label identity for the host this page is being served under. */
|
|
7
|
+
declare const useWhiteLabel: () => WhiteLabel;
|
|
6
8
|
interface AppProviderProps {
|
|
7
9
|
children: React__default.ReactNode;
|
|
8
10
|
queryClient?: QueryClient;
|
|
11
|
+
/**
|
|
12
|
+
* Host header value, for server rendering. Omit in the browser and the host
|
|
13
|
+
* is read from `location`. Never bake a brand into a deployment — pass the
|
|
14
|
+
* request's host and the same image serves every org.
|
|
15
|
+
*/
|
|
16
|
+
host?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Escape hatch: pin the gui child-theme row (`dark_lux` | `dark_zoo` |
|
|
19
|
+
* `dark_hanzo` | `dark_pars`). Leave unset so the theme follows the host.
|
|
20
|
+
*/
|
|
21
|
+
defaultTheme?: string;
|
|
9
22
|
}
|
|
10
|
-
declare const AppProvider: ({ children, queryClient }: AppProviderProps) =>
|
|
23
|
+
declare const AppProvider: ({ children, queryClient, host, defaultTheme, }: AppProviderProps) => React__default.ReactElement;
|
|
11
24
|
|
|
12
|
-
export { AppProvider };
|
|
25
|
+
export { AppProvider, useWhiteLabel };
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
2
|
export { QueryClient, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
4
3
|
import React__default from 'react';
|
|
4
|
+
import { WhiteLabel } from './white-label.js';
|
|
5
5
|
|
|
6
|
+
/** The white-label identity for the host this page is being served under. */
|
|
7
|
+
declare const useWhiteLabel: () => WhiteLabel;
|
|
6
8
|
interface AppProviderProps {
|
|
7
9
|
children: React__default.ReactNode;
|
|
8
10
|
queryClient?: QueryClient;
|
|
11
|
+
/**
|
|
12
|
+
* Host header value, for server rendering. Omit in the browser and the host
|
|
13
|
+
* is read from `location`. Never bake a brand into a deployment — pass the
|
|
14
|
+
* request's host and the same image serves every org.
|
|
15
|
+
*/
|
|
16
|
+
host?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Escape hatch: pin the gui child-theme row (`dark_lux` | `dark_zoo` |
|
|
19
|
+
* `dark_hanzo` | `dark_pars`). Leave unset so the theme follows the host.
|
|
20
|
+
*/
|
|
21
|
+
defaultTheme?: string;
|
|
9
22
|
}
|
|
10
|
-
declare const AppProvider: ({ children, queryClient }: AppProviderProps) =>
|
|
23
|
+
declare const AppProvider: ({ children, queryClient, host, defaultTheme, }: AppProviderProps) => React__default.ReactElement;
|
|
11
24
|
|
|
12
|
-
export { AppProvider };
|
|
25
|
+
export { AppProvider, useWhiteLabel };
|
package/dist/provider.js
CHANGED
|
@@ -1,17 +1,206 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createGui } from '@
|
|
2
|
+
import { createGui, GuiProvider } from '@hanzo/gui';
|
|
3
3
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
4
4
|
export { QueryClient, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { defaultConfig } from '@hanzogui/config/v5';
|
|
7
|
+
import { animations } from '@hanzogui/config/v5-css';
|
|
5
8
|
import { jsx } from 'react/jsx-runtime';
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
// src/white-label.ts
|
|
11
|
+
var LUX_BRAND = {
|
|
12
|
+
lux: "#7000FF",
|
|
13
|
+
zoo: "#6C5EFB",
|
|
14
|
+
hanzo: "#EA580C",
|
|
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"
|
|
19
|
+
};
|
|
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 IdP is `id.zoo.network`, not a `zoo.id` apex — the one row in this
|
|
35
|
+
// table where the issuer is not `<org>.id`, and the one every hand-rolled
|
|
36
|
+
// per-app branding map got wrong.
|
|
37
|
+
iamDomain: "id.zoo.network",
|
|
38
|
+
accent: LUX_BRAND.zoo,
|
|
39
|
+
accentForeground: "#FFFFFF"
|
|
40
|
+
},
|
|
41
|
+
bootnode: {
|
|
42
|
+
org: "bootnode",
|
|
43
|
+
name: "Bootnode",
|
|
44
|
+
domain: "bootno.de",
|
|
45
|
+
iamDomain: "id.bootno.de",
|
|
46
|
+
accent: LUX_BRAND.lux,
|
|
47
|
+
accentForeground: "#FFFFFF"
|
|
48
|
+
},
|
|
49
|
+
hanzo: {
|
|
50
|
+
org: "hanzo",
|
|
51
|
+
name: "Hanzo",
|
|
52
|
+
domain: "hanzo.ai",
|
|
53
|
+
iamDomain: "hanzo.id",
|
|
54
|
+
accent: LUX_BRAND.hanzo,
|
|
55
|
+
accentForeground: "#FFFFFF"
|
|
56
|
+
},
|
|
57
|
+
pars: {
|
|
58
|
+
org: "pars",
|
|
59
|
+
name: "Pars",
|
|
60
|
+
domain: "pars.id",
|
|
61
|
+
iamDomain: "pars.id",
|
|
62
|
+
accent: LUX_BRAND.pars,
|
|
63
|
+
accentForeground: PARS_GOLD
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var DOMAIN_ORG = [
|
|
67
|
+
["lux.network", "lux"],
|
|
68
|
+
["lux.cloud", "lux"],
|
|
69
|
+
["lux.id", "lux"],
|
|
70
|
+
["lux.finance", "lux"],
|
|
71
|
+
["zoo.ngo", "zoo"],
|
|
72
|
+
["zoo.network", "zoo"],
|
|
73
|
+
["zoo.cloud", "zoo"],
|
|
74
|
+
["zoo.id", "zoo"],
|
|
75
|
+
["hanzo.ai", "hanzo"],
|
|
76
|
+
["hanzo.cloud", "hanzo"],
|
|
77
|
+
["hanzo.id", "hanzo"],
|
|
78
|
+
["pars.id", "pars"],
|
|
79
|
+
["parsdao.org", "pars"],
|
|
80
|
+
["bootno.de", "bootnode", "platform"]
|
|
81
|
+
];
|
|
82
|
+
var DEFAULT_ORG = "lux";
|
|
83
|
+
function normalizeHost(host) {
|
|
84
|
+
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
85
|
+
return noPort.replace(/\.$/, "");
|
|
86
|
+
}
|
|
87
|
+
function isUnder(host, domain) {
|
|
88
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
89
|
+
}
|
|
90
|
+
function matchDomain(host) {
|
|
91
|
+
let best;
|
|
92
|
+
for (const entry of DOMAIN_ORG) {
|
|
93
|
+
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
94
|
+
best = entry;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return best;
|
|
98
|
+
}
|
|
99
|
+
function appSlug(host, domain, apexApp) {
|
|
100
|
+
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
101
|
+
const leftmost = sub.split(".")[0] ?? "";
|
|
102
|
+
if (leftmost && leftmost !== "www") return leftmost;
|
|
103
|
+
if (apexApp) return apexApp;
|
|
104
|
+
const label = domain.split(".")[0] ?? "";
|
|
105
|
+
const tld = domain.split(".").slice(1).join(".");
|
|
106
|
+
return tld.split(".")[0] || label;
|
|
107
|
+
}
|
|
108
|
+
function isLocal(host) {
|
|
109
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
110
|
+
}
|
|
111
|
+
function resolveWhiteLabel(host) {
|
|
112
|
+
const h = normalizeHost(host ?? "");
|
|
113
|
+
const match = h ? matchDomain(h) : void 0;
|
|
114
|
+
const org = match ? match[1] : DEFAULT_ORG;
|
|
115
|
+
const identity = ORGS[org];
|
|
116
|
+
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
117
|
+
return {
|
|
118
|
+
...identity,
|
|
119
|
+
host: h,
|
|
120
|
+
app,
|
|
121
|
+
theme: `dark_${org}`,
|
|
122
|
+
issuer: `https://${identity.iamDomain}`,
|
|
123
|
+
clientId: `${org}-${app}`
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function currentHost() {
|
|
127
|
+
return typeof window === "undefined" ? "" : window.location.host;
|
|
9
128
|
}
|
|
129
|
+
|
|
130
|
+
// src/lux.config.ts
|
|
131
|
+
var TRUE_BLACK = "#000000";
|
|
132
|
+
var darkBase = {
|
|
133
|
+
...defaultConfig.themes.dark,
|
|
134
|
+
background: TRUE_BLACK,
|
|
135
|
+
backgroundHover: "#0A0A0A",
|
|
136
|
+
backgroundPress: "#141414",
|
|
137
|
+
backgroundFocus: "#0A0A0A"
|
|
138
|
+
};
|
|
139
|
+
var brandTheme = (accent, extra = {}) => ({
|
|
140
|
+
...darkBase,
|
|
141
|
+
accentBackground: accent,
|
|
142
|
+
accentColor: "#FFFFFF",
|
|
143
|
+
borderColorHover: accent,
|
|
144
|
+
colorHover: accent,
|
|
145
|
+
...extra
|
|
146
|
+
});
|
|
147
|
+
var luxThemes = {
|
|
148
|
+
dark: darkBase,
|
|
149
|
+
dark_lux: brandTheme(LUX_BRAND.lux),
|
|
150
|
+
dark_zoo: brandTheme(LUX_BRAND.zoo),
|
|
151
|
+
dark_hanzo: brandTheme(LUX_BRAND.hanzo),
|
|
152
|
+
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD }),
|
|
153
|
+
dark_bootnode: brandTheme(LUX_BRAND.bootnode)
|
|
154
|
+
};
|
|
155
|
+
var config = createGui({
|
|
156
|
+
...defaultConfig,
|
|
157
|
+
animations,
|
|
158
|
+
settings: {
|
|
159
|
+
...defaultConfig.settings,
|
|
160
|
+
onlyAllowShorthands: false
|
|
161
|
+
},
|
|
162
|
+
themes: {
|
|
163
|
+
...defaultConfig.themes,
|
|
164
|
+
...luxThemes
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
var lux_config_default = config;
|
|
10
168
|
var defaultQueryClient = new QueryClient({
|
|
11
169
|
defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
|
|
12
170
|
});
|
|
13
|
-
var
|
|
14
|
-
|
|
171
|
+
var FONT_BODY_RESET_ID = "lux-ui-font-body-reset";
|
|
172
|
+
var FONT_BODY_RESET_CSS = "body .font_body{line-height:1.5}";
|
|
173
|
+
var useFontBodyReset = () => {
|
|
174
|
+
React.useInsertionEffect(() => {
|
|
175
|
+
if (typeof document === "undefined") return;
|
|
176
|
+
if (document.getElementById(FONT_BODY_RESET_ID)) return;
|
|
177
|
+
const style = document.createElement("style");
|
|
178
|
+
style.id = FONT_BODY_RESET_ID;
|
|
179
|
+
style.textContent = FONT_BODY_RESET_CSS;
|
|
180
|
+
document.head.appendChild(style);
|
|
181
|
+
}, []);
|
|
182
|
+
};
|
|
183
|
+
var WhiteLabelContext = React.createContext(resolveWhiteLabel(""));
|
|
184
|
+
var useWhiteLabel = () => React.useContext(WhiteLabelContext);
|
|
185
|
+
var useHostWhiteLabel = (host) => {
|
|
186
|
+
const [resolvedHost, setResolvedHost] = React.useState(host ?? "");
|
|
187
|
+
React.useEffect(() => {
|
|
188
|
+
if (host !== void 0) return;
|
|
189
|
+
const browserHost = currentHost();
|
|
190
|
+
if (browserHost) setResolvedHost(browserHost);
|
|
191
|
+
}, [host]);
|
|
192
|
+
return React.useMemo(() => resolveWhiteLabel(resolvedHost), [resolvedHost]);
|
|
193
|
+
};
|
|
194
|
+
var AppProvider = ({
|
|
195
|
+
children,
|
|
196
|
+
queryClient,
|
|
197
|
+
host,
|
|
198
|
+
defaultTheme
|
|
199
|
+
}) => {
|
|
200
|
+
useFontBodyReset();
|
|
201
|
+
const whiteLabel = useHostWhiteLabel(host);
|
|
202
|
+
const theme = defaultTheme ?? whiteLabel.theme;
|
|
203
|
+
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 }) }) });
|
|
15
204
|
};
|
|
16
205
|
|
|
17
|
-
export { AppProvider };
|
|
206
|
+
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"
|