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