@kodiak-finance/orderly-ui-share 2.9.2 → 2.9.3

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
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var orderlyI18n = require('@kodiak-finance/orderly-i18n');
3
4
  var orderlyUi = require('@kodiak-finance/orderly-ui');
4
5
  var React = require('react');
5
6
  var orderlyHooks = require('@kodiak-finance/orderly-hooks');
6
- var orderlyI18n = require('@kodiak-finance/orderly-i18n');
7
7
  var orderlyTypes = require('@kodiak-finance/orderly-types');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var orderlyUtils = require('@kodiak-finance/orderly-utils');
@@ -63,6 +63,7 @@ var Poster = React.forwardRef((props, parentRef) => {
63
63
  ref,
64
64
  width,
65
65
  height,
66
+ dir: "ltr",
66
67
  className,
67
68
  style
68
69
  }
@@ -428,11 +429,17 @@ var NextButton = (props) => {
428
429
  };
429
430
  var CarouselBackgroundImage = (props) => {
430
431
  const { backgroundImages, selectedSnap, setSelectedSnap } = props;
432
+ const [direction, setDirection] = React.useState("ltr");
431
433
  const [emblaRef, emblaApi] = orderlyUi.useEmblaCarousel({
432
434
  // loop: true,
433
435
  containScroll: "keepSnaps",
434
- dragFree: true
436
+ dragFree: true,
437
+ direction
435
438
  });
439
+ React.useEffect(() => {
440
+ const docDir = document?.documentElement?.dir?.toLowerCase();
441
+ setDirection(docDir === "rtl" ? "rtl" : "ltr");
442
+ }, []);
436
443
  const onPrevButtonClick = React.useCallback(() => {
437
444
  if (!emblaApi) {
438
445
  return;
@@ -470,7 +477,7 @@ var CarouselBackgroundImage = (props) => {
470
477
  };
471
478
  }, [emblaApi, onSelect]);
472
479
  return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { mt: 4, px: 2, children: [
473
- /* @__PURE__ */ jsxRuntime.jsx(PrevButton, { onClick: onPrevButtonClick }),
480
+ direction === "rtl" ? /* @__PURE__ */ jsxRuntime.jsx(NextButton, { onClick: onNextButtonClick }) : /* @__PURE__ */ jsxRuntime.jsx(PrevButton, { onClick: onPrevButtonClick }),
474
481
  /* @__PURE__ */ jsxRuntime.jsx(
475
482
  "div",
476
483
  {
@@ -488,10 +495,9 @@ var CarouselBackgroundImage = (props) => {
488
495
  },
489
496
  mx: 2,
490
497
  my: 1,
491
- mr: 6,
492
498
  r: "base",
493
499
  className: orderlyUi.cn(
494
- "oui-shrink-0 oui-w-[162px]",
500
+ "oui-shrink-0 oui-w-[162px] oui-me-6",
495
501
  selectedSnap === index && "oui-outline oui-outline-1 oui-outline-primary-darken"
496
502
  ),
497
503
  children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: e, className: "oui-rounded-sm" })
@@ -500,7 +506,7 @@ var CarouselBackgroundImage = (props) => {
500
506
  )) })
501
507
  }
502
508
  ),
503
- /* @__PURE__ */ jsxRuntime.jsx(NextButton, { onClick: onNextButtonClick })
509
+ direction === "rtl" ? /* @__PURE__ */ jsxRuntime.jsx(PrevButton, { onClick: onPrevButtonClick }) : /* @__PURE__ */ jsxRuntime.jsx(NextButton, { onClick: onNextButtonClick })
504
510
  ] });
505
511
  };
