@orderly.network/ui-tradingview 3.0.4 → 3.1.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
@@ -15464,6 +15464,7 @@ interface ColorConfigInterface {
15464
15464
  }
15465
15465
 
15466
15466
  type TradingviewLocaleCode = LanguageCode;
15467
+ type TradingviewDirection = "ltr" | "rtl";
15467
15468
  interface TradingviewWidgetPropsInterface {
15468
15469
  symbol?: string;
15469
15470
  mode?: ChartMode;
@@ -15519,6 +15520,7 @@ interface TradingviewUIPropsInterface {
15519
15520
  root?: string;
15520
15521
  content?: string;
15521
15522
  };
15523
+ direction?: TradingviewDirection;
15522
15524
  fullscreen?: boolean;
15523
15525
  }
15524
15526
  interface DisplayControlSettingInterface {
@@ -15589,6 +15591,7 @@ declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15589
15591
  root?: string;
15590
15592
  content?: string;
15591
15593
  } | undefined;
15594
+ direction: "ltr" | "rtl";
15592
15595
  fullscreen: any;
15593
15596
  };
15594
15597
 
@@ -15600,4 +15603,4 @@ declare const DesktopDisplayControl: React.FC<IProps>;
15600
15603
 
15601
15604
  declare const MobileDisplayControl: React.FC<IProps>;
15602
15605
 
