@orderly.network/ui-order-entry 3.0.4-alpha.3 → 3.0.4-alpha.4

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.js CHANGED
@@ -1718,33 +1718,38 @@ function AssetInfo(props) {
1718
1718
  symbol,
1719
1719
  side: props.side
1720
1720
  });
1721
+ const estLiqTipsContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-min-w-[204px] oui-max-w-[280px] oui-text-2xs oui-leading-normal oui-text-base-contrast-80", children: [
1722
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-pretty", children: t("common.liquidationPrice.tooltip") }),
1723
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
1724
+ "a",
1725
+ {
1726
+ href: "https://orderly.network/docs/introduction/trade-on-orderly/perpetual-futures/liquidations",
1727
+ target: "_blank",
1728
+ rel: "noopener noreferrer",
1729
+ className: "oui-text-primary oui-underline",
1730
+ children: t("common.liquidationPrice.tooltip.learnMore")
1731
+ }
1732
+ ) })
1733
+ ] });
1721
1734
  return /* @__PURE__ */ jsxRuntime.jsxs(
1722
1735
  "div",
1723
1736
  {
1724
1737
  className: "oui-orderEntry-assetInfo oui-space-y-[2px] xl:oui-space-y-1",
1725
1738
  children: [
1726
1739
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "between", className: "oui-orderEntry-estLiqPrice", children: [
1727
- isMobile ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", children: t("orderEntry.estLiqPrice") }) : /* @__PURE__ */ jsxRuntime.jsx(
1728
- ui.Tooltip,
1740
+ /* @__PURE__ */ jsxRuntime.jsx(
1741
+ ui.Tips,
1729
1742
  {
1730
- content: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-min-w-[204px] oui-max-w-[280px] oui-text-2xs oui-leading-normal oui-text-base-contrast-80", children: [
1731
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-pretty", children: t("common.liquidationPrice.tooltip") }),
1732
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
1733
- "a",
1734
- {
1735
- href: "https://orderly.network/docs/introduction/trade-on-orderly/perpetual-futures/liquidations",
1736
- target: "_blank",
1737
- rel: "noopener noreferrer",
1738
- className: "oui-text-primary oui-underline",
1739
- children: t("common.liquidationPrice.tooltip.learnMore")
1740
- }
1741
- ) })
1742
- ] }),
1743
- children: /* @__PURE__ */ jsxRuntime.jsx(
1743
+ title: t("common.tips"),
1744
+ content: estLiqTipsContent,
1745
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(
1744
1746
  ui.Text,
1745
1747
  {
1746
1748
  size: "2xs",
1747
- className: "oui-estLiqPrice-label oui-cursor-pointer oui-border-b oui-border-dashed oui-border-line-12",
1749
+ className: ui.cn(
1750
+ "oui-estLiqPrice-label oui-cursor-pointer",
1751
+ "oui-border-b oui-border-dashed oui-border-line-12"
1752
+ ),
1748
1753
  children: t("orderEntry.estLiqPrice")
1749
1754
  }
1750
1755
  )
@@ -1854,6 +1859,7 @@ var LTVRiskTooltipUI = (props) => {
1854
1859
  threshold: isThresholdLoading ? "-" : ltv_threshold,
1855
1860
  usdcThreshold: isThresholdLoading ? "-" : negative_usdc_threshold
1856
1861
  }) }),
