@orderly.network/ui-scaffold 2.10.2 → 3.0.0-beta.0
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 +85 -36
- package/dist/index.d.ts +85 -36
- package/dist/index.js +6 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import react__default, { ReactNode, HTMLAttributeAnchorTarget, FC, PropsWithChildren } from 'react';
|
|
4
1
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
5
|
-
import { RouterAdapter, NetworkId, API } from '@orderly.network/types';
|
|
2
|
+
import { AccountStatusEnum, RouterAdapter, NetworkId, API } from '@orderly.network/types';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import react__default, { HTMLAttributeAnchorTarget, ReactNode, FC, PropsWithChildren } from 'react';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { WsNetworkStatus } from '@orderly.network/hooks';
|
|
7
7
|
import * as _orderly_network_i18n from '@orderly.network/i18n';
|
|
8
8
|
import { LocaleContextState } from '@orderly.network/i18n';
|
|
9
9
|
import { useAnnouncement } from '@orderly.network/ui-notification';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
type AccountMenuProps = {
|
|
12
|
+
accountState: AccountState;
|
|
13
|
+
address?: string;
|
|
14
|
+
onDisconnect: () => void;
|
|
15
|
+
connect: () => Promise<void>;
|
|
16
|
+
onCrateAccount: () => Promise<void>;
|
|
17
|
+
onCreateOrderlyKey: () => Promise<void>;
|
|
18
|
+
onOpenExplorer: () => void;
|
|
19
|
+
onSwitchNetwork: () => void;
|
|
20
|
+
wrongNetwork: boolean;
|
|
21
|
+
disabledConnect?: boolean;
|
|
22
|
+
isMobile: boolean;
|
|
23
23
|
};
|
|
24
|
-
type
|
|
25
|
-
|
|
26
|
-
href: string;
|
|
27
|
-
target?: string;
|
|
28
|
-
icon?: ReactNode;
|
|
29
|
-
trailing?: ReactNode;
|
|
30
|
-
customRender?: (option: {
|
|
31
|
-
name: string;
|
|
32
|
-
href: string;
|
|
33
|
-
isActive?: boolean;
|
|
34
|
-
}) => React.ReactNode;
|
|
24
|
+
type AccountState = {
|
|
25
|
+
status: AccountStatusEnum;
|
|
35
26
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @default false
|
|
38
|
-
**/
|
|
39
|
-
onlyInMainAccount?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Optional secondary style; secondary items render smaller and gray.
|
|
42
|
-
* Secondary items are grouped below primary items with a divider in between.
|
|
27
|
+
* whether the account is validating
|
|
43
28
|
*/
|
|
44
|
-
|
|
29
|
+
validating: boolean;
|
|
30
|
+
chainNamespace?: string;
|
|
31
|
+
accountId?: string;
|
|
32
|
+
userId?: string;
|
|
33
|
+
address?: string;
|
|
34
|
+
isNew?: boolean;
|
|
35
|
+
connectWallet?: {
|
|
36
|
+
name: string;
|
|
37
|
+
chainId: number;
|
|
38
|
+
};
|
|
45
39
|
};
|
|
46
40
|
|
|
47
41
|
type MainNavItem = {
|
|
@@ -109,6 +103,61 @@ type MainNavClassNames = {
|
|
|
109
103
|
navItem?: string;
|
|
110
104
|
subMenu?: string;
|
|
111
105
|
};
|
|
106
|
+
type MainNavItemsProps = {
|
|
107
|
+
items?: MainNavItem[];
|
|
108
|
+
current?: string[];
|
|
109
|
+
classNames?: MainNavClassNames;
|
|
110
|
+
onItemClick?: (item: MainNavItem[]) => void;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Module augmentation: maps interceptor target paths to their component props types.
|
|
115
|
+
* Import from @orderly.network/ui-scaffold to enable typed props in
|
|
116
|
+
* createInterceptor('Account.AccountMenu', ...) and createInterceptor('Layout.MainMenus', ...).
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
declare module "@orderly.network/plugin-core" {
|
|
120
|
+
interface InterceptorTargetPropsMap {
|
|
121
|
+
"Account.AccountMenu": AccountMenuProps;
|
|
122
|
+
"Layout.MainMenus": MainNavItemsProps;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare const AccountMenuWidget: () => react_jsx_runtime.JSX.Element;
|
|
127
|
+
|
|
128
|
+
type LeftNavProps = {
|
|
129
|
+
/** custom leading */
|
|
130
|
+
leading?: ReactNode;
|
|
131
|
+
menus?: LeftNavItem[];
|
|
132
|
+
twitterUrl?: string;
|
|
133
|
+
telegramUrl?: string;
|
|
134
|
+
discordUrl?: string;
|
|
135
|
+
duneUrl?: string;
|
|
136
|
+
feedbackUrl?: string;
|
|
137
|
+
customLeftNav?: ReactNode;
|
|
138
|
+
};
|
|
139
|
+
type LeftNavItem = {
|
|
140
|
+
name: string;
|
|
141
|
+
href: string;
|
|
142
|
+
target?: string;
|
|
143
|
+
icon?: ReactNode;
|
|
144
|
+
trailing?: ReactNode;
|
|
145
|
+
customRender?: (option: {
|
|
146
|
+
name: string;
|
|
147
|
+
href: string;
|
|
148
|
+
isActive?: boolean;
|
|
149
|
+
}) => React.ReactNode;
|
|
150
|
+
/**
|
|
151
|
+
* if true, this item will only be shown in the main account
|
|
152
|
+
* @default false
|
|
153
|
+
**/
|
|
154
|
+
onlyInMainAccount?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Optional secondary style; secondary items render smaller and gray.
|
|
157
|
+
* Secondary items are grouped below primary items with a divider in between.
|
|
158
|
+
*/
|
|
159
|
+
isSecondary?: boolean;
|
|
160
|
+
};
|
|
112
161
|
|
|
113
162
|
declare const useLeftNavScript: () => {
|
|
114
163
|
open: boolean;
|
|
@@ -477,4 +526,4 @@ declare const useScanQRCodeScript: () => {
|
|
|
477
526
|
type ScanQRCodeProps = UseScanQRCodeScriptReturn;
|
|
478
527
|
declare const ScanQRCode: FC<ScanQRCodeProps>;
|
|
479
528
|
|
|
480
|
-
export { AccountMenuWidget, AccountSummaryWidget, BottomNav, type BottomNavProps$1 as BottomNavProps, BottomNavWidget, CampaignPositionEnum, ChainMenu, ChainMenuWidget, Footer, type FooterProps, FooterWidget, LanguageSwitcher, type LanguageSwitcherProps, type LanguageSwitcherScriptReturn, LanguageSwitcherWidget, type LanguageSwitcherWidgetProps, type LeftNavItem, type LeftNavProps, LeftNavUI, type LeftNavUIProps, LeftNavWidget, MainLogo, type MainNavItem, MainNavMobile, MainNavWidget, type MainNavWidgetProps, MaintenanceTipsUI, MaintenanceTipsWidget, RestrictedInfo, RestrictedInfoWidget, Scaffold, ScaffoldContext, type ScaffoldProps, ScanQRCode, ScanQRCodeWidget, SideBar, type SideBarProps, type SideMenuItem, SideNavbarWidget, SubAccountScript, SubAccountUI, SubAccountWidget, useLanguageSwitcherScript, useRestrictedInfoScript, useScaffoldContext, useScanQRCodeScript };
|
|
529
|
+
export { type AccountMenuProps, AccountMenuWidget, AccountSummaryWidget, BottomNav, type BottomNavProps$1 as BottomNavProps, BottomNavWidget, CampaignPositionEnum, ChainMenu, ChainMenuWidget, Footer, type FooterProps, FooterWidget, LanguageSwitcher, type LanguageSwitcherProps, type LanguageSwitcherScriptReturn, LanguageSwitcherWidget, type LanguageSwitcherWidgetProps, type LeftNavItem, type LeftNavProps, LeftNavUI, type LeftNavUIProps, LeftNavWidget, MainLogo, type MainNavItem, type MainNavItemsProps, MainNavMobile, MainNavWidget, type MainNavWidgetProps, MaintenanceTipsUI, MaintenanceTipsWidget, RestrictedInfo, RestrictedInfoWidget, Scaffold, ScaffoldContext, type ScaffoldProps, ScanQRCode, ScanQRCodeWidget, SideBar, type SideBarProps, type SideMenuItem, SideNavbarWidget, SubAccountScript, SubAccountUI, SubAccountWidget, useLanguageSwitcherScript, useRestrictedInfoScript, useScaffoldContext, useScanQRCodeScript };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import react__default, { ReactNode, HTMLAttributeAnchorTarget, FC, PropsWithChildren } from 'react';
|
|
4
1
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
5
|
-
import { RouterAdapter, NetworkId, API } from '@orderly.network/types';
|
|
2
|
+
import { AccountStatusEnum, RouterAdapter, NetworkId, API } from '@orderly.network/types';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import react__default, { HTMLAttributeAnchorTarget, ReactNode, FC, PropsWithChildren } from 'react';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { WsNetworkStatus } from '@orderly.network/hooks';
|
|
7
7
|
import * as _orderly_network_i18n from '@orderly.network/i18n';
|
|
8
8
|
import { LocaleContextState } from '@orderly.network/i18n';
|
|
9
9
|
import { useAnnouncement } from '@orderly.network/ui-notification';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
type AccountMenuProps = {
|
|
12
|
+
accountState: AccountState;
|
|
13
|
+
address?: string;
|
|
14
|
+
onDisconnect: () => void;
|
|
15
|
+
connect: () => Promise<void>;
|
|
16
|
+
onCrateAccount: () => Promise<void>;
|
|
17
|
+
onCreateOrderlyKey: () => Promise<void>;
|
|
18
|
+
onOpenExplorer: () => void;
|
|
19
|
+
onSwitchNetwork: () => void;
|
|
20
|
+
wrongNetwork: boolean;
|
|
21
|
+
disabledConnect?: boolean;
|
|
22
|
+
isMobile: boolean;
|
|
23
23
|
};
|
|
24
|
-
type
|
|
25
|
-
|
|
26
|
-
href: string;
|
|
27
|
-
target?: string;
|
|
28
|
-
icon?: ReactNode;
|
|
29
|
-
trailing?: ReactNode;
|
|
30
|
-
customRender?: (option: {
|
|
31
|
-
name: string;
|
|
32
|
-
href: string;
|
|
33
|
-
isActive?: boolean;
|
|
34
|
-
}) => React.ReactNode;
|
|
24
|
+
type AccountState = {
|
|
25
|
+
status: AccountStatusEnum;
|
|
35
26
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @default false
|
|
38
|
-
**/
|
|
39
|
-
onlyInMainAccount?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Optional secondary style; secondary items render smaller and gray.
|
|
42
|
-
* Secondary items are grouped below primary items with a divider in between.
|
|
27
|
+
* whether the account is validating
|
|
43
28
|
*/
|
|
44
|
-
|
|
29
|
+
validating: boolean;
|
|
30
|
+
chainNamespace?: string;
|
|
31
|
+
accountId?: string;
|
|
32
|
+
userId?: string;
|
|
33
|
+
address?: string;
|
|
34
|
+
isNew?: boolean;
|
|
35
|
+
connectWallet?: {
|
|
36
|
+
name: string;
|
|
37
|
+
chainId: number;
|
|
38
|
+
};
|
|
45
39
|
};
|
|
46
40
|
|
|
47
41
|
type MainNavItem = {
|
|
@@ -109,6 +103,61 @@ type MainNavClassNames = {
|
|
|
109
103
|
navItem?: string;
|
|
110
104
|
subMenu?: string;
|
|
111
105
|
};
|
|
106
|
+
type MainNavItemsProps = {
|
|
107
|
+
items?: MainNavItem[];
|
|
108
|
+
current?: string[];
|
|
109
|
+
classNames?: MainNavClassNames;
|
|
110
|
+
onItemClick?: (item: MainNavItem[]) => void;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Module augmentation: maps interceptor target paths to their component props types.
|
|
115
|
+
* Import from @orderly.network/ui-scaffold to enable typed props in
|
|
116
|
+
* createInterceptor('Account.AccountMenu', ...) and createInterceptor('Layout.MainMenus', ...).
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
declare module "@orderly.network/plugin-core" {
|
|
120
|
+
interface InterceptorTargetPropsMap {
|
|
121
|
+
"Account.AccountMenu": AccountMenuProps;
|
|
122
|
+
"Layout.MainMenus": MainNavItemsProps;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare const AccountMenuWidget: () => react_jsx_runtime.JSX.Element;
|
|
127
|
+
|
|
128
|
+
type LeftNavProps = {
|
|
129
|
+
/** custom leading */
|
|
130
|
+
leading?: ReactNode;
|
|
131
|
+
menus?: LeftNavItem[];
|
|
132
|
+
twitterUrl?: string;
|
|
133
|
+
telegramUrl?: string;
|
|
134
|
+
discordUrl?: string;
|
|
135
|
+
duneUrl?: string;
|
|
136
|
+
feedbackUrl?: string;
|
|
137
|
+
customLeftNav?: ReactNode;
|
|
138
|
+
};
|
|
139
|
+
type LeftNavItem = {
|
|
140
|
+
name: string;
|
|
141
|
+
href: string;
|
|
142
|
+
target?: string;
|
|
143
|
+
icon?: ReactNode;
|
|
144
|
+
trailing?: ReactNode;
|
|
145
|
+
customRender?: (option: {
|
|
146
|
+
name: string;
|
|
147
|
+
href: string;
|
|
148
|
+
isActive?: boolean;
|
|
149
|
+
}) => React.ReactNode;
|
|
150
|
+
/**
|
|
151
|
+
* if true, this item will only be shown in the main account
|
|
152
|
+
* @default false
|
|
153
|
+
**/
|
|
154
|
+
onlyInMainAccount?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Optional secondary style; secondary items render smaller and gray.
|
|
157
|
+
* Secondary items are grouped below primary items with a divider in between.
|
|
158
|
+
*/
|
|
159
|
+
isSecondary?: boolean;
|
|
160
|
+
};
|
|
112
161
|
|
|
113
162
|
declare const useLeftNavScript: () => {
|
|
114
163
|
open: boolean;
|
|
@@ -477,4 +526,4 @@ declare const useScanQRCodeScript: () => {
|
|
|
477
526
|
type ScanQRCodeProps = UseScanQRCodeScriptReturn;
|
|
478
527
|
declare const ScanQRCode: FC<ScanQRCodeProps>;
|
|
479
528
|
|
|
480
|
-
export { AccountMenuWidget, AccountSummaryWidget, BottomNav, type BottomNavProps$1 as BottomNavProps, BottomNavWidget, CampaignPositionEnum, ChainMenu, ChainMenuWidget, Footer, type FooterProps, FooterWidget, LanguageSwitcher, type LanguageSwitcherProps, type LanguageSwitcherScriptReturn, LanguageSwitcherWidget, type LanguageSwitcherWidgetProps, type LeftNavItem, type LeftNavProps, LeftNavUI, type LeftNavUIProps, LeftNavWidget, MainLogo, type MainNavItem, MainNavMobile, MainNavWidget, type MainNavWidgetProps, MaintenanceTipsUI, MaintenanceTipsWidget, RestrictedInfo, RestrictedInfoWidget, Scaffold, ScaffoldContext, type ScaffoldProps, ScanQRCode, ScanQRCodeWidget, SideBar, type SideBarProps, type SideMenuItem, SideNavbarWidget, SubAccountScript, SubAccountUI, SubAccountWidget, useLanguageSwitcherScript, useRestrictedInfoScript, useScaffoldContext, useScanQRCodeScript };
|
|
529
|
+
export { type AccountMenuProps, AccountMenuWidget, AccountSummaryWidget, BottomNav, type BottomNavProps$1 as BottomNavProps, BottomNavWidget, CampaignPositionEnum, ChainMenu, ChainMenuWidget, Footer, type FooterProps, FooterWidget, LanguageSwitcher, type LanguageSwitcherProps, type LanguageSwitcherScriptReturn, LanguageSwitcherWidget, type LanguageSwitcherWidgetProps, type LeftNavItem, type LeftNavProps, LeftNavUI, type LeftNavUIProps, LeftNavWidget, MainLogo, type MainNavItem, type MainNavItemsProps, MainNavMobile, MainNavWidget, type MainNavWidgetProps, MaintenanceTipsUI, MaintenanceTipsWidget, RestrictedInfo, RestrictedInfoWidget, Scaffold, ScaffoldContext, type ScaffoldProps, ScanQRCode, ScanQRCodeWidget, SideBar, type SideBarProps, type SideMenuItem, SideNavbarWidget, SubAccountScript, SubAccountUI, SubAccountWidget, useLanguageSwitcherScript, useRestrictedInfoScript, useScaffoldContext, useScanQRCodeScript };
|
package/dist/index.js
CHANGED
|
@@ -978,21 +978,14 @@ var useAccountMenu = () => {
|
|
|
978
978
|
isMobile
|
|
979
979
|
};
|
|
980
980
|
};
|
|
981
|
+
var InjectableAccountMenu = ui.injectable(AccountMenu, "Account.AccountMenu");
|
|
981
982
|
var AccountMenuWidget = () => {
|
|
982
983
|
const state = useAccountMenu();
|
|
983
984
|
return /* @__PURE__ */ jsxRuntime.jsx(AccountMenu, { ...state });
|
|
984
985
|
};
|
|
985
|
-
ui.installExtension({
|
|
986
|
-
name: "account-menu",
|
|
987
|
-
scope: ["*"],
|
|
988
|
-
positions: [ui.ExtensionPositionEnum.AccountMenu],
|
|
989
|
-
builder: useAccountMenu,
|
|
990
|
-
__isInternal: true
|
|
991
|
-
})((props) => {
|
|
992
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AccountMenu, { ...props });
|
|
993
|
-
});
|
|
994
986
|
var WalletConnectButtonExtension = () => {
|
|
995
|
-
|
|
987
|
+
const state = useAccountMenu();
|
|
988
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InjectableAccountMenu, { ...state });
|
|
996
989
|
};
|
|
997
990
|
var useChainMenuScript = () => {
|
|
998
991
|
const [open2, setOpen] = React6.useState(false);
|
|
@@ -1675,7 +1668,7 @@ var calculateAccountValue = (holdings, unsettlePnl, indexPrices) => {
|
|
|
1675
1668
|
if (!price) {
|
|
1676
1669
|
return acc;
|
|
1677
1670
|
}
|
|
1678
|
-
return
|
|
1671
|
+
return new utils.Decimal(holding2.holding).times(price).add(holding2.isolated_margin ?? 0).add(acc).toNumber();
|
|
1679
1672
|
}, 0);
|
|
1680
1673
|
return holding + unsettlePnl;
|
|
1681
1674
|
};
|
|
@@ -5502,16 +5495,9 @@ var MainNavMenus = (props) => {
|
|
|
5502
5495
|
index
|
|
5503
5496
|
)) });
|
|
5504
5497
|
};
|
|
5505
|
-
ui.
|
|
5506
|
-
name: "default-main-nav-menus",
|
|
5507
|
-
scope: ["*"],
|
|
5508
|
-
positions: [ui.ExtensionPositionEnum.MainMenus],
|
|
5509
|
-
__isInternal: true
|
|
5510
|
-
})((props) => {
|
|
5511
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MainNavMenus, { ...props });
|
|
5512
|
-
});
|
|
5498
|
+
var InjectableMainNavMenus = ui.injectable(MainNavMenus, "Layout.MainMenus");
|
|
5513
5499
|
var MainNavMenusExtension = (props) => {
|
|
5514
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5500
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InjectableMainNavMenus, { ...props });
|
|
5515
5501
|
};
|
|
5516
5502
|
var MainNav = (props) => {
|
|
5517
5503
|
const { className, classNames, campaigns, campaignPosition } = props;
|