@transferwise/components 0.0.0-experimental-a4458ac → 0.0.0-experimental-210ef2c

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 (45) hide show
  1. package/build/index.esm.js +80 -99
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +80 -99
  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/flowNavigation/FlowNavigation.d.ts.map +1 -1
  13. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +2 -1
  14. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
  15. package/build/types/flowNavigation/backButton/BackButton.d.ts +11 -10
  16. package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
  17. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  18. package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/src/common/flowHeader/FlowHeader.tsx +3 -9
  21. package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +2 -2
  22. package/src/flowNavigation/FlowNavigation.css +1 -1
  23. package/src/flowNavigation/FlowNavigation.less +9 -0
  24. package/src/flowNavigation/FlowNavigation.spec.js +3 -3
  25. package/src/flowNavigation/FlowNavigation.story.js +183 -24
  26. package/src/flowNavigation/FlowNavigation.tsx +13 -9
  27. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +11 -14
  28. package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
  29. package/src/flowNavigation/animatedLabel/AnimatedLabel.less +6 -0
  30. package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +21 -7
  31. package/src/flowNavigation/animatedLabel/AnimatedLabel.story.js +22 -0
  32. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +17 -8
  33. package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
  34. package/src/flowNavigation/backButton/BackButton.js +9 -14
  35. package/src/flowNavigation/backButton/BackButton.spec.js +2 -3
  36. package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +21 -28
  37. package/src/inputs/SelectInput.css +1 -1
  38. package/src/inputs/SelectInput.less +1 -13
  39. package/src/inputs/SelectInput.tsx +61 -80
  40. package/src/main.css +1 -1
  41. package/src/overlayHeader/OverlayHeader.css +1 -1
  42. package/src/overlayHeader/OverlayHeader.js +2 -4
  43. package/src/overlayHeader/OverlayHeader.less +8 -0
  44. package/src/overlayHeader/OverlayHeader.spec.js +1 -1
  45. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +3 -3
