@deriv-web-design/ui 0.1.21 → 0.1.23
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/block-registry.json +132 -3
- package/components.manifest.json +1 -1
- package/dist/index.css +125 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +23 -2
- package/dist/index.d.ts +23 -2
- package/dist/index.js +158 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +161 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8463,6 +8463,7 @@ var ResourceBanner = ({
|
|
|
8463
8463
|
import {
|
|
8464
8464
|
useEffect as useEffect18,
|
|
8465
8465
|
useId as useId5,
|
|
8466
|
+
useRef as useRef21,
|
|
8466
8467
|
useState as useState24
|
|
8467
8468
|
} from "react";
|
|
8468
8469
|
import { Fragment as Fragment13, jsx as jsx63, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
@@ -8662,6 +8663,126 @@ function OptionPanel({
|
|
|
8662
8663
|
metadata
|
|
8663
8664
|
] });
|
|
8664
8665
|
}
|
|
8666
|
+
function TogglePanel({
|
|
8667
|
+
item,
|
|
8668
|
+
idPrefix,
|
|
8669
|
+
marketsLabel,
|
|
8670
|
+
platformsLabel,
|
|
8671
|
+
playing,
|
|
8672
|
+
setPlaying
|
|
8673
|
+
}) {
|
|
8674
|
+
const animations = item.animations;
|
|
8675
|
+
const [activeIndex, setActiveIndex] = useState24(0);
|
|
8676
|
+
const switchRefs = useRef21([]);
|
|
8677
|
+
const safeIndex = Math.min(activeIndex, Math.max(animations.length - 1, 0));
|
|
8678
|
+
useEffect18(() => {
|
|
8679
|
+
setPlaying({});
|
|
8680
|
+
}, [safeIndex, setPlaying]);
|
|
8681
|
+
const hasMarkets = Boolean(item.markets && item.markets.length > 0);
|
|
8682
|
+
const hasPlatforms = Boolean(item.platforms && item.platforms.length > 0);
|
|
8683
|
+
const onSwitchKeyDown = (event) => {
|
|
8684
|
+
const last = animations.length - 1;
|
|
8685
|
+
let next = null;
|
|
8686
|
+
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
8687
|
+
next = safeIndex === last ? 0 : safeIndex + 1;
|
|
8688
|
+
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
8689
|
+
next = safeIndex === 0 ? last : safeIndex - 1;
|
|
8690
|
+
} else if (event.key === "Home") {
|
|
8691
|
+
next = 0;
|
|
8692
|
+
} else if (event.key === "End") {
|
|
8693
|
+
next = last;
|
|
8694
|
+
}
|
|
8695
|
+
if (next === null) return;
|
|
8696
|
+
event.preventDefault();
|
|
8697
|
+
setActiveIndex(next);
|
|
8698
|
+
switchRefs.current[next]?.focus();
|
|
8699
|
+
};
|
|
8700
|
+
return /* @__PURE__ */ jsxs59("div", { className: "ot__option ot__option--toggle", children: [
|
|
8701
|
+
/* @__PURE__ */ jsx63("div", { className: "ot__toggle-media", children: animations.map((animation, index) => {
|
|
8702
|
+
const key = `${item.id}-${animation.id ?? index}`;
|
|
8703
|
+
const isActive = index === safeIndex;
|
|
8704
|
+
return /* @__PURE__ */ jsx63(
|
|
8705
|
+
"div",
|
|
8706
|
+
{
|
|
8707
|
+
className: "ot__toggle-pane",
|
|
8708
|
+
id: `${idPrefix}-media-${index}`,
|
|
8709
|
+
role: "tabpanel",
|
|
8710
|
+
"aria-labelledby": `${idPrefix}-switch-${index}`,
|
|
8711
|
+
hidden: !isActive,
|
|
8712
|
+
children: isActive ? /* @__PURE__ */ jsx63(
|
|
8713
|
+
AnimationCard,
|
|
8714
|
+
{
|
|
8715
|
+
animation,
|
|
8716
|
+
itemId: item.id,
|
|
8717
|
+
playing: Boolean(playing[key]),
|
|
8718
|
+
onToggle: () => setPlaying((current) => ({
|
|
8719
|
+
...current,
|
|
8720
|
+
[key]: !current[key]
|
|
8721
|
+
}))
|
|
8722
|
+
}
|
|
8723
|
+
) : null
|
|
8724
|
+
},
|
|
8725
|
+
key
|
|
8726
|
+
);
|
|
8727
|
+
}) }),
|
|
8728
|
+
/* @__PURE__ */ jsxs59("div", { className: "ot__toggle-side", children: [
|
|
8729
|
+
animations.length > 1 ? /* @__PURE__ */ jsx63(
|
|
8730
|
+
"div",
|
|
8731
|
+
{
|
|
8732
|
+
className: "ot__toggle-switch",
|
|
8733
|
+
role: "tablist",
|
|
8734
|
+
"aria-label": `${item.title} views`,
|
|
8735
|
+
onKeyDown: onSwitchKeyDown,
|
|
8736
|
+
children: animations.map((animation, index) => {
|
|
8737
|
+
const isActive = index === safeIndex;
|
|
8738
|
+
const iconUrl = safeHref(animation.iconUrl);
|
|
8739
|
+
return /* @__PURE__ */ jsx63(
|
|
8740
|
+
"button",
|
|
8741
|
+
{
|
|
8742
|
+
ref: (node) => {
|
|
8743
|
+
switchRefs.current[index] = node;
|
|
8744
|
+
},
|
|
8745
|
+
type: "button",
|
|
8746
|
+
role: "tab",
|
|
8747
|
+
id: `${idPrefix}-switch-${index}`,
|
|
8748
|
+
"aria-controls": `${idPrefix}-media-${index}`,
|
|
8749
|
+
"aria-selected": isActive,
|
|
8750
|
+
"aria-label": animation.label,
|
|
8751
|
+
tabIndex: isActive ? 0 : -1,
|
|
8752
|
+
className: `ot__toggle-option${isActive ? " ot__toggle-option--active" : ""}`,
|
|
8753
|
+
onClick: () => setActiveIndex(index),
|
|
8754
|
+
children: iconUrl ? /* @__PURE__ */ jsx63(
|
|
8755
|
+
"img",
|
|
8756
|
+
{
|
|
8757
|
+
className: "ot__toggle-icon",
|
|
8758
|
+
src: iconUrl,
|
|
8759
|
+
alt: "",
|
|
8760
|
+
"aria-hidden": "true",
|
|
8761
|
+
loading: "lazy",
|
|
8762
|
+
decoding: "async"
|
|
8763
|
+
}
|
|
8764
|
+
) : /* @__PURE__ */ jsx63("span", { className: "ot__toggle-option-label", children: animation.label })
|
|
8765
|
+
},
|
|
8766
|
+
`${item.id}-switch-${animation.id ?? index}`
|
|
8767
|
+
);
|
|
8768
|
+
})
|
|
8769
|
+
}
|
|
8770
|
+
) : null,
|
|
8771
|
+
/* @__PURE__ */ jsx63("h3", { className: "ot__toggle-title", children: item.title }),
|
|
8772
|
+
/* @__PURE__ */ jsx63("div", { className: "ot__description", children: /* @__PURE__ */ jsx63("p", { children: item.description }) }),
|
|
8773
|
+
hasMarkets || hasPlatforms ? /* @__PURE__ */ jsxs59("div", { className: "ot__metadata", children: [
|
|
8774
|
+
hasMarkets ? /* @__PURE__ */ jsxs59("div", { className: "ot__meta-group", children: [
|
|
8775
|
+
/* @__PURE__ */ jsx63("h4", { children: marketsLabel }),
|
|
8776
|
+
/* @__PURE__ */ jsx63(MetaList, { items: item.markets })
|
|
8777
|
+
] }) : null,
|
|
8778
|
+
hasPlatforms ? /* @__PURE__ */ jsxs59("div", { className: "ot__meta-group", children: [
|
|
8779
|
+
/* @__PURE__ */ jsx63("h4", { children: platformsLabel }),
|
|
8780
|
+
/* @__PURE__ */ jsx63(MetaList, { items: item.platforms })
|
|
8781
|
+
] }) : null
|
|
8782
|
+
] }) : null
|
|
8783
|
+
] })
|
|
8784
|
+
] });
|
|
8785
|
+
}
|
|
8665
8786
|
function OptionsTypes({
|
|
8666
8787
|
variant = "tabs",
|
|
8667
8788
|
heading = "Section title goes here",
|
|
@@ -8735,7 +8856,17 @@ function OptionsTypes({
|
|
|
8735
8856
|
},
|
|
8736
8857
|
item.id
|
|
8737
8858
|
);
|
|
8738
|
-
}) }) : /* @__PURE__ */ jsx63(
|
|
8859
|
+
}) }) : variant === "toggle" ? /* @__PURE__ */ jsx63(
|
|
8860
|
+
TogglePanel,
|
|
8861
|
+
{
|
|
8862
|
+
item: usableItems[0],
|
|
8863
|
+
idPrefix: tabPrefix,
|
|
8864
|
+
marketsLabel,
|
|
8865
|
+
platformsLabel,
|
|
8866
|
+
playing,
|
|
8867
|
+
setPlaying
|
|
8868
|
+
}
|
|
8869
|
+
) : /* @__PURE__ */ jsx63(
|
|
8739
8870
|
OptionPanel,
|
|
8740
8871
|
{
|
|
8741
8872
|
item: usableItems[0],
|
|
@@ -8976,6 +9107,31 @@ var OPTIONS_TYPES_MULTIPLIERS_CONTENT = {
|
|
|
8976
9107
|
}
|
|
8977
9108
|
]
|
|
8978
9109
|
};
|
|
9110
|
+
var OPTIONS_TYPES_EU_MULTIPLIERS_CONTENT = {
|
|
9111
|
+
variant: "toggle",
|
|
9112
|
+
heading: "How do multipliers work",
|
|
9113
|
+
items: [
|
|
9114
|
+
{
|
|
9115
|
+
id: "eu-multipliers",
|
|
9116
|
+
title: "Multipliers",
|
|
9117
|
+
description: "Choose a multiplier (up to 30x) and predict if the market price will go up or down compared to the entry price. Your potential payout grows the further the market price moves in your predicted direction, boosted by the multiplier. Losses are limited to the initial amount you put into the contract.",
|
|
9118
|
+
animations: [
|
|
9119
|
+
{
|
|
9120
|
+
id: "up",
|
|
9121
|
+
label: "Up",
|
|
9122
|
+
src: `${WEBFLOW_CDN}/6630e305e7f044e7deae8a90_Web%20Trade%20Clip%20-%20Multipliers%20(Up).lottie`,
|
|
9123
|
+
iconUrl: `${WEBFLOW_ICON_CDN}/68e4859893e33d078096e151_66585fe0e1dc7e70cc75dec1_multipliers-up-sm.svg`
|
|
9124
|
+
},
|
|
9125
|
+
{
|
|
9126
|
+
id: "down",
|
|
9127
|
+
label: "Down",
|
|
9128
|
+
src: `${WEBFLOW_CDN}/6630e3055be526fd74f10190_Web%20Trade%20Clip%20-%20Multipliers%20(Down).lottie`,
|
|
9129
|
+
iconUrl: `${WEBFLOW_ICON_CDN}/68e4859893e33d078096e155_66585fe0e1dc7e70cc75dee8_multipliers-down-sm.svg`
|
|
9130
|
+
}
|
|
9131
|
+
]
|
|
9132
|
+
}
|
|
9133
|
+
]
|
|
9134
|
+
};
|
|
8979
9135
|
|
|
8980
9136
|
// templates/EntityInfoSection/EntityInfoSection.tsx
|
|
8981
9137
|
import { jsx as jsx64, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
@@ -9221,7 +9377,7 @@ var DocumentChips = ({
|
|
|
9221
9377
|
};
|
|
9222
9378
|
|
|
9223
9379
|
// components/LinkModal/LinkModal.tsx
|
|
9224
|
-
import { useCallback as useCallback6, useEffect as useEffect19, useId as useId6, useRef as
|
|
9380
|
+
import { useCallback as useCallback6, useEffect as useEffect19, useId as useId6, useRef as useRef22 } from "react";
|
|
9225
9381
|
import { createPortal as createPortal2 } from "react-dom";
|
|
9226
9382
|
import { jsx as jsx67, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
9227
9383
|
var XMarkIcon3 = () => /* @__PURE__ */ jsx67(
|
|
@@ -9264,8 +9420,8 @@ var LinkModal = ({
|
|
|
9264
9420
|
...props
|
|
9265
9421
|
}) => {
|
|
9266
9422
|
const titleId = useId6();
|
|
9267
|
-
const panelRef =
|
|
9268
|
-
const triggerRef =
|
|
9423
|
+
const panelRef = useRef22(null);
|
|
9424
|
+
const triggerRef = useRef22(null);
|
|
9269
9425
|
const getFocusable = useCallback6(() => {
|
|
9270
9426
|
const panel = panelRef.current;
|
|
9271
9427
|
if (!panel) return [];
|
|
@@ -9669,6 +9825,7 @@ export {
|
|
|
9669
9825
|
Navbar,
|
|
9670
9826
|
OPTIONS_TYPES_ACCUMULATOR_CONTENT,
|
|
9671
9827
|
OPTIONS_TYPES_DIGITAL_CONTENT,
|
|
9828
|
+
OPTIONS_TYPES_EU_MULTIPLIERS_CONTENT,
|
|
9672
9829
|
OPTIONS_TYPES_MULTIPLIERS_CONTENT,
|
|
9673
9830
|
OPTIONS_TYPES_PLACEHOLDER_ITEMS,
|
|
9674
9831
|
OPTIONS_TYPES_TURBO_CONTENT,
|