@transferwise/components 0.0.0-experimental-adfacd1 → 0.0.0-experimental-b5cc5ec

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 (41) hide show
  1. package/build/index.esm.js +36 -36
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +36 -36
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +1 -1
  6. package/build/styles/flowNavigation/FlowNavigation.css +1 -1
  7. package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
  8. package/build/styles/main.css +1 -1
  9. package/build/styles/overlayHeader/OverlayHeader.css +1 -1
  10. package/build/types/common/flowHeader/FlowHeader.d.ts.map +1 -1
  11. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  12. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +2 -1
  13. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
  14. package/build/types/flowNavigation/backButton/BackButton.d.ts +11 -10
  15. package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
  16. package/build/types/logo/Logo.d.ts.map +1 -1
  17. package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/src/common/flowHeader/FlowHeader.tsx +3 -9
  20. package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +2 -2
  21. package/src/flowNavigation/FlowNavigation.css +1 -1
  22. package/src/flowNavigation/FlowNavigation.less +9 -0
  23. package/src/flowNavigation/FlowNavigation.spec.js +3 -3
  24. package/src/flowNavigation/FlowNavigation.story.js +183 -24
  25. package/src/flowNavigation/FlowNavigation.tsx +13 -9
  26. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +11 -14
  27. package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
  28. package/src/flowNavigation/animatedLabel/AnimatedLabel.less +6 -0
  29. package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +21 -7
  30. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +17 -8
  31. package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
  32. package/src/flowNavigation/backButton/BackButton.js +9 -14
  33. package/src/flowNavigation/backButton/BackButton.spec.js +2 -3
  34. package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +21 -28
  35. package/src/logo/Logo.js +5 -0
  36. package/src/main.css +1 -1
  37. package/src/overlayHeader/OverlayHeader.css +1 -1
  38. package/src/overlayHeader/OverlayHeader.js +2 -4
  39. package/src/overlayHeader/OverlayHeader.less +8 -0
  40. package/src/overlayHeader/OverlayHeader.spec.js +1 -1
  41. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +3 -3
