@transferwise/components 46.35.0 → 46.36.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 +69 -67
- package/build/index.js.map +1 -1
- package/build/index.mjs +70 -68
- package/build/index.mjs.map +1 -1
- package/build/main.css +1 -0
- package/build/styles/main.css +1 -0
- package/build/styles/nudge/Nudge.css +1 -0
- package/build/types/common/action/Action.d.ts +15 -0
- package/build/types/common/action/Action.d.ts.map +1 -0
- package/build/types/nudge/Nudge.d.ts +4 -4
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/summary/Summary.d.ts +2 -4
- package/build/types/summary/Summary.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.tsx +2 -30
- package/src/common/action/Action.tsx +44 -0
- package/src/main.css +1 -0
- package/src/nudge/Nudge.css +1 -0
- package/src/nudge/Nudge.less +1 -0
- package/src/nudge/Nudge.story.tsx +34 -0
- package/src/nudge/Nudge.tsx +6 -4
- package/src/select/Select.js +1 -2
- package/src/summary/Summary.tsx +3 -15
package/build/index.js
CHANGED
|
@@ -19,7 +19,6 @@ var react = require('@floating-ui/react');
|
|
|
19
19
|
var overlays = require('@react-aria/overlays');
|
|
20
20
|
var reactPopper = require('react-popper');
|
|
21
21
|
var art = require('@wise/art');
|
|
22
|
-
var reactId = require('@radix-ui/react-id');
|
|
23
22
|
var clamp$2 = require('lodash.clamp');
|
|
24
23
|
var debounce = require('lodash.debounce');
|
|
25
24
|
var requiredIf = require('react-required-if');
|
|
@@ -731,40 +730,6 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
|
|
|
731
730
|
});
|
|
732
731
|
});
|
|
733
732
|
|
|
734
|
-
var messages$c = reactIntl.defineMessages({
|
|
735
|
-
opensInNewTab: {
|
|
736
|
-
id: "neptune.Link.opensInNewTab"
|
|
737
|
-
}
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
const Link = ({
|
|
741
|
-
className,
|
|
742
|
-
children,
|
|
743
|
-
href,
|
|
744
|
-
target,
|
|
745
|
-
type,
|
|
746
|
-
'aria-label': ariaLabel,
|
|
747
|
-
onClick,
|
|
748
|
-
...props
|
|
749
|
-
}) => {
|
|
750
|
-
const isBlank = target === '_blank';
|
|
751
|
-
const {
|
|
752
|
-
formatMessage
|
|
753
|
-
} = reactIntl.useIntl();
|
|
754
|
-
return /*#__PURE__*/jsxRuntime.jsxs("a", {
|
|
755
|
-
href: href,
|
|
756
|
-
target: target,
|
|
757
|
-
className: classNames__default.default('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className),
|
|
758
|
-
"aria-label": ariaLabel,
|
|
759
|
-
rel: isBlank ? 'noreferrer' : undefined,
|
|
760
|
-
onClick: onClick,
|
|
761
|
-
...props,
|
|
762
|
-
children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
|
|
763
|
-
title: formatMessage(messages$c.opensInNewTab)
|
|
764
|
-
})]
|
|
765
|
-
});
|
|
766
|
-
};
|
|
767
|
-
|
|
768
733
|
const iconTypeMap = {
|
|
769
734
|
positive: icons.Check,
|
|
770
735
|
neutral: icons.Info,
|
|
@@ -911,6 +876,64 @@ InlineMarkdown.defaultProps = {
|
|
|
911
876
|
className: undefined
|
|
912
877
|
};
|
|
913
878
|
|
|
879
|
+
var messages$c = reactIntl.defineMessages({
|
|
880
|
+
opensInNewTab: {
|
|
881
|
+
id: "neptune.Link.opensInNewTab"
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
|
|
885
|
+
const Link = ({
|
|
886
|
+
className,
|
|
887
|
+
children,
|
|
888
|
+
href,
|
|
889
|
+
target,
|
|
890
|
+
type,
|
|
891
|
+
'aria-label': ariaLabel,
|
|
892
|
+
onClick,
|
|
893
|
+
...props
|
|
894
|
+
}) => {
|
|
895
|
+
const isBlank = target === '_blank';
|
|
896
|
+
const {
|
|
897
|
+
formatMessage
|
|
898
|
+
} = reactIntl.useIntl();
|
|
899
|
+
return /*#__PURE__*/jsxRuntime.jsxs("a", {
|
|
900
|
+
href: href,
|
|
901
|
+
target: target,
|
|
902
|
+
className: classNames__default.default('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className),
|
|
903
|
+
"aria-label": ariaLabel,
|
|
904
|
+
rel: isBlank ? 'noreferrer' : undefined,
|
|
905
|
+
onClick: onClick,
|
|
906
|
+
...props,
|
|
907
|
+
children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
|
|
908
|
+
title: formatMessage(messages$c.opensInNewTab)
|
|
909
|
+
})]
|
|
910
|
+
});
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
function Action({
|
|
914
|
+
action,
|
|
915
|
+
className
|
|
916
|
+
}) {
|
|
917
|
+
if ('href' in action) {
|
|
918
|
+
return /*#__PURE__*/jsxRuntime.jsx(Link, {
|
|
919
|
+
href: action.href,
|
|
920
|
+
className: className,
|
|
921
|
+
"aria-label": action['aria-label'],
|
|
922
|
+
target: action.target,
|
|
923
|
+
type: exports.Typography.LINK_LARGE,
|
|
924
|
+
onClick: action.onClick,
|
|
925
|
+
children: action.text
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
929
|
+
type: "button",
|
|
930
|
+
"aria-label": action['aria-label'],
|
|
931
|
+
className: classNames__default.default('btn-unstyled np-text-link-large', className),
|
|
932
|
+
onClick: action.onClick,
|
|
933
|
+
children: action.text
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
|
|
914
937
|
exports.AlertArrowPosition = void 0;
|
|
915
938
|
(function (AlertArrowPosition) {
|
|
916
939
|
AlertArrowPosition["TOP_LEFT"] = "up-left";
|
|
@@ -1017,7 +1040,8 @@ function Alert({
|
|
|
1017
1040
|
})
|
|
1018
1041
|
})]
|
|
1019
1042
|
}), action && /*#__PURE__*/jsxRuntime.jsx(Action, {
|
|
1020
|
-
action: action
|
|
1043
|
+
action: action,
|
|
1044
|
+
className: "m-t-1"
|
|
1021
1045
|
})]
|
|
1022
1046
|
})]
|
|
1023
1047
|
}), onDismiss && /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
@@ -1044,28 +1068,6 @@ function alertArrowClassNames(arrow) {
|
|
|
1044
1068
|
return 'arrow';
|
|
1045
1069
|
}
|
|
1046
1070
|
}
|
|
1047
|
-
function Action({
|
|
1048
|
-
action
|
|
1049
|
-
}) {
|
|
1050
|
-
if ('href' in action) {
|
|
1051
|
-
return /*#__PURE__*/jsxRuntime.jsx(Link, {
|
|
1052
|
-
href: action.href,
|
|
1053
|
-
className: "m-t-1",
|
|
1054
|
-
"aria-label": action['aria-label'],
|
|
1055
|
-
target: action.target,
|
|
1056
|
-
type: exports.Typography.LINK_LARGE,
|
|
1057
|
-
onClick: action.onClick,
|
|
1058
|
-
children: action.text
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
1062
|
-
type: "button",
|
|
1063
|
-
"aria-label": action['aria-label'],
|
|
1064
|
-
className: "btn-unstyled np-text-link-large m-t-1",
|
|
1065
|
-
onClick: action.onClick,
|
|
1066
|
-
children: action.text
|
|
1067
|
-
});
|
|
1068
|
-
}
|
|
1069
1071
|
|
|
1070
1072
|
// TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
|
|
1071
1073
|
exports.AvatarType = void 0;
|
|
@@ -7827,7 +7829,8 @@ const Nudge = ({
|
|
|
7827
7829
|
persistDismissal,
|
|
7828
7830
|
isPreviouslyDismissed,
|
|
7829
7831
|
id,
|
|
7830
|
-
className
|
|
7832
|
+
className,
|
|
7833
|
+
action
|
|
7831
7834
|
}) => {
|
|
7832
7835
|
const [isDismissed, setIsDismissed] = React.useState(false);
|
|
7833
7836
|
const [isMounted, setIsMounted] = React.useState(false);
|
|
@@ -7888,6 +7891,9 @@ const Nudge = ({
|
|
|
7888
7891
|
className: "wds-nudge-link",
|
|
7889
7892
|
onClick: onClick,
|
|
7890
7893
|
children: link
|
|
7894
|
+
}), action && /*#__PURE__*/jsxRuntime.jsx(Action, {
|
|
7895
|
+
action: action,
|
|
7896
|
+
className: "m-t-1"
|
|
7891
7897
|
})]
|
|
7892
7898
|
}), onDismiss || persistDismissal ? /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
7893
7899
|
className: "wds-nudge-control",
|
|
@@ -10150,7 +10156,7 @@ function Select({
|
|
|
10150
10156
|
}, [defaultOptions, search, searchValue]);
|
|
10151
10157
|
const selectableOptions = React.useMemo(() => options.filter(isActionableOption), [options]);
|
|
10152
10158
|
const focusedOption = selectableOptions[keyboardFocusedOptionIndex];
|
|
10153
|
-
const fallbackButtonId =
|
|
10159
|
+
const fallbackButtonId = React.useId();
|
|
10154
10160
|
const computedId = id || inputAttributes.id || fallbackButtonId;
|
|
10155
10161
|
const listboxId = `${computedId}-listbox`;
|
|
10156
10162
|
const searchBoxId = `${computedId}-searchbox`;
|
|
@@ -10861,13 +10867,9 @@ const Summary = ({
|
|
|
10861
10867
|
type: exports.Typography.BODY_DEFAULT,
|
|
10862
10868
|
className: "d-block np-summary__description",
|
|
10863
10869
|
children: description
|
|
10864
|
-
}), action && /*#__PURE__*/jsxRuntime.jsx(
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
className: "np-summary__action",
|
|
10868
|
-
"aria-label": action['aria-label'],
|
|
10869
|
-
onClick: action.onClick,
|
|
10870
|
-
children: action.text
|
|
10870
|
+
}), action && /*#__PURE__*/jsxRuntime.jsx(Action, {
|
|
10871
|
+
action: action,
|
|
10872
|
+
className: "np-summary__action"
|
|
10871
10873
|
})]
|
|
10872
10874
|
}), info && /*#__PURE__*/jsxRuntime.jsx(Info, {
|
|
10873
10875
|
"aria-label": info['aria-label'],
|