@transferwise/components 46.29.0 → 46.29.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.
@@ -35,7 +35,7 @@
35
35
  "neptune.Upload.psProcessingText": "Feltöltés...",
36
36
  "neptune.Upload.usButtonText": "Vagy válaszd ki a fájlt",
37
37
  "neptune.Upload.usDropMessage": "Húzd ide a fájlokat a feltöltéshez",
38
- "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize} MB méretű fájlt",
38
+ "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}MB méretű fájlt",
39
39
  "neptune.UploadButton.allFileTypes": "Összes fájltípus",
40
40
  "neptune.UploadButton.dropFiles": "Húzd a fájlokat ide a feltöltéshez",
41
41
  "neptune.UploadButton.instructions": "{fileTypes}, legfeljebb {size}MB",
package/build/index.js CHANGED
@@ -20,7 +20,6 @@ var reactTransitionGroup = require('react-transition-group');
20
20
  var neptuneValidation = require('@transferwise/neptune-validation');
21
21
  var reactDom = require('react-dom');
22
22
  var reactPopper = require('react-popper');
23
- var throttle = require('lodash.throttle');
24
23
  var art = require('@wise/art');
25
24
  var clamp$2 = require('lodash.clamp');
26
25
  var debounce = require('lodash.debounce');
@@ -52,7 +51,6 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
52
51
  var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
53
52
  var commonmark__default = /*#__PURE__*/_interopDefault(commonmark);
54
53
  var mergeProps__default = /*#__PURE__*/_interopDefault(mergeProps);
55
- var throttle__default = /*#__PURE__*/_interopDefault(throttle);
56
54
  var clamp__default = /*#__PURE__*/_interopDefault(clamp$2);
57
55
  var debounce__default = /*#__PURE__*/_interopDefault(debounce);
58
56
  var requiredIf__default = /*#__PURE__*/_interopDefault(requiredIf);
