@transferwise/components 0.0.0-experimental-05a786f → 0.0.0-experimental-278276c

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 (86) hide show
  1. package/build/i18n/en.json +0 -1
  2. package/build/index.esm.js +206 -229
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +206 -229
  5. package/build/index.js.map +1 -1
  6. package/build/main.css +1 -1
  7. package/build/styles/actionButton/ActionButton.css +1 -1
  8. package/build/styles/chips/Chip.css +1 -1
  9. package/build/styles/circularButton/CircularButton.css +1 -1
  10. package/build/styles/common/Option/Option.css +1 -1
  11. package/build/styles/common/bottomSheet/BottomSheet.css +1 -1
  12. package/build/styles/common/closeButton/CloseButton.css +1 -1
  13. package/build/styles/dateLookup/DateLookup.css +1 -1
  14. package/build/styles/drawer/Drawer.css +1 -1
  15. package/build/styles/flowNavigation/FlowNavigation.css +1 -1
  16. package/build/styles/inputs/SelectInput.css +1 -1
  17. package/build/styles/main.css +1 -1
  18. package/build/styles/overlayHeader/OverlayHeader.css +1 -1
  19. package/build/styles/statusIcon/StatusIcon.css +1 -1
  20. package/build/styles/summary/Summary.css +1 -1
  21. package/build/styles/typeahead/Typeahead.css +1 -1
  22. package/build/styles/uploadInput/UploadInput.css +1 -1
  23. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  24. package/build/types/common/propsValues/breakpoint.d.ts +1 -0
  25. package/build/types/common/propsValues/breakpoint.d.ts.map +1 -1
  26. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  27. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  28. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  29. package/build/types/test-utils/story-config.d.ts +11 -1
  30. package/build/types/test-utils/story-config.d.ts.map +1 -1
  31. package/build/types/test-utils/window-mock.d.ts +2 -0
  32. package/build/types/test-utils/window-mock.d.ts.map +1 -0
  33. package/package.json +4 -4
  34. package/src/actionButton/ActionButton.css +1 -1
  35. package/src/actionButton/ActionButton.less +5 -1
  36. package/src/chips/Chip.css +1 -1
  37. package/src/chips/Chip.less +8 -0
  38. package/src/circularButton/CircularButton.css +1 -1
  39. package/src/circularButton/CircularButton.less +9 -3
  40. package/src/common/Option/Option.css +1 -1
  41. package/src/common/Option/Option.less +6 -0
  42. package/src/common/bottomSheet/BottomSheet.css +1 -1
  43. package/src/common/bottomSheet/BottomSheet.less +1 -1
  44. package/src/common/bottomSheet/BottomSheet.spec.tsx +4 -1
  45. package/src/common/bottomSheet/BottomSheet.story.tsx +4 -0
  46. package/src/common/bottomSheet/BottomSheet.tsx +10 -1
  47. package/src/common/closeButton/CloseButton.css +1 -1
  48. package/src/common/closeButton/CloseButton.less +12 -0
  49. package/src/common/hooks/useMedia.spec.ts +3 -17
  50. package/src/common/propsValues/breakpoint.ts +1 -0
  51. package/src/dateLookup/DateLookup.css +1 -1
  52. package/src/dateLookup/DateLookup.js +7 -3
  53. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -0
  54. package/src/dateLookup/DateLookup.less +6 -0
  55. package/src/dateLookup/DateLookup.story.js +6 -1
  56. package/src/dateLookup/DateLookup.testingLibrary.spec.js +3 -1
  57. package/src/dateLookup/DateLookup.view.spec.js +4 -0
  58. package/src/dateLookup/dateHeader/DateHeader.js +4 -2
  59. package/src/drawer/Drawer.css +1 -1
  60. package/src/drawer/Drawer.less +6 -8
  61. package/src/drawer/Drawer.story.js +42 -2
  62. package/src/flowNavigation/FlowNavigation.css +1 -1
  63. package/src/i18n/en.json +0 -1
  64. package/src/inputs/SelectInput.css +1 -1
  65. package/src/inputs/SelectInput.less +0 -12
  66. package/src/inputs/SelectInput.tsx +22 -55
  67. package/src/inputs/_BottomSheet.tsx +19 -19
  68. package/src/main.css +1 -1
  69. package/src/modal/Modal.tsx +2 -2
  70. package/src/overlayHeader/OverlayHeader.css +1 -1
  71. package/src/popover/Popover.spec.js +3 -1
  72. package/src/select/Select.spec.js +6 -9
  73. package/src/statusIcon/StatusIcon.css +1 -1
  74. package/src/statusIcon/StatusIcon.less +10 -0
  75. package/src/summary/Summary.css +1 -1
  76. package/src/summary/Summary.less +1 -1
  77. package/src/test-utils/index.js +1 -0
  78. package/src/test-utils/story-config.ts +21 -7
  79. package/src/test-utils/window-mock.ts +19 -0
  80. package/src/typeahead/Typeahead.css +1 -1
  81. package/src/typeahead/Typeahead.less +5 -6
  82. package/src/uploadInput/UploadInput.css +1 -1
  83. package/src/uploadInput/UploadInput.less +5 -1
  84. package/build/types/inputs/SelectInput.messages.d.ts +0 -9
  85. package/build/types/inputs/SelectInput.messages.d.ts.map +0 -1
  86. package/src/inputs/SelectInput.messages.ts +0 -9
