@luxfi/ui 8.2.7 → 8.2.9
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/3d-model-viewer.cjs +25 -421
- package/dist/3d-model-viewer.js +20 -416
- package/dist/accordion.cjs +3 -10
- package/dist/accordion.js +2 -10
- package/dist/advanced-navigation-bar.cjs +5 -401
- package/dist/advanced-navigation-bar.js +5 -401
- package/dist/ai-agents.cjs +45 -890
- package/dist/ai-agents.js +8 -834
- package/dist/ai-assistant.cjs +13 -740
- package/dist/ai-assistant.js +10 -738
- package/dist/ai-chat.cjs +24 -770
- package/dist/ai-chat.js +18 -765
- package/dist/ai-code.cjs +67 -923
- package/dist/ai-code.js +49 -905
- package/dist/ai-playground.cjs +25 -801
- package/dist/ai-playground.js +18 -795
- package/dist/ai-tools.cjs +22 -767
- package/dist/ai-tools.js +15 -761
- package/dist/ai-vision.cjs +41 -993
- package/dist/ai-vision.js +30 -983
- package/dist/ai-voice-settings.cjs +35 -1006
- package/dist/ai-voice-settings.js +32 -1004
- package/dist/ai-voice.cjs +51 -1024
- package/dist/ai-voice.js +9 -963
- package/dist/alert.cjs +11 -129
- package/dist/alert.js +8 -127
- package/dist/announcement.cjs +6 -402
- package/dist/announcement.js +6 -402
- package/dist/app-switcher-navigation-bar.cjs +5 -401
- package/dist/app-switcher-navigation-bar.js +5 -401
- package/dist/apple-cards-carousel.cjs +84 -480
- package/dist/apple-cards-carousel.js +19 -415
- package/dist/auth.cjs +10 -387
- package/dist/auth.js +7 -385
- package/dist/avatar.cjs +2 -9
- package/dist/avatar.js +2 -10
- package/dist/badge.cjs +8 -228
- package/dist/badge.js +5 -210
- package/dist/button.cjs +14 -67
- package/dist/button.js +12 -65
- package/dist/chrome.cjs +29 -493
- package/dist/chrome.js +9 -474
- package/dist/code-block.cjs +16 -664
- package/dist/code-block.js +13 -662
- package/dist/code-compare.cjs +28 -1302
- package/dist/code-compare.js +18 -1293
- package/dist/code-diff.cjs +21 -669
- package/dist/code-diff.js +17 -666
- package/dist/code-editor.cjs +13 -409
- package/dist/code-editor.js +12 -408
- package/dist/code-explorer.cjs +14 -456
- package/dist/code-explorer.js +13 -456
- package/dist/code-preview.cjs +31 -983
- package/dist/code-preview.js +23 -976
- package/dist/code-snippet.cjs +19 -667
- package/dist/code-snippet.js +14 -663
- package/dist/code-terminal.cjs +24 -485
- package/dist/code-terminal.js +19 -481
- package/dist/collapsible.cjs +13 -347
- package/dist/collapsible.js +11 -330
- package/dist/color-picker.cjs +8 -450
- package/dist/color-picker.js +7 -450
- package/dist/combobox.cjs +6 -402
- package/dist/combobox.js +6 -402
- package/dist/communication-navigation-bar.cjs +7 -403
- package/dist/communication-navigation-bar.js +5 -401
- package/dist/dashboard-navigation-bar.cjs +6 -402
- package/dist/dashboard-navigation-bar.js +5 -401
- package/dist/dialog-stack.cjs +5 -401
- package/dist/dialog-stack.js +5 -401
- package/dist/dialog.cjs +13 -70
- package/dist/dialog.js +13 -70
- package/dist/drawer.cjs +23 -99
- package/dist/drawer.js +19 -96
- package/dist/e-commerce-navigation-bar.cjs +7 -403
- package/dist/e-commerce-navigation-bar.js +5 -401
- package/dist/editor.cjs +9 -405
- package/dist/editor.js +6 -402
- package/dist/iam.cjs +2 -123
- package/dist/iam.js +1 -122
- package/dist/icon-button.cjs +2 -56
- package/dist/icon-button.js +1 -55
- package/dist/identity.cjs +28 -242
- package/dist/identity.js +20 -235
- package/dist/image-crop.cjs +10 -406
- package/dist/image-crop.js +7 -403
- package/dist/image.cjs +14 -83
- package/dist/image.js +13 -67
- package/dist/index.cjs +1868 -38770
- package/dist/index.js +174 -38320
- package/dist/input-group.cjs +3 -10
- package/dist/input-group.js +2 -10
- package/dist/item.cjs +2 -27
- package/dist/item.js +1 -22
- package/dist/kanban.cjs +25 -751
- package/dist/kanban.js +15 -742
- package/dist/limelight-nav.cjs +10 -452
- package/dist/limelight-nav.js +9 -452
- package/dist/link.cjs +11 -80
- package/dist/link.js +6 -60
- package/dist/lux.config.cjs +14 -32
- package/dist/lux.config.js +3 -26
- package/dist/menu.cjs +5 -13
- package/dist/menu.js +1 -9
- package/dist/message-dock.cjs +5 -401
- package/dist/message-dock.js +5 -401
- package/dist/mini-calendar.cjs +7 -403
- package/dist/mini-calendar.js +6 -402
- package/dist/music-player.cjs +30 -528
- package/dist/music-player.js +22 -520
- package/dist/next.cjs +8 -89
- package/dist/next.js +3 -86
- package/dist/popover.cjs +17 -74
- package/dist/popover.js +16 -73
- package/dist/progress-circle.cjs +3 -10
- package/dist/progress-circle.js +2 -10
- package/dist/provider.cjs +7 -176
- package/dist/provider.js +4 -174
- package/dist/select.cjs +36 -89
- package/dist/select.js +35 -88
- package/dist/sidebar.cjs +22 -493
- package/dist/sidebar.js +17 -489
- package/dist/site/commerce/ui/context.cjs +9 -214
- package/dist/site/commerce/ui/context.js +6 -215
- package/dist/site/components/analytics.cjs +2 -42
- package/dist/site/components/analytics.js +1 -37
- package/dist/site/components/auth/callback.cjs +2 -8
- package/dist/site/components/auth/callback.js +1 -7
- package/dist/site/components/auth/login-panel.cjs +15 -74
- package/dist/site/components/auth/login-panel.js +12 -73
- package/dist/site/components/auth/login.cjs +2 -6
- package/dist/site/components/auth/login.js +1 -5
- package/dist/site/components/auth/widget.cjs +2 -6
- package/dist/site/components/auth/widget.js +1 -5
- package/dist/site/components/commerce/bag-button.cjs +2 -3
- package/dist/site/components/commerce/bag-button.js +2 -3
- package/dist/site/components/commerce/buy-button.cjs +2 -11
- package/dist/site/components/commerce/buy-button.js +1 -10
- package/dist/site/components/commerce/checkout-button.cjs +2 -3
- package/dist/site/components/commerce/checkout-button.js +2 -3
- package/dist/site/components/commerce/checkout-panel/desktop-cp.cjs +15 -173
- package/dist/site/components/commerce/checkout-panel/desktop-cp.js +14 -174
- package/dist/site/components/commerce/checkout-panel/index.cjs +9 -400
- package/dist/site/components/commerce/checkout-panel/index.js +10 -403
- package/dist/site/components/commerce/checkout-panel/mobile-cp.cjs +15 -236
- package/dist/site/components/commerce/checkout-panel/mobile-cp.js +13 -237
- package/dist/site/components/commerce/desktop-bag-popup.cjs +7 -8
- package/dist/site/components/commerce/desktop-bag-popup.js +3 -8
- package/dist/site/components/commerce/drawer/index.cjs +15 -289
- package/dist/site/components/commerce/drawer/index.js +10 -290
- package/dist/site/components/commerce/drawer/micro.cjs +8 -115
- package/dist/site/components/commerce/drawer/micro.js +4 -115
- package/dist/site/components/commerce/drawer/shell.cjs +2 -10
- package/dist/site/components/commerce/drawer/shell.js +2 -10
- package/dist/site/components/contact-dialog/index.cjs +6 -69
- package/dist/site/components/contact-dialog/index.js +7 -71
- package/dist/site/components/drawer-margin.cjs +2 -10
- package/dist/site/components/drawer-margin.js +2 -10
- package/dist/site/components/footer.cjs +11 -81
- package/dist/site/components/footer.js +8 -80
- package/dist/site/components/header/desktop.cjs +18 -374
- package/dist/site/components/header/desktop.js +12 -355
- package/dist/site/components/header/index.cjs +9 -674
- package/dist/site/components/header/index.js +8 -657
- package/dist/site/components/header/mobile-bag-drawer.cjs +6 -71
- package/dist/site/components/header/mobile-bag-drawer.js +5 -74
- package/dist/site/components/header/mobile-nav-menu-ai.cjs +2 -31
- package/dist/site/components/header/mobile-nav-menu-ai.js +1 -26
- package/dist/site/components/header/mobile-nav-menu-item.cjs +6 -60
- package/dist/site/components/header/mobile-nav-menu-item.js +6 -61
- package/dist/site/components/header/mobile-nav-menu.cjs +7 -110
- package/dist/site/components/header/mobile-nav-menu.js +7 -112
- package/dist/site/components/header/mobile.cjs +25 -330
- package/dist/site/components/header/mobile.js +20 -330
- package/dist/site/components/icons/index.cjs +34 -35
- package/dist/site/components/icons/index.js +5 -33
- package/dist/site/components/index.cjs +118 -1961
- package/dist/site/components/index.js +23 -1951
- package/dist/site/components/mini-chart/index.cjs +7 -90
- package/dist/site/components/mini-chart/index.js +1 -92
- package/dist/site/components/mini-chart/wrapper.cjs +7 -76
- package/dist/site/components/mini-chart/wrapper.js +4 -77
- package/dist/site/components/not-found/index.cjs +9 -819
- package/dist/site/components/not-found/index.js +8 -802
- package/dist/site/components/security/index.cjs +9 -819
- package/dist/site/components/security/index.js +8 -802
- package/dist/site/next/analytics/index.cjs +16 -49
- package/dist/site/next/analytics/index.js +3 -49
- package/dist/site/next/analytics/pixel-analytics.cjs +23 -8
- package/dist/site/next/analytics/pixel-analytics.js +4 -8
- package/dist/site/next/index.cjs +13 -140
- package/dist/site/next/index.js +2 -140
- package/dist/site/root-layout/index.cjs +12 -1435
- package/dist/site/root-layout/index.css +0 -133
- package/dist/site/root-layout/index.js +12 -1416
- package/dist/site/site-def/footer/community.cjs +11 -27
- package/dist/site/site-def/footer/community.js +2 -18
- package/dist/site/site-def/footer/company.d.ts +3 -3
- package/dist/site/site-def/footer/index.cjs +38 -218
- package/dist/site/site-def/footer/index.js +14 -215
- package/dist/site/site-def/index.cjs +28 -620
- package/dist/site/site-def/index.js +3 -624
- package/dist/table.cjs +20 -338
- package/dist/table.js +19 -338
- package/dist/tabs.cjs +3 -10
- package/dist/tabs.js +1 -9
- package/dist/tag.cjs +9 -270
- package/dist/tag.js +6 -268
- package/dist/tags.cjs +6 -314
- package/dist/tags.js +5 -314
- package/dist/textarea.cjs +4 -50
- package/dist/textarea.js +3 -49
- package/dist/tooltip.cjs +15 -34
- package/dist/tooltip.js +13 -33
- package/dist/vite.cjs +3 -82
- package/dist/vite.js +1 -80
- package/package.json +1 -1
- package/dist/index.css +0 -132
- package/dist/site/components/auth/login-panel.css +0 -4
- package/dist/site/components/commerce/bag-button.css +0 -4
- package/dist/site/components/commerce/checkout-button.css +0 -4
- package/dist/site/components/commerce/checkout-panel/desktop-cp.css +0 -132
- package/dist/site/components/commerce/checkout-panel/index.css +0 -132
- package/dist/site/components/commerce/checkout-panel/mobile-cp.css +0 -132
- package/dist/site/components/commerce/desktop-bag-popup.css +0 -4
- package/dist/site/components/commerce/drawer/index.css +0 -132
- package/dist/site/components/commerce/drawer/micro.css +0 -4
- package/dist/site/components/header/desktop.css +0 -4
- package/dist/site/components/header/index.css +0 -132
- package/dist/site/components/header/mobile-bag-drawer.css +0 -4
- package/dist/site/components/header/mobile-nav-menu-ai.css +0 -132
- package/dist/site/components/header/mobile-nav-menu-item.css +0 -132
- package/dist/site/components/header/mobile-nav-menu.css +0 -132
- package/dist/site/components/header/mobile.css +0 -132
- package/dist/site/components/icons/index.css +0 -4
- package/dist/site/components/index.css +0 -132
- package/dist/site/components/not-found/index.css +0 -132
- package/dist/site/components/security/index.css +0 -132
- package/dist/site/site-def/footer/community.css +0 -4
- package/dist/site/site-def/footer/index.css +0 -4
- package/dist/site/site-def/index.css +0 -4
package/dist/provider.cjs
CHANGED
|
@@ -4,184 +4,15 @@
|
|
|
4
4
|
var gui = require('@hanzo/gui');
|
|
5
5
|
var reactQuery = require('@tanstack/react-query');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var v5Css = require('@hanzogui/config/v5-css');
|
|
7
|
+
var config = require('./lux.config.cjs');
|
|
8
|
+
var whiteLabel_cjs = require('./white-label.cjs');
|
|
10
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
10
|
|
|
12
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
|
|
14
13
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
|
+
var config__default = /*#__PURE__*/_interopDefault(config);
|
|
15
15
|
|
|
16
|
-
// src/white-label.ts
|
|
17
|
-
var LUX_BRAND = {
|
|
18
|
-
lux: "#7000FF",
|
|
19
|
-
zoo: "#6C5EFB",
|
|
20
|
-
hanzo: "#EA580C",
|
|
21
|
-
pars: "#1C3879",
|
|
22
|
-
// bootno.de is its own white label with its own IdP (id.bootno.de) — accent
|
|
23
|
-
// taken from the bootnode console's own brand default, not invented here.
|
|
24
|
-
bootnode: "#3B82F6"
|
|
25
|
-
};
|
|
26
|
-
var PARS_GOLD = "#C8A45C";
|
|
27
|
-
var ORGS = {
|
|
28
|
-
lux: {
|
|
29
|
-
org: "lux",
|
|
30
|
-
name: "Lux",
|
|
31
|
-
domain: "lux.network",
|
|
32
|
-
iamDomain: "lux.id",
|
|
33
|
-
accent: LUX_BRAND.lux,
|
|
34
|
-
accentForeground: "#FFFFFF"
|
|
35
|
-
},
|
|
36
|
-
zoo: {
|
|
37
|
-
org: "zoo",
|
|
38
|
-
name: "Zoo",
|
|
39
|
-
domain: "zoo.ngo",
|
|
40
|
-
// Zoo's issuer is `zoolabs.id` — the one row where it is not `<org>.id`,
|
|
41
|
-
// and the one every hand-rolled branding map gets wrong. `id.zoo.network`
|
|
42
|
-
// ANSWERS, which is why it keeps being copied around, but it is an alias:
|
|
43
|
-
// its own discovery document advertises
|
|
44
|
-
// issuer https://zoolabs.id
|
|
45
|
-
// authorization_endpoint https://zoolabs.id/v1/iam/oauth/authorize
|
|
46
|
-
// jwks_uri https://zoolabs.id/v1/iam/.well-known/jwks
|
|
47
|
-
// so a client configured on the alias validates `iss` against a string the
|
|
48
|
-
// IdP never emits and rejects every token it is given — the exact shape of
|
|
49
|
-
// the lux.id outage. `zoo.id` is not an IdP at all (no discovery document).
|
|
50
|
-
iamDomain: "zoolabs.id",
|
|
51
|
-
accent: LUX_BRAND.zoo,
|
|
52
|
-
accentForeground: "#FFFFFF"
|
|
53
|
-
},
|
|
54
|
-
bootnode: {
|
|
55
|
-
org: "bootnode",
|
|
56
|
-
name: "Bootnode",
|
|
57
|
-
domain: "bootno.de",
|
|
58
|
-
iamDomain: "id.bootno.de",
|
|
59
|
-
accent: LUX_BRAND.lux,
|
|
60
|
-
accentForeground: "#FFFFFF"
|
|
61
|
-
},
|
|
62
|
-
hanzo: {
|
|
63
|
-
org: "hanzo",
|
|
64
|
-
name: "Hanzo",
|
|
65
|
-
domain: "hanzo.ai",
|
|
66
|
-
iamDomain: "hanzo.id",
|
|
67
|
-
accent: LUX_BRAND.hanzo,
|
|
68
|
-
accentForeground: "#FFFFFF"
|
|
69
|
-
},
|
|
70
|
-
pars: {
|
|
71
|
-
org: "pars",
|
|
72
|
-
name: "Pars",
|
|
73
|
-
domain: "pars.id",
|
|
74
|
-
iamDomain: "pars.id",
|
|
75
|
-
accent: LUX_BRAND.pars,
|
|
76
|
-
accentForeground: PARS_GOLD
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
var DOMAIN_ORG = [
|
|
80
|
-
["lux.network", "lux"],
|
|
81
|
-
["lux.cloud", "lux"],
|
|
82
|
-
["lux.id", "lux"],
|
|
83
|
-
["lux.finance", "lux"],
|
|
84
|
-
["lux.market", "lux"],
|
|
85
|
-
["lux.exchange", "lux"],
|
|
86
|
-
["zoo.ngo", "zoo"],
|
|
87
|
-
["zoo.network", "zoo"],
|
|
88
|
-
["zoo.cloud", "zoo"],
|
|
89
|
-
["zoolabs.id", "zoo"],
|
|
90
|
-
["hanzo.ai", "hanzo"],
|
|
91
|
-
["hanzo.cloud", "hanzo"],
|
|
92
|
-
["hanzo.id", "hanzo"],
|
|
93
|
-
["pars.id", "pars", "app"],
|
|
94
|
-
["pars.network", "pars", "app"],
|
|
95
|
-
["parsdao.org", "pars", "app"],
|
|
96
|
-
["bootno.de", "bootnode", "platform"]
|
|
97
|
-
];
|
|
98
|
-
var DEFAULT_ORG = "lux";
|
|
99
|
-
function normalizeHost(host) {
|
|
100
|
-
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
101
|
-
return noPort.replace(/\.$/, "");
|
|
102
|
-
}
|
|
103
|
-
function isUnder(host, domain) {
|
|
104
|
-
return host === domain || host.endsWith(`.${domain}`);
|
|
105
|
-
}
|
|
106
|
-
function matchDomain(host) {
|
|
107
|
-
let best;
|
|
108
|
-
for (const entry of DOMAIN_ORG) {
|
|
109
|
-
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
110
|
-
best = entry;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return best;
|
|
114
|
-
}
|
|
115
|
-
function appSlug(host, domain, pinned) {
|
|
116
|
-
if (pinned) return pinned;
|
|
117
|
-
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
118
|
-
const leftmost = sub.split(".")[0] ?? "";
|
|
119
|
-
if (leftmost && leftmost !== "www") return leftmost;
|
|
120
|
-
const label = domain.split(".")[0] ?? "";
|
|
121
|
-
const tld = domain.split(".").slice(1).join(".");
|
|
122
|
-
return tld.split(".")[0] || label;
|
|
123
|
-
}
|
|
124
|
-
function isLocal(host) {
|
|
125
|
-
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
126
|
-
}
|
|
127
|
-
function resolveWhiteLabel(host) {
|
|
128
|
-
const h = normalizeHost(host ?? "");
|
|
129
|
-
const match = h ? matchDomain(h) : void 0;
|
|
130
|
-
const org = match ? match[1] : DEFAULT_ORG;
|
|
131
|
-
const identity = ORGS[org];
|
|
132
|
-
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
133
|
-
return {
|
|
134
|
-
...identity,
|
|
135
|
-
host: h,
|
|
136
|
-
app,
|
|
137
|
-
theme: `dark_${org}`,
|
|
138
|
-
issuer: `https://${identity.iamDomain}`,
|
|
139
|
-
clientId: `${org}-${app}`
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function currentHost() {
|
|
143
|
-
return typeof window === "undefined" ? "" : window.location.host;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// src/lux.config.ts
|
|
147
|
-
var TRUE_BLACK = "#000000";
|
|
148
|
-
var darkBase = {
|
|
149
|
-
...v5.defaultConfig.themes.dark,
|
|
150
|
-
background: TRUE_BLACK,
|
|
151
|
-
backgroundHover: "#0A0A0A",
|
|
152
|
-
backgroundPress: "#141414",
|
|
153
|
-
backgroundFocus: "#0A0A0A"
|
|
154
|
-
};
|
|
155
|
-
var brandTheme = (accent, extra = {}) => ({
|
|
156
|
-
...darkBase,
|
|
157
|
-
accentBackground: accent,
|
|
158
|
-
accentColor: "#FFFFFF",
|
|
159
|
-
borderColorHover: accent,
|
|
160
|
-
colorHover: accent,
|
|
161
|
-
...extra
|
|
162
|
-
});
|
|
163
|
-
var luxThemes = {
|
|
164
|
-
dark: darkBase,
|
|
165
|
-
dark_lux: brandTheme(LUX_BRAND.lux),
|
|
166
|
-
dark_zoo: brandTheme(LUX_BRAND.zoo),
|
|
167
|
-
dark_hanzo: brandTheme(LUX_BRAND.hanzo),
|
|
168
|
-
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD }),
|
|
169
|
-
dark_bootnode: brandTheme(LUX_BRAND.bootnode)
|
|
170
|
-
};
|
|
171
|
-
var config = gui.createGui({
|
|
172
|
-
...v5.defaultConfig,
|
|
173
|
-
...guiConfig.config,
|
|
174
|
-
animations: v5Css.animations,
|
|
175
|
-
settings: {
|
|
176
|
-
...v5.defaultConfig.settings,
|
|
177
|
-
onlyAllowShorthands: false
|
|
178
|
-
},
|
|
179
|
-
themes: {
|
|
180
|
-
...v5.defaultConfig.themes,
|
|
181
|
-
...luxThemes
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
var lux_config_default = config;
|
|
185
16
|
var defaultQueryClient = new reactQuery.QueryClient({
|
|
186
17
|
defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
|
|
187
18
|
});
|
|
@@ -197,16 +28,16 @@ var useFontBodyReset = () => {
|
|
|
197
28
|
document.head.appendChild(style);
|
|
198
29
|
}, []);
|
|
199
30
|
};
|
|
200
|
-
var WhiteLabelContext = React__default.default.createContext(resolveWhiteLabel(""));
|
|
31
|
+
var WhiteLabelContext = React__default.default.createContext(whiteLabel_cjs.resolveWhiteLabel(""));
|
|
201
32
|
var useWhiteLabel = () => React__default.default.useContext(WhiteLabelContext);
|
|
202
33
|
var useHostWhiteLabel = (host) => {
|
|
203
34
|
const [resolvedHost, setResolvedHost] = React__default.default.useState(host ?? "");
|
|
204
35
|
React__default.default.useEffect(() => {
|
|
205
36
|
if (host !== void 0) return;
|
|
206
|
-
const browserHost = currentHost();
|
|
37
|
+
const browserHost = whiteLabel_cjs.currentHost();
|
|
207
38
|
if (browserHost) setResolvedHost(browserHost);
|
|
208
39
|
}, [host]);
|
|
209
|
-
return React__default.default.useMemo(() => resolveWhiteLabel(resolvedHost), [resolvedHost]);
|
|
40
|
+
return React__default.default.useMemo(() => whiteLabel_cjs.resolveWhiteLabel(resolvedHost), [resolvedHost]);
|
|
210
41
|
};
|
|
211
42
|
var AppProvider = ({
|
|
212
43
|
children,
|
|
@@ -217,7 +48,7 @@ var AppProvider = ({
|
|
|
217
48
|
useFontBodyReset();
|
|
218
49
|
const whiteLabel = useHostWhiteLabel(host);
|
|
219
50
|
const theme = defaultTheme ?? whiteLabel.theme;
|
|
220
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WhiteLabelContext.Provider, { value: whiteLabel, children: /* @__PURE__ */ jsxRuntime.jsx(gui.GuiProvider, { config:
|
|
51
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WhiteLabelContext.Provider, { value: whiteLabel, children: /* @__PURE__ */ jsxRuntime.jsx(gui.GuiProvider, { config: config__default.default, defaultTheme: theme, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient ?? defaultQueryClient, children }) }) });
|
|
221
52
|
};
|
|
222
53
|
|
|
223
54
|
Object.defineProperty(exports, "QueryClient", {
|
package/dist/provider.js
CHANGED
|
@@ -1,182 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { 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
5
|
import React from 'react';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { animations } from '@hanzogui/config/v5-css';
|
|
6
|
+
import config from './lux.config.js';
|
|
7
|
+
import { resolveWhiteLabel, currentHost } from './white-label.js';
|
|
9
8
|
import { jsx } from 'react/jsx-runtime';
|
|
10
9
|
|
|
11
|
-
// src/white-label.ts
|
|
12
|
-
var LUX_BRAND = {
|
|
13
|
-
lux: "#7000FF",
|
|
14
|
-
zoo: "#6C5EFB",
|
|
15
|
-
hanzo: "#EA580C",
|
|
16
|
-
pars: "#1C3879",
|
|
17
|
-
// bootno.de is its own white label with its own IdP (id.bootno.de) — accent
|
|
18
|
-
// taken from the bootnode console's own brand default, not invented here.
|
|
19
|
-
bootnode: "#3B82F6"
|
|
20
|
-
};
|
|
21
|
-
var PARS_GOLD = "#C8A45C";
|
|
22
|
-
var ORGS = {
|
|
23
|
-
lux: {
|
|
24
|
-
org: "lux",
|
|
25
|
-
name: "Lux",
|
|
26
|
-
domain: "lux.network",
|
|
27
|
-
iamDomain: "lux.id",
|
|
28
|
-
accent: LUX_BRAND.lux,
|
|
29
|
-
accentForeground: "#FFFFFF"
|
|
30
|
-
},
|
|
31
|
-
zoo: {
|
|
32
|
-
org: "zoo",
|
|
33
|
-
name: "Zoo",
|
|
34
|
-
domain: "zoo.ngo",
|
|
35
|
-
// Zoo's issuer is `zoolabs.id` — the one row where it is not `<org>.id`,
|
|
36
|
-
// and the one every hand-rolled branding map gets wrong. `id.zoo.network`
|
|
37
|
-
// ANSWERS, which is why it keeps being copied around, but it is an alias:
|
|
38
|
-
// its own discovery document advertises
|
|
39
|
-
// issuer https://zoolabs.id
|
|
40
|
-
// authorization_endpoint https://zoolabs.id/v1/iam/oauth/authorize
|
|
41
|
-
// jwks_uri https://zoolabs.id/v1/iam/.well-known/jwks
|
|
42
|
-
// so a client configured on the alias validates `iss` against a string the
|
|
43
|
-
// IdP never emits and rejects every token it is given — the exact shape of
|
|
44
|
-
// the lux.id outage. `zoo.id` is not an IdP at all (no discovery document).
|
|
45
|
-
iamDomain: "zoolabs.id",
|
|
46
|
-
accent: LUX_BRAND.zoo,
|
|
47
|
-
accentForeground: "#FFFFFF"
|
|
48
|
-
},
|
|
49
|
-
bootnode: {
|
|
50
|
-
org: "bootnode",
|
|
51
|
-
name: "Bootnode",
|
|
52
|
-
domain: "bootno.de",
|
|
53
|
-
iamDomain: "id.bootno.de",
|
|
54
|
-
accent: LUX_BRAND.lux,
|
|
55
|
-
accentForeground: "#FFFFFF"
|
|
56
|
-
},
|
|
57
|
-
hanzo: {
|
|
58
|
-
org: "hanzo",
|
|
59
|
-
name: "Hanzo",
|
|
60
|
-
domain: "hanzo.ai",
|
|
61
|
-
iamDomain: "hanzo.id",
|
|
62
|
-
accent: LUX_BRAND.hanzo,
|
|
63
|
-
accentForeground: "#FFFFFF"
|
|
64
|
-
},
|
|
65
|
-
pars: {
|
|
66
|
-
org: "pars",
|
|
67
|
-
name: "Pars",
|
|
68
|
-
domain: "pars.id",
|
|
69
|
-
iamDomain: "pars.id",
|
|
70
|
-
accent: LUX_BRAND.pars,
|
|
71
|
-
accentForeground: PARS_GOLD
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var DOMAIN_ORG = [
|
|
75
|
-
["lux.network", "lux"],
|
|
76
|
-
["lux.cloud", "lux"],
|
|
77
|
-
["lux.id", "lux"],
|
|
78
|
-
["lux.finance", "lux"],
|
|
79
|
-
["lux.market", "lux"],
|
|
80
|
-
["lux.exchange", "lux"],
|
|
81
|
-
["zoo.ngo", "zoo"],
|
|
82
|
-
["zoo.network", "zoo"],
|
|
83
|
-
["zoo.cloud", "zoo"],
|
|
84
|
-
["zoolabs.id", "zoo"],
|
|
85
|
-
["hanzo.ai", "hanzo"],
|
|
86
|
-
["hanzo.cloud", "hanzo"],
|
|
87
|
-
["hanzo.id", "hanzo"],
|
|
88
|
-
["pars.id", "pars", "app"],
|
|
89
|
-
["pars.network", "pars", "app"],
|
|
90
|
-
["parsdao.org", "pars", "app"],
|
|
91
|
-
["bootno.de", "bootnode", "platform"]
|
|
92
|
-
];
|
|
93
|
-
var DEFAULT_ORG = "lux";
|
|
94
|
-
function normalizeHost(host) {
|
|
95
|
-
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
96
|
-
return noPort.replace(/\.$/, "");
|
|
97
|
-
}
|
|
98
|
-
function isUnder(host, domain) {
|
|
99
|
-
return host === domain || host.endsWith(`.${domain}`);
|
|
100
|
-
}
|
|
101
|
-
function matchDomain(host) {
|
|
102
|
-
let best;
|
|
103
|
-
for (const entry of DOMAIN_ORG) {
|
|
104
|
-
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
105
|
-
best = entry;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return best;
|
|
109
|
-
}
|
|
110
|
-
function appSlug(host, domain, pinned) {
|
|
111
|
-
if (pinned) return pinned;
|
|
112
|
-
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
113
|
-
const leftmost = sub.split(".")[0] ?? "";
|
|
114
|
-
if (leftmost && leftmost !== "www") return leftmost;
|
|
115
|
-
const label = domain.split(".")[0] ?? "";
|
|
116
|
-
const tld = domain.split(".").slice(1).join(".");
|
|
117
|
-
return tld.split(".")[0] || label;
|
|
118
|
-
}
|
|
119
|
-
function isLocal(host) {
|
|
120
|
-
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
121
|
-
}
|
|
122
|
-
function resolveWhiteLabel(host) {
|
|
123
|
-
const h = normalizeHost(host ?? "");
|
|
124
|
-
const match = h ? matchDomain(h) : void 0;
|
|
125
|
-
const org = match ? match[1] : DEFAULT_ORG;
|
|
126
|
-
const identity = ORGS[org];
|
|
127
|
-
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
128
|
-
return {
|
|
129
|
-
...identity,
|
|
130
|
-
host: h,
|
|
131
|
-
app,
|
|
132
|
-
theme: `dark_${org}`,
|
|
133
|
-
issuer: `https://${identity.iamDomain}`,
|
|
134
|
-
clientId: `${org}-${app}`
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function currentHost() {
|
|
138
|
-
return typeof window === "undefined" ? "" : window.location.host;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// src/lux.config.ts
|
|
142
|
-
var TRUE_BLACK = "#000000";
|
|
143
|
-
var darkBase = {
|
|
144
|
-
...defaultConfig.themes.dark,
|
|
145
|
-
background: TRUE_BLACK,
|
|
146
|
-
backgroundHover: "#0A0A0A",
|
|
147
|
-
backgroundPress: "#141414",
|
|
148
|
-
backgroundFocus: "#0A0A0A"
|
|
149
|
-
};
|
|
150
|
-
var brandTheme = (accent, extra = {}) => ({
|
|
151
|
-
...darkBase,
|
|
152
|
-
accentBackground: accent,
|
|
153
|
-
accentColor: "#FFFFFF",
|
|
154
|
-
borderColorHover: accent,
|
|
155
|
-
colorHover: accent,
|
|
156
|
-
...extra
|
|
157
|
-
});
|
|
158
|
-
var luxThemes = {
|
|
159
|
-
dark: darkBase,
|
|
160
|
-
dark_lux: brandTheme(LUX_BRAND.lux),
|
|
161
|
-
dark_zoo: brandTheme(LUX_BRAND.zoo),
|
|
162
|
-
dark_hanzo: brandTheme(LUX_BRAND.hanzo),
|
|
163
|
-
dark_pars: brandTheme(LUX_BRAND.pars, { accentColor: PARS_GOLD }),
|
|
164
|
-
dark_bootnode: brandTheme(LUX_BRAND.bootnode)
|
|
165
|
-
};
|
|
166
|
-
var config = createGui({
|
|
167
|
-
...defaultConfig,
|
|
168
|
-
...config$1,
|
|
169
|
-
animations,
|
|
170
|
-
settings: {
|
|
171
|
-
...defaultConfig.settings,
|
|
172
|
-
onlyAllowShorthands: false
|
|
173
|
-
},
|
|
174
|
-
themes: {
|
|
175
|
-
...defaultConfig.themes,
|
|
176
|
-
...luxThemes
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
var lux_config_default = config;
|
|
180
10
|
var defaultQueryClient = new QueryClient({
|
|
181
11
|
defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
|
|
182
12
|
});
|
|
@@ -212,7 +42,7 @@ var AppProvider = ({
|
|
|
212
42
|
useFontBodyReset();
|
|
213
43
|
const whiteLabel = useHostWhiteLabel(host);
|
|
214
44
|
const theme = defaultTheme ?? whiteLabel.theme;
|
|
215
|
-
return /* @__PURE__ */ jsx(WhiteLabelContext.Provider, { value: whiteLabel, children: /* @__PURE__ */ jsx(GuiProvider, { config
|
|
45
|
+
return /* @__PURE__ */ jsx(WhiteLabelContext.Provider, { value: whiteLabel, children: /* @__PURE__ */ jsx(GuiProvider, { config, defaultTheme: theme, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient ?? defaultQueryClient, children }) }) });
|
|
216
46
|
};
|
|
217
47
|
|
|
218
48
|
export { AppProvider, useWhiteLabel };
|
package/dist/select.cjs
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
var gui = require('@hanzo/gui');
|
|
5
5
|
var ui = require('@hanzo/ui');
|
|
6
6
|
var usehooks = require('@uidotdev/usehooks');
|
|
7
|
-
var
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var skeleton_cjs = require('./skeleton.cjs');
|
|
8
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
10
|
|
|
10
11
|
function _interopNamespace(e) {
|
|
@@ -25,70 +26,16 @@ function _interopNamespace(e) {
|
|
|
25
26
|
return Object.freeze(n);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
var
|
|
29
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
30
|
|
|
30
|
-
var SKELETON_CLASSES = "lux-skeleton rounded-sm";
|
|
31
|
-
var Skeleton = React2__namespace.forwardRef(
|
|
32
|
-
function Skeleton2(props, ref) {
|
|
33
|
-
const { loading = true, asChild, className, children, style, ...rest } = props;
|
|
34
|
-
if (!loading) {
|
|
35
|
-
if (asChild && React2__namespace.isValidElement(children)) return children;
|
|
36
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { ref, className, style, ...rest, children });
|
|
37
|
-
}
|
|
38
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
-
"div",
|
|
40
|
-
{
|
|
41
|
-
ref,
|
|
42
|
-
"data-loading": true,
|
|
43
|
-
...ui.sx(
|
|
44
|
-
SKELETON_CLASSES,
|
|
45
|
-
asChild || children ? "[&_*]:invisible" : "min-h-5",
|
|
46
|
-
className
|
|
47
|
-
),
|
|
48
|
-
style,
|
|
49
|
-
...rest,
|
|
50
|
-
children
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
React2__namespace.forwardRef(
|
|
56
|
-
function SkeletonCircle2(props, ref) {
|
|
57
|
-
const { size = 40, loading = true, className, ...rest } = props;
|
|
58
|
-
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
59
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
-
Skeleton,
|
|
61
|
-
{
|
|
62
|
-
ref,
|
|
63
|
-
loading,
|
|
64
|
-
...ui.sx("rounded-full shrink-0", className),
|
|
65
|
-
style: { width: dimension, height: dimension, ...rest.style },
|
|
66
|
-
...rest
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
React2__namespace.forwardRef(
|
|
72
|
-
function SkeletonText2(props, ref) {
|
|
73
|
-
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
74
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { ref, className: ui.cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
-
Skeleton,
|
|
76
|
-
{
|
|
77
|
-
loading,
|
|
78
|
-
...ui.sx(ui.cn("h-4", index === noOfLines - 1 && "max-w-[80%]"))
|
|
79
|
-
},
|
|
80
|
-
index
|
|
81
|
-
)) });
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
31
|
function createListCollection(config) {
|
|
85
32
|
return { items: config.items };
|
|
86
33
|
}
|
|
87
34
|
var ArrowIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...props, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
88
35
|
var CheckIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { ...props, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.667 5L7.5 14.167 3.333 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
89
36
|
function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
90
|
-
const [value, setValue] =
|
|
91
|
-
const handleChange =
|
|
37
|
+
const [value, setValue] = React__namespace.useState(initialValue);
|
|
38
|
+
const handleChange = React__namespace.useCallback((e) => {
|
|
92
39
|
setValue(e.target.value);
|
|
93
40
|
onChange?.(e.target.value);
|
|
94
41
|
}, [onChange]);
|
|
@@ -108,15 +55,15 @@ function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
|
108
55
|
}
|
|
109
56
|
);
|
|
110
57
|
}
|
|
111
|
-
var SelectInternalContext =
|
|
58
|
+
var SelectInternalContext = React__namespace.createContext(null);
|
|
112
59
|
function useSelectInternalContext() {
|
|
113
|
-
const ctx =
|
|
60
|
+
const ctx = React__namespace.useContext(SelectInternalContext);
|
|
114
61
|
if (!ctx) {
|
|
115
62
|
throw new Error("Select compound components must be rendered inside <SelectRoot>");
|
|
116
63
|
}
|
|
117
64
|
return ctx;
|
|
118
65
|
}
|
|
119
|
-
var SelectRoot =
|
|
66
|
+
var SelectRoot = React__namespace.forwardRef(
|
|
120
67
|
function SelectRoot2(props, ref) {
|
|
121
68
|
const {
|
|
122
69
|
children,
|
|
@@ -147,21 +94,21 @@ var SelectRoot = React2__namespace.forwardRef(
|
|
|
147
94
|
hideFrom: _hideFrom
|
|
148
95
|
} = props;
|
|
149
96
|
const collection = collectionProp ?? createListCollection({ items: [] });
|
|
150
|
-
const [internalValue, setInternalValue] =
|
|
97
|
+
const [internalValue, setInternalValue] = React__namespace.useState(defaultValueArr ?? []);
|
|
151
98
|
const currentValue = valueProp ?? internalValue;
|
|
152
|
-
const selectedItems =
|
|
99
|
+
const selectedItems = React__namespace.useMemo(() => {
|
|
153
100
|
return currentValue.map((v) => collection.items.find((item) => item.value === v)).filter(Boolean);
|
|
154
101
|
}, [currentValue, collection.items]);
|
|
155
|
-
const [open, setOpen] =
|
|
102
|
+
const [open, setOpen] = React__namespace.useState(defaultOpen ?? false);
|
|
156
103
|
const isOpen = openProp ?? open;
|
|
157
|
-
const handleOpenChange =
|
|
104
|
+
const handleOpenChange = React__namespace.useCallback((nextOpen) => {
|
|
158
105
|
setOpen(nextOpen);
|
|
159
106
|
onOpenChange?.(nextOpen);
|
|
160
107
|
if (!nextOpen) {
|
|
161
108
|
onInteractOutside?.();
|
|
162
109
|
}
|
|
163
110
|
}, [onOpenChange, onInteractOutside]);
|
|
164
|
-
const handleRadixValueChange =
|
|
111
|
+
const handleRadixValueChange = React__namespace.useCallback((radixValue) => {
|
|
165
112
|
const nextArr = [radixValue];
|
|
166
113
|
if (!valueProp) {
|
|
167
114
|
setInternalValue(nextArr);
|
|
@@ -169,7 +116,7 @@ var SelectRoot = React2__namespace.forwardRef(
|
|
|
169
116
|
const items = collection.items.filter((item) => nextArr.includes(item.value));
|
|
170
117
|
onValueChangeProp?.({ value: nextArr, items });
|
|
171
118
|
}, [valueProp, collection.items, onValueChangeProp]);
|
|
172
|
-
const ctxValue =
|
|
119
|
+
const ctxValue = React__namespace.useMemo(() => ({
|
|
173
120
|
value: currentValue,
|
|
174
121
|
selectedItems,
|
|
175
122
|
collection,
|
|
@@ -189,7 +136,7 @@ var SelectRoot = React2__namespace.forwardRef(
|
|
|
189
136
|
if (typeof v === "string") return v;
|
|
190
137
|
return v.base ?? v.lg ?? Object.values(v)[0];
|
|
191
138
|
};
|
|
192
|
-
const inlineStyle =
|
|
139
|
+
const inlineStyle = React__namespace.useMemo(() => {
|
|
193
140
|
const s = { ...style };
|
|
194
141
|
const rw = resolveVal(w);
|
|
195
142
|
if (rw) s.width = rw;
|
|
@@ -226,7 +173,7 @@ var SelectRoot = React2__namespace.forwardRef(
|
|
|
226
173
|
) });
|
|
227
174
|
}
|
|
228
175
|
);
|
|
229
|
-
var SelectControl =
|
|
176
|
+
var SelectControl = React__namespace.forwardRef(
|
|
230
177
|
function SelectControl2(props, ref) {
|
|
231
178
|
const { children, noIndicator, triggerProps, loading, defaultValue } = props;
|
|
232
179
|
const ctx = useSelectInternalContext();
|
|
@@ -259,16 +206,16 @@ var SelectControl = React2__namespace.forwardRef(
|
|
|
259
206
|
}
|
|
260
207
|
);
|
|
261
208
|
if (loading) {
|
|
262
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading, asChild: true, children: trigger });
|
|
209
|
+
return /* @__PURE__ */ jsxRuntime.jsx(skeleton_cjs.Skeleton, { loading, asChild: true, children: trigger });
|
|
263
210
|
}
|
|
264
211
|
return trigger;
|
|
265
212
|
}
|
|
266
213
|
);
|
|
267
|
-
var SelectClearTrigger =
|
|
214
|
+
var SelectClearTrigger = React__namespace.forwardRef(
|
|
268
215
|
function SelectClearTrigger2(props, ref) {
|
|
269
216
|
const { className, ...rest } = props;
|
|
270
217
|
const ctx = useSelectInternalContext();
|
|
271
|
-
const handleClick =
|
|
218
|
+
const handleClick = React__namespace.useCallback(() => {
|
|
272
219
|
ctx.onValueChange({ value: [], items: [] });
|
|
273
220
|
}, [ctx]);
|
|
274
221
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -286,7 +233,7 @@ var SelectClearTrigger = React2__namespace.forwardRef(
|
|
|
286
233
|
);
|
|
287
234
|
}
|
|
288
235
|
);
|
|
289
|
-
var SelectContent =
|
|
236
|
+
var SelectContent = React__namespace.forwardRef(
|
|
290
237
|
function SelectContent2(props, _ref) {
|
|
291
238
|
const { portalled: _portalled, portalRef: _portalRef, children, className, ...rest } = props;
|
|
292
239
|
let n = 0;
|
|
@@ -309,13 +256,13 @@ var SelectContent = React2__namespace.forwardRef(
|
|
|
309
256
|
);
|
|
310
257
|
}
|
|
311
258
|
);
|
|
312
|
-
var stampIndices = (children, next) =>
|
|
313
|
-
if (!
|
|
314
|
-
if (child.type === SelectItem) return
|
|
259
|
+
var stampIndices = (children, next) => React__namespace.Children.map(children, (child) => {
|
|
260
|
+
if (!React__namespace.isValidElement(child)) return child;
|
|
261
|
+
if (child.type === SelectItem) return React__namespace.cloneElement(child, { index: next() });
|
|
315
262
|
const kids = child.props.children;
|
|
316
|
-
return kids === void 0 ? child :
|
|
263
|
+
return kids === void 0 ? child : React__namespace.cloneElement(child, void 0, stampIndices(kids, next));
|
|
317
264
|
});
|
|
318
|
-
var SelectItem =
|
|
265
|
+
var SelectItem = React__namespace.forwardRef(
|
|
319
266
|
function SelectItem2(props, ref) {
|
|
320
267
|
const { item, children, className, index, ...rest } = props;
|
|
321
268
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -343,7 +290,7 @@ var SelectItem = React2__namespace.forwardRef(
|
|
|
343
290
|
);
|
|
344
291
|
}
|
|
345
292
|
);
|
|
346
|
-
var SelectValueText =
|
|
293
|
+
var SelectValueText = React__namespace.forwardRef(
|
|
347
294
|
function SelectValueText2(props, ref) {
|
|
348
295
|
const { children, size, required, invalid, errorText, mode, className, style, placeholder: placeholderProp, ...rest } = props;
|
|
349
296
|
const ctx = useSelectInternalContext();
|
|
@@ -400,7 +347,7 @@ var SelectValueText = React2__namespace.forwardRef(
|
|
|
400
347
|
);
|
|
401
348
|
}
|
|
402
349
|
);
|
|
403
|
-
var SelectItemGroup =
|
|
350
|
+
var SelectItemGroup = React__namespace.forwardRef(
|
|
404
351
|
function SelectItemGroup2(props, ref) {
|
|
405
352
|
const { children, label, className, ...rest } = props;
|
|
406
353
|
return /* @__PURE__ */ jsxRuntime.jsxs(gui.Select.Group, { ref, ...ui.sx("py-1", className), ...rest, children: [
|
|
@@ -411,7 +358,7 @@ var SelectItemGroup = React2__namespace.forwardRef(
|
|
|
411
358
|
);
|
|
412
359
|
var SelectLabel = gui.Select.Label;
|
|
413
360
|
var SelectItemText = gui.Select.ItemText;
|
|
414
|
-
var Select =
|
|
361
|
+
var Select = React__namespace.forwardRef((props, ref) => {
|
|
415
362
|
const { collection, placeholder, portalled = true, loading, errorText, contentProps, contentHeader, itemFilter, mode, ...rest } = props;
|
|
416
363
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
417
364
|
SelectRoot,
|
|
@@ -433,7 +380,7 @@ var Select = React2__namespace.forwardRef((props, ref) => {
|
|
|
433
380
|
) }),
|
|
434
381
|
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { portalled, ...contentProps, children: [
|
|
435
382
|
contentHeader,
|
|
436
|
-
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
383
|
+
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
|
|
437
384
|
/* @__PURE__ */ jsxRuntime.jsx(SelectItem, { item, children: item.renderLabel ? item.renderLabel("item") : item.label }),
|
|
438
385
|
item.afterElement
|
|
439
386
|
] }, item.value))
|
|
@@ -442,19 +389,19 @@ var Select = React2__namespace.forwardRef((props, ref) => {
|
|
|
442
389
|
}
|
|
443
390
|
);
|
|
444
391
|
});
|
|
445
|
-
var SelectAsync =
|
|
392
|
+
var SelectAsync = React__namespace.forwardRef((props, ref) => {
|
|
446
393
|
const { placeholder, portalled = true, loading, loadOptions, extraControls, onValueChange, errorText, mode, contentHeader, ...rest } = props;
|
|
447
|
-
const [collection, setCollection] =
|
|
448
|
-
const [inputValue, setInputValue] =
|
|
449
|
-
const [value, setValue] =
|
|
394
|
+
const [collection, setCollection] = React__namespace.useState(createListCollection({ items: [] }));
|
|
395
|
+
const [inputValue, setInputValue] = React__namespace.useState("");
|
|
396
|
+
const [value, setValue] = React__namespace.useState([]);
|
|
450
397
|
const debouncedInputValue = usehooks.useDebounce(inputValue, 300);
|
|
451
|
-
|
|
398
|
+
React__namespace.useEffect(() => {
|
|
452
399
|
loadOptions(debouncedInputValue, value).then(setCollection);
|
|
453
400
|
}, [debouncedInputValue, loadOptions, value]);
|
|
454
|
-
const handleFilterChange =
|
|
401
|
+
const handleFilterChange = React__namespace.useCallback((val) => {
|
|
455
402
|
setInputValue(val);
|
|
456
403
|
}, []);
|
|
457
|
-
const handleValueChange =
|
|
404
|
+
const handleValueChange = React__namespace.useCallback(({ value: v, items }) => {
|
|
458
405
|
setValue(v);
|
|
459
406
|
onValueChange?.({ value: v, items });
|
|
460
407
|
}, [onValueChange]);
|