@transferwise/components 0.0.0-experimental-c9cdfe3 → 0.0.0-experimental-79c0fba

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 (42) hide show
  1. package/README.md +1 -1
  2. package/build/index.esm.js +49 -75
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +50 -76
  5. package/build/index.js.map +1 -1
  6. package/build/mocks.esm.js +33 -27
  7. package/build/mocks.esm.js.map +1 -1
  8. package/build/mocks.js +33 -27
  9. package/build/mocks.js.map +1 -1
  10. package/build/types/circularButton/CircularButton.d.ts +2 -2
  11. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  12. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  13. package/build/types/index.d.ts +2 -0
  14. package/build/types/index.d.ts.map +1 -1
  15. package/build/types/slidingPanel/SlidingPanel.d.ts +12 -17
  16. package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
  17. package/build/types/slidingPanel/index.d.ts +2 -1
  18. package/build/types/slidingPanel/index.d.ts.map +1 -1
  19. package/build/types/sticky/Sticky.d.ts +9 -14
  20. package/build/types/sticky/Sticky.d.ts.map +1 -1
  21. package/build/types/sticky/index.d.ts +2 -1
  22. package/build/types/sticky/index.d.ts.map +1 -1
  23. package/package.json +17 -1
  24. package/src/circularButton/CircularButton.tsx +2 -2
  25. package/src/common/bottomSheet/BottomSheet.tsx +47 -41
  26. package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +37 -33
  27. package/src/index.ts +2 -0
  28. package/src/select/Select.spec.js +1 -1
  29. package/src/slidingPanel/SlidingPanel.spec.js +9 -19
  30. package/src/slidingPanel/SlidingPanel.tsx +62 -0
  31. package/src/slidingPanel/index.ts +2 -0
  32. package/src/sticky/Sticky.spec.js +0 -1
  33. package/src/sticky/{Sticky.story.js → Sticky.story.tsx} +2 -3
  34. package/src/sticky/Sticky.tsx +16 -0
  35. package/src/sticky/index.ts +2 -0
  36. package/build/mocks.d.ts +0 -9
  37. package/build/mocks.d.ts.map +0 -1
  38. package/src/slidingPanel/SlidingPanel.js +0 -73
  39. package/src/slidingPanel/index.js +0 -1
  40. package/src/sticky/Sticky.js +0 -23
  41. package/src/sticky/index.js +0 -1
  42. /package/src/slidingPanel/{SlidingPanel.story.js → SlidingPanel.story.tsx} +0 -0
