@orderly.network/markets 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.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import React6, { createContext, memo, useState, useRef, useCallback, useEffect, createElement, useMemo, useContext, isValidElement } from 'react';
1
+ import React6, { createContext, memo, useState, useRef, useCallback, useEffect, useMemo, createElement, useContext, isValidElement } from 'react';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
- import { useSymbolsInfo, useBadgeBySymbol, useMarkets, MarketsType, isCurrentlyTrading, useFundingRateHistory, useFundingRates, useQuery, useMarketsStream, useLocalStorage, useGetRwaSymbolInfo, useTickerStream, useFundingRate, useMarketsStore, useFundingDetails, useSessionStorage, useMarketCategoriesConfig, useMarketList, useRwaSymbolsInfo, useFundingRateBySymbol, usePositionStream, useConfig, useAllBrokers } from '@orderly.network/hooks';
3
+ import { useSymbolsInfo, useBadgeBySymbol, useMarkets, MarketsType, isCurrentlyTrading, useFundingRate, useFundingDetails, useFundingRateBySymbol, usePositionStream, useFundingRateHistory, useFundingRates, useQuery, useMarketsStream, useLocalStorage, useGetRwaSymbolInfo, useTickerStream, useMarketsStore, useSessionStorage, useMarketCategoriesConfig, useMarketList, useRwaSymbolsInfo, useConfig, useAllBrokers } from '@orderly.network/hooks';
4
4
  import { useTranslation, Trans, i18n } from '@orderly.network/i18n';
5
- import { Flex, TokenIcon, Text, SymbolBadge as SymbolBadge$1, Box, cn, Marquee, Checkbox, Divider, Tooltip, GradientText, useEmblaCarousel, useScreen, Badge, CloseIcon, CheckedSquareFillIcon, CheckSquareEmptyIcon, Button, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, Input, CloseCircleFillIcon, PlusIcon, DataTable, usePagination, Tabs, TabPanel, WarningIcon, NewsFillIcon, EmptyDataState, modal, RwaIcon, EmptyStateIcon, Picker, Select } from '@orderly.network/ui';
5
+ import { injectable, Flex, TokenIcon, Text, SymbolBadge as SymbolBadge$1, Tooltip, Box, cn, Marquee, Checkbox, Divider, useScreen, WarningIcon, NewsFillIcon, CloseIcon, modal, GradientText, useEmblaCarousel, Badge, CheckedSquareFillIcon, CheckSquareEmptyIcon, Button, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, Input, CloseCircleFillIcon, PlusIcon, DataTable, usePagination, Tabs, TabPanel, EmptyDataState, RwaIcon, EmptyStateIcon, Picker, Select } from '@orderly.network/ui';
6
6
  import { Decimal, formatSymbol } from '@orderly.network/utils';
7
7
  import { pick } from 'ramda';
8
8
  import { LeftNavUI } from '@orderly.network/ui-scaffold';
@@ -137,7 +137,7 @@ var init_symbolDisplay = __esm({
137
137
  });
138
138
  }
139
139
  });
