@orderly.network/ui-tradingview 3.0.0 → 3.0.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
@@ -1,6 +1,6 @@
1
+ import { LocaleCode } from '@orderly.network/i18n';
1
2
  import * as React$1 from 'react';
2
3
  import React__default from 'react';
3
- import { LocaleCode } from '@orderly.network/i18n';
4
4
 
5
5
  /* eslint-enable jsdoc/require-jsdoc */
6
6
  declare enum HHistDirection {
@@ -15532,6 +15532,40 @@ interface DisplayControlSettingInterface {
15532
15532
  liquidationPrice: boolean;
15533
15533
  }
15534
15534
 
15535
+ interface IProps {
15536
+ displayControlState: DisplayControlSettingInterface;
15537
+ changeDisplayControlState: (state: DisplayControlSettingInterface) => void;
15538
+ }
15539
+ /**
15540
+ * One desktop dropdown menu row in display-control panel.
15541
+ * `onCheckedChange` allows plugins to inject fully custom toggle behaviors.
15542
+ */
15543
+ type DesktopDisplayControlMenuItem = {
15544
+ id: string;
15545
+ label: string;
15546
+ checked?: boolean;
15547
+ disabled?: boolean;
15548
+ onCheckedChange?: (checked: boolean) => void;
15549
+ };
15550
+ /**
15551
+ * Interceptor props for desktop display-control menu list target.
15552
+ */
15553
+ type DesktopDisplayControlMenuListProps = {
15554
+ items: DesktopDisplayControlMenuItem[];
15555
+ };
15556
+
15557
+ /**
15558
+ * Module augmentation: maps TradingView interceptor target paths to props types.
15559
+ * Import from @orderly.network/ui-tradingview to enable typed props in
15560
+ * createInterceptor("TradingView.DisplayControl.DesktopMenuList", ...).
15561
+ */
15562
+
15563
+ declare module "@orderly.network/plugin-core" {
15564
+ interface InterceptorTargetPropsMap {
15565
+ "TradingView.DisplayControl.DesktopMenuList": DesktopDisplayControlMenuListProps;
15566
+ }
15567
+ }
15568
+
15535
15569
  declare const TradingviewWidget: React$1.ForwardRefExoticComponent<TradingviewWidgetPropsInterface & React$1.RefAttributes<HTMLDivElement>>;
15536
15570
 
15537
15571
  declare const TradingviewUI: React__default.ForwardRefExoticComponent<TradingviewUIPropsInterface & React__default.RefAttributes<HTMLDivElement>>;
@@ -15558,4 +15592,12 @@ declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15558
15592
  fullscreen: any;
15559
15593
  };
15560
15594
 
