@transferwise/components 0.0.0-experimental-e9526a8 → 0.0.0-experimental-9a61b0a

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.
Files changed (61) hide show
  1. package/build/i18n/en.json +8 -0
  2. package/build/index.esm.js +388 -241
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +387 -240
  5. package/build/index.js.map +1 -1
  6. package/build/main.css +1 -1
  7. package/build/styles/dateLookup/DateLookup.css +1 -1
  8. package/build/styles/main.css +1 -1
  9. package/build/types/common/focusBoundary/FocusBoundary.d.ts +2 -2
  10. package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
  11. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts +2 -0
  12. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts.map +1 -0
  13. package/build/types/common/focusBoundary/utils/index.d.ts +3 -0
  14. package/build/types/common/focusBoundary/utils/index.d.ts.map +1 -0
  15. package/build/types/common/focusBoundary/utils/resetFocus.d.ts +2 -0
  16. package/build/types/common/focusBoundary/utils/resetFocus.d.ts.map +1 -0
  17. package/build/types/dateLookup/DateLookup.messages.d.ts +65 -0
  18. package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
  19. package/build/types/dateLookup/dateHeader/DateHeader.d.ts +3 -1
  20. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  21. package/build/types/dateLookup/tableLink/TableLink.d.ts +4 -26
  22. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  23. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +4 -29
  24. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
  25. package/build/types/upload/steps/completeStep/completeStep.d.ts.map +1 -1
  26. package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
  27. package/package.json +1 -2
  28. package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +1 -8
  29. package/src/common/focusBoundary/FocusBoundary.spec.tsx +66 -0
  30. package/src/common/focusBoundary/FocusBoundary.tsx +36 -6
  31. package/src/common/focusBoundary/__snapshots__/FocusBoundary.spec.tsx.snap +16 -0
  32. package/src/common/focusBoundary/utils/getFocusableElements.js +25 -0
  33. package/src/common/focusBoundary/utils/getFocusableElements.spec.js +51 -0
  34. package/src/common/focusBoundary/utils/index.js +2 -0
  35. package/src/common/focusBoundary/utils/resetFocus.js +23 -0
  36. package/src/common/focusBoundary/utils/resetFocus.spec.js +103 -0
  37. package/src/dateLookup/DateLookup.css +1 -1
  38. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -3
  39. package/src/dateLookup/DateLookup.less +4 -0
  40. package/src/dateLookup/DateLookup.messages.js +44 -0
  41. package/src/dateLookup/DateLookup.testingLibrary.spec.js +39 -0
  42. package/src/dateLookup/dateHeader/DateHeader.js +48 -26
  43. package/src/dateLookup/dateHeader/DateHeader.spec.js +37 -0
  44. package/src/dateLookup/dayCalendar/DayCalendar.js +3 -1
  45. package/src/dateLookup/dayCalendar/DayCalendar.spec.js +7 -1
  46. package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +7 -3
  47. package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +1 -0
  48. package/src/dateLookup/monthCalendar/MonthCalendar.js +3 -1
  49. package/src/dateLookup/monthCalendar/MonthCalendar.spec.js +7 -1
  50. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +4 -5
  51. package/src/dateLookup/tableLink/TableLink.js +24 -3
  52. package/src/dateLookup/tableLink/TableLink.spec.js +60 -4
  53. package/src/dateLookup/yearCalendar/YearCalendar.js +16 -3
  54. package/src/dateLookup/yearCalendar/YearCalendar.spec.js +14 -1
  55. package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +4 -5
  56. package/src/i18n/en.json +8 -0
  57. package/src/main.css +1 -1
  58. package/src/upload/Upload.js +1 -1
  59. package/src/upload/steps/completeStep/completeStep.js +4 -1
  60. package/src/upload/steps/processingStep/processingStep.js +1 -0
  61. package/src/uploadInput/uploadItem/UploadItem.tsx +1 -1
package/build/index.js CHANGED
@@ -11,9 +11,8 @@ var formatting = require('@transferwise/formatting');
11
11
  var throttle = require('lodash.throttle');
12
12
  var reactTransitionGroup = require('react-transition-group');
13
13
  var reactDom = require('react-dom');
14
- var focus = require('@react-aria/focus');
15
- var mergeRefs = require('react-merge-refs');
16
14
  var neptuneValidation = require('@transferwise/neptune-validation');
15
+ var mergeRefs = require('react-merge-refs');
17
16
  var reactPopper = require('react-popper');
18
17
  var react$1 = require('@headlessui/react');
19
18
  var reactId = require('@radix-ui/react-id');
@@ -796,7 +795,7 @@ const ActionOption = ({
796
795
  });
797
796
  };
798
797
 
