@transferwise/components 45.21.3 → 45.23.0
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.
- package/build/index.esm.js +103 -77
- package/build/index.esm.js.map +1 -1
- package/build/index.js +103 -77
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/flowNavigation/FlowNavigation.css +1 -1
- package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
- package/build/styles/header/Header.css +1 -1
- package/build/styles/inputs/SelectInput.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/overlayHeader/OverlayHeader.css +1 -1
- package/build/types/common/flowHeader/FlowHeader.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +1 -2
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +10 -11
- package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
- package/build/types/header/Header.d.ts +1 -1
- package/build/types/header/Header.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +5 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/build/types/title/Title.d.ts +1 -1
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/flowHeader/FlowHeader.tsx +4 -22
- package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +6 -22
- package/src/flowNavigation/FlowNavigation.css +1 -1
- package/src/flowNavigation/FlowNavigation.less +0 -9
- package/src/flowNavigation/FlowNavigation.spec.js +3 -3
- package/src/flowNavigation/FlowNavigation.story.js +22 -189
- package/src/flowNavigation/FlowNavigation.tsx +22 -27
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +18 -26
- package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.less +0 -6
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +7 -21
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +8 -17
- package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
- package/src/flowNavigation/backButton/BackButton.js +14 -9
- package/src/flowNavigation/backButton/BackButton.spec.js +3 -2
- package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +28 -21
- package/src/header/Header.css +1 -1
- package/src/header/Header.less +5 -0
- package/src/header/Header.tsx +21 -2
- package/src/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +7 -10
- package/src/inputs/SelectInput.spec.tsx +40 -0
- package/src/inputs/SelectInput.story.tsx +18 -0
- package/src/inputs/SelectInput.tsx +46 -12
- package/src/inputs/_BottomSheet.less +1 -1
- package/src/inputs/_Popover.less +1 -0
- package/src/main.css +1 -1
- package/src/overlayHeader/OverlayHeader.css +1 -1
- package/src/overlayHeader/OverlayHeader.js +6 -4
- package/src/overlayHeader/OverlayHeader.less +0 -8
- package/src/overlayHeader/OverlayHeader.spec.js +1 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +10 -14
- package/src/title/Title.tsx +1 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.story.js +0 -22
package/build/index.js
CHANGED
|
@@ -5430,19 +5430,8 @@ const FlowHeader = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
5430
5430
|
const isVertical = layout === exports.Layout.VERTICAL;
|
|
5431
5431
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5432
5432
|
ref: reference,
|
|
5433
|
-
className: classNames__default.default('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', className),
|
|
5434
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5435
|
-
className: classNames__default.default('np-flow-header__left', {
|
|
5436
|
-
'flex__item--8': isVertical
|
|
5437
|
-
}),
|
|
5438
|
-
children: leftContent
|
|
5439
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5440
|
-
className: classNames__default.default('align-items-center', 'd-flex', 'np-flow-header__right', 'justify-content-end', {
|
|
5441
|
-
'flex__item--4 ': isVertical,
|
|
5442
|
-
'order-2': !isVertical
|
|
5443
|
-
}),
|
|
5444
|
-
children: rightContent
|
|
5445
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5433
|
+
className: classNames__default.default('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', 'justify-content-between', 'flex__item--12', className),
|
|
5434
|
+
children: [leftContent, rightContent, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5446
5435
|
className: classNames__default.default('align-items-center', 'd-flex', 'justify-content-center', {
|
|
5447
5436
|
'flex__item--12': isVertical,
|
|
5448
5437
|
'order-1 flex-grow-1': !isVertical
|
|
@@ -5745,19 +5734,16 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
5745
5734
|
const AnimatedLabel = ({
|
|
5746
5735
|
activeLabel,
|
|
5747
5736
|
className,
|
|
5748
|
-
labels
|
|
5749
|
-
'aria-label': ariaLabel
|
|
5737
|
+
labels
|
|
5750
5738
|
}) => {
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
className: classNames__default.default('np-animated-label', 'np-text-body-large-bold', className),
|
|
5739
|
+
return /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
5740
|
+
type: exports.Typography.BODY_LARGE_BOLD,
|
|
5741
|
+
className: classNames__default.default('np-animated-label', className),
|
|
5755
5742
|
children: labels.map((label, index) => {
|
|
5756
5743
|
const nextLabel = index - 1;
|
|
5757
5744
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5758
|
-
className: classNames__default.default('text-xs-
|
|
5759
|
-
'np-animated-label--in': index === activeLabel
|
|
5760
|
-
'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels
|
|
5745
|
+
className: classNames__default.default('text-xs-center', {
|
|
5746
|
+
'np-animated-label--in text-ellipsis': index === activeLabel
|
|
5761
5747
|
}),
|
|
5762
5748
|
children: label
|
|
5763
5749
|
}, nextLabel);
|
|
@@ -5766,18 +5752,24 @@ const AnimatedLabel = ({
|
|
|
5766
5752
|
};
|
|
5767
5753
|
|
|
5768
5754
|
const BackButton = ({
|
|
5769
|
-
label,
|
|
5770
5755
|
className,
|
|
5771
|
-
onClick
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
children:
|
|
5777
|
-
|
|
5778
|
-
|
|
5756
|
+
onClick,
|
|
5757
|
+
'aria-label': ariaLabel
|
|
5758
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(Avatar, {
|
|
5759
|
+
type: exports.AvatarType.ICON,
|
|
5760
|
+
size: 40,
|
|
5761
|
+
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
5762
|
+
type: "button",
|
|
5763
|
+
"aria-label": ariaLabel,
|
|
5764
|
+
className: classNames__default.default('np-back-button', 'btn-unstyled', className),
|
|
5765
|
+
onClick: onClick,
|
|
5766
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeft, {
|
|
5767
|
+
size: 24
|
|
5768
|
+
})
|
|
5769
|
+
})
|
|
5779
5770
|
});
|
|
5780
5771
|
BackButton.propTypes = {
|
|
5772
|
+
'aria-label': PropTypes__default.default.string.isRequired,
|
|
5781
5773
|
className: PropTypes__default.default.string,
|
|
5782
5774
|
label: PropTypes__default.default.element,
|
|
5783
5775
|
onClick: PropTypes__default.default.func
|
|
@@ -5807,21 +5799,9 @@ const FlowNavigation = ({
|
|
|
5807
5799
|
onClick: onClose
|
|
5808
5800
|
});
|
|
5809
5801
|
const isSmall = clientWidth != null && clientWidth < exports.Breakpoint.SMALL;
|
|
5802
|
+
const isLarge = clientWidth != null && clientWidth >= exports.Breakpoint.LARGE;
|
|
5810
5803
|
const newAvatar = done ? null : avatar;
|
|
5811
|
-
const
|
|
5812
|
-
const displayGoBack = onGoBack != null && activeStep > 0;
|
|
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
|
-
}),
|
|
5821
|
-
onClick: onGoBack
|
|
5822
|
-
}) : logo
|
|
5823
|
-
});
|
|
5824
|
-
};
|
|
5804
|
+
const displayGoBack = onGoBack != null && activeStep > 0;
|
|
5825
5805
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5826
5806
|
ref: reference,
|
|
5827
5807
|
className: classNames__default.default('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
|
|
@@ -5833,12 +5813,24 @@ const FlowNavigation = ({
|
|
|
5833
5813
|
'np-flow-navigation--xs-max': isSmall,
|
|
5834
5814
|
// Size switches on parent container which may or may not have the same size as the window.
|
|
5835
5815
|
'np-flow-navigation--sm': clientWidth != null && clientWidth >= exports.Breakpoint.SMALL,
|
|
5836
|
-
'np-flow-navigation--lg':
|
|
5816
|
+
'np-flow-navigation--lg': isLarge
|
|
5817
|
+
}),
|
|
5818
|
+
leftContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
5819
|
+
children: [isSmall && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
|
|
5820
|
+
"aria-label": intl.formatMessage(messages$5.back),
|
|
5821
|
+
onClick: onGoBack
|
|
5822
|
+
}) : logo, isSmall && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
|
|
5823
|
+
className: "m-x-1",
|
|
5824
|
+
labels: steps.map(step => step.label),
|
|
5825
|
+
activeLabel: activeStep
|
|
5826
|
+
})]
|
|
5837
5827
|
}),
|
|
5838
|
-
|
|
5839
|
-
|
|
5828
|
+
rightContent: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5829
|
+
className: classNames__default.default('d-flex', 'align-items-center', {
|
|
5830
|
+
'order-2': isLarge
|
|
5831
|
+
}),
|
|
5840
5832
|
children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5841
|
-
className: "
|
|
5833
|
+
className: "m-x-1"
|
|
5842
5834
|
}), closeButton]
|
|
5843
5835
|
}),
|
|
5844
5836
|
bottomContent: !done && /*#__PURE__*/jsxRuntime.jsx(Stepper, {
|
|
@@ -5893,6 +5885,18 @@ const Header = ({
|
|
|
5893
5885
|
title,
|
|
5894
5886
|
className
|
|
5895
5887
|
}) => {
|
|
5888
|
+
if (!action) {
|
|
5889
|
+
return /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
5890
|
+
as: as,
|
|
5891
|
+
type: exports.Typography.TITLE_GROUP,
|
|
5892
|
+
className: classNames__default.default('np-header', 'np-header__title', className),
|
|
5893
|
+
children: title
|
|
5894
|
+
});
|
|
5895
|
+
}
|
|
5896
|
+
if (as === 'legend') {
|
|
5897
|
+
// eslint-disable-next-line no-console
|
|
5898
|
+
console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
|
|
5899
|
+
}
|
|
5896
5900
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5897
5901
|
className: classNames__default.default('np-header', className),
|
|
5898
5902
|
children: [/*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
@@ -5900,7 +5904,7 @@ const Header = ({
|
|
|
5900
5904
|
type: exports.Typography.TITLE_GROUP,
|
|
5901
5905
|
className: "np-header__title",
|
|
5902
5906
|
children: title
|
|
5903
|
-
}),
|
|
5907
|
+
}), /*#__PURE__*/jsxRuntime.jsx(HeaderAction, {
|
|
5904
5908
|
action: action
|
|
5905
5909
|
})]
|
|
5906
5910
|
});
|
|
@@ -6783,6 +6787,7 @@ function SelectInput({
|
|
|
6783
6787
|
value: controlledValue,
|
|
6784
6788
|
compareValues,
|
|
6785
6789
|
renderValue = wrapInFragment,
|
|
6790
|
+
renderFooter,
|
|
6786
6791
|
renderTrigger = defaultRenderTrigger,
|
|
6787
6792
|
filterable,
|
|
6788
6793
|
filterPlaceholder,
|
|
@@ -6856,6 +6861,7 @@ function SelectInput({
|
|
|
6856
6861
|
children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
|
|
6857
6862
|
items: items,
|
|
6858
6863
|
renderValue: renderValue,
|
|
6864
|
+
renderFooter: renderFooter,
|
|
6859
6865
|
filterable: filterable,
|
|
6860
6866
|
filterPlaceholder: filterPlaceholder,
|
|
6861
6867
|
searchInputRef: searchInputRef,
|
|
@@ -6898,29 +6904,32 @@ const SelectInputOptionsContainer = /*#__PURE__*/React.forwardRef(function Selec
|
|
|
6898
6904
|
React.useEffect(() => {
|
|
6899
6905
|
handleAriaActiveDescendantChange(ariaActiveDescendant);
|
|
6900
6906
|
}, [ariaActiveDescendant, handleAriaActiveDescendantChange]);
|
|
6901
|
-
return (
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6907
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6908
|
+
ref: ref,
|
|
6909
|
+
role: "none",
|
|
6910
|
+
onKeyDown: event => {
|
|
6911
|
+
// Prevent confirmation close without an active item
|
|
6912
|
+
if (event.key === 'Enter' && ariaActiveDescendant == null) {
|
|
6913
|
+
return;
|
|
6914
|
+
}
|
|
6915
|
+
// Prevent absorbing actions early
|
|
6916
|
+
if (event.key === 'Escape' || event.key === 'Tab') {
|
|
6917
|
+
onKeyDown?.({
|
|
6918
|
+
...event,
|
|
6919
|
+
preventDefault: () => {},
|
|
6920
|
+
stopPropagation: () => {}
|
|
6921
|
+
});
|
|
6922
|
+
return;
|
|
6923
|
+
}
|
|
6924
|
+
onKeyDown?.(event);
|
|
6925
|
+
},
|
|
6926
|
+
...restProps
|
|
6927
|
+
});
|
|
6920
6928
|
});
|
|
6921
6929
|
function SelectInputOptions({
|
|
6922
6930
|
items,
|
|
6923
6931
|
renderValue = wrapInFragment,
|
|
6932
|
+
renderFooter,
|
|
6924
6933
|
filterable = false,
|
|
6925
6934
|
filterPlaceholder,
|
|
6926
6935
|
searchInputRef,
|
|
@@ -6935,14 +6944,14 @@ function SelectInputOptions({
|
|
|
6935
6944
|
}
|
|
6936
6945
|
return undefined;
|
|
6937
6946
|
}, [filterable, query]);
|
|
6938
|
-
const
|
|
6947
|
+
const resultsEmpty = needle != null && filterSelectInputItems(items, needle).length === 0;
|
|
6939
6948
|
const listboxContainerRef = React.useRef(null);
|
|
6940
6949
|
React.useEffect(() => {
|
|
6941
6950
|
if (listboxContainerRef.current != null) {
|
|
6942
6951
|
listboxContainerRef.current.style.setProperty('--initial-height', `${listboxContainerRef.current.offsetHeight}px`);
|
|
6943
6952
|
}
|
|
6944
6953
|
}, []);
|
|
6945
|
-
const showStatus =
|
|
6954
|
+
const showStatus = resultsEmpty;
|
|
6946
6955
|
const statusId = reactId.useId();
|
|
6947
6956
|
const listboxId = reactId.useId();
|
|
6948
6957
|
return /*#__PURE__*/jsxRuntime.jsxs(react$1.Listbox.Options, {
|
|
@@ -6978,10 +6987,10 @@ function SelectInputOptions({
|
|
|
6978
6987
|
setQuery(event.currentTarget.value);
|
|
6979
6988
|
}
|
|
6980
6989
|
})
|
|
6981
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsxs("
|
|
6990
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsxs("section", {
|
|
6982
6991
|
ref: listboxContainerRef,
|
|
6983
6992
|
className: classNames__default.default('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
|
|
6984
|
-
children: [
|
|
6993
|
+
children: [resultsEmpty ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6985
6994
|
id: statusId,
|
|
6986
6995
|
className: "np-select-input-options-status",
|
|
6987
6996
|
children: [/*#__PURE__*/jsxRuntime.jsx(icons.CrossCircle, {
|
|
@@ -7002,7 +7011,22 @@ function SelectInputOptions({
|
|
|
7002
7011
|
renderValue: renderValue,
|
|
7003
7012
|
needle: needle
|
|
7004
7013
|
}, index))
|
|
7005
|
-
})
|
|
7014
|
+
}), renderFooter != null ? /*#__PURE__*/jsxRuntime.jsx("footer", {
|
|
7015
|
+
className: "np-select-input-footer",
|
|
7016
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7017
|
+
role: "none",
|
|
7018
|
+
onKeyDown: event => {
|
|
7019
|
+
// Prevent interfering with Headless UI
|
|
7020
|
+
if (event.key !== 'Escape') {
|
|
7021
|
+
event.stopPropagation();
|
|
7022
|
+
}
|
|
7023
|
+
},
|
|
7024
|
+
children: renderFooter({
|
|
7025
|
+
resultsEmpty,
|
|
7026
|
+
normalizedQuery: needle
|
|
7027
|
+
})
|
|
7028
|
+
})
|
|
7029
|
+
}) : null]
|
|
7006
7030
|
})]
|
|
7007
7031
|
});
|
|
7008
7032
|
}
|
|
@@ -7059,7 +7083,7 @@ function SelectInputGroupItemView({
|
|
|
7059
7083
|
className: classNames__default.default(needle === null && 'np-select-input-group-item--without-needle'),
|
|
7060
7084
|
children: [needle == null ? /*#__PURE__*/jsxRuntime.jsx("header", {
|
|
7061
7085
|
id: headerId,
|
|
7062
|
-
role: "
|
|
7086
|
+
role: "none",
|
|
7063
7087
|
className: "np-select-input-group-item-header np-text-title-group",
|
|
7064
7088
|
children: item.label
|
|
7065
7089
|
}) : null, item.options.map((option, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
|
|
@@ -8837,6 +8861,7 @@ const OverlayHeader = ({
|
|
|
8837
8861
|
logo
|
|
8838
8862
|
}) => {
|
|
8839
8863
|
const closeButton = onClose && /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
8864
|
+
size: exports.Size.LARGE,
|
|
8840
8865
|
onClick: onClose
|
|
8841
8866
|
});
|
|
8842
8867
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -8844,9 +8869,10 @@ const OverlayHeader = ({
|
|
|
8844
8869
|
children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader, {
|
|
8845
8870
|
className: "np-overlay-header__content p-a-3",
|
|
8846
8871
|
leftContent: logo,
|
|
8847
|
-
rightContent: /*#__PURE__*/jsxRuntime.jsxs(
|
|
8872
|
+
rightContent: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8873
|
+
className: classNames__default.default('d-flex', 'align-items-center', 'order-2'),
|
|
8848
8874
|
children: [avatar, avatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
8849
|
-
className:
|
|
8875
|
+
className: classNames__default.default('m-x-1')
|
|
8850
8876
|
}), closeButton]
|
|
8851
8877
|
})
|
|
8852
8878
|
})
|