@orderly.network/ui-scaffold 2.12.4 → 3.0.0-alpha.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 CHANGED
@@ -1,52 +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 { LanguageContextState } from '@orderly.network/i18n';
9
9
  import { useAnnouncement } from '@orderly.network/ui-notification';
10
10
 
11
- declare const AccountMenuWidget: () => react_jsx_runtime.JSX.Element;
12
-
13
- type LeftNavProps = {
14
- /** custom leading */
15
- leading?: ReactNode;
16
- menus?: LeftNavItem[];
17
- twitterUrl?: string;
18
- telegramUrl?: string;
19
- discordUrl?: string;
20
- duneUrl?: string;
21
- /**
22
- * @deprecated Deprecated. This prop will no longer affect the rendered UI
23
- * in the leftNav drawer footer. Use `customFooter` instead.
24
- */
25
- feedbackUrl?: string;
26
- customFooter?: ReactNode;
27
- customLeftNav?: ReactNode;
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;
28
23
  };
29
- type LeftNavItem = {
30
- name: string;
31
- href: string;
32
- target?: string;
33
- icon?: ReactNode;
34
- trailing?: ReactNode;
35
- customRender?: (option: {
36
- name: string;
37
- href: string;
38
- isActive?: boolean;
39
- }) => React.ReactNode;
24
+ type AccountState = {
25
+ status: AccountStatusEnum;
40
26
  /**
41
- * if true, this item will only be shown in the main account
42
- * @default false
43
- **/
44
- onlyInMainAccount?: boolean;
45
- /**
46
- * Optional secondary style; secondary items render smaller and gray.
47
- * Secondary items are grouped below primary items with a divider in between.
27
+ * whether the account is validating
48
28
  */
49
- isSecondary?: boolean;
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
+ };
50
39
  };
51
40
 