@@ -13,11 +13,11 @@ import { CSSTransition } from 'react-transition-group';
13
13
  import { createPortal } from 'react-dom';
14
14
  import { FocusScope } from '@react-aria/focus';
15
15
  import mergeRefs from 'react-merge-refs';
16
+ import { useSyncExternalStore } from 'use-sync-external-store/shim';
16
17
  import { isUndefined, isKey, isNumber, isEmpty, isNull, isArray } from '@transferwise/neptune-validation';
17
18
  import { usePopper } from 'react-popper';
18
19
  import { Transition, Listbox } from '@headlessui/react';
19
20
  import mergeProps from 'merge-props';
20
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
21
21
  import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, offset, flip, shift, size, autoUpdate } from '@floating-ui/react';
22
22
  import { usePreventScroll } from '@react-aria/overlays';
23
23
  import { Illustration } from '@wise/art';
@@ -158,6 +158,7 @@ var Priority;
158
158
 
159
159
  var Breakpoint;
160
160
  (function (Breakpoint) {
161
+ Breakpoint[Breakpoint["ZOOM_400"] = 320] = "ZOOM_400";
161
162
  Breakpoint[Breakpoint["EXTRA_SMALL"] = 480] = "EXTRA_SMALL";
162
163
  Breakpoint[Breakpoint["SMALL"] = 576] = "SMALL";
163
164
  Breakpoint[Breakpoint["MEDIUM"] = 768] = "MEDIUM";
@@ -1706,58 +1707,6 @@ const DimmerContentWrapper = ({
1706
1707
  };
1707
1708
  var Dimmer$1 = withNextPortalWrapper(Dimmer);
1708
1709
 
1709
- const EXIT_ANIMATION = 350;
1710
- const SlidingPanel = /*#__PURE__*/forwardRef(({
1711
- children,
1712
- className,
1713
- open,
1714
- position,
1715
- showSlidingPanelBorder,
1716
- slidingPanelPositionFixed,
1717
- ...rest
1718
- }, reference) => {
1719
- /** @type {RefObject<HTMLDivElement>} */
1720
- const localReference = useRef(null);
1721
- return /*#__PURE__*/jsx(CSSTransition, {
1722
- ...rest,
1723
- nodeRef: localReference,
1724
- in: open
1725
- // Wait for animation to finish before unmount.
1726
- ,
1727
- timeout: {
1728
- enter: 0,
1729
- exit: EXIT_ANIMATION
1730
- },
1731
- classNames: classNames(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
1732
- 'sliding-panel--fixed': slidingPanelPositionFixed
1733
- }, 'sliding-panel'),
1734
- appear: true,
1735
- unmountOnExit: true,
1736
- children: /*#__PURE__*/jsx("div", {
1737
- ref: mergeRefs([reference, localReference]),
1738
- className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
1739
- children: children
1740
- })
1741
- });
1742
- });
1743
- SlidingPanel.propTypes = {
1744
- children: PropTypes.node,
1745
- className: PropTypes.string,
1746
- open: PropTypes.bool,
1747
- position: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
1748
- showSlidingPanelBorder: PropTypes.bool,
1749
- slidingPanelPositionFixed: PropTypes.bool
1750
- };
1751
- SlidingPanel.defaultProps = {
1752
- children: null,
1753
- className: undefined,
1754
- open: false,
1755
- position: 'left',
1756
- showSlidingPanelBorder: false,
1757
- slidingPanelPositionFixed: false
1758
- };
1759
- var SlidingPanel$1 = SlidingPanel;
1760
-
1761
1710
  const THROTTLE_MS = 100;
1762
1711
  const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
1763
1712
  const useClientWidth = ({
@@ -1928,6 +1877,137 @@ const useLayout = () => {
1928
1877
  };
1929
1878
  };
1930
1879
 
1880
+ const EXIT_ANIMATION = 350;
1881
+ const SlidingPanel = /*#__PURE__*/forwardRef(({
1882
+ children,
1883
+ className,
1884
+ open,
1885
+ position,
1886
+ showSlidingPanelBorder,
1887
+ slidingPanelPositionFixed,
1888
+ ...rest
1889
+ }, reference) => {
1890
+ /** @type {RefObject<HTMLDivElement>} */
1891
+ const localReference = useRef(null);
1892
+ return /*#__PURE__*/jsx(CSSTransition, {
1893
+ ...rest,
1894
+ nodeRef: localReference,
1895
+ in: open
1896
+ // Wait for animation to finish before unmount.
1897
+ ,
1898
+ timeout: {
1899
+ enter: 0,
1900
+ exit: EXIT_ANIMATION
1901
+ },
1902
+ classNames: classNames(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
1903
+ 'sliding-panel--fixed': slidingPanelPositionFixed
1904
+ }, 'sliding-panel'),
1905
+ appear: true,
1906
+ unmountOnExit: true,
1907
+ children: /*#__PURE__*/jsx("div", {
1908
+ ref: mergeRefs([reference, localReference]),
1909
+ className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
1910
+ children: children
1911
+ })
1912
+ });
1913
+ });
1914
+ SlidingPanel.propTypes = {
1915
+ children: PropTypes.node,
1916
+ className: PropTypes.string,
1917
+ open: PropTypes.bool,
1918
+ position: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
1919
+ showSlidingPanelBorder: PropTypes.bool,
1920
+ slidingPanelPositionFixed: PropTypes.bool
1921
+ };
1922
+ SlidingPanel.defaultProps = {
1923
+ children: null,
1924
+ className: undefined,
1925
+ open: false,
1926
+ position: 'left',
1927
+ showSlidingPanelBorder: false,
1928
+ slidingPanelPositionFixed: false
1929
+ };
1930
+ var SlidingPanel$1 = SlidingPanel;
1931
+
1932
+ const Drawer = ({
1933
+ children,
1934
+ className,
1935
+ footerContent,
1936
+ headerTitle,
1937
+ onClose,
1938
+ open,
1939
+ position
1940
+ }) => {
1941
+ logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
1942
+ const {
1943
+ isMobile
1944
+ } = useLayout();
1945
+ return /*#__PURE__*/jsx(Dimmer$1, {
1946
+ open: open,
1947
+ onClose: onClose,
1948
+ children: /*#__PURE__*/jsx(SlidingPanel$1, {
1949
+ open: open,
1950
+ position: isMobile ? Position.BOTTOM : position,
1951
+ children: /*#__PURE__*/jsxs("div", {
1952
+ className: classNames('np-drawer', className),
1953
+ role: "dialog",
1954
+ children: [/*#__PURE__*/jsxs("div", {
1955
+ className: classNames('np-drawer-header', {
1956
+ 'np-drawer-header--withborder': headerTitle
1957
+ }),
1958
+ children: [headerTitle && /*#__PURE__*/jsx(Title, {
1959
+ type: Typography.TITLE_BODY,
1960
+ children: headerTitle
1961
+ }), /*#__PURE__*/jsx(CloseButton, {
1962
+ onClick: onClose
1963
+ })]
1964
+ }), children && /*#__PURE__*/jsx("div", {
1965
+ className: classNames('np-drawer-content'),
1966
+ children: children
1967
+ }), footerContent && /*#__PURE__*/jsx("div", {
1968
+ className: classNames('np-drawer-footer'),
1969
+ children: footerContent
1970
+ })]
1971
+ })
1972
+ })
1973
+ });
1974
+ };
1975
+ Drawer.propTypes = {
1976
+ /** The content to appear in the drawer body. */
1977
+ children: PropTypes.node,
1978
+ className: PropTypes.string,
1979
+ /** The content to appear in the drawer footer. */
1980
+ footerContent: PropTypes.node,
1981
+ /** The content to appear in the drawer header. */
1982
+ headerTitle: PropTypes.node,
1983
+ /** The action to perform on close click. */
1984
+ onClose: PropTypes.func,
1985
+ /** The status of Drawer either open or not. */
1986
+ open: PropTypes.bool,
1987
+ /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
1988
+ position: PropTypes.oneOf(['left', 'right', 'bottom'])
1989
+ };
1990
+ Drawer.defaultProps = {
1991
+ children: null,
1992
+ className: undefined,
1993
+ footerContent: null,
1994
+ headerTitle: null,
1995
+ onClose: null,
1996
+ open: false,
1997
+ position: Position.RIGHT
1998
+ };
1999
+ var Drawer$1 = Drawer;
2000
+
2001
+ function useMedia(query) {
2002
+ return useSyncExternalStore(onStoreChange => {
2003
+ const mediaQueryList = window.matchMedia(query);
2004
+ mediaQueryList.addEventListener('change', onStoreChange);
2005
+ return () => {
2006
+ mediaQueryList.removeEventListener('change', onStoreChange);
2007
+ };
2008
+ }, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
2009
+ }
2010
+
1931
2011
  const INITIAL_Y_POSITION = 0;
1932
2012
  const CONTENT_SCROLL_THRESHOLD = 1;
1933
2013
  const MOVE_OFFSET_THRESHOLD = 50;
@@ -2055,7 +2135,13 @@ const BottomSheet$1 = props => {
2055
2135
  maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`
2056
2136
  };
2057
2137
  }
2058
- return /*#__PURE__*/jsx(Dimmer$1, {
2138
+ const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
2139
+ return is400Zoom ? /*#__PURE__*/jsx(Drawer$1, {
2140
+ open: props.open,
2141
+ className: props.className,
2142
+ onClose: close,
2143
+ children: props.children
2144
+ }) : /*#__PURE__*/jsx(Dimmer$1, {
2059
2145
  open: props.open,
2060
2146
  fadeContentOnEnter: true,
2061
2147
  fadeContentOnExit: true,
@@ -3282,7 +3368,7 @@ const ResponsivePanel = /*#__PURE__*/forwardRef(({
3282
3368
  });
3283
3369
  var ResponsivePanel$1 = ResponsivePanel;
3284
3370
 
3285
- var dateTriggerMessages = defineMessages({
3371
+ var messages$6 = defineMessages({
3286
3372
  ariaLabel: {
3287
3373
  id: "neptune.ClearButton.ariaLabel"
3288
3374
  }
@@ -3345,7 +3431,7 @@ const DateTrigger = ({
3345
3431
  className: "input-group-addon",
3346
3432
  children: /*#__PURE__*/jsx(CloseButton, {
3347
3433
  className: `clear-btn clear-btn--${size}`,
3348
- "aria-label": formatMessage(dateTriggerMessages.ariaLabel),
3434
+ "aria-label": formatMessage(messages$6.ariaLabel),
3349
3435
  size: Size.SMALL,
3350
3436
  onClick: event => {
3351
3437
  event.stopPropagation();
@@ -3375,7 +3461,7 @@ DateTrigger.defaultProps = {
3375
3461
  };
3376
3462
  var DateTrigger$1 = DateTrigger;
3377
3463
 
3378
- var messages$6 = defineMessages({
3464
+ var messages$5 = defineMessages({
3379
3465
  next: {
3380
3466
  id: "neptune.DateLookup.next"
3381
3467
  },
@@ -3411,14 +3497,17 @@ const DateHeader = ({
3411
3497
  dateMode
3412
3498
  }) => {
3413
3499
  const intl = useIntl();
3500
+ const {
3501
+ isMobile
3502
+ } = useLayout();
3414
3503
  return /*#__PURE__*/jsxs("div", {
3415
- className: "text-xs-center p-t-1 p-b-2 clearfix",
3504
+ className: classNames('text-xs-center', !isMobile && ['clearfix', 'p-y-1']),
3416
3505
  children: [/*#__PURE__*/jsx("div", {
3417
3506
  className: "pull-left-single-direction",
3418
3507
  children: /*#__PURE__*/jsx("button", {
3419
3508
  type: "button",
3420
3509
  className: `d-inline-flex ${buttonClasses}`,
3421
- "aria-label": `${intl.formatMessage(messages$6.previous)} ${dateMode}`,
3510
+ "aria-label": `${intl.formatMessage(messages$5.previous)} ${dateMode}`,
3422
3511
  onClick: onPreviousClick,
3423
3512
  children: /*#__PURE__*/jsx(Chevron$1, {
3424
3513
  orientation: Position.LEFT,
@@ -3432,7 +3521,7 @@ const DateHeader = ({
3432
3521
  children: /*#__PURE__*/jsx("button", {
3433
3522
  type: "button",
3434
3523
  className: `tw-date-lookup-header-current ${buttonClasses}`,
3435
- "aria-label": intl.formatMessage(messages$6.goTo20YearView),
3524
+ "aria-label": intl.formatMessage(messages$5.goTo20YearView),
3436
3525
  onClick: onLabelClick,
3437
3526
  children: label
3438
3527
  })
@@ -3441,7 +3530,7 @@ const DateHeader = ({
3441
3530
  children: /*#__PURE__*/jsx("button", {
3442
3531
  type: "button",
3443
3532
  className: `d-inline-flex ${buttonClasses}`,
3444
- "aria-label": `${useIntl().formatMessage(messages$6.next)} ${dateMode}`,
3533
+ "aria-label": `${useIntl().formatMessage(messages$5.next)} ${dateMode}`,
3445
3534
  onClick: onNextClick,
3446
3535
  children: /*#__PURE__*/jsx(Chevron$1, {
3447
3536
  orientation: Position.RIGHT,
@@ -3485,7 +3574,7 @@ class TableLink extends PureComponent {
3485
3574
  };
3486
3575
  calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
3487
3576
  if (active) {
3488
- return `${longTitle || title}, ${formatMessage(messages$6.selected)} ${formatMessage(messages$6[type])}`;
3577
+ return `${longTitle || title}, ${formatMessage(messages$5.selected)} ${formatMessage(messages$5[type])}`;
3489
3578
  }
3490
3579
  return longTitle || title;
3491
3580
  };
@@ -3708,7 +3797,7 @@ class DayCalendar extends PureComponent {
3708
3797
  month: monthFormat,
3709
3798
  year: 'numeric'
3710
3799
  }),
3711
- dateMode: formatMessage(messages$6.month),
3800
+ dateMode: formatMessage(messages$5.month),
3712
3801
  onLabelClick: onLabelClick,
3713
3802
  onPreviousClick: this.selectPreviousMonth,
3714
3803
  onNextClick: this.selectNextMonth
@@ -3836,7 +3925,7 @@ class MonthCalendar extends PureComponent {
3836
3925
  } = this.props;
3837
3926
  return /*#__PURE__*/jsxs(Fragment, {
3838
3927
  children: [/*#__PURE__*/jsx(DateHeader$1, {
3839
- dateMode: formatMessage(messages$6.year),
3928
+ dateMode: formatMessage(messages$5.year),
3840
3929
  label: formatDate(new Date(viewYear, 0), locale, {
3841
3930
  year: 'numeric'
3842
3931
  }),
@@ -3961,7 +4050,7 @@ class YearCalendar extends PureComponent {
3961
4050
  } = this.props;
3962
4051
  return /*#__PURE__*/jsxs(Fragment, {
3963
4052
  children: [/*#__PURE__*/jsx(DateHeader$1, {
3964
- dateMode: formatMessage(messages$6.twentyYears),
4053
+ dateMode: formatMessage(messages$5.twentyYears),
3965
4054
  onPreviousClick: this.selectPreviousYears,
3966
4055
  onNextClick: this.selectNextYears
3967
4056
  }), /*#__PURE__*/jsx(YearCalendarTable$1, {
@@ -4008,7 +4097,8 @@ class DateLookup extends PureComponent {
4008
4097
  viewMonth: (props.value || new Date()).getMonth(),
4009
4098
  viewYear: (props.value || new Date()).getFullYear(),
4010
4099
  open: false,
4011
- mode: MODE.DAY
4100
+ mode: MODE.DAY,
4101
+ isMobile: false
4012
4102
  };
4013
4103
  }
4014
4104
  static getDerivedStateFromProps(props, state) {
@@ -4043,6 +4133,10 @@ class DateLookup extends PureComponent {
4043
4133
  if (+this.props.value !== +previousProps.value && this.state.open) {
4044
4134
  this.focusOn('.active');
4045
4135
  }
4136
+ this.mediaQuery = window.matchMedia(`(max-width: ${Breakpoint.SMALL}px)`);
4137
+ this.setState({
4138
+ isMobile: this.mediaQuery.matches
4139
+ });
4046
4140
  }
4047
4141
  componentWillUnmount() {
4048
4142
  // Prevents memory leak by cleaning state.
@@ -4175,14 +4269,17 @@ class DateLookup extends PureComponent {
4175
4269
  max,
4176
4270
  viewMonth,
4177
4271
  viewYear,
4178
- mode
4272
+ mode,
4273
+ isMobile
4179
4274
  } = this.state;
4180
4275
  const {
4181
4276
  placeholder,
4182
4277
  monthFormat
4183
4278
  } = this.props;
4184
4279
  return /*#__PURE__*/jsxs("div", {
4185
- className: "p-a-1",
4280
+ className: classNames({
4281
+ 'p-a-1': !isMobile
4282
+ }),
4186
4283
  children: [mode === MODE.DAY && /*#__PURE__*/jsx(DayCalendar$1, {
4187
4284
  selectedDate,
4188
4285
  min,
@@ -4690,75 +4787,6 @@ function Display({
4690
4787
  });
4691
4788
  }
4692
4789
 
4693
- const Drawer = ({
4694
- children,
4695
- className,
4696
- footerContent,
4697
- headerTitle,
4698
- onClose,
4699
- open,
4700
- position
4701
- }) => {
4702
- logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
4703
- const {
4704
- isMobile
4705
- } = useLayout();
4706
- return /*#__PURE__*/jsx(Dimmer$1, {
4707
- open: open,
4708
- onClose: onClose,
4709
- children: /*#__PURE__*/jsx(SlidingPanel$1, {
4710
- open: open,
4711
- position: isMobile ? Position.BOTTOM : position,
4712
- children: /*#__PURE__*/jsxs("div", {
4713
- className: classNames('np-drawer', className),
4714
- role: "dialog",
4715
- children: [/*#__PURE__*/jsxs("div", {
4716
- className: classNames('np-drawer-header', {
4717
- 'np-drawer-header--withborder': headerTitle
4718
- }),
4719
- children: [headerTitle && /*#__PURE__*/jsx(Title, {
4720
- type: Typography.TITLE_BODY,
4721
- children: headerTitle
4722
- }), /*#__PURE__*/jsx(CloseButton, {
4723
- onClick: onClose
4724
- })]
4725
- }), children && /*#__PURE__*/jsx("div", {
4726
- className: classNames('np-drawer-content'),
4727
- children: children
4728
- }), footerContent && /*#__PURE__*/jsx("div", {
4729
- className: classNames('np-drawer-footer'),
4730
- children: footerContent
4731
- })]
4732
- })
4733
- })
4734
- });
4735
- };
4736
- Drawer.propTypes = {
4737
- /** The content to appear in the drawer body. */
4738
- children: PropTypes.node,
4739
- className: PropTypes.string,
4740
- /** The content to appear in the drawer footer. */
4741
- footerContent: PropTypes.node,
4742
- /** The content to appear in the drawer header. */
4743
- headerTitle: PropTypes.node,
4744
- /** The action to perform on close click. */
4745
- onClose: PropTypes.func,
4746
- /** The status of Drawer either open or not. */
4747
- open: PropTypes.bool,
4748
- /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
4749
- position: PropTypes.oneOf(['left', 'right', 'bottom'])
4750
- };
4751
- Drawer.defaultProps = {
4752
- children: null,
4753
- className: undefined,
4754
- footerContent: null,
4755
- headerTitle: null,
4756
- onClose: null,
4757
- open: false,
4758
- position: Position.RIGHT
4759
- };
4760
- var Drawer$1 = Drawer;
4761
-
4762
4790
  const DropFade = ({
4763
4791
  children,
4764
4792
  show
@@ -5659,7 +5687,7 @@ const Stepper = ({
5659
5687
  });
5660
5688
  };
5661
5689
 
5662
- var messages$5 = defineMessages({
5690
+ var messages$4 = defineMessages({
5663
5691
  back: {
5664
5692
  id: "neptune.FlowNavigation.back"
5665
5693
  }
@@ -5739,7 +5767,7 @@ const FlowNavigation = ({
5739
5767
  className: "m-x-1",
5740
5768
  labels: steps.map(step => step.label),
5741
5769
  activeLabel: activeStep - 1,
5742
- "aria-label": intl.formatMessage(messages$5.back)
5770
+ "aria-label": intl.formatMessage(messages$4.back)
5743
5771
  }),
5744
5772
  onClick: onGoBack
5745
5773
  }) : logo
@@ -5891,13 +5919,14 @@ const Modal = ({
5891
5919
  }) => {
5892
5920
  const checkSpecialClasses = classToCheck => className?.split(' ').includes(classToCheck);
5893
5921
  const {
5894
- isMobile
5922
+ isMobile,
5923
+ isMedium: isTablet
5895
5924
  } = useLayout();
5896
5925
  // These should be replaced with props in breaking change.
5897
5926
  const isCompact = checkSpecialClasses('compact');
5898
5927
  const noDivider = checkSpecialClasses('no-divider');
5899
5928
  const contentReference = useRef(null);
5900
- return isMobile ? /*#__PURE__*/jsx(Drawer$1, {
5929
+ return isMobile || isTablet ? /*#__PURE__*/jsx(Drawer$1, {
5901
5930
  open: open,
5902
5931
  headerTitle: title,
5903
5932
  footerContent: footer,
@@ -6320,16 +6349,6 @@ const SearchInput = /*#__PURE__*/forwardRef(function SearchInput({
6320
6349
  });
6321
6350
  });
6322
6351
 
6323
- function useMedia(query) {
6324
- return useSyncExternalStore(onStoreChange => {
6325
- const mediaQueryList = window.matchMedia(query);
6326
- mediaQueryList.addEventListener('change', onStoreChange);
6327
- return () => {
6328
- mediaQueryList.removeEventListener('change', onStoreChange);
6329
- };
6330
- }, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
6331
- }
6332
-
6333
6352
  function useScreenSize(size) {
6334
6353
  return useMedia(`(min-width: ${size}px)`);
6335
6354
  }
@@ -6354,12 +6373,6 @@ function wrapInFragment(value) {
6354
6373
  });
6355
6374
  }
6356
6375
 
6357
- var messages$4 = defineMessages({
6358
- noResultsFound: {
6359
- id: "neptune.SelectInput.noResultsFound"
6360
- }
6361
- });
6362
-
6363
6376
  function PreventScroll() {
6364
6377
  usePreventScroll();
6365
6378
  return null;
@@ -6405,29 +6418,29 @@ function BottomSheet({
6405
6418
  theme: theme,
6406
6419
  screenMode: screenMode,
6407
6420
  isNotRootProvider: true,
6408
- children: /*#__PURE__*/jsx(Transition, {
6421
+ children: /*#__PURE__*/jsxs(Transition, {
6409
6422
  show: open,
6410
6423
  className: "np-bottom-sheet-v2-container",
6411
6424
  beforeEnter: () => {
6412
6425
  setFloatingKey(prev => prev + 1);
6413
6426
  },
6414
- children: /*#__PURE__*/jsxs(FocusBoundary, {
6415
- children: [/*#__PURE__*/jsx(Transition.Child, {
6416
- enter: "np-bottom-sheet-v2-backdrop-container--enter",
6417
- enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
6418
- leave: "np-bottom-sheet-v2-backdrop-container--leave",
6419
- leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
6420
- children: /*#__PURE__*/jsx("div", {
6421
- className: "np-bottom-sheet-v2-backdrop"
6422
- })
6423
- }), /*#__PURE__*/jsx("div", {
6424
- className: "np-bottom-sheet-v2",
6425
- children: /*#__PURE__*/jsx(Transition.Child, {
6426
- className: "np-bottom-sheet-v2-content",
6427
- enter: "np-bottom-sheet-v2-content--enter",
6428
- enterFrom: "np-bottom-sheet-v2-content--enter-from",
6429
- leave: "np-bottom-sheet-v2-content--leave",
6430
- leaveTo: "np-bottom-sheet-v2-content--leave-to",
6427
+ children: [/*#__PURE__*/jsx(Transition.Child, {
6428
+ enter: "np-bottom-sheet-v2-backdrop-container--enter",
6429
+ enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
6430
+ leave: "np-bottom-sheet-v2-backdrop-container--leave",
6431
+ leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
6432
+ children: /*#__PURE__*/jsx("div", {
6433
+ className: "np-bottom-sheet-v2-backdrop"
6434
+ })
6435
+ }), /*#__PURE__*/jsx("div", {
6436
+ className: "np-bottom-sheet-v2",
6437
+ children: /*#__PURE__*/jsx(Transition.Child, {
6438
+ className: "np-bottom-sheet-v2-content",
6439
+ enter: "np-bottom-sheet-v2-content--enter",
6440
+ enterFrom: "np-bottom-sheet-v2-content--enter-from",
6441
+ leave: "np-bottom-sheet-v2-content--leave",
6442
+ leaveTo: "np-bottom-sheet-v2-content--leave-to",
6443
+ children: /*#__PURE__*/jsx(FocusBoundary, {
6431
6444
  children: /*#__PURE__*/jsx(FloatingFocusManager, {
6432
6445
  context: context,
6433
6446
  initialFocus: initialFocusRef,
@@ -6461,8 +6474,8 @@ function BottomSheet({
6461
6474
  }, floatingKey)
6462
6475
  })
6463
6476
  })
6464
- })]
6465
- })
6477
+ })
6478
+ })]
6466
6479
  })
6467
6480
  })
6468
6481
  })]
@@ -6613,14 +6626,14 @@ function useSelectInputItemCheckPadding() {
6613
6626
  const SelectInputTriggerButtonPropsContext = /*#__PURE__*/createContext({});
6614
6627
  const SelectInputOptionContentWithinTriggerContext = /*#__PURE__*/createContext(false);
6615
6628
  function dedupeSelectInputOptionItem(item, existingValues) {
6616
- if (!existingValues.has(item.value)) {
6617
- existingValues.add(item.value);
6618
- return item;
6629
+ if (existingValues.has(item.value)) {
6630
+ return {
6631
+ ...item,
6632
+ value: undefined
6633
+ };
6619
6634
  }
6620
- return {
6621
- ...item,
6622
- value: undefined
6623
- };
6635
+ existingValues.add(item.value);
6636
+ return item;
6624
6637
  }
6625
6638
  function dedupeSelectInputItems(items) {
6626
6639
  const existingValues = new Set();
@@ -6641,24 +6654,6 @@ function dedupeSelectInputItems(items) {
6641
6654
  return item;
6642
6655
  });
6643
6656
  }
6644
- function filterSelectInputOptionItem(item, needle) {
6645
- return inferSearchableStrings(item.filterMatchers ?? item.value).some(haystack => haystack.includes(needle));
6646
- }
6647
- function filterSelectInputItems(items, needle) {
6648
- return items.filter(item => {
6649
- switch (item.type) {
6650
- case 'option':
6651
- {
6652
- return filterSelectInputOptionItem(item, needle);
6653
- }
6654
- case 'group':
6655
- {
6656
- return item.options.some(option => filterSelectInputOptionItem(option, needle));
6657
- }
6658
- }
6659
- return false;
6660
- });
6661
- }
6662
6657
  const defaultRenderTrigger = ({
6663
6658
  content,
6664
6659
  placeholderShown,
@@ -6706,7 +6701,7 @@ function SelectInputClearButton({
6706
6701
  const intl = useIntl();
6707
6702
  return /*#__PURE__*/jsx("button", {
6708
6703
  type: "button",
6709
- "aria-label": intl.formatMessage(dateTriggerMessages.ariaLabel),
6704
+ "aria-label": intl.formatMessage(messages$6.ariaLabel),
6710
6705
  className: classNames(className, 'np-select-input-addon np-select-input-addon--interactive'),
6711
6706
  onClick: onClick,
6712
6707
  children: /*#__PURE__*/jsx(Cross, {
@@ -6847,14 +6842,9 @@ const SelectInputOptionsContainer = /*#__PURE__*/forwardRef(function SelectInput
6847
6842
  ref: ref,
6848
6843
  onKeyDown: event => {
6849
6844
  // Prevent absorbing dismissal requests too early
6850
- if (event.key === 'Escape') {
6851
- return;
6852
- }
6853
- // Prevent confirmation close without an active item
6854
- if (event.key === 'Enter' && ariaActiveDescendant == null) {
6855
- return;
6845
+ if (event.key !== 'Escape') {
6846
+ onKeyDown?.(event);
6856
6847
  }
6857
- onKeyDown?.(event);
6858
6848
  },
6859
6849
  ...restProps
6860
6850
  })
@@ -6868,8 +6858,6 @@ function SelectInputOptions({
6868
6858
  searchInputRef,
6869
6859
  listboxRef
6870
6860
  }) {
6871
- const intl = useIntl();
6872
- const controllerRef = filterable ? searchInputRef : listboxRef;
6873
6861
  const [query, setQuery] = useState('');
6874
6862
  const needle = useMemo(() => {
6875
6863
  if (filterable) {
@@ -6877,16 +6865,14 @@ function SelectInputOptions({
6877
6865
  }
6878
6866
  return undefined;
6879
6867
  }, [filterable, query]);
6880
- const empty = needle != null && filterSelectInputItems(items, needle).length === 0;
6881
6868
  const listboxContainerRef = useRef(null);
6882
6869
  useEffect(() => {
6883
6870
  if (listboxContainerRef.current != null) {
6884
6871
  listboxContainerRef.current.style.setProperty('--initial-height', `${listboxContainerRef.current.offsetHeight}px`);
6885
6872
  }
6886
6873
  }, []);
6887
- const showStatus = empty;
6888
- const statusId = useId();
6889
6874
  const listboxId = useId();
6875
+ const controllerRef = filterable ? searchInputRef : listboxRef;
6890
6876
  return /*#__PURE__*/jsxs(Listbox.Options, {
6891
6877
  as: SelectInputOptionsContainer,
6892
6878
  static: true,
@@ -6908,7 +6894,6 @@ function SelectInputOptions({
6908
6894
  placeholder: filterPlaceholder,
6909
6895
  value: query,
6910
6896
  "aria-controls": listboxId,
6911
- "aria-describedby": showStatus ? statusId : undefined,
6912
6897
  onKeyDown: event => {
6913
6898
  // Prevent interfering with the matcher of Headless UI
6914
6899
  // https://mathiasbynens.be/notes/javascript-unicode#regex
@@ -6920,31 +6905,24 @@ function SelectInputOptions({
6920
6905
  setQuery(event.currentTarget.value);
6921
6906
  }
6922
6907
  })
6923
- }) : null, /*#__PURE__*/jsxs("div", {
6908
+ }) : null, /*#__PURE__*/jsx("div", {
6924
6909
  ref: listboxContainerRef,
6925
6910
  className: classNames('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
6926
- children: [empty ? /*#__PURE__*/jsxs("div", {
6927
- id: statusId,
6928
- className: "np-select-input-options-status",
6929
- children: [/*#__PURE__*/jsx(CrossCircle, {
6930
- size: 16,
6931
- className: "np-select-input-options-status-icon"
6932
- }), intl.formatMessage(messages$4.noResultsFound)]
6933
- }) : null, /*#__PURE__*/jsx("div", {
6911
+ children: /*#__PURE__*/jsx("div", {
6934
6912
  ref: listboxRef,
6935
6913
  id: listboxId,
6936
6914
  role: "listbox",
6937
6915
  "aria-orientation": "vertical",
6938
6916
  tabIndex: 0,
6939
6917
  className: "np-select-input-listbox",
6940
- children: (needle != null ? dedupeSelectInputItems(items) : items).map((item, index) => /*#__PURE__*/jsx(SelectInputItemView
6918
+ children: (needle == null ? items : dedupeSelectInputItems(items)).map((item, index) => /*#__PURE__*/jsx(SelectInputItemView
6941
6919
  // eslint-disable-next-line react/no-array-index-key
6942
6920
  , {
6943
6921
  item: item,
6944
6922
  renderValue: renderValue,
6945
6923
  needle: needle
6946
6924
  }, index))
6947
- })]
6925
+ })
6948
6926
  })]
6949
6927
  });
6950
6928
  }
@@ -6956,7 +6934,7 @@ function SelectInputItemView({
6956
6934
  switch (item.type) {
6957
6935
  case 'option':
6958
6936
  {
6959
- if (item.value != null && (needle == null || filterSelectInputOptionItem(item, needle))) {
6937
+ if (item.value != null && (!needle || inferSearchableStrings(item.filterMatchers ?? item.value).some(haystack => haystack.includes(needle)))) {
6960
6938
  return /*#__PURE__*/jsx(SelectInputOption, {
6961
6939
  value: item.value,
6962
6940
  disabled: item.disabled,
@@ -10731,7 +10709,6 @@ var en = {
10731
10709
  "neptune.Link.opensInNewTab": "(opens in new tab)",
10732
10710
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
10733
10711
  "neptune.Select.searchPlaceholder": "Search...",
10734
- "neptune.SelectInput.noResultsFound": "No results found",
10735
10712
  "neptune.Summary.statusDone": "Item done",
10736
10713
  "neptune.Summary.statusNotDone": "Item to do",
10737
10714
  "neptune.Summary.statusPending": "Item pending",