@orderly.network/ui-scaffold 2.12.0 → 2.12.1
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +104 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -66
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +11 -11
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import * as _orderly_network_types from '@orderly.network/types';
|
|
|
5
5
|
import { RouterAdapter, NetworkId, API } from '@orderly.network/types';
|
|
6
6
|
import { WsNetworkStatus } from '@orderly.network/hooks';
|
|
7
7
|
import * as _orderly_network_i18n from '@orderly.network/i18n';
|
|
8
|
-
import {
|
|
8
|
+
import { LanguageContextState } from '@orderly.network/i18n';
|
|
9
9
|
import { useAnnouncement } from '@orderly.network/ui-notification';
|
|
10
10
|
|
|
11
11
|
declare const AccountMenuWidget: () => react_jsx_runtime.JSX.Element;
|
|
@@ -443,7 +443,7 @@ type MainLogoProps = {
|
|
|
443
443
|
declare const MainLogo: FC<MainLogoProps>;
|
|
444
444
|
|
|
445
445
|
type LanguageSwitcherScriptReturn = ReturnType<typeof useLanguageSwitcherScript>;
|
|
446
|
-
type LanguageSwitcherScriptOptions = Pick<
|
|
446
|
+
type LanguageSwitcherScriptOptions = Pick<LanguageContextState, "popup"> & {
|
|
447
447
|
open?: boolean;
|
|
448
448
|
onOpenChange?: (open: boolean) => void;
|
|
449
449
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as _orderly_network_types from '@orderly.network/types';
|
|
|
5
5
|
import { RouterAdapter, NetworkId, API } from '@orderly.network/types';
|
|
6
6
|
import { WsNetworkStatus } from '@orderly.network/hooks';
|
|
7
7
|
import * as _orderly_network_i18n from '@orderly.network/i18n';
|
|
8
|
-
import {
|
|
8
|
+
import { LanguageContextState } from '@orderly.network/i18n';
|
|
9
9
|
import { useAnnouncement } from '@orderly.network/ui-notification';
|
|
10
10
|
|
|
11
11
|
declare const AccountMenuWidget: () => react_jsx_runtime.JSX.Element;
|
|
@@ -443,7 +443,7 @@ type MainLogoProps = {
|
|
|
443
443
|
declare const MainLogo: FC<MainLogoProps>;
|
|
444
444
|
|
|
445
445
|
type LanguageSwitcherScriptReturn = ReturnType<typeof useLanguageSwitcherScript>;
|
|
446
|
-
type LanguageSwitcherScriptOptions = Pick<
|
|
446
|
+
type LanguageSwitcherScriptOptions = Pick<LanguageContextState, "popup"> & {
|
|
447
447
|
open?: boolean;
|
|
448
448
|
onOpenChange?: (open: boolean) => void;
|
|
449
449
|
};
|
package/dist/index.js
CHANGED
|
@@ -1239,7 +1239,7 @@ var useLanguageSwitcherScript = (options) => {
|
|
|
1239
1239
|
const [open2, setOpen] = React7.useState(false);
|
|
1240
1240
|
const [loading, setLoading] = React7.useState(false);
|
|
1241
1241
|
const [selectedLang, setSelectedLang] = React7.useState(i18n.i18n.language);
|
|
1242
|
-
const { languages, onLanguageBeforeChanged, onLanguageChanged, popup } = i18n.
|
|
1242
|
+
const { languages, onLanguageBeforeChanged, onLanguageChanged, popup } = i18n.useLanguageContext();
|
|
1243
1243
|
const { track, setIdentify } = hooks.useTrack();
|
|
1244
1244
|
const { isMobile } = ui.useScreen();
|
|
1245
1245
|
const onOpenChange = React7.useCallback(
|
|
@@ -2339,19 +2339,15 @@ var EditIcon = React7.forwardRef((props, ref) => {
|
|
|
2339
2339
|
}
|
|
2340
2340
|
);
|
|
2341
2341
|
});
|
|
2342
|
+
function splitAccountIdForDisplay(accountId) {
|
|
2343
|
+
return {
|
|
2344
|
+
leading: accountId.slice(0, 6),
|
|
2345
|
+
middle: accountId.slice(6, -4),
|
|
2346
|
+
trailing: accountId.slice(-4)
|
|
2347
|
+
};
|
|
2348
|
+
}
|
|
2342
2349
|
var AccountIdForCopy = (props) => {
|
|
2343
|
-
const
|
|
2344
|
-
const info = React7.useMemo(() => {
|
|
2345
|
-
return {
|
|
2346
|
-
leading: props.accountId.slice(0, 6),
|
|
2347
|
-
middle: props.accountId.slice(6, -4),
|
|
2348
|
-
trailing: props.accountId.slice(-4)
|
|
2349
|
-
};
|
|
2350
|
-
}, [props.accountId]);
|
|
2351
|
-
const copy = React7.useCallback(() => {
|
|
2352
|
-
navigator.clipboard.writeText(props.accountId);
|
|
2353
|
-
ui.toast.success(t("common.copy.copied"));
|
|
2354
|
-
}, [props.accountId]);
|
|
2350
|
+
const info = splitAccountIdForDisplay(props.accountId);
|
|
2355
2351
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2356
2352
|
ui.Flex,
|
|
2357
2353
|
{
|
|
@@ -2368,7 +2364,7 @@ var AccountIdForCopy = (props) => {
|
|
|
2368
2364
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2369
2365
|
ui.CopyIcon,
|
|
2370
2366
|
{
|
|
2371
|
-
onClick:
|
|
2367
|
+
onClick: props.onCopy,
|
|
2372
2368
|
className: "oui-cursor-pointer oui-text-base-contrast-36 hover:oui-text-base-contrast"
|
|
2373
2369
|
}
|
|
2374
2370
|
)
|
|
@@ -2378,7 +2374,44 @@ var AccountIdForCopy = (props) => {
|
|
|
2378
2374
|
};
|
|
2379
2375
|
var AccountItem = (props) => {
|
|
2380
2376
|
const { t } = i18n.useTranslation();
|
|
2381
|
-
|
|
2377
|
+
const { isMobile } = ui.useScreen();
|
|
2378
|
+
const {
|
|
2379
|
+
isMainAccount,
|
|
2380
|
+
accountId,
|
|
2381
|
+
description,
|
|
2382
|
+
userAddress,
|
|
2383
|
+
isCurrent,
|
|
2384
|
+
onSwitch,
|
|
2385
|
+
accountValue,
|
|
2386
|
+
onEdit
|
|
2387
|
+
} = props;
|
|
2388
|
+
const copyAccountId = React7.useCallback(
|
|
2389
|
+
(event) => {
|
|
2390
|
+
event.stopPropagation();
|
|
2391
|
+
navigator.clipboard.writeText(accountId);
|
|
2392
|
+
ui.toast.success(t("common.copy.copied"));
|
|
2393
|
+
},
|
|
2394
|
+
[accountId, t]
|
|
2395
|
+
);
|
|
2396
|
+
const handleSwitch = React7.useCallback(() => {
|
|
2397
|
+
if (isCurrent) return;
|
|
2398
|
+
onSwitch?.(accountId);
|
|
2399
|
+
}, [isCurrent, onSwitch, accountId]);
|
|
2400
|
+
const handleEdit = React7.useCallback(
|
|
2401
|
+
(event) => {
|
|
2402
|
+
event.stopPropagation();
|
|
2403
|
+
event.preventDefault();
|
|
2404
|
+
onEdit?.({
|
|
2405
|
+
accountId,
|
|
2406
|
+
description: description ?? ""
|
|
2407
|
+
});
|
|
2408
|
+
},
|
|
2409
|
+
[onEdit, accountId, description]
|
|
2410
|
+
);
|
|
2411
|
+
const stopPropagation = React7.useCallback((event) => {
|
|
2412
|
+
event.stopPropagation();
|
|
2413
|
+
}, []);
|
|
2414
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2382
2415
|
ui.Flex,
|
|
2383
2416
|
{
|
|
2384
2417
|
justify: "between",
|
|
@@ -2387,69 +2420,76 @@ var AccountItem = (props) => {
|
|
|
2387
2420
|
className: ui.cn(
|
|
2388
2421
|
"oui-relative oui-cursor-pointer oui-rounded-[6px] oui-bg-base-6 oui-px-3 oui-py-4",
|
|
2389
2422
|
"oui-border oui-border-base-6",
|
|
2390
|
-
|
|
2391
|
-
!
|
|
2423
|
+
isCurrent && "oui-border-[rgb(var(--oui-gradient-brand-start))]",
|
|
2424
|
+
!isCurrent && "hover:oui-border-base-contrast-16"
|
|
2392
2425
|
),
|
|
2393
2426
|
children: [
|
|
2394
2427
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2395
2428
|
"div",
|
|
2396
2429
|
{
|
|
2397
|
-
className: "oui-absolute oui-inset-0 oui-z-0
|
|
2398
|
-
onClick:
|
|
2399
|
-
if (props.isCurrent) {
|
|
2400
|
-
return;
|
|
2401
|
-
}
|
|
2402
|
-
props.onSwitch?.(props.accountId);
|
|
2403
|
-
}
|
|
2430
|
+
className: "oui-absolute oui-inset-0 oui-z-0",
|
|
2431
|
+
onClick: handleSwitch
|
|
2404
2432
|
}
|
|
2405
2433
|
),
|
|
2406
|
-
|
|
2434
|
+
isCurrent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2407
2435
|
"div",
|
|
2408
2436
|
{
|
|
2409
2437
|
className: ui.cn(
|
|
2410
2438
|
"oui-absolute -oui-right-[1px] -oui-top-[1px] oui-leading-3",
|
|
2411
2439
|
"oui-text-[10px] oui-font-semibold oui-text-base-10",
|
|
2412
|
-
"oui-rounded-[6px] oui-rounded-br-none oui-rounded-tl-none oui-bg-[rgb(var(--oui-gradient-brand-start))] oui-py-0.5 oui-pl-1
|
|
2440
|
+
"oui-rounded-[6px] oui-rounded-br-none oui-rounded-tl-none oui-bg-[rgb(var(--oui-gradient-brand-start))] oui-py-0.5 oui-pl-1 oui-pr-[5px]"
|
|
2413
2441
|
),
|
|
2414
2442
|
children: t("subAccount.modal.current")
|
|
2415
2443
|
}
|
|
2416
2444
|
),
|
|
2417
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2418
|
-
ui.
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
ui.
|
|
2427
|
-
{
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
|
|
2445
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", gap: 1, className: "oui-z-[2]", children: [
|
|
2446
|
+
isMainAccount ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-xs oui-leading-3 oui-text-base-contrast", children: ui.formatAddress(userAddress ?? "") }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2447
|
+
ui.Flex,
|
|
2448
|
+
{
|
|
2449
|
+
justify: "start",
|
|
2450
|
+
itemAlign: "center",
|
|
2451
|
+
className: "oui-cursor-pointer oui-gap-[2px] oui-fill-base-contrast-54 hover:oui-fill-base-contrast",
|
|
2452
|
+
onClick: handleEdit,
|
|
2453
|
+
children: [
|
|
2454
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-xs oui-leading-3 oui-text-base-contrast", children: description }),
|
|
2455
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditIcon, { className: "oui-fill-base-contrast-54 hover:oui-fill-base-contrast" })
|
|
2456
|
+
]
|
|
2457
|
+
}
|
|
2458
|
+
),
|
|
2459
|
+
isMobile ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2460
|
+
ui.Flex,
|
|
2461
|
+
{
|
|
2462
|
+
justify: "start",
|
|
2463
|
+
itemAlign: "center",
|
|
2464
|
+
gap: 1,
|
|
2465
|
+
className: "oui-w-full",
|
|
2466
|
+
onClick: stopPropagation,
|
|
2467
|
+
children: [
|
|
2468
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "oui-text-2xs oui-leading-3 oui-text-base-contrast-36", children: [
|
|
2469
|
+
"ID: ",
|
|
2470
|
+
ui.formatAddress(accountId)
|
|
2471
|
+
] }),
|
|
2472
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2473
|
+
ui.CopyIcon,
|
|
2474
|
+
{
|
|
2475
|
+
size: 12,
|
|
2476
|
+
onClick: copyAccountId,
|
|
2477
|
+
className: "oui-shrink-0 oui-cursor-pointer oui-text-base-contrast-36 hover:oui-text-base-contrast"
|
|
2478
|
+
}
|
|
2479
|
+
)
|
|
2480
|
+
]
|
|
2481
|
+
}
|
|
2482
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2483
|
+
ui.Tooltip,
|
|
2484
|
+
{
|
|
2485
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(AccountIdForCopy, { accountId, onCopy: copyAccountId }),
|
|
2486
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "oui-text-2xs oui-leading-3 oui-text-base-contrast-36 hover:oui-text-base-contrast", children: [
|
|
2446
2487
|
"ID: ",
|
|
2447
|
-
ui.formatAddress(
|
|
2448
|
-
] })
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
),
|
|
2488
|
+
ui.formatAddress(accountId)
|
|
2489
|
+
] })
|
|
2490
|
+
}
|
|
2491
|
+
)
|
|
2492
|
+
] }),
|
|
2453
2493
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2454
2494
|
ui.Flex,
|
|
2455
2495
|
{
|
|
@@ -2457,14 +2497,14 @@ var AccountItem = (props) => {
|
|
|
2457
2497
|
itemAlign: "end",
|
|
2458
2498
|
gap: 1,
|
|
2459
2499
|
children: [
|
|
2460
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text.numeral, { rule: "price", dp: 2, children:
|
|
2500
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text.numeral, { rule: "price", dp: 2, children: accountValue ?? 0 }),
|
|
2461
2501
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "USDC" })
|
|
2462
2502
|
]
|
|
2463
2503
|
}
|
|
2464
2504
|
)
|
|
2465
2505
|
]
|
|
2466
2506
|
}
|
|
2467
|
-
)
|
|
2507
|
+
);
|
|
2468
2508
|
};
|
|
2469
2509
|
var NickNameTextField = (props) => {
|
|
2470
2510
|
const { t } = i18n.useTranslation();
|
|
@@ -2748,7 +2788,7 @@ function SubAccountUI(props) {
|
|
|
2748
2788
|
if (!props.subAccounts?.length) {
|
|
2749
2789
|
return noSubAccount;
|
|
2750
2790
|
}
|
|
2751
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.ScrollArea, { className: "oui-custom-scrollbar oui-max-h-[
|
|
2791
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.ScrollArea, { className: "oui-custom-scrollbar oui-max-h-[205px] oui-w-full oui-overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "column", gap: 2, itemAlign: "start", width: "100%", children: props.subAccounts.map((subAccount) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2752
2792
|
AccountItem,
|
|
2753
2793
|
{
|
|
2754
2794
|
accountId: subAccount.id,
|