@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.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useSyncExternalStore, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import { ChevronUp, CrossCircleFill, Cross,
|
|
5
|
+
import { ChevronUp, CrossCircleFill, Cross, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, NavigateAway, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, AlertCircle, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle } from '@transferwise/icons';
|
|
6
6
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import commonmark from 'commonmark';
|
|
@@ -18,7 +18,6 @@ import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, Floa
|
|
|
18
18
|
import { usePreventScroll } from '@react-aria/overlays';
|
|
19
19
|
import { usePopper } from 'react-popper';
|
|
20
20
|
import { Flag, Illustration } from '@wise/art';
|
|
21
|
-
import { useId as useId$1 } from '@radix-ui/react-id';
|
|
22
21
|
import clamp$2 from 'lodash.clamp';
|
|
23
22
|
import debounce from 'lodash.debounce';
|
|
24
23
|
import requiredIf from 'react-required-if';
|
|
@@ -701,40 +700,6 @@ const CloseButton = /*#__PURE__*/forwardRef(function CloseButton({
|
|
|
701
700
|
});
|
|
702
701
|
});
|
|
703
702
|
|
|
704
|
-
var messages$c = defineMessages({
|
|
705
|
-
opensInNewTab: {
|
|
706
|
-
id: "neptune.Link.opensInNewTab"
|
|
707
|
-
}
|
|
708
|
-
});
|
|
709
|
-
|
|
710
|
-
const Link = ({
|
|
711
|
-
className,
|
|
712
|
-
children,
|
|
713
|
-
href,
|
|
714
|
-
target,
|
|
715
|
-
type,
|
|
716
|
-
'aria-label': ariaLabel,
|
|
717
|
-
onClick,
|
|
718
|
-
...props
|
|
719
|
-
}) => {
|
|
720
|
-
const isBlank = target === '_blank';
|
|
721
|
-
const {
|
|
722
|
-
formatMessage
|
|
723
|
-
} = useIntl();
|
|
724
|
-
return /*#__PURE__*/jsxs("a", {
|
|
725
|
-
href: href,
|
|
726
|
-
target: target,
|
|
727
|
-
className: classNames('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className),
|
|
728
|
-
"aria-label": ariaLabel,
|
|
729
|
-
rel: isBlank ? 'noreferrer' : undefined,
|
|
730
|
-
onClick: onClick,
|
|
731
|
-
...props,
|
|
732
|
-
children: [children, " ", isBlank && /*#__PURE__*/jsx(NavigateAway, {
|
|
733
|
-
title: formatMessage(messages$c.opensInNewTab)
|
|
734
|
-
})]
|
|
735
|
-
});
|
|
736
|
-
};
|
|
737
|
-
|
|
738
703
|
const iconTypeMap = {
|
|
739
704
|
positive: Check,
|
|
740
705
|
neutral: Info$1,
|
|
@@ -881,6 +846,64 @@ InlineMarkdown.defaultProps = {
|
|
|
881
846
|
className: undefined
|
|
882
847
|
};
|
|
883
848
|
|
|
849
|
+
var messages$c = defineMessages({
|
|
850
|
+
opensInNewTab: {
|
|
851
|
+
id: "neptune.Link.opensInNewTab"
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
|
|
855
|
+
const Link = ({
|
|
856
|
+
className,
|
|
857
|
+
children,
|
|
858
|
+
href,
|
|
859
|
+
target,
|
|
860
|
+
type,
|
|
861
|
+
'aria-label': ariaLabel,
|
|
862
|
+
onClick,
|
|
863
|
+
...props
|
|
864
|
+
}) => {
|
|
865
|
+
const isBlank = target === '_blank';
|
|
866
|
+
const {
|
|
867
|
+
formatMessage
|
|
868
|
+
} = useIntl();
|
|
869
|
+
return /*#__PURE__*/jsxs("a", {
|
|
870
|
+
href: href,
|
|
871
|
+
target: target,
|
|
872
|
+
className: classNames('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className),
|
|
873
|
+
"aria-label": ariaLabel,
|
|
874
|
+
rel: isBlank ? 'noreferrer' : undefined,
|
|
875
|
+
onClick: onClick,
|
|
876
|
+
...props,
|
|
877
|
+
children: [children, " ", isBlank && /*#__PURE__*/jsx(NavigateAway, {
|
|
878
|
+
title: formatMessage(messages$c.opensInNewTab)
|
|
879
|
+
})]
|
|
880
|
+
});
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
function Action({
|
|
884
|
+
action,
|
|
885
|
+
className
|
|
886
|
+
}) {
|
|
887
|
+
if ('href' in action) {
|
|
888
|
+
return /*#__PURE__*/jsx(Link, {
|
|
889
|
+
href: action.href,
|
|
890
|
+
className: className,
|
|
891
|
+
"aria-label": action['aria-label'],
|
|
892
|
+
target: action.target,
|
|
893
|
+
type: Typography.LINK_LARGE,
|
|
894
|
+
onClick: action.onClick,
|
|
895
|
+
children: action.text
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
return /*#__PURE__*/jsx("button", {
|
|
899
|
+
type: "button",
|
|
900
|
+
"aria-label": action['aria-label'],
|
|
901
|
+
className: classNames('btn-unstyled np-text-link-large', className),
|
|
902
|
+
onClick: action.onClick,
|
|
903
|
+
children: action.text
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
|
|
884
907
|
var AlertArrowPosition;
|
|
885
908
|
(function (AlertArrowPosition) {
|
|
886
909
|
AlertArrowPosition["TOP_LEFT"] = "up-left";
|
|
@@ -987,7 +1010,8 @@ function Alert({
|
|
|
987
1010
|
})
|
|
988
1011
|
})]
|
|
989
1012
|
}), action && /*#__PURE__*/jsx(Action, {
|
|
990
|
-
action: action
|
|
1013
|
+
action: action,
|
|
1014
|
+
className: "m-t-1"
|
|
991
1015
|
})]
|
|
992
1016
|
})]
|
|
993
1017
|
}), onDismiss && /*#__PURE__*/jsx(CloseButton, {
|
|
@@ -1014,28 +1038,6 @@ function alertArrowClassNames(arrow) {
|
|
|
1014
1038
|
return 'arrow';
|
|
1015
1039
|
}
|
|
1016
1040
|
}
|
|
1017
|
-
function Action({
|
|
1018
|
-
action
|
|
1019
|
-
}) {
|
|
1020
|
-
if ('href' in action) {
|
|
1021
|
-
return /*#__PURE__*/jsx(Link, {
|
|
1022
|
-
href: action.href,
|
|
1023
|
-
className: "m-t-1",
|
|
1024
|
-
"aria-label": action['aria-label'],
|
|
1025
|
-
target: action.target,
|
|
1026
|
-
type: Typography.LINK_LARGE,
|
|
1027
|
-
onClick: action.onClick,
|
|
1028
|
-
children: action.text
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
return /*#__PURE__*/jsx("button", {
|
|
1032
|
-
type: "button",
|
|
1033
|
-
"aria-label": action['aria-label'],
|
|
1034
|
-
className: "btn-unstyled np-text-link-large m-t-1",
|
|
1035
|
-
onClick: action.onClick,
|
|
1036
|
-
children: action.text
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
1041
|
|
|
1040
1042
|
// TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
|
|
1041
1043
|
var AvatarType;
|
|
@@ -7797,7 +7799,8 @@ const Nudge = ({
|
|
|
7797
7799
|
persistDismissal,
|
|
7798
7800
|
isPreviouslyDismissed,
|
|
7799
7801
|
id,
|
|
7800
|
-
className
|
|
7802
|
+
className,
|
|
7803
|
+
action
|
|
7801
7804
|
}) => {
|
|
7802
7805
|
const [isDismissed, setIsDismissed] = useState(false);
|
|
7803
7806
|
const [isMounted, setIsMounted] = useState(false);
|
|
@@ -7858,6 +7861,9 @@ const Nudge = ({
|
|
|
7858
7861
|
className: "wds-nudge-link",
|
|
7859
7862
|
onClick: onClick,
|
|
7860
7863
|
children: link
|
|
7864
|
+
}), action && /*#__PURE__*/jsx(Action, {
|
|
7865
|
+
action: action,
|
|
7866
|
+
className: "m-t-1"
|
|
7861
7867
|
})]
|
|
7862
7868
|
}), onDismiss || persistDismissal ? /*#__PURE__*/jsx(CloseButton, {
|
|
7863
7869
|
className: "wds-nudge-control",
|
|
@@ -10120,7 +10126,7 @@ function Select({
|
|
|
10120
10126
|
}, [defaultOptions, search, searchValue]);
|
|
10121
10127
|
const selectableOptions = useMemo(() => options.filter(isActionableOption), [options]);
|
|
10122
10128
|
const focusedOption = selectableOptions[keyboardFocusedOptionIndex];
|
|
10123
|
-
const fallbackButtonId = useId
|
|
10129
|
+
const fallbackButtonId = useId();
|
|
10124
10130
|
const computedId = id || inputAttributes.id || fallbackButtonId;
|
|
10125
10131
|
const listboxId = `${computedId}-listbox`;
|
|
10126
10132
|
const searchBoxId = `${computedId}-searchbox`;
|
|
@@ -10831,13 +10837,9 @@ const Summary = ({
|
|
|
10831
10837
|
type: Typography.BODY_DEFAULT,
|
|
10832
10838
|
className: "d-block np-summary__description",
|
|
10833
10839
|
children: description
|
|
10834
|
-
}), action && /*#__PURE__*/jsx(
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
className: "np-summary__action",
|
|
10838
|
-
"aria-label": action['aria-label'],
|
|
10839
|
-
onClick: action.onClick,
|
|
10840
|
-
children: action.text
|
|
10840
|
+
}), action && /*#__PURE__*/jsx(Action, {
|
|
10841
|
+
action: action,
|
|
10842
|
+
className: "np-summary__action"
|
|
10841
10843
|
})]
|
|
10842
10844
|
}), info && /*#__PURE__*/jsx(Info, {
|
|
10843
10845
|
"aria-label": info['aria-label'],
|