@transferwise/components 45.14.2 → 45.15.1

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 (160) hide show
  1. package/build/i18n/en.json +8 -0
  2. package/build/index.esm.js +1001 -367
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +1003 -366
  5. package/build/index.js.map +1 -1
  6. package/build/main.css +1 -1
  7. package/build/styles/common/closeButton/CloseButton.css +1 -1
  8. package/build/styles/dateLookup/DateLookup.css +1 -1
  9. package/build/styles/inputs/Input.css +1 -1
  10. package/build/styles/inputs/InputGroup.css +1 -1
  11. package/build/styles/inputs/SelectInput.css +1 -0
  12. package/build/styles/inputs/TextArea.css +1 -1
  13. package/build/styles/main.css +1 -1
  14. package/build/styles/promoCard/PromoCard.css +1 -1
  15. package/build/styles/stepper/Stepper.css +1 -1
  16. package/build/types/avatarWrapper/AvatarWrapper.d.ts +14 -5
  17. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  18. package/build/types/common/Option/Option.d.ts.map +1 -1
  19. package/build/types/common/focusBoundary/FocusBoundary.d.ts +2 -2
  20. package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
  21. package/build/types/common/hooks/useMedia.d.ts +2 -0
  22. package/build/types/common/hooks/useMedia.d.ts.map +1 -0
  23. package/build/types/common/hooks/useScreenSize.d.ts +3 -0
  24. package/build/types/common/hooks/useScreenSize.d.ts.map +1 -0
  25. package/build/types/common/preventScroll/PreventScroll.d.ts +2 -0
  26. package/build/types/common/preventScroll/PreventScroll.d.ts.map +1 -0
  27. package/build/types/dateInput/DateInput.d.ts +2 -0
  28. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  29. package/build/types/dateLookup/DateLookup.messages.d.ts +65 -0
  30. package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
  31. package/build/types/dateLookup/dateHeader/DateHeader.d.ts +3 -1
  32. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  33. package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts +7 -7
  34. package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts.map +1 -1
  35. package/build/types/dateLookup/tableLink/TableLink.d.ts +4 -26
  36. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  37. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +4 -29
  38. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
  39. package/build/types/index.d.ts +4 -0
  40. package/build/types/index.d.ts.map +1 -1
  41. package/build/types/inputs/Input.d.ts +1 -0
  42. package/build/types/inputs/Input.d.ts.map +1 -1
  43. package/build/types/inputs/SearchInput.d.ts +10 -0
  44. package/build/types/inputs/SearchInput.d.ts.map +1 -0
  45. package/build/types/inputs/SelectInput.d.ts +41 -0
  46. package/build/types/inputs/SelectInput.d.ts.map +1 -0
  47. package/build/types/inputs/_BottomSheet.d.ts +17 -0
  48. package/build/types/inputs/_BottomSheet.d.ts.map +1 -0
  49. package/build/types/inputs/_ButtonInput.d.ts +6 -0
  50. package/build/types/inputs/_ButtonInput.d.ts.map +1 -0
  51. package/build/types/inputs/_Popover.d.ts +18 -0
  52. package/build/types/inputs/_Popover.d.ts.map +1 -0
  53. package/build/types/inputs/_common.d.ts.map +1 -1
  54. package/build/types/logo/Logo.d.ts.map +1 -1
  55. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  56. package/build/types/snackbar/Snackbar.d.ts.map +1 -1
  57. package/build/types/stepper/Stepper.d.ts.map +1 -1
  58. package/build/types/tabs/Tabs.d.ts.map +1 -1
  59. package/build/types/tile/Tile.d.ts.map +1 -1
  60. package/build/types/upload/steps/completeStep/completeStep.d.ts.map +1 -1
  61. package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
  62. package/build/types/utilities/wrapInFragment.d.ts +3 -0
  63. package/build/types/utilities/wrapInFragment.d.ts.map +1 -0
  64. package/package.json +27 -20
  65. package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -6
  66. package/src/avatarWrapper/AvatarWrapper.tsx +20 -8
  67. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +1 -1
  68. package/src/card/Card.spec.js +2 -2
  69. package/src/common/Option/Option.tsx +1 -7
  70. package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +8 -1
  71. package/src/common/closeButton/CloseButton.css +1 -1
  72. package/src/common/focusBoundary/FocusBoundary.tsx +9 -32
  73. package/src/common/hooks/useMedia.spec.ts +39 -0
  74. package/src/common/hooks/useMedia.ts +15 -0
  75. package/src/common/hooks/useScreenSize.ts +7 -0
  76. package/src/common/preventScroll/PreventScroll.tsx +6 -0
  77. package/src/dateInput/DateInput.js +6 -0
  78. package/src/dateInput/DateInput.story.tsx +2 -0
  79. package/src/dateLookup/DateLookup.css +1 -1
  80. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -3
  81. package/src/dateLookup/DateLookup.less +4 -0
  82. package/src/dateLookup/DateLookup.messages.js +44 -0
  83. package/src/dateLookup/DateLookup.testingLibrary.spec.js +39 -0
  84. package/src/dateLookup/dateHeader/DateHeader.js +48 -26
  85. package/src/dateLookup/dateHeader/DateHeader.spec.js +37 -0
  86. package/src/dateLookup/dayCalendar/DayCalendar.js +3 -1
  87. package/src/dateLookup/dayCalendar/DayCalendar.spec.js +7 -1
  88. package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +7 -3
  89. package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +1 -0
  90. package/src/dateLookup/monthCalendar/MonthCalendar.js +3 -1
  91. package/src/dateLookup/monthCalendar/MonthCalendar.spec.js +7 -1
  92. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +4 -5
  93. package/src/dateLookup/tableLink/TableLink.js +24 -3
  94. package/src/dateLookup/tableLink/TableLink.spec.js +60 -4
  95. package/src/dateLookup/yearCalendar/YearCalendar.js +16 -3
  96. package/src/dateLookup/yearCalendar/YearCalendar.spec.js +14 -1
  97. package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +4 -5
  98. package/src/decision/Decision.story.js +11 -11
  99. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +12 -12
  100. package/src/i18n/en.json +9 -0
  101. package/src/index.ts +8 -0
  102. package/src/inputs/Input.css +1 -1
  103. package/src/inputs/Input.less +14 -0
  104. package/src/inputs/Input.tsx +6 -2
  105. package/src/inputs/InputGroup.css +1 -1
  106. package/src/inputs/InputGroup.less +5 -0
  107. package/src/inputs/SearchInput.story.tsx +40 -0
  108. package/src/inputs/SearchInput.tsx +35 -0
  109. package/src/inputs/SelectInput.css +1 -0
  110. package/src/inputs/SelectInput.less +183 -0
  111. package/src/inputs/SelectInput.spec.tsx +120 -0
  112. package/src/inputs/SelectInput.story.tsx +264 -0
  113. package/src/inputs/SelectInput.tsx +565 -0
  114. package/src/inputs/TextArea.css +1 -1
  115. package/src/inputs/TextArea.less +5 -0
  116. package/src/inputs/_BottomSheet.less +107 -0
  117. package/src/inputs/_BottomSheet.tsx +128 -0
  118. package/src/inputs/_ButtonInput.less +7 -0
  119. package/src/inputs/_ButtonInput.tsx +27 -0
  120. package/src/inputs/_Popover.less +38 -0
  121. package/src/inputs/_Popover.tsx +118 -0
  122. package/src/inputs/_common.less +0 -4
  123. package/src/inputs/_common.ts +0 -1
  124. package/src/logo/Logo.js +3 -21
  125. package/src/logo/__snapshots__/Logo.spec.js.snap +78 -30
  126. package/src/main.css +1 -1
  127. package/src/main.less +4 -0
  128. package/src/phoneNumberInput/PhoneNumberInput.js +1 -0
  129. package/src/promoCard/PromoCard.css +1 -1
  130. package/src/select/searchBox/__snapshots__/SearchBox.spec.js.snap +1 -1
  131. package/src/snackbar/Snackbar.js +6 -1
  132. package/src/snackbar/Snackbar.spec.js +1 -3
  133. package/src/ssr.spec.js +7 -0
  134. package/src/stepper/Stepper.css +1 -1
  135. package/src/stepper/Stepper.less +1 -9
  136. package/src/stepper/Stepper.spec.js +4 -4
  137. package/src/stepper/Stepper.tsx +2 -5
  138. package/src/tabs/Tabs.js +2 -1
  139. package/src/tile/Tile.js +5 -11
  140. package/src/tile/__snapshots__/Tile.spec.js.snap +7 -9
  141. package/src/upload/Upload.js +1 -1
  142. package/src/upload/steps/completeStep/completeStep.js +4 -1
  143. package/src/upload/steps/processingStep/processingStep.js +1 -0
  144. package/src/uploadInput/uploadItem/UploadItem.tsx +1 -1
  145. package/src/utilities/wrapInFragment.tsx +3 -0
  146. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts +0 -2
  147. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts.map +0 -1
  148. package/build/types/common/focusBoundary/utils/index.d.ts +0 -3
  149. package/build/types/common/focusBoundary/utils/index.d.ts.map +0 -1
  150. package/build/types/common/focusBoundary/utils/resetFocus.d.ts +0 -2
  151. package/build/types/common/focusBoundary/utils/resetFocus.d.ts.map +0 -1
  152. package/src/common/focusBoundary/FocusBoundary.spec.tsx +0 -66
  153. package/src/common/focusBoundary/__snapshots__/FocusBoundary.spec.tsx.snap +0 -16
  154. package/src/common/focusBoundary/utils/getFocusableElements.js +0 -25
  155. package/src/common/focusBoundary/utils/getFocusableElements.spec.js +0 -51
  156. package/src/common/focusBoundary/utils/index.js +0 -2
  157. package/src/common/focusBoundary/utils/resetFocus.js +0 -23
  158. package/src/common/focusBoundary/utils/resetFocus.spec.js +0 -103
  159. package/src/snackbar/__snapshots__/Snackbar.spec.js.snap +0 -5
  160. /package/src/dateLookup/dateTrigger/{DateTrigger.messages.js → DateTrigger.messages.ts} +0 -0
package/build/index.js CHANGED
@@ -11,9 +11,15 @@ 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 neptuneValidation = require('@transferwise/neptune-validation');
14
+ var focus = require('@react-aria/focus');
15
15
  var mergeRefs = require('react-merge-refs');
16
+ var neptuneValidation = require('@transferwise/neptune-validation');
16
17
  var reactPopper = require('react-popper');
18
+ var react$1 = require('@headlessui/react');
19
+ var reactId = require('@radix-ui/react-id');
20
+ var shim = require('use-sync-external-store/shim');
21
+ var react = require('@floating-ui/react');
22
+ var overlays = require('@react-aria/overlays');
17
23
  var art = require('@wise/art');
18
24
  var clamp$2 = require('lodash.clamp');
