@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.
- package/build/index.esm.js +47 -37
- package/build/index.esm.js.map +1 -1
- package/build/index.js +47 -37
- 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/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/common/locale/index.d.ts +10 -1
- package/build/types/common/locale/index.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/logo/Logo.d.ts.map +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/common/flowHeader/FlowHeader.tsx +9 -3
- package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +2 -2
- package/src/common/locale/index.js +10 -1
- 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 +24 -183
- package/src/flowNavigation/FlowNavigation.tsx +9 -13
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +14 -11
- 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/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +1 -1
- package/src/inputs/SelectInput.story.tsx +8 -5
- package/src/logo/Logo.js +0 -5
- package/src/main.css +1 -1
- package/src/overlayHeader/OverlayHeader.css +1 -1
- package/src/overlayHeader/OverlayHeader.js +4 -2
- package/src/overlayHeader/OverlayHeader.less +0 -8
- package/src/overlayHeader/OverlayHeader.spec.js +1 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +3 -3
package/build/index.js
CHANGED
|
@@ -396,6 +396,11 @@ const DEFAULT_LOCALE = 'en-GB';
|
|
|
396
396
|
* @type {string[]}
|
|
397
397
|
*/
|
|
398
398
|
const RTL_LANGUAGES = ['ar', 'he'];
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @deprecated The source of truth for supported languages lives in Crab.
|
|
402
|
+
* @type {string[]}
|
|
403
|
+
*/
|
|
399
404
|
const SUPPORTED_LANGUAGES = [DEFAULT_LANG, 'de', 'es', 'fr', 'hu', 'id', 'it', 'ja', 'pl', 'pt', 'ro', 'ru', 'th', 'tr', 'uk', 'zh'];
|
|
400
405
|
|
|
401
406
|
/**
|
|
@@ -425,8 +430,13 @@ function adjustLocale(locale) {
|
|
|
425
430
|
* Provides corresponding lang (iso2) for provided locale
|
|
426
431
|
* if locale is invalid or language is unsupported returns null
|
|
427
432
|
*
|
|
433
|
+
* @deprecated The use of this function almost always breaks language variants
|
|
434
|
+
* e.g. Simplified and Traditional Chinese.
|
|
435
|
+
* There should be no use case for this function.
|
|
436
|
+
* To select the correct translations from a translations object, pass the
|
|
437
|
+
* locale directly into Crab's getLocalisedMessages.
|
|
428
438
|
* @param {string} locale (`es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP` etc)
|
|
429
|
-
* @returns {string|null}
|
|
439
|
+
* @returns {string|null} two-letter ISO639-1 language
|
|
430
440
|
*/
|
|
431
441
|
function getLangFromLocale(locale) {
|
|
432
442
|
const adjustedLocale = adjustLocale(locale);
|
|
@@ -5422,7 +5432,7 @@ const FlowHeader = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
5422
5432
|
ref: reference,
|
|
5423
5433
|
className: classNames__default.default('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', className),
|
|
5424
5434
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5425
|
-
className: classNames__default.default('np-flow-header__left', {
|
|
5435
|
+
className: classNames__default.default('np-flow-header__left', 'd-flex', 'align-items-center', 'justify-content-between', {
|
|
5426
5436
|
'flex__item--8': isVertical
|
|
5427
5437
|
}),
|
|
5428
5438
|
children: leftContent
|
|
@@ -5527,11 +5537,6 @@ const Logo = ({
|
|
|
5527
5537
|
});
|
|
5528
5538
|
const isSmall = clientWidth < exports.Breakpoint.SMALL;
|
|
5529
5539
|
const LogoSvg = isSmall ? svgPaths[`WISE_FLAG${inverse ? '_INVERSE' : ''}`] : svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
5530
|
-
|
|
5531
|
-
// If clientWidth is not defined, don't render anything
|
|
5532
|
-
if (clientWidth === null) {
|
|
5533
|
-
return null;
|
|
5534
|
-
}
|
|
5535
5540
|
return /*#__PURE__*/jsxRuntime.jsx(LogoSvg, {
|
|
5536
5541
|
className: classNames__default.default('np-logo-svg', className),
|
|
5537
5542
|
alt: type === exports.LogoType.WISE ? 'Wise' : 'Wise business'
|
|
@@ -5735,19 +5740,16 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
5735
5740
|
const AnimatedLabel = ({
|
|
5736
5741
|
activeLabel,
|
|
5737
5742
|
className,
|
|
5738
|
-
labels
|
|
5739
|
-
'aria-label': ariaLabel
|
|
5743
|
+
labels
|
|
5740
5744
|
}) => {
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
className: classNames__default.default('np-animated-label', 'np-text-body-large-bold', className),
|
|
5745
|
+
return /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
5746
|
+
type: exports.Typography.BODY_LARGE_BOLD,
|
|
5747
|
+
className: classNames__default.default('np-animated-label', className),
|
|
5745
5748
|
children: labels.map((label, index) => {
|
|
5746
5749
|
const nextLabel = index - 1;
|
|
5747
5750
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5748
|
-
className: classNames__default.default('text-xs-
|
|
5749
|
-
'np-animated-label--in': index === activeLabel
|
|
5750
|
-
'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels
|
|
5751
|
+
className: classNames__default.default('text-xs-center', {
|
|
5752
|
+
'np-animated-label--in text-ellipsis': index === activeLabel
|
|
5751
5753
|
}),
|
|
5752
5754
|
children: label
|
|
5753
5755
|
}, nextLabel);
|
|
@@ -5756,18 +5758,24 @@ const AnimatedLabel = ({
|
|
|
5756
5758
|
};
|
|
5757
5759
|
|
|
5758
5760
|
const BackButton = ({
|
|
5759
|
-
label,
|
|
5760
5761
|
className,
|
|
5761
|
-
onClick
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
children:
|
|
5767
|
-
|
|
5768
|
-
|
|
5762
|
+
onClick,
|
|
5763
|
+
'aria-label': ariaLabel
|
|
5764
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(Avatar, {
|
|
5765
|
+
type: exports.AvatarType.ICON,
|
|
5766
|
+
size: 40,
|
|
5767
|
+
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
5768
|
+
type: "button",
|
|
5769
|
+
"aria-label": ariaLabel,
|
|
5770
|
+
className: classNames__default.default('np-back-button', 'btn-unstyled', className),
|
|
5771
|
+
onClick: onClick,
|
|
5772
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeft, {
|
|
5773
|
+
size: 24
|
|
5774
|
+
})
|
|
5775
|
+
})
|
|
5769
5776
|
});
|
|
5770
5777
|
BackButton.propTypes = {
|
|
5778
|
+
'aria-label': PropTypes__default.default.string.isRequired,
|
|
5771
5779
|
className: PropTypes__default.default.string,
|
|
5772
5780
|
label: PropTypes__default.default.element,
|
|
5773
5781
|
onClick: PropTypes__default.default.func
|
|
@@ -5800,16 +5808,17 @@ const FlowNavigation = ({
|
|
|
5800
5808
|
const newAvatar = done ? null : avatar;
|
|
5801
5809
|
const getLeftContentSmall = () => {
|
|
5802
5810
|
const displayGoBack = onGoBack != null && activeStep > 0;
|
|
5803
|
-
return /*#__PURE__*/jsxRuntime.
|
|
5804
|
-
children: displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
|
|
5805
|
-
label:
|
|
5806
|
-
className: "m-x-1",
|
|
5807
|
-
labels: steps.map(step => step.label),
|
|
5808
|
-
activeLabel: activeStep - 1,
|
|
5809
|
-
"aria-label": intl.formatMessage(messages$5.back)
|
|
5810
|
-
}),
|
|
5811
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
5812
|
+
children: [displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
|
|
5813
|
+
"aria-label": intl.formatMessage(messages$5.back),
|
|
5811
5814
|
onClick: onGoBack
|
|
5812
|
-
}) : logo
|
|
5815
|
+
}) : logo, /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
|
|
5816
|
+
className: "m-x-1",
|
|
5817
|
+
labels: steps.map(step => step.label),
|
|
5818
|
+
activeLabel: activeStep
|
|
5819
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5820
|
+
className: "m-x-1"
|
|
5821
|
+
})]
|
|
5813
5822
|
});
|
|
5814
5823
|
};
|
|
5815
5824
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -5818,7 +5827,7 @@ const FlowNavigation = ({
|
|
|
5818
5827
|
'np-flow-navigation--border-bottom': !done
|
|
5819
5828
|
}),
|
|
5820
5829
|
children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader, {
|
|
5821
|
-
className: classNames__default.default('np-flow-navigation__content p-x-3', {
|
|
5830
|
+
className: classNames__default.default('np-flow-navigation__content', isSmall ? 'p-x-2' : 'p-x-3', {
|
|
5822
5831
|
'np-flow-navigation--hidden': !clientWidth,
|
|
5823
5832
|
'np-flow-navigation--xs-max': isSmall,
|
|
5824
5833
|
// Size switches on parent container which may or may not have the same size as the window.
|
|
@@ -5828,7 +5837,7 @@ const FlowNavigation = ({
|
|
|
5828
5837
|
leftContent: isSmall ? getLeftContentSmall() : logo,
|
|
5829
5838
|
rightContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
5830
5839
|
children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5831
|
-
className: "
|
|
5840
|
+
className: "m-x-1"
|
|
5832
5841
|
}), closeButton]
|
|
5833
5842
|
}),
|
|
5834
5843
|
bottomContent: !done && /*#__PURE__*/jsxRuntime.jsx(Stepper, {
|
|
@@ -8841,6 +8850,7 @@ const OverlayHeader = ({
|
|
|
8841
8850
|
logo
|
|
8842
8851
|
}) => {
|
|
8843
8852
|
const closeButton = onClose && /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
8853
|
+
size: exports.Size.LARGE,
|
|
8844
8854
|
onClick: onClose
|
|
8845
8855
|
});
|
|
8846
8856
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -8850,7 +8860,7 @@ const OverlayHeader = ({
|
|
|
8850
8860
|
leftContent: logo,
|
|
8851
8861
|
rightContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8852
8862
|
children: [avatar, avatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
8853
|
-
className:
|
|
8863
|
+
className: classNames__default.default('m-x-1')
|
|
8854
8864
|
}), closeButton]
|
|
8855
8865
|
})
|
|
8856
8866
|
})
|