799
- var messages$8 = reactIntl.defineMessages({
798
+ var messages$9 = reactIntl.defineMessages({
800
799
  ariaLabel: {
801
800
  id: "neptune.CloseButton.ariaLabel"
802
801
  }
@@ -812,7 +811,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
812
811
  testId
813
812
  }, reference) {
814
813
  const intl = reactIntl.useIntl();
815
- ariaLabel ??= intl.formatMessage(messages$8.ariaLabel);
814
+ ariaLabel ??= intl.formatMessage(messages$9.ariaLabel);
816
815
  const Icon = filled ? icons.CrossCircleFill : icons.Cross;
817
816
  return /*#__PURE__*/jsxRuntime.jsx("button", {
818
817
  ref: reference,
@@ -832,7 +831,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
832
831
  });
833
832
  });
834
833
 
835
- var messages$7 = reactIntl.defineMessages({
834
+ var messages$8 = reactIntl.defineMessages({
836
835
  opensInNewTab: {
837
836
  id: "neptune.Link.opensInNewTab"
838
837
  }
@@ -861,7 +860,7 @@ const Link = ({
861
860
  onClick: onClick,
862
861
  ...props,
863
862
  children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
864
- title: formatMessage(messages$7.opensInNewTab)
863
+ title: formatMessage(messages$8.opensInNewTab)
865
864
  })]
866
865
  });
867
866
  };
@@ -1491,22 +1490,269 @@ function getInitials(name) {
1491
1490
  return allInitials[0] + allInitials.slice(-1);
1492
1491
  }
1493
1492
 
1493
+ const THROTTLE_MS = 100;
1494
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1495
+ const useClientWidth = ({
1496
+ ref,
1497
+ throttleMs = THROTTLE_MS
1498
+ }) => {
1499
+ const [clientWidth, setClientWidth] = React.useState(null);
1500
+ useIsomorphicLayoutEffect(() => {
1501
+ // eslint-disable-next-line unicorn/consistent-function-scoping
1502
+ const updateClientWidth = () => {
1503
+ if (ref) {
1504
+ // when `ref` is a window
1505
+ if ('innerWidth' in ref) {
1506
+ setClientWidth(ref.innerWidth);
1507
+ }
1508
+ // when `ref` is an element
1509
+ else if (ref.current) {
1510
+ setClientWidth(ref.current.clientWidth);
1511
+ }
1512
+ }
1513
+ };
1514
+ // This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
1515
+ // If throttle gets passed directly to both add and removeEventListenet the results will be that the event
1516
+ // won't get removed even if the component is unmounted.
1517
+ const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
1518
+ window.addEventListener('resize', attachedFunction, true);
1519
+ // using requestAnimationFrame to perform the calculation before the next repaint
1520
+ // getting width earlier causes issues in animations when used with react-transition-group
1521
+ window.requestAnimationFrame(updateClientWidth);
1522
+ return () => window.removeEventListener('resize', attachedFunction, true);
1523
+ }, []);
1524
+ return [clientWidth];
1525
+ };
1526
+ useClientWidth.THROTTLE_MS = THROTTLE_MS;
1527
+
1528
+ const useConditionalListener = ({
1529
+ attachListener,
1530
+ callback,
1531
+ eventType,
1532
+ parent
1533
+ }) => {
1534
+ React.useEffect(() => {
1535
+ if (attachListener && !neptuneValidation.isUndefined(parent)) {
1536
+ parent.addEventListener(eventType, callback, true);
1537
+ }
1538
+ return () => {
1539
+ if (!neptuneValidation.isUndefined(parent)) {
1540
+ parent.removeEventListener(eventType, callback, true);
1541
+ }
1542
+ };
1543
+ }, [attachListener, callback, eventType, parent]);
1544
+ };
1545
+
1546
+ const DirectionContext = /*#__PURE__*/React.createContext(exports.Direction.LTR);
1547
+ const DirectionProvider = ({
1548
+ direction,
1549
+ children
1550
+ }) => {
1551
+ return /*#__PURE__*/jsxRuntime.jsx(DirectionContext.Provider, {
1552
+ value: direction,
1553
+ children: children
1554
+ });
1555
+ };
1556
+
1557
+ const useDirection = () => {
1558
+ const direction = React.useContext(DirectionContext);
1559
+ return {
1560
+ direction,
1561
+ isRTL: direction === 'rtl'
1562
+ };
1563
+ };
1564
+
1565
+ const ObserverParams = {
1566
+ threshold: 0.1
1567
+ };
1568
+
1569
+ /**
1570
+ * useHasIntersected.
1571
+ * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
1572
+ * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
1573
+ *
1574
+ * @param elRef.elRef
1575
+ * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
1576
+ * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
1577
+ * @param elRef.loading
1578
+ * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
1579
+ */
1580
+ const useHasIntersected = ({
1581
+ elRef,
1582
+ loading
1583
+ }) => {
1584
+ const [hasIntersected, setHasIntersected] = React.useState(false);
1585
+ const {
1586
+ current
1587
+ } = elRef || {};
1588
+ const isValidReference = () => {
1589
+ return elRef && current;
1590
+ };
1591
+ const handleOnIntersect = (entries, observer) => {
1592
+ entries.forEach(entry => {
1593
+ if (entry.isIntersecting) {
1594
+ setHasIntersected(true);
1595
+ observer.unobserve(current);
1596
+ }
1597
+ });
1598
+ };
1599
+ React.useEffect(() => {
1600
+ let observer;
1601
+ let didCancel = false;
1602
+
1603
+ // Check if window is define for SSR and Old browsers fallback
1604
+ if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
1605
+ setHasIntersected(true);
1606
+ } else if (!didCancel) {
1607
+ observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
1608
+ observer.observe(current);
1609
+ }
1610
+ return () => {
1611
+ didCancel = true;
1612
+ if (observer) {
1613
+ observer.unobserve(current);
1614
+ }
1615
+ };
1616
+ }, [elRef]);
1617
+ if (loading === 'eager') {
1618
+ return [false];
1619
+ }
1620
+ return [hasIntersected];
1621
+ };
1622
+
1623
+ const useLayout = () => {
1624
+ const windowReference = typeof window === 'undefined' ? undefined : window;
1625
+ const [breakpoint, setBreakpoint] = React.useState();
1626
+ const [clientWidth] = useClientWidth({
1627
+ ref: windowReference
1628
+ });
1629
+ React.useEffect(() => {
1630
+ if (!clientWidth) {
1631
+ return;
1632
+ }
1633
+ if (clientWidth <= exports.Breakpoint.EXTRA_SMALL) {
1634
+ setBreakpoint(exports.Breakpoint.EXTRA_SMALL);
1635
+ return;
1636
+ }
1637
+ if (exports.Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= exports.Breakpoint.SMALL) {
1638
+ setBreakpoint(exports.Breakpoint.SMALL);
1639
+ return;
1640
+ }
1641
+ if (exports.Breakpoint.SMALL < clientWidth && clientWidth <= exports.Breakpoint.MEDIUM) {
1642
+ setBreakpoint(exports.Breakpoint.MEDIUM);
1643
+ return;
1644
+ }
1645
+ if (exports.Breakpoint.MEDIUM < clientWidth && clientWidth <= exports.Breakpoint.LARGE) {
1646
+ setBreakpoint(exports.Breakpoint.LARGE);
1647
+ return;
1648
+ }
1649
+ if (exports.Breakpoint.LARGE < clientWidth) {
1650
+ setBreakpoint(exports.Breakpoint.EXTRA_LARGE);
1651
+ }
1652
+ }, [clientWidth]);
1653
+ return {
1654
+ isMobile: !!breakpoint && [exports.Breakpoint.EXTRA_SMALL, exports.Breakpoint.SMALL].includes(breakpoint),
1655
+ isExtraSmall: breakpoint === exports.Breakpoint.EXTRA_SMALL,
1656
+ isSmall: breakpoint === exports.Breakpoint.SMALL,
1657
+ isMedium: breakpoint === exports.Breakpoint.MEDIUM,
1658
+ isLarge: breakpoint === exports.Breakpoint.LARGE,
1659
+ isExtraLarge: breakpoint === exports.Breakpoint.EXTRA_LARGE
1660
+ };
1661
+ };
1662
+
1663
+ /**
1664
+ * This function returns the first and the last focusable elements within a node.
1665
+ *
1666
+ * @param {Node} focusBoundaryContainer - the area that contains focused elements.
1667
+ * @returns {object} focusableEls - which contains the first focusable element and the last focusable element. First and last can be the same element if area contains one or none focusable element.
1668
+ */
1669
+
1670
+ const getFocusableElements = focusBoundaryContainer => {
1671
+ const focusableEls = {
1672
+ first: focusBoundaryContainer,
1673
+ last: focusBoundaryContainer
1674
+ };
1675
+ if (focusBoundaryContainer?.querySelectorAll) {
1676
+ const allEls = [...focusBoundaryContainer.querySelectorAll('a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter(element => !element.hasAttribute('disabled'));
1677
+ if (allEls.length > 0) {
1678
+ [focusableEls.first] = allEls;
1679
+ focusableEls.last = allEls[allEls.length - 1];
1680
+ }
1681
+ }
1682
+ return focusableEls;
1683
+ };
1684
+
1685
+ /**
1686
+ * This function resets the focus to either last of first focusable elements within a node.
1687
+ *
1688
+ * @param {object} focusableEls - contains the first last of first focusable elements within a node.
1689
+ * @param {object} event - the triggered event
1690
+ */
1691
+
1692
+ const resetFocus = ({
1693
+ focusableEls: {
1694
+ first,
1695
+ last
1696
+ },
1697
+ event
1698
+ }) => {
1699
+ const {
1700
+ activeElement
1701
+ } = document;
1702
+ if (event.shiftKey && activeElement === first) {
1703
+ if (last) {
1704
+ last.focus();
1705
+ }
1706
+ event.preventDefault();
1707
+ }
1708
+ if (!event.shiftKey && activeElement === last) {
1709
+ if (first) {
1710
+ first.focus();
1711
+ }
1712
+ event.preventDefault();
1713
+ }
1714
+ };
1715
+
1716
+ const {
1717
+ TAB
1718
+ } = Key;
1494
1719
  const FocusBoundary = ({
1495
1720
  children
1496
1721
  }) => {
1497
- return (
1498
- /*#__PURE__*/
1499
- // eslint-disable-next-line jsx-a11y/no-autofocus
1500
- jsxRuntime.jsx(focus.FocusScope, {
1501
- contain: true,
1502
- restoreFocus: true,
1503
- autoFocus: true,
1504
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
1505
- tabIndex: -1,
1506
- children: children
1507
- })
1508
- })
1509
- );
1722
+ const boundaryReference = React.useRef(null);
1723
+ const parent = neptuneValidation.isUndefined(document) ? undefined : document;
1724
+ const [focusableEls, setFocusableEls] = React.useState({});
1725
+ React.useEffect(() => {
1726
+ if (boundaryReference?.current) {
1727
+ boundaryReference.current.focus({
1728
+ preventScroll: true
1729
+ });
1730
+ setFocusableEls(getFocusableElements(boundaryReference.current));
1731
+ }
1732
+ }, []);
1733
+ // If event type is Tab the resetFocus will force the focus to either the first focusable or last in boundaryRef .
1734
+ useConditionalListener({
1735
+ eventType: 'keydown',
1736
+ callback: event => {
1737
+ if (neptuneValidation.isKey({
1738
+ keyType: TAB,
1739
+ event
1740
+ })) {
1741
+ resetFocus({
1742
+ event,
1743
+ focusableEls
1744
+ });
1745
+ }
1746
+ },
1747
+ attachListener: true,
1748
+ parent
1749
+ });
1750
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1751
+ ref: boundaryReference,
1752
+ tabIndex: -1,
1753
+ className: "np-focus-boundary outline-none",
1754
+ children: children
1755
+ });
1510
1756
  };