1862
+ marginMode === types.MarginMode.ISOLATED ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-pb-2", intensity: 54, size: "2xs", children: t("transfer.LTV.isolatedMarginOrderHint") }) : null,
1857
1863
  /* @__PURE__ */ jsxRuntime.jsx(
1858
1864
  ui.Button,
1859
1865
  {
@@ -1883,6 +1889,7 @@ var useConvertThreshold = () => {
1883
1889
  };
1884
1890
  };
1885
1891
  var useLTVTooltipScript = (marginMode) => {
1892
+ const { isMobile } = ui.useScreen();
1886
1893
  const { data: holdingList = [], isLoading: isHoldingLoading } = hooks.useHoldingStream();
1887
1894
  const {
1888
1895
  ltv_threshold,
@@ -1914,8 +1921,8 @@ var useLTVTooltipScript = (marginMode) => {
1914
1921
  });
1915
1922
  const currentLtv = hooks.useComputedLTV();
1916
1923
  const onConvert = React3.useCallback(async () => {
1917
- return ui.modal.show("ConvertDialogId");
1918
- }, []);
1924
+ return ui.modal.show(isMobile ? "ConvertSheetId" : "ConvertDialogId");
1925
+ }, [isMobile]);
1919
1926
  return {
1920
1927
  holdingData,
1921
1928
  isHoldingLoading,
@@ -1940,6 +1947,13 @@ var Available = (props) => {
1940
1947
  const showLTV = React3.useMemo(() => {
1941
1948
  return typeof currentLtv === "number" && !Number.isNaN(currentLtv) && currentLtv > 0;
1942
1949
  }, [currentLtv]);
1950
+ const availableTooltip = React3.useMemo(() => {
1951
+ return marginMode === types.MarginMode.ISOLATED ? t("transfer.LTV.isolatedModeUsdcOnly") : t("transfer.LTV.availableCrossMarginHint");
1952
+ }, [marginMode, t]);
1953
+ const availableTipsContent = React3.useMemo(
1954
+ () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-pretty oui-text-2xs oui-leading-normal oui-text-base-contrast-80", children: availableTooltip }),
1955
+ [availableTooltip]
1956
+ );
1943
1957
  return /* @__PURE__ */ jsxRuntime.jsxs(
1944
1958
  ui.Flex,
1945
1959
  {
@@ -1947,14 +1961,31 @@ var Available = (props) => {
1947
1961
  justify: "between",
1948
1962
  className: "oui-orderEntry-available",
1949
1963
  children: [
1950
- marginMode === types.MarginMode.ISOLATED ? /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: t("transfer.LTV.isolatedModeUsdcOnly"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-available-label oui-cursor-pointer", size: "2xs", children: t("common.available") }) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-available-label", size: "2xs", children: t("common.available") }),
1964
+ /* @__PURE__ */ jsxRuntime.jsx(
1965
+ ui.Tips,
1966
+ {
1967
+ title: t("common.tips"),
1968
+ content: availableTipsContent,
1969
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(
1970
+ ui.Text,
1971
+ {
1972
+ size: "2xs",
1973
+ className: ui.cn(
1974
+ "oui-available-label oui-cursor-pointer",
1975
+ "oui-border-b oui-border-dashed oui-border-line-12"
1976
+ ),
1977
+ children: t("common.available")
1978
+ }
1979
+ )
1980
+ }
1981
+ ),
1951
1982
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { itemAlign: "center", justify: "center", gap: 1, children: [
1952
1983
  showLTV && /* @__PURE__ */ jsxRuntime.jsx(
1953
- ui.Tooltip,
1984
+ ui.Tips,
1954
1985
  {
1955
- className: "oui-available-ltvRisk-tooltip oui-bg-base-6 oui-p-2",
1986
+ title: t("common.tips"),
1956
1987
  content: /* @__PURE__ */ jsxRuntime.jsx(LTVRiskTooltipWidget, { marginMode }),
1957
- children: /* @__PURE__ */ jsxRuntime.jsx(
1988
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(
1958
1989
  ui.InfoCircleIcon,
1959
1990
  {
1960
1991
  className: "oui-cursor-pointer oui-text-warning oui-opacity-80"
@@ -2600,19 +2631,26 @@ var MarginModeSwitch = (props) => {
2600
2631
  var OptionCard = (props) => {
2601
2632
  const { t } = i18n.useTranslation();
2602
2633
  const title = props.mode === types.MarginMode.CROSS ? t("marginMode.crossMargin") : t("marginMode.isolatedMargin");
2603
- const desc = props.mode === types.MarginMode.CROSS ? t("marginMode.crossMarginDescription") : t("marginMode.isolatedMarginDescription");
2604
2634
  return /* @__PURE__ */ jsxRuntime.jsxs(
2605
- "button",
2635
+ "div",
2606
2636
  {
2607
- type: "button",
2637
+ role: "button",
2638
+ tabIndex: props.disabled ? -1 : 0,
2608
2639
  className: ui.cn(
2609
2640
  "oui-relative oui-w-full oui-rounded-md oui-p-2",
2610
2641
  "oui-bg-base-6",
2611
2642
  "oui-text-left",
2612
- props.disabled ? "oui-cursor-not-allowed oui-opacity-50 oui-border oui-border-transparent" : props.selected ? "oui-border oui-border-[#38e2fe]" : "oui-border oui-border-transparent hover:oui-border-line-12"
2643
+ props.disabled ? "oui-cursor-not-allowed oui-opacity-50 oui-border oui-border-transparent" : props.selected ? "oui-border oui-border-[#38e2fe]" : "oui-border oui-border-transparent hover:oui-border-line-12",
2644
+ !props.disabled && "oui-cursor-pointer"
2613
2645
  ),
2614
2646
  onClick: props.disabled ? void 0 : props.onClick,
2615
- disabled: props.disabled,
2647
+ onKeyDown: (e) => {
2648
+ if (props.disabled) return;
2649
+ if (e.key === "Enter" || e.key === " ") {
2650
+ e.preventDefault();
2651
+ props.onClick();
2652
+ }
2653
+ },
2616
2654
  "aria-disabled": props.disabled,
2617
2655
  "data-testid": `oui-testid-marginModeSwitch-option-${props.mode}`,
2618
2656
  children: [
@@ -2625,7 +2663,25 @@ var OptionCard = (props) => {
2625
2663
  children: title
2626
2664
  }
2627
2665
  ),
2628
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-2xs oui-leading-[15px] oui-text-base-contrast-36 oui-font-semibold oui-tracking-[0.03em]", children: desc })
2666
+ props.mode === types.MarginMode.ISOLATED ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-2xs oui-leading-[15px] oui-text-base-contrast-36 oui-font-semibold oui-tracking-[0.03em]", children: /* @__PURE__ */ jsxRuntime.jsx(
2667
+ i18n.Trans,
2668
+ {
2669
+ i18nKey: "marginMode.isolatedMarginDescription",
2670
+ components: [
2671
+ /* @__PURE__ */ jsxRuntime.jsx(
2672
+ "a",
2673
+ {
2674
+ href: "https://orderly.network/docs/introduction/trade-on-orderly/perpetual-futures/isolated-margin",
2675
+ target: "_blank",
2676
+ rel: "noopener noreferrer",
2677
+ className: "whitespace-nowrap oui-font-semibold oui-text-warning oui-underline oui-underline-offset-2 hover:oui-text-warning/90",
2678
+ onClick: (e) => e.stopPropagation()
2679
+ },
2680
+ "isolated-margin-doc"
2681
+ )
2682
+ ]
2683
+ }
2684
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-2xs oui-leading-[15px] oui-text-base-contrast-36 oui-font-semibold oui-tracking-[0.03em]", children: t("marginMode.crossMarginDescription") })
2629
2685
  ] }),
2630
2686
  props.isCurrent ? /* @__PURE__ */ jsxRuntime.jsx(
2631
2687
  "div",