@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.mjs
CHANGED
|
@@ -450,7 +450,7 @@ const Chevron = ({
|
|
|
450
450
|
}) => {
|
|
451
451
|
const classNameValue = classNames('tw-chevron', {
|
|
452
452
|
'chevron-color': !disabled
|
|
453
|
-
},
|
|
453
|
+
}, orientation, className);
|
|
454
454
|
if (size === Size.EXTRA_SMALL) {
|
|
455
455
|
return /*#__PURE__*/jsx(ExtraSmallChevron, {
|
|
456
456
|
className: classNameValue
|
|
@@ -782,18 +782,17 @@ function Title({
|
|
|
782
782
|
const mapping = titleTypeMapping[type];
|
|
783
783
|
const isTypeSupported = mapping !== undefined;
|
|
784
784
|
if (isTypeSupported) {
|
|
785
|
-
const HeaderTag = as ??
|
|
785
|
+
const HeaderTag = as ?? mapping;
|
|
786
786
|
return /*#__PURE__*/jsx(HeaderTag, {
|
|
787
787
|
...props,
|
|
788
788
|
className: classNames(`np-text-${type}`, className)
|
|
789
789
|
});
|
|
790
|
-
} else {
|
|
791
|
-
const HeaderTag = as ?? `${titleTypeMapping[DEFAULT_TYPE]}`;
|
|
792
|
-
return /*#__PURE__*/jsx(HeaderTag, {
|
|
793
|
-
...props,
|
|
794
|
-
className: classNames(`np-text-${DEFAULT_TYPE}`, className)
|
|
795
|
-
});
|
|
796
790
|
}
|
|
791
|
+
const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
|
|
792
|
+
return /*#__PURE__*/jsx(HeaderTag, {
|
|
793
|
+
...props,
|
|
794
|
+
className: classNames(`np-text-${DEFAULT_TYPE}`, className)
|
|
795
|
+
});
|
|
797
796
|
}
|
|
798
797
|
|
|
799
798
|
function logActionRequired(message) {
|
|
@@ -6171,9 +6170,21 @@ function SelectInput({
|
|
|
6171
6170
|
className,
|
|
6172
6171
|
onFilterChange = noop,
|
|
6173
6172
|
onChange,
|
|
6173
|
+
onClose,
|
|
6174
6174
|
onClear
|
|
6175
6175
|
}) {
|
|
6176
6176
|
const [open, setOpen] = useState(false);
|
|
6177
|
+
const initialized = useRef(false);
|
|
6178
|
+
const handleClose = useEffectEvent(onClose ?? (() => {}));
|
|
6179
|
+
useEffect(() => {
|
|
6180
|
+
if (initialized.current) {
|
|
6181
|
+
if (!open) {
|
|
6182
|
+
handleClose?.();
|
|
6183
|
+
}
|
|
6184
|
+
} else {
|
|
6185
|
+
initialized.current = true;
|
|
6186
|
+
}
|
|
6187
|
+
}, [handleClose, open]);
|
|
6177
6188
|
const [filterQuery, _setFilterQuery] = useState('');
|
|
6178
6189
|
const setFilterQuery = useEffectEvent(query => {
|
|
6179
6190
|
_setFilterQuery(query);
|
|
@@ -6650,7 +6661,7 @@ const ListItem = ({
|
|
|
6650
6661
|
'p-x-2': !isContainerAligned
|
|
6651
6662
|
}),
|
|
6652
6663
|
...rest,
|
|
6653
|
-
children: [media
|
|
6664
|
+
children: [media, /*#__PURE__*/jsxs("div", {
|
|
6654
6665
|
className: classNames('d-flex flex-column', {
|
|
6655
6666
|
'p-l-2': !!media,
|
|
6656
6667
|
'p-r-2': !!action
|
|
@@ -7165,7 +7176,7 @@ const getLocalStorage = () => {
|
|
|
7165
7176
|
if (storageItem) {
|
|
7166
7177
|
const storage = JSON.parse(storageItem);
|
|
7167
7178
|
if (Array.isArray(storage)) {
|
|
7168
|
-
return storage;
|
|
7179
|
+
return storage.map(item => String(item));
|
|
7169
7180
|
}
|
|
7170
7181
|
}
|
|
7171
7182
|
// eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
|
|
@@ -7191,7 +7202,7 @@ const Nudge = ({
|
|
|
7191
7202
|
const dismissedNudgesStorage = getLocalStorage();
|
|
7192
7203
|
if (persistDismissal && id) {
|
|
7193
7204
|
try {
|
|
7194
|
-
localStorage.setItem(STORAGE_NAME, JSON.stringify([...
|
|
7205
|
+
localStorage.setItem(STORAGE_NAME, JSON.stringify([...dismissedNudgesStorage, id]));
|
|
7195
7206
|
// eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
|
|
7196
7207
|
} catch (error) {}
|
|
7197
7208
|
setIsDismissed(true);
|
|
@@ -7204,7 +7215,7 @@ const Nudge = ({
|
|
|
7204
7215
|
if (persistDismissal && id) {
|
|
7205
7216
|
const dismissedNudgesStorage = getLocalStorage();
|
|
7206
7217
|
let isDismissed = false;
|
|
7207
|
-
if (dismissedNudgesStorage
|
|
7218
|
+
if (dismissedNudgesStorage?.find(item => item === id)) {
|
|
7208
7219
|
setIsDismissed(true);
|
|
7209
7220
|
isDismissed = true;
|
|
7210
7221
|
}
|
|
@@ -8964,9 +8975,8 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
8964
8975
|
'np-Card--promoCard': true,
|
|
8965
8976
|
'np-Card--checked': !href && type,
|
|
8966
8977
|
'np-Card--link': href && !type,
|
|
8967
|
-
'is-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined
|
|
8968
|
-
|
|
8969
|
-
});
|
|
8978
|
+
'is-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined
|
|
8979
|
+
}, className);
|
|
8970
8980
|
// Object with common props that will be passed to the `Card` components
|
|
8971
8981
|
const commonProps = {
|
|
8972
8982
|
className: commonClasses,
|
|
@@ -9086,18 +9096,17 @@ const PromoCardGroup = ({
|
|
|
9086
9096
|
};
|
|
9087
9097
|
return {
|
|
9088
9098
|
state,
|
|
9089
|
-
isDisabled
|
|
9099
|
+
isDisabled,
|
|
9090
9100
|
onChange: handleOnChange
|
|
9091
9101
|
};
|
|
9092
9102
|
}, [state, isDisabled, onChange]);
|
|
9093
9103
|
const commonClasses = classNames({
|
|
9094
9104
|
'np-CardGroup': true,
|
|
9095
|
-
'is-disabled': isDisabled
|
|
9096
|
-
|
|
9097
|
-
});
|
|
9105
|
+
'is-disabled': isDisabled
|
|
9106
|
+
}, className);
|
|
9098
9107
|
const commonProps = {
|
|
9099
9108
|
className: commonClasses,
|
|
9100
|
-
id
|
|
9109
|
+
id,
|
|
9101
9110
|
'data-testid': testId,
|
|
9102
9111
|
role: containerRole // Add the role attribute here
|
|
9103
9112
|
};
|