1511
1757
  var FocusBoundary$1 = FocusBoundary;
1512
1758
 
@@ -1761,176 +2007,6 @@ SlidingPanel.defaultProps = {
1761
2007
  };
1762
2008
  var SlidingPanel$1 = SlidingPanel;
1763
2009
 
1764
- const THROTTLE_MS = 100;
1765
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1766
- const useClientWidth = ({
1767
- ref,
1768
- throttleMs = THROTTLE_MS
1769
- }) => {
1770
- const [clientWidth, setClientWidth] = React.useState(null);
1771
- useIsomorphicLayoutEffect(() => {
1772
- // eslint-disable-next-line unicorn/consistent-function-scoping
1773
- const updateClientWidth = () => {
1774
- if (ref) {
1775
- // when `ref` is a window
1776
- if ('innerWidth' in ref) {
1777
- setClientWidth(ref.innerWidth);
1778
- }
1779
- // when `ref` is an element
1780
- else if (ref.current) {
1781
- setClientWidth(ref.current.clientWidth);
1782
- }
1783
- }
1784
- };
1785
- // This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
1786
- // If throttle gets passed directly to both add and removeEventListenet the results will be that the event
1787
- // won't get removed even if the component is unmounted.
1788
- const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
1789
- window.addEventListener('resize', attachedFunction, true);
1790
- // using requestAnimationFrame to perform the calculation before the next repaint
1791
- // getting width earlier causes issues in animations when used with react-transition-group
1792
- window.requestAnimationFrame(updateClientWidth);
1793
- return () => window.removeEventListener('resize', attachedFunction, true);
1794
- }, []);
1795
- return [clientWidth];
1796
- };
1797
- useClientWidth.THROTTLE_MS = THROTTLE_MS;
1798
-
1799
- const useConditionalListener = ({
1800
- attachListener,
1801
- callback,
1802
- eventType,
1803
- parent
1804
- }) => {
1805
- React.useEffect(() => {
1806
- if (attachListener && !neptuneValidation.isUndefined(parent)) {
1807
- parent.addEventListener(eventType, callback, true);
1808
- }
1809
- return () => {
1810
- if (!neptuneValidation.isUndefined(parent)) {
1811
- parent.removeEventListener(eventType, callback, true);
1812
- }
1813
- };
1814
- }, [attachListener, callback, eventType, parent]);
1815
- };
1816
-
1817
- const DirectionContext = /*#__PURE__*/React.createContext(exports.Direction.LTR);
1818
- const DirectionProvider = ({
1819
- direction,
1820
- children
1821
- }) => {
1822
- return /*#__PURE__*/jsxRuntime.jsx(DirectionContext.Provider, {
1823
- value: direction,
1824
- children: children
1825
- });
1826
- };
1827
-
1828
- const useDirection = () => {
1829
- const direction = React.useContext(DirectionContext);
1830
- return {
1831
- direction,
1832
- isRTL: direction === 'rtl'
1833
- };
1834
- };
1835
-
1836
- const ObserverParams = {
1837
- threshold: 0.1
1838
- };
1839
-
1840
- /**
1841
- * useHasIntersected.
1842
- * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
1843
- * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
1844
- *
1845
- * @param elRef.elRef
1846
- * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
1847
- * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
1848
- * @param elRef.loading
1849
- * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
1850
- */
1851
- const useHasIntersected = ({
1852
- elRef,
1853
- loading
1854
- }) => {
1855
- const [hasIntersected, setHasIntersected] = React.useState(false);
1856
- const {
1857
- current
1858
- } = elRef || {};
1859
- const isValidReference = () => {
1860
- return elRef && current;
1861
- };
1862
- const handleOnIntersect = (entries, observer) => {
1863
- entries.forEach(entry => {
1864
- if (entry.isIntersecting) {
1865
- setHasIntersected(true);
1866
- observer.unobserve(current);
1867
- }
1868
- });
1869
- };
1870
- React.useEffect(() => {
1871
- let observer;
1872
- let didCancel = false;
1873
-
1874
- // Check if window is define for SSR and Old browsers fallback
1875
- if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
1876
- setHasIntersected(true);
1877
- } else if (!didCancel) {
1878
- observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
1879
- observer.observe(current);
1880
- }
1881
- return () => {
1882
- didCancel = true;
1883
- if (observer) {
1884
- observer.unobserve(current);
1885
- }
1886
- };
1887
- }, [elRef]);
1888
- if (loading === 'eager') {
1889
- return [false];
1890
- }
1891
- return [hasIntersected];
1892
- };
1893
-
1894
- const useLayout = () => {
1895
- const windowReference = typeof window === 'undefined' ? undefined : window;
1896
- const [breakpoint, setBreakpoint] = React.useState();
1897
- const [clientWidth] = useClientWidth({
1898
- ref: windowReference
1899
- });
1900
- React.useEffect(() => {
1901
- if (!clientWidth) {
1902
- return;
1903
- }
1904
- if (clientWidth <= exports.Breakpoint.EXTRA_SMALL) {
1905
- setBreakpoint(exports.Breakpoint.EXTRA_SMALL);
1906
- return;
1907
- }
1908
- if (exports.Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= exports.Breakpoint.SMALL) {
1909
- setBreakpoint(exports.Breakpoint.SMALL);
1910
- return;
1911
- }
1912
- if (exports.Breakpoint.SMALL < clientWidth && clientWidth <= exports.Breakpoint.MEDIUM) {
1913
- setBreakpoint(exports.Breakpoint.MEDIUM);
1914
- return;
1915
- }
1916
- if (exports.Breakpoint.MEDIUM < clientWidth && clientWidth <= exports.Breakpoint.LARGE) {
1917
- setBreakpoint(exports.Breakpoint.LARGE);
1918
- return;
1919
- }
1920
- if (exports.Breakpoint.LARGE < clientWidth) {
1921
- setBreakpoint(exports.Breakpoint.EXTRA_LARGE);
1922
- }
1923
- }, [clientWidth]);
1924
- return {
1925
- isMobile: !!breakpoint && [exports.Breakpoint.EXTRA_SMALL, exports.Breakpoint.SMALL].includes(breakpoint),
1926
- isExtraSmall: breakpoint === exports.Breakpoint.EXTRA_SMALL,
1927
- isSmall: breakpoint === exports.Breakpoint.SMALL,
1928
- isMedium: breakpoint === exports.Breakpoint.MEDIUM,
1929
- isLarge: breakpoint === exports.Breakpoint.LARGE,
1930
- isExtraLarge: breakpoint === exports.Breakpoint.EXTRA_LARGE
1931
- };
1932
- };
1933
-
1934
2010
  const INITIAL_Y_POSITION = 0;
