@transferwise/components 46.29.2 → 46.30.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.js +29 -20
- package/build/index.js.map +1 -1
- package/build/index.mjs +29 -20
- package/build/index.mjs.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +2 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/promoCard/PromoCardGroup.d.ts.map +1 -1
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/chevron/Chevron.tsx +1 -1
- package/src/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.spec.ts +1 -1
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +2 -2
- package/src/inputs/SelectInput.spec.tsx +12 -0
- package/src/inputs/SelectInput.story.tsx +2 -0
- package/src/inputs/SelectInput.tsx +14 -0
- package/src/listItem/ListItem.tsx +1 -1
- package/src/nudge/Nudge.tsx +5 -8
- package/src/promoCard/PromoCard.tsx +10 -7
- package/src/promoCard/PromoCardGroup.tsx +9 -7
- package/src/select/Select.story.js +1 -1
- package/src/stepper/Stepper.spec.js +13 -13
- package/src/title/Title.tsx +4 -5
package/build/index.js
CHANGED
|
@@ -480,7 +480,7 @@ const Chevron = ({
|
|
|
480
480
|
}) => {
|
|
481
481
|
const classNameValue = classNames__default.default('tw-chevron', {
|
|
482
482
|
'chevron-color': !disabled
|
|
483
|
-
},
|
|
483
|
+
}, orientation, className);
|
|
484
484
|
if (size === exports.Size.EXTRA_SMALL) {
|
|
485
485
|
return /*#__PURE__*/jsxRuntime.jsx(ExtraSmallChevron, {
|
|
486
486
|
className: classNameValue
|
|
@@ -812,18 +812,17 @@ function Title({
|
|
|
812
812
|
const mapping = titleTypeMapping[type];
|
|
813
813
|
const isTypeSupported = mapping !== undefined;
|
|
814
814
|
if (isTypeSupported) {
|
|
815
|
-
const HeaderTag = as ??
|
|
815
|
+
const HeaderTag = as ?? mapping;
|
|
816
816
|
return /*#__PURE__*/jsxRuntime.jsx(HeaderTag, {
|
|
817
817
|
...props,
|
|
818
818
|
className: classNames__default.default(`np-text-${type}`, className)
|
|
819
819
|
});
|
|
820
|
-
} else {
|
|
821
|
-
const HeaderTag = as ?? `${titleTypeMapping[DEFAULT_TYPE]}`;
|
|
822
|
-
return /*#__PURE__*/jsxRuntime.jsx(HeaderTag, {
|
|
823
|
-
...props,
|
|
824
|
-
className: classNames__default.default(`np-text-${DEFAULT_TYPE}`, className)
|
|
825
|
-
});
|
|
826
820
|
}
|
|
821
|
+
const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
|
|
822
|
+
return /*#__PURE__*/jsxRuntime.jsx(HeaderTag, {
|
|
823
|
+
...props,
|
|
824
|
+
className: classNames__default.default(`np-text-${DEFAULT_TYPE}`, className)
|
|
825
|
+
});
|
|
827
826
|
}
|
|
828
827
|
|
|
829
828
|
function logActionRequired(message) {
|
|
@@ -6201,9 +6200,21 @@ function SelectInput({
|
|
|
6201
6200
|
className,
|
|
6202
6201
|
onFilterChange = noop,
|
|
6203
6202
|
onChange,
|
|
6203
|
+
onClose,
|
|
6204
6204
|
onClear
|
|
6205
6205
|
}) {
|
|
6206
6206
|
const [open, setOpen] = React.useState(false);
|
|
6207
|
+
const initialized = React.useRef(false);
|
|
6208
|
+
const handleClose = useEffectEvent(onClose ?? (() => {}));
|
|
6209
|
+
React.useEffect(() => {
|
|
6210
|
+
if (initialized.current) {
|
|
6211
|
+
if (!open) {
|
|
6212
|
+
handleClose?.();
|
|
6213
|
+
}
|
|
6214
|
+
} else {
|
|
6215
|
+
initialized.current = true;
|
|
6216
|
+
}
|
|
6217
|
+
}, [handleClose, open]);
|
|
6207
6218
|
const [filterQuery, _setFilterQuery] = React.useState('');
|
|
6208
6219
|
const setFilterQuery = useEffectEvent(query => {
|
|
6209
6220
|
_setFilterQuery(query);
|
|
@@ -6680,7 +6691,7 @@ const ListItem = ({
|
|
|
6680
6691
|
'p-x-2': !isContainerAligned
|
|
6681
6692
|
}),
|
|
6682
6693
|
...rest,
|
|
6683
|
-
children: [media
|
|
6694
|
+
children: [media, /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6684
6695
|
className: classNames__default.default('d-flex flex-column', {
|
|
6685
6696
|
'p-l-2': !!media,
|
|
6686
6697
|
'p-r-2': !!action
|
|
@@ -7195,7 +7206,7 @@ const getLocalStorage = () => {
|
|
|
7195
7206
|
if (storageItem) {
|
|
7196
7207
|
const storage = JSON.parse(storageItem);
|
|
7197
7208
|
if (Array.isArray(storage)) {
|
|
7198
|
-
return storage;
|
|
7209
|
+
return storage.map(item => String(item));
|
|
7199
7210
|
}
|
|
7200
7211
|
}
|
|
7201
7212
|
// eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
|
|
@@ -7221,7 +7232,7 @@ const Nudge = ({
|
|
|
7221
7232
|
const dismissedNudgesStorage = getLocalStorage();
|
|
7222
7233
|
if (persistDismissal && id) {
|
|
7223
7234
|
try {
|
|
7224
|
-
localStorage.setItem(STORAGE_NAME, JSON.stringify([...
|
|
7235
|
+
localStorage.setItem(STORAGE_NAME, JSON.stringify([...dismissedNudgesStorage, id]));
|
|
7225
7236
|
// eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
|
|
7226
7237
|
} catch (error) {}
|
|
7227
7238
|
setIsDismissed(true);
|
|
@@ -7234,7 +7245,7 @@ const Nudge = ({
|
|
|
7234
7245
|
if (persistDismissal && id) {
|
|
7235
7246
|
const dismissedNudgesStorage = getLocalStorage();
|
|
7236
7247
|
let isDismissed = false;
|
|
7237
|
-
if (dismissedNudgesStorage
|
|
7248
|
+
if (dismissedNudgesStorage?.find(item => item === id)) {
|
|
7238
7249
|
setIsDismissed(true);
|
|
7239
7250
|
isDismissed = true;
|
|
7240
7251
|
}
|
|
@@ -8994,9 +9005,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
8994
9005
|
'np-Card--promoCard': true,
|
|
8995
9006
|
'np-Card--checked': !href && type,
|
|
8996
9007
|
'np-Card--link': href && !type,
|
|
8997
|
-
'is-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined
|
|
8998
|
-
|
|
8999
|
-
});
|
|
9008
|
+
'is-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined
|
|
9009
|
+
}, className);
|
|
9000
9010
|
// Object with common props that will be passed to the `Card` components
|
|
9001
9011
|
const commonProps = {
|
|
9002
9012
|
className: commonClasses,
|
|
@@ -9116,18 +9126,17 @@ const PromoCardGroup = ({
|
|
|
9116
9126
|
};
|
|
9117
9127
|
return {
|
|
9118
9128
|
state,
|
|
9119
|
-
isDisabled
|
|
9129
|
+
isDisabled,
|
|
9120
9130
|
onChange: handleOnChange
|
|
9121
9131
|
};
|
|
9122
9132
|
}, [state, isDisabled, onChange]);
|
|
9123
9133
|
const commonClasses = classNames__default.default({
|
|
9124
9134
|
'np-CardGroup': true,
|
|
9125
|
-
'is-disabled': isDisabled
|
|
9126
|
-
|
|
9127
|
-
});
|
|
9135
|
+
'is-disabled': isDisabled
|
|
9136
|
+
}, className);
|
|
9128
9137
|
const commonProps = {
|
|
9129
9138
|
className: commonClasses,
|
|
9130
|
-
id
|
|
9139
|
+
id,
|
|
9131
9140
|
'data-testid': testId,
|
|
9132
9141
|
role: containerRole // Add the role attribute here
|
|
9133
9142
|
};
|