@transferwise/components 0.0.0-experimental-62f7040 → 0.0.0-experimental-adfacd1

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 (48) hide show
  1. package/build/index.esm.js +47 -37
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +47 -37
  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/inputs/SelectInput.css +1 -1
  9. package/build/styles/main.css +1 -1
  10. package/build/styles/overlayHeader/OverlayHeader.css +1 -1
  11. package/build/types/common/flowHeader/FlowHeader.d.ts.map +1 -1
  12. package/build/types/common/locale/index.d.ts +10 -1
  13. package/build/types/common/locale/index.d.ts.map +1 -1
  14. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  15. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +1 -2
  16. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
  17. package/build/types/flowNavigation/backButton/BackButton.d.ts +10 -11
  18. package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
  19. package/build/types/logo/Logo.d.ts.map +1 -1
  20. package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
  21. package/package.json +4 -4
  22. package/src/common/flowHeader/FlowHeader.tsx +9 -3
  23. package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +2 -2
  24. package/src/common/locale/index.js +10 -1
  25. package/src/flowNavigation/FlowNavigation.css +1 -1
  26. package/src/flowNavigation/FlowNavigation.less +0 -9
  27. package/src/flowNavigation/FlowNavigation.spec.js +3 -3
  28. package/src/flowNavigation/FlowNavigation.story.js +24 -183
  29. package/src/flowNavigation/FlowNavigation.tsx +9 -13
  30. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +14 -11
  31. package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
  32. package/src/flowNavigation/animatedLabel/AnimatedLabel.less +0 -6
  33. package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +7 -21
  34. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +8 -17
  35. package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
  36. package/src/flowNavigation/backButton/BackButton.js +14 -9
  37. package/src/flowNavigation/backButton/BackButton.spec.js +3 -2
  38. package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +28 -21
  39. package/src/inputs/SelectInput.css +1 -1
  40. package/src/inputs/SelectInput.less +1 -1
  41. package/src/inputs/SelectInput.story.tsx +8 -5
  42. package/src/logo/Logo.js +0 -5
  43. package/src/main.css +1 -1
  44. package/src/overlayHeader/OverlayHeader.css +1 -1
  45. package/src/overlayHeader/OverlayHeader.js +4 -2
  46. package/src/overlayHeader/OverlayHeader.less +0 -8
  47. package/src/overlayHeader/OverlayHeader.spec.js +1 -1
  48. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +3 -3
@@ -362,6 +362,11 @@ const DEFAULT_LOCALE = 'en-GB';
362
362
  * @type {string[]}
363
363
  */
364
364
  const RTL_LANGUAGES = ['ar', 'he'];
365
+
366
+ /**
367
+ * @deprecated The source of truth for supported languages lives in Crab.
368
+ * @type {string[]}
369
+ */
365
370
  const SUPPORTED_LANGUAGES = [DEFAULT_LANG, 'de', 'es', 'fr', 'hu', 'id', 'it', 'ja', 'pl', 'pt', 'ro', 'ru', 'th', 'tr', 'uk', 'zh'];
366
371
 
367
372
  /**
@@ -391,8 +396,13 @@ function adjustLocale(locale) {
391
396
  * Provides corresponding lang (iso2) for provided locale
392
397
  * if locale is invalid or language is unsupported returns null
393
398
  *
399
+ * @deprecated The use of this function almost always breaks language variants
400
+ * e.g. Simplified and Traditional Chinese.
401
+ * There should be no use case for this function.
402
+ * To select the correct translations from a translations object, pass the
403
+ * locale directly into Crab's getLocalisedMessages.
394
404
  * @param {string} locale (`es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP` etc)
395
- * @returns {string|null}
405
+ * @returns {string|null} two-letter ISO639-1 language
396
406
  */