1935
2011
  const CONTENT_SCROLL_THRESHOLD = 1;
1936
2012
  const MOVE_OFFSET_THRESHOLD = 50;
@@ -2494,7 +2570,7 @@ const Chip = ({
2494
2570
  }, value);
2495
2571
  };
2496
2572
 
2497
- var messages$6 = reactIntl.defineMessages({
2573
+ var messages$7 = reactIntl.defineMessages({
2498
2574
  ariaLabel: {
2499
2575
  id: "neptune.Chips.ariaLabel"
2500
2576
  }
@@ -2526,7 +2602,7 @@ const Chips = ({
2526
2602
  value: chip.value,
2527
2603
  label: chip.label,
2528
2604
  closeButton: {
2529
- 'aria-label': intl.formatMessage(messages$6.ariaLabel, {
2605
+ 'aria-label': intl.formatMessage(messages$7.ariaLabel, {
2530
2606
  choice: chip.label
2531
2607
  })
2532
2608
  },
@@ -2634,7 +2710,7 @@ const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateO
2634
2710
 
2635
2711
  const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
2636
2712
 
2637
- var messages$5 = reactIntl.defineMessages({
2713
+ var messages$6 = reactIntl.defineMessages({
2638
2714
  monthLabel: {
2639
2715
  id: "neptune.DateInput.month.label"
2640
2716
  },
@@ -2712,12 +2788,12 @@ const DateInput = ({
2712
2788
  const [month, setMonth] = React.useState(() => getExplodedDate('month'));
2713
2789
  const [year, setYear] = React.useState(() => getExplodedDate('year'));
2714
2790
  const [lastBroadcastedValue, setLastBroadcastedValue] = React.useState(getDateObject);
2715
- dayLabel = dayLabel || formatMessage(messages$5.dayLabel);
2716
- monthLabel = monthLabel || formatMessage(messages$5.monthLabel);
2717
- yearLabel = yearLabel || formatMessage(messages$5.yearLabel);
2791
+ dayLabel = dayLabel || formatMessage(messages$6.dayLabel);
2792
+ monthLabel = monthLabel || formatMessage(messages$6.monthLabel);
2793
+ yearLabel = yearLabel || formatMessage(messages$6.yearLabel);
2718
2794
  placeholders = {
2719
2795
  day: placeholders?.day || 'DD',
2720
- month: placeholders?.month || formatMessage(messages$5.monthLabel),
2796
+ month: placeholders?.month || formatMessage(messages$6.monthLabel),
2721
2797
  year: placeholders?.year || 'YYYY'
2722
2798
  };
2723
2799
  const getDateAsString = date => {
@@ -3148,7 +3224,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
3148
3224
  });
3149
3225
  var ResponsivePanel$1 = ResponsivePanel;
3150
3226
 
3151
- var messages$4 = reactIntl.defineMessages({
3227
+ var messages$5 = reactIntl.defineMessages({
3152
3228
  ariaLabel: {
3153
3229
  id: "neptune.ClearButton.ariaLabel"
3154
3230
  }
@@ -3211,7 +3287,7 @@ const DateTrigger = ({
3211
3287
  className: "input-group-addon",
3212
3288
  children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
3213
3289
  className: `clear-btn clear-btn--${size}`,
3214
- "aria-label": formatMessage(messages$4.ariaLabel),
3290
+ "aria-label": formatMessage(messages$5.ariaLabel),
3215
3291
  size: exports.Size.SMALL,
3216
3292
  onClick: event => {
3217
3293
  event.stopPropagation();
@@ -3241,50 +3317,85 @@ DateTrigger.defaultProps = {
3241
3317
  };
3242
3318
  var DateTrigger$1 = DateTrigger;
3243
3319
 
3320
+ var messages$4 = reactIntl.defineMessages({
3321
+ next: {
3322
+ id: "neptune.DateLookup.next"
3323
+ },
3324
+ previous: {
3325
+ id: "neptune.DateLookup.previous"
3326
+ },
3327
+ day: {
3328
+ id: "neptune.DateLookup.day"
3329
+ },
3330
+ month: {
3331
+ id: "neptune.DateLookup.month"
3332
+ },
3333
+ year: {
3334
+ id: "neptune.DateLookup.year"
3335
+ },
3336
+ twentyYears: {
3337
+ id: "neptune.DateLookup.twentyYears"
3338
+ },
3339
+ selected: {
3340
+ id: "neptune.DateLookup.selected"
3341
+ },
3342
+ goTo20YearView: {
3343
+ id: "neptune.DateLookup.goTo20YearView"
3344
+ }
3345
+ });
3346
+
3244
3347
  const buttonClasses = 'btn-link p-a-0 text-no-decoration np-text-body-large-bold rounded-sm';
3245
3348
  const DateHeader = ({
3246
3349
  label,
3247
3350
  onLabelClick,
3248
3351
  onPreviousClick,
3249
- onNextClick
3250
- }) => /*#__PURE__*/jsxRuntime.jsxs("div", {
3251
- className: "text-xs-center p-t-1 p-b-2 clearfix",
3252
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
3253
- className: "pull-left-single-direction",
3254
- children: /*#__PURE__*/jsxRuntime.jsx("button", {
3255
- type: "button",
3256
- className: `d-inline-flex ${buttonClasses}`,
3257
- onClick: onPreviousClick,
3258
- children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3259
- orientation: exports.Position.LEFT,
3260
- className: "left-single-direction",
3261
- size: exports.Size.MEDIUM
3352
+ onNextClick,
3353
+ dateMode
3354
+ }) => {
3355
+ const intl = reactIntl.useIntl();
3356
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
3357
+ className: "text-xs-center p-t-1 p-b-2 clearfix",
3358
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
3359
+ className: "pull-left-single-direction",
3360
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
3361
+ type: "button",
3362
+ className: `d-inline-flex ${buttonClasses}`,
3363
+ "aria-label": `${intl.formatMessage(messages$4.previous)} ${dateMode}`,
3364
+ onClick: onPreviousClick,
3365
+ children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3366
+ orientation: exports.Position.LEFT,
3367
+ className: "left-single-direction",
3368
+ size: exports.Size.MEDIUM
3369
+ })
3262
3370
  })
3263
- })
3264
- }), label && /*#__PURE__*/jsxRuntime.jsx("button", {
3265
- type: "button",
3266
- className: `tw-date-lookup-header-current ${buttonClasses}`,
3267
- onClick: onLabelClick,
3268
- children: label
3269
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
3270
- className: "pull-right-single-direction",
3271
- children: /*#__PURE__*/jsxRuntime.jsx("button", {
3371
+ }), label && /*#__PURE__*/jsxRuntime.jsx("button", {
3272
3372
  type: "button",
3273
- className: `d-inline-flex ${buttonClasses}`,
3274
- onClick: onNextClick,
3275
- children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3276
- orientation: exports.Position.RIGHT,
3277
- className: "right-single-direction",
3278
- size: exports.Size.MEDIUM
3373
+ className: `tw-date-lookup-header-current ${buttonClasses}`,
3374
+ "aria-label": intl.formatMessage(messages$4.goTo20YearView),
3375
+ onClick: onLabelClick,
3376
+ children: label
3377
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
3378
+ className: "pull-right-single-direction",
3379
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
3380
+ type: "button",
3381
+ className: `d-inline-flex ${buttonClasses}`,
3382
+ "aria-label": `${reactIntl.useIntl().formatMessage(messages$4.next)} ${dateMode}`,
3383
+ onClick: onNextClick,
3384
+ children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3385
+ orientation: exports.Position.RIGHT,
3386
+ className: "right-single-direction",
3387
+ size: exports.Size.MEDIUM
3388
+ })
3279
3389
  })
3280
- })
3281
- })]
3282
- });
3390
+ })]
3391
+ });
3392
+ };
3283
3393
  DateHeader.propTypes = {
3284
3394
  label: PropTypes__default.default.string,
3285
3395
  onLabelClick: PropTypes__default.default.func,
3286
3396
  onPreviousClick: PropTypes__default.default.func.isRequired,
3287
- onNextClick: PropTypes__default.default.func.isRequired
3397
+ onNextClick: PropTypes__default.default.func.isRequired,
3398
+ dateMode: PropTypes__default.default.string
3288
3399
  };
3289
3400
  DateHeader.defaultProps = {
3290
3401
  label: null,
@@ -3310,6 +3421,12 @@ class TableLink extends React.PureComponent {
3310
3421
  this.props.onClick(this.props.item);
3311
3422
  }
3312
3423
  };
3424
+ calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
3425
+ if (active) {
3426
+ return `${longTitle || title}, ${formatMessage(messages$4.selected)} ${formatMessage(messages$4[type])}`;
3427
+ }
3428
+ return longTitle || title;
3429
+ };
3313
3430
  render() {
3314
3431
  const {
3315
3432
  item,
@@ -3318,14 +3435,17 @@ class TableLink extends React.PureComponent {
3318
3435
  longTitle,
3319
3436
  active,
3320
3437
  disabled,
3321
- today
3438
+ today,
3439
+ intl: {
3440
+ formatMessage
3441
+ }
3322
3442
  } = this.props;
3323
3443
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
3324
3444
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
3325
3445
  type: "button",
3326
3446
  className: `tw-date-lookup-${type}-option ${active ? 'active' : ''} ${today ? 'today' : ''} np-text-body-default-bold`,
3327
3447
  disabled: disabled,
3328
- "aria-label": longTitle,
3448
+ "aria-label": this.calculateAriaLabel(longTitle, title, active, type, formatMessage),
3329
3449
  onClick: this.onClick,
3330
3450
  children: title || item
3331
3451
  })
@@ -3347,7 +3467,7 @@ TableLink.defaultProps = {
3347
3467
  title: null,
3348
3468
  longTitle: null
3349
3469
  };
3350
- var TableLink$1 = TableLink;
3470
+ var TableLink$1 = reactIntl.injectIntl(TableLink);
3351
3471
 
3352
3472
  const SHORT_DAY_FORMAT = {
3353
3473
  day: 'numeric'
@@ -3391,6 +3511,7 @@ class DayCalendarTable extends React.PureComponent {
3391
3511
  };
3392
3512
  days = getDayNames(this.props.intl.locale, 'short');
3393
3513
  daysShort = getDayNames(this.props.intl.locale, 'narrow');
3514
+ daysLong = getDayNames(this.props.intl.locale, 'long');
3394
3515
  selectDay = day => {
3395
3516
  const {
3396
3517
  viewMonth,
@@ -3434,10 +3555,16 @@ class DayCalendarTable extends React.PureComponent {
3434
3555
  className: "text-xs-center np-text-body-default-bold",
3435
3556
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
3436
3557
  className: "hidden-xs",
3437
- children: day.slice(0, 3)
3558
+ children: /*#__PURE__*/jsxRuntime.jsx("abbr", {
3559
+ title: this.daysLong[index],
3560
+ children: day.slice(0, 3)
3561
+ })
3438
3562
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
3439
3563
  className: "visible-xs-inline-block",
3440
- children: this.daysShort[index].slice(0, 2)
3564
+ children: /*#__PURE__*/jsxRuntime.jsx("abbr", {
3565
+ title: this.daysLong[index],
3566
+ children: this.daysShort[index].slice(0, 2)
3567
+ })
3441
3568
  })]
3442
3569
  }, day))
