@orderly.network/ui-tradingview 3.0.4-alpha.4 → 3.1.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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React3, { forwardRef, useRef, useState, useMemo, useEffect, useCallback } from 'react';
|
|
3
3
|
import { useTranslation, Trans, useLocaleCode, i18n } from '@orderly.network/i18n';
|
|
4
|
-
import { injectable, useScreen, cn, Flex, Divider, useOrderlyTheme, Text, Switch, Box, useThemeAttribute, toast, modal, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent } from '@orderly.network/ui';
|
|
4
|
+
import { injectable, useScreen, cn, Flex, Divider, useDocumentDirection, useOrderlyTheme, Text, Switch, Box, useThemeAttribute, toast, modal, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent } from '@orderly.network/ui';
|
|
5
5
|
import { useConfig, useAccount, useSymbolsInfo, useLocalStorage, useOrderEntry_deprecated, useMarginModeBySymbol, useWS, usePositionStream, useOrderStream, useEventEmitter } from '@orderly.network/hooks';
|
|
6
6
|
import { OrderSide, TradingviewFullscreenKey, OrderType, AccountStatusEnum, OrderStatus, ORDER_ENTRY_EST_LIQ_PRICE_CHANGE, MarginMode } from '@orderly.network/types';
|
|
7
7
|
import { Decimal, commify, getTrailingStopPrice, getPrecisionByNumber } from '@orderly.network/utils';
|
|
@@ -483,7 +483,7 @@ var init_timeInterval = __esm({
|
|
|
483
483
|
"div",
|
|
484
484
|
{
|
|
485
485
|
className: cn(
|
|
486
|
-
"oui-text-2xs oui-text-base-contrast-36 oui-flex oui-gap-[2px] oui-items-center oui-
|
|
486
|
+
"oui-text-2xs oui-text-base-contrast-36 oui-flex oui-gap-[2px] oui-items-center oui-me-3 oui-font-semibold",
|
|
487
487
|
"oui-overflow-hidden"
|
|
488
488
|
),
|
|
489
489
|
children: timeIntervalMap.map((item) => /* @__PURE__ */ jsx(
|
|
@@ -556,7 +556,7 @@ var init_timeInterval = __esm({
|
|
|
556
556
|
"oui-overflow-hidden"
|
|
557
557
|
),
|
|
558
558
|
children: [
|
|
559
|
-
/* @__PURE__ */ jsx("div", { className: " oui-flex oui-gap-1 oui-items-center oui-
|
|
559
|
+
/* @__PURE__ */ jsx("div", { className: " oui-flex oui-gap-1 oui-items-center oui-me-3 oui-font-semibold", children: mobileTimeIntervalDefaultMap.map((item) => /* @__PURE__ */ jsx(
|
|
560
560
|
"div",
|
|
561
561
|
{
|
|
562
562
|
className: cn(
|
|
@@ -4334,6 +4334,7 @@ var Widget = class {
|
|
|
4334
4334
|
datafeed: options.datafeed,
|
|
4335
4335
|
studies_overrides: options.studiesOverrides,
|
|
4336
4336
|
locale: options.locale,
|
|
4337
|
+
direction: options.direction,
|
|
4337
4338
|
theme: options.theme,
|
|
4338
4339
|
loading_screen: options.loadingScreen,
|
|
4339
4340
|
toolbar_bg: options.toolbarBg,
|
|
@@ -4415,7 +4416,7 @@ var getChartLocalStorageKey = (suffix, isMobile) => {
|
|
|
4415
4416
|
return isMobile ? `orderly_tradingview_mobile_${suffix}` : `orderly_tradingview_${suffix}`;
|
|
4416
4417
|
};
|
|
4417
4418
|
var defaultLocale = (localeCode) => {
|
|
4418
|
-
return localeCode === "id" ? "id_ID" : localeCode === "tc" ? "zh_TW" : localeCode;
|
|
4419
|
+
return localeCode === "id" ? "id_ID" : localeCode === "tc" ? "zh_TW" : localeCode === "ar" ? "ar" : localeCode === "he" ? "he_IL" : localeCode;
|
|
4419
4420
|
};
|
|
4420
4421
|
function useTradingviewScript(props) {
|
|
4421
4422
|
const {
|
|
@@ -4435,6 +4436,7 @@ function useTradingviewScript(props) {
|
|
|
4435
4436
|
customIndicatorsGetter
|
|
4436
4437
|
} = props;
|
|
4437
4438
|
const localeCode = useLocaleCode();
|
|
4439
|
+
const direction = useDocumentDirection();
|
|
4438
4440
|
const { isMobile } = useScreen();
|
|
4439
4441
|
const { currentTheme } = useOrderlyTheme();
|
|
4440
4442
|
const theme = props.theme ?? currentTheme?.mode ?? "dark";
|
|
@@ -4667,6 +4669,7 @@ function useTradingviewScript(props) {
|
|
|
4667
4669
|
autosize: true,
|
|
4668
4670
|
symbol: withExchangePrefix(symbol),
|
|
4669
4671
|
locale: typeof locale === "function" ? locale(localeCode) : locale,
|
|
4672
|
+
direction,
|
|
4670
4673
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
4671
4674
|
container: chartRef.current,
|
|
4672
4675
|
libraryPath,
|
|
@@ -4719,7 +4722,8 @@ function useTradingviewScript(props) {
|
|
|
4719
4722
|
configHash,
|
|
4720
4723
|
loadingScreen,
|
|
4721
4724
|
toolbarBg,
|
|
4722
|
-
customIndicatorsGetter
|
|
4725
|
+
customIndicatorsGetter,
|
|
4726
|
+
direction
|
|
4723
4727
|
]);
|
|
4724
4728
|
useEffect(() => {
|
|
4725
4729
|
ws.on(
|
|
@@ -4779,6 +4783,7 @@ function useTradingviewScript(props) {
|
|
|
4779
4783
|
symbol,
|
|
4780
4784
|
onFullScreenChange,
|
|
4781
4785
|
classNames,
|
|
4786
|
+
direction,
|
|
4782
4787
|
fullscreen
|
|
4783
4788
|
};
|
|
4784
4789
|
}
|
|
@@ -4800,7 +4805,7 @@ var NoTradingview = () => {
|
|
|
4800
4805
|
const { t } = useTranslation();
|
|
4801
4806
|
return /* @__PURE__ */ 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__ */ jsxs("div", { children: [
|
|
4802
4807
|
/* @__PURE__ */ jsx("p", { className: "oui-mb-6 oui-text-xs", children: t("tradingView.noScriptSrc") }),
|
|
4803
|
-
/* @__PURE__ */ jsx("p", { className: "oui-mb-3 oui-
|
|
4808
|
+
/* @__PURE__ */ 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__ */ jsx(
|
|
4804
4809
|
Trans,
|
|
4805
4810
|
{
|
|
4806
4811
|
i18nKey: "tradingView.noScriptSrc.1",
|
|
@@ -4815,7 +4820,7 @@ var NoTradingview = () => {
|
|
|
4815
4820
|
]
|
|
4816
4821
|
}
|
|
4817
4822
|
) }),
|
|
4818
|
-
/* @__PURE__ */ jsx("p", { className: "oui-
|
|
4823
|
+
/* @__PURE__ */ 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__ */ jsx(
|
|
4819
4824
|
Trans,
|
|
4820
4825
|
{
|
|
4821
4826
|
i18nKey: "tradingView.noScriptSrc.2",
|
|
@@ -4836,12 +4841,13 @@ var TopBar = (props) => {
|
|
|
4836
4841
|
return /* @__PURE__ */ 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 });
|
|
4837
4842
|
};
|
|
4838
4843
|
var topBar_default = TopBar;
|
|
4839
|
-
var TradingviewChart = ({ chartRef }) => {
|
|
4844
|
+
var TradingviewChart = ({ chartRef, direction = "ltr" }) => {
|
|
4840
4845
|
return /* @__PURE__ */ jsx(
|
|
4841
4846
|
"div",
|
|
4842
4847
|
{
|
|
4843
4848
|
"data-testid": "tradingview-chart",
|
|
4844
4849
|
ref: chartRef,
|
|
4850
|
+
dir: direction,
|
|
4845
4851
|
className: "oui-size-full oui-overflow-hidden"
|
|
4846
4852
|
}
|
|
4847
4853
|
);
|
|
@@ -5008,13 +5014,15 @@ var TradingviewUI = forwardRef((props, ref) => {
|
|
|
5008
5014
|
changeLineType,
|
|
5009
5015
|
openChartSetting,
|
|
5010
5016
|
openChartIndicators,
|
|
5011
|
-
onFullScreenChange
|
|
5017
|
+
onFullScreenChange,
|
|
5018
|
+
direction = "ltr"
|
|
5012
5019
|
} = props;
|
|
5013
5020
|
const { isMobile } = useScreen();
|
|
5014
5021
|
return /* @__PURE__ */ jsx(
|
|
5015
5022
|
"div",
|
|
5016
5023
|
{
|
|
5017
5024
|
ref,
|
|
5025
|
+
dir: direction,
|
|
5018
5026
|
className: cn(
|
|
5019
5027
|
"oui-tradingview-root oui-relative oui-size-full",
|
|
5020
5028
|
props.classNames?.root
|
|
@@ -5022,6 +5030,7 @@ var TradingviewUI = forwardRef((props, ref) => {
|
|
|
5022
5030
|
children: !tradingViewScriptSrc ? /* @__PURE__ */ jsx(NoTradingview, {}) : /* @__PURE__ */ jsxs(
|
|
5023
5031
|
"div",
|
|
5024
5032
|
{
|
|
5033
|
+
dir: direction,
|
|
5025
5034
|
className: cn(
|
|
5026
5035
|
"oui-absolute oui-inset-0 oui-z-[1] oui-flex oui-flex-col",
|
|
5027
5036
|
props.classNames?.content
|