@orderly.network/ui-tradingview 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
@@ -15536,6 +15536,8 @@ declare const TradingviewWidget: React$1.ForwardRefExoticComponent<TradingviewWi
15536
15536
 
15537
15537
  declare const TradingviewUI: React__default.ForwardRefExoticComponent<TradingviewUIPropsInterface & React__default.RefAttributes<HTMLDivElement>>;
15538
15538
 
15539
+ declare const InjectableTradingviewDesktop: React$1.ComponentType<TradingviewUIPropsInterface>;
15540
+
15539
15541
  declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15540
15542
  tradingViewScriptSrc: string | undefined;
15541
15543
  chartRef: React$1.RefObject<HTMLDivElement>;
@@ -15556,4 +15558,4 @@ declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15556
15558
  fullscreen: any;
15557
15559
  };
15558
15560
 
15559
- export { type DisplayControlSettingInterface, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
15561
+ export { type DisplayControlSettingInterface, InjectableTradingviewDesktop, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
package/dist/index.d.ts CHANGED
@@ -15536,6 +15536,8 @@ declare const TradingviewWidget: React$1.ForwardRefExoticComponent<TradingviewWi
15536
15536
 
15537
15537
  declare const TradingviewUI: React__default.ForwardRefExoticComponent<TradingviewUIPropsInterface & React__default.RefAttributes<HTMLDivElement>>;
15538
15538
 
15539
+ declare const InjectableTradingviewDesktop: React$1.ComponentType<TradingviewUIPropsInterface>;
15540
+
15539
15541
  declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15540
15542
  tradingViewScriptSrc: string | undefined;
15541
15543
  chartRef: React$1.RefObject<HTMLDivElement>;
@@ -15556,4 +15558,4 @@ declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15556
15558
  fullscreen: any;
15557
15559
  };
15558
15560
 
15559
- export { type DisplayControlSettingInterface, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
15561
+ export { type DisplayControlSettingInterface, InjectableTradingviewDesktop, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
package/dist/index.js CHANGED
@@ -4773,9 +4773,25 @@ var NoTradingview = () => {
4773
4773
  ] }) });
4774
4774
  };
4775
4775
  var TopBar = (props) => {
4776
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "top-toolbar oui-flex oui-h-[44px] oui-justify-between md:oui-justify-start oui-items-center oui-p-2 md:oui-px-3 md:oui-pt-3 md:oui-pb-[14px]", children: props.children });
4776
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "top-toolbar oui-flex oui-h-[44px] oui-justify-between md:oui-justify-start oui-items-center oui-p-2 md:oui-px-3 md:oui-pt-3 md:oui-pb-[14px] oui-w-full", children: props.children });
4777
4777
  };
4778
4778
  var topBar_default = TopBar;
4779
+ var TradingviewChart = ({ chartRef }) => {
4780
+ return /* @__PURE__ */ jsxRuntime.jsx(
4781
+ "div",
4782
+ {
4783
+ "data-testid": "tradingview-chart",
4784
+ ref: chartRef,
4785
+ className: "oui-size-full oui-overflow-hidden"
4786
+ }
4787
+ );
4788
+ };
4789
+
4790
+ // src/components/tradingview.injectable.tsx
4791
+ var InjectableTradingviewDesktop = ui.injectable(
4792
+ TradingviewChart,
4793
+ "TradingView.Desktop"
4794
+ );
4779
4795
  var LazyLineType = React3__default.default.lazy(() => Promise.resolve().then(() => (init_lineType(), lineType_exports)));
4780
4796
  var LazyTimeInterval = React3__default.default.lazy(
4781
4797
  () => Promise.resolve().then(() => (init_timeInterval(), timeInterval_exports)).then((mod) => ({ default: mod.TimeInterval }))
@@ -4790,6 +4806,98 @@ var LazyDesktopDisplayControl = React3__default.default.lazy(
4790
4806
  default: mod.DesktopDisplayControl
4791
4807
  }))
4792
4808
  );