15561
- export { type DisplayControlSettingInterface, InjectableTradingviewDesktop, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
15595
+ /**
15596
+ * Interceptor target path for desktop TradingView display-control dropdown list.
15597
+ */
15598
+ declare const DesktopDisplayControlMenuListTarget = "TradingView.DisplayControl.DesktopMenuList";
15599
+ declare const DesktopDisplayControl: React.FC<IProps>;
15600
+
15601
+ declare const MobileDisplayControl: React.FC<IProps>;
15602
+
15603
+ export { DesktopDisplayControl, type DesktopDisplayControlMenuItem, type DesktopDisplayControlMenuListProps, DesktopDisplayControlMenuListTarget, type DisplayControlSettingInterface, InjectableTradingviewDesktop, MobileDisplayControl, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { LocaleCode } from '@orderly.network/i18n';
1
2
  import * as React$1 from 'react';
2
3
  import React__default from 'react';
3
- import { LocaleCode } from '@orderly.network/i18n';
4
4
 
5
5
  /* eslint-enable jsdoc/require-jsdoc */
6
6
  declare enum HHistDirection {
@@ -15532,6 +15532,40 @@ interface DisplayControlSettingInterface {
15532
15532
  liquidationPrice: boolean;
15533
15533
  }
15534
15534
 
15535
+ interface IProps {
15536
+ displayControlState: DisplayControlSettingInterface;
15537
+ changeDisplayControlState: (state: DisplayControlSettingInterface) => void;
15538
+ }
15539
+ /**
15540
+ * One desktop dropdown menu row in display-control panel.
15541
+ * `onCheckedChange` allows plugins to inject fully custom toggle behaviors.
15542
+ */
15543
+ type DesktopDisplayControlMenuItem = {
15544
+ id: string;
15545
+ label: string;
15546
+ checked?: boolean;
15547
+ disabled?: boolean;
15548
+ onCheckedChange?: (checked: boolean) => void;
15549
+ };
15550
+ /**
15551
+ * Interceptor props for desktop display-control menu list target.
15552
+ */
15553
+ type DesktopDisplayControlMenuListProps = {
15554
+ items: DesktopDisplayControlMenuItem[];
15555
+ };
15556
+
15557
+ /**
15558
+ * Module augmentation: maps TradingView interceptor target paths to props types.
15559
+ * Import from @orderly.network/ui-tradingview to enable typed props in
15560
+ * createInterceptor("TradingView.DisplayControl.DesktopMenuList", ...).
15561
+ */
15562
+
15563
+ declare module "@orderly.network/plugin-core" {
15564
+ interface InterceptorTargetPropsMap {
15565
+ "TradingView.DisplayControl.DesktopMenuList": DesktopDisplayControlMenuListProps;
15566
+ }
15567
+ }
15568
+
15535
15569
  declare const TradingviewWidget: React$1.ForwardRefExoticComponent<TradingviewWidgetPropsInterface & React$1.RefAttributes<HTMLDivElement>>;
15536
15570
 
15537
15571
  declare const TradingviewUI: React__default.ForwardRefExoticComponent<TradingviewUIPropsInterface & React__default.RefAttributes<HTMLDivElement>>;
@@ -15558,4 +15592,12 @@ declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
15558
15592
  fullscreen: any;
15559
15593
  };
15560
15594
 
15561
- export { type DisplayControlSettingInterface, InjectableTradingviewDesktop, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
15595
+ /**
15596
+ * Interceptor target path for desktop TradingView display-control dropdown list.
15597
+ */
15598
+ declare const DesktopDisplayControlMenuListTarget = "TradingView.DisplayControl.DesktopMenuList";
15599
+ declare const DesktopDisplayControl: React.FC<IProps>;
15600
+
15601
+ declare const MobileDisplayControl: React.FC<IProps>;
15602
+
15603
+ export { DesktopDisplayControl, type DesktopDisplayControlMenuItem, type DesktopDisplayControlMenuListProps, DesktopDisplayControlMenuListTarget, type DisplayControlSettingInterface, InjectableTradingviewDesktop, MobileDisplayControl, type TradingviewLocaleCode, TradingviewUI, type TradingviewUIPropsInterface, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };
package/dist/index.js CHANGED
@@ -627,11 +627,48 @@ var init_timeInterval = __esm({
627
627
  };
628
628
  }
629
629
  });
630
- var DesktopDisplayControl;
630
+ exports.DesktopDisplayControlMenuListTarget = void 0; var DesktopDisplayControlMenuList, InjectableDesktopDisplayControlMenuList; exports.DesktopDisplayControl = void 0;
631
631
  var init_displayControl_desktop = __esm({
632
632
  "src/components/displayControl/displayControl.desktop.tsx"() {
633
633
  init_icons();
634
- DesktopDisplayControl = (props) => {
634
+ exports.DesktopDisplayControlMenuListTarget = "TradingView.DisplayControl.DesktopMenuList";
635
+ DesktopDisplayControlMenuList = ({ items }) => {
636
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
637
+ ui.Flex,
638
+ {
639
+ justify: "between",
640
+ itemAlign: "center",
641
+ className: "oui-w-full",
642
+ children: [
643
+ /* @__PURE__ */ jsxRuntime.jsx(
644
+ ui.Text,
645
+ {
646
+ className: ui.cn(
647
+ "oui-text-sm oui-text-base-contrast-80",
648
+ !(item.checked ?? true) && "oui-text-base-contrast-36"
649
+ ),
650
+ children: item.label
651
+ }
652
+ ),
653
+ /* @__PURE__ */ jsxRuntime.jsx(
654
+ ui.Switch,
655
+ {
656
+ className: "oui-h-4 oui-w-8",
657
+ checked: item.checked ?? true,
658
+ disabled: item.disabled,
659
+ onCheckedChange: (checked) => item.onCheckedChange?.(checked)
660
+ }
661
+ )
662
+ ]
663
+ },
664
+ item.id
665
+ )) });
666
+ };
667
+ InjectableDesktopDisplayControlMenuList = ui.injectable(
668
+ DesktopDisplayControlMenuList,
669
+ exports.DesktopDisplayControlMenuListTarget
670
+ );
671
+ exports.DesktopDisplayControl = (props) => {
635
672
  const { displayControlState, changeDisplayControlState } = props;
636
673
  const [open, setOpen] = React3.useState(false);
637
674
  const { t } = i18n.useTranslation();
@@ -639,38 +676,94 @@ var init_displayControl_desktop = __esm({
639
676
  return [
640
677
  {
641
678
  label: t("common.position"),
642
- id: "position"
679
+ id: "position",
680
+ checked: displayControlState.position ?? true,
681
+ onCheckedChange: (checked) => {
682
+ changeDisplayControlState({
683
+ ...displayControlState,
684
+ position: checked
685
+ });
686
+ }
643
687
  },
644
688
  {
645
689
  label: t("tradingView.displayControl.buySell"),
646
- id: "buySell"
690
+ id: "buySell",
691
+ checked: displayControlState.buySell ?? true,
692
+ onCheckedChange: (checked) => {
693
+ changeDisplayControlState({
694
+ ...displayControlState,
695
+ buySell: checked
696
+ });
697
+ }
647
698
  },
648
699
  {
649
700
  label: t("tradingView.displayControl.limitOrders"),
650
- id: "limitOrders"
701
+ id: "limitOrders",
702
+ checked: displayControlState.limitOrders ?? true,
703
+ onCheckedChange: (checked) => {
704
+ changeDisplayControlState({
705
+ ...displayControlState,
706
+ limitOrders: checked
707
+ });
708
+ }
651
709
  },
652
710
  {
653
711
  label: t("tradingView.displayControl.stopOrders"),
654
- id: "stopOrders"
712
+ id: "stopOrders",
713
+ checked: displayControlState.stopOrders ?? true,
714
+ onCheckedChange: (checked) => {
715
+ changeDisplayControlState({
716
+ ...displayControlState,
717
+ stopOrders: checked
718
+ });
719
+ }
655
720
  },
656
721
  {
657
722
  label: t("common.tpsl"),
658
- id: "tpsl"
723
+ id: "tpsl",
724
+ checked: displayControlState.tpsl ?? true,
725
+ onCheckedChange: (checked) => {
726
+ changeDisplayControlState({
727
+ ...displayControlState,
728
+ tpsl: checked
729
+ });
730
+ }
659
731
  },
660
732
  {
661
733
  label: t("tpsl.positionTpsl"),
662
- id: "positionTpsl"
734
+ id: "positionTpsl",
735
+ checked: displayControlState.positionTpsl ?? true,
736
+ onCheckedChange: (checked) => {
737
+ changeDisplayControlState({
738
+ ...displayControlState,
739
+ positionTpsl: checked
740
+ });
741
+ }
663
742
  },
664
743
  {
665
744
  label: t("orderEntry.orderType.trailingStop"),
666
- id: "trailingStop"
745
+ id: "trailingStop",
746
+ checked: displayControlState.trailingStop ?? true,
747
+ onCheckedChange: (checked) => {
748
+ changeDisplayControlState({
749
+ ...displayControlState,
750
+ trailingStop: checked
751
+ });
752
+ }
667
753
  },
668
754
  {
669
755
  label: t("tradingView.displayControl.liquidationPrice"),
670
- id: "liquidationPrice"
756
+ id: "liquidationPrice",
757
+ checked: displayControlState.liquidationPrice ?? true,
758
+ onCheckedChange: (checked) => {
759
+ changeDisplayControlState({
760
+ ...displayControlState,
761
+ liquidationPrice: checked
762
+ });
763
+ }
671
764
  }
672
765
  ];
673
- }, [t]);
766
+ }, [changeDisplayControlState, displayControlState, t]);
674
767
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuRoot, { open, onOpenChange: setOpen, children: [
675
768
  /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
676
769
  ui.Flex,
@@ -717,40 +810,12 @@ var init_displayControl_desktop = __esm({
717
810
  width: 240,
718
811
  justify: "start",
719
812
  itemAlign: "start",
720
- children: displayControlMap.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
721
- ui.Flex,
813
+ children: /* @__PURE__ */ jsxRuntime.jsx(
814
+ InjectableDesktopDisplayControlMenuList,
722
815
  {
723
- justify: "between",
724
- itemAlign: "center",
725
- className: "oui-w-full",
726
- children: [
727
- /* @__PURE__ */ jsxRuntime.jsx(
728
- ui.Text,
729
- {
730
- className: ui.cn(
731
- "oui-text-sm oui-text-base-contrast-80",
732
- !(displayControlState[item.id] ?? true) && "oui-text-base-contrast-36"
733
- ),
734
- children: item.label
735
- }
736
- ),
737
- /* @__PURE__ */ jsxRuntime.jsx(
738
- ui.Switch,
739
- {
740
- className: "oui-h-4 oui-w-8",
741
- checked: displayControlState[item.id] ?? true,
742
- onCheckedChange: (checked) => {
743
- changeDisplayControlState({
744
- ...displayControlState,
745
- [item.id]: checked
746
- });
747
- }
748
- }
749
- )
750
- ]
751
- },
752
- item.id
753
- ))
816
+ items: displayControlMap
817
+ }
818
+ )
754
819
  }