@@ -1490,41 +1488,6 @@ const DimmerContentWrapper = ({
1490
1488
  };
1491
1489
  var Dimmer$1 = withNextPortalWrapper(Dimmer);
1492
1490
 
1493
- const THROTTLE_MS = 100;
1494
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1495
- const useClientWidth = ({
1496
- ref,
1497
- throttleMs = THROTTLE_MS
1498
- }) => {
1499
- const [clientWidth, setClientWidth] = React.useState(null);
1500
- useIsomorphicLayoutEffect(() => {
1501
- // eslint-disable-next-line unicorn/consistent-function-scoping
1502
- const updateClientWidth = () => {
1503
- if (ref) {
1504
- // when `ref` is a window
1505
- if ('innerWidth' in ref) {
1506
- setClientWidth(ref.innerWidth);
1507
- }
1508
- // when `ref` is an element
1509
- else if (ref.current) {
1510
- setClientWidth(ref.current.clientWidth);
1511
- }
1512
- }
1513
- };
1514
- // This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
1515
- // If throttle gets passed directly to both add and removeEventListenet the results will be that the event
1516
- // won't get removed even if the component is unmounted.
1517
- const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
1518
- window.addEventListener('resize', attachedFunction, true);
1519
- // using requestAnimationFrame to perform the calculation before the next repaint
1520
- // getting width earlier causes issues in animations when used with react-transition-group
1521
- window.requestAnimationFrame(updateClientWidth);
1522
- return () => window.removeEventListener('resize', attachedFunction, true);
1523
- }, []);
1524
- return [clientWidth];
1525
- };
1526
- useClientWidth.THROTTLE_MS = THROTTLE_MS;
1527
-
1528
1491
  const useConditionalListener = ({
1529
1492
  attachListener,
1530
1493
  callback,
@@ -4845,49 +4808,41 @@ const FlowNavigation = ({
4845
4808
  onGoBack,
4846
4809
  steps
4847
4810
  }) => {
4848
- const reference = React.useRef(null);
4849
4811
  const intl = reactIntl.useIntl();
4850
- const [clientWidth] = useClientWidth({
4851
- ref: reference
4852
- });
4853
4812
  const closeButton = onClose != null && /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
4854
4813
  size: "lg",
4855
4814
  onClick: onClose
4856
4815
  });
4857
- const isSmall = clientWidth != null && clientWidth < exports.Breakpoint.SMALL;
4858
- const isLarge = clientWidth != null && clientWidth >= exports.Breakpoint.LARGE;
4816
+ const screenSm = useScreenSize(exports.Breakpoint.SMALL);
4817
+ const screenLg = useScreenSize(exports.Breakpoint.LARGE);
4859
4818
  const newAvatar = done ? null : avatar;
4860
4819
  const displayGoBack = onGoBack != null && activeStep > 0;
4861
4820
  return /*#__PURE__*/jsxRuntime.jsx("div", {
4862
- ref: reference,
4863
4821
  className: classNames__default.default('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
4864
4822
  'np-flow-navigation--border-bottom': !done
4865
4823
  }),
4866
4824
  children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader, {
4867
- className: classNames__default.default('np-flow-navigation__content p-x-3', {
4868
- 'np-flow-navigation--hidden': !clientWidth,
4869
- 'np-flow-navigation--xs-max': isSmall,
4825
+ className: classNames__default.default('np-flow-navigation__content p-x-3', screenSm == null ? 'np-flow-navigation--hidden' : {
4826
+ 'np-flow-navigation--xs-max': !screenSm,
4870
4827
  // Size switches on parent container which may or may not have the same size as the window.
4871
- 'np-flow-navigation--sm': clientWidth != null && clientWidth >= exports.Breakpoint.SMALL,
4872
- 'np-flow-navigation--lg': isLarge
4828
+ 'np-flow-navigation--sm': screenSm,
4829
+ 'np-flow-navigation--lg': screenLg
4873
4830
  }),
4874
4831
  leftContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
4875
- children: [isSmall && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
4832
+ children: [!screenSm && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
4876
4833
  "aria-label": intl.formatMessage(messages$7.back),
4877
4834
  onClick: onGoBack
4878
4835
  }) : /*#__PURE__*/jsxRuntime.jsx("div", {
4879
4836
  className: "np-flow-header__left",
4880
4837
  children: logo
4881
- }), isSmall && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
4838
+ }), !screenSm && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
4882
4839
  className: "m-x-1",
4883
4840
  labels: steps.map(step => step.label),
4884
4841
  activeLabel: activeStep
4885
4842
  })]
4886
4843
  }),
4887
4844
  rightContent: /*#__PURE__*/jsxRuntime.jsxs("div", {
4888
- className: classNames__default.default('np-flow-header__right', 'd-flex', 'align-items-center', 'justify-content-end', {
4889
- 'order-2': isLarge
4890
- }),
4845
+ className: "np-flow-header__right d-flex align-items-center justify-content-end order-2--lg",
4891
4846
  children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
4892
4847
  className: "m-x-1"
4893
4848
  }), closeButton]
@@ -4897,7 +4852,7 @@ const FlowNavigation = ({
4897
4852
  steps: steps,
4898
4853
  className: classNames__default.default('np-flow-navigation__stepper')
4899
4854
  }),
4900
- layout: clientWidth != null && clientWidth < exports.Breakpoint.LARGE ? exports.Layout.VERTICAL : exports.Layout.HORIZONTAL
4855
+ layout: !screenLg ? exports.Layout.VERTICAL : exports.Layout.HORIZONTAL
4901
4856
  })
4902
4857
  });
4903
4858
  };
@@ -13631,7 +13586,7 @@ var hu = {
13631
13586
  "neptune.Upload.psProcessingText": "Feltöltés...",
13632
13587
  "neptune.Upload.usButtonText": "Vagy válaszd ki a fájlt",
13633
13588
  "neptune.Upload.usDropMessage": "Húzd ide a fájlokat a feltöltéshez",
13634
- "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize} MB méretű fájlt",
13589
+ "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}MB méretű fájlt",
13635
13590
  "neptune.UploadButton.allFileTypes": "Összes fájltípus",
13636
13591
  "neptune.UploadButton.dropFiles": "Húzd a fájlokat ide a feltöltéshez",
13637
13592
  "neptune.UploadButton.instructions": "{fileTypes}, legfeljebb {size}MB",