@orderly.network/ui-tradingview 2.11.0 → 3.0.0-beta.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/dist/index.d.mts CHANGED
@@ -15535,6 +15535,8 @@ declare const TradingviewWidget: React$1.ForwardRefExoticComponent<TradingviewWi
15535
15535
 
15536
15536
  declare const TradingviewUI: React__default.ForwardRefExoticComponent<TradingviewUIPropsInterface & React__default.RefAttributes<HTMLDivElement>>;
15537
15537
 
15538
+ declare const InjectableTradingviewDesktop: React$1.ComponentType<TradingviewUIPropsInterface>;
15539
+
15538
15540
  declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15539
15541
  tradingViewScriptSrc: string | undefined;
15540
15542
  chartRef: React$1.RefObject<HTMLDivElement>;
@@ -15555,4 +15557,4 @@ declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15555
15557
  fullscreen: any;
15556
15558
  };
15557
15559
 
15558
- export { type DisplayControlSettingInterface, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
15560
+ export { type DisplayControlSettingInterface, InjectableTradingviewDesktop, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
package/dist/index.d.ts CHANGED
@@ -15535,6 +15535,8 @@ declare const TradingviewWidget: React$1.ForwardRefExoticComponent<TradingviewWi
15535
15535
 
15536
15536
  declare const TradingviewUI: React__default.ForwardRefExoticComponent<TradingviewUIPropsInterface & React__default.RefAttributes<HTMLDivElement>>;
15537
15537
 
15538
+ declare const InjectableTradingviewDesktop: React$1.ComponentType<TradingviewUIPropsInterface>;
15539
+
15538
15540
  declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15539
15541
  tradingViewScriptSrc: string | undefined;
15540
15542
  chartRef: React$1.RefObject<HTMLDivElement>;
@@ -15555,4 +15557,4 @@ declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15555
15557
  fullscreen: any;
15556
15558
  };
15557
15559
 
15558
- export { type DisplayControlSettingInterface, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
15560
+ export { type DisplayControlSettingInterface, InjectableTradingviewDesktop, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
package/dist/index.js CHANGED
@@ -4680,9 +4680,25 @@ var NoTradingview = () => {
4680
4680
  ] }) });
4681
4681
  };
4682
4682
  var TopBar = (props) => {
4683
- 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 });
4683
+ 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 });
4684
4684
  };
4685
4685
  var topBar_default = TopBar;
4686
+ var TradingviewChart = ({ chartRef }) => {
4687
+ return /* @__PURE__ */ jsxRuntime.jsx(
4688
+ "div",
4689
+ {
4690
+ "data-testid": "tradingview-chart",
4691
+ ref: chartRef,
4692
+ className: "oui-size-full oui-overflow-hidden"
4693
+ }
4694
+ );
4695
+ };
4696
+
4697
+ // src/components/tradingview.injectable.tsx
4698
+ var InjectableTradingviewDesktop = ui.injectable(
4699
+ TradingviewChart,
4700
+ "TradingView.Desktop"
4701
+ );
4686
4702
  var LazyLineType = React3__default.default.lazy(() => Promise.resolve().then(() => (init_lineType(), lineType_exports)));
4687
4703
  var LazyTimeInterval = React3__default.default.lazy(
4688
4704
  () => Promise.resolve().then(() => (init_timeInterval(), timeInterval_exports)).then((mod) => ({ default: mod.TimeInterval }))
@@ -4697,6 +4713,98 @@ var LazyDesktopDisplayControl = React3__default.default.lazy(
4697
4713
  default: mod.DesktopDisplayControl
4698
4714
  }))
4699
4715
  );