755
820
  )
756
821
  }
@@ -759,11 +824,11 @@ var init_displayControl_desktop = __esm({
759
824
  };
760
825
  }
761
826
  });
762
- var MobileDisplayControl;
827
+ exports.MobileDisplayControl = void 0;
763
828
  var init_displayControl_mobile = __esm({
764
829
  "src/components/displayControl/displayControl.mobile.tsx"() {
765
830
  init_icons();
766
- MobileDisplayControl = (props) => {
831
+ exports.MobileDisplayControl = (props) => {
767
832
  const [open, setOpen] = React3.useState(false);
768
833
  const { t } = i18n.useTranslation();
769
834
  const mobileDisplayControlMap = React3.useMemo(() => {
@@ -888,8 +953,9 @@ var init_displayControl_mobile = __esm({
888
953
  // src/components/displayControl/index.tsx
889
954
  var displayControl_exports = {};
890
955
  __export(displayControl_exports, {
891
- DesktopDisplayControl: () => DesktopDisplayControl,
892
- MobileDisplayControl: () => MobileDisplayControl
956
+ DesktopDisplayControl: () => exports.DesktopDisplayControl,
957
+ DesktopDisplayControlMenuListTarget: () => exports.DesktopDisplayControlMenuListTarget,
958
+ MobileDisplayControl: () => exports.MobileDisplayControl
893
959
  });
894
960
  var init_displayControl = __esm({
895
961
  "src/components/displayControl/index.tsx"() {
@@ -5003,6 +5069,9 @@ var TradingviewWidget = React3.forwardRef((props, ref) => {
5003
5069
  return /* @__PURE__ */ jsxRuntime.jsx(TradingviewUI, { ...state });
5004
5070
  });
5005
5071
 
5072
+ // src/index.ts
5073
+ init_displayControl();
5074
+
5006
5075
  exports.InjectableTradingviewDesktop = InjectableTradingviewDesktop;
5007
5076
  exports.TradingviewUI = TradingviewUI;
5008
5077
  exports.TradingviewWidget = TradingviewWidget;