@deriv-web-design/ui 0.1.3 → 0.1.5
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 +2358 -57
- package/components.manifest.json +2432 -0
- package/dist/award-leaf-left-HVAB5T5H.png +0 -0
- package/dist/award-leaf-right-WR5I37KI.png +0 -0
- package/dist/index.css +872 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +198 -1
- package/dist/index.d.ts +198 -1
- package/dist/index.js +577 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +569 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -5
package/dist/index.mjs
CHANGED
|
@@ -5581,6 +5581,567 @@ var ArticleSection = ({
|
|
|
5581
5581
|
] })
|
|
5582
5582
|
] });
|
|
5583
5583
|
};
|
|
5584
|
+
|
|
5585
|
+
// templates/CoralBanner/CoralBanner.tsx
|
|
5586
|
+
import { useCallback as useCallback3, useEffect as useEffect13, useRef as useRef16, useState as useState16 } from "react";
|
|
5587
|
+
import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5588
|
+
var DEFAULT_SLIDES = [
|
|
5589
|
+
{
|
|
5590
|
+
title: "Section title goes here",
|
|
5591
|
+
description: "Explain how this specific feature helps your user.",
|
|
5592
|
+
primaryButton: { label: "Get started", href: "#" }
|
|
5593
|
+
}
|
|
5594
|
+
];
|
|
5595
|
+
var CORAL_BANNER_DERIV_SLIDES = [
|
|
5596
|
+
{
|
|
5597
|
+
id: "ai-insights",
|
|
5598
|
+
title: "Analyse markets with AI-powered insights",
|
|
5599
|
+
primaryButton: { label: "Explore TradersView", href: "#" }
|
|
5600
|
+
},
|
|
5601
|
+
{
|
|
5602
|
+
id: "join-traders",
|
|
5603
|
+
title: "Join 3M+\nglobal traders",
|
|
5604
|
+
description: "Open an account in minutes and start trading the world's markets \u2014 forex, stocks, indices, and more.",
|
|
5605
|
+
primaryButton: { label: "Trade now", href: "#" }
|
|
5606
|
+
}
|
|
5607
|
+
];
|
|
5608
|
+
var LeftArrowIcon = () => /* @__PURE__ */ jsx46("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx46(
|
|
5609
|
+
"path",
|
|
5610
|
+
{
|
|
5611
|
+
d: "M3.31066 8.75001L9.03033 14.4697L7.96967 15.5303L0.439339 8.00001L7.96967 0.469676L9.03033 1.53034L3.31066 7.25001L15.5 7.25L15.5 8.75L3.31066 8.75001Z",
|
|
5612
|
+
fill: "currentColor"
|
|
5613
|
+
}
|
|
5614
|
+
) });
|
|
5615
|
+
var RightArrowIcon = () => /* @__PURE__ */ jsx46("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx46(
|
|
5616
|
+
"path",
|
|
5617
|
+
{
|
|
5618
|
+
d: "M12.6893 7.25L6.96967 1.53033L8.03033 0.469666L15.5607 8L8.03033 15.5303L6.96967 14.4697L12.6893 8.75H0.5V7.25H12.6893Z",
|
|
5619
|
+
fill: "currentColor"
|
|
5620
|
+
}
|
|
5621
|
+
) });
|
|
5622
|
+
var renderTitleLines = (title) => {
|
|
5623
|
+
const lines = title.split("\n");
|
|
5624
|
+
return lines.map((line, i) => /* @__PURE__ */ jsxs42("span", { children: [
|
|
5625
|
+
line,
|
|
5626
|
+
i < lines.length - 1 && /* @__PURE__ */ jsx46("br", {})
|
|
5627
|
+
] }, i));
|
|
5628
|
+
};
|
|
5629
|
+
var ButtonBlock3 = ({
|
|
5630
|
+
primaryButton,
|
|
5631
|
+
secondaryButton
|
|
5632
|
+
}) => {
|
|
5633
|
+
if (!primaryButton && !secondaryButton) return null;
|
|
5634
|
+
return /* @__PURE__ */ jsxs42("div", { className: "crb__buttons", children: [
|
|
5635
|
+
primaryButton && (primaryButton.href ? /* @__PURE__ */ jsx46("a", { href: primaryButton.href, children: /* @__PURE__ */ jsx46(
|
|
5636
|
+
Button,
|
|
5637
|
+
{
|
|
5638
|
+
colorScheme: "black",
|
|
5639
|
+
variant: "primary",
|
|
5640
|
+
label: primaryButton.label,
|
|
5641
|
+
onClick: primaryButton.onClick
|
|
5642
|
+
}
|
|
5643
|
+
) }) : /* @__PURE__ */ jsx46(
|
|
5644
|
+
Button,
|
|
5645
|
+
{
|
|
5646
|
+
colorScheme: "black",
|
|
5647
|
+
variant: "primary",
|
|
5648
|
+
label: primaryButton.label,
|
|
5649
|
+
onClick: primaryButton.onClick
|
|
5650
|
+
}
|
|
5651
|
+
)),
|
|
5652
|
+
secondaryButton && (secondaryButton.href ? /* @__PURE__ */ jsx46("a", { href: secondaryButton.href, children: /* @__PURE__ */ jsx46(
|
|
5653
|
+
Button,
|
|
5654
|
+
{
|
|
5655
|
+
colorScheme: "white",
|
|
5656
|
+
variant: "secondary",
|
|
5657
|
+
label: secondaryButton.label,
|
|
5658
|
+
onClick: secondaryButton.onClick
|
|
5659
|
+
}
|
|
5660
|
+
) }) : /* @__PURE__ */ jsx46(
|
|
5661
|
+
Button,
|
|
5662
|
+
{
|
|
5663
|
+
colorScheme: "white",
|
|
5664
|
+
variant: "secondary",
|
|
5665
|
+
label: secondaryButton.label,
|
|
5666
|
+
onClick: secondaryButton.onClick
|
|
5667
|
+
}
|
|
5668
|
+
))
|
|
5669
|
+
] });
|
|
5670
|
+
};
|
|
5671
|
+
var SlideContent = ({ slide }) => /* @__PURE__ */ jsxs42("div", { className: "crb__grid", children: [
|
|
5672
|
+
/* @__PURE__ */ jsxs42("div", { className: "crb__content", children: [
|
|
5673
|
+
/* @__PURE__ */ jsx46("h3", { className: "crb__title", children: renderTitleLines(slide.title) }),
|
|
5674
|
+
slide.description && /* @__PURE__ */ jsx46("p", { className: "crb__description", children: slide.description }),
|
|
5675
|
+
/* @__PURE__ */ jsx46(
|
|
5676
|
+
ButtonBlock3,
|
|
5677
|
+
{
|
|
5678
|
+
primaryButton: slide.primaryButton,
|
|
5679
|
+
secondaryButton: slide.secondaryButton
|
|
5680
|
+
}
|
|
5681
|
+
)
|
|
5682
|
+
] }),
|
|
5683
|
+
/* @__PURE__ */ jsx46("div", { className: "crb__spacer", "aria-hidden": "true" })
|
|
5684
|
+
] });
|
|
5685
|
+
var CoralBanner = ({
|
|
5686
|
+
variant = "static",
|
|
5687
|
+
slides,
|
|
5688
|
+
autoplay = true,
|
|
5689
|
+
autoplayDelay = 2e3,
|
|
5690
|
+
transitionDuration = 330,
|
|
5691
|
+
infinite = true,
|
|
5692
|
+
showArrows = true,
|
|
5693
|
+
showDots = true,
|
|
5694
|
+
className,
|
|
5695
|
+
...props
|
|
5696
|
+
}) => {
|
|
5697
|
+
const resolvedSlides = slides && slides.length > 0 ? slides : DEFAULT_SLIDES;
|
|
5698
|
+
const count = resolvedSlides.length;
|
|
5699
|
+
const isCarousel = variant === "carousel" && count > 1;
|
|
5700
|
+
const [activeIndex, setActiveIndex] = useState16(0);
|
|
5701
|
+
const autoplayTimer = useRef16(null);
|
|
5702
|
+
const dragState = useRef16(null);
|
|
5703
|
+
const goTo = useCallback3(
|
|
5704
|
+
(index) => {
|
|
5705
|
+
if (count <= 1) return;
|
|
5706
|
+
const next = infinite ? (index % count + count) % count : Math.max(0, Math.min(index, count - 1));
|
|
5707
|
+
setActiveIndex(next);
|
|
5708
|
+
},
|
|
5709
|
+
[count, infinite]
|
|
5710
|
+
);
|
|
5711
|
+
const goNext = useCallback3(() => goTo(activeIndex + 1), [activeIndex, goTo]);
|
|
5712
|
+
const goPrev = useCallback3(() => goTo(activeIndex - 1), [activeIndex, goTo]);
|
|
5713
|
+
const resetAutoplay = () => {
|
|
5714
|
+
if (autoplayTimer.current) clearTimeout(autoplayTimer.current);
|
|
5715
|
+
};
|
|
5716
|
+
useEffect13(() => {
|
|
5717
|
+
if (!isCarousel || !autoplay) return;
|
|
5718
|
+
autoplayTimer.current = setTimeout(() => {
|
|
5719
|
+
goTo(activeIndex + 1);
|
|
5720
|
+
}, autoplayDelay);
|
|
5721
|
+
return () => resetAutoplay();
|
|
5722
|
+
}, [isCarousel, autoplay, autoplayDelay, activeIndex]);
|
|
5723
|
+
const handlePointerDown = (e) => {
|
|
5724
|
+
if (!isCarousel) return;
|
|
5725
|
+
dragState.current = { startX: e.clientX };
|
|
5726
|
+
};
|
|
5727
|
+
const handlePointerUp = (e) => {
|
|
5728
|
+
if (!isCarousel || !dragState.current) return;
|
|
5729
|
+
const delta = e.clientX - dragState.current.startX;
|
|
5730
|
+
dragState.current = null;
|
|
5731
|
+
const SWIPE_THRESHOLD = 40;
|
|
5732
|
+
if (delta > SWIPE_THRESHOLD) {
|
|
5733
|
+
resetAutoplay();
|
|
5734
|
+
goPrev();
|
|
5735
|
+
} else if (delta < -SWIPE_THRESHOLD) {
|
|
5736
|
+
resetAutoplay();
|
|
5737
|
+
goNext();
|
|
5738
|
+
}
|
|
5739
|
+
};
|
|
5740
|
+
const rootClass = [
|
|
5741
|
+
"crb",
|
|
5742
|
+
isCarousel ? "crb--carousel" : "crb--static",
|
|
5743
|
+
className
|
|
5744
|
+
].filter(Boolean).join(" ");
|
|
5745
|
+
if (!isCarousel) {
|
|
5746
|
+
return /* @__PURE__ */ jsx46("section", { className: rootClass, ...props, children: /* @__PURE__ */ jsx46("div", { className: "crb__inner", children: /* @__PURE__ */ jsx46("div", { className: "crb__stage", children: /* @__PURE__ */ jsx46(SlideContent, { slide: resolvedSlides[0] }) }) }) });
|
|
5747
|
+
}
|
|
5748
|
+
return /* @__PURE__ */ jsx46("section", { className: rootClass, ...props, children: /* @__PURE__ */ jsx46("div", { className: "crb__inner", children: /* @__PURE__ */ jsxs42("div", { className: "crb__stage", children: [
|
|
5749
|
+
/* @__PURE__ */ jsx46(
|
|
5750
|
+
"div",
|
|
5751
|
+
{
|
|
5752
|
+
className: "crb__viewport",
|
|
5753
|
+
onPointerDown: handlePointerDown,
|
|
5754
|
+
onPointerUp: handlePointerUp,
|
|
5755
|
+
children: /* @__PURE__ */ jsx46(
|
|
5756
|
+
"div",
|
|
5757
|
+
{
|
|
5758
|
+
className: "crb__track",
|
|
5759
|
+
style: {
|
|
5760
|
+
transform: `translateX(-${activeIndex * 100}%)`,
|
|
5761
|
+
transitionDuration: `${transitionDuration}ms`
|
|
5762
|
+
},
|
|
5763
|
+
children: resolvedSlides.map((slide, i) => /* @__PURE__ */ jsx46(
|
|
5764
|
+
"div",
|
|
5765
|
+
{
|
|
5766
|
+
className: "crb__slide",
|
|
5767
|
+
role: "group",
|
|
5768
|
+
"aria-roledescription": "slide",
|
|
5769
|
+
"aria-label": `${i + 1} of ${count}`,
|
|
5770
|
+
"aria-hidden": i !== activeIndex,
|
|
5771
|
+
children: /* @__PURE__ */ jsx46(SlideContent, { slide })
|
|
5772
|
+
},
|
|
5773
|
+
slide.id ?? i
|
|
5774
|
+
))
|
|
5775
|
+
}
|
|
5776
|
+
)
|
|
5777
|
+
}
|
|
5778
|
+
),
|
|
5779
|
+
showDots && /* @__PURE__ */ jsx46("div", { className: "crb__dots", role: "tablist", "aria-label": "Banner slide navigation", children: resolvedSlides.map((_, i) => /* @__PURE__ */ jsx46(
|
|
5780
|
+
"button",
|
|
5781
|
+
{
|
|
5782
|
+
type: "button",
|
|
5783
|
+
role: "tab",
|
|
5784
|
+
"aria-selected": i === activeIndex,
|
|
5785
|
+
"aria-label": `Go to slide ${i + 1} of ${count}`,
|
|
5786
|
+
className: [
|
|
5787
|
+
"crb__dot",
|
|
5788
|
+
i === activeIndex ? "crb__dot--active" : ""
|
|
5789
|
+
].filter(Boolean).join(" "),
|
|
5790
|
+
onClick: () => {
|
|
5791
|
+
resetAutoplay();
|
|
5792
|
+
goTo(i);
|
|
5793
|
+
}
|
|
5794
|
+
},
|
|
5795
|
+
i
|
|
5796
|
+
)) }),
|
|
5797
|
+
showArrows && /* @__PURE__ */ jsxs42("div", { className: "crb__arrows", children: [
|
|
5798
|
+
/* @__PURE__ */ jsx46(
|
|
5799
|
+
"button",
|
|
5800
|
+
{
|
|
5801
|
+
type: "button",
|
|
5802
|
+
className: "crb__arrow crb__arrow--prev",
|
|
5803
|
+
"aria-label": "Previous slide",
|
|
5804
|
+
onClick: () => {
|
|
5805
|
+
resetAutoplay();
|
|
5806
|
+
goPrev();
|
|
5807
|
+
},
|
|
5808
|
+
children: /* @__PURE__ */ jsx46(LeftArrowIcon, {})
|
|
5809
|
+
}
|
|
5810
|
+
),
|
|
5811
|
+
/* @__PURE__ */ jsx46(
|
|
5812
|
+
"button",
|
|
5813
|
+
{
|
|
5814
|
+
type: "button",
|
|
5815
|
+
className: "crb__arrow crb__arrow--next",
|
|
5816
|
+
"aria-label": "Next slide",
|
|
5817
|
+
onClick: () => {
|
|
5818
|
+
resetAutoplay();
|
|
5819
|
+
goNext();
|
|
5820
|
+
},
|
|
5821
|
+
children: /* @__PURE__ */ jsx46(RightArrowIcon, {})
|
|
5822
|
+
}
|
|
5823
|
+
)
|
|
5824
|
+
] })
|
|
5825
|
+
] }) }) });
|
|
5826
|
+
};
|
|
5827
|
+
|
|
5828
|
+
// assets/award-leaf-left.png
|
|
5829
|
+
var award_leaf_left_default = "./award-leaf-left-HVAB5T5H.png";
|
|
5830
|
+
|
|
5831
|
+
// assets/award-leaf-right.png
|
|
5832
|
+
var award_leaf_right_default = "./award-leaf-right-WR5I37KI.png";
|
|
5833
|
+
|
|
5834
|
+
// templates/FeatureAwards/FeatureAwards.tsx
|
|
5835
|
+
import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
5836
|
+
var FEATURE_AWARDS_TEXT_CONTENT = {
|
|
5837
|
+
title: "Our awards"
|
|
5838
|
+
};
|
|
5839
|
+
var DEFAULT_AWARDS = [
|
|
5840
|
+
{ title: "Best Trade Execution Award (MEA)", subtitle: "Ultimate Fintech 2026" },
|
|
5841
|
+
{ title: "Best Trading Experience - Global", subtitle: "UF Awards 2025" },
|
|
5842
|
+
{ title: "Best CFD Broker - LATAM", subtitle: "UF Awards 2025" },
|
|
5843
|
+
{ title: "Most Innovative Broker - MEA", subtitle: "UF Awards 2025" },
|
|
5844
|
+
{ title: "Most Transparent Broker - Global", subtitle: "Global Forex Awards 2025" },
|
|
5845
|
+
{ title: "Best Broker - Africa", subtitle: "Global Forex Awards 2025" },
|
|
5846
|
+
{ title: "Best Trading Platform - MENA", subtitle: "Global Forex Awards 2025" },
|
|
5847
|
+
{ title: "Most Innovative Online Trading Platform", subtitle: "Forex Expo Dubai 2025" },
|
|
5848
|
+
{ title: "Chief Risk & Compliance Officer of the Year", subtitle: "Forex Expo Dubai 2025" },
|
|
5849
|
+
{ title: "Best Broker - APAC", subtitle: "UF Awards 2025" },
|
|
5850
|
+
{ title: "Best Trading Conditions - Global", subtitle: "Finance Magnates 2025" },
|
|
5851
|
+
{ title: "Most Trusted Broker - Middle East", subtitle: "Finance Magnates 2025" },
|
|
5852
|
+
{ title: "Affiliate Program of the Year", subtitle: "Forex Expo Dubai 2024" },
|
|
5853
|
+
{ title: "Best Customer Service - Global", subtitle: "Global Forex Awards 2024" },
|
|
5854
|
+
{ title: "Most Trusted Broker - Africa", subtitle: "Finance Magnates 2024" },
|
|
5855
|
+
{ title: "Best LATAM Region Broker", subtitle: "ADVFN Awards 2024" },
|
|
5856
|
+
{ title: "Broker of the Year - Global", subtitle: "Finance Magnates 2024" }
|
|
5857
|
+
];
|
|
5858
|
+
var LaurelIcon = ({ side }) => /* @__PURE__ */ jsx47(
|
|
5859
|
+
"img",
|
|
5860
|
+
{
|
|
5861
|
+
className: `fa__leaf fa__leaf--${side}`,
|
|
5862
|
+
src: side === "left" ? award_leaf_left_default : award_leaf_right_default,
|
|
5863
|
+
alt: "",
|
|
5864
|
+
"aria-hidden": "true",
|
|
5865
|
+
loading: "lazy",
|
|
5866
|
+
draggable: false
|
|
5867
|
+
}
|
|
5868
|
+
);
|
|
5869
|
+
var AwardBadge2 = ({ award }) => /* @__PURE__ */ jsxs43("div", { className: "fa__item", role: "listitem", children: [
|
|
5870
|
+
/* @__PURE__ */ jsx47(LaurelIcon, { side: "left" }),
|
|
5871
|
+
/* @__PURE__ */ jsxs43("div", { className: "fa__item-text", children: [
|
|
5872
|
+
/* @__PURE__ */ jsx47("p", { className: "fa__item-title", children: award.title }),
|
|
5873
|
+
/* @__PURE__ */ jsx47("p", { className: "fa__item-subtitle", children: award.subtitle })
|
|
5874
|
+
] }),
|
|
5875
|
+
/* @__PURE__ */ jsx47(LaurelIcon, { side: "right" })
|
|
5876
|
+
] });
|
|
5877
|
+
var FeatureAwards = ({
|
|
5878
|
+
title = FEATURE_AWARDS_TEXT_CONTENT.title,
|
|
5879
|
+
awards = DEFAULT_AWARDS,
|
|
5880
|
+
autoScrollDuration = 32,
|
|
5881
|
+
className,
|
|
5882
|
+
...props
|
|
5883
|
+
}) => {
|
|
5884
|
+
if (!awards || awards.length === 0) return null;
|
|
5885
|
+
const trackStyle = {
|
|
5886
|
+
"--fa-duration": `${autoScrollDuration}s`
|
|
5887
|
+
};
|
|
5888
|
+
return /* @__PURE__ */ jsx47(
|
|
5889
|
+
"section",
|
|
5890
|
+
{
|
|
5891
|
+
className: ["fa", className].filter(Boolean).join(" "),
|
|
5892
|
+
...props,
|
|
5893
|
+
children: /* @__PURE__ */ jsxs43("div", { className: "fa__inner", children: [
|
|
5894
|
+
title && /* @__PURE__ */ jsx47("h2", { className: "fa__title", children: title }),
|
|
5895
|
+
/* @__PURE__ */ jsx47("div", { className: "fa__grid", role: "list", children: awards.map((award, i) => /* @__PURE__ */ jsx47(AwardBadge2, { award }, `g-${i}`)) }),
|
|
5896
|
+
/* @__PURE__ */ jsx47("div", { className: "fa__scroller", children: /* @__PURE__ */ jsxs43("div", { className: "fa__track fa__track--auto", style: trackStyle, children: [
|
|
5897
|
+
/* @__PURE__ */ jsx47("div", { className: "fa__track-group", role: "list", children: awards.map((award, i) => /* @__PURE__ */ jsx47(AwardBadge2, { award }, `m-${i}`)) }),
|
|
5898
|
+
/* @__PURE__ */ jsx47(
|
|
5899
|
+
"div",
|
|
5900
|
+
{
|
|
5901
|
+
className: "fa__track-group",
|
|
5902
|
+
role: "presentation",
|
|
5903
|
+
"aria-hidden": "true",
|
|
5904
|
+
children: awards.map((award, i) => /* @__PURE__ */ jsx47(AwardBadge2, { award }, `m-dup-${i}`))
|
|
5905
|
+
}
|
|
5906
|
+
)
|
|
5907
|
+
] }) })
|
|
5908
|
+
] })
|
|
5909
|
+
}
|
|
5910
|
+
);
|
|
5911
|
+
};
|
|
5912
|
+
|
|
5913
|
+
// templates/HelpCentreCategories/HelpCentreCategories.tsx
|
|
5914
|
+
import { Fragment as Fragment7, jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
5915
|
+
var externalLinkRel2 = (href) => href && /^https?:\/\//i.test(href) ? "noopener noreferrer" : void 0;
|
|
5916
|
+
var CategoryTileContent = ({ category }) => /* @__PURE__ */ jsxs44(Fragment7, { children: [
|
|
5917
|
+
category.icon && /* @__PURE__ */ jsx48("span", { className: "hcc-tile-icon", children: typeof category.icon === "string" ? /* @__PURE__ */ jsx48(
|
|
5918
|
+
"img",
|
|
5919
|
+
{
|
|
5920
|
+
alt: category.iconAlt ?? "",
|
|
5921
|
+
className: "hcc-tile-iconImage",
|
|
5922
|
+
decoding: "async",
|
|
5923
|
+
height: 48,
|
|
5924
|
+
loading: "lazy",
|
|
5925
|
+
src: category.icon,
|
|
5926
|
+
width: 48
|
|
5927
|
+
}
|
|
5928
|
+
) : category.icon }),
|
|
5929
|
+
/* @__PURE__ */ jsx48("span", { className: "hcc-tile-title", children: category.title })
|
|
5930
|
+
] });
|
|
5931
|
+
var CategoryTile = ({ category }) => {
|
|
5932
|
+
if (category.href) {
|
|
5933
|
+
return /* @__PURE__ */ jsx48(
|
|
5934
|
+
"a",
|
|
5935
|
+
{
|
|
5936
|
+
className: "hcc-tile",
|
|
5937
|
+
href: category.href,
|
|
5938
|
+
onClick: category.onClick,
|
|
5939
|
+
rel: externalLinkRel2(category.href),
|
|
5940
|
+
children: /* @__PURE__ */ jsx48(CategoryTileContent, { category })
|
|
5941
|
+
}
|
|
5942
|
+
);
|
|
5943
|
+
}
|
|
5944
|
+
return /* @__PURE__ */ jsx48("button", { className: "hcc-tile", onClick: category.onClick, type: "button", children: /* @__PURE__ */ jsx48(CategoryTileContent, { category }) });
|
|
5945
|
+
};
|
|
5946
|
+
var getColumnCount = (categoryCount) => Math.max(1, Math.min(categoryCount, 3));
|
|
5947
|
+
var HelpCentreCategories = ({
|
|
5948
|
+
sectionTitle,
|
|
5949
|
+
sectionDescription,
|
|
5950
|
+
categories
|
|
5951
|
+
}) => {
|
|
5952
|
+
const columnCount = getColumnCount(categories.length);
|
|
5953
|
+
return /* @__PURE__ */ jsx48("section", { className: "hcc-section", children: /* @__PURE__ */ jsxs44("div", { className: "hcc-container", children: [
|
|
5954
|
+
(sectionTitle || sectionDescription) && /* @__PURE__ */ jsxs44("div", { className: "hcc-header", children: [
|
|
5955
|
+
sectionTitle && /* @__PURE__ */ jsx48("h2", { className: "hcc-sectionTitle", children: sectionTitle }),
|
|
5956
|
+
sectionDescription && /* @__PURE__ */ jsx48("p", { className: "hcc-sectionDescription", children: sectionDescription })
|
|
5957
|
+
] }),
|
|
5958
|
+
/* @__PURE__ */ jsx48("div", { className: `hcc-grid hcc-grid--${columnCount}`, role: "list", children: categories.map((category, index) => /* @__PURE__ */ jsx48("div", { className: "hcc-gridItem", role: "listitem", children: /* @__PURE__ */ jsx48(CategoryTile, { category }) }, category.id ?? `${category.title}-${index}`)) })
|
|
5959
|
+
] }) });
|
|
5960
|
+
};
|
|
5961
|
+
|
|
5962
|
+
// templates/HelpCentreSubCategories/HelpCentreSubCategories.tsx
|
|
5963
|
+
import { useMemo as useMemo3, useState as useState17 } from "react";
|
|
5964
|
+
import { jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5965
|
+
var externalLinkRel3 = (href) => href && /^https?:\/\//i.test(href) ? "noopener noreferrer" : void 0;
|
|
5966
|
+
var QuestionCard = ({ item }) => {
|
|
5967
|
+
if (item.href) {
|
|
5968
|
+
return /* @__PURE__ */ jsx49("a", { className: "hcsc-card", href: item.href, onClick: item.onClick, rel: externalLinkRel3(item.href), children: /* @__PURE__ */ jsx49("span", { className: "hcsc-card-text", children: item.question }) });
|
|
5969
|
+
}
|
|
5970
|
+
return /* @__PURE__ */ jsx49("button", { className: "hcsc-card", onClick: item.onClick, type: "button", children: /* @__PURE__ */ jsx49("span", { className: "hcsc-card-text", children: item.question }) });
|
|
5971
|
+
};
|
|
5972
|
+
var HelpCentreSubCategories = ({
|
|
5973
|
+
title,
|
|
5974
|
+
searchPlaceholder = "Search",
|
|
5975
|
+
searchAriaLabel,
|
|
5976
|
+
items,
|
|
5977
|
+
noResultsText = 'No results found for "{query}"',
|
|
5978
|
+
onSearchChange
|
|
5979
|
+
}) => {
|
|
5980
|
+
const [search, setSearch] = useState17("");
|
|
5981
|
+
const filtered = useMemo3(() => {
|
|
5982
|
+
const q = search.trim().toLowerCase();
|
|
5983
|
+
if (!q) return items;
|
|
5984
|
+
return items.filter((item) => item.question.toLowerCase().includes(q));
|
|
5985
|
+
}, [items, search]);
|
|
5986
|
+
const handleSearchChange = (e) => {
|
|
5987
|
+
setSearch(e.target.value);
|
|
5988
|
+
onSearchChange?.(e.target.value);
|
|
5989
|
+
};
|
|
5990
|
+
const handleClear = () => {
|
|
5991
|
+
setSearch("");
|
|
5992
|
+
onSearchChange?.("");
|
|
5993
|
+
};
|
|
5994
|
+
return /* @__PURE__ */ jsx49("section", { className: "hcsc-section", children: /* @__PURE__ */ jsxs45("div", { className: "hcsc-container", children: [
|
|
5995
|
+
/* @__PURE__ */ jsx49("h1", { className: "hcsc-title", children: title }),
|
|
5996
|
+
/* @__PURE__ */ jsx49("div", { className: "hcsc-searchWrap", children: /* @__PURE__ */ jsx49(
|
|
5997
|
+
SearchField,
|
|
5998
|
+
{
|
|
5999
|
+
"aria-label": searchAriaLabel ?? searchPlaceholder,
|
|
6000
|
+
onChange: handleSearchChange,
|
|
6001
|
+
onClear: handleClear,
|
|
6002
|
+
placeholder: searchPlaceholder,
|
|
6003
|
+
value: search,
|
|
6004
|
+
variant: "outline"
|
|
6005
|
+
}
|
|
6006
|
+
) }),
|
|
6007
|
+
filtered.length > 0 ? /* @__PURE__ */ jsx49("div", { className: "hcsc-grid", role: "list", children: filtered.map((item, index) => /* @__PURE__ */ jsx49("div", { className: "hcsc-gridItem", role: "listitem", children: /* @__PURE__ */ jsx49(QuestionCard, { item }) }, item.id ?? `${item.question}-${index}`)) }) : /* @__PURE__ */ jsx49("p", { className: "hcsc-noResults", children: noResultsText.replace("{query}", search) })
|
|
6008
|
+
] }) });
|
|
6009
|
+
};
|
|
6010
|
+
|
|
6011
|
+
// templates/HelpCenterPage/HelpCenterPage.tsx
|
|
6012
|
+
import { useMemo as useMemo4, useState as useState18 } from "react";
|
|
6013
|
+
import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
6014
|
+
var externalLinkRel4 = (href) => href && /^https?:\/\//i.test(href) ? "noopener noreferrer" : void 0;
|
|
6015
|
+
var ChevronDownIcon5 = () => /* @__PURE__ */ jsx50("svg", { "aria-hidden": "true", fill: "none", height: "16", viewBox: "0 0 16 16", width: "16", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx50("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) });
|
|
6016
|
+
var renderBlock = (block, index) => {
|
|
6017
|
+
if (block.type === "heading") {
|
|
6018
|
+
const HeadingTag = block.level === 3 ? "h3" : "h2";
|
|
6019
|
+
return /* @__PURE__ */ jsx50(HeadingTag, { className: "hcp-blockHeading", children: block.text }, index);
|
|
6020
|
+
}
|
|
6021
|
+
if (block.type === "list") {
|
|
6022
|
+
const ListTag = block.ordered ? "ol" : "ul";
|
|
6023
|
+
return /* @__PURE__ */ jsx50(ListTag, { className: "hcp-blockList", children: (block.items ?? []).map((item, i) => /* @__PURE__ */ jsx50("li", { className: "hcp-blockListItem", children: item }, i)) }, index);
|
|
6024
|
+
}
|
|
6025
|
+
return /* @__PURE__ */ jsx50("p", { className: "hcp-blockParagraph", children: block.text }, index);
|
|
6026
|
+
};
|
|
6027
|
+
var QuestionRow = ({
|
|
6028
|
+
item,
|
|
6029
|
+
isActive,
|
|
6030
|
+
onSelect
|
|
6031
|
+
}) => {
|
|
6032
|
+
const rowClass = ["hcp-row", isActive ? "hcp-row--active" : ""].filter(Boolean).join(" ");
|
|
6033
|
+
if (item.href) {
|
|
6034
|
+
return /* @__PURE__ */ jsx50(
|
|
6035
|
+
"a",
|
|
6036
|
+
{
|
|
6037
|
+
"aria-current": isActive ? "page" : void 0,
|
|
6038
|
+
className: rowClass,
|
|
6039
|
+
href: item.href,
|
|
6040
|
+
onClick: () => {
|
|
6041
|
+
item.onClick?.();
|
|
6042
|
+
onSelect(item);
|
|
6043
|
+
},
|
|
6044
|
+
rel: externalLinkRel4(item.href),
|
|
6045
|
+
children: /* @__PURE__ */ jsx50("span", { className: "hcp-rowText", children: item.question })
|
|
6046
|
+
}
|
|
6047
|
+
);
|
|
6048
|
+
}
|
|
6049
|
+
return /* @__PURE__ */ jsx50(
|
|
6050
|
+
"button",
|
|
6051
|
+
{
|
|
6052
|
+
"aria-current": isActive ? "page" : void 0,
|
|
6053
|
+
className: rowClass,
|
|
6054
|
+
onClick: () => {
|
|
6055
|
+
item.onClick?.();
|
|
6056
|
+
onSelect(item);
|
|
6057
|
+
},
|
|
6058
|
+
type: "button",
|
|
6059
|
+
children: /* @__PURE__ */ jsx50("span", { className: "hcp-rowText", children: item.question })
|
|
6060
|
+
}
|
|
6061
|
+
);
|
|
6062
|
+
};
|
|
6063
|
+
var HelpCenterPage = ({
|
|
6064
|
+
categoryTitle,
|
|
6065
|
+
questions,
|
|
6066
|
+
activeQuestionId,
|
|
6067
|
+
defaultActiveQuestionId,
|
|
6068
|
+
onQuestionSelect,
|
|
6069
|
+
contentTitle,
|
|
6070
|
+
content,
|
|
6071
|
+
searchPlaceholder = "Search",
|
|
6072
|
+
searchAriaLabel,
|
|
6073
|
+
onSearchChange,
|
|
6074
|
+
searchNoResultsText = 'No results found for "{query}"',
|
|
6075
|
+
articlesSheetTitle = "Articles in this section",
|
|
6076
|
+
className
|
|
6077
|
+
}) => {
|
|
6078
|
+
const [search, setSearch] = useState18("");
|
|
6079
|
+
const [internalActiveId, setInternalActiveId] = useState18(defaultActiveQuestionId ?? questions[0]?.id);
|
|
6080
|
+
const [sheetOpen, setSheetOpen] = useState18(false);
|
|
6081
|
+
const isControlled = activeQuestionId !== void 0;
|
|
6082
|
+
const activeId = isControlled ? activeQuestionId : internalActiveId;
|
|
6083
|
+
const activeItem = questions.find((item) => item.id === activeId);
|
|
6084
|
+
const filtered = useMemo4(() => {
|
|
6085
|
+
const q = search.trim().toLowerCase();
|
|
6086
|
+
if (!q) return questions;
|
|
6087
|
+
return questions.filter((item) => item.question.toLowerCase().includes(q));
|
|
6088
|
+
}, [questions, search]);
|
|
6089
|
+
const handleSearchChange = (e) => {
|
|
6090
|
+
setSearch(e.target.value);
|
|
6091
|
+
onSearchChange?.(e.target.value);
|
|
6092
|
+
};
|
|
6093
|
+
const handleClear = () => {
|
|
6094
|
+
setSearch("");
|
|
6095
|
+
onSearchChange?.("");
|
|
6096
|
+
};
|
|
6097
|
+
const handleSelect = (item) => {
|
|
6098
|
+
if (!isControlled) setInternalActiveId(item.id);
|
|
6099
|
+
onQuestionSelect?.(item.id);
|
|
6100
|
+
setSheetOpen(false);
|
|
6101
|
+
};
|
|
6102
|
+
const resolvedTitle = activeItem?.content ? activeItem.contentTitle ?? contentTitle : contentTitle;
|
|
6103
|
+
const resolvedContent = activeItem?.content ?? content;
|
|
6104
|
+
const rootClass = ["hcp-section", className ?? ""].filter(Boolean).join(" ");
|
|
6105
|
+
return /* @__PURE__ */ jsxs46("section", { className: rootClass, children: [
|
|
6106
|
+
/* @__PURE__ */ jsxs46("div", { className: "hcp-container", children: [
|
|
6107
|
+
/* @__PURE__ */ jsx50("div", { className: "hcp-searchWrap", children: /* @__PURE__ */ jsx50(
|
|
6108
|
+
SearchField,
|
|
6109
|
+
{
|
|
6110
|
+
"aria-label": searchAriaLabel ?? searchPlaceholder,
|
|
6111
|
+
onChange: handleSearchChange,
|
|
6112
|
+
onClear: handleClear,
|
|
6113
|
+
placeholder: searchPlaceholder,
|
|
6114
|
+
value: search,
|
|
6115
|
+
variant: "outline"
|
|
6116
|
+
}
|
|
6117
|
+
) }),
|
|
6118
|
+
/* @__PURE__ */ jsxs46("div", { className: "hcp-body", children: [
|
|
6119
|
+
/* @__PURE__ */ jsx50("aside", { className: "hcp-sidebar", children: /* @__PURE__ */ jsxs46("div", { className: "hcp-sidebarCard", children: [
|
|
6120
|
+
/* @__PURE__ */ jsx50("h2", { className: "hcp-sidebarTitle", children: categoryTitle }),
|
|
6121
|
+
filtered.length > 0 ? /* @__PURE__ */ jsx50("div", { className: "hcp-list", role: "list", children: filtered.map((item) => /* @__PURE__ */ jsx50("div", { className: "hcp-listItem", role: "listitem", children: /* @__PURE__ */ jsx50(QuestionRow, { isActive: item.id === activeId, item, onSelect: handleSelect }) }, item.id)) }) : /* @__PURE__ */ jsx50("p", { className: "hcp-noResults", children: searchNoResultsText.replace("{query}", search) })
|
|
6122
|
+
] }) }),
|
|
6123
|
+
/* @__PURE__ */ jsxs46(
|
|
6124
|
+
"button",
|
|
6125
|
+
{
|
|
6126
|
+
"aria-expanded": sheetOpen,
|
|
6127
|
+
className: "hcp-mobileToggle",
|
|
6128
|
+
onClick: () => setSheetOpen(true),
|
|
6129
|
+
type: "button",
|
|
6130
|
+
children: [
|
|
6131
|
+
/* @__PURE__ */ jsx50("span", { className: "hcp-mobileToggleLabel", children: categoryTitle }),
|
|
6132
|
+
/* @__PURE__ */ jsx50("span", { className: "hcp-mobileToggleChevron", children: /* @__PURE__ */ jsx50(ChevronDownIcon5, {}) })
|
|
6133
|
+
]
|
|
6134
|
+
}
|
|
6135
|
+
),
|
|
6136
|
+
/* @__PURE__ */ jsxs46("div", { className: "hcp-content", children: [
|
|
6137
|
+
/* @__PURE__ */ jsx50("h1", { className: "hcp-contentTitle", children: resolvedTitle }),
|
|
6138
|
+
/* @__PURE__ */ jsx50("div", { className: "hcp-contentBody", children: resolvedContent.map(renderBlock) })
|
|
6139
|
+
] })
|
|
6140
|
+
] })
|
|
6141
|
+
] }),
|
|
6142
|
+
/* @__PURE__ */ jsx50(BottomSheet, { onClose: () => setSheetOpen(false), open: sheetOpen, title: articlesSheetTitle, children: filtered.length > 0 ? /* @__PURE__ */ jsx50("div", { className: "hcp-sheetList", role: "list", children: filtered.map((item) => /* @__PURE__ */ jsx50("div", { className: "hcp-sheetItem", role: "listitem", children: /* @__PURE__ */ jsx50(QuestionRow, { isActive: item.id === activeId, item, onSelect: handleSelect }) }, item.id)) }) : /* @__PURE__ */ jsx50("p", { className: "hcp-noResults", children: searchNoResultsText.replace("{query}", search) }) })
|
|
6143
|
+
] });
|
|
6144
|
+
};
|
|
5584
6145
|
export {
|
|
5585
6146
|
AVATAR_DATA,
|
|
5586
6147
|
Accordion,
|
|
@@ -5592,16 +6153,21 @@ export {
|
|
|
5592
6153
|
Button,
|
|
5593
6154
|
COL_ONE_LOGOS,
|
|
5594
6155
|
COL_TWO_LOGOS,
|
|
6156
|
+
CORAL_BANNER_DERIV_SLIDES,
|
|
5595
6157
|
CTABanner,
|
|
5596
6158
|
Card,
|
|
5597
6159
|
Chip,
|
|
5598
6160
|
ChipDropdown,
|
|
6161
|
+
CoralBanner,
|
|
6162
|
+
DEFAULT_AWARDS,
|
|
5599
6163
|
DayNightTransition,
|
|
5600
6164
|
DotLottieInView,
|
|
5601
6165
|
DownloadBadge,
|
|
5602
6166
|
DownloadBanner,
|
|
6167
|
+
FEATURE_AWARDS_TEXT_CONTENT,
|
|
5603
6168
|
FEATURE_SCROLL_DATA,
|
|
5604
6169
|
FaqAccordion,
|
|
6170
|
+
FeatureAwards,
|
|
5605
6171
|
FeatureBullets,
|
|
5606
6172
|
FeatureCards,
|
|
5607
6173
|
FeatureCardsIcon,
|
|
@@ -5609,6 +6175,9 @@ export {
|
|
|
5609
6175
|
FeatureSplit,
|
|
5610
6176
|
Footer,
|
|
5611
6177
|
Header,
|
|
6178
|
+
HelpCenterPage,
|
|
6179
|
+
HelpCentreCategories,
|
|
6180
|
+
HelpCentreSubCategories,
|
|
5612
6181
|
Hero,
|
|
5613
6182
|
ImageBanner,
|
|
5614
6183
|
Leaders,
|