@transferwise/components 0.0.0-experimental-73ab65e → 0.0.0-experimental-c976134

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 (58) hide show
  1. package/build/index.esm.js +66 -57
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +66 -57
  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/header/Header.css +1 -1
  9. package/build/styles/inputs/SelectInput.css +1 -1
  10. package/build/styles/main.css +1 -1
  11. package/build/styles/overlayHeader/OverlayHeader.css +1 -1
  12. package/build/types/common/flowHeader/FlowHeader.d.ts.map +1 -1
  13. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  14. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +1 -2
  15. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
  16. package/build/types/flowNavigation/backButton/BackButton.d.ts +10 -11
  17. package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
  18. package/build/types/header/Header.d.ts +1 -1
  19. package/build/types/header/Header.d.ts.map +1 -1
  20. package/build/types/inputs/SelectInput.d.ts +4 -1
  21. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  22. package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
  23. package/build/types/title/Title.d.ts +1 -1
  24. package/build/types/title/Title.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/common/flowHeader/FlowHeader.tsx +4 -22
  27. package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +6 -22
  28. package/src/flowNavigation/FlowNavigation.css +1 -1
  29. package/src/flowNavigation/FlowNavigation.less +0 -9
  30. package/src/flowNavigation/FlowNavigation.spec.js +3 -3
  31. package/src/flowNavigation/FlowNavigation.story.js +22 -189
  32. package/src/flowNavigation/FlowNavigation.tsx +22 -27
  33. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +18 -26
  34. package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
  35. package/src/flowNavigation/animatedLabel/AnimatedLabel.less +0 -6
  36. package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +7 -21
  37. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +8 -17
  38. package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
  39. package/src/flowNavigation/backButton/BackButton.js +14 -9
  40. package/src/flowNavigation/backButton/BackButton.spec.js +3 -2
  41. package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +28 -21
  42. package/src/header/Header.css +1 -1
  43. package/src/header/Header.less +5 -0
  44. package/src/header/Header.tsx +21 -2
  45. package/src/inputs/SelectInput.css +1 -1
  46. package/src/inputs/SelectInput.less +3 -10
  47. package/src/inputs/SelectInput.spec.tsx +1 -1
  48. package/src/inputs/SelectInput.story.tsx +2 -2
  49. package/src/inputs/SelectInput.tsx +12 -6
  50. package/src/inputs/_Popover.less +1 -0
  51. package/src/main.css +1 -1
  52. package/src/overlayHeader/OverlayHeader.css +1 -1
  53. package/src/overlayHeader/OverlayHeader.js +6 -4
  54. package/src/overlayHeader/OverlayHeader.less +0 -8
  55. package/src/overlayHeader/OverlayHeader.spec.js +1 -1
  56. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +10 -14
  57. package/src/title/Title.tsx +1 -1
  58. package/src/flowNavigation/animatedLabel/AnimatedLabel.story.js +0 -22