@@ -5398,7 +5398,7 @@ const FlowHeader = /*#__PURE__*/React.forwardRef(({
5398
5398
  ref: reference,
5399
5399
  className: classNames('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', className),
5400
5400
  children: [/*#__PURE__*/jsx("div", {
5401
- className: classNames('np-flow-header__left', 'd-flex', 'align-items-center', 'justify-content-between', {
5401
+ className: classNames('np-flow-header__left', {
5402
5402
  'flex__item--8': isVertical
5403
5403
  }),
5404
5404
  children: leftContent
@@ -5503,6 +5503,11 @@ const Logo = ({
5503
5503
  });
5504
5504
  const isSmall = clientWidth < Breakpoint.SMALL;
5505
5505
  const LogoSvg = isSmall ? svgPaths[`WISE_FLAG${inverse ? '_INVERSE' : ''}`] : svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5506
+
5507
+ // If clientWidth is not defined, don't render anything
5508
+ if (clientWidth === null) {
5509
+ return null;
5510
+ }
5506
5511
  return /*#__PURE__*/jsx(LogoSvg, {
5507
5512
  className: classNames('np-logo-svg', className),
5508
5513
  alt: type === LogoType.WISE ? 'Wise' : 'Wise business'
@@ -5706,16 +5711,19 @@ var messages$5 = defineMessages({
5706
5711
  const AnimatedLabel = ({
5707
5712
  activeLabel,
5708
5713
  className,
5709
- labels
5714
+ labels,
5715
+ 'aria-label': ariaLabel
5710
5716
  }) => {
5711
- return /*#__PURE__*/jsx(Body, {
5712
- type: Typography.BODY_LARGE_BOLD,
5713
- className: classNames('np-animated-label', className),
5717
+ const numberLabels = labels.length - 1;
5718
+ return /*#__PURE__*/jsx("div", {
5719
+ "aria-label": ariaLabel,
5720
+ className: classNames('np-animated-label', 'np-text-body-large-bold', className),
5714
5721
  children: labels.map((label, index) => {
5715
5722
  const nextLabel = index - 1;
5716
5723
  return /*#__PURE__*/jsx("div", {
5717
- className: classNames('text-xs-center', {
5718
- 'np-animated-label--in text-ellipsis': index === activeLabel
5724
+ className: classNames('text-xs-left', {
5725
+ 'np-animated-label--in': index === activeLabel,
5726
+ 'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels
5719
5727
  }),
5720
5728
  children: label
5721
5729
  }, nextLabel);
@@ -5724,24 +5732,18 @@ const AnimatedLabel = ({
5724
5732
  };
5725
5733
 
5726
5734
  const BackButton = ({
5735
+ label,
5727
5736
  className,
5728
- onClick,
5729
- 'aria-label': ariaLabel
5730
- }) => /*#__PURE__*/jsx(Avatar, {
5731
- type: AvatarType.ICON,
5732
- size: 40,
5733
- children: /*#__PURE__*/jsx("button", {
5734
- type: "button",
5735
- "aria-label": ariaLabel,
5736
- className: classNames('np-back-button', 'btn-unstyled', className),
5737
- onClick: onClick,
5738
- children: /*#__PURE__*/jsx(ArrowLeft, {
5739
- size: 24
5740
- })
5741
- })
5737
+ onClick
5738
+ }) => /*#__PURE__*/jsxs("button", {
5739
+ type: "button",
5740
+ className: classNames('np-back-button', 'align-items-center', 'btn-unstyled', className),
5741
+ onClick: onClick,
5742
+ children: [/*#__PURE__*/jsx(ArrowLeft, {
5743
+ size: 24
5744
+ }), label]
5742
5745
  });
5743
5746
  BackButton.propTypes = {
5744
- 'aria-label': PropTypes.string.isRequired,
5745
5747
  className: PropTypes.string,
5746
5748
  label: PropTypes.element,
5747
5749
  onClick: PropTypes.func
@@ -5774,17 +5776,16 @@ const FlowNavigation = ({
5774
5776
  const newAvatar = done ? null : avatar;
5775
5777
  const getLeftContentSmall = () => {
5776
5778
  const displayGoBack = onGoBack != null && activeStep > 0;
5777
- return /*#__PURE__*/jsxs(Fragment, {
5778
- children: [displayGoBack ? /*#__PURE__*/jsx(BackButton$1, {
5779
- "aria-label": intl.formatMessage(messages$5.back),
5779
+ return /*#__PURE__*/jsx(Fragment, {
5780
+ children: displayGoBack ? /*#__PURE__*/jsx(BackButton$1, {
5781
+ label: /*#__PURE__*/jsx(AnimatedLabel, {
5782
+ className: "m-x-1",
5783
+ labels: steps.map(step => step.label),
5784
+ activeLabel: activeStep - 1,
5785
+ "aria-label": intl.formatMessage(messages$5.back)
5786
+ }),
5780
5787
  onClick: onGoBack
5781
- }) : logo, /*#__PURE__*/jsx(AnimatedLabel, {
5782
- className: "m-x-1",
5783
- labels: steps.map(step => step.label),
5784
- activeLabel: activeStep
5785
- }), /*#__PURE__*/jsx("span", {
5786
- className: "m-x-1"
5787
- })]
5788
+ }) : logo
5788
5789
  });
5789
5790
  };
5790
5791
  return /*#__PURE__*/jsx("div", {
@@ -5793,7 +5794,7 @@ const FlowNavigation = ({
5793
5794
  'np-flow-navigation--border-bottom': !done
5794
5795
  }),
5795
5796
  children: /*#__PURE__*/jsx(FlowHeader, {
5796
- className: classNames('np-flow-navigation__content', isSmall ? 'p-x-2' : 'p-x-3', {
5797
+ className: classNames('np-flow-navigation__content p-x-3', {
5797
5798
  'np-flow-navigation--hidden': !clientWidth,
5798
5799
  'np-flow-navigation--xs-max': isSmall,
5799
5800
  // Size switches on parent container which may or may not have the same size as the window.
@@ -5803,7 +5804,7 @@ const FlowNavigation = ({
5803
5804
  leftContent: isSmall ? getLeftContentSmall() : logo,
5804
5805
  rightContent: /*#__PURE__*/jsxs(Fragment, {
5805
5806
  children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsx("span", {
5806
- className: "m-x-1"
5807
+ className: "separator"
5807
5808
  }), closeButton]
5808
5809
  }),
5809
5810
  bottomContent: !done && /*#__PURE__*/jsx(Stepper, {
@@ -8816,7 +8817,6 @@ const OverlayHeader = ({
8816
8817
  logo
8817
8818
  }) => {
8818
8819
  const closeButton = onClose && /*#__PURE__*/jsx(CloseButton, {
8819
- size: Size.LARGE,
8820
8820
  onClick: onClose
8821
8821
  });
8822
8822
  return /*#__PURE__*/jsx("div", {
@@ -8826,7 +8826,7 @@ const OverlayHeader = ({
8826
8826
  leftContent: logo,
8827
8827
  rightContent: /*#__PURE__*/jsxs(Fragment, {
8828
8828
  children: [avatar, avatar && closeButton && /*#__PURE__*/jsx("span", {
8829
- className: classNames('m-x-1')
8829
+ className: "separator"
8830
8830
  }), closeButton]
8831
8831
  })
8832
8832
  })