@orderly.network/ui 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 +22 -52
- package/dist/index.d.ts +22 -52
- package/dist/index.js +109 -165
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -164
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React79 from 'react';
|
|
2
|
-
import React79__default, { forwardRef, useMemo, useRef, useCallback, createContext, useState, useEffect, useId, Fragment as Fragment$1, memo, useImperativeHandle, useContext, useReducer } from 'react';
|
|
2
|
+
import React79__default, { forwardRef, useMemo, useRef, useCallback, createContext, useState, useEffect, useId, Fragment as Fragment$1, memo, useImperativeHandle, useContext, useReducer, createElement } from 'react';
|
|
3
3
|
import { createTV, tv as tv$1, cnBase, cn } from 'tailwind-variants';
|
|
4
4
|
export { cnBase as cn } from 'tailwind-variants';
|
|
5
5
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -7,7 +7,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
7
7
|
import { isValid, format } from 'date-fns';
|
|
8
8
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
9
9
|
import makeBlockie from 'ethereum-blockies-base64';
|
|
10
|
-
import { findLongestCommonSubString, Decimal, getPrecisionByNumber, numberToHumanStyle, commify,
|
|
10
|
+
import { findLongestCommonSubString, Decimal, getPrecisionByNumber, numberToHumanStyle, commify, todpIfNeed, formatNum } from '@orderly.network/utils';
|
|
11
11
|
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
12
12
|
import { enUS } from 'date-fns/locale';
|
|
13
13
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
@@ -18,7 +18,8 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
|
18
18
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
19
19
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
20
20
|
import { useReactTable, getFilteredRowModel, getSortedRowModel, getExpandedRowModel, getCoreRowModel, getPaginationRowModel, createColumnHelper, flexRender } from '@tanstack/react-table';
|
|
21
|
-
import {
|
|
21
|
+
import { injectable, positionToPath, OrderlyPluginRegistry } from '@orderly.network/plugin-core';
|
|
22
|
+
export { ExtensionPositionEnum, ExtensionProvider, ExtensionSlot, OrderlyExtensionRegistry, OrderlyPluginProvider, OrderlyPluginRegistry, PluginErrorBoundary, PluginScopeContext, PluginScopeProvider, createInterceptor, createOrderlySDK, injectable, installExtension, positionToPath, setExtensionBuilder, useExtensionContext, useInjectedComponent, useOrderlyPluginContext, usePluginScope } from '@orderly.network/plugin-core';
|
|
22
23
|
import { DayPicker } from 'react-day-picker';
|
|
23
24
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
24
25
|
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
@@ -8809,139 +8810,26 @@ var TablePagination = (props) => {
|
|
|
8809
8810
|
}
|
|
8810
8811
|
) });
|
|
8811
8812
|
};
|
|
8812
|
-
var
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
if (!globalObject.__ORDERLY_EXTENSION_REGISTRY__) {
|
|
8817
|
-
globalObject.__ORDERLY_EXTENSION_REGISTRY__ = new _OrderlyExtensionRegistry();
|
|
8818
|
-
}
|
|
8819
|
-
return globalObject.__ORDERLY_EXTENSION_REGISTRY__;
|
|
8820
|
-
}
|
|
8821
|
-
extensionMap = /* @__PURE__ */ new Map();
|
|
8822
|
-
// private formatterMap: Map<string, Function> = new Map();
|
|
8823
|
-
register(plugin3) {
|
|
8824
|
-
if (!plugin3.builder) ;
|
|
8825
|
-
for (let index = 0; index < plugin3.positions.length; index++) {
|
|
8826
|
-
if (typeof plugin3.builder !== "function") {
|
|
8827
|
-
const builder = this.extensionMap.get(plugin3.positions[index])?.builder;
|
|
8828
|
-
plugin3.builder = typeof builder === "undefined" ? (
|
|
8829
|
-
// ? DEFAULT_BUILDER
|
|
8830
|
-
void 0
|
|
8831
|
-
) : builder;
|
|
8832
|
-
}
|
|
8833
|
-
const pos = plugin3.positions[index];
|
|
8834
|
-
this.registerToPosition(pos, plugin3);
|
|
8835
|
-
}
|
|
8836
|
-
}
|
|
8837
|
-
registerToPosition(position, plugin3) {
|
|
8838
|
-
if (this.extensionMap.has(position)) {
|
|
8839
|
-
const existingPlugin = this.extensionMap.get(position);
|
|
8840
|
-
if (!existingPlugin?.__isInternal) {
|
|
8841
|
-
if (!existingPlugin?.builder && plugin3.__isInternal) {
|
|
8842
|
-
this.setBuilder(position, plugin3.builder);
|
|
8843
|
-
}
|
|
8844
|
-
return;
|
|
8845
|
-
}
|
|
8846
|
-
if (!plugin3.builder) {
|
|
8847
|
-
plugin3.builder = existingPlugin.builder;
|
|
8848
|
-
}
|
|
8849
|
-
}
|
|
8850
|
-
this.extensionMap.set(position, plugin3);
|
|
8851
|
-
}
|
|
8852
|
-
setBuilder(position, builder) {
|
|
8853
|
-
const plugin3 = this.extensionMap.get(position);
|
|
8854
|
-
if (plugin3) {
|
|
8855
|
-
plugin3.builder = builder;
|
|
8856
|
-
}
|
|
8857
|
-
}
|
|
8858
|
-
unregister(plugin3) {
|
|
8859
|
-
for (let index = 0; index < plugin3.positions.length; index++) {
|
|
8860
|
-
const pos = plugin3.positions[index];
|
|
8861
|
-
this.unregisterFromPosition(pos);
|
|
8862
|
-
}
|
|
8863
|
-
}
|
|
8864
|
-
unregisterFromPosition(position) {
|
|
8865
|
-
this.extensionMap.delete(position);
|
|
8866
|
-
}
|
|
8867
|
-
getPluginsByPosition(position) {
|
|
8868
|
-
return this.extensionMap.get(position);
|
|
8869
|
-
}
|
|
8870
|
-
/**
|
|
8871
|
-
* get the registered formatter by position
|
|
8872
|
-
* @param position
|
|
8873
|
-
*/
|
|
8874
|
-
getFormatterByPosition(position) {
|
|
8875
|
-
return this.extensionMap.get(position);
|
|
8876
|
-
}
|
|
8877
|
-
};
|
|
8878
|
-
|
|
8879
|
-
// src/plugin/install.tsx
|
|
8880
|
-
var installExtension = (options) => {
|
|
8881
|
-
return (component) => {
|
|
8882
|
-
const registry = OrderlyExtensionRegistry.getInstance();
|
|
8883
|
-
registry.register({
|
|
8884
|
-
name: options.name,
|
|
8885
|
-
positions: options.positions,
|
|
8886
|
-
__isInternal: !!options.__isInternal,
|
|
8887
|
-
builder: options.builder,
|
|
8888
|
-
render: component
|
|
8889
|
-
});
|
|
8890
|
-
};
|
|
8891
|
-
};
|
|
8892
|
-
var setExtensionBuilder = (position, builder) => {
|
|
8893
|
-
const registry = OrderlyExtensionRegistry.getInstance();
|
|
8894
|
-
registry.setBuilder(position, builder);
|
|
8895
|
-
};
|
|
8896
|
-
var NotFound = (props) => {
|
|
8897
|
-
const { position } = props;
|
|
8898
|
-
return /* @__PURE__ */ jsxs("div", { className: "oui-text-danger", children: [
|
|
8899
|
-
/* @__PURE__ */ jsx("strong", { children: `[${position}] ` }),
|
|
8900
|
-
/* @__PURE__ */ jsx("span", { children: "Not found!" })
|
|
8901
|
-
] });
|
|
8902
|
-
};
|
|
8903
|
-
|
|
8904
|
-
// src/plugin/useBuilder.ts
|
|
8905
|
-
var useBuilder = (position, props) => {
|
|
8906
|
-
const registry = OrderlyExtensionRegistry.getInstance();
|
|
8907
|
-
const plugin3 = registry.getPluginsByPosition(position);
|
|
8908
|
-
return () => {
|
|
8909
|
-
return plugin3?.builder?.(props) || props;
|
|
8910
|
-
};
|
|
8911
|
-
};
|
|
8912
|
-
|
|
8913
|
-
// src/plugin/useExtensionBuilder.ts
|
|
8914
|
-
var useExtensionBuilder = (position, props) => {
|
|
8915
|
-
const builder = useBuilder(position, props);
|
|
8916
|
-
return builder();
|
|
8917
|
-
};
|
|
8918
|
-
var ExtensionSlot = (props) => {
|
|
8919
|
-
const { position, scope, defaultWidget: defaultValue, ...rest } = props;
|
|
8920
|
-
const elementProps = useExtensionBuilder(position, rest);
|
|
8921
|
-
const Ele = useMemo(() => {
|
|
8922
|
-
const registry = OrderlyExtensionRegistry.getInstance();
|
|
8923
|
-
const plugin3 = registry.getPluginsByPosition(position);
|
|
8924
|
-
return plugin3?.render ?? defaultValue ?? NotFound;
|
|
8925
|
-
}, []);
|
|
8926
|
-
return /* @__PURE__ */ jsx(
|
|
8927
|
-
ErrorBoundary,
|
|
8813
|
+
var EmptyDataState = (props) => {
|
|
8814
|
+
const [locale] = useLocale("empty");
|
|
8815
|
+
return /* @__PURE__ */ jsxs(
|
|
8816
|
+
Flex,
|
|
8928
8817
|
{
|
|
8929
|
-
|
|
8930
|
-
|
|
8818
|
+
itemAlign: "center",
|
|
8819
|
+
direction: "column",
|
|
8820
|
+
gapY: 4,
|
|
8821
|
+
className: props.className,
|
|
8822
|
+
children: [
|
|
8823
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(emptyData_default, {}) }),
|
|
8824
|
+
/* @__PURE__ */ jsx(Text2, { as: "div", intensity: 36, size: "2xs", children: props.title ?? locale.description })
|
|
8825
|
+
]
|
|
8931
8826
|
}
|
|
8932
8827
|
);
|
|
8933
8828
|
};
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
ExtensionPositionEnum2["WithdrawForm"] = "withdrawForm";
|
|
8939
|
-
ExtensionPositionEnum2["AccountMenu"] = "accountMenu";
|
|
8940
|
-
ExtensionPositionEnum2["MobileAccountMenu"] = "mobileAccountMenu";
|
|
8941
|
-
ExtensionPositionEnum2["MainMenus"] = "mainMenus";
|
|
8942
|
-
ExtensionPositionEnum2["EmptyDataIdentifier"] = "emptyDataIdentifier";
|
|
8943
|
-
return ExtensionPositionEnum2;
|
|
8944
|
-
})(ExtensionPositionEnum || {});
|
|
8829
|
+
var InjectableEmptyDataState = injectable(
|
|
8830
|
+
EmptyDataState,
|
|
8831
|
+
"Table.EmptyDataIdentifier"
|
|
8832
|
+
);
|
|
8945
8833
|
var TablePlaceholder = (props) => {
|
|
8946
8834
|
const { visible, loading, emptyView, className } = props;
|
|
8947
8835
|
if (!visible) {
|
|
@@ -8959,7 +8847,7 @@ var TablePlaceholder = (props) => {
|
|
|
8959
8847
|
"oui-flex oui-items-center oui-justify-center",
|
|
8960
8848
|
className
|
|
8961
8849
|
),
|
|
8962
|
-
children: loading ? /* @__PURE__ */ jsx(Spinner, {}) : emptyView || /* @__PURE__ */ jsx(
|
|
8850
|
+
children: loading ? /* @__PURE__ */ jsx(Spinner, {}) : emptyView || /* @__PURE__ */ jsx(InjectableEmptyDataState, {})
|
|
8963
8851
|
}
|
|
8964
8852
|
);
|
|
8965
8853
|
};
|
|
@@ -9876,26 +9764,6 @@ var usePagination = (initial) => {
|
|
|
9876
9764
|
parsePagination
|
|
9877
9765
|
};
|
|
9878
9766
|
};
|
|
9879
|
-
var EmptyDataState = (props) => {
|
|
9880
|
-
const [locale] = useLocale("empty");
|
|
9881
|
-
return /* @__PURE__ */ jsxs(
|
|
9882
|
-
Flex,
|
|
9883
|
-
{
|
|
9884
|
-
itemAlign: "center",
|
|
9885
|
-
direction: "column",
|
|
9886
|
-
gapY: 4,
|
|
9887
|
-
className: props.className,
|
|
9888
|
-
children: [
|
|
9889
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(emptyData_default, {}) }),
|
|
9890
|
-
/* @__PURE__ */ jsx(Text2, { as: "div", intensity: 36, size: "2xs", children: props.title ?? locale.description })
|
|
9891
|
-
]
|
|
9892
|
-
}
|
|
9893
|
-
);
|
|
9894
|
-
};
|
|
9895
|
-
installExtension({
|
|
9896
|
-
name: "emptyDataIdentifier",
|
|
9897
|
-
positions: ["emptyDataIdentifier" /* EmptyDataIdentifier */]
|
|
9898
|
-
})(EmptyDataState);
|
|
9899
9767
|
|
|
9900
9768
|
// src/table/features/index.ts
|
|
9901
9769
|
var features_exports = {};
|
|
@@ -11590,19 +11458,23 @@ var SimpleDropdownMenu = (props) => {
|
|
|
11590
11458
|
) })
|
|
11591
11459
|
] });
|
|
11592
11460
|
};
|
|
11461
|
+
|
|
11462
|
+
// src/provider/componentProvider.tsx
|
|
11463
|
+
var COMPONENTS_PLUGIN_ID = "orderly-components-provider-overrides";
|
|
11593
11464
|
var ComponentsProvider = (props) => {
|
|
11594
11465
|
useEffect(() => {
|
|
11595
11466
|
if (props.components && Object.keys(props.components).length) {
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11604
|
-
|
|
11605
|
-
|
|
11467
|
+
const interceptors = Object.entries(props.components).map(
|
|
11468
|
+
([position, Element]) => ({
|
|
11469
|
+
target: positionToPath(position),
|
|
11470
|
+
component: (_Original, slotProps) => createElement(Element, slotProps)
|
|
11471
|
+
})
|
|
11472
|
+
);
|
|
11473
|
+
OrderlyPluginRegistry.register({
|
|
11474
|
+
id: COMPONENTS_PLUGIN_ID,
|
|
11475
|
+
name: "ComponentsProvider",
|
|
11476
|
+
interceptors
|
|
11477
|
+
});
|
|
11606
11478
|
}
|
|
11607
11479
|
}, [props.components]);
|
|
11608
11480
|
return props.children;
|
|
@@ -11960,6 +11832,6 @@ var LIGHT_THEME_CSS_VARS = {
|
|
|
11960
11832
|
"--oui-spacing-xl": "33.75rem"
|
|
11961
11833
|
};
|
|
11962
11834
|
|
|
11963
|
-
export { ActionSheet, AddCircleIcon, AffiliateIcon, AlertDialog, ArrowDownShortIcon, ArrowDownSquareFillIcon, ArrowDownUpIcon, ArrowLeftRightIcon, ArrowLeftRightSquareFill, ArrowLeftShortIcon, ArrowRightShortIcon, ArrowRightUpSquareFillIcon, ArrowUpShortIcon, ArrowUpSquareFillIcon, AssetIcon, Avatar, Badge, BarChartIcon, BattleActiveIcon, BattleIcon, BattleInactiveIcon, BattleSolidActiveIcon, BattleSolidInactiveIcon, BellIcon, Box, Button, Calendar, CalendarIcon, CalendarMinusIcon, Card, CardBase, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CaretDownIcon, CaretLeftIcon, CaretRightIcon, CaretUpIcon, ChainIcon, CheckIcon, CheckSquareEmptyIcon, Checkbox, CheckedCircleFillIcon, CheckedSquareFillIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleOutlinedIcon, CloseCircleFillIcon, CloseIcon, CloseRoundFillIcon, CloseSquareFillIcon, collapse_default as Collapse, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ConfirmDialog, CopyIcon, DARK_THEME_CSS_VARS, DataFilter, DataTable, DatePicker2 as DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Divider, DotStatus, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger, EVMAvatar, EarnActiveIcon, EarnIcon, EarnInactiveIcon, EditIcon, Either, EmptyDataState, EmptyStateIcon, EsOrderlyIcon, ExclamationFillIcon,
|
|
11835
|
+
export { ActionSheet, AddCircleIcon, AffiliateIcon, AlertDialog, ArrowDownShortIcon, ArrowDownSquareFillIcon, ArrowDownUpIcon, ArrowLeftRightIcon, ArrowLeftRightSquareFill, ArrowLeftShortIcon, ArrowRightShortIcon, ArrowRightUpSquareFillIcon, ArrowUpShortIcon, ArrowUpSquareFillIcon, AssetIcon, Avatar, Badge, BarChartIcon, BattleActiveIcon, BattleIcon, BattleInactiveIcon, BattleSolidActiveIcon, BattleSolidInactiveIcon, BellIcon, Box, Button, Calendar, CalendarIcon, CalendarMinusIcon, Card, CardBase, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CaretDownIcon, CaretLeftIcon, CaretRightIcon, CaretUpIcon, ChainIcon, CheckIcon, CheckSquareEmptyIcon, Checkbox, CheckedCircleFillIcon, CheckedSquareFillIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleOutlinedIcon, CloseCircleFillIcon, CloseIcon, CloseRoundFillIcon, CloseSquareFillIcon, collapse_default as Collapse, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ConfirmDialog, CopyIcon, DARK_THEME_CSS_VARS, DataFilter, DataTable, DatePicker2 as DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Divider, DotStatus, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger, EVMAvatar, EarnActiveIcon, EarnIcon, EarnInactiveIcon, EditIcon, Either, EmptyDataState, EmptyStateIcon, EsOrderlyIcon, ExclamationFillIcon, EyeCloseIcon, EyeIcon, FeeTierIcon, Flex, GradientText, Grid2 as Grid, HoverCard, HoverCardContent, HoverCardRoot, HoverCardTrigger, Icon, IconButton, InfoCircleIcon, InjectableEmptyDataState, Input2 as Input, InputAdditional, LIGHT_THEME_CSS_VARS, LeaderboardActiveIcon, LeaderboardInactiveIcon, LeftNavVaultsIcon, ListView, LocaleContext, LocaleProvider, Logo, MarketsActiveIcon, MarketsInactiveIcon, Marquee, ModalContext, ModalIdContext, ModalProvider, MultiSortHeader, NewsFillIcon, tailwind_exports as OUITailwind, OrderlyIcon, OrderlyThemeProvider, PaginationItems, PeopleIcon, PerpsIcon, PersonIcon, Picker, PlusIcon, Popover, PopoverAnchor, PopoverContent, PopoverRoot, PopoverTrigger, PopupUnionIcon, PortfolioActiveIcon, PortfolioInactiveIcon, QuestionFillIcon, ReduceIcon, ReferralSolidIcon, RefreshIcon, RwaIcon, ScrollArea, ScrollBar, ScrollIndicator, Select2 as Select, SelectItem, SelectedChoicesFillIcon, ServerFillIcon, SettingFillIcon, SettingIcon, ShareIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SimpleDialog, SimpleDialogFooter, SimpleDropdownMenu, SimpleSheet, Slider, SortingAscIcon, SortingDescIcon, SortingIcon, Spinner, SpotIcon, SquareOutlinedIcon, StarChildChatActiveIcon, StarChildChatInactiveIcon, Statistic, StatisticLabel, SwapHorizIcon, Switch, SymbolBadge, TabPanel, features_exports as TableFeatures, Tabs, TabsBase, TabsContent, TabsList, TabsTrigger, Text2 as Text, TextField, ThrottledButton, Tips, ToastTile, Toaster, TokenIcon, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, TraderMobileIcon, TradingActiveIcon, TradingIcon, TradingInactiveIcon, TradingLeftNavIcon, TradingRewardsIcon, TriggerDialog, VaultsIcon, VectorIcon, WalletIcon, WarningIcon, WoofiStakeIcon, boxVariants, buttonVariants, capitalizeFirstLetter, convertValueToPercentage, dotStatusVariants, formatAddress, gradientTextVariants, iconButtonVariants, formatter_exports as inputFormatter, modal, parseNumber, registerSimpleDialog, registerSimpleSheet, scrollAreaVariants, startViewTransition, statisticVariants, textVariants, tv, useLocale, useLongPress, useMediaQuery, useModal, useMultiSort, useObserverElement, useOrderlyTheme, usePagination, useScreen, useThemeAttribute };
|
|
11964
11836
|
//# sourceMappingURL=index.mjs.map
|
|
11965
11837
|
//# sourceMappingURL=index.mjs.map
|