@transferwise/components 46.31.0 → 46.32.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/build/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, Component, useCallback, createContext, useContext, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
2
+ import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
3
3
  import { useId } from '@radix-ui/react-id';
4
4
  import classNames from 'classnames';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
- import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, AlertCircleFill, ArrowLeft, AlertCircle, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle } from '@transferwise/icons';
6
+ import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, ArrowLeft, AlertCircle, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle } from '@transferwise/icons';
7
7
  import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
8
8
  import PropTypes from 'prop-types';
9
9
  import commonmark from 'commonmark';
@@ -1480,7 +1480,717 @@ const Button = /*#__PURE__*/forwardRef(({
1480
1480
  });
1481
1481
  });
1482
1482
 
1483
- const Card$1 = /*#__PURE__*/forwardRef((props, reference) => {
1483
+ const Card$2 = /*#__PURE__*/forwardRef(({
1484
+ className,
1485
+ children = null,
1486
+ id,
1487
+ isDisabled = false,
1488
+ isSmall = false,
1489
+ onDismiss,
1490
+ testId,
1491
+ ...props
1492
+ }, ref) => {
1493
+ const closeButtonReference = useRef(null);
1494
+ return /*#__PURE__*/jsxs("div", {
1495
+ ref: ref,
1496
+ className: classNames('np-Card', {
1497
+ 'np-Card--small': !!isSmall,
1498
+ 'is-disabled': !!isDisabled
1499
+ }, className),
1500
+ id: id,
1501
+ "data-testid": testId,
1502
+ ...props,
1503
+ children: [onDismiss && /*#__PURE__*/jsx(CloseButton, {
1504
+ ref: closeButtonReference,
1505
+ className: "np-Card-closeButton",
1506
+ size: isSmall ? 'sm' : 'md',
1507
+ isDisabled: isDisabled,
1508
+ testId: "close-button",
1509
+ onClick: e => {
1510
+ stopPropagation$1(e);
1511
+ onDismiss();
1512
+ }
1513
+ }), children]
1514
+ });
1515
+ });
1516
+ Card$2.displayName = 'Card';
1517
+
1518
+ function Display({
1519
+ as: Heading = 'h1',
1520
+ type = Typography.DISPLAY_LARGE,
1521
+ children,
1522
+ className,
1523
+ id
1524
+ }) {
1525
+ return /*#__PURE__*/jsx(Heading, {
1526
+ id: id,
1527
+ className: classNames(`np-text-${type}`, 'text-primary', className),
1528
+ children: children
1529
+ });
1530
+ }
1531
+
1532
+ const useConditionalListener = ({
1533
+ attachListener,
1534
+ callback,
1535
+ eventType,
1536
+ parent
1537
+ }) => {
1538
+ useEffect(() => {
1539
+ if (attachListener && !isUndefined(parent)) {
1540
+ parent.addEventListener(eventType, callback, true);
1541
+ }
1542
+ return () => {
1543
+ if (!isUndefined(parent)) {
1544
+ parent.removeEventListener(eventType, callback, true);
1545
+ }
1546
+ };
1547
+ }, [attachListener, callback, eventType, parent]);
1548
+ };
1549
+
1550
+ const DirectionContext = /*#__PURE__*/createContext(Direction.LTR);
1551
+ const DirectionProvider = ({
1552
+ direction,
1553
+ children
1554
+ }) => {
1555
+ return /*#__PURE__*/jsx(DirectionContext.Provider, {
1556
+ value: direction,
1557
+ children: children
1558
+ });
1559
+ };
1560
+
1561
+ const useDirection = () => {
1562
+ const direction = useContext(DirectionContext);
1563
+ return {
1564
+ direction,
1565
+ isRTL: direction === 'rtl'
1566
+ };
1567
+ };
1568
+
1569
+ const ObserverParams = {
1570
+ threshold: 0.1
1571
+ };
1572
+
1573
+ /**
1574
+ * useHasIntersected.
1575
+ * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
1576
+ * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
1577
+ *
1578
+ * @param elRef.elRef
1579
+ * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
1580
+ * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
1581
+ * @param elRef.loading
1582
+ * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
1583
+ */
1584
+ const useHasIntersected = ({
1585
+ elRef,
1586
+ loading
1587
+ }) => {
1588
+ const [hasIntersected, setHasIntersected] = useState(false);
1589
+ const {
1590
+ current
1591
+ } = elRef || {};
1592
+ const isValidReference = () => {
1593
+ return elRef && current;
1594
+ };
1595
+ const handleOnIntersect = (entries, observer) => {
1596
+ entries.forEach(entry => {
1597
+ if (entry.isIntersecting) {
1598
+ setHasIntersected(true);
1599
+ observer.unobserve(current);
1600
+ }
1601
+ });
1602
+ };
1603
+ useEffect(() => {
1604
+ let observer;
1605
+ let didCancel = false;
1606
+
1607
+ // Check if window is define for SSR and Old browsers fallback
1608
+ if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
1609
+ setHasIntersected(true);
1610
+ } else if (!didCancel) {
1611
+ observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
1612
+ observer.observe(current);
1613
+ }
1614
+ return () => {
1615
+ didCancel = true;
1616
+ if (observer) {
1617
+ observer.unobserve(current);
1618
+ }
1619
+ };
1620
+ }, [elRef]);
1621
+ if (loading === 'eager') {
1622
+ return [false];
1623
+ }
1624
+ return [hasIntersected];
1625
+ };
1626
+
1627
+ // eslint-disable-next-line import/extensions
1628
+ function useMedia(query) {
1629
+ return useSyncExternalStore(onStoreChange => {
1630
+ const mediaQueryList = window.matchMedia(query);
1631
+ mediaQueryList.addEventListener('change', onStoreChange);
1632
+ return () => {
1633
+ mediaQueryList.removeEventListener('change', onStoreChange);
1634
+ };
1635
+ }, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
1636
+ }
1637
+
1638
+ function useScreenSize(size) {
1639
+ return useMedia(`(min-width: ${size}px)`);
1640
+ }
1641
+
1642
+ /**
1643
+ * @deprecated Prefer `useScreenSize` instead.
1644
+ */
1645
+ const useLayout = () => {
1646
+ const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);
1647
+ const screenSm = useScreenSize(Breakpoint.SMALL);
1648
+ const screenMd = useScreenSize(Breakpoint.MEDIUM);
1649
+ const screenLg = useScreenSize(Breakpoint.LARGE);
1650
+ const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);
1651
+ return {
1652
+ isMobile: screenSm != null ? !screenSm : undefined,
1653
+ isExtraSmall: screenXs,
1654
+ isSmall: screenSm,
1655
+ isMedium: screenMd,
1656
+ isLarge: screenLg,
1657
+ isExtraLarge: screenXl
1658
+ };
1659
+ };
1660
+
1661
+ const EmptyTransparentImage = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
1662
+ const Image = ({
1663
+ id,
1664
+ src,
1665
+ alt,
1666
+ onLoad,
1667
+ onError,
1668
+ className,
1669
+ loading,
1670
+ stretch = true,
1671
+ role,
1672
+ shrink = true
1673
+ }) => {
1674
+ const elementReference = useRef(null);
1675
+ const [hasIntersected] = useHasIntersected({
1676
+ elRef: elementReference,
1677
+ loading
1678
+ });
1679
+ let imageSource = src;
1680
+ let imageOnLoad = onLoad;
1681
+ if (loading === 'lazy' && !hasIntersected) {
1682
+ imageSource = EmptyTransparentImage;
1683
+ imageOnLoad = undefined;
1684
+ }
1685
+ return /*#__PURE__*/jsx("img", {
1686
+ ref: elementReference,
1687
+ id: id,
1688
+ alt: alt,
1689
+ src: imageSource,
1690
+ className: classNames(['tw-image', {
1691
+ 'tw-image__stretch': stretch,
1692
+ 'tw-image__shrink': shrink
1693
+ }, className]),
1694
+ role: role,
1695
+ onLoad: imageOnLoad,
1696
+ onError: onError
1697
+ });
1698
+ };
1699
+
1700
+ const defaultPromoCardContext = {
1701
+ state: '',
1702
+ isDisabled: false,
1703
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1704
+ onChange: () => {}
1705
+ };
1706
+ /**
1707
+ * The PromoCard context object.
1708
+ */
1709
+ const PromoCardContext = /*#__PURE__*/createContext(defaultPromoCardContext);
1710
+ /**
1711
+ * A custom hook for accessing the PromoCard context object.
1712
+ *
1713
+ * The `usePromoCardContext` hook is used to access the PromoCard context object
1714
+ * from within a child PromoCard component. It throws an error if the context
1715
+ * object is not available, which can help with debugging and development.
1716
+ *
1717
+ * @returns {PromoCardContextType} - The PromoCard context object.
1718
+ */
1719
+ const usePromoCardContext = () => {
1720
+ return useContext(PromoCardContext);
1721
+ };
1722
+
1723
+ const PromoCardIndicator = ({
1724
+ className,
1725
+ children,
1726
+ label,
1727
+ icon,
1728
+ isSmall = false,
1729
+ testid,
1730
+ ...rest
1731
+ }) => {
1732
+ const isIconString = icon && typeof icon === 'string';
1733
+ const IconComponent = isIconString && {
1734
+ check: Check,
1735
+ arrow: ArrowRight,
1736
+ download: Download
1737
+ }[icon];
1738
+ return /*#__PURE__*/jsxs("div", {
1739
+ className: classNames('np-Card-indicator', className),
1740
+ "data-testid": testid,
1741
+ ...rest,
1742
+ children: [label && /*#__PURE__*/jsx(Body, {
1743
+ as: "span",
1744
+ type: Typography.BODY_LARGE_BOLD,
1745
+ className: "np-Card-indicatorText",
1746
+ children: label
1747
+ }), icon && /*#__PURE__*/jsx(Avatar, {
1748
+ type: AvatarType.ICON,
1749
+ size: isSmall ? 40 : 56,
1750
+ backgroundColor: "var(--Card-indicator-icon-background-color)",
1751
+ className: "np-Card-indicatorIcon",
1752
+ children: IconComponent ? /*#__PURE__*/jsx(IconComponent, {
1753
+ size: 24,
1754
+ "aria-hidden": "true"
1755
+ }) : icon
1756
+ }), children]
1757
+ });
1758
+ };
1759
+
1760
+ const PromoCard = /*#__PURE__*/forwardRef(({
1761
+ className,
1762
+ description,
1763
+ defaultChecked,
1764
+ download,
1765
+ href,
1766
+ hrefLang,
1767
+ id,
1768
+ headingLevel = 'h3',
1769
+ imageAlt,
1770
+ imageClass,
1771
+ imageSource,
1772
+ indicatorLabel,
1773
+ indicatorIcon,
1774
+ isChecked,
1775
+ isDisabled,
1776
+ onClick,
1777
+ onKeyDown,
1778
+ rel,
1779
+ tabIndex,
1780
+ target,
1781
+ testId,
1782
+ title,
1783
+ type,
1784
+ value,
1785
+ isSmall,
1786
+ useDisplayFont = true,
1787
+ anchorRef,
1788
+ anchorId,
1789
+ ...props
1790
+ }, ref) => {
1791
+ // Set the `checked` state to the value of `defaultChecked` if it is truthy,
1792
+ // or the value of `isChecked` if it is truthy, or `false` if neither
1793
+ // is truthy.
1794
+ const {
1795
+ state,
1796
+ onChange,
1797
+ isDisabled: contextIsDisabled
1798
+ } = usePromoCardContext();
1799
+ const [checked, setChecked] = useState(type === 'checkbox' ? defaultChecked ?? isChecked ?? false : false);
1800
+ const handleClick = () => {
1801
+ if (type === 'radio') {
1802
+ onChange(value || ''); // Update the context state for radio
1803
+ } else if (type === 'checkbox') {
1804
+ setChecked(!checked); // Update local state for checkbox
1805
+ }
1806
+ };
1807
+ const fallbackId = useId();
1808
+ const componentId = id || fallbackId;
1809
+ // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
1810
+ // `'download'` if `download` is truthy. If neither condition is true, set
1811
+ // `icon` to `undefined`.
1812
+ // Create a function to get icon type
1813
+ const getIconType = () => {
1814
+ if (indicatorIcon) {
1815
+ return indicatorIcon;
1816
+ }
1817
+ if (download) {
1818
+ return 'download';
1819
+ }
1820
+ if (href && !type) {
1821
+ return 'arrow';
1822
+ }
1823
+ return undefined;
1824
+ };
1825
+ // Define all class names string based on the values of the `href`, `type`,
1826
+ // `checked`, and `className` props.
1827
+ const commonClasses = classNames({
1828
+ 'np-Card--promoCard': true,
1829
+ 'np-Card--checked': !href && type,
1830
+ 'np-Card--link': href && !type,
1831
+ 'is-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined
1832
+ }, className);
1833
+ // Object with common props that will be passed to the `Card` components
1834
+ const commonProps = {
1835
+ className: commonClasses,
1836
+ id: componentId,
1837
+ isDisabled: isDisabled || contextIsDisabled,
1838
+ onClick,
1839
+ onKeyDown,
1840
+ ref,
1841
+ 'data-testid': testId,
1842
+ isSmall
1843
+ };
1844
+ // Object with Anchor props that will be passed to the `a` element. These
1845
+ // won't be refurned if set to `isDisabled`
1846
+ const anchorProps = href && !isDisabled ? {
1847
+ download,
1848
+ href: href || undefined,
1849
+ hrefLang,
1850
+ rel,
1851
+ target,
1852
+ ref: anchorRef,
1853
+ id: anchorId
1854
+ } : {};
1855
+ // Object of all Checked props that will be passed to the root `Card` component
1856
+ const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
1857
+ ...commonProps,
1858
+ 'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
1859
+ 'aria-describedby': `${componentId}-title`,
1860
+ 'aria-disabled': isDisabled,
1861
+ 'data-value': value ?? undefined,
1862
+ role: type === 'checkbox' || type === 'radio' ? type : undefined,
1863
+ onClick: handleClick,
1864
+ onKeyDown: event => {
1865
+ if (event.key === 'Enter' || event.key === ' ') {
1866
+ handleClick();
1867
+ }
1868
+ },
1869
+ ref,
1870
+ tabIndex: 0
1871
+ } : {};
1872
+ const getTitle = () => {
1873
+ const titleContent = href && !type ? /*#__PURE__*/jsx("a", {
1874
+ className: "np-Card-titleLink",
1875
+ ...anchorProps,
1876
+ children: title
1877
+ }) : title;
1878
+ const titleProps = {
1879
+ id: `${componentId}-title`,
1880
+ as: headingLevel,
1881
+ className: 'np-Card-title'
1882
+ };
1883
+ return useDisplayFont ? /*#__PURE__*/jsx(Display, {
1884
+ type: Typography.DISPLAY_SMALL,
1885
+ ...titleProps,
1886
+ children: titleContent
1887
+ }) : /*#__PURE__*/jsx(Title, {
1888
+ type: Typography.TITLE_SUBSECTION,
1889
+ ...titleProps,
1890
+ children: titleContent
1891
+ });
1892
+ };
1893
+ useEffect(() => {
1894
+ setChecked(defaultChecked ?? isChecked ?? false);
1895
+ }, [defaultChecked, isChecked]);
1896
+ return /*#__PURE__*/jsxs(Card$2, {
1897
+ ...commonProps,
1898
+ ...checkedProps,
1899
+ ...props,
1900
+ children: [(value === state || checked) && /*#__PURE__*/jsx("span", {
1901
+ className: "np-Card-check",
1902
+ children: /*#__PURE__*/jsx(Check, {
1903
+ size: 24,
1904
+ "aria-hidden": "true"
1905
+ })
1906
+ }), getTitle(), /*#__PURE__*/jsx(Body, {
1907
+ className: "np-Card-description",
1908
+ children: description
1909
+ }), imageSource && /*#__PURE__*/jsx("div", {
1910
+ className: classNames('np-Card-image', {
1911
+ imageClass
1912
+ }),
1913
+ children: /*#__PURE__*/jsx(Image, {
1914
+ src: imageSource,
1915
+ alt: imageAlt || '',
1916
+ loading: "lazy"
1917
+ })
1918
+ }), /*#__PURE__*/jsx(PromoCardIndicator, {
1919
+ label: indicatorLabel,
1920
+ icon: getIconType(),
1921
+ isSmall: isSmall
1922
+ })]
1923
+ });
1924
+ });
1925
+ var PromoCard$1 = /*#__PURE__*/React__default.memo(PromoCard);
1926
+
1927
+ const LEFT_SCROLL_OFFSET = 8;
1928
+ const Carousel = ({
1929
+ header,
1930
+ className,
1931
+ cards,
1932
+ onClick
1933
+ }) => {
1934
+ const [scrollPosition, setScrollPosition] = useState(0);
1935
+ const [previousScrollPosition, setPreviousScrollPosition] = useState(0);
1936
+ const [scrollIsAtEnd, setScrollIsAtEnd] = useState(false);
1937
+ const [visibleCardOnMobileView, setVisibleCardOnMobileView] = useState('');
1938
+ const carouselElementRef = useRef(null);
1939
+ const carouselCardsRef = useRef([]);
1940
+ const isLeftActionButtonEnabled = scrollPosition > LEFT_SCROLL_OFFSET;
1941
+ const areActionButtonsEnabled = isLeftActionButtonEnabled || !scrollIsAtEnd;
1942
+ const [focusedCard, setFocusedCard] = useState(cards?.[0]?.id);
1943
+ const updateScrollButtonsState = () => {
1944
+ if (carouselElementRef.current) {
1945
+ const {
1946
+ scrollWidth,
1947
+ offsetWidth
1948
+ } = carouselElementRef.current;
1949
+ const scrollAtEnd = scrollWidth - offsetWidth <= scrollPosition + LEFT_SCROLL_OFFSET;
1950
+ setScrollIsAtEnd(scrollAtEnd);
1951
+ }
1952
+ const scrollDirecton = scrollPosition > previousScrollPosition ? 'right' : 'left';
1953
+ const cardsInFullViewIds = [];
1954
+ carouselCardsRef.current.forEach(card => {
1955
+ if (isVisible(carouselElementRef.current, card.cardElement)) {
1956
+ // eslint-disable-next-line functional/immutable-data
1957
+ cardsInFullViewIds.push(card.cardElement.getAttribute('id') ?? '');
1958
+ }
1959
+ });
1960
+ if (cardsInFullViewIds.length >= 1) {
1961
+ const visibleCardIndex = scrollDirecton === 'right' ? cardsInFullViewIds.length - 1 : 0;
1962
+ const visibleCardId = cardsInFullViewIds[visibleCardIndex];
1963
+ setVisibleCardOnMobileView(visibleCardId);
1964
+ setFocusedCard(visibleCardId);
1965
+ }
1966
+ setPreviousScrollPosition(scrollPosition);
1967
+ };
1968
+ const scrollCarousel = (direction = 'right') => {
1969
+ if (carouselElementRef.current) {
1970
+ const {
1971
+ scrollWidth
1972
+ } = carouselElementRef.current;
1973
+ const cardWidth = scrollWidth / carouselCardsRef.current.length;
1974
+ const res = Math.floor(cardWidth - cardWidth * 0.05);
1975
+ carouselElementRef.current.scrollBy({
1976
+ left: direction === 'right' ? res : -res,
1977
+ behavior: 'smooth'
1978
+ });
1979
+ }
1980
+ };
1981
+ const handleOnKeyDown = (event, index) => {
1982
+ if (event.key === 'ArrowRight' || event.key === 'ArrowLeft') {
1983
+ const nextIndex = event.key === 'ArrowRight' ? index + 1 : index - 1;
1984
+ const nextCard = cards[nextIndex];
1985
+ if (nextCard) {
1986
+ const ref = carouselCardsRef.current[nextIndex];
1987
+ if (ref.type === 'promo') {
1988
+ ref.anchorElement?.focus();
1989
+ } else {
1990
+ ref.cardElement?.focus();
1991
+ }
1992
+ scrollCardIntoView(carouselCardsRef.current[nextIndex].cardElement, nextCard);
1993
+ event.preventDefault();
1994
+ }
1995
+ }
1996
+ if (event.key === 'Enter' || event.key === ' ') {
1997
+ event.currentTarget.click();
1998
+ }
1999
+ };
2000
+ const scrollCardIntoView = (element, card) => {
2001
+ element.scrollIntoView({
2002
+ behavior: 'smooth',
2003
+ block: 'nearest',
2004
+ inline: 'center'
2005
+ });
2006
+ setFocusedCard(card.id);
2007
+ };
2008
+ useEffect(() => {
2009
+ updateScrollButtonsState();
2010
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2011
+ }, [scrollPosition]);
2012
+ useEffect(() => {
2013
+ window.addEventListener('resize', updateScrollButtonsState);
2014
+ return () => {
2015
+ window.removeEventListener('resize', updateScrollButtonsState);
2016
+ };
2017
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2018
+ }, []);
2019
+ const addElementToCardsRefArray = (index, ref) => {
2020
+ if (ref) {
2021
+ // eslint-disable-next-line functional/immutable-data
2022
+ carouselCardsRef.current[index] = {
2023
+ type: ref.type ?? carouselCardsRef.current?.[index]?.type,
2024
+ cardElement: ref.cardElement ?? carouselCardsRef.current?.[index]?.cardElement,
2025
+ anchorElement: ref.anchorElement ?? carouselCardsRef.current?.[index]?.anchorElement
2026
+ };
2027
+ }
2028
+ };
2029
+ return /*#__PURE__*/jsxs("div", {
2030
+ className: classNames('carousel-wrapper', className),
2031
+ children: [/*#__PURE__*/jsxs("div", {
2032
+ className: "d-flex justify-content-between carousel__header",
2033
+ children: [typeof header === 'string' ? /*#__PURE__*/jsx(Title, {
2034
+ as: "span",
2035
+ type: "title-body",
2036
+ children: header
2037
+ }) : header, areActionButtonsEnabled ? /*#__PURE__*/jsxs("div", {
2038
+ className: "hidden-xs",
2039
+ children: [/*#__PURE__*/jsx(ActionButton, {
2040
+ className: "carousel__scroll-button",
2041
+ tabIndex: -1,
2042
+ priority: "secondary",
2043
+ disabled: !isLeftActionButtonEnabled,
2044
+ "aria-hidden": "true",
2045
+ "data-testid": "scroll-carousel-left",
2046
+ onClick: () => scrollCarousel('left'),
2047
+ children: /*#__PURE__*/jsx(ChevronLeft, {})
2048
+ }), /*#__PURE__*/jsx(ActionButton, {
2049
+ tabIndex: -1,
2050
+ className: "carousel__scroll-button m-l-1",
2051
+ priority: "secondary",
2052
+ "aria-hidden": "true",
2053
+ "data-testid": "scroll-carousel-right",
2054
+ disabled: scrollIsAtEnd,
2055
+ onClick: () => scrollCarousel(),
2056
+ children: /*#__PURE__*/jsx(ChevronRight, {})
2057
+ })]
2058
+ }) : null]
2059
+ }), /*#__PURE__*/jsx("div", {
2060
+ ref: carouselElementRef,
2061
+ tabIndex: -1,
2062
+ role: "list",
2063
+ className: "carousel",
2064
+ onScroll: event => {
2065
+ const target = event.target;
2066
+ setScrollPosition(target.scrollLeft);
2067
+ },
2068
+ children: cards?.map((card, index) => {
2069
+ const sharedProps = {
2070
+ id: card.id,
2071
+ className: classNames('carousel__card', {
2072
+ 'carousel__card--focused': card.id === focusedCard
2073
+ }),
2074
+ onClick: () => {
2075
+ card.onClick?.();
2076
+ onClick?.(card.id);
2077
+ },
2078
+ onFocus: event => {
2079
+ scrollCardIntoView(event.currentTarget, card);
2080
+ }
2081
+ };
2082
+ const cardContent = card.type !== 'promo' ? /*#__PURE__*/jsx("div", {
2083
+ id: `${card.id}-content`,
2084
+ className: classNames('carousel__card-content', {
2085
+ [card.className ?? '']: !!card.className
2086
+ })
2087
+ // eslint-disable-next-line react/forbid-dom-props
2088
+ ,
2089
+ style: card.styles,
2090
+ children: card.content
2091
+ }) : null;
2092
+ if (card.type === 'button') {
2093
+ return /*#__PURE__*/jsx("div", {
2094
+ "aria-labelledby": `${card.id}-content`,
2095
+ role: "listitem",
2096
+ children: /*#__PURE__*/jsx("div", {
2097
+ ...sharedProps,
2098
+ ref: el => {
2099
+ if (el) {
2100
+ // eslint-disable-next-line functional/immutable-data
2101
+ carouselCardsRef.current[index] = {
2102
+ type: 'default',
2103
+ cardElement: el
2104
+ };
2105
+ }
2106
+ },
2107
+ role: "button",
2108
+ tabIndex: 0,
2109
+ onKeyDown: event => handleOnKeyDown(event, index),
2110
+ children: cardContent
2111
+ })
2112
+ }, card.id);
2113
+ }
2114
+ if (card.type === 'promo') {
2115
+ return /*#__PURE__*/jsx("div", {
2116
+ id: card.id,
2117
+ role: "listitem",
2118
+ "aria-labelledby": `${card.id}-anchor`,
2119
+ children: /*#__PURE__*/jsx(PromoCard$1, {
2120
+ ...card,
2121
+ type: undefined,
2122
+ ...sharedProps,
2123
+ ref: el => {
2124
+ if (el) {
2125
+ addElementToCardsRefArray(index, {
2126
+ type: 'promo',
2127
+ cardElement: el
2128
+ });
2129
+ }
2130
+ },
2131
+ anchorRef: el => {
2132
+ if (el) {
2133
+ addElementToCardsRefArray(index, {
2134
+ type: 'promo',
2135
+ anchorElement: el
2136
+ });
2137
+ }
2138
+ },
2139
+ anchorId: `${card.id}-anchor`,
2140
+ onKeyDown: event => handleOnKeyDown(event, index)
2141
+ })
2142
+ }, card.id);
2143
+ }
2144
+ return /*#__PURE__*/jsx("div", {
2145
+ "aria-labelledby": `${card.id}-content`,
2146
+ role: "listitem",
2147
+ children: /*#__PURE__*/jsx("a", {
2148
+ ...sharedProps,
2149
+ ref: el => {
2150
+ if (el) {
2151
+ // eslint-disable-next-line functional/immutable-data
2152
+ carouselCardsRef.current[index] = {
2153
+ type: 'default',
2154
+ cardElement: el
2155
+ };
2156
+ }
2157
+ },
2158
+ href: card.href,
2159
+ rel: "noreferrer",
2160
+ onKeyDown: event => handleOnKeyDown(event, index),
2161
+ children: cardContent
2162
+ })
2163
+ }, card.id);
2164
+ })
2165
+ }), /*#__PURE__*/jsx("div", {
2166
+ className: "visible-xs",
2167
+ children: /*#__PURE__*/jsx("div", {
2168
+ className: "carousel__indicators",
2169
+ children: cards?.map((card, index) => /*#__PURE__*/jsx("button", {
2170
+ "data-testid": `${card.id}-indicator`,
2171
+ tabIndex: -1,
2172
+ "aria-hidden": true,
2173
+ type: "button",
2174
+ className: classNames('carousel__indicator', {
2175
+ 'carousel__indicator--selected': card.id === visibleCardOnMobileView
2176
+ }),
2177
+ onClick: () => {
2178
+ scrollCardIntoView(carouselCardsRef.current[index].cardElement, card);
2179
+ }
2180
+ }, `${card.id}-indicator`))
2181
+ })
2182
+ })]
2183
+ });
2184
+ };
2185
+ const isVisible = (container, el) => {
2186
+ const cWidth = container.offsetWidth;
2187
+ const cScrollOffset = container.scrollLeft;
2188
+ const elemLeft = el.offsetLeft - container.offsetLeft;
2189
+ const elemRight = elemLeft + el.offsetWidth;
2190
+ return elemLeft >= cScrollOffset && elemRight <= cScrollOffset + cWidth;
2191
+ };
2192
+
2193
+ const Card = /*#__PURE__*/forwardRef((props, reference) => {
1484
2194
  const {
1485
2195
  'aria-label': ariaLabel,
1486
2196
  as: Element,
@@ -1531,7 +2241,7 @@ const Card$1 = /*#__PURE__*/forwardRef((props, reference) => {
1531
2241
  const hasChildren = ({
1532
2242
  children
1533
2243
  }) => children;
1534
- Card$1.propTypes = {
2244
+ Card.propTypes = {
1535
2245
  'aria-label': PropTypes.string,
1536
2246
  as: PropTypes.string,
1537
2247
  isExpanded: requiredIf(PropTypes.bool, hasChildren),
@@ -1544,7 +2254,7 @@ Card$1.propTypes = {
1544
2254
  className: PropTypes.string,
1545
2255
  'data-testid': PropTypes.string
1546
2256
  };
1547
- Card$1.defaultProps = {
2257
+ Card.defaultProps = {
1548
2258
  'aria-label': undefined,
1549
2259
  as: 'div',
1550
2260
  children: null,
@@ -1552,7 +2262,7 @@ Card$1.defaultProps = {
1552
2262
  className: null,
1553
2263
  'data-testid': null
1554
2264
  };
1555
- var Card$2 = Card$1;
2265
+ var Card$1 = Card;
1556
2266
 
1557
2267
  const CheckboxButton = /*#__PURE__*/forwardRef(({
1558
2268
  checked,
@@ -2038,135 +2748,6 @@ const DimmerContentWrapper = ({
2038
2748
  };
2039
2749
  var Dimmer$1 = withNextPortalWrapper(Dimmer);
2040
2750
 
2041
- const useConditionalListener = ({
2042
- attachListener,
2043
- callback,
2044
- eventType,
2045
- parent
2046
- }) => {
2047
- useEffect(() => {
2048
- if (attachListener && !isUndefined(parent)) {
2049
- parent.addEventListener(eventType, callback, true);
2050
- }
2051
- return () => {
2052
- if (!isUndefined(parent)) {
2053
- parent.removeEventListener(eventType, callback, true);
2054
- }
2055
- };
2056
- }, [attachListener, callback, eventType, parent]);
2057
- };
2058
-
2059
- const DirectionContext = /*#__PURE__*/createContext(Direction.LTR);
2060
- const DirectionProvider = ({
2061
- direction,
2062
- children
2063
- }) => {
2064
- return /*#__PURE__*/jsx(DirectionContext.Provider, {
2065
- value: direction,
2066
- children: children
2067
- });
2068
- };
2069
-
2070
- const useDirection = () => {
2071
- const direction = useContext(DirectionContext);
2072
- return {
2073
- direction,
2074
- isRTL: direction === 'rtl'
2075
- };
2076
- };
2077
-
2078
- const ObserverParams = {
2079
- threshold: 0.1
2080
- };
2081
-
2082
- /**
2083
- * useHasIntersected.
2084
- * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
2085
- * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
2086
- *
2087
- * @param elRef.elRef
2088
- * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
2089
- * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
2090
- * @param elRef.loading
2091
- * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
2092
- */
2093
- const useHasIntersected = ({
2094
- elRef,
2095
- loading
2096
- }) => {
2097
- const [hasIntersected, setHasIntersected] = useState(false);
2098
- const {
2099
- current
2100
- } = elRef || {};
2101
- const isValidReference = () => {
2102
- return elRef && current;
2103
- };
2104
- const handleOnIntersect = (entries, observer) => {
2105
- entries.forEach(entry => {
2106
- if (entry.isIntersecting) {
2107
- setHasIntersected(true);
2108
- observer.unobserve(current);
2109
- }
2110
- });
2111
- };
2112
- useEffect(() => {
2113
- let observer;
2114
- let didCancel = false;
2115
-
2116
- // Check if window is define for SSR and Old browsers fallback
2117
- if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
2118
- setHasIntersected(true);
2119
- } else if (!didCancel) {
2120
- observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
2121
- observer.observe(current);
2122
- }
2123
- return () => {
2124
- didCancel = true;
2125
- if (observer) {
2126
- observer.unobserve(current);
2127
- }
2128
- };
2129
- }, [elRef]);
2130
- if (loading === 'eager') {
2131
- return [false];
2132
- }
2133
- return [hasIntersected];
2134
- };
2135
-
2136
- // eslint-disable-next-line import/extensions
2137
- function useMedia(query) {
2138
- return useSyncExternalStore(onStoreChange => {
2139
- const mediaQueryList = window.matchMedia(query);
2140
- mediaQueryList.addEventListener('change', onStoreChange);
2141
- return () => {
2142
- mediaQueryList.removeEventListener('change', onStoreChange);
2143
- };
2144
- }, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
2145
- }
2146
-
2147
- function useScreenSize(size) {
2148
- return useMedia(`(min-width: ${size}px)`);
2149
- }
2150
-
2151
- /**
2152
- * @deprecated Prefer `useScreenSize` instead.
2153
- */
2154
- const useLayout = () => {
2155
- const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);
2156
- const screenSm = useScreenSize(Breakpoint.SMALL);
2157
- const screenMd = useScreenSize(Breakpoint.MEDIUM);
2158
- const screenLg = useScreenSize(Breakpoint.LARGE);
2159
- const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);
2160
- return {
2161
- isMobile: screenSm != null ? !screenSm : undefined,
2162
- isExtraSmall: screenXs,
2163
- isSmall: screenSm,
2164
- isMedium: screenMd,
2165
- isLarge: screenLg,
2166
- isExtraLarge: screenXl
2167
- };
2168
- };
2169
-
2170
2751
  const EXIT_ANIMATION = 350;
2171
2752
  const SlidingPanel = /*#__PURE__*/forwardRef(({
2172
2753
  position = 'left',
@@ -2446,39 +3027,6 @@ const BottomSheet$1 = props => {
2446
3027
  });
2447
3028
  };
2448
3029
 
2449
- const Card = ({
2450
- className,
2451
- children = null,
2452
- id,
2453
- isDisabled = false,
2454
- isSmall = false,
2455
- onDismiss,
2456
- testId,
2457
- ...props
2458
- }) => {
2459
- const closeButtonReference = useRef(null);
2460
- return /*#__PURE__*/jsxs("div", {
2461
- className: classNames('np-Card', {
2462
- 'np-Card--small': !!isSmall,
2463
- 'is-disabled': !!isDisabled
2464
- }, className),
2465
- id: id,
2466
- "data-testid": testId,
2467
- ...props,
2468
- children: [onDismiss && /*#__PURE__*/jsx(CloseButton, {
2469
- ref: closeButtonReference,
2470
- className: "np-Card-closeButton",
2471
- size: isSmall ? 'sm' : 'md',
2472
- isDisabled: isDisabled,
2473
- testId: "close-button",
2474
- onClick: e => {
2475
- stopPropagation$1(e);
2476
- onDismiss();
2477
- }
2478
- }), children]
2479
- });
2480
- };
2481
-
2482
3030
  function CriticalCommsBanner({
2483
3031
  title,
2484
3032
  subtitle,
@@ -4336,20 +4884,6 @@ DefinitionList.defaultProps = {
4336
4884
  };
4337
4885
  var DefinitionList$1 = DefinitionList;
4338
4886
 
4339
- function Display({
4340
- as: Heading = 'h1',
4341
- type = Typography.DISPLAY_LARGE,
4342
- children,
4343
- className,
4344
- id
4345
- }) {
4346
- return /*#__PURE__*/jsx(Heading, {
4347
- id: id,
4348
- className: classNames(`np-text-${type}`, 'text-primary', className),
4349
- children: children
4350
- });
4351
- }
4352
-
4353
4887
  const DropFade = ({
4354
4888
  children,
4355
4889
  show
@@ -5033,71 +5567,32 @@ const HeaderAction = ({
5033
5567
  */
5034
5568
  const Header = ({
5035
5569
  action,
5036
- as = 'h5',
5037
- title,
5038
- className
5039
- }) => {
5040
- if (!action) {
5041
- return /*#__PURE__*/jsx(Title, {
5042
- as: as,
5043
- type: Typography.TITLE_GROUP,
5044
- className: classNames('np-header', 'np-header__title', className),
5045
- children: title
5046
- });
5047
- }
5048
- if (as === 'legend') {
5049
- // eslint-disable-next-line no-console
5050
- console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
5051
- }
5052
- return /*#__PURE__*/jsxs("div", {
5053
- className: classNames('np-header', className),
5054
- children: [/*#__PURE__*/jsx(Title, {
5055
- as: as,
5056
- type: Typography.TITLE_GROUP,
5057
- className: "np-header__title",
5058
- children: title
5059
- }), /*#__PURE__*/jsx(HeaderAction, {
5060
- action: action
5061
- })]
5062
- });
5063
- };
5064
-
5065
- const EmptyTransparentImage = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
5066
- const Image = ({
5067
- id,
5068
- src,
5069
- alt,
5070
- onLoad,
5071
- onError,
5072
- className,
5073
- loading,
5074
- stretch = true,
5075
- role,
5076
- shrink = true
5077
- }) => {
5078
- const elementReference = useRef(null);
5079
- const [hasIntersected] = useHasIntersected({
5080
- elRef: elementReference,
5081
- loading
5082
- });
5083
- let imageSource = src;
5084
- let imageOnLoad = onLoad;
5085
- if (loading === 'lazy' && !hasIntersected) {
5086
- imageSource = EmptyTransparentImage;
5087
- imageOnLoad = undefined;
5570
+ as = 'h5',
5571
+ title,
5572
+ className
5573
+ }) => {
5574
+ if (!action) {
5575
+ return /*#__PURE__*/jsx(Title, {
5576
+ as: as,
5577
+ type: Typography.TITLE_GROUP,
5578
+ className: classNames('np-header', 'np-header__title', className),
5579
+ children: title
5580
+ });
5088
5581
  }
5089
- return /*#__PURE__*/jsx("img", {
5090
- ref: elementReference,
5091
- id: id,
5092
- alt: alt,
5093
- src: imageSource,
5094
- className: classNames(['tw-image', {
5095
- 'tw-image__stretch': stretch,
5096
- 'tw-image__shrink': shrink
5097
- }, className]),
5098
- role: role,
5099
- onLoad: imageOnLoad,
5100
- onError: onError
5582
+ if (as === 'legend') {
5583
+ // eslint-disable-next-line no-console
5584
+ console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
5585
+ }
5586
+ return /*#__PURE__*/jsxs("div", {
5587
+ className: classNames('np-header', className),
5588
+ children: [/*#__PURE__*/jsx(Title, {
5589
+ as: as,
5590
+ type: Typography.TITLE_GROUP,
5591
+ className: "np-header__title",
5592
+ children: title
5593
+ }), /*#__PURE__*/jsx(HeaderAction, {
5594
+ action: action
5595
+ })]
5101
5596
  });
5102
5597
  };
5103
5598
 
@@ -8970,227 +9465,6 @@ const ProgressBar = ({
8970
9465
  });
8971
9466
  };
8972
9467
 
8973
- const defaultPromoCardContext = {
8974
- state: '',
8975
- isDisabled: false,
8976
- // eslint-disable-next-line @typescript-eslint/no-empty-function
8977
- onChange: () => {}
8978
- };
8979
- /**
8980
- * The PromoCard context object.
8981
- */
8982
- const PromoCardContext = /*#__PURE__*/createContext(defaultPromoCardContext);
8983
- /**
8984
- * A custom hook for accessing the PromoCard context object.
8985
- *
8986
- * The `usePromoCardContext` hook is used to access the PromoCard context object
8987
- * from within a child PromoCard component. It throws an error if the context
8988
- * object is not available, which can help with debugging and development.
8989
- *
8990
- * @returns {PromoCardContextType} - The PromoCard context object.
8991
- */
8992
- const usePromoCardContext = () => {
8993
- return useContext(PromoCardContext);
8994
- };
8995
-
8996
- const PromoCardIndicator = ({
8997
- className,
8998
- children,
8999
- label,
9000
- icon,
9001
- isSmall = false,
9002
- testid,
9003
- ...rest
9004
- }) => {
9005
- const isIconString = icon && typeof icon === 'string';
9006
- const IconComponent = isIconString && {
9007
- check: Check,
9008
- arrow: ArrowRight,
9009
- download: Download
9010
- }[icon];
9011
- return /*#__PURE__*/jsxs("div", {
9012
- className: classNames('np-Card-indicator', className),
9013
- "data-testid": testid,
9014
- ...rest,
9015
- children: [label && /*#__PURE__*/jsx(Body, {
9016
- as: "span",
9017
- type: Typography.BODY_LARGE_BOLD,
9018
- className: "np-Card-indicatorText",
9019
- children: label
9020
- }), icon && /*#__PURE__*/jsx(Avatar, {
9021
- type: AvatarType.ICON,
9022
- size: isSmall ? 40 : 56,
9023
- backgroundColor: "var(--Card-indicator-icon-background-color)",
9024
- className: "np-Card-indicatorIcon",
9025
- children: IconComponent ? /*#__PURE__*/jsx(IconComponent, {
9026
- size: 24,
9027
- "aria-hidden": "true"
9028
- }) : icon
9029
- }), children]
9030
- });
9031
- };
9032
-
9033
- const PromoCard = /*#__PURE__*/forwardRef(({
9034
- className,
9035
- description,
9036
- defaultChecked,
9037
- download,
9038
- href,
9039
- hrefLang,
9040
- id,
9041
- headingLevel = 'h3',
9042
- imageAlt,
9043
- imageClass,
9044
- imageSource,
9045
- indicatorLabel,
9046
- indicatorIcon,
9047
- isChecked,
9048
- isDisabled,
9049
- onClick,
9050
- rel,
9051
- tabIndex,
9052
- target,
9053
- testId,
9054
- title,
9055
- type,
9056
- value,
9057
- isSmall,
9058
- useDisplayFont = true,
9059
- ...props
9060
- }, reference) => {
9061
- // Set the `checked` state to the value of `defaultChecked` if it is truthy,
9062
- // or the value of `isChecked` if it is truthy, or `false` if neither
9063
- // is truthy.
9064
- const {
9065
- state,
9066
- onChange,
9067
- isDisabled: contextIsDisabled
9068
- } = usePromoCardContext();
9069
- const [checked, setChecked] = useState(type === 'checkbox' ? defaultChecked ?? isChecked ?? false : false);
9070
- const handleClick = () => {
9071
- if (type === 'radio') {
9072
- onChange(value || ''); // Update the context state for radio
9073
- } else if (type === 'checkbox') {
9074
- setChecked(!checked); // Update local state for checkbox
9075
- }
9076
- };
9077
- const fallbackId = useId();
9078
- const componentId = id || fallbackId;
9079
- // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
9080
- // `'download'` if `download` is truthy. If neither condition is true, set
9081
- // `icon` to `undefined`.
9082
- // Create a function to get icon type
9083
- const getIconType = () => {
9084
- if (indicatorIcon) {
9085
- return indicatorIcon;
9086
- }
9087
- if (download) {
9088
- return 'download';
9089
- }
9090
- if (href && !type) {
9091
- return 'arrow';
9092
- }
9093
- return undefined;
9094
- };
9095
- // Define all class names string based on the values of the `href`, `type`,
9096
- // `checked`, and `className` props.
9097
- const commonClasses = classNames({
9098
- 'np-Card--promoCard': true,
9099
- 'np-Card--checked': !href && type,
9100
- 'np-Card--link': href && !type,
9101
- 'is-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined
9102
- }, className);
9103
- // Object with common props that will be passed to the `Card` components
9104
- const commonProps = {
9105
- className: commonClasses,
9106
- id: componentId,
9107
- isDisabled: isDisabled || contextIsDisabled,
9108
- onClick,
9109
- ref: reference,
9110
- 'data-testid': testId,
9111
- isSmall
9112
- };
9113
- // Object with Anchor props that will be passed to the `a` element. These
9114
- // won't be refurned if set to `isDisabled`
9115
- const anchorProps = href && !isDisabled ? {
9116
- download,
9117
- href: href || undefined,
9118
- hrefLang,
9119
- rel,
9120
- target
9121
- } : {};
9122
- // Object of all Checked props that will be passed to the root `Card` component
9123
- const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
9124
- ...commonProps,
9125
- 'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
9126
- 'aria-describedby': `${componentId}-title`,
9127
- 'aria-disabled': isDisabled,
9128
- 'data-value': value ?? undefined,
9129
- role: type === 'checkbox' || type === 'radio' ? type : undefined,
9130
- onClick: handleClick,
9131
- onKeyDown: event => {
9132
- if (event.key === 'Enter' || event.key === ' ') {
9133
- handleClick();
9134
- }
9135
- },
9136
- ref: reference,
9137
- tabIndex: 0
9138
- } : {};
9139
- const getTitle = () => {
9140
- const titleContent = href && !type ? /*#__PURE__*/jsx("a", {
9141
- className: "np-Card-titleLink",
9142
- ...anchorProps,
9143
- children: title
9144
- }) : title;
9145
- const titleProps = {
9146
- id: `${componentId}-title`,
9147
- as: headingLevel,
9148
- className: 'np-Card-title'
9149
- };
9150
- return useDisplayFont ? /*#__PURE__*/jsx(Display, {
9151
- type: Typography.DISPLAY_SMALL,
9152
- ...titleProps,
9153
- children: titleContent
9154
- }) : /*#__PURE__*/jsx(Title, {
9155
- type: Typography.TITLE_SUBSECTION,
9156
- ...titleProps,
9157
- children: titleContent
9158
- });
9159
- };
9160
- useEffect(() => {
9161
- setChecked(defaultChecked ?? isChecked ?? false);
9162
- }, [defaultChecked, isChecked]);
9163
- return /*#__PURE__*/jsxs(Card, {
9164
- ...commonProps,
9165
- ...checkedProps,
9166
- ...props,
9167
- children: [(value === state || checked) && /*#__PURE__*/jsx("span", {
9168
- className: "np-Card-check",
9169
- children: /*#__PURE__*/jsx(Check, {
9170
- size: 24,
9171
- "aria-hidden": "true"
9172
- })
9173
- }), getTitle(), /*#__PURE__*/jsx(Body, {
9174
- className: "np-Card-description",
9175
- children: description
9176
- }), imageSource && /*#__PURE__*/jsx("div", {
9177
- className: classNames('np-Card-image', {
9178
- imageClass
9179
- }),
9180
- children: /*#__PURE__*/jsx(Image, {
9181
- src: imageSource,
9182
- alt: imageAlt || '',
9183
- loading: "lazy"
9184
- })
9185
- }), /*#__PURE__*/jsx(PromoCardIndicator, {
9186
- label: indicatorLabel,
9187
- icon: getIconType(),
9188
- isSmall: isSmall
9189
- })]
9190
- });
9191
- });
9192
- var PromoCard$1 = /*#__PURE__*/React__default.memo(PromoCard);
9193
-
9194
9468
  const PromoCardGroup = ({
9195
9469
  children,
9196
9470
  className,
@@ -14484,5 +14758,5 @@ const translations = {
14484
14758
  'zh-HK': zhHK
14485
14759
  };
14486
14760
 
14487
- export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, Field, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, Label, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCardGroup$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
14761
+ export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card$2 as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$1 as Card, Carousel, Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, Field, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, Label, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCardGroup$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
14488
14762
  //# sourceMappingURL=index.mjs.map