package/build/index.js CHANGED
@@ -1786,15 +1786,14 @@ const useLayout = () => {
1786
1786
 
1787
1787
  const EXIT_ANIMATION = 350;
1788
1788
  const SlidingPanel = /*#__PURE__*/React.forwardRef(({
1789
- children,
1790
- className,
1789
+ position = 'left',
1791
1790
  open,
1792
- position,
1793
1791
  showSlidingPanelBorder,
1794
1792
  slidingPanelPositionFixed,
1793
+ className,
1794
+ children,
1795
1795
  ...rest
1796
1796
  }, reference) => {
1797
- /** @type {RefObject<HTMLDivElement>} */
1798
1797
  const localReference = React.useRef(null);
1799
1798
  return /*#__PURE__*/React.createElement(reactTransitionGroup.CSSTransition, {
1800
1799
  ...rest,
@@ -1807,34 +1806,15 @@ const SlidingPanel = /*#__PURE__*/React.forwardRef(({
1807
1806
  enter: 0,
1808
1807
  exit: EXIT_ANIMATION
1809
1808
  },
1810
- classNames: classNames__default.default(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
1811
- 'sliding-panel--fixed': slidingPanelPositionFixed
1812
- }, 'sliding-panel'),
1809
+ classNames: "sliding-panel",
1813
1810
  appear: true,
1814
1811
  unmountOnExit: true
1815
1812
  }, /*#__PURE__*/jsxRuntime.jsx("div", {
1816
1813
  ref: mergeRefs__default.default([reference, localReference]),
1817
- className: classNames__default.default('sliding-panel', `sliding-panel--open-${position}`, className),
1814
+ className: classNames__default.default('sliding-panel', `sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, slidingPanelPositionFixed && 'sliding-panel--fixed', className),
1818
1815
  children: children
1819
1816
  }));
1820
1817
  });
1821
- SlidingPanel.propTypes = {
1822
- children: PropTypes__default.default.node,
1823
- className: PropTypes__default.default.string,
1824
- open: PropTypes__default.default.bool,
1825
- position: PropTypes__default.default.oneOf(['top', 'bottom', 'left', 'right']),
1826
- showSlidingPanelBorder: PropTypes__default.default.bool,
1827
- slidingPanelPositionFixed: PropTypes__default.default.bool
1828
- };
1829
- SlidingPanel.defaultProps = {
1830
- children: null,
1831
- className: undefined,
1832
- open: false,
1833
- position: 'left',
1834
- showSlidingPanelBorder: false,
1835
- slidingPanelPositionFixed: false
1836
- };
1837
- var SlidingPanel$1 = SlidingPanel;
1838
1818
 
1839
1819
  const Drawer = ({
1840
1820
  children,
@@ -1853,7 +1833,7 @@ const Drawer = ({
1853
1833
  return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
1854
1834
  open: open,
1855
1835
  onClose: onClose,
1856
- children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel$1, {
1836
+ children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel, {
1857
1837
  open: open,
1858
1838
  position: isMobile ? exports.Position.BOTTOM : position,
1859
1839
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -1970,15 +1950,15 @@ const BottomSheet$1 = props => {
1970
1950
  props.onClose(event);
1971
1951
  }
1972
1952
  }
1973
- const onSwipeStart = isMobile => event => {
1974
- initialYCoordinate.current = (isMobile ? event.touches[0] : event).clientY;
1953
+ const onSwipeStart = event => {
1954
+ initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;
1975
1955
  setPressed(true);
1976
1956
  };
1977
- const onSwipeMove = isMobile => event => {
1957
+ const onSwipeMove = event => {
1978
1958
  if (pressed) {
1979
1959
  const {
1980
1960
  clientY
1981
- } = isMobile ? event.touches[0] : event;
1961
+ } = 'touches' in event ? event.touches[0] : event;
1982
1962
  const offset = calculateOffsetAfterMove(clientY);
1983
1963
  // check whether move is to the bottom only and content scroll position is at the top
1984
1964
  if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {
@@ -2047,34 +2027,37 @@ const BottomSheet$1 = props => {
2047
2027
  fadeContentOnEnter: true,
2048
2028
  fadeContentOnExit: true,
2049
2029
  onClose: close,
2050
- children: /*#__PURE__*/jsxRuntime.jsxs(SlidingPanel$1, {
2030
+ children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel, {
2051
2031
  ref: bottomSheetReference,
2052
2032
  open: props.open,
2053
2033
  position: exports.Position.BOTTOM,
2054
2034
  className: classNames__default.default('np-bottom-sheet', props.className),
2055
- role: "dialog",
2056
- onTouchStart: onSwipeStart(true),
2057
- onTouchMove: onSwipeMove(true),
2058
- onTouchEnd: onSwipeEnd,
2059
- onMouseDown: onSwipeStart(false),
2060
- onMouseMove: onSwipeMove(false),
2061
- onMouseUp: onSwipeEnd,
2062
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2063
- ref: topBarReference,
2064
- className: "np-bottom-sheet--top-bar",
2065
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2066
- className: "np-bottom-sheet--handler"
2067
- }), /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
2068
- size: "sm",
2069
- className: "sr-only np-bottom-sheet--close-btn",
2070
- onClick: close
2035
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
2036
+ role: "dialog",
2037
+ "aria-modal": true,
2038
+ onTouchStart: onSwipeStart,
2039
+ onTouchMove: onSwipeMove,
2040
+ onTouchEnd: onSwipeEnd,
2041
+ onMouseDown: onSwipeStart,
2042
+ onMouseMove: onSwipeMove,
2043
+ onMouseUp: onSwipeEnd,
2044
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2045
+ ref: topBarReference,
2046
+ className: "np-bottom-sheet--top-bar",
2047
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2048
+ className: "np-bottom-sheet--handler"
2049
+ }), /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
2050
+ size: "sm",
2051
+ className: "sr-only np-bottom-sheet--close-btn",
2052
+ onClick: close
2053
+ })]
2054
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2055
+ ref: contentReference,
2056
+ style: setContentMaxHeight(),
2057
+ className: "np-bottom-sheet--content",
2058
+ children: props.children
2071
2059
  })]
2072
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
2073
- ref: contentReference,
2074
- style: setContentMaxHeight(),
2075
- className: "np-bottom-sheet--content",
2076
- children: props.children
2077
- })]
2060
+ })
2078
2061
  })
2079
2062
  });
2080
2063
  };
@@ -10975,28 +10958,19 @@ function SnackbarProvider({
10975
10958
  });
10976
10959
  }
10977
10960
 
10978
- const Sticky = ({
10979
- open,
10980
- position,
10961
+ function Sticky({
10962
+ open = true,
10963
+ position = 'bottom',
10981
10964
  children
10982
- }) => /*#__PURE__*/jsxRuntime.jsx(SlidingPanel$1, {
10983
- open: open,
10984
- position: position,
10985
- slidingPanelPositionFixed: true,
10986
- showSlidingPanelBorder: true,
10987
- children: children
10988
- });
10989
- Sticky.propTypes = {
10990
- open: PropTypes__default.default.bool,
10991
- position: PropTypes__default.default.oneOf(['top', 'bottom']),
10992
- children: PropTypes__default.default.node
10993
- };
10994
- Sticky.defaultProps = {
10995
- open: true,
10996
- position: 'bottom',
10997
- children: null
10998
- };
10999
- var Sticky$1 = Sticky;
10965
+ }) {
10966
+ return /*#__PURE__*/jsxRuntime.jsx(SlidingPanel, {
10967
+ open: open,
10968
+ position: position,
10969
+ slidingPanelPositionFixed: true,
10970
+ showSlidingPanelBorder: true,
10971
+ children: children
10972
+ });
10973
+ }
11000
10974
 
11001
10975
  var messages$1 = reactIntl.defineMessages({
11002
10976
  statusNotDone: {
@@ -15187,14 +15161,14 @@ exports.Select = Select;
15187
15161
  exports.SelectInput = SelectInput;
15188
15162
  exports.SelectInputOptionContent = SelectInputOptionContent;
15189
15163
  exports.SelectInputTriggerButton = SelectInputTriggerButton;
15190
- exports.SlidingPanel = SlidingPanel$1;
15164
+ exports.SlidingPanel = SlidingPanel;
15191
15165
  exports.SnackbarConsumer = SnackbarConsumer;
15192
15166
  exports.SnackbarContext = SnackbarContext;
15193
15167
  exports.SnackbarPortal = SnackbarPortal;
15194
15168
  exports.SnackbarProvider = SnackbarProvider;
15195
15169
  exports.StatusIcon = StatusIcon;
15196
15170
  exports.Stepper = Stepper;
15197
- exports.Sticky = Sticky$1;
15171
+ exports.Sticky = Sticky;
15198
15172
  exports.Summary = Summary;
15199
15173
  exports.Switch = Switch;
15200
15174
  exports.SwitchOption = SwitchOption;