3443
3570
  })
@@ -3505,7 +3632,8 @@ class DayCalendar extends React.PureComponent {
3505
3632
  viewMonth,
3506
3633
  viewYear,
3507
3634
  intl: {
3508
- locale
3635
+ locale,
3636
+ formatMessage
3509
3637
  },
3510
3638
  monthFormat,
3511
3639
  onLabelClick,
@@ -3517,6 +3645,7 @@ class DayCalendar extends React.PureComponent {
3517
3645
  month: monthFormat,
3518
3646
  year: 'numeric'
3519
3647
  }),
3648
+ dateMode: formatMessage(messages$4.month),
3520
3649
  onLabelClick: onLabelClick,
3521
3650
  onPreviousClick: this.selectPreviousMonth,
3522
3651
  onNextClick: this.selectNextMonth
@@ -3636,13 +3765,15 @@ class MonthCalendar extends React.PureComponent {
3636
3765
  max,
3637
3766
  viewYear,
3638
3767
  intl: {
3639
- locale
3768
+ locale,
3769
+ formatMessage
3640
3770
  },
3641
3771
  placeholder,
3642
3772
  onLabelClick
3643
3773
  } = this.props;
3644
3774
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3645
3775
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
3776
+ dateMode: formatMessage(messages$4.year),
3646
3777
  label: formatting.formatDate(new Date(viewYear, 0), locale, {
3647
3778
  year: 'numeric'
3648
3779
  }),
