@transferwise/components 46.33.0 → 46.34.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 +25 -8
- package/build/index.js.map +1 -1
- package/build/index.mjs +25 -8
- package/build/index.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts +3 -2
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.spec.tsx +12 -0
- package/src/alert/Alert.story.tsx +11 -1
- package/src/alert/Alert.tsx +33 -14
package/build/index.mjs
CHANGED
|
@@ -950,7 +950,7 @@ function Alert({
|
|
|
950
950
|
"data-testid": "alert",
|
|
951
951
|
onTouchStart: () => setShouldFire(true),
|
|
952
952
|
onTouchEnd: event => {
|
|
953
|
-
if (shouldFire && action &&
|
|
953
|
+
if (shouldFire && action?.href &&
|
|
954
954
|
// Check if current event is triggered from closeButton
|
|
955
955
|
event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
|
|
956
956
|
if (action.target === '_blank') {
|
|
@@ -987,13 +987,8 @@ function Alert({
|
|
|
987
987
|
children: message
|
|
988
988
|
})
|
|
989
989
|
})]
|
|
990
|
-
}), action && /*#__PURE__*/jsx(
|
|
991
|
-
|
|
992
|
-
className: "m-t-1",
|
|
993
|
-
"aria-label": action['aria-label'],
|
|
994
|
-
target: action.target,
|
|
995
|
-
type: Typography.LINK_LARGE,
|
|
996
|
-
children: action.text
|
|
990
|
+
}), action && /*#__PURE__*/jsx(Action, {
|
|
991
|
+
action: action
|
|
997
992
|
})]
|
|
998
993
|
})]
|
|
999
994
|
}), onDismiss && /*#__PURE__*/jsx(CloseButton, {
|
|
@@ -1020,6 +1015,28 @@ function alertArrowClassNames(arrow) {
|
|
|
1020
1015
|
return 'arrow';
|
|
1021
1016
|
}
|
|
1022
1017
|
}
|
|
1018
|
+
function Action({
|
|
1019
|
+
action
|
|
1020
|
+
}) {
|
|
1021
|
+
if ('href' in action) {
|
|
1022
|
+
return /*#__PURE__*/jsx(Link, {
|
|
1023
|
+
href: action.href,
|
|
1024
|
+
className: "m-t-1",
|
|
1025
|
+
"aria-label": action['aria-label'],
|
|
1026
|
+
target: action.target,
|
|
1027
|
+
type: Typography.LINK_LARGE,
|
|
1028
|
+
onClick: action.onClick,
|
|
1029
|
+
children: action.text
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
return /*#__PURE__*/jsx("button", {
|
|
1033
|
+
type: "button",
|
|
1034
|
+
"aria-label": action['aria-label'],
|
|
1035
|
+
className: "btn-unstyled np-text-link-large m-t-1",
|
|
1036
|
+
onClick: action.onClick,
|
|
1037
|
+
children: action.text
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1023
1040
|
|
|
1024
1041
|
// TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
|
|
1025
1042
|
var AvatarType;
|