package/build/index.js CHANGED
@@ -5432,7 +5432,7 @@ const FlowHeader = /*#__PURE__*/React__namespace.forwardRef(({
5432
5432
  ref: reference,
5433
5433
  className: classNames__default.default('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', className),
5434
5434
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
5435
- className: classNames__default.default('np-flow-header__left', 'd-flex', 'align-items-center', 'justify-content-between', {
5435
+ className: classNames__default.default('np-flow-header__left', {
5436
5436
  'flex__item--8': isVertical
5437
5437
  }),
5438
5438
  children: leftContent
@@ -5745,16 +5745,19 @@ var messages$5 = reactIntl.defineMessages({
5745
5745
  const AnimatedLabel = ({
5746
5746
  activeLabel,
5747
5747
  className,
5748
- labels
5748
+ labels,
5749
+ 'aria-label': ariaLabel
5749
5750
  }) => {
5750
- return /*#__PURE__*/jsxRuntime.jsx(Body, {
5751
- type: exports.Typography.BODY_LARGE_BOLD,
5752
- className: classNames__default.default('np-animated-label', className),
5751
+ const numberLabels = labels.length - 1;
5752
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
5753
+ "aria-label": ariaLabel,
5754
+ className: classNames__default.default('np-animated-label', 'np-text-body-large-bold', className),
5753
5755
  children: labels.map((label, index) => {
5754
5756
  const nextLabel = index - 1;
5755
5757
  return /*#__PURE__*/jsxRuntime.jsx("div", {
5756
- className: classNames__default.default('text-xs-center', {
5757
- 'np-animated-label--in text-ellipsis': index === activeLabel
5758
+ className: classNames__default.default('text-xs-left', {
5759
+ 'np-animated-label--in': index === activeLabel,
5760
+ 'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels
5758
5761
  }),
5759
5762
  children: label
5760
5763
  }, nextLabel);
@@ -5763,24 +5766,18 @@ const AnimatedLabel = ({
5763
5766
  };
5764
5767
 
5765
5768
  const BackButton = ({
5769
+ label,
5766
5770
  className,
5767
- onClick,
5768
- 'aria-label': ariaLabel
5769
- }) => /*#__PURE__*/jsxRuntime.jsx(Avatar, {
5770
- type: exports.AvatarType.ICON,
5771
- size: 40,
5772
- children: /*#__PURE__*/jsxRuntime.jsx("button", {
5773
- type: "button",
5774
- "aria-label": ariaLabel,
5775
- className: classNames__default.default('np-back-button', 'btn-unstyled', className),
5776
- onClick: onClick,
5777
- children: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeft, {
5778
- size: 24
5779
- })
5780
- })
5771
+ onClick
5772
+ }) => /*#__PURE__*/jsxRuntime.jsxs("button", {
5773
+ type: "button",
5774
+ className: classNames__default.default('np-back-button', 'align-items-center', 'btn-unstyled', className),
5775
+ onClick: onClick,
5776
+ children: [/*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeft, {
5777
+ size: 24
5778
+ }), label]
5781
5779
  });
5782
5780
  BackButton.propTypes = {
5783
- 'aria-label': PropTypes__default.default.string.isRequired,
5784
5781
  className: PropTypes__default.default.string,
5785
5782
  label: PropTypes__default.default.element,
5786
5783
  onClick: PropTypes__default.default.func
@@ -5813,17 +5810,16 @@ const FlowNavigation = ({
5813
5810
  const newAvatar = done ? null : avatar;
5814
5811
  const getLeftContentSmall = () => {
5815
5812
  const displayGoBack = onGoBack != null && activeStep > 0;
5816
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5817
- children: [displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
5818
- "aria-label": intl.formatMessage(messages$5.back),
5813
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
5814
+ children: displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
5815
+ label: /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
5816
+ className: "m-x-1",
5817
+ labels: steps.map(step => step.label),
5818
+ activeLabel: activeStep - 1,
5819
+ "aria-label": intl.formatMessage(messages$5.back)
5820
+ }),
5819
5821
  onClick: onGoBack
5820
- }) : logo, /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
5821
- className: "m-x-1",
5822
- labels: steps.map(step => step.label),
5823
- activeLabel: activeStep
5824
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
5825
- className: "m-x-1"
5826
- })]
5822
+ }) : logo
5827
5823
  });
5828
5824
  };
5829
5825
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -5832,7 +5828,7 @@ const FlowNavigation = ({
5832
5828
  'np-flow-navigation--border-bottom': !done
5833
5829
  }),
5834
5830
  children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader, {
5835
- className: classNames__default.default('np-flow-navigation__content', isSmall ? 'p-x-2' : 'p-x-3', {
5831
+ className: classNames__default.default('np-flow-navigation__content p-x-3', {
5836
5832
  'np-flow-navigation--hidden': !clientWidth,
5837
5833
  'np-flow-navigation--xs-max': isSmall,
5838
5834
  // Size switches on parent container which may or may not have the same size as the window.
@@ -5842,7 +5838,7 @@ const FlowNavigation = ({
5842
5838
  leftContent: isSmall ? getLeftContentSmall() : logo,
5843
5839
  rightContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5844
5840
  children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
5845
- className: "m-x-1"
5841
+ className: "separator"
5846
5842
  }), closeButton]
5847
5843
  }),
5848
5844
  bottomContent: !done && /*#__PURE__*/jsxRuntime.jsx(Stepper, {
@@ -6675,13 +6671,6 @@ function inferSearchableStrings(value) {
6675
6671
  }
6676
6672
  return [];
6677
6673
  }
6678
- const SelectInputItemCheckPaddingContext = /*#__PURE__*/React.createContext(false);
6679
- function useSelectInputItemCheckPadding() {
6680
- const checkPadding = React.useContext(SelectInputItemCheckPaddingContext);
6681
- // Avoid layout shifts during transitions via caching
6682
- const [initialCheckPadding] = React.useState(checkPadding);
6683
- return initialCheckPadding;
6684
- }
6685
6674
  const SelectInputTriggerButtonPropsContext = /*#__PURE__*/React.createContext({});
6686
6675
  const SelectInputOptionContentWithinTriggerContext = /*#__PURE__*/React.createContext(false);
6687
6676
  function dedupeSelectInputOptionItem(item, existingValues) {
@@ -6826,54 +6815,51 @@ function SelectInput({
6826
6815
  children: ({
6827
6816
  disabled: uiDisabled,
6828
6817
  value
6829
- }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemCheckPaddingContext.Provider, {
6830
- value: Boolean(filterable) || value != null,
6831
- children: /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
6832
- placement: "bottom-start",
6833
- open: open,
6834
- renderTrigger: ({
6835
- ref,
6836
- getInteractionProps
6837
- }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputTriggerButtonPropsContext.Provider, {
6838
- // eslint-disable-next-line react/jsx-no-constructed-context-values
6839
- value: {
6840
- ref: mergeRefs__default.default([ref, triggerRef]),
6841
- ...mergeProps__default.default({
6842
- onClick: () => {
6843
- setOpen(prev => !prev);
6844
- }
6845
- }, getInteractionProps())
6846
- },
6847
- children: renderTrigger({
6848
- content: value != null ? /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
6849
- value: true,
6850
- children: renderValue(value, true)
6851
- }) : placeholder,
6852
- placeholderShown: value == null,
6853
- clear: onClear != null ? () => {
6854
- onClear();
6855
- triggerRef.current?.focus({
6856
- preventScroll: true
6857
- });
6858
- } : undefined,
6859
- disabled: uiDisabled,
6860
- size,
6861
- className
6862
- })
6863
- }),
6864
- initialFocusRef: controllerRef,
6865
- padding: "none",
6866
- onClose: () => {
6867
- setOpen(false);
6818
+ }) => /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
6819
+ placement: "bottom-start",
6820
+ open: open,
6821
+ renderTrigger: ({
6822
+ ref,
6823
+ getInteractionProps
6824
+ }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputTriggerButtonPropsContext.Provider, {
6825
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
6826
+ value: {
6827
+ ref: mergeRefs__default.default([ref, triggerRef]),
6828
+ ...mergeProps__default.default({
6829
+ onClick: () => {
6830
+ setOpen(prev => !prev);
6831
+ }
6832
+ }, getInteractionProps())
6868
6833
  },
6869
- children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
6870
- items: items,
6871
- renderValue: renderValue,
6872
- filterable: filterable,
6873
- filterPlaceholder: filterPlaceholder,
6874
- searchInputRef: searchInputRef,
6875
- listboxRef: listboxRef
6834
+ children: renderTrigger({
6835
+ content: value != null ? /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
6836
+ value: true,
6837
+ children: renderValue(value, true)
6838
+ }) : placeholder,
6839
+ placeholderShown: value == null,
6840
+ clear: onClear != null ? () => {
6841
+ onClear();
6842
+ triggerRef.current?.focus({
6843
+ preventScroll: true
6844
+ });
6845
+ } : undefined,
6846
+ disabled: uiDisabled,
6847
+ size,
6848
+ className
6876
6849
  })
6850
+ }),
6851
+ initialFocusRef: controllerRef,
6852
+ padding: "none",
6853
+ onClose: () => {
6854
+ setOpen(false);
6855
+ },
6856
+ children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
6857
+ items: items,
6858
+ renderValue: renderValue,
6859
+ filterable: filterable,
6860
+ filterPlaceholder: filterPlaceholder,
6861
+ searchInputRef: searchInputRef,
6862
+ listboxRef: listboxRef
6877
6863
  })
6878
6864
  })
6879
6865
  });
@@ -7063,7 +7049,6 @@ function SelectInputGroupItemView({
7063
7049
  needle
7064
7050
  }) {
7065
7051
  const headerId = reactId.useId();
7066
- const checkPadding = useSelectInputItemCheckPadding();
7067
7052
  return (
7068
7053
  /*#__PURE__*/
7069
7054
  // An empty container may be rendered when no options match `needle`
@@ -7072,13 +7057,11 @@ function SelectInputGroupItemView({
7072
7057
  role: "group",
7073
7058
  "aria-labelledby": headerId,
7074
7059
  className: classNames__default.default(needle === null && 'np-select-input-group-item--without-needle'),
7075
- children: [needle == null ? /*#__PURE__*/jsxRuntime.jsxs("header", {
7060
+ children: [needle == null ? /*#__PURE__*/jsxRuntime.jsx("header", {
7076
7061
  id: headerId,
7077
7062
  role: "presentation",
7078
7063
  className: "np-select-input-group-item-header np-text-title-group",
7079
- children: [checkPadding ? /*#__PURE__*/jsxRuntime.jsx("span", {
7080
- className: "np-select-input-option-check-placeholder"
7081
- }) : null, item.label]
7064
+ children: item.label
7082
7065
  }) : null, item.options.map((option, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
7083
7066
  // eslint-disable-next-line react/no-array-index-key
7084
7067
  , {
@@ -7094,7 +7077,6 @@ function SelectInputOption({
7094
7077
  disabled,
7095
7078
  children
7096
7079
  }) {
7097
- const checkPadding = useSelectInputItemCheckPadding();
7098
7080
  return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Option, {
7099
7081
  as: "div",
7100
7082
  value: value,
@@ -7106,12 +7088,12 @@ function SelectInputOption({
7106
7088
  children: ({
7107
7089
  selected
7108
7090
  }) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7109
- children: [checkPadding ? /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
7110
- size: 16,
7111
- className: classNames__default.default('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
7112
- }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
7091
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
7113
7092
  className: "np-select-input-option",
7114
7093
  children: children
7094
+ }), /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
7095
+ size: 16,
7096
+ className: classNames__default.default('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
7115
7097
  })]
7116
7098
  })
7117
7099
  });
@@ -8855,7 +8837,6 @@ const OverlayHeader = ({
8855
8837
  logo
8856
8838
  }) => {
8857
8839
  const closeButton = onClose && /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
8858
- size: exports.Size.LARGE,
8859
8840
  onClick: onClose
8860
8841
  });
8861
8842
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -8865,7 +8846,7 @@ const OverlayHeader = ({
8865
8846
  leftContent: logo,
8866
8847
  rightContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
8867
8848
  children: [avatar, avatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
8868
- className: classNames__default.default('m-x-1')
8849
+ className: "separator"
8869
8850
  }), closeButton]
8870
8851
  })
8871
8852
  })