397
407
  function getLangFromLocale(locale) {
398
408
  const adjustedLocale = adjustLocale(locale);
@@ -5388,7 +5398,7 @@ const FlowHeader = /*#__PURE__*/React.forwardRef(({
5388
5398
  ref: reference,
5389
5399
  className: classNames('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', className),
5390
5400
  children: [/*#__PURE__*/jsx("div", {
5391
- className: classNames('np-flow-header__left', {
5401
+ className: classNames('np-flow-header__left', 'd-flex', 'align-items-center', 'justify-content-between', {
5392
5402
  'flex__item--8': isVertical
5393
5403
  }),
5394
5404
  children: leftContent
@@ -5493,11 +5503,6 @@ const Logo = ({
5493
5503
  });
5494
5504
  const isSmall = clientWidth < Breakpoint.SMALL;
5495
5505
  const LogoSvg = isSmall ? svgPaths[`WISE_FLAG${inverse ? '_INVERSE' : ''}`] : svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5496
-
5497
- // If clientWidth is not defined, don't render anything
5498
- if (clientWidth === null) {
5499
- return null;
5500
- }
5501
5506
  return /*#__PURE__*/jsx(LogoSvg, {
5502
5507
  className: classNames('np-logo-svg', className),
5503
5508
  alt: type === LogoType.WISE ? 'Wise' : 'Wise business'
@@ -5701,19 +5706,16 @@ var messages$5 = defineMessages({
5701
5706
  const AnimatedLabel = ({
5702
5707
  activeLabel,
5703
5708
  className,
5704
- labels,
5705
- 'aria-label': ariaLabel
5709
+ labels
5706
5710
  }) => {
5707
- const numberLabels = labels.length - 1;
5708
- return /*#__PURE__*/jsx("div", {
5709
- "aria-label": ariaLabel,
5710
- className: classNames('np-animated-label', 'np-text-body-large-bold', className),
5711
+ return /*#__PURE__*/jsx(Body, {
5712
+ type: Typography.BODY_LARGE_BOLD,
5713
+ className: classNames('np-animated-label', className),
5711
5714
  children: labels.map((label, index) => {
5712
5715
  const nextLabel = index - 1;
5713
5716
  return /*#__PURE__*/jsx("div", {
5714
- className: classNames('text-xs-left', {
5715
- 'np-animated-label--in': index === activeLabel,
5716
- 'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels
5717
+ className: classNames('text-xs-center', {
5718
+ 'np-animated-label--in text-ellipsis': index === activeLabel
5717
5719
  }),
5718
5720
  children: label
5719
5721
  }, nextLabel);
@@ -5722,18 +5724,24 @@ const AnimatedLabel = ({
5722
5724
  };
5723
5725
 
5724
5726
  const BackButton = ({
5725
- label,
5726
5727
  className,
5727
- onClick
5728
- }) => /*#__PURE__*/jsxs("button", {
5729
- type: "button",
5730
- className: classNames('np-back-button', 'align-items-center', 'btn-unstyled', className),
5731
- onClick: onClick,
5732
- children: [/*#__PURE__*/jsx(ArrowLeft, {
5733
- size: 24
5734
- }), label]
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
+ })
5735
5742
  });
5736
5743
  BackButton.propTypes = {
5744
+ 'aria-label': PropTypes.string.isRequired,
5737
5745
  className: PropTypes.string,
5738
5746
  label: PropTypes.element,
5739
5747
  onClick: PropTypes.func
@@ -5766,16 +5774,17 @@ const FlowNavigation = ({
5766
5774
  const newAvatar = done ? null : avatar;
5767
5775
  const getLeftContentSmall = () => {
5768
5776
  const displayGoBack = onGoBack != null && activeStep > 0;
5769
- return /*#__PURE__*/jsx(Fragment, {
5770
- children: displayGoBack ? /*#__PURE__*/jsx(BackButton$1, {
5771
- label: /*#__PURE__*/jsx(AnimatedLabel, {
5772
- className: "m-x-1",
5773
- labels: steps.map(step => step.label),
5774
- activeLabel: activeStep - 1,
5775
- "aria-label": intl.formatMessage(messages$5.back)
5776
- }),
5777
+ return /*#__PURE__*/jsxs(Fragment, {
5778
+ children: [displayGoBack ? /*#__PURE__*/jsx(BackButton$1, {
5779
+ "aria-label": intl.formatMessage(messages$5.back),
5777
5780
  onClick: onGoBack
5778
- }) : logo
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
+ })]
5779
5788
  });
5780
5789
  };
5781
5790
  return /*#__PURE__*/jsx("div", {
@@ -5784,7 +5793,7 @@ const FlowNavigation = ({
5784
5793
  'np-flow-navigation--border-bottom': !done
5785
5794
  }),
5786
5795
  children: /*#__PURE__*/jsx(FlowHeader, {
5787
- className: classNames('np-flow-navigation__content p-x-3', {
5796
+ className: classNames('np-flow-navigation__content', isSmall ? 'p-x-2' : 'p-x-3', {
5788
5797
  'np-flow-navigation--hidden': !clientWidth,
5789
5798
  'np-flow-navigation--xs-max': isSmall,
5790
5799
  // Size switches on parent container which may or may not have the same size as the window.
@@ -5794,7 +5803,7 @@ const FlowNavigation = ({
5794
5803
  leftContent: isSmall ? getLeftContentSmall() : logo,
5795
5804
  rightContent: /*#__PURE__*/jsxs(Fragment, {
5796
5805
  children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsx("span", {
5797
- className: "separator"
5806
+ className: "m-x-1"
5798
5807
  }), closeButton]
5799
5808
  }),
5800
5809
  bottomContent: !done && /*#__PURE__*/jsx(Stepper, {
@@ -8807,6 +8816,7 @@ const OverlayHeader = ({
8807
8816
  logo
8808
8817
  }) => {
8809
8818
  const closeButton = onClose && /*#__PURE__*/jsx(CloseButton, {
8819
+ size: Size.LARGE,
8810
8820
  onClick: onClose
8811
8821
  });
8812
8822
  return /*#__PURE__*/jsx("div", {
@@ -8816,7 +8826,7 @@ const OverlayHeader = ({
8816
8826
  leftContent: logo,
8817
8827
  rightContent: /*#__PURE__*/jsxs(Fragment, {
8818
8828
  children: [avatar, avatar && closeButton && /*#__PURE__*/jsx("span", {
8819
- className: "separator"
8829
+ className: classNames('m-x-1')
8820
8830
  }), closeButton]
8821
8831
  })
8822
8832
  })