@deriv-web-design/ui 0.1.40 → 0.1.41
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.css +25 -16
- package/dist/index.css.map +1 -1
- package/dist/index.js +182 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +136 -95
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5003,6 +5003,7 @@ var DayNightTransition = ({
|
|
|
5003
5003
|
const [nightMarginStart, setNightMarginStart] = (0, import_react20.useState)("0px");
|
|
5004
5004
|
const [nightMarginEnd, setNightMarginEnd] = (0, import_react20.useState)("0px");
|
|
5005
5005
|
const [ixMedia, setIxMedia] = (0, import_react20.useState)("desktop");
|
|
5006
|
+
const [isRtl, setIsRtl] = (0, import_react20.useState)(false);
|
|
5006
5007
|
const webflowV2 = scrollPreset === "webflow-day-night-v2";
|
|
5007
5008
|
(0, import_react20.useEffect)(() => {
|
|
5008
5009
|
const mq = window.matchMedia("(max-width: 991px)");
|
|
@@ -5011,6 +5012,21 @@ var DayNightTransition = ({
|
|
|
5011
5012
|
mq.addEventListener("change", sync);
|
|
5012
5013
|
return () => mq.removeEventListener("change", sync);
|
|
5013
5014
|
}, []);
|
|
5015
|
+
(0, import_react20.useEffect)(() => {
|
|
5016
|
+
const syncRtl = () => {
|
|
5017
|
+
const doc = document.documentElement;
|
|
5018
|
+
setIsRtl(
|
|
5019
|
+
doc.getAttribute("dir") === "rtl" || doc.lang.toLowerCase().startsWith("ar")
|
|
5020
|
+
);
|
|
5021
|
+
};
|
|
5022
|
+
syncRtl();
|
|
5023
|
+
const mo = new MutationObserver(syncRtl);
|
|
5024
|
+
mo.observe(document.documentElement, {
|
|
5025
|
+
attributes: true,
|
|
5026
|
+
attributeFilter: ["dir", "lang"]
|
|
5027
|
+
});
|
|
5028
|
+
return () => mo.disconnect();
|
|
5029
|
+
}, []);
|
|
5014
5030
|
const MotionHeadline = headlineLevel === "h1" ? import_framer_motion3.motion.h1 : import_framer_motion3.motion.h2;
|
|
5015
5031
|
(0, import_react20.useLayoutEffect)(() => {
|
|
5016
5032
|
if (!inlineDayNightHeadline) return;
|
|
@@ -5099,7 +5115,7 @@ var DayNightTransition = ({
|
|
|
5099
5115
|
const v2NightWordOp = (0, import_framer_motion3.useTransform)(progress, (t) => webflowV2NightWordOpacity(t, ixMedia));
|
|
5100
5116
|
const v2DayHeight = (0, import_framer_motion3.useTransform)(
|
|
5101
5117
|
progress,
|
|
5102
|
-
(t) => ixMedia === "mobile" ? `${webflowV2DayClipPercent(t,
|
|
5118
|
+
(t) => ixMedia === "mobile" || isRtl ? `${webflowV2DayClipPercent(t, "mobile")}%` : "100vh"
|
|
5103
5119
|
);
|
|
5104
5120
|
const hasDescription = Boolean(dayDescription || nightDescription);
|
|
5105
5121
|
const useInlineHeadline = Boolean(inlineDayNightHeadline);
|
|
@@ -5121,19 +5137,23 @@ var DayNightTransition = ({
|
|
|
5121
5137
|
import_framer_motion3.motion.div,
|
|
5122
5138
|
{
|
|
5123
5139
|
className: "dnt__v2-bg-day trade-day-night_background-day is-alternative",
|
|
5124
|
-
style: {
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5140
|
+
style: { height: v2DayHeight },
|
|
5141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5142
|
+
"div",
|
|
5143
|
+
{
|
|
5144
|
+
className: "dnt__v2-bg-media",
|
|
5145
|
+
style: { backgroundImage: `url(${dayImageUrl})` }
|
|
5146
|
+
}
|
|
5147
|
+
)
|
|
5128
5148
|
}
|
|
5129
5149
|
),
|
|
5130
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5150
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "dnt__v2-bg-night trade-day-night_background-night is-alternative", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5131
5151
|
"div",
|
|
5132
5152
|
{
|
|
5133
|
-
className: "dnt__v2-bg-
|
|
5153
|
+
className: "dnt__v2-bg-media",
|
|
5134
5154
|
style: { backgroundImage: `url(${nightImageUrl})` }
|
|
5135
5155
|
}
|
|
5136
|
-
)
|
|
5156
|
+
) })
|
|
5137
5157
|
] }),
|
|
5138
5158
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: webflowV2 ? "dnt__sticky dnt__sticky--webflow-v2" : "dnt__sticky", children: [
|
|
5139
5159
|
!webflowV2 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
@@ -7390,6 +7410,9 @@ var CoralBanner = ({
|
|
|
7390
7410
|
] }) }) });
|
|
7391
7411
|
};
|
|
7392
7412
|
|
|
7413
|
+
// templates/FeatureAwards/FeatureAwards.tsx
|
|
7414
|
+
var import_react29 = require("react");
|
|
7415
|
+
|
|
7393
7416
|
// assets/award-leaf-left.png
|
|
7394
7417
|
var award_leaf_left_default = "data:image/png;base64,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";
|
|
7395
7418
|
|
|
@@ -7431,9 +7454,12 @@ var LaurelIcon = ({ side }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
|
7431
7454
|
draggable: false
|
|
7432
7455
|
}
|
|
7433
7456
|
);
|
|
7434
|
-
var AwardBadge2 = ({
|
|
7457
|
+
var AwardBadge2 = ({
|
|
7458
|
+
award,
|
|
7459
|
+
textDir
|
|
7460
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__item", role: "listitem", dir: "ltr", children: [
|
|
7435
7461
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(LaurelIcon, { side: "left" }),
|
|
7436
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__item-text", children: [
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__item-text", dir: textDir, children: [
|
|
7437
7463
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "fa__item-title", children: award.title }),
|
|
7438
7464
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "fa__item-subtitle", children: award.subtitle })
|
|
7439
7465
|
] }),
|
|
@@ -7446,6 +7472,21 @@ var FeatureAwards = ({
|
|
|
7446
7472
|
className,
|
|
7447
7473
|
...props
|
|
7448
7474
|
}) => {
|
|
7475
|
+
const [textDir, setTextDir] = (0, import_react29.useState)("ltr");
|
|
7476
|
+
(0, import_react29.useEffect)(() => {
|
|
7477
|
+
const sync = () => {
|
|
7478
|
+
setTextDir(
|
|
7479
|
+
document.documentElement.getAttribute("dir") === "rtl" ? "rtl" : "ltr"
|
|
7480
|
+
);
|
|
7481
|
+
};
|
|
7482
|
+
sync();
|
|
7483
|
+
const mo = new MutationObserver(sync);
|
|
7484
|
+
mo.observe(document.documentElement, {
|
|
7485
|
+
attributes: true,
|
|
7486
|
+
attributeFilter: ["dir"]
|
|
7487
|
+
});
|
|
7488
|
+
return () => mo.disconnect();
|
|
7489
|
+
}, []);
|
|
7449
7490
|
if (!awards || awards.length === 0) return null;
|
|
7450
7491
|
const trackStyle = {
|
|
7451
7492
|
"--fa-duration": `${autoScrollDuration}s`
|
|
@@ -7457,16 +7498,16 @@ var FeatureAwards = ({
|
|
|
7457
7498
|
...props,
|
|
7458
7499
|
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__inner", children: [
|
|
7459
7500
|
title && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h2", { className: "fa__title", children: title }),
|
|
7460
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__grid", role: "list", children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award }, `g-${i}`)) }),
|
|
7501
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__grid", role: "list", children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award, textDir }, `g-${i}`)) }),
|
|
7461
7502
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__scroller", dir: "ltr", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "fa__track fa__track--auto", style: trackStyle, children: [
|
|
7462
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__track-group", role: "list", children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award }, `m-${i}`)) }),
|
|
7503
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "fa__track-group", role: "list", children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award, textDir }, `m-${i}`)) }),
|
|
7463
7504
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
7464
7505
|
"div",
|
|
7465
7506
|
{
|
|
7466
7507
|
className: "fa__track-group",
|
|
7467
7508
|
role: "presentation",
|
|
7468
7509
|
"aria-hidden": "true",
|
|
7469
|
-
children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award }, `m-dup-${i}`))
|
|
7510
|
+
children: awards.map((award, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AwardBadge2, { award, textDir }, `m-dup-${i}`))
|
|
7470
7511
|
}
|
|
7471
7512
|
)
|
|
7472
7513
|
] }) })
|
|
@@ -7553,7 +7594,7 @@ var FeatureBlog = ({
|
|
|
7553
7594
|
};
|
|
7554
7595
|
|
|
7555
7596
|
// templates/FeatureBlogCategories/FeatureBlogCategories.tsx
|
|
7556
|
-
var
|
|
7597
|
+
var import_react30 = require("react");
|
|
7557
7598
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
7558
7599
|
var isExternalUrl = (href) => Boolean(href && /^https?:\/\//i.test(href));
|
|
7559
7600
|
var FEATURE_BLOG_CATEGORIES_TEXT_CONTENT = {
|
|
@@ -7617,20 +7658,20 @@ var FeatureBlogCategories = ({
|
|
|
7617
7658
|
className,
|
|
7618
7659
|
...props
|
|
7619
7660
|
}) => {
|
|
7620
|
-
const [search, setSearch] = (0,
|
|
7621
|
-
const [internalActiveId, setInternalActiveId] = (0,
|
|
7661
|
+
const [search, setSearch] = (0, import_react30.useState)("");
|
|
7662
|
+
const [internalActiveId, setInternalActiveId] = (0, import_react30.useState)(defaultActiveCategoryId ?? allCategoryId);
|
|
7622
7663
|
const isControlled = activeCategoryId !== void 0;
|
|
7623
7664
|
const activeId = isControlled ? activeCategoryId : internalActiveId;
|
|
7624
|
-
const tabs = (0,
|
|
7665
|
+
const tabs = (0, import_react30.useMemo)(
|
|
7625
7666
|
() => [{ id: allCategoryId, label: allCategoryLabel }, ...categories],
|
|
7626
7667
|
[allCategoryId, allCategoryLabel, categories]
|
|
7627
7668
|
);
|
|
7628
|
-
const categoryLabelById = (0,
|
|
7669
|
+
const categoryLabelById = (0, import_react30.useMemo)(() => {
|
|
7629
7670
|
const map = /* @__PURE__ */ new Map();
|
|
7630
7671
|
categories.forEach((category) => map.set(category.id, category.label));
|
|
7631
7672
|
return map;
|
|
7632
7673
|
}, [categories]);
|
|
7633
|
-
const filteredPosts = (0,
|
|
7674
|
+
const filteredPosts = (0, import_react30.useMemo)(() => {
|
|
7634
7675
|
const query = search.trim().toLowerCase();
|
|
7635
7676
|
return posts.filter((post) => {
|
|
7636
7677
|
const matchesCategory = activeId === allCategoryId || post.category === activeId;
|
|
@@ -7726,7 +7767,7 @@ var HelpCentreCategories = ({
|
|
|
7726
7767
|
};
|
|
7727
7768
|
|
|
7728
7769
|
// templates/HelpCentreSubCategories/HelpCentreSubCategories.tsx
|
|
7729
|
-
var
|
|
7770
|
+
var import_react31 = require("react");
|
|
7730
7771
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
7731
7772
|
var externalLinkRel4 = (href) => href && /^https?:\/\//i.test(href) ? "noopener noreferrer" : void 0;
|
|
7732
7773
|
var QuestionCard = ({ item }) => {
|
|
@@ -7743,8 +7784,8 @@ var HelpCentreSubCategories = ({
|
|
|
7743
7784
|
noResultsText = 'No results found for "{query}"',
|
|
7744
7785
|
onSearchChange
|
|
7745
7786
|
}) => {
|
|
7746
|
-
const [search, setSearch] = (0,
|
|
7747
|
-
const filtered = (0,
|
|
7787
|
+
const [search, setSearch] = (0, import_react31.useState)("");
|
|
7788
|
+
const filtered = (0, import_react31.useMemo)(() => {
|
|
7748
7789
|
const q = search.trim().toLowerCase();
|
|
7749
7790
|
if (!q) return items;
|
|
7750
7791
|
return items.filter((item) => item.question.toLowerCase().includes(q));
|
|
@@ -7775,7 +7816,7 @@ var HelpCentreSubCategories = ({
|
|
|
7775
7816
|
};
|
|
7776
7817
|
|
|
7777
7818
|
// templates/HelpCenterPage/HelpCenterPage.tsx
|
|
7778
|
-
var
|
|
7819
|
+
var import_react32 = require("react");
|
|
7779
7820
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7780
7821
|
var externalLinkRel5 = (href) => href && /^https?:\/\//i.test(href) ? "noopener noreferrer" : void 0;
|
|
7781
7822
|
var ChevronDownIcon5 = () => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("svg", { "aria-hidden": "true", fill: "none", height: "16", viewBox: "0 0 16 16", width: "16", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) });
|
|
@@ -7841,13 +7882,13 @@ var HelpCenterPage = ({
|
|
|
7841
7882
|
articlesSheetTitle = "Articles in this section",
|
|
7842
7883
|
className
|
|
7843
7884
|
}) => {
|
|
7844
|
-
const [search, setSearch] = (0,
|
|
7845
|
-
const [internalActiveId, setInternalActiveId] = (0,
|
|
7846
|
-
const [sheetOpen, setSheetOpen] = (0,
|
|
7885
|
+
const [search, setSearch] = (0, import_react32.useState)("");
|
|
7886
|
+
const [internalActiveId, setInternalActiveId] = (0, import_react32.useState)(defaultActiveQuestionId ?? questions[0]?.id);
|
|
7887
|
+
const [sheetOpen, setSheetOpen] = (0, import_react32.useState)(false);
|
|
7847
7888
|
const isControlled = activeQuestionId !== void 0;
|
|
7848
7889
|
const activeId = isControlled ? activeQuestionId : internalActiveId;
|
|
7849
7890
|
const activeItem = questions.find((item) => item.id === activeId);
|
|
7850
|
-
const filtered = (0,
|
|
7891
|
+
const filtered = (0, import_react32.useMemo)(() => {
|
|
7851
7892
|
const q = search.trim().toLowerCase();
|
|
7852
7893
|
if (!q) return questions;
|
|
7853
7894
|
return questions.filter((item) => item.question.toLowerCase().includes(q));
|
|
@@ -7910,7 +7951,7 @@ var HelpCenterPage = ({
|
|
|
7910
7951
|
};
|
|
7911
7952
|
|
|
7912
7953
|
// templates/FeatureBlogPage/FeatureBlogPage.tsx
|
|
7913
|
-
var
|
|
7954
|
+
var import_react33 = require("react");
|
|
7914
7955
|
|
|
7915
7956
|
// assets/share-link.png
|
|
7916
7957
|
var share_link_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABYklEQVR4AezVgU3DMBAFUMRAzMEQzMEQzMEQzMFE+FX5kuNGF4cgIVWp8us73/n/76vaPj/98+sycE3gmsBDTuCl/bQELayfv5zAW5P6avgYwEzb2n7OGBiJGYjK9xLoYWhJ75ffGCCUm2bF/N7e4HVZxS28Pc7cgvHtiAG3ITiSZd+tIRrizyXRs4TrZdYAgowyxG4IcqyjMXupOS+/w4wBh3txoojsqUVky0D20uPcCnsGCBByCEnEe2JjVtOj3wpiEKcuXmHPwJZ4SBEhloM8kPdnmUxttVYGeoLcfHV4SJiBUbw8WxkI/+ieSGo+CoL29IkPGa8MIIvQuBKz1xvQf0gcQWXArfQgtvZgoK8zAnrUyrFrCmYMIAZnmBEDEWAECAd6p1AZ6MkI+hU0YjEQIMwE9P1qU6gMIAgpITlkT3waewYIEHRDfzIgB7XTmDFwWqQiuAxcE3j8CVTfALUfAAAA//85/ClxAAAABklEQVQDABFpTkF24Li2AAAAAElFTkSuQmCC";
|
|
@@ -7967,7 +8008,7 @@ var TocCard = ({
|
|
|
7967
8008
|
idSuffix,
|
|
7968
8009
|
collapsible
|
|
7969
8010
|
}) => {
|
|
7970
|
-
const [open, setOpen] = (0,
|
|
8011
|
+
const [open, setOpen] = (0, import_react33.useState)(defaultOpen);
|
|
7971
8012
|
const panelId = `fbp-toc-panel-${idSuffix}`;
|
|
7972
8013
|
const isOpen = collapsible ? open : true;
|
|
7973
8014
|
const list = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ol", { className: "fbp-tocList", id: panelId, children: headings.map((heading) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("li", { className: "fbp-tocItem", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
@@ -8009,7 +8050,7 @@ var ShareRow = ({
|
|
|
8009
8050
|
onShare,
|
|
8010
8051
|
copiedLabel
|
|
8011
8052
|
}) => {
|
|
8012
|
-
const [copied, setCopied] = (0,
|
|
8053
|
+
const [copied, setCopied] = (0, import_react33.useState)(false);
|
|
8013
8054
|
const handleCopy = async () => {
|
|
8014
8055
|
onShare?.("copy");
|
|
8015
8056
|
try {
|
|
@@ -8101,7 +8142,7 @@ var FeatureBlogPage = ({
|
|
|
8101
8142
|
copiedLabel = "Copied!",
|
|
8102
8143
|
className
|
|
8103
8144
|
}) => {
|
|
8104
|
-
const headingIds = (0,
|
|
8145
|
+
const headingIds = (0, import_react33.useMemo)(() => {
|
|
8105
8146
|
const seen = /* @__PURE__ */ new Map();
|
|
8106
8147
|
const ids = /* @__PURE__ */ new Map();
|
|
8107
8148
|
content.forEach((block, i) => {
|
|
@@ -8113,14 +8154,14 @@ var FeatureBlogPage = ({
|
|
|
8113
8154
|
});
|
|
8114
8155
|
return ids;
|
|
8115
8156
|
}, [content]);
|
|
8116
|
-
const headings = (0,
|
|
8157
|
+
const headings = (0, import_react33.useMemo)(
|
|
8117
8158
|
() => content.map((block, i) => ({ block, i })).filter(
|
|
8118
8159
|
({ block }) => block.type === "steps" || block.type === "heading" && (block.level ?? 2) === 2
|
|
8119
8160
|
).map(({ block, i }) => ({ id: headingIds.get(i), text: block.text ?? "" })),
|
|
8120
8161
|
[content, headingIds]
|
|
8121
8162
|
);
|
|
8122
|
-
const [activeId, setActiveId] = (0,
|
|
8123
|
-
(0,
|
|
8163
|
+
const [activeId, setActiveId] = (0, import_react33.useState)(null);
|
|
8164
|
+
(0, import_react33.useEffect)(() => {
|
|
8124
8165
|
if (typeof IntersectionObserver === "undefined" || headings.length === 0) return;
|
|
8125
8166
|
const elements = headings.map((heading) => document.getElementById(heading.id)).filter((el) => el !== null);
|
|
8126
8167
|
if (elements.length === 0) return;
|
|
@@ -8225,7 +8266,7 @@ var FeatureBlogPage = ({
|
|
|
8225
8266
|
};
|
|
8226
8267
|
|
|
8227
8268
|
// templates/ParallaxBanner/ParallaxBanner.tsx
|
|
8228
|
-
var
|
|
8269
|
+
var import_react34 = require("react");
|
|
8229
8270
|
var import_framer_motion5 = require("framer-motion");
|
|
8230
8271
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
8231
8272
|
var PARALLAX_BANNER_TEXT_CONTENT = {
|
|
@@ -8268,7 +8309,7 @@ var ParallaxBanner = ({
|
|
|
8268
8309
|
className,
|
|
8269
8310
|
...props
|
|
8270
8311
|
}) => {
|
|
8271
|
-
const sectionRef = (0,
|
|
8312
|
+
const sectionRef = (0, import_react34.useRef)(null);
|
|
8272
8313
|
const prefersReducedMotion = (0, import_framer_motion5.useReducedMotion)();
|
|
8273
8314
|
const parallaxActive = enableParallax && !prefersReducedMotion;
|
|
8274
8315
|
const showCards = variant !== "banner-only" && cards.length > 0;
|
|
@@ -8334,7 +8375,7 @@ var ParallaxBanner = ({
|
|
|
8334
8375
|
};
|
|
8335
8376
|
|
|
8336
8377
|
// templates/TradingCalculator/TradingCalculator.tsx
|
|
8337
|
-
var
|
|
8378
|
+
var import_react35 = require("react");
|
|
8338
8379
|
|
|
8339
8380
|
// templates/TradingCalculator/TradingCalculator.types.ts
|
|
8340
8381
|
var DEFAULT_TRADING_CALCULATOR_LABELS = {
|
|
@@ -8419,13 +8460,13 @@ function computeResults(symbol, volumeInLots, assetPrice, rates) {
|
|
|
8419
8460
|
return { marginRequired, tradeVolume, pipValue, swapChargeLong, swapChargeShort };
|
|
8420
8461
|
}
|
|
8421
8462
|
function useExchangeRates(wsUrl) {
|
|
8422
|
-
const socketRef = (0,
|
|
8423
|
-
const reqIdRef = (0,
|
|
8424
|
-
const pendingRef = (0,
|
|
8463
|
+
const socketRef = (0, import_react35.useRef)(null);
|
|
8464
|
+
const reqIdRef = (0, import_react35.useRef)(1);
|
|
8465
|
+
const pendingRef = (0, import_react35.useRef)(
|
|
8425
8466
|
/* @__PURE__ */ new Map()
|
|
8426
8467
|
);
|
|
8427
|
-
const cacheRef = (0,
|
|
8428
|
-
(0,
|
|
8468
|
+
const cacheRef = (0, import_react35.useRef)(/* @__PURE__ */ new Map());
|
|
8469
|
+
(0, import_react35.useEffect)(() => {
|
|
8429
8470
|
const pending = pendingRef.current;
|
|
8430
8471
|
return () => {
|
|
8431
8472
|
socketRef.current?.close();
|
|
@@ -8434,7 +8475,7 @@ function useExchangeRates(wsUrl) {
|
|
|
8434
8475
|
pending.clear();
|
|
8435
8476
|
};
|
|
8436
8477
|
}, [wsUrl]);
|
|
8437
|
-
const getRates = (0,
|
|
8478
|
+
const getRates = (0, import_react35.useCallback)(
|
|
8438
8479
|
(baseCurrency) => {
|
|
8439
8480
|
if (!wsUrl) return Promise.reject(new Error("Live exchange rate conversion is disabled"));
|
|
8440
8481
|
const cached = cacheRef.current.get(baseCurrency);
|
|
@@ -8496,11 +8537,11 @@ function useExchangeRates(wsUrl) {
|
|
|
8496
8537
|
return getRates;
|
|
8497
8538
|
}
|
|
8498
8539
|
function useSymbols(symbolsProp, endpoint) {
|
|
8499
|
-
const [state, setState] = (0,
|
|
8540
|
+
const [state, setState] = (0, import_react35.useState)(
|
|
8500
8541
|
symbolsProp ? { status: "ready", data: symbolsProp } : { status: "loading" }
|
|
8501
8542
|
);
|
|
8502
|
-
const [retryToken, setRetryToken] = (0,
|
|
8503
|
-
(0,
|
|
8543
|
+
const [retryToken, setRetryToken] = (0, import_react35.useState)(0);
|
|
8544
|
+
(0, import_react35.useEffect)(() => {
|
|
8504
8545
|
if (symbolsProp) {
|
|
8505
8546
|
setState({ status: "ready", data: symbolsProp });
|
|
8506
8547
|
return;
|
|
@@ -8522,7 +8563,7 @@ function useSymbols(symbolsProp, endpoint) {
|
|
|
8522
8563
|
cancelled = true;
|
|
8523
8564
|
};
|
|
8524
8565
|
}, [symbolsProp, endpoint, retryToken]);
|
|
8525
|
-
const retry = (0,
|
|
8566
|
+
const retry = (0, import_react35.useCallback)(() => setRetryToken((n) => n + 1), []);
|
|
8526
8567
|
return [state, retry];
|
|
8527
8568
|
}
|
|
8528
8569
|
var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
@@ -8552,24 +8593,24 @@ var SymbolCombobox = ({
|
|
|
8552
8593
|
inputId,
|
|
8553
8594
|
copy
|
|
8554
8595
|
}) => {
|
|
8555
|
-
const [query, setQuery] = (0,
|
|
8556
|
-
const [isOpen, setIsOpen] = (0,
|
|
8557
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
8558
|
-
const wrapperRef = (0,
|
|
8559
|
-
const listboxId = (0,
|
|
8596
|
+
const [query, setQuery] = (0, import_react35.useState)("");
|
|
8597
|
+
const [isOpen, setIsOpen] = (0, import_react35.useState)(false);
|
|
8598
|
+
const [activeIndex, setActiveIndex] = (0, import_react35.useState)(-1);
|
|
8599
|
+
const wrapperRef = (0, import_react35.useRef)(null);
|
|
8600
|
+
const listboxId = (0, import_react35.useId)();
|
|
8560
8601
|
const isLoading = symbolsState.status === "loading";
|
|
8561
8602
|
const isError = symbolsState.status === "error";
|
|
8562
8603
|
const allSymbols = symbolsState.status === "ready" ? symbolsState.data : [];
|
|
8563
|
-
const filtered = (0,
|
|
8604
|
+
const filtered = (0, import_react35.useMemo)(() => {
|
|
8564
8605
|
const term = query.trim().toLowerCase();
|
|
8565
8606
|
if (!term) return allSymbols;
|
|
8566
8607
|
return allSymbols.filter(
|
|
8567
8608
|
(item) => item.symbol.toLowerCase().includes(term) || item.description.toLowerCase().includes(term) || item.asset_class.toLowerCase().includes(term)
|
|
8568
8609
|
);
|
|
8569
8610
|
}, [allSymbols, query]);
|
|
8570
|
-
const grouped = (0,
|
|
8571
|
-
const flatOptions = (0,
|
|
8572
|
-
(0,
|
|
8611
|
+
const grouped = (0, import_react35.useMemo)(() => groupByAssetClass(filtered), [filtered]);
|
|
8612
|
+
const flatOptions = (0, import_react35.useMemo)(() => grouped.flatMap(([, items]) => items), [grouped]);
|
|
8613
|
+
(0, import_react35.useEffect)(() => {
|
|
8573
8614
|
if (!isOpen) return;
|
|
8574
8615
|
const handlePointerDown = (event) => {
|
|
8575
8616
|
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
@@ -8711,15 +8752,15 @@ var TradingCalculator = ({
|
|
|
8711
8752
|
const showTradeVolume = variant === "main";
|
|
8712
8753
|
const [symbolsState, retrySymbols] = useSymbols(symbolsProp, symbolsEndpoint);
|
|
8713
8754
|
const getRates = useExchangeRates(exchangeRateWsUrl);
|
|
8714
|
-
const [selectedSymbol, setSelectedSymbol] = (0,
|
|
8715
|
-
const [volumeInLots, setVolumeInLots] = (0,
|
|
8716
|
-
const [assetPrice, setAssetPrice] = (0,
|
|
8717
|
-
const [errors, setErrors] = (0,
|
|
8718
|
-
const [results, setResults] = (0,
|
|
8719
|
-
const [isCalculating, setIsCalculating] = (0,
|
|
8720
|
-
const [calcError, setCalcError] = (0,
|
|
8721
|
-
const didPreselect = (0,
|
|
8722
|
-
(0,
|
|
8755
|
+
const [selectedSymbol, setSelectedSymbol] = (0, import_react35.useState)(null);
|
|
8756
|
+
const [volumeInLots, setVolumeInLots] = (0, import_react35.useState)("");
|
|
8757
|
+
const [assetPrice, setAssetPrice] = (0, import_react35.useState)("");
|
|
8758
|
+
const [errors, setErrors] = (0, import_react35.useState)({});
|
|
8759
|
+
const [results, setResults] = (0, import_react35.useState)(null);
|
|
8760
|
+
const [isCalculating, setIsCalculating] = (0, import_react35.useState)(false);
|
|
8761
|
+
const [calcError, setCalcError] = (0, import_react35.useState)(null);
|
|
8762
|
+
const didPreselect = (0, import_react35.useRef)(false);
|
|
8763
|
+
(0, import_react35.useEffect)(() => {
|
|
8723
8764
|
if (didPreselect.current || !defaultSymbol || symbolsState.status !== "ready") return;
|
|
8724
8765
|
const match = symbolsState.data.find((item) => item.symbol === defaultSymbol);
|
|
8725
8766
|
if (match) {
|
|
@@ -8776,9 +8817,9 @@ var TradingCalculator = ({
|
|
|
8776
8817
|
setIsCalculating(false);
|
|
8777
8818
|
}
|
|
8778
8819
|
};
|
|
8779
|
-
const symbolInputId = (0,
|
|
8780
|
-
const volumeInputId = (0,
|
|
8781
|
-
const priceInputId = (0,
|
|
8820
|
+
const symbolInputId = (0, import_react35.useId)();
|
|
8821
|
+
const volumeInputId = (0, import_react35.useId)();
|
|
8822
|
+
const priceInputId = (0, import_react35.useId)();
|
|
8782
8823
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("section", { className: ["tcalc-section", className ?? ""].filter(Boolean).join(" "), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "tcalc-container", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "tcalc-card", children: [
|
|
8783
8824
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "tcalc-column", children: [
|
|
8784
8825
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h3", { className: "tcalc-panelTitle", children: copy.calculatorPanel }),
|
|
@@ -8929,7 +8970,7 @@ var TradingCalculator = ({
|
|
|
8929
8970
|
};
|
|
8930
8971
|
|
|
8931
8972
|
// templates/TradingCalculatorHowTo/TradingCalculatorHowTo.tsx
|
|
8932
|
-
var
|
|
8973
|
+
var import_react36 = require("react");
|
|
8933
8974
|
|
|
8934
8975
|
// templates/TradingCalculatorHowTo/TradingCalculatorHowTo.types.ts
|
|
8935
8976
|
var DEFAULT_TRADING_CALCULATOR_HOWTO_LABELS = {
|
|
@@ -9130,7 +9171,7 @@ function swapTabsForLabels(labels) {
|
|
|
9130
9171
|
{ id: "percentage", label: percentage }
|
|
9131
9172
|
];
|
|
9132
9173
|
}
|
|
9133
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
9174
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react36.useLayoutEffect : import_react36.useEffect;
|
|
9134
9175
|
var FormulaBlockView = ({ block }) => {
|
|
9135
9176
|
if (block.type === "footnote") {
|
|
9136
9177
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "tchow-footnote", children: block.content });
|
|
@@ -9152,9 +9193,9 @@ var ConnectorArrow = () => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("svg",
|
|
|
9152
9193
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("path", { d: "M1.4 5.6L4 8.6L6.6 5.6", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
9153
9194
|
] });
|
|
9154
9195
|
var CalculationStrip = ({ tokens }) => {
|
|
9155
|
-
const wrapperRef = (0,
|
|
9156
|
-
const stripRef = (0,
|
|
9157
|
-
const [fit, setFit] = (0,
|
|
9196
|
+
const wrapperRef = (0, import_react36.useRef)(null);
|
|
9197
|
+
const stripRef = (0, import_react36.useRef)(null);
|
|
9198
|
+
const [fit, setFit] = (0, import_react36.useState)({ scale: 1, naturalHeight: 0 });
|
|
9158
9199
|
useIsomorphicLayoutEffect(() => {
|
|
9159
9200
|
const wrapper = wrapperRef.current;
|
|
9160
9201
|
const strip = stripRef.current;
|
|
@@ -9191,7 +9232,7 @@ var CalculationStrip = ({ tokens }) => {
|
|
|
9191
9232
|
style: isShrunk ? { transform: `scale(${fit.scale})` } : void 0,
|
|
9192
9233
|
role: "img",
|
|
9193
9234
|
"aria-label": tokens.map((token) => token.text).join(" "),
|
|
9194
|
-
children: tokens.map((token, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
9235
|
+
children: tokens.map((token, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react36.Fragment, { children: [
|
|
9195
9236
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
9196
9237
|
"span",
|
|
9197
9238
|
{
|
|
@@ -9238,8 +9279,8 @@ var TradingCalculatorHowTo = ({
|
|
|
9238
9279
|
...props
|
|
9239
9280
|
}) => {
|
|
9240
9281
|
const isSwap = variant === "swap-points" || variant === "swap-percentage";
|
|
9241
|
-
const [swapTab, setSwapTab] = (0,
|
|
9242
|
-
(0,
|
|
9282
|
+
const [swapTab, setSwapTab] = (0, import_react36.useState)(() => swapModeForVariant(variant));
|
|
9283
|
+
(0, import_react36.useEffect)(() => {
|
|
9243
9284
|
setSwapTab(swapModeForVariant(variant));
|
|
9244
9285
|
}, [variant]);
|
|
9245
9286
|
const baseContent = variant === "pip" ? PIP_CONTENT : isSwap ? swapTab === "percentage" ? SWAP_PERCENTAGE_CONTENT : SWAP_POINTS_CONTENT : MARGIN_CONTENT;
|
|
@@ -9282,7 +9323,7 @@ var TradingCalculatorHowTo = ({
|
|
|
9282
9323
|
};
|
|
9283
9324
|
|
|
9284
9325
|
// templates/CryptoTradeConverter/CryptoTradeConverter.tsx
|
|
9285
|
-
var
|
|
9326
|
+
var import_react38 = require("react");
|
|
9286
9327
|
|
|
9287
9328
|
// templates/cryptoMarketData/origins.ts
|
|
9288
9329
|
var DEFAULT_API_ORIGIN = "https://deriv.exchange";
|
|
@@ -10117,7 +10158,7 @@ function getSharedMarketDataClient(apiOrigin) {
|
|
|
10117
10158
|
}
|
|
10118
10159
|
|
|
10119
10160
|
// templates/cryptoMarketData/useCryptoMarketData.ts
|
|
10120
|
-
var
|
|
10161
|
+
var import_react37 = require("react");
|
|
10121
10162
|
var EMPTY = {
|
|
10122
10163
|
kind: "spot",
|
|
10123
10164
|
status: "idle",
|
|
@@ -10130,8 +10171,8 @@ var EMPTY = {
|
|
|
10130
10171
|
};
|
|
10131
10172
|
function useCryptoMarketData(options) {
|
|
10132
10173
|
const { kind, kline, apiOrigin, enabled = true } = options;
|
|
10133
|
-
const [snapshot, setSnapshot] = (0,
|
|
10134
|
-
(0,
|
|
10174
|
+
const [snapshot, setSnapshot] = (0, import_react37.useState)({ ...EMPTY, kind });
|
|
10175
|
+
(0, import_react37.useEffect)(() => {
|
|
10135
10176
|
if (!enabled || typeof window === "undefined") return;
|
|
10136
10177
|
const client = getSharedMarketDataClient(apiOrigin);
|
|
10137
10178
|
return client.subscribe({ kind, kline }, setSnapshot);
|
|
@@ -10181,7 +10222,7 @@ function matchPair(rows, defaultPair) {
|
|
|
10181
10222
|
return rows.find((r) => r.id === needle) ?? rows.find((r) => r.name.toLowerCase() === needle) ?? rows.find((r) => r.name.replace("/", "").toLowerCase() === needle.replace("/", "")) ?? rows[0] ?? null;
|
|
10182
10223
|
}
|
|
10183
10224
|
function CoinAvatar({ base, icon, label }) {
|
|
10184
|
-
const [failed, setFailed] = (0,
|
|
10225
|
+
const [failed, setFailed] = (0, import_react38.useState)(false);
|
|
10185
10226
|
if (failed) {
|
|
10186
10227
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ctc-avatar ctc-avatar--fallback", "aria-hidden": "true", children: base.slice(0, 3) });
|
|
10187
10228
|
}
|
|
@@ -10230,28 +10271,28 @@ var CryptoTradeConverter = ({
|
|
|
10230
10271
|
className
|
|
10231
10272
|
}) => {
|
|
10232
10273
|
const copy = mergeLabels2(labelsProp);
|
|
10233
|
-
const reactId = (0,
|
|
10274
|
+
const reactId = (0, import_react38.useId)().replace(/:/g, "");
|
|
10234
10275
|
const listboxId = `ctc-listbox-${reactId}`;
|
|
10235
10276
|
const payId = `ctc-pay-${reactId}`;
|
|
10236
10277
|
const receiveId = `ctc-receive-${reactId}`;
|
|
10237
10278
|
const statusId = `ctc-status-${reactId}`;
|
|
10238
10279
|
const snapshot = useCryptoMarketData({ kind: "spot", kline: false, apiOrigin });
|
|
10239
|
-
const rows = (0,
|
|
10240
|
-
const [side, setSide] = (0,
|
|
10241
|
-
const [selectedId, setSelectedId] = (0,
|
|
10242
|
-
const [pay, setPay] = (0,
|
|
10243
|
-
const [receive, setReceive] = (0,
|
|
10244
|
-
const [edited, setEdited] = (0,
|
|
10245
|
-
const [pickerOpen, setPickerOpen] = (0,
|
|
10246
|
-
const [activeOption, setActiveOption] = (0,
|
|
10247
|
-
const rootRef = (0,
|
|
10248
|
-
const buttonRef = (0,
|
|
10249
|
-
const listRef = (0,
|
|
10280
|
+
const rows = (0, import_react38.useMemo)(() => [...snapshot.rows.values()], [snapshot.rows]);
|
|
10281
|
+
const [side, setSide] = (0, import_react38.useState)("buy");
|
|
10282
|
+
const [selectedId, setSelectedId] = (0, import_react38.useState)(null);
|
|
10283
|
+
const [pay, setPay] = (0, import_react38.useState)("");
|
|
10284
|
+
const [receive, setReceive] = (0, import_react38.useState)("");
|
|
10285
|
+
const [edited, setEdited] = (0, import_react38.useState)("pay");
|
|
10286
|
+
const [pickerOpen, setPickerOpen] = (0, import_react38.useState)(false);
|
|
10287
|
+
const [activeOption, setActiveOption] = (0, import_react38.useState)(0);
|
|
10288
|
+
const rootRef = (0, import_react38.useRef)(null);
|
|
10289
|
+
const buttonRef = (0, import_react38.useRef)(null);
|
|
10290
|
+
const listRef = (0, import_react38.useRef)(null);
|
|
10250
10291
|
const selected = (selectedId ? rows.find((r) => r.id === selectedId) : null) ?? matchPair(rows, defaultPair);
|
|
10251
|
-
(0,
|
|
10292
|
+
(0, import_react38.useEffect)(() => {
|
|
10252
10293
|
if (!selectedId && selected) setSelectedId(selected.id);
|
|
10253
10294
|
}, [selected, selectedId]);
|
|
10254
|
-
const conversion = (0,
|
|
10295
|
+
const conversion = (0, import_react38.useMemo)(
|
|
10255
10296
|
() => convertAmounts({
|
|
10256
10297
|
side,
|
|
10257
10298
|
price: selected?.last ?? null,
|
|
@@ -10265,16 +10306,16 @@ var CryptoTradeConverter = ({
|
|
|
10265
10306
|
}),
|
|
10266
10307
|
[side, selected?.last, pay, receive, edited, copy.waitingForPrice, copy.invalidAmount]
|
|
10267
10308
|
);
|
|
10268
|
-
(0,
|
|
10309
|
+
(0, import_react38.useEffect)(() => {
|
|
10269
10310
|
if (edited === "pay") setReceive(conversion.receive);
|
|
10270
10311
|
else setPay(conversion.pay);
|
|
10271
10312
|
}, [conversion.pay, conversion.receive, edited]);
|
|
10272
10313
|
const labels = currenciesForSide(side, selected?.base ?? "\u2014", selected?.quote ?? "\u2014");
|
|
10273
|
-
const closePicker = (0,
|
|
10314
|
+
const closePicker = (0, import_react38.useCallback)(() => {
|
|
10274
10315
|
setPickerOpen(false);
|
|
10275
10316
|
buttonRef.current?.focus();
|
|
10276
10317
|
}, []);
|
|
10277
|
-
(0,
|
|
10318
|
+
(0, import_react38.useEffect)(() => {
|
|
10278
10319
|
if (!pickerOpen) return;
|
|
10279
10320
|
const onDoc = (event) => {
|
|
10280
10321
|
if (!rootRef.current?.contains(event.target)) setPickerOpen(false);
|
|
@@ -10292,7 +10333,7 @@ var CryptoTradeConverter = ({
|
|
|
10292
10333
|
document.removeEventListener("keydown", onKey);
|
|
10293
10334
|
};
|
|
10294
10335
|
}, [pickerOpen, closePicker]);
|
|
10295
|
-
const sortedRows = (0,
|
|
10336
|
+
const sortedRows = (0, import_react38.useMemo)(
|
|
10296
10337
|
() => [...rows].sort((a, b) => a.name.localeCompare(b.name)),
|
|
10297
10338
|
[rows]
|
|
10298
10339
|
);
|
|
@@ -10322,7 +10363,7 @@ var CryptoTradeConverter = ({
|
|
|
10322
10363
|
closePicker();
|
|
10323
10364
|
}
|
|
10324
10365
|
};
|
|
10325
|
-
(0,
|
|
10366
|
+
(0, import_react38.useEffect)(() => {
|
|
10326
10367
|
if (!pickerOpen) return;
|
|
10327
10368
|
listRef.current?.querySelectorAll('[role="option"]')[activeOption]?.scrollIntoView({
|
|
10328
10369
|
block: "nearest"
|
|
@@ -10584,7 +10625,7 @@ var CryptoTradeConverter = ({
|
|
|
10584
10625
|
};
|
|
10585
10626
|
|
|
10586
10627
|
// templates/CryptoMarketsTable/CryptoMarketsTable.tsx
|
|
10587
|
-
var
|
|
10628
|
+
var import_react39 = require("react");
|
|
10588
10629
|
|
|
10589
10630
|
// templates/CryptoMarketsTable/CryptoMarketsTable.types.ts
|
|
10590
10631
|
var DEFAULT_CRYPTO_MARKETS_TABLE_TITLE = "Explore the markets";
|
|
@@ -10617,7 +10658,7 @@ function mergeLabels3(overrides) {
|
|
|
10617
10658
|
return { ...DEFAULT_CRYPTO_MARKETS_TABLE_LABELS, ...overrides };
|
|
10618
10659
|
}
|
|
10619
10660
|
function CoinAvatar2({ base, icon }) {
|
|
10620
|
-
const [failed, setFailed] = (0,
|
|
10661
|
+
const [failed, setFailed] = (0, import_react39.useState)(false);
|
|
10621
10662
|
if (failed) {
|
|
10622
10663
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "cmt-avatar cmt-avatar--fallback", "aria-hidden": "true", children: base.slice(0, 3) });
|
|
10623
10664
|
}
|
|
@@ -10641,8 +10682,8 @@ function Sparkline({
|
|
|
10641
10682
|
label,
|
|
10642
10683
|
reducedMotion
|
|
10643
10684
|
}) {
|
|
10644
|
-
const canvasRef = (0,
|
|
10645
|
-
(0,
|
|
10685
|
+
const canvasRef = (0, import_react39.useRef)(null);
|
|
10686
|
+
(0, import_react39.useEffect)(() => {
|
|
10646
10687
|
const canvas = canvasRef.current;
|
|
10647
10688
|
if (!canvas) return;
|
|
10648
10689
|
const points = values.map(Number).filter(Number.isFinite);
|
|
@@ -10726,16 +10767,16 @@ var CryptoMarketsTable = ({
|
|
|
10726
10767
|
className
|
|
10727
10768
|
}) => {
|
|
10728
10769
|
const copy = mergeLabels3(labelsProp);
|
|
10729
|
-
const reactId = (0,
|
|
10730
|
-
const [kind, setKind] = (0,
|
|
10731
|
-
const [quote, setQuote] = (0,
|
|
10732
|
-
const [sortKey, setSortKey] = (0,
|
|
10733
|
-
const [sortDir, setSortDir] = (0,
|
|
10734
|
-
const [reducedMotion, setReducedMotion] = (0,
|
|
10735
|
-
const scrollRef = (0,
|
|
10736
|
-
const [scrolled, setScrolled] = (0,
|
|
10770
|
+
const reactId = (0, import_react39.useId)().replace(/:/g, "");
|
|
10771
|
+
const [kind, setKind] = (0, import_react39.useState)(initialMarket);
|
|
10772
|
+
const [quote, setQuote] = (0, import_react39.useState)(initialQuoteCurrency.toUpperCase());
|
|
10773
|
+
const [sortKey, setSortKey] = (0, import_react39.useState)("last");
|
|
10774
|
+
const [sortDir, setSortDir] = (0, import_react39.useState)("desc");
|
|
10775
|
+
const [reducedMotion, setReducedMotion] = (0, import_react39.useState)(false);
|
|
10776
|
+
const scrollRef = (0, import_react39.useRef)(null);
|
|
10777
|
+
const [scrolled, setScrolled] = (0, import_react39.useState)(false);
|
|
10737
10778
|
const snapshot = useCryptoMarketData({ kind, kline: true, apiOrigin });
|
|
10738
|
-
(0,
|
|
10779
|
+
(0, import_react39.useEffect)(() => {
|
|
10739
10780
|
if (typeof window === "undefined") return;
|
|
10740
10781
|
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
10741
10782
|
const update = () => setReducedMotion(mq.matches);
|
|
@@ -10743,7 +10784,7 @@ var CryptoMarketsTable = ({
|
|
|
10743
10784
|
mq.addEventListener?.("change", update);
|
|
10744
10785
|
return () => mq.removeEventListener?.("change", update);
|
|
10745
10786
|
}, []);
|
|
10746
|
-
(0,
|
|
10787
|
+
(0, import_react39.useEffect)(() => {
|
|
10747
10788
|
const node = scrollRef.current;
|
|
10748
10789
|
if (!node) return;
|
|
10749
10790
|
const onScroll = () => setScrolled(node.scrollLeft > 0);
|
|
@@ -10751,12 +10792,12 @@ var CryptoMarketsTable = ({
|
|
|
10751
10792
|
node.addEventListener("scroll", onScroll, { passive: true });
|
|
10752
10793
|
return () => node.removeEventListener("scroll", onScroll);
|
|
10753
10794
|
}, []);
|
|
10754
|
-
(0,
|
|
10795
|
+
(0, import_react39.useEffect)(() => {
|
|
10755
10796
|
if (snapshot.quotes.length && !snapshot.quotes.includes(quote)) {
|
|
10756
10797
|
setQuote(snapshot.quotes[0]);
|
|
10757
10798
|
}
|
|
10758
10799
|
}, [snapshot.quotes, quote]);
|
|
10759
|
-
const filtered = (0,
|
|
10800
|
+
const filtered = (0, import_react39.useMemo)(() => {
|
|
10760
10801
|
const rows = [...snapshot.rows.values()].filter(
|
|
10761
10802
|
(row) => row.quote.toUpperCase() === quote.toUpperCase()
|
|
10762
10803
|
);
|
|
@@ -10891,7 +10932,7 @@ var CryptoMarketsTable = ({
|
|
|
10891
10932
|
};
|
|
10892
10933
|
|
|
10893
10934
|
// templates/FeatureOffices/FeatureOffices.tsx
|
|
10894
|
-
var
|
|
10935
|
+
var import_react40 = require("react");
|
|
10895
10936
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
10896
10937
|
var isExternalUrl2 = (href) => Boolean(href && /^https?:\/\//i.test(href));
|
|
10897
10938
|
var FEATURE_OFFICES_TEXT_CONTENT = {
|
|
@@ -10945,12 +10986,12 @@ var FeatureOffices = ({
|
|
|
10945
10986
|
className,
|
|
10946
10987
|
...props
|
|
10947
10988
|
}) => {
|
|
10948
|
-
const [internalActiveId, setInternalActiveId] = (0,
|
|
10989
|
+
const [internalActiveId, setInternalActiveId] = (0, import_react40.useState)(
|
|
10949
10990
|
defaultActiveRegionId ?? regions[0]?.id
|
|
10950
10991
|
);
|
|
10951
10992
|
const isControlled = activeRegionId !== void 0;
|
|
10952
10993
|
const activeId = isControlled ? activeRegionId : internalActiveId;
|
|
10953
|
-
const filteredOffices = (0,
|
|
10994
|
+
const filteredOffices = (0, import_react40.useMemo)(
|
|
10954
10995
|
() => offices.filter((office) => office.region === activeId),
|
|
10955
10996
|
[offices, activeId]
|
|
10956
10997
|
);
|
|
@@ -11208,7 +11249,7 @@ var ResourceBanner = ({
|
|
|
11208
11249
|
};
|
|
11209
11250
|
|
|
11210
11251
|
// templates/OptionsTypes/OptionsTypes.tsx
|
|
11211
|
-
var
|
|
11252
|
+
var import_react41 = require("react");
|
|
11212
11253
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
11213
11254
|
var OPTIONS_TYPES_PLACEHOLDER_ITEMS = [
|
|
11214
11255
|
{
|
|
@@ -11415,10 +11456,10 @@ function TogglePanel({
|
|
|
11415
11456
|
setPlaying
|
|
11416
11457
|
}) {
|
|
11417
11458
|
const animations = item.animations;
|
|
11418
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
11419
|
-
const switchRefs = (0,
|
|
11459
|
+
const [activeIndex, setActiveIndex] = (0, import_react41.useState)(0);
|
|
11460
|
+
const switchRefs = (0, import_react41.useRef)([]);
|
|
11420
11461
|
const safeIndex = Math.min(activeIndex, Math.max(animations.length - 1, 0));
|
|
11421
|
-
(0,
|
|
11462
|
+
(0, import_react41.useEffect)(() => {
|
|
11422
11463
|
setPlaying({});
|
|
11423
11464
|
}, [safeIndex, setPlaying]);
|
|
11424
11465
|
const hasMarkets = Boolean(item.markets && item.markets.length > 0);
|
|
@@ -11541,15 +11582,15 @@ function OptionsTypes({
|
|
|
11541
11582
|
...props
|
|
11542
11583
|
}) {
|
|
11543
11584
|
const usableItems = Array.isArray(items) ? items.filter((item) => item?.id) : [];
|
|
11544
|
-
const [internalActiveId, setInternalActiveId] = (0,
|
|
11585
|
+
const [internalActiveId, setInternalActiveId] = (0, import_react41.useState)(
|
|
11545
11586
|
defaultActiveId ?? usableItems[0]?.id ?? ""
|
|
11546
11587
|
);
|
|
11547
11588
|
const selectedId = usableItems.find((item) => item.id === activeId)?.id ?? usableItems.find((item) => item.id === internalActiveId)?.id ?? usableItems[0]?.id ?? "";
|
|
11548
|
-
const [playing, setPlaying] = (0,
|
|
11549
|
-
const generatedId = (0,
|
|
11589
|
+
const [playing, setPlaying] = (0, import_react41.useState)({});
|
|
11590
|
+
const generatedId = (0, import_react41.useId)().replace(/:/g, "");
|
|
11550
11591
|
const tabPrefix = `options-types-${generatedId}`;
|
|
11551
11592
|
const Heading = headingLevel;
|
|
11552
|
-
(0,
|
|
11593
|
+
(0, import_react41.useEffect)(() => {
|
|
11553
11594
|
setPlaying({});
|
|
11554
11595
|
}, [selectedId]);
|
|
11555
11596
|
const selectItem = (id) => {
|
|
@@ -11965,7 +12006,7 @@ var CountryLinkGrid = ({
|
|
|
11965
12006
|
};
|
|
11966
12007
|
|
|
11967
12008
|
// templates/DocumentChips/DocumentChips.tsx
|
|
11968
|
-
var
|
|
12009
|
+
var import_react42 = require("react");
|
|
11969
12010
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
11970
12011
|
var DEFAULT_GROUPS = [
|
|
11971
12012
|
{
|
|
@@ -12069,7 +12110,7 @@ var DocumentChips = ({
|
|
|
12069
12110
|
}) => {
|
|
12070
12111
|
const resolvedGroups = groups && groups.length > 0 ? groups : DEFAULT_GROUPS;
|
|
12071
12112
|
const groupKeys = resolvedGroups.map((group, i) => String(group.id ?? i));
|
|
12072
|
-
const [openKeys, setOpenKeys] = (0,
|
|
12113
|
+
const [openKeys, setOpenKeys] = (0, import_react42.useState)(void 0);
|
|
12073
12114
|
const resolvedOpenKeys = openKeys === void 0 ? groupKeys.slice(0, 1) : openKeys;
|
|
12074
12115
|
const handleToggle = (key, next) => {
|
|
12075
12116
|
setOpenKeys((current) => {
|
|
@@ -12120,7 +12161,7 @@ var DocumentChips = ({
|
|
|
12120
12161
|
};
|
|
12121
12162
|
|
|
12122
12163
|
// components/LinkModal/LinkModal.tsx
|
|
12123
|
-
var
|
|
12164
|
+
var import_react43 = require("react");
|
|
12124
12165
|
var import_react_dom2 = require("react-dom");
|
|
12125
12166
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
12126
12167
|
var XMarkIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
@@ -12162,17 +12203,17 @@ var LinkModal = ({
|
|
|
12162
12203
|
className,
|
|
12163
12204
|
...props
|
|
12164
12205
|
}) => {
|
|
12165
|
-
const titleId = (0,
|
|
12166
|
-
const panelRef = (0,
|
|
12167
|
-
const triggerRef = (0,
|
|
12168
|
-
const getFocusable = (0,
|
|
12206
|
+
const titleId = (0, import_react43.useId)();
|
|
12207
|
+
const panelRef = (0, import_react43.useRef)(null);
|
|
12208
|
+
const triggerRef = (0, import_react43.useRef)(null);
|
|
12209
|
+
const getFocusable = (0, import_react43.useCallback)(() => {
|
|
12169
12210
|
const panel = panelRef.current;
|
|
12170
12211
|
if (!panel) return [];
|
|
12171
12212
|
return Array.from(panel.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
|
|
12172
12213
|
(el) => el.offsetParent !== null || el === document.activeElement
|
|
12173
12214
|
);
|
|
12174
12215
|
}, []);
|
|
12175
|
-
(0,
|
|
12216
|
+
(0, import_react43.useEffect)(() => {
|
|
12176
12217
|
if (!open || typeof document === "undefined") return;
|
|
12177
12218
|
triggerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
12178
12219
|
panelRef.current?.focus();
|
|
@@ -12182,7 +12223,7 @@ var LinkModal = ({
|
|
|
12182
12223
|
if (trigger && document.contains(trigger)) trigger.focus();
|
|
12183
12224
|
};
|
|
12184
12225
|
}, [open]);
|
|
12185
|
-
(0,
|
|
12226
|
+
(0, import_react43.useEffect)(() => {
|
|
12186
12227
|
if (!open || typeof document === "undefined") return;
|
|
12187
12228
|
const handleKeyDown = (event) => {
|
|
12188
12229
|
if (event.key === "Escape") {
|
|
@@ -12193,7 +12234,7 @@ var LinkModal = ({
|
|
|
12193
12234
|
document.addEventListener("keydown", handleKeyDown);
|
|
12194
12235
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
12195
12236
|
}, [open, onClose]);
|
|
12196
|
-
(0,
|
|
12237
|
+
(0, import_react43.useEffect)(() => {
|
|
12197
12238
|
if (!open || typeof document === "undefined") return;
|
|
12198
12239
|
const body = document.body;
|
|
12199
12240
|
const previousOverflow = body.style.overflow;
|
|
@@ -12333,7 +12374,7 @@ var LanguageSelectModal = ({
|
|
|
12333
12374
|
};
|
|
12334
12375
|
|
|
12335
12376
|
// templates/AffiliatesSlider/AffiliatesSlider.tsx
|
|
12336
|
-
var
|
|
12377
|
+
var import_react44 = require("react");
|
|
12337
12378
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
12338
12379
|
var ArrowIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
12339
12380
|
"svg",
|
|
@@ -12418,16 +12459,16 @@ var AffiliatesSlider = ({
|
|
|
12418
12459
|
className,
|
|
12419
12460
|
...props
|
|
12420
12461
|
}) => {
|
|
12421
|
-
const [internalValue, setInternalValue] = (0,
|
|
12462
|
+
const [internalValue, setInternalValue] = (0, import_react44.useState)(defaultValue);
|
|
12422
12463
|
const currentValue = value ?? internalValue;
|
|
12423
|
-
const handleChange = (0,
|
|
12464
|
+
const handleChange = (0, import_react44.useCallback)(
|
|
12424
12465
|
(next) => {
|
|
12425
12466
|
if (value === void 0) setInternalValue(next);
|
|
12426
12467
|
onValueChange?.(next);
|
|
12427
12468
|
},
|
|
12428
12469
|
[onValueChange, value]
|
|
12429
12470
|
);
|
|
12430
|
-
const ticks = (0,
|
|
12471
|
+
const ticks = (0, import_react44.useMemo)(
|
|
12431
12472
|
() => tickValues ?? buildDefaultTicks(min, max),
|
|
12432
12473
|
[max, min, tickValues]
|
|
12433
12474
|
);
|