@orderly.network/ui-scaffold 2.5.2 → 2.5.3-alpha.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/README.md +13 -2
- package/dist/index.d.mts +41 -9
- package/dist/index.d.ts +41 -9
- package/dist/index.js +42 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -208,7 +208,7 @@ const sidebarMenus = [
|
|
|
208
208
|
- `telegramUrl`: Telegram community link
|
|
209
209
|
- `discordUrl`: Discord community link
|
|
210
210
|
- `duneUrl`: Dune Analytics link
|
|
211
|
-
- `feedbackUrl`: Feedback form link
|
|
211
|
+
- `feedbackUrl`: Feedback form link (optional - if not provided, feedback section will not be displayed)
|
|
212
212
|
- `customLeftNav`: Custom component to replace the default leftNav trigger
|
|
213
213
|
|
|
214
214
|
#### LeftNavItem Properties
|
|
@@ -217,6 +217,7 @@ Each menu item in the `menus` array supports:
|
|
|
217
217
|
|
|
218
218
|
- `name`: Display name of the menu item
|
|
219
219
|
- `href`: Navigation URL
|
|
220
|
+
- `target`: Link target (e.g., "\_blank" for new window). If provided, will use `window.open()` instead of router navigation (optional)
|
|
220
221
|
- `icon`: Icon component to display (optional)
|
|
221
222
|
- `trailing`: Additional content on the right side (optional)
|
|
222
223
|
- `customRender`: Custom render function for complete control over item appearance
|
|
@@ -250,6 +251,12 @@ Each menu item in the `menus` array supports:
|
|
|
250
251
|
<SpecialBadge />
|
|
251
252
|
</div>
|
|
252
253
|
)
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: "External Link",
|
|
257
|
+
href: "https://external-site.com",
|
|
258
|
+
target: "_blank",
|
|
259
|
+
icon: <ExternalLinkIcon />
|
|
253
260
|
}
|
|
254
261
|
],
|
|
255
262
|
leading: (
|
|
@@ -279,8 +286,11 @@ Each menu item in the `menus` array supports:
|
|
|
279
286
|
3. Sub-account selector (if user is logged in with trading enabled)
|
|
280
287
|
4. Menu items list (scrollable if needed)
|
|
281
288
|
5. Social media links at the bottom
|
|
282
|
-
6. Feedback link at the very bottom
|
|
289
|
+
6. Feedback link at the very bottom (only if `feedbackUrl` is provided)
|
|
283
290
|
- **Auto-close**: The drawer automatically closes when a menu item is selected
|
|
291
|
+
- **Navigation Behavior**:
|
|
292
|
+
- Items with `target` property will open in new window/tab using `window.open()`
|
|
293
|
+
- Items without `target` will use router navigation and close the drawer
|
|
284
294
|
|
|
285
295
|
#### Advanced Customization
|
|
286
296
|
|
|
@@ -573,3 +583,4 @@ The Scaffold component automatically detects device type and provides appropriat
|
|
|
573
583
|
- `useScaffoldContext`: Hook to get Scaffold state
|
|
574
584
|
- `MobileScaffold`: Mobile layout component
|
|
575
585
|
- `DesktopScaffold`: Desktop layout component
|
|
586
|
+
- `SubAccountWidget`: Sub-account selection component (exported from ui-scaffold)
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import react__default, { ReactNode, HTMLAttributeAnchorTarget, FC, PropsWithChildren } from 'react';
|
|
4
4
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
5
|
-
import { NetworkId } from '@orderly.network/types';
|
|
5
|
+
import { 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
8
|
import { LocaleContextState } from '@orderly.network/i18n';
|
|
@@ -23,6 +23,7 @@ type LeftNavProps = {
|
|
|
23
23
|
type LeftNavItem = {
|
|
24
24
|
name: string;
|
|
25
25
|
href: string;
|
|
26
|
+
target?: string;
|
|
26
27
|
icon?: ReactNode;
|
|
27
28
|
trailing?: ReactNode;
|
|
28
29
|
customRender?: (option: {
|
|
@@ -332,6 +333,40 @@ declare const useChainMenuScript: () => {
|
|
|
332
333
|
|
|
333
334
|
declare const ChainMenu: (props: UseChainMenuScriptReturn) => react_jsx_runtime.JSX.Element;
|
|
334
335
|
|
|
336
|
+
type SubAccountWidgetProps = {
|
|
337
|
+
customTrigger?: ReactNode;
|
|
338
|
+
};
|
|
339
|
+
declare const SubAccountWidget: FC<SubAccountWidgetProps>;
|
|
340
|
+
|
|
341
|
+
type SubAccountScriptReturn = ReturnType<typeof SubAccountScript>;
|
|
342
|
+
declare const SubAccountScript: () => {
|
|
343
|
+
userAddress: string | undefined;
|
|
344
|
+
mainAccount: {
|
|
345
|
+
id: string;
|
|
346
|
+
userAddress: string;
|
|
347
|
+
holding: API.Holding[];
|
|
348
|
+
accountValue: number;
|
|
349
|
+
} | undefined;
|
|
350
|
+
currentAccountId: string | undefined;
|
|
351
|
+
open: boolean;
|
|
352
|
+
onOpenChange: react.Dispatch<react.SetStateAction<boolean>>;
|
|
353
|
+
popup: {
|
|
354
|
+
mode: string;
|
|
355
|
+
};
|
|
356
|
+
createSubAccount: (nickName: string) => Promise<any>;
|
|
357
|
+
subAccounts: {
|
|
358
|
+
accountValue: number;
|
|
359
|
+
id: string;
|
|
360
|
+
description: string;
|
|
361
|
+
holding: API.Holding[];
|
|
362
|
+
}[];
|
|
363
|
+
onSwitch: (accountId: string) => Promise<void>;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
declare function SubAccountUI(props: SubAccountScriptReturn & {
|
|
367
|
+
customTrigger?: ReactNode;
|
|
368
|
+
}): react_jsx_runtime.JSX.Element;
|
|
369
|
+
|
|
335
370
|
interface MaintenanceTipInterface {
|
|
336
371
|
tipsContent: string;
|
|
337
372
|
showTips: boolean;
|
|
@@ -409,16 +444,10 @@ type MainLogoProps = {
|
|
|
409
444
|
};
|
|
410
445
|
declare const MainLogo: FC<MainLogoProps>;
|
|
411
446
|
|
|
412
|
-
type LanguageSwitcherWidgetProps = Pick<LocaleContextState, "popup"> & {
|
|
413
|
-
open?: boolean;
|
|
414
|
-
setOpen?: (open: boolean) => void;
|
|
415
|
-
};
|
|
416
|
-
declare const LanguageSwitcherWidget: (props: LanguageSwitcherWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
417
|
-
|
|
418
447
|
type LanguageSwitcherScriptReturn = ReturnType<typeof useLanguageSwitcherScript>;
|
|
419
448
|
type LanguageSwitcherScriptOptions = Pick<LocaleContextState, "popup"> & {
|
|
420
449
|
open?: boolean;
|
|
421
|
-
|
|
450
|
+
onOpenChange?: (open: boolean) => void;
|
|
422
451
|
};
|
|
423
452
|
declare const useLanguageSwitcherScript: (options?: LanguageSwitcherScriptOptions) => {
|
|
424
453
|
open: boolean;
|
|
@@ -434,6 +463,9 @@ declare const useLanguageSwitcherScript: (options?: LanguageSwitcherScriptOption
|
|
|
434
463
|
};
|
|
435
464
|
};
|
|
436
465
|
|
|
466
|
+
type LanguageSwitcherWidgetProps = LanguageSwitcherScriptOptions;
|
|
467
|
+
declare const LanguageSwitcherWidget: (props: LanguageSwitcherWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
468
|
+
|
|
437
469
|
type LanguageSwitcherProps = LanguageSwitcherScriptReturn;
|
|
438
470
|
declare const LanguageSwitcher: FC<LanguageSwitcherProps>;
|
|
439
471
|
|
|
@@ -452,4 +484,4 @@ declare function useScanQRCodeScript(): {
|
|
|
452
484
|
type ScanQRCodeProps = UseScanQRCodeScriptReturn;
|
|
453
485
|
declare const ScanQRCode: FC<ScanQRCodeProps>;
|
|
454
486
|
|
|
455
|
-
export { AccountMenuWidget, AccountSummaryWidget, Announcement, AnnouncementWidget, type AnnouncementWidgetProps, 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, LeftNavWidget, MainLogo, MainNavMobile, MainNavWidget, type MainNavWidgetProps, MaintenanceTipsUI, MaintenanceTipsWidget, RestrictedInfo, RestrictedInfoWidget, type RouteOption, type RouterAdapter, Scaffold, ScaffoldContext, type ScaffoldProps, ScanQRCode, ScanQRCodeWidget, SideBar, type SideBarProps, type SideMenuItem, SideNavbarWidget, useAnnouncementScript, useLanguageSwitcherScript, useRestrictedInfoScript, useScaffoldContext, useScanQRCodeScript };
|
|
487
|
+
export { AccountMenuWidget, AccountSummaryWidget, Announcement, AnnouncementWidget, type AnnouncementWidgetProps, 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, LeftNavWidget, MainLogo, MainNavMobile, MainNavWidget, type MainNavWidgetProps, MaintenanceTipsUI, MaintenanceTipsWidget, RestrictedInfo, RestrictedInfoWidget, type RouteOption, type RouterAdapter, Scaffold, ScaffoldContext, type ScaffoldProps, ScanQRCode, ScanQRCodeWidget, SideBar, type SideBarProps, type SideMenuItem, SideNavbarWidget, SubAccountScript, SubAccountUI, SubAccountWidget, useAnnouncementScript, useLanguageSwitcherScript, useRestrictedInfoScript, useScaffoldContext, useScanQRCodeScript };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import react__default, { ReactNode, HTMLAttributeAnchorTarget, FC, PropsWithChildren } from 'react';
|
|
4
4
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
5
|
-
import { NetworkId } from '@orderly.network/types';
|
|
5
|
+
import { 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
8
|
import { LocaleContextState } from '@orderly.network/i18n';
|
|
@@ -23,6 +23,7 @@ type LeftNavProps = {
|
|
|
23
23
|
type LeftNavItem = {
|
|
24
24
|
name: string;
|
|
25
25
|
href: string;
|
|
26
|
+
target?: string;
|
|
26
27
|
icon?: ReactNode;
|
|
27
28
|
trailing?: ReactNode;
|
|
28
29
|
customRender?: (option: {
|
|
@@ -332,6 +333,40 @@ declare const useChainMenuScript: () => {
|
|
|
332
333
|
|
|
333
334
|
declare const ChainMenu: (props: UseChainMenuScriptReturn) => react_jsx_runtime.JSX.Element;
|
|
334
335
|
|
|
336
|
+
type SubAccountWidgetProps = {
|
|
337
|
+
customTrigger?: ReactNode;
|
|
338
|
+
};
|
|
339
|
+
declare const SubAccountWidget: FC<SubAccountWidgetProps>;
|
|
340
|
+
|
|
341
|
+
type SubAccountScriptReturn = ReturnType<typeof SubAccountScript>;
|
|
342
|
+
declare const SubAccountScript: () => {
|
|
343
|
+
userAddress: string | undefined;
|
|
344
|
+
mainAccount: {
|
|
345
|
+
id: string;
|
|
346
|
+
userAddress: string;
|
|
347
|
+
holding: API.Holding[];
|
|
348
|
+
accountValue: number;
|
|
349
|
+
} | undefined;
|
|
350
|
+
currentAccountId: string | undefined;
|
|
351
|
+
open: boolean;
|
|
352
|
+
onOpenChange: react.Dispatch<react.SetStateAction<boolean>>;
|
|
353
|
+
popup: {
|
|
354
|
+
mode: string;
|
|
355
|
+
};
|
|
356
|
+
createSubAccount: (nickName: string) => Promise<any>;
|
|
357
|
+
subAccounts: {
|
|
358
|
+
accountValue: number;
|
|
359
|
+
id: string;
|
|
360
|
+
description: string;
|
|
361
|
+
holding: API.Holding[];
|
|
362
|
+
}[];
|
|
363
|
+
onSwitch: (accountId: string) => Promise<void>;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
declare function SubAccountUI(props: SubAccountScriptReturn & {
|
|
367
|
+
customTrigger?: ReactNode;
|
|
368
|
+
}): react_jsx_runtime.JSX.Element;
|
|
369
|
+
|
|
335
370
|
interface MaintenanceTipInterface {
|
|
336
371
|
tipsContent: string;
|
|
337
372
|
showTips: boolean;
|
|
@@ -409,16 +444,10 @@ type MainLogoProps = {
|
|
|
409
444
|
};
|
|
410
445
|
declare const MainLogo: FC<MainLogoProps>;
|
|
411
446
|
|
|
412
|
-
type LanguageSwitcherWidgetProps = Pick<LocaleContextState, "popup"> & {
|
|
413
|
-
open?: boolean;
|
|
414
|
-
setOpen?: (open: boolean) => void;
|
|
415
|
-
};
|
|
416
|
-
declare const LanguageSwitcherWidget: (props: LanguageSwitcherWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
417
|
-
|
|
418
447
|
type LanguageSwitcherScriptReturn = ReturnType<typeof useLanguageSwitcherScript>;
|
|
419
448
|
type LanguageSwitcherScriptOptions = Pick<LocaleContextState, "popup"> & {
|
|
420
449
|
open?: boolean;
|
|
421
|
-
|
|
450
|
+
onOpenChange?: (open: boolean) => void;
|
|
422
451
|
};
|
|
423
452
|
declare const useLanguageSwitcherScript: (options?: LanguageSwitcherScriptOptions) => {
|
|
424
453
|
open: boolean;
|
|
@@ -434,6 +463,9 @@ declare const useLanguageSwitcherScript: (options?: LanguageSwitcherScriptOption
|
|
|
434
463
|
};
|
|
435
464
|
};
|
|
436
465
|
|
|
466
|
+
type LanguageSwitcherWidgetProps = LanguageSwitcherScriptOptions;
|
|
467
|
+
declare const LanguageSwitcherWidget: (props: LanguageSwitcherWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
468
|
+
|
|
437
469
|
type LanguageSwitcherProps = LanguageSwitcherScriptReturn;
|
|
438
470
|
declare const LanguageSwitcher: FC<LanguageSwitcherProps>;
|
|
439
471
|
|
|
@@ -452,4 +484,4 @@ declare function useScanQRCodeScript(): {
|
|
|
452
484
|
type ScanQRCodeProps = UseScanQRCodeScriptReturn;
|
|
453
485
|
declare const ScanQRCode: FC<ScanQRCodeProps>;
|
|
454
486
|
|
|
455
|
-
export { AccountMenuWidget, AccountSummaryWidget, Announcement, AnnouncementWidget, type AnnouncementWidgetProps, 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, LeftNavWidget, MainLogo, MainNavMobile, MainNavWidget, type MainNavWidgetProps, MaintenanceTipsUI, MaintenanceTipsWidget, RestrictedInfo, RestrictedInfoWidget, type RouteOption, type RouterAdapter, Scaffold, ScaffoldContext, type ScaffoldProps, ScanQRCode, ScanQRCodeWidget, SideBar, type SideBarProps, type SideMenuItem, SideNavbarWidget, useAnnouncementScript, useLanguageSwitcherScript, useRestrictedInfoScript, useScaffoldContext, useScanQRCodeScript };
|
|
487
|
+
export { AccountMenuWidget, AccountSummaryWidget, Announcement, AnnouncementWidget, type AnnouncementWidgetProps, 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, LeftNavWidget, MainLogo, MainNavMobile, MainNavWidget, type MainNavWidgetProps, MaintenanceTipsUI, MaintenanceTipsWidget, RestrictedInfo, RestrictedInfoWidget, type RouteOption, type RouterAdapter, Scaffold, ScaffoldContext, type ScaffoldProps, ScanQRCode, ScanQRCodeWidget, SideBar, type SideBarProps, type SideMenuItem, SideNavbarWidget, SubAccountScript, SubAccountUI, SubAccountWidget, useAnnouncementScript, useLanguageSwitcherScript, useRestrictedInfoScript, useScaffoldContext, useScanQRCodeScript };
|