52
41
  type MainNavItem = {
@@ -114,6 +103,66 @@ type MainNavClassNames = {
114
103
  navItem?: string;
115
104
  subMenu?: string;
116
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
+ /**
137
+ * @deprecated Deprecated. This prop will no longer affect the rendered UI
138
+ * in the leftNav drawer footer. Use `customFooter` instead.
139
+ */
140
+ feedbackUrl?: string;
141
+ customFooter?: ReactNode;
142
+ customLeftNav?: ReactNode;
143
+ };
144
+ type LeftNavItem = {
145
+ name: string;
146
+ href: string;
147
+ target?: string;
148
+ icon?: ReactNode;
149
+ trailing?: ReactNode;
150
+ customRender?: (option: {
151
+ name: string;
152
+ href: string;
153
+ isActive?: boolean;
154
+ }) => React.ReactNode;
155
+ /**
156
+ * if true, this item will only be shown in the main account
157
+ * @default false
158
+ **/
159
+ onlyInMainAccount?: boolean;
160
+ /**
161
+ * Optional secondary style; secondary items render smaller and gray.
162
+ * Secondary items are grouped below primary items with a divider in between.
163
+ */
164
+ isSecondary?: boolean;
165
+ };
117
166
 
118
167
  declare const useLeftNavScript: () => {
119
168
  open: boolean;
@@ -482,4 +531,4 @@ declare const useScanQRCodeScript: () => {
482
531
  type ScanQRCodeProps = UseScanQRCodeScriptReturn;
483
532
  declare const ScanQRCode: FC<ScanQRCodeProps>;
484
533
 
485
- 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 };
534
+ 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,52 +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 { LanguageContextState } from '@orderly.network/i18n';
9
9
  import { useAnnouncement } from '@orderly.network/ui-notification';
10
10
 
11
- declare const AccountMenuWidget: () => react_jsx_runtime.JSX.Element;
12
-
13
- type LeftNavProps = {
14
- /** custom leading */
15
- leading?: ReactNode;
16
- menus?: LeftNavItem[];
17
- twitterUrl?: string;
18
- telegramUrl?: string;
19
- discordUrl?: string;
20
- duneUrl?: string;
21
- /**
22
- * @deprecated Deprecated. This prop will no longer affect the rendered UI
23
- * in the leftNav drawer footer. Use `customFooter` instead.
24
- */
25
- feedbackUrl?: string;
26
- customFooter?: ReactNode;
27
- customLeftNav?: ReactNode;
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;
28
23
  };
29
- type LeftNavItem = {
30
- name: string;
31
- href: string;
32
- target?: string;
33
- icon?: ReactNode;
34
- trailing?: ReactNode;
35
- customRender?: (option: {
36
- name: string;
37
- href: string;
38
- isActive?: boolean;
39
- }) => React.ReactNode;
24
+ type AccountState = {
25
+ status: AccountStatusEnum;
40
26
  /**
41
- * if true, this item will only be shown in the main account
42
- * @default false
43
- **/
44
- onlyInMainAccount?: boolean;
45
- /**
46
- * Optional secondary style; secondary items render smaller and gray.
47
- * Secondary items are grouped below primary items with a divider in between.
27
+ * whether the account is validating
48
28
  */
49
- isSecondary?: boolean;
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
+ };
50
39
  };
51
40
 
52
41
  type MainNavItem = {
@@ -114,6 +103,66 @@ type MainNavClassNames = {
114
103
  navItem?: string;
115
104
  subMenu?: string;
116
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
+ /**
137
+ * @deprecated Deprecated. This prop will no longer affect the rendered UI
138
+ * in the leftNav drawer footer. Use `customFooter` instead.
139
+ */
140
+ feedbackUrl?: string;
141
+ customFooter?: ReactNode;
142
+ customLeftNav?: ReactNode;
143
+ };
144
+ type LeftNavItem = {
145
+ name: string;
146
+ href: string;
147
+ target?: string;
148
+ icon?: ReactNode;
149
+ trailing?: ReactNode;
150
+ customRender?: (option: {
151
+ name: string;
152
+ href: string;
153
+ isActive?: boolean;
154
+ }) => React.ReactNode;
155
+ /**
156
+ * if true, this item will only be shown in the main account
157
+ * @default false
158
+ **/
159
+ onlyInMainAccount?: boolean;
160
+ /**
161
+ * Optional secondary style; secondary items render smaller and gray.
162
+ * Secondary items are grouped below primary items with a divider in between.
163
+ */
164
+ isSecondary?: boolean;
165
+ };
117
166
 
118
167
  declare const useLeftNavScript: () => {
119
168
  open: boolean;
@@ -482,4 +531,4 @@ declare const useScanQRCodeScript: () => {
482
531
  type ScanQRCodeProps = UseScanQRCodeScriptReturn;
483
532
  declare const ScanQRCode: FC<ScanQRCodeProps>;
484
533
 
485
- 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 };
534
+ 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
- return /* @__PURE__ */ jsxRuntime.jsx(ui.ExtensionSlot, { position: ui.ExtensionPositionEnum.AccountMenu });
987
+ const state = useAccountMenu();
988
+ return /* @__PURE__ */ jsxRuntime.jsx(InjectableAccountMenu, { ...state });
996
989
  };
997
990
  var useChainMenuScript = () => {
998
991
  const [open2, setOpen] = React7.useState(false);
@@ -5550,16 +5543,9 @@ var MainNavMenus = (props) => {
5550
5543
  index
5551
5544
  )) });
5552
5545
  };
5553
- ui.installExtension({
5554
- name: "default-main-nav-menus",
5555
- scope: ["*"],
5556
- positions: [ui.ExtensionPositionEnum.MainMenus],
5557
- __isInternal: true
5558
- })((props) => {
5559
- return /* @__PURE__ */ jsxRuntime.jsx(MainNavMenus, { ...props });
5560
- });
5546
+ var InjectableMainNavMenus = ui.injectable(MainNavMenus, "Layout.MainMenus");
5561
5547
  var MainNavMenusExtension = (props) => {
5562
- return /* @__PURE__ */ jsxRuntime.jsx(ui.ExtensionSlot, { position: ui.ExtensionPositionEnum.MainMenus, ...props });
5548
+ return /* @__PURE__ */ jsxRuntime.jsx(InjectableMainNavMenus, { ...props });
5563
5549
  };
5564
5550
  var MainNav = (props) => {
5565
5551
  const { className, classNames, campaigns, campaignPosition } = props;