19
25
  var debounce = require('lodash.debounce');
@@ -639,10 +645,8 @@ const Option$2 = /*#__PURE__*/React.forwardRef(({
639
645
  })
640
646
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
641
647
  className: "media-body",
642
- children: [/*#__PURE__*/jsxRuntime.jsx(Body, {
643
- as: "span",
644
- type: exports.Typography.BODY_LARGE_BOLD,
645
- className: "text-primary np-option__title d-block",
648
+ children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
649
+ className: "np-text-body-large-bold text-primary np-option__title",
646
650
  children: title
647
651
  }), content && /*#__PURE__*/jsxRuntime.jsx(Body, {
648
652
  className: "d-block np-option__body",
@@ -792,7 +796,7 @@ const ActionOption = ({
792
796
  });
793
797
  };
794
798
 
795
- var messages$8 = reactIntl.defineMessages({
799
+ var messages$9 = reactIntl.defineMessages({
796
800
  ariaLabel: {
797
801
  id: "neptune.CloseButton.ariaLabel"
798
802
  }
@@ -808,7 +812,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
808
812
  testId
809
813
  }, reference) {
810
814
  const intl = reactIntl.useIntl();
811
- ariaLabel ??= intl.formatMessage(messages$8.ariaLabel);
815
+ ariaLabel ??= intl.formatMessage(messages$9.ariaLabel);
812
816
  const Icon = filled ? icons.CrossCircleFill : icons.Cross;
813
817
  return /*#__PURE__*/jsxRuntime.jsx("button", {
814
818
  ref: reference,
@@ -828,7 +832,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
828
832
  });
829
833
  });
830
834
 
831
- var messages$7 = reactIntl.defineMessages({
835
+ var messages$8 = reactIntl.defineMessages({
832
836
  opensInNewTab: {
833
837
  id: "neptune.Link.opensInNewTab"
834
838
  }
@@ -857,7 +861,7 @@ const Link = ({
857
861
  onClick: onClick,
858
862
  ...props,
859
863
  children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
860
- title: formatMessage(messages$7.opensInNewTab)
864
+ title: formatMessage(messages$8.opensInNewTab)
861
865
  })]
862
866
  });
863
867
  };
@@ -1433,7 +1437,7 @@ const AvatarWrapper = ({
1433
1437
  type: exports.AvatarType.THUMBNAIL,
1434
1438
  children: /*#__PURE__*/jsxRuntime.jsx("img", {
1435
1439
  src: url,
1436
- alt: "avatar",
1440
+ alt: "",
1437
1441
  onError: () => setImageLoadError(true)
1438
1442
  }),
1439
1443
  ...avatarProps
@@ -1487,268 +1491,23 @@ function getInitials(name) {
1487
1491
  return allInitials[0] + allInitials.slice(-1);
1488
1492
  }
1489
1493
 
1490
- const THROTTLE_MS = 100;
1491
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1492
- const useClientWidth = ({
1493
- ref,
1494
- throttleMs = THROTTLE_MS
1495
- }) => {
1496
- const [clientWidth, setClientWidth] = React.useState(null);
1497
- useIsomorphicLayoutEffect(() => {
1498
- // eslint-disable-next-line unicorn/consistent-function-scoping
1499
- const updateClientWidth = () => {
1500
- if (ref) {
1501
- // when `ref` is a window
1502
- if ('innerWidth' in ref) {
1503
- setClientWidth(ref.innerWidth);
1504
- }
1505
- // when `ref` is an element
1506
- else if (ref.current) {
1507
- setClientWidth(ref.current.clientWidth);
1508
- }
1509
- }
1510
- };
1511
- // This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
1512
- // If throttle gets passed directly to both add and removeEventListenet the results will be that the event
1513
- // won't get removed even if the component is unmounted.
1514
- const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
1515
- window.addEventListener('resize', attachedFunction, true);
1516
- // using requestAnimationFrame to perform the calculation before the next repaint
1517
- // getting width earlier causes issues in animations when used with react-transition-group
1518
- window.requestAnimationFrame(updateClientWidth);
1519
- return () => window.removeEventListener('resize', attachedFunction, true);
1520
- }, []);
1521
- return [clientWidth];
1522
- };
1523
- useClientWidth.THROTTLE_MS = THROTTLE_MS;
1524
-
1525
- const useConditionalListener = ({
1526
- attachListener,
1527
- callback,
1528
- eventType,
1529
- parent
1530
- }) => {
1531
- React.useEffect(() => {
1532
- if (attachListener && !neptuneValidation.isUndefined(parent)) {
1533
- parent.addEventListener(eventType, callback, true);
1534
- }
1535
- return () => {
1536
- if (!neptuneValidation.isUndefined(parent)) {
1537
- parent.removeEventListener(eventType, callback, true);
1538
- }
1539
- };
1540
- }, [attachListener, callback, eventType, parent]);
1541
- };
1542
-
1543
- const DirectionContext = /*#__PURE__*/React.createContext(exports.Direction.LTR);
1544
- const DirectionProvider = ({
1545
- direction,
1546
- children
1547
- }) => {
1548
- return /*#__PURE__*/jsxRuntime.jsx(DirectionContext.Provider, {
1549
- value: direction,
1550
- children: children
1551
- });
1552
- };
1553
-
1554
- const useDirection = () => {
1555
- const direction = React.useContext(DirectionContext);
1556
- return {
1557
- direction,
1558
- isRTL: direction === 'rtl'
1559
- };
1560
- };
1561
-
1562
- const ObserverParams = {
1563
- threshold: 0.1
1564
- };
1565
-
1566
- /**
1567
- * useHasIntersected.
1568
- * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
1569
- * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
1570
- *
1571
- * @param elRef.elRef
1572
- * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
1573
- * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
1574
- * @param elRef.loading
1575
- * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
1576
- */
1577
- const useHasIntersected = ({
1578
- elRef,
1579
- loading
1580
- }) => {
1581
- const [hasIntersected, setHasIntersected] = React.useState(false);
1582
- const {
1583
- current
1584
- } = elRef || {};
1585
- const isValidReference = () => {
1586
- return elRef && current;
1587
- };
1588
- const handleOnIntersect = (entries, observer) => {
1589
- entries.forEach(entry => {
1590
- if (entry.isIntersecting) {
1591
- setHasIntersected(true);
1592
- observer.unobserve(current);
1593
- }
1594
- });
1595
- };
1596
- React.useEffect(() => {
1597
- let observer;
1598
- let didCancel = false;
1599
-
1600
- // Check if window is define for SSR and Old browsers fallback
1601
- if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
1602
- setHasIntersected(true);
1603
- } else if (!didCancel) {
1604
- observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
1605
- observer.observe(current);
1606
- }
1607
- return () => {
1608
- didCancel = true;
1609
- if (observer) {
1610
- observer.unobserve(current);
1611
- }
1612
- };
1613
- }, [elRef]);
1614
- if (loading === 'eager') {
1615
- return [false];
1616
- }
1617
- return [hasIntersected];
1618
- };
1619
-
1620
- const useLayout = () => {
1621
- const windowReference = typeof window === 'undefined' ? undefined : window;
1622
- const [breakpoint, setBreakpoint] = React.useState();
1623
- const [clientWidth] = useClientWidth({
1624
- ref: windowReference
1625
- });
1626
- React.useEffect(() => {
1627
- if (!clientWidth) {
1628
- return;
1629
- }
1630
- if (clientWidth <= exports.Breakpoint.EXTRA_SMALL) {
1631
- setBreakpoint(exports.Breakpoint.EXTRA_SMALL);
1632
- return;
1633
- }
1634
- if (exports.Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= exports.Breakpoint.SMALL) {
1635
- setBreakpoint(exports.Breakpoint.SMALL);
1636
- return;
1637
- }
1638
- if (exports.Breakpoint.SMALL < clientWidth && clientWidth <= exports.Breakpoint.MEDIUM) {
1639
- setBreakpoint(exports.Breakpoint.MEDIUM);
1640
- return;
1641
- }
1642
- if (exports.Breakpoint.MEDIUM < clientWidth && clientWidth <= exports.Breakpoint.LARGE) {
1643
- setBreakpoint(exports.Breakpoint.LARGE);
1644
- return;
1645
- }
1646
- if (exports.Breakpoint.LARGE < clientWidth) {
1647
- setBreakpoint(exports.Breakpoint.EXTRA_LARGE);
1648
- }
1649
- }, [clientWidth]);
1650
- return {
1651
- isMobile: !!breakpoint && [exports.Breakpoint.EXTRA_SMALL, exports.Breakpoint.SMALL].includes(breakpoint),
1652
- isExtraSmall: breakpoint === exports.Breakpoint.EXTRA_SMALL,
1653
- isSmall: breakpoint === exports.Breakpoint.SMALL,
1654
- isMedium: breakpoint === exports.Breakpoint.MEDIUM,
1655
- isLarge: breakpoint === exports.Breakpoint.LARGE,
1656
- isExtraLarge: breakpoint === exports.Breakpoint.EXTRA_LARGE
1657
- };
1658
- };
1659
-
1660
- /**
1661
- * This function returns the first and the last focusable elements within a node.
1662
- *
1663
- * @param {Node} focusBoundaryContainer - the area that contains focused elements.
1664
- * @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.
1665
- */
1666
-
1667
- const getFocusableElements = focusBoundaryContainer => {
1668
- const focusableEls = {
1669
- first: focusBoundaryContainer,
1670
- last: focusBoundaryContainer
1671
- };
1672
- if (focusBoundaryContainer?.querySelectorAll) {
1673
- const allEls = [...focusBoundaryContainer.querySelectorAll('a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter(element => !element.hasAttribute('disabled'));
1674
- if (allEls.length > 0) {
1675
- [focusableEls.first] = allEls;
1676
- focusableEls.last = allEls[allEls.length - 1];
1677
- }
1678
- }
1679
- return focusableEls;
1680
- };
1681
-
1682
- /**
1683
- * This function resets the focus to either last of first focusable elements within a node.
1684
- *
1685
- * @param {object} focusableEls - contains the first last of first focusable elements within a node.
1686
- * @param {object} event - the triggered event
1687
- */
1688
-
1689
- const resetFocus = ({
1690
- focusableEls: {
1691
- first,
1692
- last
1693
- },
1694
- event
1695
- }) => {
1696
- const {
1697
- activeElement
1698
- } = document;
1699
- if (event.shiftKey && activeElement === first) {
1700
- if (last) {
1701
- last.focus();
1702
- }
1703
- event.preventDefault();
1704
- }
1705
- if (!event.shiftKey && activeElement === last) {
1706
- if (first) {
1707
- first.focus();
1708
- }
1709
- event.preventDefault();
1710
- }
1711
- };
1712
-
1713
- const {
1714
- TAB
1715
- } = Key;
1716
1494
  const FocusBoundary = ({
1717
1495
  children
1718
1496
  }) => {
1719
- const boundaryReference = React.useRef(null);
1720
- const parent = neptuneValidation.isUndefined(document) ? undefined : document;
1721
- const [focusableEls, setFocusableEls] = React.useState({});
1497
+ const wrapperReference = React.useRef(null);
1722
1498
  React.useEffect(() => {
1723
- if (boundaryReference?.current) {
1724
- boundaryReference.current.focus({
1725
- preventScroll: true
1726
- });
1727
- setFocusableEls(getFocusableElements(boundaryReference.current));
1728
- }
1499
+ wrapperReference.current?.focus({
1500
+ preventScroll: true
1501
+ });
1729
1502
  }, []);
1730
- // If event type is Tab the resetFocus will force the focus to either the first focusable or last in boundaryRef .
1731
- useConditionalListener({
1732
- eventType: 'keydown',
1733
- callback: event => {
1734
- if (neptuneValidation.isKey({
1735
- keyType: TAB,
1736
- event
1737
- })) {
1738
- resetFocus({
1739
- event,
1740
- focusableEls
1741
- });
1742
- }
1743
- },
1744
- attachListener: true,
1745
- parent
1746
- });
1747
1503
  return /*#__PURE__*/jsxRuntime.jsx("div", {
1748
- ref: boundaryReference,
1504
+ ref: wrapperReference,
1749
1505
  tabIndex: -1,
1750
- className: "np-focus-boundary outline-none",
1751
- children: children
1506
+ children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
1507
+ contain: true,
1508
+ restoreFocus: true,
1509
+ children: children
1510
+ })
1752
1511
  });
1753
1512
  };
1754
1513
  var FocusBoundary$1 = FocusBoundary;
@@ -2004,6 +1763,176 @@ SlidingPanel.defaultProps = {
2004
1763
  };
2005
1764
  var SlidingPanel$1 = SlidingPanel;
2006
1765
 
1766
+ const THROTTLE_MS = 100;
1767
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1768
+ const useClientWidth = ({
1769
+ ref,
1770
+ throttleMs = THROTTLE_MS
1771
+ }) => {
1772
+ const [clientWidth, setClientWidth] = React.useState(null);
1773
+ useIsomorphicLayoutEffect(() => {
1774
+ // eslint-disable-next-line unicorn/consistent-function-scoping
1775
+ const updateClientWidth = () => {
1776
+ if (ref) {
1777
+ // when `ref` is a window
1778
+ if ('innerWidth' in ref) {
1779
+ setClientWidth(ref.innerWidth);
1780
+ }
1781
+ // when `ref` is an element
1782
+ else if (ref.current) {
1783
+ setClientWidth(ref.current.clientWidth);
1784
+ }
1785
+ }
1786
+ };
1787
+ // This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
1788
+ // If throttle gets passed directly to both add and removeEventListenet the results will be that the event
1789
+ // won't get removed even if the component is unmounted.
1790
+ const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
1791
+ window.addEventListener('resize', attachedFunction, true);
1792
+ // using requestAnimationFrame to perform the calculation before the next repaint
1793
+ // getting width earlier causes issues in animations when used with react-transition-group
1794
+ window.requestAnimationFrame(updateClientWidth);
1795
+ return () => window.removeEventListener('resize', attachedFunction, true);
1796
+ }, []);
1797
+ return [clientWidth];
1798
+ };
1799
+ useClientWidth.THROTTLE_MS = THROTTLE_MS;
1800
+
1801
+ const useConditionalListener = ({
1802
+ attachListener,
1803
+ callback,
1804
+ eventType,
1805
+ parent
1806
+ }) => {
1807
+ React.useEffect(() => {
1808
+ if (attachListener && !neptuneValidation.isUndefined(parent)) {
1809
+ parent.addEventListener(eventType, callback, true);
1810
+ }
1811
+ return () => {
1812
+ if (!neptuneValidation.isUndefined(parent)) {
1813
+ parent.removeEventListener(eventType, callback, true);
1814
+ }
1815
+ };
1816
+ }, [attachListener, callback, eventType, parent]);
1817
+ };
1818
+
1819
+ const DirectionContext = /*#__PURE__*/React.createContext(exports.Direction.LTR);
1820
+ const DirectionProvider = ({
1821
+ direction,
1822
+ children
1823
+ }) => {
1824
+ return /*#__PURE__*/jsxRuntime.jsx(DirectionContext.Provider, {
1825
+ value: direction,
1826
+ children: children
1827
+ });
1828
+ };
1829
+
1830
+ const useDirection = () => {
1831
+ const direction = React.useContext(DirectionContext);
1832
+ return {
1833
+ direction,
1834
+ isRTL: direction === 'rtl'
1835
+ };
1836
+ };
1837
+
1838
+ const ObserverParams = {
1839
+ threshold: 0.1
1840
+ };
1841
+
1842
+ /**
1843
+ * useHasIntersected.
1844
+ * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
1845
+ * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
1846
+ *
1847
+ * @param elRef.elRef
1848
+ * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
1849
+ * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
1850
+ * @param elRef.loading
1851
+ * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
1852
+ */
1853
+ const useHasIntersected = ({
1854
+ elRef,
1855
+ loading
1856
+ }) => {
1857
+ const [hasIntersected, setHasIntersected] = React.useState(false);
1858
+ const {
1859
+ current
1860
+ } = elRef || {};
1861
+ const isValidReference = () => {
1862
+ return elRef && current;
1863
+ };
1864
+ const handleOnIntersect = (entries, observer) => {
1865
+ entries.forEach(entry => {
1866
+ if (entry.isIntersecting) {
1867
+ setHasIntersected(true);
1868
+ observer.unobserve(current);
1869
+ }
1870
+ });
1871
+ };
1872
+ React.useEffect(() => {
1873
+ let observer;
1874
+ let didCancel = false;
1875
+
1876
+ // Check if window is define for SSR and Old browsers fallback
1877
+ if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
1878
+ setHasIntersected(true);
1879
+ } else if (!didCancel) {
1880
+ observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
1881
+ observer.observe(current);
1882
+ }
1883
+ return () => {
1884
+ didCancel = true;
1885
+ if (observer) {
1886
+ observer.unobserve(current);
1887
+ }
1888
+ };
1889
+ }, [elRef]);
1890
+ if (loading === 'eager') {
1891
+ return [false];
1892
+ }
1893
+ return [hasIntersected];
1894
+ };
1895
+
1896
+ const useLayout = () => {
1897
+ const windowReference = typeof window === 'undefined' ? undefined : window;
1898
+ const [breakpoint, setBreakpoint] = React.useState();
1899
+ const [clientWidth] = useClientWidth({
1900
+ ref: windowReference
1901
+ });
1902
+ React.useEffect(() => {
1903
+ if (!clientWidth) {
1904
+ return;
1905
+ }
1906
+ if (clientWidth <= exports.Breakpoint.EXTRA_SMALL) {
1907
+ setBreakpoint(exports.Breakpoint.EXTRA_SMALL);
1908
+ return;
1909
+ }
1910
+ if (exports.Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= exports.Breakpoint.SMALL) {
1911
+ setBreakpoint(exports.Breakpoint.SMALL);
1912
+ return;
1913
+ }
1914
+ if (exports.Breakpoint.SMALL < clientWidth && clientWidth <= exports.Breakpoint.MEDIUM) {
1915
+ setBreakpoint(exports.Breakpoint.MEDIUM);
1916
+ return;
1917
+ }
1918
+ if (exports.Breakpoint.MEDIUM < clientWidth && clientWidth <= exports.Breakpoint.LARGE) {
1919
+ setBreakpoint(exports.Breakpoint.LARGE);
1920
+ return;
1921
+ }
1922
+ if (exports.Breakpoint.LARGE < clientWidth) {
1923
+ setBreakpoint(exports.Breakpoint.EXTRA_LARGE);
1924
+ }
1925
+ }, [clientWidth]);
1926
+ return {
1927
+ isMobile: !!breakpoint && [exports.Breakpoint.EXTRA_SMALL, exports.Breakpoint.SMALL].includes(breakpoint),
1928
+ isExtraSmall: breakpoint === exports.Breakpoint.EXTRA_SMALL,
1929
+ isSmall: breakpoint === exports.Breakpoint.SMALL,
1930
+ isMedium: breakpoint === exports.Breakpoint.MEDIUM,
1931
+ isLarge: breakpoint === exports.Breakpoint.LARGE,
1932
+ isExtraLarge: breakpoint === exports.Breakpoint.EXTRA_LARGE
1933
+ };
1934
+ };
1935
+
2007
1936
  const INITIAL_Y_POSITION = 0;
2008
1937
  const CONTENT_SCROLL_THRESHOLD = 1;
2009
1938
  const MOVE_OFFSET_THRESHOLD = 50;
@@ -2013,7 +1942,7 @@ const MOVE_OFFSET_THRESHOLD = 50;
2013
1942
  * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet
2014
1943
  *
2015
1944
  */
2016
- const BottomSheet = props => {
1945
+ const BottomSheet$1 = props => {
2017
1946
  const bottomSheetReference = React.useRef(null);
2018
1947
  const topBarReference = React.useRef(null);
2019
1948
  const contentReference = React.useRef(null);
@@ -2167,7 +2096,7 @@ const BottomSheet = props => {
2167
2096
  })
2168
2097
  });
2169
2098
  };
2170
- var BottomSheet$1 = BottomSheet;
2099
+ var BottomSheet$2 = BottomSheet$1;
2171
2100
 
2172
2101
  const typeClassMap$1 = {
2173
2102
  [exports.ControlType.ACCENT]: 'btn-accent',
@@ -2567,7 +2496,7 @@ const Chip = ({
2567
2496
  }, value);
2568
2497
  };
2569
2498
 
2570
- var messages$6 = reactIntl.defineMessages({
2499
+ var messages$7 = reactIntl.defineMessages({
2571
2500
  ariaLabel: {
2572
2501
  id: "neptune.Chips.ariaLabel"
2573
2502
  }
@@ -2599,7 +2528,7 @@ const Chips = ({
2599
2528
  value: chip.value,
2600
2529
  label: chip.label,
2601
2530
  closeButton: {
2602
- 'aria-label': intl.formatMessage(messages$6.ariaLabel, {
2531
+ 'aria-label': intl.formatMessage(messages$7.ariaLabel, {
2603
2532
  choice: chip.label
2604
2533
  })
2605
2534
  },
@@ -2707,7 +2636,7 @@ const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateO
2707
2636
 
2708
2637
  const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
2709
2638
 
2710
- var messages$5 = reactIntl.defineMessages({
2639
+ var messages$6 = reactIntl.defineMessages({
2711
2640
  monthLabel: {
2712
2641
  id: "neptune.DateInput.month.label"
2713
2642
  },
@@ -2747,8 +2676,10 @@ const DateInput = ({
2747
2676
  size,
2748
2677
  value,
2749
2678
  dayLabel,
2679
+ dayAutoComplete,
2750
2680
  monthLabel,
2751
2681
  yearLabel,
2682
+ yearAutoComplete,
2752
2683
  monthFormat,
2753
2684
  mode,
2754
2685
  onChange,
@@ -2783,12 +2714,12 @@ const DateInput = ({
2783
2714
  const [month, setMonth] = React.useState(() => getExplodedDate('month'));
2784
2715
  const [year, setYear] = React.useState(() => getExplodedDate('year'));
2785
2716
  const [lastBroadcastedValue, setLastBroadcastedValue] = React.useState(getDateObject);
2786
- dayLabel = dayLabel || formatMessage(messages$5.dayLabel);
2787
- monthLabel = monthLabel || formatMessage(messages$5.monthLabel);
2788
- yearLabel = yearLabel || formatMessage(messages$5.yearLabel);
2717
+ dayLabel = dayLabel || formatMessage(messages$6.dayLabel);
2718
+ monthLabel = monthLabel || formatMessage(messages$6.monthLabel);
2719
+ yearLabel = yearLabel || formatMessage(messages$6.yearLabel);
2789
2720
  placeholders = {
2790
2721
  day: placeholders?.day || 'DD',
2791
- month: placeholders?.month || formatMessage(messages$5.monthLabel),
2722
+ month: placeholders?.month || formatMessage(messages$6.monthLabel),
2792
2723
  year: placeholders?.year || 'YYYY'
2793
2724
  };
2794
2725
  const getDateAsString = date => {
@@ -2946,6 +2877,7 @@ const DateInput = ({
2946
2877
  children: /*#__PURE__*/jsxRuntime.jsx(Input, {
2947
2878
  type: "number",
2948
2879
  name: "day",
2880
+ autoComplete: dayAutoComplete,
2949
2881
  value: day || '',
2950
2882
  placeholder: placeholders.day,
2951
2883
  disabled: disabled,
@@ -2968,6 +2900,7 @@ const DateInput = ({
2968
2900
  children: /*#__PURE__*/jsxRuntime.jsx(Input, {
2969
2901
  type: "number",
2970
2902
  name: "year",
2903
+ autoComplete: yearAutoComplete,
2971
2904
  placeholder: placeholders.year,
2972
2905
  value: year || '',
2973
2906
  disabled: disabled,
@@ -3015,8 +2948,10 @@ DateInput.propTypes = {
3015
2948
  onFocus: PropTypes__default.default.func,
3016
2949
  onBlur: PropTypes__default.default.func,
3017
2950
  dayLabel: PropTypes__default.default.string,
2951
+ dayAutoComplete: PropTypes__default.default.string,
3018
2952
  monthLabel: PropTypes__default.default.string,
3019
2953
  yearLabel: PropTypes__default.default.string,
2954
+ yearAutoComplete: PropTypes__default.default.string,
3020
2955
  monthFormat: PropTypes__default.default.oneOf(['long', 'short']),
3021
2956
  mode: PropTypes__default.default.oneOf(['day-month-year', 'month-year']),
3022
2957
  placeholders: PropTypes__default.default.shape({
@@ -3194,7 +3129,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
3194
3129
  isMobile
3195
3130
  } = useLayout();
3196
3131
  if (isMobile) {
3197
- return /*#__PURE__*/jsxRuntime.jsx(BottomSheet$1, {
3132
+ return /*#__PURE__*/jsxRuntime.jsx(BottomSheet$2, {
3198
3133
  open: open,
3199
3134
  className: className,
3200
3135
  onClose: onClose,
@@ -3215,7 +3150,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
3215
3150
  });
3216
3151
  var ResponsivePanel$1 = ResponsivePanel;
3217
3152
 
3218
- var messages$4 = reactIntl.defineMessages({
3153
+ var messages$5 = reactIntl.defineMessages({
3219
3154
  ariaLabel: {
3220
3155
  id: "neptune.ClearButton.ariaLabel"
3221
3156
  }
@@ -3278,7 +3213,7 @@ const DateTrigger = ({
3278
3213
  className: "input-group-addon",
3279
3214
  children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
3280
3215
  className: `clear-btn clear-btn--${size}`,
3281
- "aria-label": formatMessage(messages$4.ariaLabel),
3216
+ "aria-label": formatMessage(messages$5.ariaLabel),
3282
3217
  size: exports.Size.SMALL,
3283
3218
  onClick: event => {
3284
3219
  event.stopPropagation();
@@ -3308,50 +3243,85 @@ DateTrigger.defaultProps = {
3308
3243
  };
3309
3244
  var DateTrigger$1 = DateTrigger;
3310
3245
 
3246
+ var messages$4 = reactIntl.defineMessages({
3247
+ next: {
3248
+ id: "neptune.DateLookup.next"
3249
+ },
3250
+ previous: {
3251
+ id: "neptune.DateLookup.previous"
3252
+ },
3253
+ day: {
3254
+ id: "neptune.DateLookup.day"
3255
+ },
3256
+ month: {
3257
+ id: "neptune.DateLookup.month"
3258
+ },
3259
+ year: {
3260
+ id: "neptune.DateLookup.year"
3261
+ },
3262
+ twentyYears: {
3263
+ id: "neptune.DateLookup.twentyYears"
3264
+ },
3265
+ selected: {
3266
+ id: "neptune.DateLookup.selected"
3267
+ },
3268
+ goTo20YearView: {
3269
+ id: "neptune.DateLookup.goTo20YearView"
3270
+ }
3271
+ });
3272
+
3311
3273
  const buttonClasses = 'btn-link p-a-0 text-no-decoration np-text-body-large-bold rounded-sm';
3312
3274
  const DateHeader = ({
3313
3275
  label,
3314
3276
  onLabelClick,
3315
3277
  onPreviousClick,
3316
- onNextClick
3317
- }) => /*#__PURE__*/jsxRuntime.jsxs("div", {
3318
- className: "text-xs-center p-t-1 p-b-2 clearfix",
3319
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
3320
- className: "pull-left-single-direction",
3321
- children: /*#__PURE__*/jsxRuntime.jsx("button", {
3322
- type: "button",
3323
- className: `d-inline-flex ${buttonClasses}`,
3324
- onClick: onPreviousClick,
3325
- children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3326
- orientation: exports.Position.LEFT,
3327
- className: "left-single-direction",
3328
- size: exports.Size.MEDIUM
3278
+ onNextClick,
3279
+ dateMode
3280
+ }) => {
3281
+ const intl = reactIntl.useIntl();
3282
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
3283
+ className: "text-xs-center p-t-1 p-b-2 clearfix",
3284
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
3285
+ className: "pull-left-single-direction",
3286
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
3287
+ type: "button",
3288
+ className: `d-inline-flex ${buttonClasses}`,
3289
+ "aria-label": `${intl.formatMessage(messages$4.previous)} ${dateMode}`,
3290
+ onClick: onPreviousClick,
3291
+ children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3292
+ orientation: exports.Position.LEFT,
3293
+ className: "left-single-direction",
3294
+ size: exports.Size.MEDIUM
3295
+ })
3329
3296
  })
3330
- })
3331
- }), label && /*#__PURE__*/jsxRuntime.jsx("button", {
3332
- type: "button",
3333
- className: `tw-date-lookup-header-current ${buttonClasses}`,
3334
- onClick: onLabelClick,
3335
- children: label
3336
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
3337
- className: "pull-right-single-direction",
3338
- children: /*#__PURE__*/jsxRuntime.jsx("button", {
3297
+ }), label && /*#__PURE__*/jsxRuntime.jsx("button", {
3339
3298
  type: "button",
3340
- className: `d-inline-flex ${buttonClasses}`,
3341
- onClick: onNextClick,
3342
- children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3343
- orientation: exports.Position.RIGHT,
3344
- className: "right-single-direction",
3345
- size: exports.Size.MEDIUM
3299
+ className: `tw-date-lookup-header-current ${buttonClasses}`,
3300
+ "aria-label": intl.formatMessage(messages$4.goTo20YearView),
3301
+ onClick: onLabelClick,
3302
+ children: label
3303
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
3304
+ className: "pull-right-single-direction",
3305
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
3306
+ type: "button",
3307
+ className: `d-inline-flex ${buttonClasses}`,
3308
+ "aria-label": `${reactIntl.useIntl().formatMessage(messages$4.next)} ${dateMode}`,
3309
+ onClick: onNextClick,
3310
+ children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3311
+ orientation: exports.Position.RIGHT,
3312
+ className: "right-single-direction",
3313
+ size: exports.Size.MEDIUM
3314
+ })
3346
3315
  })
3347
- })
3348
- })]
3349
- });
3316
+ })]
3317
+ });
3318
+ };
3350
3319
  DateHeader.propTypes = {
3351
3320
  label: PropTypes__default.default.string,
3352
3321
  onLabelClick: PropTypes__default.default.func,
3353
3322
  onPreviousClick: PropTypes__default.default.func.isRequired,
3354
- onNextClick: PropTypes__default.default.func.isRequired
3323
+ onNextClick: PropTypes__default.default.func.isRequired,
3324
+ dateMode: PropTypes__default.default.string
3355
3325
  };
3356
3326
  DateHeader.defaultProps = {
3357
3327
  label: null,
@@ -3377,6 +3347,12 @@ class TableLink extends React.PureComponent {
3377
3347
  this.props.onClick(this.props.item);
3378
3348
  }
3379
3349
  };
3350
+ calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
3351
+ if (active) {
3352
+ return `${longTitle || title}, ${formatMessage(messages$4.selected)} ${formatMessage(messages$4[type])}`;
3353
+ }
3354
+ return longTitle || title;
3355
+ };
3380
3356
  render() {
3381
3357
  const {
3382
3358
  item,
@@ -3385,14 +3361,17 @@ class TableLink extends React.PureComponent {
3385
3361
  longTitle,
3386
3362
  active,
3387
3363
  disabled,
3388
- today
3364
+ today,
3365
+ intl: {
3366
+ formatMessage
3367
+ }
3389
3368
  } = this.props;
3390
3369
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
3391
3370
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
3392
3371
  type: "button",
3393
3372
  className: `tw-date-lookup-${type}-option ${active ? 'active' : ''} ${today ? 'today' : ''} np-text-body-default-bold`,
3394
3373
  disabled: disabled,
3395
- "aria-label": longTitle,
3374
+ "aria-label": this.calculateAriaLabel(longTitle, title, active, type, formatMessage),
3396
3375
  onClick: this.onClick,
3397
3376
  children: title || item
3398
3377
  })
@@ -3414,7 +3393,7 @@ TableLink.defaultProps = {
3414
3393
  title: null,
3415
3394
  longTitle: null
3416
3395
  };
3417
- var TableLink$1 = TableLink;
3396
+ var TableLink$1 = reactIntl.injectIntl(TableLink);
3418
3397
 
3419
3398
  const SHORT_DAY_FORMAT = {
3420
3399
  day: 'numeric'
@@ -3458,6 +3437,7 @@ class DayCalendarTable extends React.PureComponent {
3458
3437
  };
3459
3438
  days = getDayNames(this.props.intl.locale, 'short');
3460
3439
  daysShort = getDayNames(this.props.intl.locale, 'narrow');
3440
+ daysLong = getDayNames(this.props.intl.locale, 'long');
3461
3441
  selectDay = day => {
3462
3442
  const {
3463
3443
  viewMonth,
@@ -3501,10 +3481,16 @@ class DayCalendarTable extends React.PureComponent {
3501
3481
  className: "text-xs-center np-text-body-default-bold",
3502
3482
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
3503
3483
  className: "hidden-xs",
3504
- children: day.slice(0, 3)
3484
+ children: /*#__PURE__*/jsxRuntime.jsx("abbr", {
3485
+ title: this.daysLong[index],
3486
+ children: day.slice(0, 3)
3487
+ })
3505
3488
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
3506
3489
  className: "visible-xs-inline-block",
3507
- children: this.daysShort[index].slice(0, 2)
3490
+ children: /*#__PURE__*/jsxRuntime.jsx("abbr", {
3491
+ title: this.daysLong[index],
3492
+ children: this.daysShort[index].slice(0, 2)
3493
+ })
3508
3494
  })]
3509
3495
  }, day))
3510
3496
  })
@@ -3572,7 +3558,8 @@ class DayCalendar extends React.PureComponent {
3572
3558
  viewMonth,
3573
3559
  viewYear,
3574
3560
  intl: {
3575
- locale
3561
+ locale,
3562
+ formatMessage
3576
3563
  },
3577
3564
  monthFormat,
3578
3565
  onLabelClick,
@@ -3584,6 +3571,7 @@ class DayCalendar extends React.PureComponent {
3584
3571
  month: monthFormat,
3585
3572
  year: 'numeric'
3586
3573
  }),
3574
+ dateMode: formatMessage(messages$4.month),
3587
3575
  onLabelClick: onLabelClick,
3588
3576
  onPreviousClick: this.selectPreviousMonth,
3589
3577
  onNextClick: this.selectNextMonth
@@ -3703,13 +3691,15 @@ class MonthCalendar extends React.PureComponent {
3703
3691
  max,
3704
3692
  viewYear,
3705
3693
  intl: {
3706
- locale
3694
+ locale,
3695
+ formatMessage
3707
3696
  },
3708
3697
  placeholder,
3709
3698
  onLabelClick
3710
3699
  } = this.props;
3711
3700
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3712
3701
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
3702
+ dateMode: formatMessage(messages$4.year),
3713
3703
  label: formatting.formatDate(new Date(viewYear, 0), locale, {
3714
3704
  year: 'numeric'
3715
3705
  }),
@@ -3827,10 +3817,14 @@ class YearCalendar extends React.PureComponent {
3827
3817
  min,
3828
3818
  max,
3829
3819
  viewYear,
3830
- placeholder
3820
+ placeholder,
3821
+ intl: {
3822
+ formatMessage
3823
+ }
3831
3824
  } = this.props;
3832
3825
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3833
3826
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
3827
+ dateMode: formatMessage(messages$4.twentyYears),
3834
3828
  onPreviousClick: this.selectPreviousYears,
3835
3829
  onNextClick: this.selectNextYears
3836
3830
  }), /*#__PURE__*/jsxRuntime.jsx(YearCalendarTable$1, {
@@ -3858,7 +3852,7 @@ YearCalendar.defaultProps = {
3858
3852
  min: null,
3859
3853
  max: null
3860
3854
  };
3861
- var YearCalendar$1 = YearCalendar;
3855
+ var YearCalendar$1 = reactIntl.injectIntl(YearCalendar);
3862
3856
 
3863
3857
  const MODE = {
3864
3858
  DAY: 'day',
@@ -4275,21 +4269,14 @@ const Tile = ({
4275
4269
  title
4276
4270
  }) => {
4277
4271
  const isSmall = size === exports.Size.SMALL;
4278
- const {
4279
- isModern
4280
- } = componentsTheming.useTheme();
4281
4272
  const Element = href ? 'a' : 'button';
4282
4273
  return /*#__PURE__*/jsxRuntime.jsxs(Element, {
4283
4274
  className: classNames__default.default('decision', 'flex-column', 'np-tile', 'text-no-decoration', 'text-xs-center', className, {
4284
- 'p-a-3': !isSmall && isModern,
4285
- 'p-y-5 p-x-4': !isSmall && !isModern,
4286
- 'p-a-2': isSmall,
4287
- 'np-tile--small': isSmall,
4288
- disabled
4289
- }),
4275
+ 'p-a-3': !isSmall,
4276
+ 'p-a-2 np-tile--small': isSmall
4277
+ }, disabled && 'disabled'),
4290
4278
  href: href,
4291
4279
  target: target,
4292
- "aria-label": title,
4293
4280
  onClick: disabled ? null : onClick,
4294
4281
  onKeyDown: disabled ? null : ({
4295
4282
  key
@@ -4305,15 +4292,12 @@ const Tile = ({
4305
4292
  type: exports.Typography.TITLE_SUBSECTION,
4306
4293
  className: classNames__default.default(isSmall ? 'm-t-1' : 'm-t-2'),
4307
4294
  children: title
4308
- }), isModern && description && /*#__PURE__*/jsxRuntime.jsx(Body, {
4295
+ }), description ? /*#__PURE__*/jsxRuntime.jsx(Body, {
4309
4296
  as: "span",
4310
4297
  type: exports.Typography.BODY_DEFAULT,
4311
4298
  className: "m-t-1",
4312
4299
  children: description
4313
- }), !isModern && description && /*#__PURE__*/jsxRuntime.jsx("div", {
4314
- className: "np-tile__description",
4315
- children: description
4316
- })]
4300
+ }) : null]
4317
4301
  });
4318
4302
  };
4319
4303
  Tile.propTypes = {
@@ -5326,14 +5310,6 @@ LogoWise.defaultProps = {
5326
5310
  height: "24",
5327
5311
  fill: "none"
5328
5312
  };
5329
- const baseUrl = 'https://wise.com/public-resources/assets/logos/wise/';
5330
- const logoPaths = {
5331
- WISE: 'brand_logo.svg',
5332
- WISE_BUSINESS: 'brand_logo_business.svg',
5333
- WISE_INVERSE: 'brand_logo_inverse.svg',
5334
- WISE_BUSINESS_INVERSE: 'brand_logo_business_inverse.svg',
5335
- WISE_FLAG: 'brand_flag.svg'
5336
- };
5337
5313
  const svgPaths = {
5338
5314
  WISE: LogoWise,
5339
5315
  WISE_BUSINESS: LogoWise,
@@ -5347,21 +5323,14 @@ const Logo = ({
5347
5323
  inverse,
5348
5324
  type
5349
5325
  }) => {
5350
- const {
5351
- isModern
5352
- } = componentsTheming.useTheme();
5353
5326
  const [clientWidth] = useClientWidth({
5354
5327
  ref: isServerSide() ? undefined : window
5355
5328
  });
5356
5329
  const isSmall = clientWidth < exports.Breakpoint.SMALL;
5357
- const path = isSmall ? logoPaths['WISE_FLAG'] : logoPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5358
5330
  const LogoSvg = isSmall ? svgPaths[`WISE_FLAG${inverse ? '_INVERSE' : ''}`] : svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5359
- return isModern ? /*#__PURE__*/jsxRuntime.jsx(LogoSvg, {
5360
- className: "np-logo-svg"
5361
- }) : /*#__PURE__*/jsxRuntime.jsx("img", {
5362
- className: classNames__default.default('np-logo', className),
5363
- alt: type === exports.LogoType.WISE ? 'Wise' : 'Wise business',
5364
- src: `${baseUrl}${path}`
5331
+ return /*#__PURE__*/jsxRuntime.jsx(LogoSvg, {
5332
+ className: classNames__default.default('np-logo-svg', className),
5333
+ alt: type === exports.LogoType.WISE ? 'Wise' : 'Wise business'
5365
5334
  });
5366
5335
  };
5367
5336
  Logo.propTypes = {
@@ -5533,13 +5502,12 @@ const Stepper = ({
5533
5502
  children: /*#__PURE__*/jsxRuntime.jsx("small", {
5534
5503
  children: step.label
5535
5504
  })
5536
- }) : /*#__PURE__*/jsxRuntime.jsx(Body, {
5537
- as: "span",
5538
- className: "tw-stepper__step-label small",
5505
+ }) : /*#__PURE__*/jsxRuntime.jsx("span", {
5506
+ className: "tw-stepper__step-label",
5539
5507
  children: step.label
5540
5508
  });
5541
5509
  return /*#__PURE__*/jsxRuntime.jsx("li", {
5542
- className: classNames__default.default('hidden-xs', 'tw-stepper__step', active && 'tw-stepper__step--active', clickable && 'tw-stepper__step--clickable', step.hoverLabel && 'tw-stepper__step--has-tooltip'),
5510
+ className: classNames__default.default('hidden-xs', 'tw-stepper__step', active ? 'np-text-body-default-bold tw-stepper__step--active' : 'np-text-body-default', clickable && 'tw-stepper__step--clickable', step.hoverLabel && 'tw-stepper__step--has-tooltip'),
5543
5511
  style: isRTL ? {
5544
5512
  right: `${index * stepPercentage * 100}%`
5545
5513
  } : {
@@ -5872,7 +5840,7 @@ const Modal = ({
5872
5840
  });
5873
5841
  };
5874
5842
 
5875
- const Popover = ({
5843
+ const Popover$1 = ({
5876
5844
  children,
5877
5845
  className,
5878
5846
  content,
@@ -5926,12 +5894,12 @@ const logActionRequired = ({
5926
5894
  }) => {
5927
5895
  logActionRequiredIf(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${deprecatedPlacements[preferredPlacement]} instead.`, deprecatedPlacements[preferredPlacement]);
5928
5896
  };
5929
- Popover.defaultProps = {
5897
+ Popover$1.defaultProps = {
5930
5898
  className: undefined,
5931
5899
  preferredPlacement: exports.Position.RIGHT,
5932
5900
  title: undefined
5933
5901
  };
5934
- Popover.propTypes = {
5902
+ Popover$1.propTypes = {
5935
5903
  children: PropTypes__default.default.node.isRequired,
5936
5904
  className: PropTypes__default.default.string,
5937
5905
  content: PropTypes__default.default.node.isRequired,
@@ -5948,7 +5916,7 @@ const deprecatedPlacements = {
5948
5916
  [exports.Position.LEFT_TOP]: exports.Position.TOP,
5949
5917
  [exports.Position.RIGHT_TOP]: exports.Position.TOP
5950
5918
  };
5951
- var Popover$1 = Popover;
5919
+ var Popover$2 = Popover$1;
5952
5920
 
5953
5921
  const Info = ({
5954
5922
  className = undefined,
@@ -5990,7 +5958,7 @@ const Info = ({
5990
5958
  title: title,
5991
5959
  onClose: () => setOpen(false)
5992
5960
  })]
5993
- }) : /*#__PURE__*/jsxRuntime.jsx(Popover$1, {
5961
+ }) : /*#__PURE__*/jsxRuntime.jsx(Popover$2, {
5994
5962
  content: content,
5995
5963
  preferredPlacement: exports.Position.BOTTOM,
5996
5964
  title: title,
@@ -6179,11 +6147,12 @@ function formControlClassNameBase({
6179
6147
  'np-form-control--size-sm np-text-body-default': size === 'sm',
6180
6148
  'np-form-control--size-md np-text-body-large': size === 'md',
6181
6149
  'np-form-control--size-lg np-text-title-subsection': size === 'lg'
6182
- }, 'np-form-control--shape-rectangle');
6150
+ });
6183
6151
  }
6184
6152
 
6185
6153
  const Input = /*#__PURE__*/React.forwardRef(function Input({
6186
6154
  size = 'auto',
6155
+ shape = 'rectangle',
6187
6156
  className,
6188
6157
  ...restProps
6189
6158
  }, reference) {
@@ -6192,7 +6161,10 @@ const Input = /*#__PURE__*/React.forwardRef(function Input({
6192
6161
  ref: reference,
6193
6162
  className: classNames__default.default(className, formControlClassNameBase({
6194
6163
  size
6195
- }))
6164
+ }), 'np-input', {
6165
+ 'np-input--shape-rectangle': shape === 'rectangle',
6166
+ 'np-input--shape-pill': shape === 'pill'
6167
+ })
6196
6168
  // eslint-disable-next-line react/forbid-dom-props
6197
6169
  ,
6198
6170
  style: inputPaddings,
@@ -6200,6 +6172,653 @@ const Input = /*#__PURE__*/React.forwardRef(function Input({
6200
6172
  });
6201
6173
  });
6202
6174
 
6175
+ const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
6176
+ shape = 'pill',
6177
+ disabled,
6178
+ className,
6179
+ ...restProps
6180
+ }, ref) {
6181
+ return /*#__PURE__*/jsxRuntime.jsx(InputGroup, {
6182
+ addonStart: {
6183
+ content: /*#__PURE__*/jsxRuntime.jsx(icons.Search, {
6184
+ size: 24
6185
+ }),
6186
+ initialContentWidth: 24
6187
+ },
6188
+ disabled: disabled,
6189
+ className: className,
6190
+ children: /*#__PURE__*/jsxRuntime.jsx(Input, {
6191
+ ref: ref,
6192
+ role: "searchbox",
6193
+ inputMode: "search",
6194
+ shape: shape,
6195
+ ...restProps
6196
+ })
6197
+ });
6198
+ });
6199
+
6200
+ function useMedia(query) {
6201
+ return shim.useSyncExternalStore(onStoreChange => {
6202
+ const mediaQueryList = window.matchMedia(query);
6203
+ mediaQueryList.addEventListener('change', onStoreChange);
6204
+ return () => {
6205
+ mediaQueryList.removeEventListener('change', onStoreChange);
6206
+ };
6207
+ }, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
6208
+ }
6209
+
6210
+ function useScreenSize(size) {
6211
+ return useMedia(`(min-width: ${size}px)`);
6212
+ }
6213
+
6214
+ function wrapInFragment(value) {
6215
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
6216
+ children: value
6217
+ });
6218
+ }
6219
+
6220
+ function PreventScroll() {
6221
+ overlays.usePreventScroll();
6222
+ return null;
6223
+ }
6224
+
6225
+ function BottomSheet({
6226
+ open,
6227
+ renderTrigger,
6228
+ title,
6229
+ initialFocusRef,
6230
+ padding = 'md',
6231
+ children,
6232
+ onClose
6233
+ }) {
6234
+ const {
6235
+ refs,
6236
+ context
6237
+ } = react.useFloating({
6238
+ open,
6239
+ onOpenChange: value => {
6240
+ if (!value) {
6241
+ onClose?.();
6242
+ }
6243
+ }
6244
+ });
6245
+ const dismiss = react.useDismiss(context, {
6246
+ outsidePressEvent: 'mousedown'
6247
+ });
6248
+ const role = react.useRole(context);
6249
+ const {
6250
+ getReferenceProps,
6251
+ getFloatingProps
6252
+ } = react.useInteractions([dismiss, role]);
6253
+ const [floatingKey, setFloatingKey] = React.useState(0);
6254
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
6255
+ children: [open ? /*#__PURE__*/jsxRuntime.jsx(PreventScroll, {}) : null, renderTrigger?.({
6256
+ ref: refs.setReference,
6257
+ getInteractionProps: getReferenceProps
6258
+ }), /*#__PURE__*/jsxRuntime.jsx(react.FloatingPortal, {
6259
+ children: /*#__PURE__*/jsxRuntime.jsxs(react$1.Transition, {
6260
+ show: open,
6261
+ className: "np-bottom-sheet-v2-container",
6262
+ beforeEnter: () => {
6263
+ setFloatingKey(prev => prev + 1);
6264
+ },
6265
+ children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
6266
+ enter: "np-bottom-sheet-v2-backdrop-container--enter",
6267
+ enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
6268
+ leave: "np-bottom-sheet-v2-backdrop-container--leave",
6269
+ leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
6270
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
6271
+ className: "np-bottom-sheet-v2-backdrop"
6272
+ })
6273
+ }), /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6274
+ context: context,
6275
+ initialFocus: initialFocusRef,
6276
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
6277
+ className: "np-bottom-sheet-v2",
6278
+ children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
6279
+ className: "np-bottom-sheet-v2-content",
6280
+ enter: "np-bottom-sheet-v2-content--enter",
6281
+ enterFrom: "np-bottom-sheet-v2-content--enter-from",
6282
+ leave: "np-bottom-sheet-v2-content--leave",
6283
+ leaveTo: "np-bottom-sheet-v2-content--leave-to",
6284
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6285
+ // Force inner state invalidation on open
6286
+ ref: refs.setFloating,
6287
+ className: "np-bottom-sheet-v2-content-inner-container",
6288
+ ...getFloatingProps(),
6289
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
6290
+ className: "np-bottom-sheet-v2-header",
6291
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
6292
+ size: exports.Size.SMALL,
6293
+ onClick: () => {
6294
+ onClose?.();
6295
+ }
6296
+ })
6297
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
6298
+ className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
6299
+ 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
6300
+ }),
6301
+ children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6302
+ className: "np-bottom-sheet-v2-title np-text-title-body",
6303
+ children: title
6304
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6305
+ className: "np-bottom-sheet-v2-body np-text-body-default",
6306
+ children: children
6307
+ })]
6308
+ })]
6309
+ }, floatingKey)
6310
+ })
6311
+ })
6312
+ })]
6313
+ })
6314
+ })]
6315
+ });
6316
+ }
6317
+
6318
+ const ButtonInput = /*#__PURE__*/React.forwardRef(function ButtonInput({
6319
+ size = 'md',
6320
+ className,
6321
+ style,
6322
+ ...restProps
6323
+ }, ref) {
6324
+ const inputPaddings = useInputPaddings();
6325
+ return /*#__PURE__*/jsxRuntime.jsx("button", {
6326
+ ref: ref,
6327
+ type: "button",
6328
+ className: classNames__default.default(className, formControlClassNameBase({
6329
+ size
6330
+ }), 'np-button-input')
6331
+ // eslint-disable-next-line react/forbid-dom-props
6332
+ ,
6333
+ style: {
6334
+ ...inputPaddings,
6335
+ ...style
6336
+ },
6337
+ ...restProps
6338
+ });
6339
+ });
6340
+
6341
+ const floatingPadding = 16;
6342
+ function Popover({
6343
+ placement,
6344
+ open,
6345
+ renderTrigger,
6346
+ title,
6347
+ padding = 'md',
6348
+ children,
6349
+ onClose
6350
+ }) {
6351
+ const {
6352
+ refs,
6353
+ floatingStyles,
6354
+ context
6355
+ } = react.useFloating({
6356
+ placement,
6357
+ middleware: [react.offset(8), react.flip({
6358
+ padding: floatingPadding,
6359
+ crossAxis: false
6360
+ }), react.shift(), react.size({
6361
+ padding: floatingPadding,
6362
+ apply: ({
6363
+ elements,
6364
+ rects,
6365
+ availableHeight
6366
+ }) => {
6367
+ elements.floating.style.setProperty('--max-height', `${availableHeight}px`);
6368
+ elements.floating.style.setProperty('--width', `${rects.reference.width}px`);
6369
+ }
6370
+ })],
6371
+ whileElementsMounted: react.autoUpdate,
6372
+ open,
6373
+ onOpenChange: value => {
6374
+ if (!value) {
6375
+ onClose?.();
6376
+ }
6377
+ }
6378
+ });
6379
+ const dismiss = react.useDismiss(context, {
6380
+ outsidePressEvent: 'mousedown'
6381
+ });
6382
+ const role = react.useRole(context);
6383
+ const {
6384
+ getReferenceProps,
6385
+ getFloatingProps
6386
+ } = react.useInteractions([role, dismiss]);
6387
+ const [floatingKey, setFloatingKey] = React.useState(0);
6388
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
6389
+ children: [open ? /*#__PURE__*/jsxRuntime.jsx(PreventScroll, {}) : null, renderTrigger({
6390
+ ref: refs.setReference,
6391
+ getInteractionProps: getReferenceProps
6392
+ }), /*#__PURE__*/jsxRuntime.jsx(react.FloatingPortal, {
6393
+ children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6394
+ context: context,
6395
+ children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition, {
6396
+ show: open,
6397
+ leave: "transition-opacity",
6398
+ leaveTo: "opacity-0",
6399
+ beforeEnter: () => {
6400
+ setFloatingKey(prev => prev + 1);
6401
+ },
6402
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
6403
+ // Force inner state invalidation on open
6404
+ ref: refs.setFloating,
6405
+ className: "np-popover-v2-container"
6406
+ // eslint-disable-next-line react/forbid-dom-props
6407
+ ,
6408
+ style: floatingStyles,
6409
+ ...getFloatingProps(),
6410
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6411
+ className: classNames__default.default('np-popover-v2', title && 'np-popover-v2--has-title', {
6412
+ 'np-popover-v2--padding-md': padding === 'md'
6413
+ }),
6414
+ children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6415
+ className: "np-popover-v2-title np-text-title-body",
6416
+ children: title
6417
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6418
+ className: "np-popover-v2-content np-text-body-default",
6419
+ children: children
6420
+ })]
6421
+ })
6422
+ }, floatingKey)
6423
+ })
6424
+ })
6425
+ })]
6426
+ });
6427
+ }
6428
+
6429
+ function searchableString(value) {
6430
+ return value.trim().replace(/\s+/gu, ' ').toLowerCase();
6431
+ }
6432
+ function inferSearchableStrings(value) {
6433
+ if (typeof value === 'string') {
6434
+ return [searchableString(value)];
6435
+ }
6436
+ if (typeof value === 'object' && value != null) {
6437
+ return Object.values(value).filter(innerValue => typeof innerValue === 'string').map(innerValue => searchableString(innerValue));
6438
+ }
6439
+ return [];
6440
+ }
6441
+ const SelectInputHasValueContext = /*#__PURE__*/React.createContext(false);
6442
+ const SelectInputOptionContentCompactContext = /*#__PURE__*/React.createContext(false);
6443
+ function dedupeSelectInputOptionItem(item, existingValues) {
6444
+ if (existingValues.has(item.value)) {
6445
+ return {
6446
+ ...item,
6447
+ value: undefined
6448
+ };
6449
+ }
6450
+ existingValues.add(item.value);
6451
+ return item;
6452
+ }
6453
+ function dedupeSelectInputItems(items) {
6454
+ const existingValues = new Set();
6455
+ return items.map(item => {
6456
+ switch (item.type) {
6457
+ case 'option':
6458
+ {
6459
+ return dedupeSelectInputOptionItem(item, existingValues);
6460
+ }
6461
+ case 'group':
6462
+ {
6463
+ return {
6464
+ ...item,
6465
+ options: item.options.map(option => dedupeSelectInputOptionItem(option, existingValues))
6466
+ };
6467
+ }
6468
+ }
6469
+ return item;
6470
+ });
6471
+ }
6472
+ function SelectInput({
6473
+ name,
6474
+ placeholder,
6475
+ items,
6476
+ defaultValue,
6477
+ value: controlledValue,
6478
+ renderValue = wrapInFragment,
6479
+ compareValues,
6480
+ filterable,
6481
+ filterPlaceholder,
6482
+ disabled,
6483
+ className,
6484
+ onChange,
6485
+ onClear
6486
+ }) {
6487
+ const intl = reactIntl.useIntl();
6488
+ const [open, setOpen] = React.useState(false);
6489
+ const triggerRef = React.useRef(null);
6490
+ const screenSm = useScreenSize(exports.Breakpoint.SMALL);
6491
+ const OptionsOverlay = screenSm ? Popover : BottomSheet;
6492
+ const searchInputRef = React.useRef(null);
6493
+ const listboxRef = React.useRef(null);
6494
+ const controllerRef = filterable ? searchInputRef : listboxRef;
6495
+ return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox, {
6496
+ name: name,
6497
+ defaultValue: defaultValue,
6498
+ value: controlledValue
6499
+ // TODO: Remove assertion when upgrading TypeScript to v5
6500
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6501
+ ,
6502
+ by: compareValues,
6503
+ disabled: disabled,
6504
+ onChange: value => {
6505
+ setOpen(false);
6506
+ onChange?.(value);
6507
+ },
6508
+ children: ({
6509
+ disabled: uiDisabled,
6510
+ value
6511
+ }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputHasValueContext.Provider, {
6512
+ value: value != null,
6513
+ children: /*#__PURE__*/jsxRuntime.jsx(InputGroup, {
6514
+ addonEnd: {
6515
+ content: /*#__PURE__*/jsxRuntime.jsxs("span", {
6516
+ className: classNames__default.default('np-select-input-addon-container', uiDisabled && 'disabled'),
6517
+ children: [onClear != null && value != null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
6518
+ children: [/*#__PURE__*/jsxRuntime.jsx("button", {
6519
+ type: "button",
6520
+ "aria-label": intl.formatMessage(messages$5.ariaLabel),
6521
+ disabled: uiDisabled,
6522
+ className: "np-select-input-addon np-select-input-addon--interactive",
6523
+ onClick: event => {
6524
+ event.preventDefault();
6525
+ onClear();
6526
+ triggerRef.current?.focus({
6527
+ preventScroll: true
6528
+ });
6529
+ },
6530
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {
6531
+ size: 16
6532
+ })
6533
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
6534
+ className: "np-select-input-addon-separator"
6535
+ })]
6536
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
6537
+ className: "np-select-input-addon",
6538
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.ChevronDown, {
6539
+ size: 16
6540
+ })
6541
+ })]
6542
+ }),
6543
+ padding: 'sm'
6544
+ },
6545
+ className: className,
6546
+ children: /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
6547
+ open: open,
6548
+ renderTrigger: ({
6549
+ ref,
6550
+ getInteractionProps
6551
+ }) => /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Button, {
6552
+ ref: mergeRefs__default.default([ref, triggerRef]),
6553
+ as: SelectInputButton,
6554
+ overrides: getInteractionProps(),
6555
+ onClick: () => {
6556
+ setOpen(prev => !prev);
6557
+ },
6558
+ children: value != null ? /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContentCompactContext.Provider, {
6559
+ value: true,
6560
+ children: renderValue(value, true)
6561
+ }) : /*#__PURE__*/jsxRuntime.jsx("span", {
6562
+ className: "np-select-input-placeholder",
6563
+ children: placeholder
6564
+ })
6565
+ }),
6566
+ initialFocusRef: controllerRef,
6567
+ padding: "none",
6568
+ onClose: () => {
6569
+ setOpen(false);
6570
+ },
6571
+ children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
6572
+ items: items,
6573
+ renderValue: renderValue,
6574
+ filterable: filterable,
6575
+ filterPlaceholder: filterPlaceholder,
6576
+ searchInputRef: searchInputRef,
6577
+ listboxRef: listboxRef
6578
+ })
6579
+ })
6580
+ })
6581
+ })
6582
+ });
6583
+ }
6584
+ const SelectInputButton = /*#__PURE__*/React.forwardRef(function SelectInputButton({
6585
+ overrides,
6586
+ ...restProps
6587
+ }, ref) {
6588
+ return /*#__PURE__*/jsxRuntime.jsx(ButtonInput, {
6589
+ ref: ref,
6590
+ ...restProps,
6591
+ ...overrides
6592
+ });
6593
+ });
6594
+ const SelectInputOptionsContainer = /*#__PURE__*/React.forwardRef(function SelectInputOptionsContainer({
6595
+ 'aria-orientation': ariaOrientation,
6596
+ 'aria-activedescendant': ariaActiveDescendant,
6597
+ role,
6598
+ tabIndex,
6599
+ onAriaActiveDescendantChange,
6600
+ onKeyDown,
6601
+ ...restProps
6602
+ }, ref) {
6603
+ const handleAriaActiveDescendantChange = useEffectEvent(onAriaActiveDescendantChange);
6604
+ React.useEffect(() => {
6605
+ handleAriaActiveDescendantChange(ariaActiveDescendant);
6606
+ }, [ariaActiveDescendant, handleAriaActiveDescendantChange]);
6607
+ return (
6608
+ /*#__PURE__*/
6609
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
6610
+ jsxRuntime.jsx("div", {
6611
+ ref: ref,
6612
+ onKeyDown: event => {
6613
+ // Prevent absorbing dismissal requests too early
6614
+ if (event.key !== 'Escape') {
6615
+ onKeyDown?.(event);
6616
+ }
6617
+ },
6618
+ ...restProps
6619
+ })
6620
+ );
6621
+ });
6622
+ function SelectInputOptions({
6623
+ items,
6624
+ renderValue = wrapInFragment,
6625
+ filterable,
6626
+ filterPlaceholder,
6627
+ searchInputRef,
6628
+ listboxRef
6629
+ }) {
6630
+ const [query, setQuery] = React.useState('');
6631
+ const needle = React.useMemo(() => query ? searchableString(query) : null, [query]);
6632
+ const listboxContainerRef = React.useRef(null);
6633
+ React.useEffect(() => {
6634
+ if (listboxContainerRef.current != null) {
6635
+ listboxContainerRef.current.style.setProperty('--initial-height', `${listboxContainerRef.current.offsetHeight}px`);
6636
+ }
6637
+ }, []);
6638
+ const listboxId = reactId.useId();
6639
+ const controllerRef = filterable ? searchInputRef : listboxRef;
6640
+ return /*#__PURE__*/jsxRuntime.jsxs(react$1.Listbox.Options, {
6641
+ as: SelectInputOptionsContainer,
6642
+ static: true,
6643
+ className: "np-select-input-options-container",
6644
+ onAriaActiveDescendantChange: value => {
6645
+ if (controllerRef.current != null) {
6646
+ if (value != null) {
6647
+ controllerRef.current.setAttribute('aria-activedescendant', value);
6648
+ } else {
6649
+ controllerRef.current.removeAttribute('aria-activedescendant');
6650
+ }
6651
+ }
6652
+ },
6653
+ children: [filterable ? /*#__PURE__*/jsxRuntime.jsx("div", {
6654
+ className: "np-select-input-query-container",
6655
+ children: /*#__PURE__*/jsxRuntime.jsx(SearchInput, {
6656
+ ref: searchInputRef,
6657
+ shape: "rectangle",
6658
+ placeholder: filterPlaceholder,
6659
+ value: query,
6660
+ "aria-controls": listboxId,
6661
+ onKeyDown: event => {
6662
+ // Prevent interfering with the matcher of Headless UI
6663
+ // https://mathiasbynens.be/notes/javascript-unicode#regex
6664
+ if (/^.$/u.test(event.key)) {
6665
+ event.stopPropagation();
6666
+ }
6667
+ },
6668
+ onChange: event => {
6669
+ setQuery(event.currentTarget.value);
6670
+ }
6671
+ })
6672
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6673
+ ref: listboxContainerRef,
6674
+ className: classNames__default.default('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
6675
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
6676
+ ref: listboxRef,
6677
+ id: listboxId,
6678
+ role: "listbox",
6679
+ "aria-orientation": "vertical",
6680
+ tabIndex: 0,
6681
+ className: "np-select-input-listbox",
6682
+ children: (needle == null ? items : dedupeSelectInputItems(items)).map((item, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
6683
+ // eslint-disable-next-line react/no-array-index-key
6684
+ , {
6685
+ item: item,
6686
+ renderValue: renderValue,
6687
+ needle: needle
6688
+ }, index))
6689
+ })
6690
+ })]
6691
+ });
6692
+ }
6693
+ function SelectInputItemView({
6694
+ item,
6695
+ renderValue,
6696
+ needle
6697
+ }) {
6698
+ switch (item.type) {
6699
+ case 'option':
6700
+ {
6701
+ if (item.value != null && (!needle || inferSearchableStrings(item.filterMatchers ?? item.value).some(haystack => haystack.includes(needle)))) {
6702
+ return /*#__PURE__*/jsxRuntime.jsx(SelectInputOption, {
6703
+ value: item.value,
6704
+ disabled: item.disabled,
6705
+ children: renderValue(item.value, false)
6706
+ });
6707
+ }
6708
+ break;
6709
+ }
6710
+ case 'group':
6711
+ {
6712
+ return /*#__PURE__*/jsxRuntime.jsx(SelectInputGroupItemView, {
6713
+ item: item,
6714
+ renderValue: renderValue,
6715
+ needle: needle
6716
+ });
6717
+ }
6718
+ case 'separator':
6719
+ {
6720
+ if (needle == null) {
6721
+ return /*#__PURE__*/jsxRuntime.jsx("hr", {
6722
+ className: "np-select-input-separator-item",
6723
+ "aria-hidden": true
6724
+ });
6725
+ }
6726
+ break;
6727
+ }
6728
+ }
6729
+ return null;
6730
+ }
6731
+ function SelectInputGroupItemView({
6732
+ item,
6733
+ renderValue,
6734
+ needle
6735
+ }) {
6736
+ const headerId = reactId.useId();
6737
+ return (
6738
+ /*#__PURE__*/
6739
+ // An empty container may be rendered when no options match `needle`
6740
+ // However, pre-filtering would result in worse performance overall
6741
+ jsxRuntime.jsxs("section", {
6742
+ role: "group",
6743
+ "aria-labelledby": headerId,
6744
+ className: classNames__default.default(needle == null && 'np-select-input-group-item--without-needle'),
6745
+ children: [needle == null ? /*#__PURE__*/jsxRuntime.jsx("header", {
6746
+ id: headerId,
6747
+ role: "presentation",
6748
+ className: "np-select-input-group-item-header np-text-title-group",
6749
+ children: item.label
6750
+ }) : null, item.options.map((option, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
6751
+ // eslint-disable-next-line react/no-array-index-key
6752
+ , {
6753
+ item: option,
6754
+ renderValue: renderValue,
6755
+ needle: needle
6756
+ }, index))]
6757
+ })
6758
+ );
6759
+ }
6760
+ function SelectInputOption({
6761
+ value,
6762
+ disabled,
6763
+ children
6764
+ }) {
6765
+ const parentHasValue = React.useContext(SelectInputHasValueContext);
6766
+ // Avoid flash during exit transition
6767
+ const {
6768
+ current: cachedParentHasValue
6769
+ } = React.useRef(parentHasValue);
6770
+ return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Option, {
6771
+ as: "div",
6772
+ value: value,
6773
+ disabled: disabled,
6774
+ className: ({
6775
+ active,
6776
+ disabled: uiDisabled
6777
+ }) => classNames__default.default('np-select-input-option-container np-text-body-large', active && 'np-select-input-option-container--active', uiDisabled && 'np-select-input-option-container--disabled'),
6778
+ children: ({
6779
+ selected
6780
+ }) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
6781
+ children: [cachedParentHasValue ? /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
6782
+ size: 16,
6783
+ className: classNames__default.default(!selected && 'np-select-input-option-check--not-selected')
6784
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6785
+ className: "np-select-input-option",
6786
+ children: children
6787
+ })]
6788
+ })
6789
+ });
6790
+ }
6791
+ function SelectInputOptionContent({
6792
+ title,
6793
+ note,
6794
+ description,
6795
+ icon
6796
+ }) {
6797
+ const compact = React.useContext(SelectInputOptionContentCompactContext);
6798
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
6799
+ className: "np-select-input-option-content-container np-text-body-large",
6800
+ children: [icon ? /*#__PURE__*/jsxRuntime.jsx("div", {
6801
+ className: classNames__default.default('np-select-input-option-content-icon', !compact && 'np-select-input-option-content-icon--not-compact'),
6802
+ children: icon
6803
+ }) : null, /*#__PURE__*/jsxRuntime.jsxs("div", {
6804
+ className: "np-select-input-option-content-text",
6805
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
6806
+ className: classNames__default.default('np-select-input-option-content-text-line-1', compact && 'np-select-input-option-content-text-compact'),
6807
+ children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
6808
+ className: "d-inline np-text-body-large",
6809
+ children: title
6810
+ }), note ? /*#__PURE__*/jsxRuntime.jsx("span", {
6811
+ className: "np-select-input-option-content-text-secondary np-text-body-default",
6812
+ children: note
6813
+ }) : null]
6814
+ }), description ? /*#__PURE__*/jsxRuntime.jsx("div", {
6815
+ className: classNames__default.default('np-select-input-option-content-text-secondary np-text-body-default', compact && 'np-select-input-option-content-text-compact'),
6816
+ children: description
6817
+ }) : null]
6818
+ })]
6819
+ });
6820
+ }
6821
+
6203
6822
  const TextArea = /*#__PURE__*/React.forwardRef(function TextArea({
6204
6823
  className,
6205
6824
  ...restProps
@@ -7315,7 +7934,7 @@ function Select({
7315
7934
  headerTitle: searchPlaceholder || formatMessage(messages$3.searchPlaceholder),
7316
7935
  onClose: handleCloseOptions,
7317
7936
  children: renderOptionsList()
7318
- }) : /*#__PURE__*/jsxRuntime.jsx(BottomSheet$1, {
7937
+ }) : /*#__PURE__*/jsxRuntime.jsx(BottomSheet$2, {
7319
7938
  open: open,
7320
7939
  onClose: handleCloseOptions,
7321
7940
  children: renderOptionsList({
@@ -9497,6 +10116,7 @@ const PhoneNumberInput = props => {
9497
10116
  className: `input-group input-group-${size}`,
9498
10117
  children: /*#__PURE__*/jsxRuntime.jsx("input", {
9499
10118
  id: id,
10119
+ autoComplete: "tel-national",
9500
10120
  name: "phoneNumber",
9501
10121
  inputMode: "numeric",
9502
10122
  value: internalValue.suffix,
@@ -9971,6 +10591,14 @@ var en = {
9971
10591
  "neptune.DateInput.day.label": "Day",
9972
10592
  "neptune.DateInput.month.label": "Month",
9973
10593
  "neptune.DateInput.year.label": "Year",
10594
+ "neptune.DateLookup.day": "day",
10595
+ "neptune.DateLookup.goTo20YearView": "Go to 20 year view",
10596
+ "neptune.DateLookup.month": "month",
10597
+ "neptune.DateLookup.next": "next",
10598
+ "neptune.DateLookup.previous": "previous",
10599
+ "neptune.DateLookup.selected": "selected",
10600
+ "neptune.DateLookup.twentyYears": "20 years",
10601
+ "neptune.DateLookup.year": "year",
9974
10602
  "neptune.Link.opensInNewTab": "(opens in new tab)",
9975
10603
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
9976
10604
  "neptune.Select.searchPlaceholder": "Search...",
@@ -10432,6 +11060,7 @@ class Snackbar extends React.Component {
10432
11060
  ref: this.bodyRef,
10433
11061
  as: "span",
10434
11062
  className: `snackbar__text snackbar__text--${theme}`,
11063
+ "aria-live": "polite",
10435
11064
  children: [text, action ? /*#__PURE__*/jsxRuntime.jsx(ActionButton, {
10436
11065
  className: "snackbar__text__action",
10437
11066
  onClick: action.onClick,
@@ -11331,7 +11960,8 @@ class Tabs extends React.Component {
11331
11960
  children: title
11332
11961
  }, title);
11333
11962
  }), translateLineX ? /*#__PURE__*/jsxRuntime.jsx("li", {
11334
- className: classNames__default.default('tabs__line'),
11963
+ role: "none",
11964
+ className: "tabs__line",
11335
11965
  style: {
11336
11966
  width: this.getTabLineWidth(),
11337
11967
  transform: isRTL ? `translateX(-${translateLineX})` : `translateX(${translateLineX})`
@@ -12478,6 +13108,7 @@ const ProcessingStep = props => {
12478
13108
  'm-b-2': isModern
12479
13109
  }),
12480
13110
  type: exports.Typography.TITLE_BODY,
13111
+ "aria-live": "polite",
12481
13112
  children: psProcessingText
12482
13113
  }), psButtonText && /*#__PURE__*/jsxRuntime.jsx(Button, {
12483
13114
  disabled: psButtonDisabled,
@@ -12521,6 +13152,7 @@ const CompleteStep = props => {
12521
13152
  className: "droppable-card-content",
12522
13153
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
12523
13154
  className: "droppable-card-content d-flex flex-column align-items-center",
13155
+ "aria-live": "polite",
12524
13156
  children: isError ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
12525
13157
  children: [isModern ? /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
12526
13158
  size: exports.Size.LARGE,
@@ -12889,6 +13521,7 @@ class Upload extends React.Component {
12889
13521
  onClear: event => this.handleOnClear(event)
12890
13522
  }), !isProcessing && /*#__PURE__*/jsxRuntime.jsx("div", {
12891
13523
  className: "droppable-dropping-card droppable-card",
13524
+ "aria-live": "polite",
12892
13525
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
12893
13526
  className: "droppable-card-content",
12894
13527
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -13363,6 +13996,7 @@ const UploadItem = ({
13363
13996
  onDownload: onDownloadFile,
13364
13997
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
13365
13998
  className: "np-upload-button",
13999
+ "aria-live": "polite",
13366
14000
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
13367
14001
  className: "media",
13368
14002
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -14439,7 +15073,7 @@ exports.AvatarWrapper = AvatarWrapper;
14439
15073
  exports.Badge = Badge;
14440
15074
  exports.BaseCard = Card;
14441
15075
  exports.Body = Body;
14442
- exports.BottomSheet = BottomSheet$1;
15076
+ exports.BottomSheet = BottomSheet$2;
14443
15077
  exports.Button = Button;
14444
15078
  exports.Card = Card$2;
14445
15079
  exports.Checkbox = Checkbox$1;
@@ -14487,7 +15121,7 @@ exports.Nudge = Nudge;
14487
15121
  exports.Option = Option$2;
14488
15122
  exports.OverlayHeader = OverlayHeader$1;
14489
15123
  exports.PhoneNumberInput = PhoneNumberInput$1;
14490
- exports.Popover = Popover$1;
15124
+ exports.Popover = Popover$2;
14491
15125
  exports.ProcessIndicator = ProcessIndicator$1;
14492
15126
  exports.Progress = Progress;
14493
15127
  exports.ProgressBar = ProgressBar;
@@ -14499,8 +15133,11 @@ exports.Radio = Radio$1;
14499
15133
  exports.RadioGroup = RadioGroup$1;
14500
15134
  exports.RadioOption = RadioOption$1;
14501
15135
  exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
15136
+ exports.SearchInput = SearchInput;
14502
15137
  exports.Section = Section;
14503
15138
  exports.Select = Select;
15139
+ exports.SelectInput = SelectInput;
15140
+ exports.SelectInputOptionContent = SelectInputOptionContent;
14504
15141
  exports.SlidingPanel = SlidingPanel$1;
14505
15142
  exports.SnackbarConsumer = SnackbarConsumer;
14506
15143
  exports.SnackbarContext = SnackbarContext;