140
- var EditIcon, TrashIcon, AllMarketsIcon, NewListingsIcon, FavoritesIcon, UnFavoritesIcon, SearchIcon, MoveToTopIcon, OrderlyIcon, FavoritesIcon2, UnFavoritesIcon2, TopIcon, DeleteIcon, AddIcon, ActiveAddIcon, ExpandIcon, CollapseIcon, FilterIcon, TriangleDownIcon, ArrowLeftIcon;
140
+ var EditIcon, TrashIcon, AllMarketsIcon, NewListingsIcon, FavoritesIcon, UnFavoritesIcon, SearchIcon, MoveToTopIcon, OrderlyIcon, FavoritesIcon2, UnFavoritesIcon2, TopIcon, DeleteIcon, AddIcon, ActiveAddIcon, FilterIcon, TriangleDownIcon, ArrowLeftIcon;
141
141
  var init_icons = __esm({
142
142
  "src/icons.tsx"() {
143
143
  EditIcon = (props) => /* @__PURE__ */ jsxs(
@@ -434,30 +434,6 @@ var init_icons = __esm({
434
434
  ]
435
435
  }
436
436
  );
437
- ExpandIcon = (props) => /* @__PURE__ */ jsx(
438
- "svg",
439
- {
440
- width: "16",
441
- height: "16",
442
- viewBox: "0 0 16 16",
443
- fill: "currentColor",
444
- xmlns: "http://www.w3.org/2000/svg",
445
- ...props,
446
- children: /* @__PURE__ */ jsx("path", { d: "M6.326 8.826a.84.84 0 0 0-.6.234L2.16 12.627v-2.135H.492v4.167c0 .46.373.833.834.833h4.166v-1.667H3.357l3.567-3.567a.857.857 0 0 0 0-1.198.84.84 0 0 0-.598-.234M10.502.492V2.16h2.135L9.07 5.726a.857.857 0 0 0 0 1.199.86.86 0 0 0 1.197 0l3.568-3.568v2.135h1.667V1.326a.834.834 0 0 0-.834-.834z" })
447
- }
448
- );
449
- CollapseIcon = (props) => /* @__PURE__ */ jsx(
450
- "svg",
451
- {
452
- width: "16",
453
- height: "16",
454
- viewBox: "0 0 16 16",
455
- fill: "currentColor",
456
- xmlns: "http://www.w3.org/2000/svg",
457
- ...props,
458
- children: /* @__PURE__ */ jsx("path", { d: "M14.668.492a.85.85 0 0 0-.599.234l-3.567 3.568V2.159H8.835v4.167c0 .46.373.833.833.833h4.167V5.492H11.7l3.569-3.567a.86.86 0 0 0 0-1.199.85.85 0 0 0-.6-.234m-12.5 8.334v1.666h2.135L.736 14.06a.86.86 0 0 0 0 1.198.86.86 0 0 0 1.198 0l3.568-3.567v2.134h1.666V9.66a.834.834 0 0 0-.833-.833z" })
459
- }
460
- );
461
437
  FilterIcon = (props) => /* @__PURE__ */ jsx(
462
438
  "svg",
463
439
  {
@@ -3627,7 +3603,7 @@ var init_expandMarkets_ui = __esm({
3627
3603
  return { default: mod.MarketsListWidget };
3628
3604
  })
3629
3605
  );
3630
- cls = "oui-h-[calc(100%_-_36px)]";
3606
+ cls = "oui-h-full";
3631
3607
  ExpandMarkets = (props) => {
3632
3608
  const { activeTab, onTabChange, tabSort, onTabSort } = props;
3633
3609
  const { getFavoritesProps, renderEmptyView } = useFavoritesProps();
@@ -4591,53 +4567,17 @@ var init_fundingComparison = __esm({
4591
4567
  // src/components/sideMarkets/sideMarkets.ui.tsx
4592
4568
  var sideMarkets_ui_exports = {};
4593
4569
  __export(sideMarkets_ui_exports, {
4594
- SideMarkets: () => SideMarkets,
4595
- SideMarketsHeader: () => SideMarketsHeader
4570
+ SideMarkets: () => SideMarkets
4596
4571
  });
4597
- var SideMarketsHeader, SideMarkets;
4572
+ var SideMarkets;
4598
4573
  var init_sideMarkets_ui = __esm({
4599
4574
  "src/components/sideMarkets/sideMarkets.ui.tsx"() {
4600
- init_icons();
4601
4575
  init_expandMarkets();
4602
4576
  init_marketsList();
4603
4577
  init_marketsProvider();
4604
4578
  init_useFavoritesExtraProps();
4605
- SideMarketsHeader = (props) => {
4606
- const { resizeable, panelSize, onPanelSizeChange } = props;
4607
- const { t } = useTranslation();
4608
- const cls3 = cn(
4609
- "oui-text-base-contrast-36",
4610
- resizeable ? "oui-cursor-pointer hover:oui-text-base-contrast-80" : "oui-cursor-not-allowed"
4611
- );
4612
- return /* @__PURE__ */ jsxs(
4613
- Flex,
4614
- {
4615
- className: panelSize === "small" ? "oui-absolute oui-end-[-20px] oui-z-50" : "oui-relative",
4616
- justify: panelSize === "large" ? "between" : "center",
4617
- width: "100%",
4618
- px: 3,
4619
- children: [
4620
- panelSize === "large" && /* @__PURE__ */ jsx(Text, { size: "base", intensity: 80, children: t("common.markets") }),
4621
- panelSize === "large" && /* @__PURE__ */ jsx(
4622
- "div",
4623
- {
4624
- onClick: resizeable ? () => onPanelSizeChange?.("middle") : void 0,
4625
- children: /* @__PURE__ */ jsx(CollapseIcon, { className: cls3 })
4626
- }
4627
- ),
4628
- (panelSize === "middle" || panelSize === "small") && /* @__PURE__ */ jsx(
4629
- "div",
4630
- {
4631
- onClick: resizeable ? () => onPanelSizeChange?.("large") : void 0,
4632
- children: /* @__PURE__ */ jsx(ExpandIcon, { className: cls3 })
4633
- }
4634
- )
4635
- ]
4636
- }
4637
- );
4638
- };
4639
4579
  SideMarkets = (props) => {
4640
- const { panelSize, activeTab, onTabChange, className, tabSort } = props;
4580
+ const { activeTab, onTabChange, className, tabSort, panelSize } = props;
4641
4581
  const { symbol, onSymbolChange } = useMarketsContext();
4642
4582
  const { getFavoritesProps } = useFavoritesProps();
4643
4583
  const renderContent = () => {
@@ -4662,34 +4602,12 @@ var init_sideMarkets_ui = __esm({
4662
4602
  }
4663
4603
  );
4664
4604
  };
4665
- return /* @__PURE__ */ jsxs(
4666
- Flex,
4605
+ return /* @__PURE__ */ jsx(
4606
+ Box,
4667
4607
  {
4668
- id: "oui-side-markets",
4669
- className: cn("oui-relative oui-font-semibold", className),
4670
- direction: "column",
4671
- gapY: 5,
4672
- height: "100%",
4673
4608
  width: "100%",
4674
- children: [
4675
- /* @__PURE__ */ jsx(
4676
- SideMarketsHeader,
4677
- {
4678
- ...pick(["resizeable", "panelSize", "onPanelSizeChange"], props)
4679
- }
4680
- ),
4681
- /* @__PURE__ */ jsx(
4682
- Box,
4683
- {
4684
- width: "100%",
4685
- className: cn(
4686
- panelSize === "large" && "oui-h-[calc(100%_-_56px)]",
4687
- panelSize === "middle" && "oui-h-[calc(100%_-_52px)]"
4688
- ),
4689
- children: renderContent()
4690
- }
4691
- )
4692
- ]
4609
+ height: "100%",
4610
+ children: renderContent()
4693
4611
  }
4694
4612
  );
4695
4613
  };
@@ -5944,7 +5862,6 @@ init_type();
5944
5862
  init_useTabSort();
5945
5863
  var SIDE_MARKETS_SEL_TAB_KEY2 = "orderly_side_markets_sel_tab_key";
5946
5864
  var useSideMarketsScript = (options) => {
5947
- const [panelSize, setPanelSize] = useState(options?.panelSize);
5948
5865
  const [activeTab, setActiveTab] = useLocalStorage(
5949
5866
  SIDE_MARKETS_SEL_TAB_KEY2,
5950
5867
  "all" /* All */
@@ -5952,26 +5869,25 @@ var useSideMarketsScript = (options) => {
5952
5869
  const { tabSort } = useTabSort({
5953
5870
  storageKey: SIDE_MARKETS_TAB_SORT_STORAGE_KEY
5954
5871
  });
5955
- const onPanelSizeChange = useCallback(
5872
+ const panelSize = useMemo(() => {
5873
+ if (options?.collapsed) {
5874
+ return "small";
5875
+ }
5876
+ return options?.panelSize || "large";
5877
+ }, [options?.collapsed, options?.panelSize]);
5878
+ useCallback(
5956
5879
  (size) => {
5957
5880
  if (typeof options?.onPanelSizeChange === "function") {
5958
5881
  options.onPanelSizeChange(size);
5959
- } else {
5960
- setPanelSize(size);
5961
5882
  }
5962
5883
  },
5963
5884
  [options?.onPanelSizeChange]
5964
5885
  );
5965
- useEffect(() => {
5966
- setPanelSize(options?.panelSize);
5967
- }, [options?.panelSize]);
5968
5886
  return {
5969
- resizeable: options?.resizeable ?? true,
5970
- panelSize,
5971
- onPanelSizeChange,
5972
5887
  activeTab,
5973
5888
  onTabChange: setActiveTab,
5974
- tabSort
5889
+ tabSort,
5890
+ panelSize
5975
5891
  };
5976
5892
  };
5977
5893
 
@@ -5983,9 +5899,7 @@ var LazySideMarkets = React6.lazy(
5983
5899
  })
5984
5900
  );
5985
5901
  var SideMarketsWidget = (props) => {
5986
- const state = useSideMarketsScript(
5987
- pick(["resizeable", "panelSize", "onPanelSizeChange"], props)
5988
- );
5902
+ const state = useSideMarketsScript(props);
5989
5903
  return /* @__PURE__ */ jsx(MarketsProvider, { ...pick(["symbol", "onSymbolChange"], props), children: /* @__PURE__ */ jsx(React6.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazySideMarkets, { ...state, className: props.className }) }) });
5990
5904
  };
5991
5905
 
@@ -6667,7 +6581,6 @@ var SymbolInfoBarDesktop = ({
6667
6581
  {
6668
6582
  intensity: 900,
6669
6583
  r: "2xl",
6670
- mt: 1,
6671
6584
  px: 3,
6672
6585
  className: cn(
6673
6586
  "oui-symbol-info-bar-desktop",
@@ -7089,10 +7002,14 @@ function useSymbolInfoBarFullScript(options) {
7089
7002
  openTimeInterval
7090
7003
  };
7091
7004
  }
7005
+ var SymbolInfoBarFullInjectable = injectable(
7006
+ SymbolInfoBarFull,
7007
+ "Trading.SymbolInfoBar.Desktop"
7008
+ );
7092
7009
  var SymbolInfoBarFullWidget = (props) => {
7093
7010
  const { symbol, ...rest } = props;
7094
7011
  const state = useSymbolInfoBarFullScript({ symbol });
7095
- return /* @__PURE__ */ jsx(SymbolInfoBarFull, { ...state, ...rest });
7012
+ return /* @__PURE__ */ jsx(SymbolInfoBarFullInjectable, { ...state, ...rest });
7096
7013
  };
7097
7014
 
7098
7015
  // src/components/horizontalMarkets/horizontalMarkets.widget.tsx