15603
- export { DesktopDisplayControl, type DesktopDisplayControlMenuItem, type DesktopDisplayControlMenuListProps, DesktopDisplayControlMenuListTarget, type DisplayControlSettingInterface, InjectableTradingviewDesktop, MobileDisplayControl, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
15606
+ export { DesktopDisplayControl, type DesktopDisplayControlMenuItem, type DesktopDisplayControlMenuListProps, DesktopDisplayControlMenuListTarget, type DisplayControlSettingInterface, InjectableTradingviewDesktop, MobileDisplayControl, type TradingviewDirection, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
package/dist/index.d.ts CHANGED
@@ -15464,6 +15464,7 @@ interface ColorConfigInterface {
15464
15464
  }
15465
15465
 
15466
15466
  type TradingviewLocaleCode = LanguageCode;
15467
+ type TradingviewDirection = "ltr" | "rtl";
15467
15468
  interface TradingviewWidgetPropsInterface {
15468
15469
  symbol?: string;
15469
15470
  mode?: ChartMode;
@@ -15519,6 +15520,7 @@ interface TradingviewUIPropsInterface {
15519
15520
  root?: string;
15520
15521
  content?: string;
15521
15522
  };
15523
+ direction?: TradingviewDirection;
15522
15524
  fullscreen?: boolean;
15523
15525
  }
15524
15526
  interface DisplayControlSettingInterface {
@@ -15589,6 +15591,7 @@ declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15589
15591
  root?: string;
15590
15592
  content?: string;
15591
15593
  } | undefined;
15594
+ direction: "ltr" | "rtl";
15592
15595
  fullscreen: any;
15593
15596
  };
15594
15597
 
@@ -15600,4 +15603,4 @@ declare const DesktopDisplayControl: React.FC<IProps>;
15600
15603
 
15601
15604
  declare const MobileDisplayControl: React.FC<IProps>;
15602
15605
 
15603
- export { DesktopDisplayControl, type DesktopDisplayControlMenuItem, type DesktopDisplayControlMenuListProps, DesktopDisplayControlMenuListTarget, type DisplayControlSettingInterface, InjectableTradingviewDesktop, MobileDisplayControl, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
15606
+ export { DesktopDisplayControl, type DesktopDisplayControlMenuItem, type DesktopDisplayControlMenuListProps, DesktopDisplayControlMenuListTarget, type DisplayControlSettingInterface, InjectableTradingviewDesktop, MobileDisplayControl, type TradingviewDirection, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
package/dist/index.js CHANGED
@@ -489,7 +489,7 @@ var init_timeInterval = __esm({
489
489
  "div",
490
490
  {
491
491
  className: ui.cn(
492
- "oui-text-2xs oui-text-base-contrast-36 oui-flex oui-gap-[2px] oui-items-center oui-mr-3 oui-font-semibold",
492
+ "oui-text-2xs oui-text-base-contrast-36 oui-flex oui-gap-[2px] oui-items-center oui-me-3 oui-font-semibold",
493
493
  "oui-overflow-hidden"
494
494
  ),
495
495
  children: timeIntervalMap.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -562,7 +562,7 @@ var init_timeInterval = __esm({
562
562
  "oui-overflow-hidden"
563
563
  ),
564
564
  children: [
565
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: " oui-flex oui-gap-1 oui-items-center oui-mr-3 oui-font-semibold", children: mobileTimeIntervalDefaultMap.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
565
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: " oui-flex oui-gap-1 oui-items-center oui-me-3 oui-font-semibold", children: mobileTimeIntervalDefaultMap.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
566
566
  "div",
567
567
  {
568
568
  className: ui.cn(
@@ -4340,6 +4340,7 @@ var Widget = class {
4340
4340
  datafeed: options.datafeed,
4341
4341
  studies_overrides: options.studiesOverrides,
4342
4342
  locale: options.locale,
4343
+ direction: options.direction,
4343
4344
  theme: options.theme,
4344
4345
  loading_screen: options.loadingScreen,
4345
4346
  toolbar_bg: options.toolbarBg,
@@ -4421,7 +4422,7 @@ var getChartLocalStorageKey = (suffix, isMobile) => {
4421
4422
  return isMobile ? `orderly_tradingview_mobile_${suffix}` : `orderly_tradingview_${suffix}`;
4422
4423
  };
4423
4424
  var defaultLocale = (localeCode) => {
4424
- return localeCode === "id" ? "id_ID" : localeCode === "tc" ? "zh_TW" : localeCode;
4425
+ return localeCode === "id" ? "id_ID" : localeCode === "tc" ? "zh_TW" : localeCode === "ar" ? "ar" : localeCode === "he" ? "he_IL" : localeCode;
4425
4426
  };
4426
4427
  function useTradingviewScript(props) {
4427
4428
  const {
@@ -4441,6 +4442,7 @@ function useTradingviewScript(props) {
4441
4442
  customIndicatorsGetter
4442
4443
  } = props;
4443
4444
  const localeCode = i18n.useLocaleCode();
4445
+ const direction = ui.useDocumentDirection();
4444
4446
  const { isMobile } = ui.useScreen();
4445
4447
  const { currentTheme } = ui.useOrderlyTheme();
4446
4448
  const theme = props.theme ?? currentTheme?.mode ?? "dark";
@@ -4673,6 +4675,7 @@ function useTradingviewScript(props) {
4673
4675
  autosize: true,
4674
4676
  symbol: withExchangePrefix(symbol),
4675
4677
  locale: typeof locale === "function" ? locale(localeCode) : locale,
4678
+ direction,
4676
4679
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
4677
4680
  container: chartRef.current,
4678
4681
  libraryPath,
@@ -4725,7 +4728,8 @@ function useTradingviewScript(props) {
4725
4728
  configHash,
4726
4729
  loadingScreen,
4727
4730
  toolbarBg,
4728
- customIndicatorsGetter
4731
+ customIndicatorsGetter,
4732
+ direction
4729
4733
  ]);
4730
4734
  React3.useEffect(() => {
4731
4735
  ws.on(
@@ -4785,6 +4789,7 @@ function useTradingviewScript(props) {
4785
4789
  symbol,
4786
4790
  onFullScreenChange,
4787
4791
  classNames,
4792
+ direction,
4788
4793
  fullscreen
4789
4794
  };
4790
4795
  }
@@ -4806,7 +4811,7 @@ var NoTradingview = () => {
4806
4811
  const { t } = i18n.useTranslation();
4807
4812
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-absolute oui-inset-0 oui-z-0 oui-flex oui-flex-col oui-items-center oui-justify-start oui-p-2 oui-text-base-contrast-80 md:oui-justify-center md:oui-p-10", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4808
4813
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "oui-mb-6 oui-text-xs", children: t("tradingView.noScriptSrc") }),
4809
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "oui-mb-3 oui-pl-0 oui-text-2xs oui-text-base-contrast-54 md:oui-pl-2 md:oui-text-base md:oui-text-base-contrast-80", children: /* @__PURE__ */ jsxRuntime.jsx(
4814
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "oui-mb-3 oui-ps-0 oui-text-2xs oui-text-base-contrast-54 md:oui-ps-2 md:oui-text-base md:oui-text-base-contrast-80", children: /* @__PURE__ */ jsxRuntime.jsx(
4810
4815
  i18n.Trans,
4811
4816
  {
4812
4817
  i18nKey: "tradingView.noScriptSrc.1",
@@ -4821,7 +4826,7 @@ var NoTradingview = () => {
4821
4826
  ]
4822
4827
  }
4823
4828
  ) }),
4824
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "oui-pl-0 oui-text-2xs oui-text-base-contrast-54 md:oui-pl-2 md:oui-text-base md:oui-text-base-contrast-80", children: /* @__PURE__ */ jsxRuntime.jsx(
4829
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "oui-ps-0 oui-text-2xs oui-text-base-contrast-54 md:oui-ps-2 md:oui-text-base md:oui-text-base-contrast-80", children: /* @__PURE__ */ jsxRuntime.jsx(
4825
4830
  i18n.Trans,
4826
4831
  {
4827
4832
  i18nKey: "tradingView.noScriptSrc.2",
@@ -4842,12 +4847,13 @@ var TopBar = (props) => {
4842
4847
  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 });
4843
4848
  };
4844
4849
  var topBar_default = TopBar;
4845
- var TradingviewChart = ({ chartRef }) => {
4850
+ var TradingviewChart = ({ chartRef, direction = "ltr" }) => {
4846
4851
  return /* @__PURE__ */ jsxRuntime.jsx(
4847
4852
  "div",
4848
4853
  {
4849
4854
  "data-testid": "tradingview-chart",
4850
4855
  ref: chartRef,
4856
+ dir: direction,
4851
4857
  className: "oui-size-full oui-overflow-hidden"
4852
4858
  }
4853
4859
  );
@@ -5014,13 +5020,15 @@ var TradingviewUI = React3.forwardRef((props, ref) => {
5014
5020
  changeLineType,
5015
5021
  openChartSetting,
5016
5022
  openChartIndicators,
5017
- onFullScreenChange
5023
+ onFullScreenChange,
5024
+ direction = "ltr"
5018
5025
  } = props;
5019
5026
  const { isMobile } = ui.useScreen();
5020
5027
  return /* @__PURE__ */ jsxRuntime.jsx(
5021
5028
  "div",
5022
5029
  {
5023
5030
  ref,
5031
+ dir: direction,
5024
5032
  className: ui.cn(
5025
5033
  "oui-tradingview-root oui-relative oui-size-full",
5026
5034
  props.classNames?.root
@@ -5028,6 +5036,7 @@ var TradingviewUI = React3.forwardRef((props, ref) => {
5028
5036
  children: !tradingViewScriptSrc ? /* @__PURE__ */ jsxRuntime.jsx(NoTradingview, {}) : /* @__PURE__ */ jsxRuntime.jsxs(
5029
5037
  "div",
5030
5038
  {
5039
+ dir: direction,
5031
5040
  className: ui.cn(
5032
5041
  "oui-absolute oui-inset-0 oui-z-[1] oui-flex oui-flex-col",
5033
5042
  props.classNames?.content