@transferwise/components 0.0.0-experimental-26e4e3f → 0.0.0-experimental-36044b4

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,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, useCallback, createContext, useContext, useSyncExternalStore, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
2
+ import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useSyncExternalStore, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, AlertCircleFill, AlertCircle, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle } from '@transferwise/icons';
5
+ import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, AlertCircle, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle } from '@transferwise/icons';
6
6
  import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
7
7
  import PropTypes from 'prop-types';
8
8
  import commonmark from 'commonmark';
@@ -1462,7 +1462,716 @@ const Button = /*#__PURE__*/forwardRef(({
1462
1462
  });
1463
1463
  });
1464
1464
 
1465
- const Card$1 = /*#__PURE__*/forwardRef((props, reference) => {
1465
+ const Card$2 = /*#__PURE__*/forwardRef(({
1466
+ className,
1467
+ children = null,
1468
+ id,
1469
+ isDisabled = false,
1470
+ isSmall = false,
1471
+ onDismiss,
1472
+ testId,
1473
+ ...props
1474
+ }, ref) => {
1475
+ const closeButtonReference = useRef(null);
1476
+ return /*#__PURE__*/jsxs("div", {
1477
+ ref: ref,
1478
+ className: classNames('np-Card', {
1479
+ 'np-Card--small': !!isSmall,
1480
+ 'is-disabled': !!isDisabled
1481
+ }, className),
1482
+ id: id,
1483
+ "data-testid": testId,
1484
+ ...props,
1485
+ children: [onDismiss && /*#__PURE__*/jsx(CloseButton, {
1486
+ ref: closeButtonReference,
1487
+ className: "np-Card-closeButton",
1488
+ size: isSmall ? 'sm' : 'md',
1489
+ isDisabled: isDisabled,
1490
+ testId: "close-button",
1491
+ onClick: e => {
1492
+ stopPropagation$1(e);
1493
+ onDismiss();
1494
+ }
1495
+ }), children]
1496
+ });
1497
+ });
1498
+ Card$2.displayName = 'Card';
1499
+
1500
+ function Display({
1501
+ as: Heading = 'h1',
1502
+ type = Typography.DISPLAY_LARGE,
1503
+ children,
1504
+ className,
1505
+ id
1506
+ }) {
1507
+ return /*#__PURE__*/jsx(Heading, {
1508
+ id: id,
1509
+ className: classNames(`np-text-${type}`, 'text-primary', className),
1510
+ children: children
1511
+ });
1512
+ }
1513
+
1514
+ const useConditionalListener = ({
1515
+ attachListener,
1516
+ callback,
1517
+ eventType,
1518
+ parent
1519
+ }) => {
1520
+ useEffect(() => {
1521
+ if (attachListener && !isUndefined(parent)) {
1522
+ parent.addEventListener(eventType, callback, true);
1523
+ }
1524
+ return () => {
1525
+ if (!isUndefined(parent)) {
1526
+ parent.removeEventListener(eventType, callback, true);
1527
+ }
1528
+ };
1529
+ }, [attachListener, callback, eventType, parent]);
1530
+ };
1531
+
1532
+ const DirectionContext = /*#__PURE__*/createContext(Direction.LTR);
1533
+ const DirectionProvider = ({
1534
+ direction,
1535
+ children
1536
+ }) => {
1537
+ return /*#__PURE__*/jsx(DirectionContext.Provider, {
1538
+ value: direction,
1539
+ children: children
1540
+ });
1541
+ };
1542
+
1543
+ const useDirection = () => {
1544
+ const direction = useContext(DirectionContext);
1545
+ return {
1546
+ direction,
1547
+ isRTL: direction === 'rtl'
1548
+ };
1549
+ };
1550
+
1551
+ const ObserverParams = {
1552
+ threshold: 0.1
1553
+ };
1554
+
1555
+ /**
1556
+ * useHasIntersected.
1557
+ * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
1558
+ * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
1559
+ *
1560
+ * @param elRef.elRef
1561
+ * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
1562
+ * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
1563
+ * @param elRef.loading
1564
+ * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
1565
+ */
1566
+ const useHasIntersected = ({
1567
+ elRef,
1568
+ loading
1569
+ }) => {
1570
+ const [hasIntersected, setHasIntersected] = useState(false);
1571
+ const {
1572
+ current
1573
+ } = elRef || {};
1574
+ const isValidReference = () => {
1575
+ return elRef && current;
1576
+ };
1577
+ const handleOnIntersect = (entries, observer) => {
1578
+ entries.forEach(entry => {
1579
+ if (entry.isIntersecting) {
1580
+ setHasIntersected(true);
1581
+ observer.unobserve(current);
1582
+ }
1583
+ });
1584
+ };
1585
+ useEffect(() => {
1586
+ let observer;
1587
+ let didCancel = false;
1588
+
1589
+ // Check if window is define for SSR and Old browsers fallback
1590
+ if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
1591
+ setHasIntersected(true);
1592
+ } else if (!didCancel) {
1593
+ observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
1594
+ observer.observe(current);
1595
+ }
1596
+ return () => {
1597
+ didCancel = true;
1598
+ if (observer) {
1599
+ observer.unobserve(current);
1600
+ }
1601
+ };
1602
+ }, [elRef]);
1603
+ if (loading === 'eager') {
1604
+ return [false];
1605
+ }
1606
+ return [hasIntersected];
1607
+ };
1608
+
1609
+ function useMedia(query) {
1610
+ return useSyncExternalStore(onStoreChange => {
1611
+ const mediaQueryList = window.matchMedia(query);
1612
+ mediaQueryList.addEventListener('change', onStoreChange);
1613
+ return () => {
1614
+ mediaQueryList.removeEventListener('change', onStoreChange);
1615
+ };
1616
+ }, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
1617
+ }
1618
+
1619
+ function useScreenSize(size) {
1620
+ return useMedia(`(min-width: ${size}px)`);
1621
+ }
1622
+
1623
+ /**
1624
+ * @deprecated Prefer `useScreenSize` instead.
1625
+ */
1626
+ const useLayout = () => {
1627
+ const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);
1628
+ const screenSm = useScreenSize(Breakpoint.SMALL);
1629
+ const screenMd = useScreenSize(Breakpoint.MEDIUM);
1630
+ const screenLg = useScreenSize(Breakpoint.LARGE);
1631
+ const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);
1632
+ return {
1633
+ isMobile: screenSm != null ? !screenSm : undefined,
1634
+ isExtraSmall: screenXs,
1635
+ isSmall: screenSm,
1636
+ isMedium: screenMd,
1637
+ isLarge: screenLg,
1638
+ isExtraLarge: screenXl
1639
+ };
1640
+ };
1641
+
1642
+ const EmptyTransparentImage = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
1643
+ const Image = ({
1644
+ id,
1645
+ src,
1646
+ alt,
1647
+ onLoad,
1648
+ onError,
1649
+ className,
1650
+ loading,
1651
+ stretch = true,
1652
+ role,
1653
+ shrink = true
1654
+ }) => {
1655
+ const elementReference = useRef(null);
1656
+ const [hasIntersected] = useHasIntersected({
1657
+ elRef: elementReference,
1658
+ loading
1659
+ });
1660
+ let imageSource = src;
1661
+ let imageOnLoad = onLoad;
1662
+ if (loading === 'lazy' && !hasIntersected) {
1663
+ imageSource = EmptyTransparentImage;
1664
+ imageOnLoad = undefined;
1665
+ }
1666
+ return /*#__PURE__*/jsx("img", {
1667
+ ref: elementReference,
1668
+ id: id,
1669
+ alt: alt,
1670
+ src: imageSource,
1671
+ className: classNames(['tw-image', {
1672
+ 'tw-image__stretch': stretch,
1673
+ 'tw-image__shrink': shrink
1674
+ }, className]),
1675
+ role: role,
1676
+ onLoad: imageOnLoad,
1677
+ onError: onError
1678
+ });
1679
+ };
1680
+
1681
+ const defaultPromoCardContext = {
1682
+ state: '',
1683
+ isDisabled: false,
1684
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1685
+ onChange: () => {}
1686
+ };
1687
+ /**
1688
+ * The PromoCard context object.
1689
+ */
1690
+ const PromoCardContext = /*#__PURE__*/createContext(defaultPromoCardContext);
1691
+ /**
1692
+ * A custom hook for accessing the PromoCard context object.
1693
+ *
1694
+ * The `usePromoCardContext` hook is used to access the PromoCard context object
1695
+ * from within a child PromoCard component. It throws an error if the context
1696
+ * object is not available, which can help with debugging and development.
1697
+ *
1698
+ * @returns {PromoCardContextType} - The PromoCard context object.
1699
+ */
1700
+ const usePromoCardContext = () => {
1701
+ return useContext(PromoCardContext);
1702
+ };
1703
+
1704
+ const PromoCardIndicator = ({
1705
+ className,
1706
+ children,
1707
+ label,
1708
+ icon,
1709
+ isSmall = false,
1710
+ testid,
1711
+ ...rest
1712
+ }) => {
1713
+ const isIconString = icon && typeof icon === 'string';
1714
+ const IconComponent = isIconString && {
1715
+ check: Check,
1716
+ arrow: ArrowRight,
1717
+ download: Download
1718
+ }[icon];
1719
+ return /*#__PURE__*/jsxs("div", {
1720
+ className: classNames('np-Card-indicator', className),
1721
+ "data-testid": testid,
1722
+ ...rest,
1723
+ children: [label && /*#__PURE__*/jsx(Body, {
1724
+ as: "span",
1725
+ type: Typography.BODY_LARGE_BOLD,
1726
+ className: "np-Card-indicatorText",
1727
+ children: label
1728
+ }), icon && /*#__PURE__*/jsx(Avatar, {
1729
+ type: AvatarType.ICON,
1730
+ size: isSmall ? 40 : 56,
1731
+ backgroundColor: "var(--Card-indicator-icon-background-color)",
1732
+ className: "np-Card-indicatorIcon",
1733
+ children: IconComponent ? /*#__PURE__*/jsx(IconComponent, {
1734
+ size: 24,
1735
+ "aria-hidden": "true"
1736
+ }) : icon
1737
+ }), children]
1738
+ });
1739
+ };
1740
+
1741
+ const PromoCard = /*#__PURE__*/forwardRef(({
1742
+ className,
1743
+ description,
1744
+ defaultChecked,
1745
+ download,
1746
+ href,
1747
+ hrefLang,
1748
+ id,
1749
+ headingLevel = 'h3',
1750
+ imageAlt,
1751
+ imageClass,
1752
+ imageSource,
1753
+ indicatorLabel,
1754
+ indicatorIcon,
1755
+ isChecked,
1756
+ isDisabled,
1757
+ onClick,
1758
+ onKeyDown,
1759
+ rel,
1760
+ tabIndex,
1761
+ target,
1762
+ testId,
1763
+ title,
1764
+ type,
1765
+ value,
1766
+ isSmall,
1767
+ useDisplayFont = true,
1768
+ anchorRef,
1769
+ anchorId,
1770
+ ...props
1771
+ }, ref) => {
1772
+ // Set the `checked` state to the value of `defaultChecked` if it is truthy,
1773
+ // or the value of `isChecked` if it is truthy, or `false` if neither
1774
+ // is truthy.
1775
+ const {
1776
+ state,
1777
+ onChange,
1778
+ isDisabled: contextIsDisabled
1779
+ } = usePromoCardContext();
1780
+ const [checked, setChecked] = useState(type === 'checkbox' ? defaultChecked ?? isChecked ?? false : false);
1781
+ const handleClick = () => {
1782
+ if (type === 'radio') {
1783
+ onChange(value || ''); // Update the context state for radio
1784
+ } else if (type === 'checkbox') {
1785
+ setChecked(!checked); // Update local state for checkbox
1786
+ }
1787
+ };
1788
+ const fallbackId = useId();
1789
+ const componentId = id || fallbackId;
1790
+ // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
1791
+ // `'download'` if `download` is truthy. If neither condition is true, set
1792
+ // `icon` to `undefined`.
1793
+ // Create a function to get icon type
1794
+ const getIconType = () => {
1795
+ if (indicatorIcon) {
1796
+ return indicatorIcon;
1797
+ }
1798
+ if (download) {
1799
+ return 'download';
1800
+ }
1801
+ if (href && !type) {
1802
+ return 'arrow';
1803
+ }
1804
+ return undefined;
1805
+ };
1806
+ // Define all class names string based on the values of the `href`, `type`,
1807
+ // `checked`, and `className` props.
1808
+ const commonClasses = classNames({
1809
+ 'np-Card--promoCard': true,
1810
+ 'np-Card--checked': !href && type,
1811
+ 'np-Card--link': href && !type,
1812
+ 'is-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined
1813
+ }, className);
1814
+ // Object with common props that will be passed to the `Card` components
1815
+ const commonProps = {
1816
+ className: commonClasses,
1817
+ id: componentId,
1818
+ isDisabled: isDisabled || contextIsDisabled,
1819
+ onClick,
1820
+ onKeyDown,
1821
+ ref,
1822
+ 'data-testid': testId,
1823
+ isSmall
1824
+ };
1825
+ // Object with Anchor props that will be passed to the `a` element. These
1826
+ // won't be refurned if set to `isDisabled`
1827
+ const anchorProps = href && !isDisabled ? {
1828
+ download,
1829
+ href: href || undefined,
1830
+ hrefLang,
1831
+ rel,
1832
+ target,
1833
+ ref: anchorRef,
1834
+ id: anchorId
1835
+ } : {};
1836
+ // Object of all Checked props that will be passed to the root `Card` component
1837
+ const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
1838
+ ...commonProps,
1839
+ 'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
1840
+ 'aria-describedby': `${componentId}-title`,
1841
+ 'aria-disabled': isDisabled,
1842
+ 'data-value': value ?? undefined,
1843
+ role: type === 'checkbox' || type === 'radio' ? type : undefined,
1844
+ onClick: handleClick,
1845
+ onKeyDown: event => {
1846
+ if (event.key === 'Enter' || event.key === ' ') {
1847
+ handleClick();
1848
+ }
1849
+ },
1850
+ ref,
1851
+ tabIndex: 0
1852
+ } : {};
1853
+ const getTitle = () => {
1854
+ const titleContent = href && !type ? /*#__PURE__*/jsx("a", {
1855
+ className: "np-Card-titleLink",
1856
+ ...anchorProps,
1857
+ children: title
1858
+ }) : title;
1859
+ const titleProps = {
1860
+ id: `${componentId}-title`,
1861
+ as: headingLevel,
1862
+ className: 'np-Card-title'
1863
+ };
1864
+ return useDisplayFont ? /*#__PURE__*/jsx(Display, {
1865
+ type: Typography.DISPLAY_SMALL,
1866
+ ...titleProps,
1867
+ children: titleContent
1868
+ }) : /*#__PURE__*/jsx(Title, {
1869
+ type: Typography.TITLE_SUBSECTION,
1870
+ ...titleProps,
1871
+ children: titleContent
1872
+ });
1873
+ };
1874
+ useEffect(() => {
1875
+ setChecked(defaultChecked ?? isChecked ?? false);
1876
+ }, [defaultChecked, isChecked]);
1877
+ return /*#__PURE__*/jsxs(Card$2, {
1878
+ ...commonProps,
1879
+ ...checkedProps,
1880
+ ...props,
1881
+ children: [(value === state || checked) && /*#__PURE__*/jsx("span", {
1882
+ className: "np-Card-check",
1883
+ children: /*#__PURE__*/jsx(Check, {
1884
+ size: 24,
1885
+ "aria-hidden": "true"
1886
+ })
1887
+ }), getTitle(), /*#__PURE__*/jsx(Body, {
1888
+ className: "np-Card-description",
1889
+ children: description
1890
+ }), imageSource && /*#__PURE__*/jsx("div", {
1891
+ className: classNames('np-Card-image', {
1892
+ imageClass
1893
+ }),
1894
+ children: /*#__PURE__*/jsx(Image, {
1895
+ src: imageSource,
1896
+ alt: imageAlt || '',
1897
+ loading: "lazy"
1898
+ })
1899
+ }), /*#__PURE__*/jsx(PromoCardIndicator, {
1900
+ label: indicatorLabel,
1901
+ icon: getIconType(),
1902
+ isSmall: isSmall
1903
+ })]
1904
+ });
1905
+ });
1906
+ var PromoCard$1 = /*#__PURE__*/React__default.memo(PromoCard);
1907
+
1908
+ const LEFT_SCROLL_OFFSET = 8;
1909
+ const Carousel = ({
1910
+ header,
1911
+ className,
1912
+ cards,
1913
+ onClick
1914
+ }) => {
1915
+ const [scrollPosition, setScrollPosition] = useState(0);
1916
+ const [previousScrollPosition, setPreviousScrollPosition] = useState(0);
1917
+ const [scrollIsAtEnd, setScrollIsAtEnd] = useState(false);
1918
+ const [visibleCardOnMobileView, setVisibleCardOnMobileView] = useState('');
1919
+ const carouselElementRef = useRef(null);
1920
+ const carouselCardsRef = useRef([]);
1921
+ const isLeftActionButtonEnabled = scrollPosition > LEFT_SCROLL_OFFSET;
1922
+ const areActionButtonsEnabled = isLeftActionButtonEnabled || !scrollIsAtEnd;
1923
+ const [focusedCard, setFocusedCard] = useState(cards?.[0]?.id);
1924
+ const updateScrollButtonsState = () => {
1925
+ if (carouselElementRef.current) {
1926
+ const {
1927
+ scrollWidth,
1928
+ offsetWidth
1929
+ } = carouselElementRef.current;
1930
+ const scrollAtEnd = scrollWidth - offsetWidth <= scrollPosition + LEFT_SCROLL_OFFSET;
1931
+ setScrollIsAtEnd(scrollAtEnd);
1932
+ }
1933
+ const scrollDirecton = scrollPosition > previousScrollPosition ? 'right' : 'left';
1934
+ const cardsInFullViewIds = [];
1935
+ carouselCardsRef.current.forEach(card => {
1936
+ if (isVisible(carouselElementRef.current, card.cardElement)) {
1937
+ // eslint-disable-next-line functional/immutable-data
1938
+ cardsInFullViewIds.push(card.cardElement.getAttribute('id') ?? '');
1939
+ }
1940
+ });
1941
+ if (cardsInFullViewIds.length >= 1) {
1942
+ const visibleCardIndex = scrollDirecton === 'right' ? cardsInFullViewIds.length - 1 : 0;
1943
+ const visibleCardId = cardsInFullViewIds[visibleCardIndex];
1944
+ setVisibleCardOnMobileView(visibleCardId);
1945
+ setFocusedCard(visibleCardId);
1946
+ }
1947
+ setPreviousScrollPosition(scrollPosition);
1948
+ };
1949
+ const scrollCarousel = (direction = 'right') => {
1950
+ if (carouselElementRef.current) {
1951
+ const {
1952
+ scrollWidth
1953
+ } = carouselElementRef.current;
1954
+ const cardWidth = scrollWidth / carouselCardsRef.current.length;
1955
+ const res = Math.floor(cardWidth - cardWidth * 0.05);
1956
+ carouselElementRef.current.scrollBy({
1957
+ left: direction === 'right' ? res : -res,
1958
+ behavior: 'smooth'
1959
+ });
1960
+ }
1961
+ };
1962
+ const handleOnKeyDown = (event, index) => {
1963
+ if (event.key === 'ArrowRight' || event.key === 'ArrowLeft') {
1964
+ const nextIndex = event.key === 'ArrowRight' ? index + 1 : index - 1;
1965
+ const nextCard = cards[nextIndex];
1966
+ if (nextCard) {
1967
+ const ref = carouselCardsRef.current[nextIndex];
1968
+ if (ref.type === 'promo') {
1969
+ ref.anchorElement?.focus();
1970
+ } else {
1971
+ ref.cardElement?.focus();
1972
+ }
1973
+ scrollCardIntoView(carouselCardsRef.current[nextIndex].cardElement, nextCard);
1974
+ event.preventDefault();
1975
+ }
1976
+ }
1977
+ if (event.key === 'Enter' || event.key === ' ') {
1978
+ event.currentTarget.click();
1979
+ }
1980
+ };
1981
+ const scrollCardIntoView = (element, card) => {
1982
+ element.scrollIntoView({
1983
+ behavior: 'smooth',
1984
+ block: 'nearest',
1985
+ inline: 'center'
1986
+ });
1987
+ setFocusedCard(card.id);
1988
+ };
1989
+ useEffect(() => {
1990
+ updateScrollButtonsState();
1991
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1992
+ }, [scrollPosition]);
1993
+ useEffect(() => {
1994
+ window.addEventListener('resize', updateScrollButtonsState);
1995
+ return () => {
1996
+ window.removeEventListener('resize', updateScrollButtonsState);
1997
+ };
1998
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1999
+ }, []);
2000
+ const addElementToCardsRefArray = (index, ref) => {
2001
+ if (ref) {
2002
+ // eslint-disable-next-line functional/immutable-data
2003
+ carouselCardsRef.current[index] = {
2004
+ type: ref.type ?? carouselCardsRef.current?.[index]?.type,
2005
+ cardElement: ref.cardElement ?? carouselCardsRef.current?.[index]?.cardElement,
2006
+ anchorElement: ref.anchorElement ?? carouselCardsRef.current?.[index]?.anchorElement
2007
+ };
2008
+ }
2009
+ };
2010
+ return /*#__PURE__*/jsxs("div", {
2011
+ className: classNames('carousel-wrapper', className),
2012
+ children: [/*#__PURE__*/jsxs("div", {
2013
+ className: "d-flex justify-content-between carousel__header",
2014
+ children: [typeof header === 'string' ? /*#__PURE__*/jsx(Title, {
2015
+ as: "span",
2016
+ type: "title-body",
2017
+ children: header
2018
+ }) : header, areActionButtonsEnabled ? /*#__PURE__*/jsxs("div", {
2019
+ className: "hidden-xs",
2020
+ children: [/*#__PURE__*/jsx(ActionButton, {
2021
+ className: "carousel__scroll-button",
2022
+ tabIndex: -1,
2023
+ priority: "secondary",
2024
+ disabled: !isLeftActionButtonEnabled,
2025
+ "aria-hidden": "true",
2026
+ "data-testid": "scroll-carousel-left",
2027
+ onClick: () => scrollCarousel('left'),
2028
+ children: /*#__PURE__*/jsx(ChevronLeft, {})
2029
+ }), /*#__PURE__*/jsx(ActionButton, {
2030
+ tabIndex: -1,
2031
+ className: "carousel__scroll-button m-l-1",
2032
+ priority: "secondary",
2033
+ "aria-hidden": "true",
2034
+ "data-testid": "scroll-carousel-right",
2035
+ disabled: scrollIsAtEnd,
2036
+ onClick: () => scrollCarousel(),
2037
+ children: /*#__PURE__*/jsx(ChevronRight, {})
2038
+ })]
2039
+ }) : null]
2040
+ }), /*#__PURE__*/jsx("div", {
2041
+ ref: carouselElementRef,
2042
+ tabIndex: -1,
2043
+ role: "list",
2044
+ className: "carousel",
2045
+ onScroll: event => {
2046
+ const target = event.target;
2047
+ setScrollPosition(target.scrollLeft);
2048
+ },
2049
+ children: cards?.map((card, index) => {
2050
+ const sharedProps = {
2051
+ id: card.id,
2052
+ className: classNames('carousel__card', {
2053
+ 'carousel__card--focused': card.id === focusedCard
2054
+ }),
2055
+ onClick: () => {
2056
+ card.onClick?.();
2057
+ onClick?.(card.id);
2058
+ },
2059
+ onFocus: event => {
2060
+ scrollCardIntoView(event.currentTarget, card);
2061
+ }
2062
+ };
2063
+ const cardContent = card.type !== 'promo' ? /*#__PURE__*/jsx("div", {
2064
+ id: `${card.id}-content`,
2065
+ className: classNames('carousel__card-content', {
2066
+ [card.className ?? '']: !!card.className
2067
+ })
2068
+ // eslint-disable-next-line react/forbid-dom-props
2069
+ ,
2070
+ style: card.styles,
2071
+ children: card.content
2072
+ }) : null;
2073
+ if (card.type === 'button') {
2074
+ return /*#__PURE__*/jsx("div", {
2075
+ "aria-labelledby": `${card.id}-content`,
2076
+ role: "listitem",
2077
+ children: /*#__PURE__*/jsx("div", {
2078
+ ...sharedProps,
2079
+ ref: el => {
2080
+ if (el) {
2081
+ // eslint-disable-next-line functional/immutable-data
2082
+ carouselCardsRef.current[index] = {
2083
+ type: 'default',
2084
+ cardElement: el
2085
+ };
2086
+ }
2087
+ },
2088
+ role: "button",
2089
+ tabIndex: 0,
2090
+ onKeyDown: event => handleOnKeyDown(event, index),
2091
+ children: cardContent
2092
+ })
2093
+ }, card.id);
2094
+ }
2095
+ if (card.type === 'promo') {
2096
+ return /*#__PURE__*/jsx("div", {
2097
+ id: card.id,
2098
+ role: "listitem",
2099
+ "aria-labelledby": `${card.id}-anchor`,
2100
+ children: /*#__PURE__*/jsx(PromoCard$1, {
2101
+ ...card,
2102
+ type: undefined,
2103
+ ...sharedProps,
2104
+ ref: el => {
2105
+ if (el) {
2106
+ addElementToCardsRefArray(index, {
2107
+ type: 'promo',
2108
+ cardElement: el
2109
+ });
2110
+ }
2111
+ },
2112
+ anchorRef: el => {
2113
+ if (el) {
2114
+ addElementToCardsRefArray(index, {
2115
+ type: 'promo',
2116
+ anchorElement: el
2117
+ });
2118
+ }
2119
+ },
2120
+ anchorId: `${card.id}-anchor`,
2121
+ onKeyDown: event => handleOnKeyDown(event, index)
2122
+ })
2123
+ }, card.id);
2124
+ }
2125
+ return /*#__PURE__*/jsx("div", {
2126
+ "aria-labelledby": `${card.id}-content`,
2127
+ role: "listitem",
2128
+ children: /*#__PURE__*/jsx("a", {
2129
+ ...sharedProps,
2130
+ ref: el => {
2131
+ if (el) {
2132
+ // eslint-disable-next-line functional/immutable-data
2133
+ carouselCardsRef.current[index] = {
2134
+ type: 'default',
2135
+ cardElement: el
2136
+ };
2137
+ }
2138
+ },
2139
+ href: card.href,
2140
+ rel: "noreferrer",
2141
+ onKeyDown: event => handleOnKeyDown(event, index),
2142
+ children: cardContent
2143
+ })
2144
+ }, card.id);
2145
+ })
2146
+ }), /*#__PURE__*/jsx("div", {
2147
+ className: "visible-xs",
2148
+ children: /*#__PURE__*/jsx("div", {
2149
+ className: "carousel__indicators",
2150
+ children: cards?.map((card, index) => /*#__PURE__*/jsx("button", {
2151
+ "data-testid": `${card.id}-indicator`,
2152
+ tabIndex: -1,
2153
+ "aria-hidden": true,
2154
+ type: "button",
2155
+ className: classNames('carousel__indicator', {
2156
+ 'carousel__indicator--selected': card.id === visibleCardOnMobileView
2157
+ }),
2158
+ onClick: () => {
2159
+ scrollCardIntoView(carouselCardsRef.current[index].cardElement, card);
2160
+ }
2161
+ }, `${card.id}-indicator`))
2162
+ })
2163
+ })]
2164
+ });
2165
+ };
2166
+ const isVisible = (container, el) => {
2167
+ const cWidth = container.offsetWidth;
2168
+ const cScrollOffset = container.scrollLeft;
2169
+ const elemLeft = el.offsetLeft - container.offsetLeft;
2170
+ const elemRight = elemLeft + el.offsetWidth;
2171
+ return elemLeft >= cScrollOffset && elemRight <= cScrollOffset + cWidth;
2172
+ };
2173
+
2174
+ const Card = /*#__PURE__*/forwardRef((props, reference) => {
1466
2175
  const {
1467
2176
  'aria-label': ariaLabel,
1468
2177
  as: Element,
@@ -1513,7 +2222,7 @@ const Card$1 = /*#__PURE__*/forwardRef((props, reference) => {
1513
2222
  const hasChildren = ({
1514
2223
  children
1515
2224
  }) => children;
1516
- Card$1.propTypes = {
2225
+ Card.propTypes = {
1517
2226
  'aria-label': PropTypes.string,
1518
2227
  as: PropTypes.string,
1519
2228
  isExpanded: requiredIf(PropTypes.bool, hasChildren),
@@ -1526,7 +2235,7 @@ Card$1.propTypes = {
1526
2235
  className: PropTypes.string,
1527
2236
  'data-testid': PropTypes.string
1528
2237
  };
1529
- Card$1.defaultProps = {
2238
+ Card.defaultProps = {
1530
2239
  'aria-label': undefined,
1531
2240
  as: 'div',
1532
2241
  children: null,
@@ -1534,7 +2243,7 @@ Card$1.defaultProps = {
1534
2243
  className: null,
1535
2244
  'data-testid': null
1536
2245
  };
1537
- var Card$2 = Card$1;
2246
+ var Card$1 = Card;
1538
2247
 
1539
2248
  const CheckboxButton = /*#__PURE__*/forwardRef(({
1540
2249
  checked,
@@ -2020,134 +2729,6 @@ const DimmerContentWrapper = ({
2020
2729
  };
2021
2730
  var Dimmer$1 = withNextPortalWrapper(Dimmer);
2022
2731
 
2023
- const useConditionalListener = ({
2024
- attachListener,
2025
- callback,
2026
- eventType,
2027
- parent
2028
- }) => {
2029
- useEffect(() => {
2030
- if (attachListener && !isUndefined(parent)) {
2031
- parent.addEventListener(eventType, callback, true);
2032
- }
2033
- return () => {
2034
- if (!isUndefined(parent)) {
2035
- parent.removeEventListener(eventType, callback, true);
2036
- }
2037
- };
2038
- }, [attachListener, callback, eventType, parent]);
2039
- };
2040
-
2041
- const DirectionContext = /*#__PURE__*/createContext(Direction.LTR);
2042
- const DirectionProvider = ({
2043
- direction,
2044
- children
2045
- }) => {
2046
- return /*#__PURE__*/jsx(DirectionContext.Provider, {
2047
- value: direction,
2048
- children: children
2049
- });
2050
- };
2051
-
2052
- const useDirection = () => {
2053
- const direction = useContext(DirectionContext);
2054
- return {
2055
- direction,
2056
- isRTL: direction === 'rtl'
2057
- };
2058
- };
2059
-
2060
- const ObserverParams = {
2061
- threshold: 0.1
2062
- };
2063
-
2064
- /**
2065
- * useHasIntersected.
2066
- * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
2067
- * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
2068
- *
2069
- * @param elRef.elRef
2070
- * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
2071
- * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
2072
- * @param elRef.loading
2073
- * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
2074
- */
2075
- const useHasIntersected = ({
2076
- elRef,
2077
- loading
2078
- }) => {
2079
- const [hasIntersected, setHasIntersected] = useState(false);
2080
- const {
2081
- current
2082
- } = elRef || {};
2083
- const isValidReference = () => {
2084
- return elRef && current;
2085
- };
2086
- const handleOnIntersect = (entries, observer) => {
2087
- entries.forEach(entry => {
2088
- if (entry.isIntersecting) {
2089
- setHasIntersected(true);
2090
- observer.unobserve(current);
2091
- }
2092
- });
2093
- };
2094
- useEffect(() => {
2095
- let observer;
2096
- let didCancel = false;
2097
-
2098
- // Check if window is define for SSR and Old browsers fallback
2099
- if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
2100
- setHasIntersected(true);
2101
- } else if (!didCancel) {
2102
- observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
2103
- observer.observe(current);
2104
- }
2105
- return () => {
2106
- didCancel = true;
2107
- if (observer) {
2108
- observer.unobserve(current);
2109
- }
2110
- };
2111
- }, [elRef]);
2112
- if (loading === 'eager') {
2113
- return [false];
2114
- }
2115
- return [hasIntersected];
2116
- };
2117
-
2118
- function useMedia(query) {
2119
- return useSyncExternalStore(onStoreChange => {
2120
- const mediaQueryList = window.matchMedia(query);
2121
- mediaQueryList.addEventListener('change', onStoreChange);
2122
- return () => {
2123
- mediaQueryList.removeEventListener('change', onStoreChange);
2124
- };
2125
- }, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
2126
- }
2127
-
2128
- function useScreenSize(size) {
2129
- return useMedia(`(min-width: ${size}px)`);
2130
- }
2131
-
2132
- /**
2133
- * @deprecated Prefer `useScreenSize` instead.
2134
- */
2135
- const useLayout = () => {
2136
- const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);
2137
- const screenSm = useScreenSize(Breakpoint.SMALL);
2138
- const screenMd = useScreenSize(Breakpoint.MEDIUM);
2139
- const screenLg = useScreenSize(Breakpoint.LARGE);
2140
- const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);
2141
- return {
2142
- isMobile: screenSm != null ? !screenSm : undefined,
2143
- isExtraSmall: screenXs,
2144
- isSmall: screenSm,
2145
- isMedium: screenMd,
2146
- isLarge: screenLg,
2147
- isExtraLarge: screenXl
2148
- };
2149
- };
2150
-
2151
2732
  const EXIT_ANIMATION = 350;
2152
2733
  const SlidingPanel = /*#__PURE__*/forwardRef(({
2153
2734
  position = 'left',
@@ -2427,39 +3008,6 @@ const BottomSheet$1 = props => {
2427
3008
  });
2428
3009
  };
2429
3010
 
2430
- const Card = ({
2431
- className,
2432
- children = null,
2433
- id,
2434
- isDisabled = false,
2435
- isSmall = false,
2436
- onDismiss,
2437
- testId,
2438
- ...props
2439
- }) => {
2440
- const closeButtonReference = useRef(null);
2441
- return /*#__PURE__*/jsxs("div", {
2442
- className: classNames('np-Card', {
2443
- 'np-Card--small': !!isSmall,
2444
- 'is-disabled': !!isDisabled
2445
- }, className),
2446
- id: id,
2447
- "data-testid": testId,
2448
- ...props,
2449
- children: [onDismiss && /*#__PURE__*/jsx(CloseButton, {
2450
- ref: closeButtonReference,
2451
- className: "np-Card-closeButton",
2452
- size: isSmall ? 'sm' : 'md',
2453
- isDisabled: isDisabled,
2454
- testId: "close-button",
2455
- onClick: e => {
2456
- stopPropagation$1(e);
2457
- onDismiss();
2458
- }
2459
- }), children]
2460
- });
2461
- };
2462
-
2463
3011
  function CriticalCommsBanner({
2464
3012
  title,
2465
3013
  subtitle,
@@ -4317,20 +4865,6 @@ DefinitionList.defaultProps = {
4317
4865
  };
4318
4866
  var DefinitionList$1 = DefinitionList;
4319
4867
 
4320
- function Display({
4321
- as: Heading = 'h1',
4322
- type = Typography.DISPLAY_LARGE,
4323
- children,
4324
- className,
4325
- id
4326
- }) {
4327
- return /*#__PURE__*/jsx(Heading, {
4328
- id: id,
4329
- className: classNames(`np-text-${type}`, 'text-primary', className),
4330
- children: children
4331
- });
4332
- }
4333
-
4334
4868
  const DropFade = ({
4335
4869
  children,
4336
4870
  show
@@ -5012,71 +5546,32 @@ const HeaderAction = ({
5012
5546
  */
5013
5547
  const Header = ({
5014
5548
  action,
5015
- as = 'h5',
5016
- title,
5017
- className
5018
- }) => {
5019
- if (!action) {
5020
- return /*#__PURE__*/jsx(Title, {
5021
- as: as,
5022
- type: Typography.TITLE_GROUP,
5023
- className: classNames('np-header', 'np-header__title', className),
5024
- children: title
5025
- });
5026
- }
5027
- if (as === 'legend') {
5028
- // eslint-disable-next-line no-console
5029
- console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
5030
- }
5031
- return /*#__PURE__*/jsxs("div", {
5032
- className: classNames('np-header', className),
5033
- children: [/*#__PURE__*/jsx(Title, {
5034
- as: as,
5035
- type: Typography.TITLE_GROUP,
5036
- className: "np-header__title",
5037
- children: title
5038
- }), /*#__PURE__*/jsx(HeaderAction, {
5039
- action: action
5040
- })]
5041
- });
5042
- };
5043
-
5044
- const EmptyTransparentImage = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
5045
- const Image = ({
5046
- id,
5047
- src,
5048
- alt,
5049
- onLoad,
5050
- onError,
5051
- className,
5052
- loading,
5053
- stretch = true,
5054
- role,
5055
- shrink = true
5056
- }) => {
5057
- const elementReference = useRef(null);
5058
- const [hasIntersected] = useHasIntersected({
5059
- elRef: elementReference,
5060
- loading
5061
- });
5062
- let imageSource = src;
5063
- let imageOnLoad = onLoad;
5064
- if (loading === 'lazy' && !hasIntersected) {
5065
- imageSource = EmptyTransparentImage;
5066
- imageOnLoad = undefined;
5549
+ as = 'h5',
5550
+ title,
5551
+ className
5552
+ }) => {
5553
+ if (!action) {
5554
+ return /*#__PURE__*/jsx(Title, {
5555
+ as: as,
5556
+ type: Typography.TITLE_GROUP,
5557
+ className: classNames('np-header', 'np-header__title', className),
5558
+ children: title
5559
+ });
5067
5560
  }
5068
- return /*#__PURE__*/jsx("img", {
5069
- ref: elementReference,
5070
- id: id,
5071
- alt: alt,
5072
- src: imageSource,
5073
- className: classNames(['tw-image', {
5074
- 'tw-image__stretch': stretch,
5075
- 'tw-image__shrink': shrink
5076
- }, className]),
5077
- role: role,
5078
- onLoad: imageOnLoad,
5079
- onError: onError
5561
+ if (as === 'legend') {
5562
+ // eslint-disable-next-line no-console
5563
+ console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
5564
+ }
5565
+ return /*#__PURE__*/jsxs("div", {
5566
+ className: classNames('np-header', className),
5567
+ children: [/*#__PURE__*/jsx(Title, {
5568
+ as: as,
5569
+ type: Typography.TITLE_GROUP,
5570
+ className: "np-header__title",
5571
+ children: title
5572
+ }), /*#__PURE__*/jsx(HeaderAction, {
5573
+ action: action
5574
+ })]
5080
5575
  });
5081
5576
  };
5082
5577
 
@@ -8947,227 +9442,6 @@ const ProgressBar = ({
8947
9442
  });
8948
9443
  };
8949
9444
 
8950
- const defaultPromoCardContext = {
8951
- state: '',
8952
- isDisabled: false,
8953
- // eslint-disable-next-line @typescript-eslint/no-empty-function
8954
- onChange: () => {}
8955
- };
8956
- /**
8957
- * The PromoCard context object.
8958
- */
8959
- const PromoCardContext = /*#__PURE__*/createContext(defaultPromoCardContext);
8960
- /**
8961
- * A custom hook for accessing the PromoCard context object.
8962
- *
8963
- * The `usePromoCardContext` hook is used to access the PromoCard context object
8964
- * from within a child PromoCard component. It throws an error if the context
8965
- * object is not available, which can help with debugging and development.
8966
- *
8967
- * @returns {PromoCardContextType} - The PromoCard context object.
8968
- */
8969
- const usePromoCardContext = () => {
8970
- return useContext(PromoCardContext);
8971
- };
8972
-
8973
- const PromoCardIndicator = ({
8974
- className,
8975
- children,
8976
- label,
8977
- icon,
8978
- isSmall = false,
8979
- testid,
8980
- ...rest
8981
- }) => {
8982
- const isIconString = icon && typeof icon === 'string';
8983
- const IconComponent = isIconString && {
8984
- check: Check,
8985
- arrow: ArrowRight,
8986
- download: Download
8987
- }[icon];
8988
- return /*#__PURE__*/jsxs("div", {
8989
- className: classNames('np-Card-indicator', className),
8990
- "data-testid": testid,
8991
- ...rest,
8992
- children: [label && /*#__PURE__*/jsx(Body, {
8993
- as: "span",
8994
- type: Typography.BODY_LARGE_BOLD,
8995
- className: "np-Card-indicatorText",
8996
- children: label
8997
- }), icon && /*#__PURE__*/jsx(Avatar, {
8998
- type: AvatarType.ICON,
8999
- size: isSmall ? 40 : 56,
9000
- backgroundColor: "var(--Card-indicator-icon-background-color)",
9001
- className: "np-Card-indicatorIcon",
9002
- children: IconComponent ? /*#__PURE__*/jsx(IconComponent, {
9003
- size: 24,
9004
- "aria-hidden": "true"
9005
- }) : icon
9006
- }), children]
9007
- });
9008
- };
9009
-
9010
- const PromoCard = /*#__PURE__*/forwardRef(({
9011
- className,
9012
- description,
9013
- defaultChecked,
9014
- download,
9015
- href,
9016
- hrefLang,
9017
- id,
9018
- headingLevel = 'h3',
9019
- imageAlt,
9020
- imageClass,
9021
- imageSource,
9022
- indicatorLabel,
9023
- indicatorIcon,
9024
- isChecked,
9025
- isDisabled,
9026
- onClick,
9027
- rel,
9028
- tabIndex,
9029
- target,
9030
- testId,
9031
- title,
9032
- type,
9033
- value,
9034
- isSmall,
9035
- useDisplayFont = true,
9036
- ...props
9037
- }, reference) => {
9038
- // Set the `checked` state to the value of `defaultChecked` if it is truthy,
9039
- // or the value of `isChecked` if it is truthy, or `false` if neither
9040
- // is truthy.
9041
- const {
9042
- state,
9043
- onChange,
9044
- isDisabled: contextIsDisabled
9045
- } = usePromoCardContext();
9046
- const [checked, setChecked] = useState(type === 'checkbox' ? defaultChecked ?? isChecked ?? false : false);
9047
- const handleClick = () => {
9048
- if (type === 'radio') {
9049
- onChange(value || ''); // Update the context state for radio
9050
- } else if (type === 'checkbox') {
9051
- setChecked(!checked); // Update local state for checkbox
9052
- }
9053
- };
9054
- const fallbackId = useId();
9055
- const componentId = id || fallbackId;
9056
- // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
9057
- // `'download'` if `download` is truthy. If neither condition is true, set
9058
- // `icon` to `undefined`.
9059
- // Create a function to get icon type
9060
- const getIconType = () => {
9061
- if (indicatorIcon) {
9062
- return indicatorIcon;
9063
- }
9064
- if (download) {
9065
- return 'download';
9066
- }
9067
- if (href && !type) {
9068
- return 'arrow';
9069
- }
9070
- return undefined;
9071
- };
9072
- // Define all class names string based on the values of the `href`, `type`,
9073
- // `checked`, and `className` props.
9074
- const commonClasses = classNames({
9075
- 'np-Card--promoCard': true,
9076
- 'np-Card--checked': !href && type,
9077
- 'np-Card--link': href && !type,
9078
- 'is-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined
9079
- }, className);
9080
- // Object with common props that will be passed to the `Card` components
9081
- const commonProps = {
9082
- className: commonClasses,
9083
- id: componentId,
9084
- isDisabled: isDisabled || contextIsDisabled,
9085
- onClick,
9086
- ref: reference,
9087
- 'data-testid': testId,
9088
- isSmall
9089
- };
9090
- // Object with Anchor props that will be passed to the `a` element. These
9091
- // won't be refurned if set to `isDisabled`
9092
- const anchorProps = href && !isDisabled ? {
9093
- download,
9094
- href: href || undefined,
9095
- hrefLang,
9096
- rel,
9097
- target
9098
- } : {};
9099
- // Object of all Checked props that will be passed to the root `Card` component
9100
- const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
9101
- ...commonProps,
9102
- 'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
9103
- 'aria-describedby': `${componentId}-title`,
9104
- 'aria-disabled': isDisabled,
9105
- 'data-value': value ?? undefined,
9106
- role: type === 'checkbox' || type === 'radio' ? type : undefined,
9107
- onClick: handleClick,
9108
- onKeyDown: event => {
9109
- if (event.key === 'Enter' || event.key === ' ') {
9110
- handleClick();
9111
- }
9112
- },
9113
- ref: reference,
9114
- tabIndex: 0
9115
- } : {};
9116
- const getTitle = () => {
9117
- const titleContent = href && !type ? /*#__PURE__*/jsx("a", {
9118
- className: "np-Card-titleLink",
9119
- ...anchorProps,
9120
- children: title
9121
- }) : title;
9122
- const titleProps = {
9123
- id: `${componentId}-title`,
9124
- as: headingLevel,
9125
- className: 'np-Card-title'
9126
- };
9127
- return useDisplayFont ? /*#__PURE__*/jsx(Display, {
9128
- type: Typography.DISPLAY_SMALL,
9129
- ...titleProps,
9130
- children: titleContent
9131
- }) : /*#__PURE__*/jsx(Title, {
9132
- type: Typography.TITLE_SUBSECTION,
9133
- ...titleProps,
9134
- children: titleContent
9135
- });
9136
- };
9137
- useEffect(() => {
9138
- setChecked(defaultChecked ?? isChecked ?? false);
9139
- }, [defaultChecked, isChecked]);
9140
- return /*#__PURE__*/jsxs(Card, {
9141
- ...commonProps,
9142
- ...checkedProps,
9143
- ...props,
9144
- children: [(value === state || checked) && /*#__PURE__*/jsx("span", {
9145
- className: "np-Card-check",
9146
- children: /*#__PURE__*/jsx(Check, {
9147
- size: 24,
9148
- "aria-hidden": "true"
9149
- })
9150
- }), getTitle(), /*#__PURE__*/jsx(Body, {
9151
- className: "np-Card-description",
9152
- children: description
9153
- }), imageSource && /*#__PURE__*/jsx("div", {
9154
- className: classNames('np-Card-image', {
9155
- imageClass
9156
- }),
9157
- children: /*#__PURE__*/jsx(Image, {
9158
- src: imageSource,
9159
- alt: imageAlt || '',
9160
- loading: "lazy"
9161
- })
9162
- }), /*#__PURE__*/jsx(PromoCardIndicator, {
9163
- label: indicatorLabel,
9164
- icon: getIconType(),
9165
- isSmall: isSmall
9166
- })]
9167
- });
9168
- });
9169
- var PromoCard$1 = /*#__PURE__*/React__default.memo(PromoCard);
9170
-
9171
9445
  const PromoCardGroup = ({
9172
9446
  children,
9173
9447
  className,
@@ -14461,5 +14735,5 @@ const translations = {
14461
14735
  'zh-HK': zhHK
14462
14736
  };
14463
14737
 
14464
- 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, 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 };
14738
+ 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, 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 };
14465
14739
  //# sourceMappingURL=index.mjs.map