@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 +27 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -15
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { i18n, useTranslation } from '@kodiak-finance/orderly-i18n';
|
|
1
2
|
import { useEmblaCarousel, cn, Button, ChevronLeftIcon, ChevronRightIcon, registerSimpleDialog, registerSimpleSheet, Box, Flex, Text, Divider, ScrollArea, Input, CloseCircleFillIcon, toast } from '@kodiak-finance/orderly-ui';
|
|
2
3
|
import React, { forwardRef, useImperativeHandle, useMemo, useState, useRef, useEffect, useCallback } from 'react';
|
|
3
4
|
import { usePoster, useSymbolsInfo, useReferralInfo } from '@kodiak-finance/orderly-hooks';
|
|
4
|
-
import { i18n, useTranslation } from '@kodiak-finance/orderly-i18n';
|
|
5
5
|
import { EMPTY_LIST } from '@kodiak-finance/orderly-types';
|
|
6
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
7
|
import { formatNum, Decimal } from '@kodiak-finance/orderly-utils';
|
|
@@ -57,6 +57,7 @@ var Poster = forwardRef((props, parentRef) => {
|
|
|
57
57
|
ref,
|
|
58
58
|
width,
|
|
59
59
|
height,
|
|
60
|
+
dir: "ltr",
|
|
60
61
|
className,
|
|
61
62
|
style
|
|
62
63
|
}
|
|
@@ -422,11 +423,17 @@ var NextButton = (props) => {
|
|
|
422
423
|
};
|
|
423
424
|
var CarouselBackgroundImage = (props) => {
|
|
424
425
|
const { backgroundImages, selectedSnap, setSelectedSnap } = props;
|
|
426
|
+
const [direction, setDirection] = useState("ltr");
|
|
425
427
|
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
426
428
|
// loop: true,
|
|
427
429
|
containScroll: "keepSnaps",
|
|
428
|
-
dragFree: true
|
|
430
|
+
dragFree: true,
|
|
431
|
+
direction
|
|
429
432
|
});
|
|
433
|
+
useEffect(() => {
|
|
434
|
+
const docDir = document?.documentElement?.dir?.toLowerCase();
|
|
435
|
+
setDirection(docDir === "rtl" ? "rtl" : "ltr");
|
|
436
|
+
}, []);
|
|
430
437
|
const onPrevButtonClick = useCallback(() => {
|
|
431
438
|
if (!emblaApi) {
|
|
432
439
|
return;
|
|
@@ -464,7 +471,7 @@ var CarouselBackgroundImage = (props) => {
|
|
|
464
471
|
};
|
|
465
472
|
}, [emblaApi, onSelect]);
|
|
466
473
|
return /* @__PURE__ */ jsxs(Flex, { mt: 4, px: 2, children: [
|
|
467
|
-
/* @__PURE__ */ jsx(PrevButton, { onClick: onPrevButtonClick }),
|
|
474
|
+
direction === "rtl" ? /* @__PURE__ */ jsx(NextButton, { onClick: onNextButtonClick }) : /* @__PURE__ */ jsx(PrevButton, { onClick: onPrevButtonClick }),
|
|
468
475
|
/* @__PURE__ */ jsx(
|
|
469
476
|
"div",
|
|
470
477
|
{
|
|
@@ -482,10 +489,9 @@ var CarouselBackgroundImage = (props) => {
|
|
|
482
489
|
},
|
|
483
490
|
mx: 2,
|
|
484
491
|
my: 1,
|
|
485
|
-
mr: 6,
|
|
486
492
|
r: "base",
|
|
487
493
|
className: cn(
|
|
488
|
-
"oui-shrink-0 oui-w-[162px]",
|
|
494
|
+
"oui-shrink-0 oui-w-[162px] oui-me-6",
|
|
489
495
|
selectedSnap === index && "oui-outline oui-outline-1 oui-outline-primary-darken"
|
|
490
496
|
),
|
|
491
497
|
children: /* @__PURE__ */ jsx("img", { src: e, className: "oui-rounded-sm" })
|
|
@@ -494,7 +500,7 @@ var CarouselBackgroundImage = (props) => {
|
|
|
494
500
|
)) })
|
|
495
501
|
}
|
|
496
502
|
),
|
|
497
|
-
/* @__PURE__ */ jsx(NextButton, { onClick: onNextButtonClick })
|
|
503
|
+
direction === "rtl" ? /* @__PURE__ */ jsx(PrevButton, { onClick: onPrevButtonClick }) : /* @__PURE__ */ jsx(NextButton, { onClick: onNextButtonClick })
|
|
498
504
|
] });
|
|
499
505
|
};
|
|
500
506
|
var Checkbox = (props) => {
|
|
@@ -566,7 +572,7 @@ var Message = (props) => {
|
|
|
566
572
|
/* @__PURE__ */ jsx(
|
|
567
573
|
"div",
|
|
568
574
|
{
|
|
569
|
-
className: "oui-text-xs oui-text-base-contrast-54 oui-
|
|
575
|
+
className: "oui-text-xs oui-text-base-contrast-54 oui-ms-1 hover:oui-cursor-pointer",
|
|
570
576
|
onClick: () => {
|
|
571
577
|
setCheck(!props.check);
|
|
572
578
|
},
|
|
@@ -587,7 +593,7 @@ var Message = (props) => {
|
|
|
587
593
|
suffix: focus && /* @__PURE__ */ jsx(
|
|
588
594
|
"button",
|
|
589
595
|
{
|
|
590
|
-
className: "oui-
|
|
596
|
+
className: "oui-me-3 oui-cursor-pointer",
|
|
591
597
|
onMouseDown: (e) => {
|
|
592
598
|
setMessage("");
|
|
593
599
|
setTimeout(() => {
|
|
@@ -711,7 +717,7 @@ var PnlFormatView = (props) => {
|
|
|
711
717
|
size: "xs",
|
|
712
718
|
intensity: 54,
|
|
713
719
|
className: cn(
|
|
714
|
-
"oui-
|
|
720
|
+
"oui-ms-2 "
|
|
715
721
|
// isSelected && "oui-text-base-contrast"
|
|
716
722
|
),
|
|
717
723
|
children: text
|
|
@@ -792,6 +798,7 @@ var DesktopSharePnLContent = (props) => {
|
|
|
792
798
|
backgroundImages: []
|
|
793
799
|
};
|
|
794
800
|
const [domain, setDomain] = useState("");
|
|
801
|
+
const direction = "ltr";
|
|
795
802
|
const posterRef = useRef(null);
|
|
796
803
|
useEffect(() => {
|
|
797
804
|
const currentDomain = window.location.hostname;
|
|
@@ -851,6 +858,7 @@ var DesktopSharePnLContent = (props) => {
|
|
|
851
858
|
height: 310,
|
|
852
859
|
data: {
|
|
853
860
|
backgroundImg: curBgImg,
|
|
861
|
+
direction,
|
|
854
862
|
...resetOptions,
|
|
855
863
|
data: posterData
|
|
856
864
|
},
|
|
@@ -1073,7 +1081,7 @@ var CarouselItem = React.forwardRef((originalProps, ref) => {
|
|
|
1073
1081
|
"aria-roledescription": "slide",
|
|
1074
1082
|
className: cn(
|
|
1075
1083
|
"oui-min-w-0 oui-shrink-0 oui-grow-0 oui-basis-full",
|
|
1076
|
-
orientation === "horizontal" ? "oui-
|
|
1084
|
+
orientation === "horizontal" ? "oui-ps-4" : "oui-pt-4",
|
|
1077
1085
|
className
|
|
1078
1086
|
),
|
|
1079
1087
|
...props,
|
|
@@ -1097,7 +1105,7 @@ var CarouselPrevious = React.forwardRef((originalProps, ref) => {
|
|
|
1097
1105
|
variant,
|
|
1098
1106
|
className: cn(
|
|
1099
1107
|
"oui-absolute oui-size-8 oui-rounded-full",
|
|
1100
|
-
orientation === "horizontal" ? "oui--
|
|
1108
|
+
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",
|
|
1101
1109
|
className
|
|
1102
1110
|
),
|
|
1103
1111
|
disabled: !canScrollPrev,
|
|
@@ -1126,7 +1134,7 @@ var CarouselNext = React.forwardRef((originalProps, ref) => {
|
|
|
1126
1134
|
variant,
|
|
1127
1135
|
className: cn(
|
|
1128
1136
|
"oui-absolute oui-size-8 oui-rounded-full",
|
|
1129
|
-
orientation === "horizontal" ? "oui--
|
|
1137
|
+
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",
|
|
1130
1138
|
className
|
|
1131
1139
|
),
|
|
1132
1140
|
disabled: !canScrollNext,
|
|
@@ -1197,6 +1205,7 @@ var MobileSharePnLContent = (props) => {
|
|
|
1197
1205
|
backgroundImages: []
|
|
1198
1206
|
};
|
|
1199
1207
|
const [domain, setDomain] = useState("");
|
|
1208
|
+
const direction = "ltr";
|
|
1200
1209
|
const posterRefs = shareOptions?.backgroundImages?.map(
|
|
1201
1210
|
() => useRef(null)
|
|
1202
1211
|
);
|
|
@@ -1283,6 +1292,7 @@ var MobileSharePnLContent = (props) => {
|
|
|
1283
1292
|
height: 310,
|
|
1284
1293
|
data: {
|
|
1285
1294
|
backgroundImg: item,
|
|
1295
|
+
direction,
|
|
1286
1296
|
...resetOptions,
|
|
1287
1297
|
data: posterData
|
|
1288
1298
|
},
|
|
@@ -1350,7 +1360,7 @@ var MobileSharePnLContent = (props) => {
|
|
|
1350
1360
|
suffix: focus && /* @__PURE__ */ jsx(
|
|
1351
1361
|
"button",
|
|
1352
1362
|
{
|
|
1353
|
-
className: "oui-
|
|
1363
|
+
className: "oui-me-3 oui-cursor-pointer",
|
|
1354
1364
|
onMouseDown: (e) => {
|
|
1355
1365
|
setMessage("");
|
|
1356
1366
|
setTimeout(() => {
|
|
@@ -1393,7 +1403,7 @@ var PnlFormatView2 = (props) => {
|
|
|
1393
1403
|
case "pnl":
|
|
1394
1404
|
return t("share.pnl.displayFormat.pnl");
|
|
1395
1405
|
}
|
|
1396
|
-
}, [type]);
|
|
1406
|
+
}, [t, type]);
|
|
1397
1407
|
const isSelected = type === curType;
|
|
1398
1408
|
return /* @__PURE__ */ jsx(
|
|
1399
1409
|
"div",
|
|
@@ -1571,6 +1581,8 @@ var SharePnLDialogWidget = (props) => {
|
|
|
1571
1581
|
});
|
|
1572
1582
|
return /* @__PURE__ */ jsx(DesktopSharePnL, { ...state });
|
|
1573
1583
|
};
|
|
1584
|
+
|
|
1585
|
+
// src/index.ts
|
|
1574
1586
|
var SharePnLDialogId = "sharePnLDialog";
|
|
1575
1587
|
var SharePnLBottomSheetId = "sharePnLBottomSheet";
|
|
1576
1588
|
registerSimpleDialog(SharePnLDialogId, SharePnLDialogWidget, {
|
|
@@ -1579,7 +1591,7 @@ registerSimpleDialog(SharePnLDialogId, SharePnLDialogWidget, {
|
|
|
1579
1591
|
}
|
|
1580
1592
|
});
|
|
1581
1593
|
registerSimpleSheet(SharePnLBottomSheetId, SharePnLBottomSheetWidget, {
|
|
1582
|
-
title: i18n.t("share.pnl.sharePnl"),
|
|
1594
|
+
title: () => i18n.t("share.pnl.sharePnl"),
|
|
1583
1595
|
classNames: {
|
|
1584
1596
|
body: "oui-pb-4 oui-pt-0"
|
|
1585
1597
|
}
|