@transferwise/components 0.0.0-experimental-a087360 → 0.0.0-experimental-5ac2a3c
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 +64 -46
- package/build/index.esm.js.map +1 -1
- package/build/index.js +64 -46
- 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/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 +2 -1
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +11 -10
- 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/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 +22 -4
- package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +22 -6
- package/src/flowNavigation/FlowNavigation.css +1 -1
- package/src/flowNavigation/FlowNavigation.less +9 -0
- package/src/flowNavigation/FlowNavigation.spec.js +3 -3
- package/src/flowNavigation/FlowNavigation.story.js +189 -22
- package/src/flowNavigation/FlowNavigation.tsx +27 -22
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +26 -18
- package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.less +6 -0
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +21 -7
- package/src/flowNavigation/animatedLabel/AnimatedLabel.story.js +22 -0
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +17 -8
- package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
- package/src/flowNavigation/backButton/BackButton.js +9 -14
- package/src/flowNavigation/backButton/BackButton.spec.js +2 -3
- package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +21 -28
- package/src/header/Header.css +1 -1
- package/src/header/Header.less +5 -0
- package/src/header/Header.tsx +21 -2
- package/src/main.css +1 -1
- package/src/overlayHeader/OverlayHeader.css +1 -1
- package/src/overlayHeader/OverlayHeader.js +4 -6
- package/src/overlayHeader/OverlayHeader.less +8 -0
- package/src/overlayHeader/OverlayHeader.spec.js +1 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +14 -10
- package/src/title/Title.tsx +1 -1
package/build/index.esm.js
CHANGED
|
@@ -5396,8 +5396,19 @@ 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',
|
|
5400
|
-
children: [
|
|
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", {
|
|
5401
5412
|
className: classNames('align-items-center', 'd-flex', 'justify-content-center', {
|
|
5402
5413
|
'flex__item--12': isVertical,
|
|
5403
5414
|
'order-1 flex-grow-1': !isVertical
|
|
@@ -5700,16 +5711,19 @@ var messages$5 = defineMessages({
|
|
|
5700
5711
|
const AnimatedLabel = ({
|
|
5701
5712
|
activeLabel,
|
|
5702
5713
|
className,
|
|
5703
|
-
labels
|
|
5714
|
+
labels,
|
|
5715
|
+
'aria-label': ariaLabel
|
|
5704
5716
|
}) => {
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
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),
|
|
5708
5721
|
children: labels.map((label, index) => {
|
|
5709
5722
|
const nextLabel = index - 1;
|
|
5710
5723
|
return /*#__PURE__*/jsx("div", {
|
|
5711
|
-
className: classNames('text-xs-
|
|
5712
|
-
'np-animated-label--in
|
|
5724
|
+
className: classNames('text-xs-left', {
|
|
5725
|
+
'np-animated-label--in': index === activeLabel,
|
|
5726
|
+
'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels
|
|
5713
5727
|
}),
|
|
5714
5728
|
children: label
|
|
5715
5729
|
}, nextLabel);
|
|
@@ -5718,24 +5732,18 @@ const AnimatedLabel = ({
|
|
|
5718
5732
|
};
|
|
5719
5733
|
|
|
5720
5734
|
const BackButton = ({
|
|
5735
|
+
label,
|
|
5721
5736
|
className,
|
|
5722
|
-
onClick
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
children: /*#__PURE__*/jsx(
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
className: classNames('np-back-button', 'btn-unstyled', className),
|
|
5731
|
-
onClick: onClick,
|
|
5732
|
-
children: /*#__PURE__*/jsx(ArrowLeft, {
|
|
5733
|
-
size: 24
|
|
5734
|
-
})
|
|
5735
|
-
})
|
|
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]
|
|
5736
5745
|
});
|
|
5737
5746
|
BackButton.propTypes = {
|
|
5738
|
-
'aria-label': PropTypes.string.isRequired,
|
|
5739
5747
|
className: PropTypes.string,
|
|
5740
5748
|
label: PropTypes.element,
|
|
5741
5749
|
onClick: PropTypes.func
|
|
@@ -5765,9 +5773,21 @@ const FlowNavigation = ({
|
|
|
5765
5773
|
onClick: onClose
|
|
5766
5774
|
});
|
|
5767
5775
|
const isSmall = clientWidth != null && clientWidth < Breakpoint.SMALL;
|
|
5768
|
-
const isLarge = clientWidth != null && clientWidth >= Breakpoint.LARGE;
|
|
5769
5776
|
const newAvatar = done ? null : avatar;
|
|
5770
|
-
const
|
|
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
|
+
};
|
|
5771
5791
|
return /*#__PURE__*/jsx("div", {
|
|
5772
5792
|
ref: reference,
|
|
5773
5793
|
className: classNames('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
|
|
@@ -5779,24 +5799,12 @@ const FlowNavigation = ({
|
|
|
5779
5799
|
'np-flow-navigation--xs-max': isSmall,
|
|
5780
5800
|
// Size switches on parent container which may or may not have the same size as the window.
|
|
5781
5801
|
'np-flow-navigation--sm': clientWidth != null && clientWidth >= Breakpoint.SMALL,
|
|
5782
|
-
'np-flow-navigation--lg':
|
|
5802
|
+
'np-flow-navigation--lg': clientWidth != null && clientWidth >= Breakpoint.LARGE
|
|
5783
5803
|
}),
|
|
5784
|
-
leftContent:
|
|
5785
|
-
|
|
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
|
-
})]
|
|
5793
|
-
}),
|
|
5794
|
-
rightContent: /*#__PURE__*/jsxs("div", {
|
|
5795
|
-
className: classNames('d-flex', 'align-items-center', {
|
|
5796
|
-
'order-2': isLarge
|
|
5797
|
-
}),
|
|
5804
|
+
leftContent: isSmall ? getLeftContentSmall() : logo,
|
|
5805
|
+
rightContent: /*#__PURE__*/jsxs(Fragment, {
|
|
5798
5806
|
children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsx("span", {
|
|
5799
|
-
className: "
|
|
5807
|
+
className: "separator"
|
|
5800
5808
|
}), closeButton]
|
|
5801
5809
|
}),
|
|
5802
5810
|
bottomContent: !done && /*#__PURE__*/jsx(Stepper, {
|
|
@@ -5851,6 +5859,18 @@ const Header = ({
|
|
|
5851
5859
|
title,
|
|
5852
5860
|
className
|
|
5853
5861
|
}) => {
|
|
5862
|
+
if (!action) {
|
|
5863
|
+
return /*#__PURE__*/jsx(Title, {
|
|
5864
|
+
as: as,
|
|
5865
|
+
type: Typography.TITLE_GROUP,
|
|
5866
|
+
className: classNames('np-header', 'np-header__title', className),
|
|
5867
|
+
children: title
|
|
5868
|
+
});
|
|
5869
|
+
}
|
|
5870
|
+
if (as === 'legend') {
|
|
5871
|
+
// eslint-disable-next-line no-console
|
|
5872
|
+
console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
|
|
5873
|
+
}
|
|
5854
5874
|
return /*#__PURE__*/jsxs("div", {
|
|
5855
5875
|
className: classNames('np-header', className),
|
|
5856
5876
|
children: [/*#__PURE__*/jsx(Title, {
|
|
@@ -5858,7 +5878,7 @@ const Header = ({
|
|
|
5858
5878
|
type: Typography.TITLE_GROUP,
|
|
5859
5879
|
className: "np-header__title",
|
|
5860
5880
|
children: title
|
|
5861
|
-
}),
|
|
5881
|
+
}), /*#__PURE__*/jsx(HeaderAction, {
|
|
5862
5882
|
action: action
|
|
5863
5883
|
})]
|
|
5864
5884
|
});
|
|
@@ -8795,7 +8815,6 @@ const OverlayHeader = ({
|
|
|
8795
8815
|
logo
|
|
8796
8816
|
}) => {
|
|
8797
8817
|
const closeButton = onClose && /*#__PURE__*/jsx(CloseButton, {
|
|
8798
|
-
size: Size.LARGE,
|
|
8799
8818
|
onClick: onClose
|
|
8800
8819
|
});
|
|
8801
8820
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -8803,10 +8822,9 @@ const OverlayHeader = ({
|
|
|
8803
8822
|
children: /*#__PURE__*/jsx(FlowHeader, {
|
|
8804
8823
|
className: "np-overlay-header__content p-a-3",
|
|
8805
8824
|
leftContent: logo,
|
|
8806
|
-
rightContent: /*#__PURE__*/jsxs(
|
|
8807
|
-
className: classNames('d-flex', 'align-items-center', 'order-2'),
|
|
8825
|
+
rightContent: /*#__PURE__*/jsxs(Fragment, {
|
|
8808
8826
|
children: [avatar, avatar && closeButton && /*#__PURE__*/jsx("span", {
|
|
8809
|
-
className:
|
|
8827
|
+
className: "separator"
|
|
8810
8828
|
}), closeButton]
|
|
8811
8829
|
})
|
|
8812
8830
|
})
|