506
512
  var Checkbox = (props) => {
@@ -572,7 +578,7 @@ var Message = (props) => {
572
578
  /* @__PURE__ */ jsxRuntime.jsx(
573
579
  "div",
574
580
  {
575
- className: "oui-text-xs oui-text-base-contrast-54 oui-ml-1 hover:oui-cursor-pointer",
581
+ className: "oui-text-xs oui-text-base-contrast-54 oui-ms-1 hover:oui-cursor-pointer",
576
582
  onClick: () => {
577
583
  setCheck(!props.check);
578
584
  },
@@ -593,7 +599,7 @@ var Message = (props) => {
593
599
  suffix: focus && /* @__PURE__ */ jsxRuntime.jsx(
594
600
  "button",
595
601
  {
596
- className: "oui-mr-3 oui-cursor-pointer",
602
+ className: "oui-me-3 oui-cursor-pointer",
597
603
  onMouseDown: (e) => {
598
604
  setMessage("");
599
605
  setTimeout(() => {
@@ -717,7 +723,7 @@ var PnlFormatView = (props) => {
717
723
  size: "xs",
718
724
  intensity: 54,
719
725
  className: orderlyUi.cn(
720
- "oui-ml-2 "
726
+ "oui-ms-2 "
721
727
  // isSelected && "oui-text-base-contrast"
722
728
  ),
723
729
  children: text
@@ -798,6 +804,7 @@ var DesktopSharePnLContent = (props) => {
798
804
  backgroundImages: []
799
805
  };
800
806
  const [domain, setDomain] = React.useState("");
807
+ const direction = "ltr";
801
808
  const posterRef = React.useRef(null);
802
809
  React.useEffect(() => {
803
810
  const currentDomain = window.location.hostname;
@@ -857,6 +864,7 @@ var DesktopSharePnLContent = (props) => {
857
864
  height: 310,
858
865
  data: {
859
866
  backgroundImg: curBgImg,
867
+ direction,
860
868
  ...resetOptions,
861
869
  data: posterData
862
870
  },
@@ -1079,7 +1087,7 @@ var CarouselItem = React__default.default.forwardRef((originalProps, ref) => {
1079
1087
  "aria-roledescription": "slide",
1080
1088
  className: orderlyUi.cn(
1081
1089
  "oui-min-w-0 oui-shrink-0 oui-grow-0 oui-basis-full",
1082
- orientation === "horizontal" ? "oui-pl-4" : "oui-pt-4",
1090
+ orientation === "horizontal" ? "oui-ps-4" : "oui-pt-4",
1083
1091
  className
1084
1092
  ),
1085
1093
  ...props,
@@ -1103,7 +1111,7 @@ var CarouselPrevious = React__default.default.forwardRef((originalProps, ref) =>
1103
1111
  variant,
1104
1112
  className: orderlyUi.cn(
1105
1113
  "oui-absolute oui-size-8 oui-rounded-full",
1106
- orientation === "horizontal" ? "oui--left-12 oui-top-1/2 oui--translate-y-1/2" : "oui--top-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",
1114
+ orientation === "horizontal" ? "oui--start-12 oui-top-1/2 oui--translate-y-1/2" : "oui--top-12 oui-start-1/2 oui--translate-x-1/2 oui-rotate-90",
1107
1115
  className
1108
1116
  ),
1109
1117
  disabled: !canScrollPrev,
@@ -1132,7 +1140,7 @@ var CarouselNext = React__default.default.forwardRef((originalProps, ref) => {
1132
1140
  variant,
1133
1141
  className: orderlyUi.cn(
1134
1142
  "oui-absolute oui-size-8 oui-rounded-full",
1135
- orientation === "horizontal" ? "oui--right-12 oui-top-1/2 oui--translate-y-1/2" : "oui--bottom-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",
1143
+ orientation === "horizontal" ? "oui--end-12 oui-top-1/2 oui--translate-y-1/2" : "oui--bottom-12 oui-start-1/2 oui--translate-x-1/2 oui-rotate-90",
1136
1144
  className
1137
1145
  ),
1138
1146
  disabled: !canScrollNext,
@@ -1203,6 +1211,7 @@ var MobileSharePnLContent = (props) => {
1203
1211
  backgroundImages: []
1204
1212
  };
1205
1213
  const [domain, setDomain] = React.useState("");
1214
+ const direction = "ltr";
1206
1215
  const posterRefs = shareOptions?.backgroundImages?.map(
1207
1216
  () => React.useRef(null)
1208
1217
  );
@@ -1289,6 +1298,7 @@ var MobileSharePnLContent = (props) => {
1289
1298
  height: 310,
1290
1299
  data: {
1291
1300
  backgroundImg: item,
1301
+ direction,
1292
1302
  ...resetOptions,
1293
1303
  data: posterData
1294
1304
  },
@@ -1356,7 +1366,7 @@ var MobileSharePnLContent = (props) => {
1356
1366
  suffix: focus && /* @__PURE__ */ jsxRuntime.jsx(
1357
1367
  "button",
1358
1368
  {
1359
- className: "oui-mr-3 oui-cursor-pointer",
1369
+ className: "oui-me-3 oui-cursor-pointer",
1360
1370
  onMouseDown: (e) => {
1361
1371
  setMessage("");
1362
1372
  setTimeout(() => {
@@ -1399,7 +1409,7 @@ var PnlFormatView2 = (props) => {
1399
1409
  case "pnl":
1400
1410
  return t("share.pnl.displayFormat.pnl");
1401
1411
  }
1402
- }, [type]);
1412
+ }, [t, type]);
1403
1413
  const isSelected = type === curType;
1404
1414
  return /* @__PURE__ */ jsxRuntime.jsx(
1405
1415
  "div",
@@ -1577,6 +1587,8 @@ var SharePnLDialogWidget = (props) => {
1577
1587
  });
1578
1588
  return /* @__PURE__ */ jsxRuntime.jsx(DesktopSharePnL, { ...state });
1579
1589
  };
1590
+
1591
+ // src/index.ts
1580
1592
  var SharePnLDialogId = "sharePnLDialog";
1581
1593
  var SharePnLBottomSheetId = "sharePnLBottomSheet";
1582
1594
  orderlyUi.registerSimpleDialog(SharePnLDialogId, SharePnLDialogWidget, {
@@ -1585,7 +1597,7 @@ orderlyUi.registerSimpleDialog(SharePnLDialogId, SharePnLDialogWidget, {
1585
1597
  }
1586
1598
  });
1587
1599
  orderlyUi.registerSimpleSheet(SharePnLBottomSheetId, SharePnLBottomSheetWidget, {
1588
- title: orderlyI18n.i18n.t("share.pnl.sharePnl"),
1600
+ title: () => orderlyI18n.i18n.t("share.pnl.sharePnl"),
1589
1601
  classNames: {
1590
1602
  body: "oui-pb-4 oui-pt-0"
1591
1603
  }