@@ -5396,19 +5396,8 @@ const FlowHeader = /*#__PURE__*/React.forwardRef(({
5396
5396
  const isVertical = layout === Layout$1.VERTICAL;
5397
5397
  return /*#__PURE__*/jsxs("div", {
5398
5398
  ref: reference,
5399
- className: classNames('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', className),
5400
- children: [/*#__PURE__*/jsx("div", {
5401
- className: classNames('np-flow-header__left', {
5402
- 'flex__item--8': isVertical
5403
- }),
5404
- children: leftContent
5405
- }), /*#__PURE__*/jsx("div", {
5406
- className: classNames('align-items-center', 'd-flex', 'np-flow-header__right', 'justify-content-end', {
5407
- 'flex__item--4 ': isVertical,
5408
- 'order-2': !isVertical
5409
- }),
5410
- children: rightContent
5411
- }), /*#__PURE__*/jsx("div", {
5399
+ className: classNames('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', 'justify-content-between', 'flex__item--12', className),
5400
+ children: [leftContent, rightContent, /*#__PURE__*/jsx("div", {
5412
5401
  className: classNames('align-items-center', 'd-flex', 'justify-content-center', {
5413
5402
  'flex__item--12': isVertical,
5414
5403
  'order-1 flex-grow-1': !isVertical
@@ -5711,19 +5700,16 @@ var messages$5 = defineMessages({
5711
5700
  const AnimatedLabel = ({
5712
5701
  activeLabel,
5713
5702
  className,
5714
- labels,
5715
- 'aria-label': ariaLabel
5703
+ labels
5716
5704
  }) => {
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),
5705
+ return /*#__PURE__*/jsx(Body, {
5706
+ type: Typography.BODY_LARGE_BOLD,
5707
+ className: classNames('np-animated-label', className),
5721
5708
  children: labels.map((label, index) => {
5722
5709
  const nextLabel = index - 1;
5723
5710
  return /*#__PURE__*/jsx("div", {
5724
- className: classNames('text-xs-left', {
5725
- 'np-animated-label--in': index === activeLabel,
5726
- 'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels
5711
+ className: classNames('text-xs-center', {
5712
+ 'np-animated-label--in text-ellipsis': index === activeLabel
5727
5713
  }),
5728
5714
  children: label
5729
5715
  }, nextLabel);
@@ -5732,18 +5718,24 @@ const AnimatedLabel = ({
5732
5718
  };
5733
5719
 
5734
5720
  const BackButton = ({
5735
- label,
5736
5721
  className,
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]
5722
+ onClick,
5723
+ 'aria-label': ariaLabel
5724
+ }) => /*#__PURE__*/jsx(Avatar, {
5725
+ type: AvatarType.ICON,
5726
+ size: 40,
5727
+ children: /*#__PURE__*/jsx("button", {
5728
+ type: "button",
5729
+ "aria-label": ariaLabel,
5730
+ className: classNames('np-back-button', 'btn-unstyled', className),
5731
+ onClick: onClick,
5732
+ children: /*#__PURE__*/jsx(ArrowLeft, {
5733
+ size: 24
5734
+ })
5735
+ })
5745
5736
  });
5746
5737
  BackButton.propTypes = {
5738
+ 'aria-label': PropTypes.string.isRequired,
5747
5739
  className: PropTypes.string,
5748
5740
  label: PropTypes.element,
5749
5741
  onClick: PropTypes.func
@@ -5773,21 +5765,9 @@ const FlowNavigation = ({
5773
5765
  onClick: onClose
5774
5766
  });
5775
5767
  const isSmall = clientWidth != null && clientWidth < Breakpoint.SMALL;
5768
+ const isLarge = clientWidth != null && clientWidth >= Breakpoint.LARGE;
5776
5769
  const newAvatar = done ? null : avatar;
5777
- const getLeftContentSmall = () => {
5778
- const displayGoBack = onGoBack != null && activeStep > 0;
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
- }),
5787
- onClick: onGoBack
5788
- }) : logo
5789
- });
5790
- };
5770
+ const displayGoBack = onGoBack != null && activeStep > 0;
5791
5771
  return /*#__PURE__*/jsx("div", {
5792
5772
  ref: reference,
5793
5773
  className: classNames('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
@@ -5799,12 +5779,24 @@ const FlowNavigation = ({
5799
5779
  'np-flow-navigation--xs-max': isSmall,
5800
5780
  // Size switches on parent container which may or may not have the same size as the window.
5801
5781
  'np-flow-navigation--sm': clientWidth != null && clientWidth >= Breakpoint.SMALL,
5802
- 'np-flow-navigation--lg': clientWidth != null && clientWidth >= Breakpoint.LARGE
5782
+ 'np-flow-navigation--lg': isLarge
5783
+ }),
5784
+ leftContent: /*#__PURE__*/jsxs(Fragment, {
5785
+ children: [isSmall && displayGoBack ? /*#__PURE__*/jsx(BackButton$1, {
5786
+ "aria-label": intl.formatMessage(messages$5.back),
5787
+ onClick: onGoBack
5788
+ }) : logo, isSmall && /*#__PURE__*/jsx(AnimatedLabel, {
5789
+ className: "m-x-1",
5790
+ labels: steps.map(step => step.label),
5791
+ activeLabel: activeStep
5792
+ })]
5803
5793
  }),
5804
- leftContent: isSmall ? getLeftContentSmall() : logo,
5805
- rightContent: /*#__PURE__*/jsxs(Fragment, {
5794
+ rightContent: /*#__PURE__*/jsxs("div", {
5795
+ className: classNames('d-flex', 'align-items-center', {
5796
+ 'order-2': isLarge
5797
+ }),
5806
5798
  children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsx("span", {
5807
- className: "separator"
5799
+ className: "m-x-1"
5808
5800
  }), closeButton]
5809
5801
  }),
5810
5802
  bottomContent: !done && /*#__PURE__*/jsx(Stepper, {
@@ -5859,6 +5851,18 @@ const Header = ({
5859
5851
  title,
5860
5852
  className
5861
5853
  }) => {
5854
+ if (!action) {
5855
+ return /*#__PURE__*/jsx(Title, {
5856
+ as: as,
5857
+ type: Typography.TITLE_GROUP,
5858
+ className: classNames('np-header', 'np-header__title', className),
5859
+ children: title
5860
+ });
5861
+ }
5862
+ if (as === 'legend') {
5863
+ // eslint-disable-next-line no-console
5864
+ console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
5865
+ }
5862
5866
  return /*#__PURE__*/jsxs("div", {
5863
5867
  className: classNames('np-header', className),
5864
5868
  children: [/*#__PURE__*/jsx(Title, {
@@ -5866,7 +5870,7 @@ const Header = ({
5866
5870
  type: Typography.TITLE_GROUP,
5867
5871
  className: "np-header__title",
5868
5872
  children: title
5869
- }), action && /*#__PURE__*/jsx(HeaderAction, {
5873
+ }), /*#__PURE__*/jsx(HeaderAction, {
5870
5874
  action: action
5871
5875
  })]
5872
5876
  });
@@ -6906,14 +6910,14 @@ function SelectInputOptions({
6906
6910
  }
6907
6911
  return undefined;
6908
6912
  }, [filterable, query]);
6909
- const empty = needle != null && filterSelectInputItems(items, needle).length === 0;
6913
+ const resultsEmpty = needle != null && filterSelectInputItems(items, needle).length === 0;
6910
6914
  const listboxContainerRef = useRef(null);
6911
6915
  useEffect(() => {
6912
6916
  if (listboxContainerRef.current != null) {
6913
6917
  listboxContainerRef.current.style.setProperty('--initial-height', `${listboxContainerRef.current.offsetHeight}px`);
6914
6918
  }
6915
6919
  }, []);
6916
- const showStatus = empty;
6920
+ const showStatus = resultsEmpty;
6917
6921
  const statusId = useId();
6918
6922
  const listboxId = useId();
6919
6923
  return /*#__PURE__*/jsxs(Listbox.Options, {
@@ -6952,7 +6956,7 @@ function SelectInputOptions({
6952
6956
  }) : null, /*#__PURE__*/jsxs("section", {
6953
6957
  ref: listboxContainerRef,
6954
6958
  className: classNames('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
6955
- children: [empty ? /*#__PURE__*/jsxs("div", {
6959
+ children: [resultsEmpty ? /*#__PURE__*/jsxs("div", {
6956
6960
  id: statusId,
6957
6961
  className: "np-select-input-options-status",
6958
6962
  children: [/*#__PURE__*/jsx(CrossCircle, {
@@ -6964,7 +6968,7 @@ function SelectInputOptions({
6964
6968
  id: listboxId,
6965
6969
  role: "listbox",
6966
6970
  "aria-orientation": "vertical",
6967
- tabIndex: !filterable ? 0 : undefined,
6971
+ tabIndex: 0,
6968
6972
  className: "np-select-input-listbox",
6969
6973
  children: (needle != null ? dedupeSelectInputItems(items) : items).map((item, index) => /*#__PURE__*/jsx(SelectInputItemView
6970
6974
  // eslint-disable-next-line react/no-array-index-key
@@ -6983,7 +6987,10 @@ function SelectInputOptions({
6983
6987
  event.stopPropagation();
6984
6988
  }
6985
6989
  },
6986
- children: renderFooter(needle)
6990
+ children: renderFooter({
6991
+ resultsEmpty,
6992
+ normalizedQuery: needle
6993
+ })
6987
6994
  })
6988
6995
  }) : null]
6989
6996
  })]
@@ -8820,6 +8827,7 @@ const OverlayHeader = ({
8820
8827
  logo
8821
8828
  }) => {
8822
8829
  const closeButton = onClose && /*#__PURE__*/jsx(CloseButton, {
8830
+ size: Size.LARGE,
8823
8831
  onClick: onClose
8824
8832
  });
8825
8833
  return /*#__PURE__*/jsx("div", {
@@ -8827,9 +8835,10 @@ const OverlayHeader = ({
8827
8835
  children: /*#__PURE__*/jsx(FlowHeader, {
8828
8836
  className: "np-overlay-header__content p-a-3",
8829
8837
  leftContent: logo,
8830
- rightContent: /*#__PURE__*/jsxs(Fragment, {
8838
+ rightContent: /*#__PURE__*/jsxs("div", {
8839
+ className: classNames('d-flex', 'align-items-center', 'order-2'),
8831
8840
  children: [avatar, avatar && closeButton && /*#__PURE__*/jsx("span", {
8832
- className: "separator"
8841
+ className: classNames('m-x-1')
8833
8842
  }), closeButton]
8834
8843
  })
8835
8844
  })