4809
+ var MobileTopBar = ({
4810
+ interval,
4811
+ changeInterval,
4812
+ displayControlState,
4813
+ changeDisplaySetting,
4814
+ openChartIndicators
4815
+ }) => {
4816
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4817
+ ui.Flex,
4818
+ {
4819
+ gapX: 2,
4820
+ width: "100%",
4821
+ justify: "between",
4822
+ className: "oui-hide-scrollbar oui-overflow-x-scroll",
4823
+ children: [
4824
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4825
+ LazyTimeInterval,
4826
+ {
4827
+ interval: interval ?? "15",
4828
+ changeInterval
4829
+ }
4830
+ ) }),
4831
+ /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartIndicators, children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorsIcon, {}) }),
4832
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4833
+ LazyMobileDisplayControl,
4834
+ {
4835
+ displayControlState,
4836
+ changeDisplayControlState: changeDisplaySetting
4837
+ }
4838
+ ) })
4839
+ ]
4840
+ }
4841
+ );
4842
+ };
4843
+ var DesktopTopBar = ({
4844
+ interval,
4845
+ changeInterval,
4846
+ displayControlState,
4847
+ changeDisplaySetting,
4848
+ openChartIndicators,
4849
+ lineType,
4850
+ changeLineType,
4851
+ openChartSetting,
4852
+ fullscreen,
4853
+ onFullScreenChange
4854
+ }) => {
4855
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "between", itemAlign: "center", width: "100%", children: [
4856
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
4857
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4858
+ LazyTimeInterval,
4859
+ {
4860
+ interval: interval ?? "1",
4861
+ changeInterval
4862
+ }
4863
+ ) }),
4864
+ /* @__PURE__ */ jsxRuntime.jsx(
4865
+ ui.Divider,
4866
+ {
4867
+ direction: "vertical",
4868
+ className: "oui-h-4",
4869
+ mx: 2,
4870
+ intensity: 8
4871
+ }
4872
+ ),
4873
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "start", itemAlign: "center", gap: 2, children: [
4874
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4875
+ LazyDesktopDisplayControl,
4876
+ {
4877
+ displayControlState,
4878
+ changeDisplayControlState: changeDisplaySetting
4879
+ }
4880
+ ) }),
4881
+ /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartIndicators, children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorsIcon, {}) }),
4882
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyLineType, { lineType, changeLineType }) }),
4883
+ /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartSetting, children: /* @__PURE__ */ jsxRuntime.jsx(SettingIcon, {}) })
4884
+ ] })
4885
+ ] }),
4886
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { children: fullscreen ? /* @__PURE__ */ jsxRuntime.jsx(
4887
+ ZoomOutIcon,
4888
+ {
4889
+ className: "oui-text-base-contrast-54 hover:oui-text-base-contrast oui-cursor-pointer",
4890
+ onClick: onFullScreenChange
4891
+ }
4892
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4893
+ ZoomInIcon,
4894
+ {
4895
+ className: "oui-text-base-contrast-54 hover:oui-text-base-contrast oui-cursor-pointer",
4896
+ onClick: onFullScreenChange
4897
+ }
4898
+ ) })
4899
+ ] });
4900
+ };
4793
4901
  var OperateButton = ({ children, onClick }) => {
4794
4902
  return /* @__PURE__ */ jsxRuntime.jsx(
4795
4903
  ui.Box,
@@ -4859,83 +4967,31 @@ var TradingviewUI = React3.forwardRef((props, ref) => {
4859
4967
  props.classNames?.content
4860
4968
  ),
4861
4969
  children: [
4862
- /* @__PURE__ */ jsxRuntime.jsx(topBar_default, { children: isMobile ? /* @__PURE__ */ jsxRuntime.jsxs(
4863
- ui.Flex,
4970
+ /* @__PURE__ */ jsxRuntime.jsx(topBar_default, { children: isMobile ? /* @__PURE__ */ jsxRuntime.jsx(
4971
+ MobileTopBar,
4864
4972
  {
4865
- gapX: 2,
4866
- width: "100%",
4867
- justify: "between",
4868
- className: "oui-hide-scrollbar oui-overflow-x-scroll",
4869
- children: [
4870
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4871
- LazyTimeInterval,
4872
- {
4873
- interval: interval ?? "15",
4874
- changeInterval
4875
- }
4876
- ) }),
4877
- /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartIndicators, children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorsIcon, {}) }),
4878
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4879
- LazyMobileDisplayControl,
4880
- {
4881
- displayControlState,
4882
- changeDisplayControlState: changeDisplaySetting
4883
- }
4884
- ) })
4885
- ]
4973
+ interval,
4974
+ changeInterval,
4975
+ displayControlState,
4976
+ changeDisplaySetting,
4977
+ openChartIndicators
4886
4978
  }
4887
- ) : /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "between", itemAlign: "center", width: "100%", children: [
4888
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
4889
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4890
- LazyTimeInterval,
4891
- {
4892
- interval: interval ?? "1",
4893
- changeInterval
4894
- }
4895
- ) }),
4896
- /* @__PURE__ */ jsxRuntime.jsx(
4897
- ui.Divider,
4898
- {
4899
- direction: "vertical",
4900
- className: "oui-h-4",
4901
- mx: 2,
4902
- intensity: 8
4903
- }
4904
- ),
4905
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "start", itemAlign: "center", gap: 2, children: [
4906
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4907
- LazyDesktopDisplayControl,
4908
- {
4909
- displayControlState,
4910
- changeDisplayControlState: changeDisplaySetting
4911
- }
4912
- ) }),
4913
- /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartIndicators, children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorsIcon, {}) }),
4914
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4915
- LazyLineType,
4916
- {
4917
- lineType,
4918
- changeLineType
4919
- }
4920
- ) }),
4921
- /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartSetting, children: /* @__PURE__ */ jsxRuntime.jsx(SettingIcon, {}) })
4922
- ] })
4923
- ] }),
4924
- /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { children: props.fullscreen ? /* @__PURE__ */ jsxRuntime.jsx(
4925
- ZoomOutIcon,
4926
- {
4927
- className: "oui-text-base-contrast-54 hover:oui-text-base-contrast oui-cursor-pointer",
4928
- onClick: onFullScreenChange
4929
- }
4930
- ) : /* @__PURE__ */ jsxRuntime.jsx(
4931
- ZoomInIcon,
4932
- {
4933
- className: "oui-text-base-contrast-54 hover:oui-text-base-contrast oui-cursor-pointer",
4934
- onClick: onFullScreenChange
4935
- }
4936
- ) })
4937
- ] }) }),
4938
- /* @__PURE__ */ jsxRuntime.jsx("div", { ref: chartRef, className: "oui-size-full oui-overflow-hidden" })
4979
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4980
+ DesktopTopBar,
4981
+ {
4982
+ interval,
4983
+ changeInterval,
4984
+ displayControlState,
4985
+ changeDisplaySetting,
4986
+ openChartIndicators,
4987
+ lineType,
4988
+ changeLineType,
4989
+ openChartSetting,
4990
+ fullscreen: props.fullscreen,
4991
+ onFullScreenChange
4992
+ }
4993
+ ) }),
4994
+ /* @__PURE__ */ jsxRuntime.jsx(InjectableTradingviewDesktop, { ...props })
4939
4995
  ]
4940
4996
  }
4941
4997
  )
@@ -4944,9 +5000,10 @@ var TradingviewUI = React3.forwardRef((props, ref) => {
4944
5000
  });
4945
5001
  var TradingviewWidget = React3.forwardRef((props, ref) => {
4946
5002
  const state = useTradingviewScript(props);
4947
- return /* @__PURE__ */ jsxRuntime.jsx(TradingviewUI, { ...state, ref });
5003
+ return /* @__PURE__ */ jsxRuntime.jsx(TradingviewUI, { ...state });
4948
5004
  });
4949
5005
 
5006
+ exports.InjectableTradingviewDesktop = InjectableTradingviewDesktop;
4950
5007
  exports.TradingviewUI = TradingviewUI;
4951
5008
  exports.TradingviewWidget = TradingviewWidget;
4952
5009
  exports.useTradingviewScript = useTradingviewScript;