@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 CHANGED
@@ -980,7 +980,7 @@ function Alert({
980
980
  "data-testid": "alert",
981
981
  onTouchStart: () => setShouldFire(true),
982
982
  onTouchEnd: event => {
983
- if (shouldFire && action &&
983
+ if (shouldFire && action?.href &&
984
984
  // Check if current event is triggered from closeButton
985
985
  event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
986
986
  if (action.target === '_blank') {
@@ -1017,13 +1017,8 @@ function Alert({
1017
1017
  children: message
1018
1018
  })
1019
1019
  })]
1020
- }), action && /*#__PURE__*/jsxRuntime.jsx(Link, {
1021
- href: action.href,
1022
- className: "m-t-1",
1023
- "aria-label": action['aria-label'],
1024
- target: action.target,
1025
- type: exports.Typography.LINK_LARGE,
1026
- children: action.text
1020
+ }), action && /*#__PURE__*/jsxRuntime.jsx(Action, {
1021
+ action: action
1027
1022
  })]
1028
1023
  })]
1029
1024
  }), onDismiss && /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
@@ -1050,6 +1045,28 @@ function alertArrowClassNames(arrow) {
1050
1045
  return 'arrow';
1051
1046
  }
1052
1047
  }
1048
+ function Action({
1049
+ action
1050
+ }) {
1051
+ if ('href' in action) {
1052
+ return /*#__PURE__*/jsxRuntime.jsx(Link, {
1053
+ href: action.href,
1054
+ className: "m-t-1",
1055
+ "aria-label": action['aria-label'],
1056
+ target: action.target,
1057
+ type: exports.Typography.LINK_LARGE,
1058
+ onClick: action.onClick,
1059
+ children: action.text
1060
+ });
1061
+ }
1062
+ return /*#__PURE__*/jsxRuntime.jsx("button", {
1063
+ type: "button",
1064
+ "aria-label": action['aria-label'],
1065
+ className: "btn-unstyled np-text-link-large m-t-1",
1066
+ onClick: action.onClick,
1067
+ children: action.text
1068
+ });
1069
+ }
1053
1070
 
1054
1071
  // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
1055
1072
  exports.AvatarType = void 0;