4716
+ var MobileTopBar = ({
4717
+ interval,
4718
+ changeInterval,
4719
+ displayControlState,
4720
+ changeDisplaySetting,
4721
+ openChartIndicators
4722
+ }) => {
4723
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4724
+ ui.Flex,
4725
+ {
4726
+ gapX: 2,
4727
+ width: "100%",
4728
+ justify: "between",
4729
+ className: "oui-hide-scrollbar oui-overflow-x-scroll",
4730
+ children: [
4731
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4732
+ LazyTimeInterval,
4733
+ {
4734
+ interval: interval ?? "15",
4735
+ changeInterval
4736
+ }
4737
+ ) }),
4738
+ /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartIndicators, children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorsIcon, {}) }),
4739
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4740
+ LazyMobileDisplayControl,
4741
+ {
4742
+ displayControlState,
4743
+ changeDisplayControlState: changeDisplaySetting
4744
+ }
4745
+ ) })
4746
+ ]
4747
+ }
4748
+ );
4749
+ };
4750
+ var DesktopTopBar = ({
4751
+ interval,
4752
+ changeInterval,
4753
+ displayControlState,
4754
+ changeDisplaySetting,
4755
+ openChartIndicators,
4756
+ lineType,
4757
+ changeLineType,
4758
+ openChartSetting,
4759
+ fullscreen,
4760
+ onFullScreenChange
4761
+ }) => {
4762
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "between", itemAlign: "center", width: "100%", children: [
4763
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
4764
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4765
+ LazyTimeInterval,
4766
+ {
4767
+ interval: interval ?? "1",
4768
+ changeInterval
4769
+ }
4770
+ ) }),
4771
+ /* @__PURE__ */ jsxRuntime.jsx(
4772
+ ui.Divider,
4773
+ {
4774
+ direction: "vertical",
4775
+ className: "oui-h-4",
4776
+ mx: 2,
4777
+ intensity: 8
4778
+ }
4779
+ ),
4780
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "start", itemAlign: "center", gap: 2, children: [
4781
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4782
+ LazyDesktopDisplayControl,
4783
+ {
4784
+ displayControlState,
4785
+ changeDisplayControlState: changeDisplaySetting
4786
+ }
4787
+ ) }),
4788
+ /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartIndicators, children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorsIcon, {}) }),
4789
+ /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyLineType, { lineType, changeLineType }) }),
4790
+ /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartSetting, children: /* @__PURE__ */ jsxRuntime.jsx(SettingIcon, {}) })
4791
+ ] })
4792
+ ] }),
4793
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { children: fullscreen ? /* @__PURE__ */ jsxRuntime.jsx(
4794
+ ZoomOutIcon,
4795
+ {
4796
+ className: "oui-text-base-contrast-54 hover:oui-text-base-contrast oui-cursor-pointer",
4797
+ onClick: onFullScreenChange
4798
+ }
4799
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4800
+ ZoomInIcon,
4801
+ {
4802
+ className: "oui-text-base-contrast-54 hover:oui-text-base-contrast oui-cursor-pointer",
4803
+ onClick: onFullScreenChange
4804
+ }
4805
+ ) })
4806
+ ] });
4807
+ };
4700
4808
  var OperateButton = ({ children, onClick }) => {
4701
4809
  return /* @__PURE__ */ jsxRuntime.jsx(
4702
4810
  ui.Box,
@@ -4766,83 +4874,31 @@ var TradingviewUI = React3.forwardRef((props, ref) => {
4766
4874
  props.classNames?.content
4767
4875
  ),
4768
4876
  children: [
4769
- /* @__PURE__ */ jsxRuntime.jsx(topBar_default, { children: isMobile ? /* @__PURE__ */ jsxRuntime.jsxs(
4770
- ui.Flex,
4877
+ /* @__PURE__ */ jsxRuntime.jsx(topBar_default, { children: isMobile ? /* @__PURE__ */ jsxRuntime.jsx(
4878
+ MobileTopBar,
4771
4879
  {
4772
- gapX: 2,
4773
- width: "100%",
4774
- justify: "between",
4775
- className: "oui-hide-scrollbar oui-overflow-x-scroll",
4776
- children: [
4777
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4778
- LazyTimeInterval,
4779
- {
4780
- interval: interval ?? "15",
4781
- changeInterval
4782
- }
4783
- ) }),
4784
- /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartIndicators, children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorsIcon, {}) }),
4785
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4786
- LazyMobileDisplayControl,
4787
- {
4788
- displayControlState,
4789
- changeDisplayControlState: changeDisplaySetting
4790
- }
4791
- ) })
4792
- ]
4880
+ interval,
4881
+ changeInterval,
4882
+ displayControlState,
4883
+ changeDisplaySetting,
4884
+ openChartIndicators
4793
4885
  }
4794
- ) : /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "between", itemAlign: "center", width: "100%", children: [
4795
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
4796
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4797
- LazyTimeInterval,
4798
- {
4799
- interval: interval ?? "1",
4800
- changeInterval
4801
- }
4802
- ) }),
4803
- /* @__PURE__ */ jsxRuntime.jsx(
4804
- ui.Divider,
4805
- {
4806
- direction: "vertical",
4807
- className: "oui-h-4",
4808
- mx: 2,
4809
- intensity: 8
4810
- }
4811
- ),
4812
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "start", itemAlign: "center", gap: 2, children: [
4813
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4814
- LazyDesktopDisplayControl,
4815
- {
4816
- displayControlState,
4817
- changeDisplayControlState: changeDisplaySetting
4818
- }
4819
- ) }),
4820
- /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartIndicators, children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorsIcon, {}) }),
4821
- /* @__PURE__ */ jsxRuntime.jsx(React3__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4822
- LazyLineType,
4823
- {
4824
- lineType,
4825
- changeLineType
4826
- }
4827
- ) }),
4828
- /* @__PURE__ */ jsxRuntime.jsx(OperateButton, { onClick: openChartSetting, children: /* @__PURE__ */ jsxRuntime.jsx(SettingIcon, {}) })
4829
- ] })
4830
- ] }),
4831
- /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { children: props.fullscreen ? /* @__PURE__ */ jsxRuntime.jsx(
4832
- ZoomOutIcon,
4833
- {
4834
- className: "oui-text-base-contrast-54 hover:oui-text-base-contrast oui-cursor-pointer",
4835
- onClick: onFullScreenChange
4836
- }
4837
- ) : /* @__PURE__ */ jsxRuntime.jsx(
4838
- ZoomInIcon,
4839
- {
4840
- className: "oui-text-base-contrast-54 hover:oui-text-base-contrast oui-cursor-pointer",
4841
- onClick: onFullScreenChange
4842
- }
4843
- ) })
4844
- ] }) }),
4845
- /* @__PURE__ */ jsxRuntime.jsx("div", { ref: chartRef, className: "oui-size-full oui-overflow-hidden" })
4886
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4887
+ DesktopTopBar,
4888
+ {
4889
+ interval,
4890
+ changeInterval,
4891
+ displayControlState,
4892
+ changeDisplaySetting,
4893
+ openChartIndicators,
4894
+ lineType,
4895
+ changeLineType,
4896
+ openChartSetting,
4897
+ fullscreen: props.fullscreen,
4898
+ onFullScreenChange
4899
+ }
4900
+ ) }),
4901
+ /* @__PURE__ */ jsxRuntime.jsx(InjectableTradingviewDesktop, { ...props })
4846
4902
  ]
4847
4903
  }
4848
4904
  )
@@ -4851,9 +4907,10 @@ var TradingviewUI = React3.forwardRef((props, ref) => {
4851
4907
  });
4852
4908
  var TradingviewWidget = React3.forwardRef((props, ref) => {
4853
4909
  const state = useTradingviewScript(props);
4854
- return /* @__PURE__ */ jsxRuntime.jsx(TradingviewUI, { ...state, ref });
4910
+ return /* @__PURE__ */ jsxRuntime.jsx(TradingviewUI, { ...state });
4855
4911
  });
4856
4912
 
4913
+ exports.InjectableTradingviewDesktop = InjectableTradingviewDesktop;
4857
4914
  exports.TradingviewUI = TradingviewUI;
4858
4915
  exports.TradingviewWidget = TradingviewWidget;
4859
4916
  exports.useTradingviewScript = useTradingviewScript;