@@ -3760,10 +3891,14 @@ class YearCalendar extends React.PureComponent {
3760
3891
  min,
3761
3892
  max,
3762
3893
  viewYear,
3763
- placeholder
3894
+ placeholder,
3895
+ intl: {
3896
+ formatMessage
3897
+ }
3764
3898
  } = this.props;
3765
3899
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3766
3900
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
3901
+ dateMode: formatMessage(messages$4.twentyYears),
3767
3902
  onPreviousClick: this.selectPreviousYears,
3768
3903
  onNextClick: this.selectNextYears
3769
3904
  }), /*#__PURE__*/jsxRuntime.jsx(YearCalendarTable$1, {
@@ -3791,7 +3926,7 @@ YearCalendar.defaultProps = {
3791
3926
  min: null,
3792
3927
  max: null
3793
3928
  };
3794
- var YearCalendar$1 = YearCalendar;
3929
+ var YearCalendar$1 = reactIntl.injectIntl(YearCalendar);
3795
3930
 
3796
3931
  const MODE = {
3797
3932
  DAY: 'day',
@@ -6456,7 +6591,7 @@ function SelectInput({
6456
6591
  children: [onClear != null && value != null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
6457
6592
  children: [/*#__PURE__*/jsxRuntime.jsx("button", {
6458
6593
  type: "button",
6459
- "aria-label": intl.formatMessage(messages$4.ariaLabel),
6594
+ "aria-label": intl.formatMessage(messages$5.ariaLabel),
6460
6595
  disabled: uiDisabled,
6461
6596
  className: "np-select-input-addon np-select-input-addon--interactive",
6462
6597
  onClick: event => {
@@ -10530,6 +10665,14 @@ var en = {
10530
10665
  "neptune.DateInput.day.label": "Day",
10531
10666
  "neptune.DateInput.month.label": "Month",
10532
10667
  "neptune.DateInput.year.label": "Year",
10668
+ "neptune.DateLookup.day": "day",
10669
+ "neptune.DateLookup.goTo20YearView": "Go to 20 year view",
10670
+ "neptune.DateLookup.month": "month",
10671
+ "neptune.DateLookup.next": "next",
10672
+ "neptune.DateLookup.previous": "previous",
10673
+ "neptune.DateLookup.selected": "selected",
10674
+ "neptune.DateLookup.twentyYears": "20 years",
10675
+ "neptune.DateLookup.year": "year",
10533
10676
  "neptune.Link.opensInNewTab": "(opens in new tab)",
10534
10677
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
10535
10678
  "neptune.Select.searchPlaceholder": "Search...",
@@ -13037,6 +13180,7 @@ const ProcessingStep = props => {
13037
13180
  'm-b-2': isModern
13038
13181
  }),
13039
13182
  type: exports.Typography.TITLE_BODY,
13183
+ "aria-live": "polite",
13040
13184
  children: psProcessingText
13041
13185
  }), psButtonText && /*#__PURE__*/jsxRuntime.jsx(Button, {
13042
13186
  disabled: psButtonDisabled,
@@ -13080,6 +13224,7 @@ const CompleteStep = props => {
13080
13224
  className: "droppable-card-content",
13081
13225
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
13082
13226
  className: "droppable-card-content d-flex flex-column align-items-center",
13227
+ "aria-live": "polite",
13083
13228
  children: isError ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
13084
13229
  children: [isModern ? /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
13085
13230
  size: exports.Size.LARGE,
@@ -13448,6 +13593,7 @@ class Upload extends React.Component {
13448
13593
  onClear: event => this.handleOnClear(event)
13449
13594
  }), !isProcessing && /*#__PURE__*/jsxRuntime.jsx("div", {
13450
13595
  className: "droppable-dropping-card droppable-card",
13596
+ "aria-live": "polite",
13451
13597
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
13452
13598
  className: "droppable-card-content",
13453
13599
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -13922,6 +14068,7 @@ const UploadItem = ({
13922
14068
  onDownload: onDownloadFile,
13923
14069
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
13924
14070
  className: "np-upload-button",
14071
+ "aria-live": "polite",
13925
14072
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
13926
14073
  className: "media",
13927
14074
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {