@transferwise/components 0.0.0-experimental-6c73115 → 0.0.0-experimental-e51a923
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 +213 -368
- package/build/index.js.map +1 -1
- package/build/index.mjs +215 -370
- package/build/index.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts +47 -58
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/alert/index.d.ts +2 -1
- package/build/types/alert/index.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts +0 -1
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +2 -4
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/alert/{Alert.spec.js → Alert.spec.tsx} +43 -40
- package/src/alert/Alert.story.tsx +1 -2
- package/src/alert/Alert.tsx +218 -0
- package/src/alert/index.ts +2 -0
- package/src/common/propsValues/sentiment.ts +0 -10
- package/src/index.ts +1 -1
- package/src/inlineAlert/InlineAlert.spec.tsx +0 -7
- package/src/inlineAlert/InlineAlert.tsx +19 -47
- package/src/inputs/SelectInput.tsx +0 -1
- package/src/inputs/_BottomSheet.tsx +54 -44
- package/src/inputs/_Popover.tsx +23 -20
- package/src/statusIcon/StatusIcon.tsx +14 -14
- package/build/types/alert/withArrow/alertArrowPositions.d.ts +0 -9
- package/build/types/alert/withArrow/alertArrowPositions.d.ts.map +0 -1
- package/build/types/alert/withArrow/index.d.ts +0 -3
- package/build/types/alert/withArrow/index.d.ts.map +0 -1
- package/build/types/alert/withArrow/withArrow.d.ts +0 -11
- package/build/types/alert/withArrow/withArrow.d.ts.map +0 -1
- package/src/alert/Alert.js +0 -196
- package/src/alert/index.js +0 -1
- package/src/alert/withArrow/alertArrowPositions.ts +0 -9
- package/src/alert/withArrow/index.js +0 -2
- package/src/alert/withArrow/withArrow.js +0 -50
- package/src/alert/withArrow/withArrow.spec.js +0 -51
package/build/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { forwardRef, cloneElement, useState, useRef, useMemo,
|
|
4
|
+
import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, useCallback, useLayoutEffect, createContext, useContext, useImperativeHandle, createElement, Component, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { useId } from '@radix-ui/react-id';
|
|
6
|
-
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$
|
|
6
|
+
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, ArrowLeft, QuestionMarkCircle, AlertCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, AlertCircleFill } from '@transferwise/icons';
|
|
7
7
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import commonmark from 'commonmark';
|
|
9
10
|
import { useTheme, ThemeProvider } from '@wise/components-theming';
|
|
10
11
|
import { formatDate, formatNumber, formatMoney, formatAmount } from '@transferwise/formatting';
|
|
11
12
|
import { Transition, Listbox } from '@headlessui/react';
|
|
12
13
|
import mergeProps from 'merge-props';
|
|
13
14
|
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';
|
|
14
15
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, offset, flip, shift, size, autoUpdate } from '@floating-ui/react';
|
|
16
|
+
import { FocusScope } from '@react-aria/focus';
|
|
15
17
|
import { usePreventScroll } from '@react-aria/overlays';
|
|
16
18
|
import { CSSTransition } from 'react-transition-group';
|
|
17
19
|
import { usePopper } from 'react-popper';
|
|
18
20
|
import throttle from 'lodash.throttle';
|
|
19
21
|
import { createPortal } from 'react-dom';
|
|
20
|
-
import { FocusScope } from '@react-aria/focus';
|
|
21
22
|
import { isUndefined, isKey, isNumber, isEmpty, isNull } from '@transferwise/neptune-validation';
|
|
22
|
-
import commonmark from 'commonmark';
|
|
23
23
|
import { Flag, Illustration } from '@wise/art';
|
|
24
24
|
import clamp$2 from 'lodash.clamp';
|
|
25
25
|
import debounce from 'lodash.debounce';
|
|
@@ -775,22 +775,22 @@ const Link = ({
|
|
|
775
775
|
});
|
|
776
776
|
};
|
|
777
777
|
|
|
778
|
+
const iconTypeMap = {
|
|
779
|
+
positive: Check,
|
|
780
|
+
neutral: Info$1,
|
|
781
|
+
warning: Alert$1,
|
|
782
|
+
negative: Cross,
|
|
783
|
+
pending: ClockBorderless,
|
|
784
|
+
info: Info$1,
|
|
785
|
+
error: Cross,
|
|
786
|
+
success: Check
|
|
787
|
+
};
|
|
778
788
|
const StatusIcon = ({
|
|
779
|
-
sentiment =
|
|
780
|
-
size =
|
|
789
|
+
sentiment = 'neutral',
|
|
790
|
+
size = 'md'
|
|
781
791
|
}) => {
|
|
782
|
-
const iconTypeMap = {
|
|
783
|
-
[Sentiment.POSITIVE]: Check,
|
|
784
|
-
[Sentiment.NEUTRAL]: Info$1,
|
|
785
|
-
[Sentiment.WARNING]: Alert$2,
|
|
786
|
-
[Sentiment.NEGATIVE]: Cross,
|
|
787
|
-
[Sentiment.PENDING]: ClockBorderless,
|
|
788
|
-
[Sentiment.INFO]: Info$1,
|
|
789
|
-
[Sentiment.ERROR]: Cross,
|
|
790
|
-
[Sentiment.SUCCESS]: Check
|
|
791
|
-
};
|
|
792
|
-
const iconColor = [Sentiment.WARNING, Sentiment.PENDING].includes(sentiment) ? 'dark' : 'light';
|
|
793
792
|
const Icon = iconTypeMap[sentiment];
|
|
793
|
+
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
794
794
|
return /*#__PURE__*/jsx("span", {
|
|
795
795
|
"data-testid": "status-icon",
|
|
796
796
|
className: classNames('status-circle', 'status-circle-' + size, sentiment),
|
|
@@ -800,7 +800,7 @@ const StatusIcon = ({
|
|
|
800
800
|
});
|
|
801
801
|
};
|
|
802
802
|
|
|
803
|
-
function logActionRequired
|
|
803
|
+
function logActionRequired(message) {
|
|
804
804
|
if (['development', 'test'].includes(process?.env?.NODE_ENV)) {
|
|
805
805
|
// eslint-disable-next-line no-console
|
|
806
806
|
console.warn(message);
|
|
@@ -808,48 +808,10 @@ function logActionRequired$1(message) {
|
|
|
808
808
|
}
|
|
809
809
|
function logActionRequiredIf(message, conditional) {
|
|
810
810
|
if (conditional) {
|
|
811
|
-
logActionRequired
|
|
811
|
+
logActionRequired(message);
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
-
const deprecatedMessage = ({
|
|
816
|
-
component,
|
|
817
|
-
propName,
|
|
818
|
-
message,
|
|
819
|
-
expiryDate
|
|
820
|
-
}) => {
|
|
821
|
-
const messages = [`${component} has deprecated the use of ${propName}.`];
|
|
822
|
-
if (message) {
|
|
823
|
-
messages.push(message);
|
|
824
|
-
}
|
|
825
|
-
if (expiryDate) {
|
|
826
|
-
messages.push(`${propName} will be removed on or after ${expiryDate.toLocaleString('en-GB', {
|
|
827
|
-
year: 'numeric',
|
|
828
|
-
month: 'numeric',
|
|
829
|
-
day: 'numeric'
|
|
830
|
-
})}`);
|
|
831
|
-
}
|
|
832
|
-
return messages.join(' ');
|
|
833
|
-
};
|
|
834
|
-
const deprecated = (validator, {
|
|
835
|
-
component,
|
|
836
|
-
message = '',
|
|
837
|
-
newProp: newProperty = null,
|
|
838
|
-
expiryDate = null
|
|
839
|
-
}) => (props, propertyName, ...rest) => {
|
|
840
|
-
const newPropertyMessage = newProperty ? `Please use ${newProperty} instead.` : message;
|
|
841
|
-
if (props[propertyName] != null && typeof props[propertyName] !== 'undefined') {
|
|
842
|
-
logActionRequired$1(deprecatedMessage({
|
|
843
|
-
component,
|
|
844
|
-
propName: propertyName,
|
|
845
|
-
message: newPropertyMessage,
|
|
846
|
-
expiryDate
|
|
847
|
-
}));
|
|
848
|
-
}
|
|
849
|
-
return validator(props, propertyName, ...rest);
|
|
850
|
-
};
|
|
851
|
-
var deprecated$1 = deprecated;
|
|
852
|
-
|
|
853
815
|
const reader = new commonmark.Parser();
|
|
854
816
|
const writer = new commonmark.HtmlRenderer({
|
|
855
817
|
safe: true
|
|
@@ -869,7 +831,7 @@ function Markdown({
|
|
|
869
831
|
const linkTarget = config?.link?.target ?? '_self';
|
|
870
832
|
const paragraphClass = config?.paragraph?.className ?? '';
|
|
871
833
|
if (allowList != null && blockList != null) {
|
|
872
|
-
logActionRequired
|
|
834
|
+
logActionRequired('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
|
|
873
835
|
}
|
|
874
836
|
const parser = nodes => {
|
|
875
837
|
const parsed = reader.parse(nodes);
|
|
@@ -930,146 +892,98 @@ InlineMarkdown.defaultProps = {
|
|
|
930
892
|
};
|
|
931
893
|
var InlineMarkdown$1 = InlineMarkdown;
|
|
932
894
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
};
|
|
953
|
-
AlertWithArrow.defaultProps = {
|
|
954
|
-
className: undefined
|
|
955
|
-
};
|
|
956
|
-
return AlertWithArrow;
|
|
895
|
+
var AlertArrowPosition;
|
|
896
|
+
(function (AlertArrowPosition) {
|
|
897
|
+
AlertArrowPosition["TOP_LEFT"] = "up-left";
|
|
898
|
+
AlertArrowPosition["TOP"] = "up-center";
|
|
899
|
+
AlertArrowPosition["TOP_RIGHT"] = "up-right";
|
|
900
|
+
AlertArrowPosition["BOTTOM_LEFT"] = "down-left";
|
|
901
|
+
AlertArrowPosition["BOTTOM"] = "down-center";
|
|
902
|
+
AlertArrowPosition["BOTTOM_RIGHT"] = "down-right";
|
|
903
|
+
})(AlertArrowPosition || (AlertArrowPosition = {}));
|
|
904
|
+
function resolveType(type) {
|
|
905
|
+
switch (type) {
|
|
906
|
+
case 'success':
|
|
907
|
+
return 'positive';
|
|
908
|
+
case 'info':
|
|
909
|
+
return 'neutral';
|
|
910
|
+
case 'error':
|
|
911
|
+
return 'negative';
|
|
912
|
+
}
|
|
913
|
+
return type;
|
|
957
914
|
}
|
|
958
|
-
function
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
return classes.concat('arrow-bottom', 'arrow-right');
|
|
976
|
-
case TOP:
|
|
977
|
-
return classes.concat('arrow-center');
|
|
978
|
-
case TOP_RIGHT:
|
|
979
|
-
return classes.concat('arrow-right');
|
|
980
|
-
case TOP_LEFT:
|
|
981
|
-
default:
|
|
982
|
-
return classes;
|
|
915
|
+
function Alert({
|
|
916
|
+
arrow,
|
|
917
|
+
action,
|
|
918
|
+
children,
|
|
919
|
+
className,
|
|
920
|
+
dismissible,
|
|
921
|
+
icon,
|
|
922
|
+
onDismiss,
|
|
923
|
+
message,
|
|
924
|
+
size,
|
|
925
|
+
title,
|
|
926
|
+
type = 'neutral',
|
|
927
|
+
variant = 'desktop'
|
|
928
|
+
}) {
|
|
929
|
+
useEffect(() => {
|
|
930
|
+
if (arrow !== undefined) {
|
|
931
|
+
logActionRequired("Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.");
|
|
983
932
|
}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
const deprecatedTypeMap$1 = {
|
|
989
|
-
[Sentiment.SUCCESS]: Sentiment.POSITIVE,
|
|
990
|
-
[Sentiment.INFO]: Sentiment.NEUTRAL,
|
|
991
|
-
[Sentiment.ERROR]: Sentiment.NEGATIVE
|
|
992
|
-
};
|
|
993
|
-
const Alert = props => {
|
|
994
|
-
const {
|
|
995
|
-
isModern
|
|
996
|
-
} = useTheme();
|
|
997
|
-
const iconTypeMap = {
|
|
998
|
-
[Sentiment.POSITIVE]: CheckCircle,
|
|
999
|
-
[Sentiment.NEUTRAL]: InfoCircle,
|
|
1000
|
-
[Sentiment.WARNING]: Warning,
|
|
1001
|
-
[Sentiment.NEGATIVE]: CrossCircle,
|
|
1002
|
-
[Sentiment.PENDING]: Clock
|
|
1003
|
-
};
|
|
1004
|
-
const [shouldFire, setShouldFire] = useState(false);
|
|
1005
|
-
const {
|
|
1006
|
-
arrow,
|
|
1007
|
-
action,
|
|
1008
|
-
children,
|
|
1009
|
-
className,
|
|
1010
|
-
icon,
|
|
1011
|
-
onDismiss,
|
|
1012
|
-
message,
|
|
1013
|
-
title,
|
|
1014
|
-
type,
|
|
1015
|
-
variant
|
|
1016
|
-
} = props;
|
|
1017
|
-
const closeButtonReference = useRef(null);
|
|
1018
|
-
if (arrow) {
|
|
1019
|
-
const AlertWithArrow = withArrow(Alert, arrow);
|
|
1020
|
-
return /*#__PURE__*/jsx(AlertWithArrow, {
|
|
1021
|
-
...props
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
logActionRequired(props);
|
|
1025
|
-
const mappedType = deprecatedTypeMap$1[type] || type;
|
|
1026
|
-
const Icon = iconTypeMap[mappedType];
|
|
1027
|
-
function generateIcon() {
|
|
1028
|
-
if (icon) {
|
|
1029
|
-
return /*#__PURE__*/jsx("div", {
|
|
1030
|
-
className: "alert__icon",
|
|
1031
|
-
children: icon
|
|
1032
|
-
});
|
|
933
|
+
}, [arrow]);
|
|
934
|
+
useEffect(() => {
|
|
935
|
+
if (children !== undefined) {
|
|
936
|
+
logActionRequired("Alert component doesn't support 'children' anymore, use 'message' instead.");
|
|
1033
937
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
});
|
|
1039
|
-
} else {
|
|
1040
|
-
return /*#__PURE__*/jsx(Icon, {
|
|
1041
|
-
size: 24
|
|
1042
|
-
});
|
|
938
|
+
}, [children]);
|
|
939
|
+
useEffect(() => {
|
|
940
|
+
if (dismissible !== undefined) {
|
|
941
|
+
logActionRequired("Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.");
|
|
1043
942
|
}
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
943
|
+
}, [dismissible]);
|
|
944
|
+
useEffect(() => {
|
|
945
|
+
if (size !== undefined) {
|
|
946
|
+
logActionRequired("Alert component doesn't support 'size' anymore, please remove that prop.");
|
|
947
|
+
}
|
|
948
|
+
}, [size]);
|
|
949
|
+
const resolvedType = resolveType(type);
|
|
950
|
+
useEffect(() => {
|
|
951
|
+
if (resolvedType !== type) {
|
|
952
|
+
logActionRequired(`Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`);
|
|
953
|
+
}
|
|
954
|
+
}, [resolvedType, type]);
|
|
955
|
+
const [shouldFire, setShouldFire] = useState(false);
|
|
956
|
+
const closeButtonReference = useRef(null);
|
|
957
|
+
return /*#__PURE__*/jsxs("div", {
|
|
958
|
+
className: classNames('alert d-flex', `alert-${resolvedType}`, arrow != null && alertArrowClassNames(arrow), className),
|
|
959
|
+
"data-testid": "alert",
|
|
960
|
+
onTouchStart: () => setShouldFire(true),
|
|
961
|
+
onTouchEnd: event => {
|
|
962
|
+
if (shouldFire && action &&
|
|
1049
963
|
// Check if current event is triggered from closeButton
|
|
1050
|
-
|
|
1051
|
-
if (action
|
|
1052
|
-
window.top
|
|
964
|
+
event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
|
|
965
|
+
if (action.target === '_blank') {
|
|
966
|
+
window.top?.open(action.href);
|
|
1053
967
|
} else {
|
|
1054
|
-
window.top
|
|
968
|
+
window.top?.location.assign(action.href);
|
|
1055
969
|
}
|
|
1056
970
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
return /*#__PURE__*/jsxs("div", {
|
|
1061
|
-
className: classNames('alert d-flex', `alert-${mappedType}`, className),
|
|
1062
|
-
"data-testid": "alert",
|
|
1063
|
-
onTouchStart: handleTouchStart,
|
|
1064
|
-
onTouchEnd: handleTouchEnd,
|
|
1065
|
-
onTouchMove: handleTouchMove,
|
|
971
|
+
setShouldFire(false);
|
|
972
|
+
},
|
|
973
|
+
onTouchMove: () => setShouldFire(false),
|
|
1066
974
|
children: [/*#__PURE__*/jsxs("div", {
|
|
1067
975
|
className: classNames('alert__content', 'd-flex', 'flex-grow-1', variant),
|
|
1068
976
|
"data-testid": variant,
|
|
1069
|
-
children: [
|
|
977
|
+
children: [icon ? /*#__PURE__*/jsx("div", {
|
|
978
|
+
className: "alert__icon",
|
|
979
|
+
children: icon
|
|
980
|
+
}) : /*#__PURE__*/jsx(StatusIcon, {
|
|
981
|
+
size: Size.LARGE,
|
|
982
|
+
sentiment: resolvedType
|
|
983
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1070
984
|
className: "alert__message",
|
|
1071
985
|
children: [/*#__PURE__*/jsxs("div", {
|
|
1072
|
-
role: Sentiment.NEGATIVE ===
|
|
986
|
+
role: Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status',
|
|
1073
987
|
children: [title && /*#__PURE__*/jsx(Title, {
|
|
1074
988
|
className: "m-b-1",
|
|
1075
989
|
type: Typography.TITLE_BODY,
|
|
@@ -1097,72 +1011,24 @@ const Alert = props => {
|
|
|
1097
1011
|
onClick: onDismiss
|
|
1098
1012
|
})]
|
|
1099
1013
|
});
|
|
1100
|
-
};
|
|
1101
|
-
const deprecatedTypeMapMessage$1 = {
|
|
1102
|
-
[Sentiment.SUCCESS]: 'Sentiment.POSITIVE',
|
|
1103
|
-
[Sentiment.INFO]: 'Sentiment.NEUTRAL',
|
|
1104
|
-
[Sentiment.ERROR]: 'Sentiment.NEGATIVE'
|
|
1105
|
-
};
|
|
1106
|
-
const deprecatedTypes$1 = Object.keys(deprecatedTypeMap$1);
|
|
1107
|
-
function logActionRequired({
|
|
1108
|
-
size,
|
|
1109
|
-
type
|
|
1110
|
-
}) {
|
|
1111
|
-
logActionRequiredIf('Alert no longer supports any possible variations in size. Please remove the `size` prop.', !!size);
|
|
1112
|
-
logActionRequiredIf(`Alert has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage$1[type]}.`, deprecatedTypes$1.includes(type));
|
|
1113
1014
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
/** The presence of the onDismiss handler will trigger the visibility of the close button */
|
|
1132
|
-
onDismiss: PropTypes.func,
|
|
1133
|
-
/** The type dictates which icon and colour will be used */
|
|
1134
|
-
type: PropTypes.oneOf(['negative', 'neutral', 'positive', 'warning', 'info', 'error', 'success']),
|
|
1135
|
-
variant: PropTypes.oneOf(['desktop', 'mobile']),
|
|
1136
|
-
/** @deprecated no arrow for `Alert` component anymore, consider to use [`InlineAlert`](https://transferwise.github.io/neptune-web/components/alerts/InlineAlert) component */
|
|
1137
|
-
arrow: deprecated$1(PropTypes.oneOf(['up-left', 'up-center', 'up-right', 'down-left', 'down-center', 'down-right']), {
|
|
1138
|
-
component: 'Alert',
|
|
1139
|
-
expiryDate: new Date('03-01-2021')
|
|
1140
|
-
}),
|
|
1141
|
-
/** @deprecated use `message` property instead */
|
|
1142
|
-
children: deprecated$1(requiredIf(PropTypes.node, ({
|
|
1143
|
-
message
|
|
1144
|
-
}) => !message), {
|
|
1145
|
-
component: 'Alert',
|
|
1146
|
-
message: 'You should now use the `message` prop. Be aware `message` only accepts plain text or text with **bold** markdown.',
|
|
1147
|
-
expiryDate: new Date('03-01-2021')
|
|
1148
|
-
}),
|
|
1149
|
-
/** @deprecated use `onDismiss` instead */
|
|
1150
|
-
dismissible: deprecated$1(PropTypes.bool, {
|
|
1151
|
-
component: 'Alert',
|
|
1152
|
-
message: 'The Alert will now be considered dismissible if an `onDismiss` hander is present.',
|
|
1153
|
-
expiryDate: new Date('03-01-2021')
|
|
1154
|
-
})
|
|
1155
|
-
};
|
|
1156
|
-
Alert.defaultProps = {
|
|
1157
|
-
action: undefined,
|
|
1158
|
-
arrow: undefined,
|
|
1159
|
-
className: undefined,
|
|
1160
|
-
dismissible: undefined,
|
|
1161
|
-
icon: undefined,
|
|
1162
|
-
type: Sentiment.NEUTRAL,
|
|
1163
|
-
variant: Variant.DESKTOP
|
|
1164
|
-
};
|
|
1165
|
-
var Alert$1 = Alert;
|
|
1015
|
+
function alertArrowClassNames(arrow) {
|
|
1016
|
+
switch (arrow) {
|
|
1017
|
+
case 'down-center':
|
|
1018
|
+
return 'arrow arrow-bottom arrow-center';
|
|
1019
|
+
case 'down-left':
|
|
1020
|
+
return 'arrow arrow-bottom arrow-left';
|
|
1021
|
+
case 'down-right':
|
|
1022
|
+
return 'arrow arrow-bottom arrow-right';
|
|
1023
|
+
case 'up-center':
|
|
1024
|
+
return 'arrow arrow-center';
|
|
1025
|
+
case 'up-right':
|
|
1026
|
+
return 'arrow arrow-right';
|
|
1027
|
+
case 'up-left':
|
|
1028
|
+
default:
|
|
1029
|
+
return 'arrow';
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1166
1032
|
|
|
1167
1033
|
// TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
|
|
1168
1034
|
var AvatarType;
|
|
@@ -1388,7 +1254,6 @@ const FocusBoundary = ({
|
|
|
1388
1254
|
})
|
|
1389
1255
|
});
|
|
1390
1256
|
};
|
|
1391
|
-
var FocusBoundary$1 = FocusBoundary;
|
|
1392
1257
|
|
|
1393
1258
|
function withNextPortalWrapper(Component) {
|
|
1394
1259
|
return function (props) {
|
|
@@ -1530,7 +1395,7 @@ const Dimmer = ({
|
|
|
1530
1395
|
onExited: onExited,
|
|
1531
1396
|
children: /*#__PURE__*/jsx(DimmerContentWrapper, {
|
|
1532
1397
|
scrollBody: !transparent,
|
|
1533
|
-
children: /*#__PURE__*/jsx(FocusBoundary
|
|
1398
|
+
children: /*#__PURE__*/jsx(FocusBoundary, {
|
|
1534
1399
|
children: /*#__PURE__*/jsx("div", {
|
|
1535
1400
|
ref: dimmerReference,
|
|
1536
1401
|
className: classNames('dimmer', {
|
|
@@ -2162,7 +2027,7 @@ var messages$b = defineMessages({
|
|
|
2162
2027
|
}
|
|
2163
2028
|
});
|
|
2164
2029
|
|
|
2165
|
-
const typeClassMap
|
|
2030
|
+
const typeClassMap = {
|
|
2166
2031
|
[ControlType.ACCENT]: 'btn-accent',
|
|
2167
2032
|
[ControlType.POSITIVE]: 'btn-positive',
|
|
2168
2033
|
[ControlType.NEGATIVE]: 'btn-negative'
|
|
@@ -2246,7 +2111,7 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
2246
2111
|
},
|
|
2247
2112
|
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
2248
2113
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2249
|
-
typeClassMap
|
|
2114
|
+
typeClassMap[newType],
|
|
2250
2115
|
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
2251
2116
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2252
2117
|
priorityClassMap[newPriority], className);
|
|
@@ -2631,7 +2496,7 @@ const CircularButton = ({
|
|
|
2631
2496
|
type = ControlType.ACCENT,
|
|
2632
2497
|
...rest
|
|
2633
2498
|
}) => {
|
|
2634
|
-
const classes = classNames('btn np-btn', typeClassMap
|
|
2499
|
+
const classes = classNames('btn np-btn', typeClassMap[type], priorityClassMap[priority]);
|
|
2635
2500
|
const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/cloneElement(icon, {
|
|
2636
2501
|
size: 24
|
|
2637
2502
|
}) : icon;
|
|
@@ -5867,7 +5732,7 @@ function Popover$1({
|
|
|
5867
5732
|
const resolvedPlacement = resolvePlacement(preferredPlacement);
|
|
5868
5733
|
useEffect(() => {
|
|
5869
5734
|
if (resolvedPlacement !== preferredPlacement) {
|
|
5870
|
-
logActionRequired
|
|
5735
|
+
logActionRequired(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
|
|
5871
5736
|
}
|
|
5872
5737
|
}, [preferredPlacement, resolvedPlacement]);
|
|
5873
5738
|
const anchorReference = useRef(null);
|
|
@@ -5972,49 +5837,22 @@ const Info = ({
|
|
|
5972
5837
|
});
|
|
5973
5838
|
};
|
|
5974
5839
|
|
|
5975
|
-
|
|
5976
|
-
[Sentiment.ERROR]: 'danger',
|
|
5977
|
-
[Sentiment.NEGATIVE]: 'danger'
|
|
5978
|
-
};
|
|
5979
|
-
const InlineAlert = ({
|
|
5840
|
+
function InlineAlert({
|
|
5980
5841
|
id,
|
|
5981
|
-
type =
|
|
5842
|
+
type = 'neutral',
|
|
5982
5843
|
className,
|
|
5983
5844
|
children
|
|
5984
|
-
})
|
|
5985
|
-
const
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
role: "alert",
|
|
5992
|
-
id: id,
|
|
5993
|
-
className: classNames('alert alert-detach', typeClass, className),
|
|
5994
|
-
children: [(type === 'error' || type === 'negative') && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
5995
|
-
children: children
|
|
5996
|
-
})]
|
|
5997
|
-
});
|
|
5998
|
-
}
|
|
5999
|
-
const getAlertContents = ({
|
|
6000
|
-
children,
|
|
6001
|
-
className
|
|
6002
|
-
}) => {
|
|
6003
|
-
return /*#__PURE__*/jsx("div", {
|
|
6004
|
-
role: "alert",
|
|
6005
|
-
id: id,
|
|
6006
|
-
className: classNames('alert alert-detach p-x-2 p-y-1', typeClass, className),
|
|
5845
|
+
}) {
|
|
5846
|
+
const danger = type === 'negative' || type === 'error';
|
|
5847
|
+
return /*#__PURE__*/jsxs("div", {
|
|
5848
|
+
role: "alert",
|
|
5849
|
+
id: id,
|
|
5850
|
+
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
5851
|
+
children: [danger && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
6007
5852
|
children: children
|
|
6008
|
-
})
|
|
6009
|
-
};
|
|
6010
|
-
const AlertWithArrow = withArrow(getAlertContents, ArrowPosition.TOP_LEFT);
|
|
6011
|
-
return /*#__PURE__*/jsx(AlertWithArrow, {
|
|
6012
|
-
id,
|
|
6013
|
-
type,
|
|
6014
|
-
className,
|
|
6015
|
-
children
|
|
5853
|
+
})]
|
|
6016
5854
|
});
|
|
6017
|
-
}
|
|
5855
|
+
}
|
|
6018
5856
|
|
|
6019
5857
|
/*
|
|
6020
5858
|
* Inspired by:
|
|
@@ -6262,61 +6100,65 @@ function BottomSheet({
|
|
|
6262
6100
|
theme: "personal",
|
|
6263
6101
|
screenMode: theme === 'personal' ? screenMode : 'light',
|
|
6264
6102
|
isNotRootProvider: true,
|
|
6265
|
-
children: /*#__PURE__*/
|
|
6103
|
+
children: /*#__PURE__*/jsx(Transition, {
|
|
6266
6104
|
show: open,
|
|
6267
6105
|
className: "np-bottom-sheet-v2-container",
|
|
6268
6106
|
beforeEnter: () => {
|
|
6269
6107
|
setFloatingKey(prev => prev + 1);
|
|
6270
6108
|
},
|
|
6271
6109
|
afterLeave: onCloseEnd,
|
|
6272
|
-
children:
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
className: "np-bottom-sheet-v2-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
}),
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6110
|
+
children: /*#__PURE__*/jsxs(FocusBoundary, {
|
|
6111
|
+
children: [/*#__PURE__*/jsx(Transition.Child, {
|
|
6112
|
+
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
6113
|
+
enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
|
|
6114
|
+
leave: "np-bottom-sheet-v2-backdrop-container--leave",
|
|
6115
|
+
leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
|
|
6116
|
+
children: /*#__PURE__*/jsx("div", {
|
|
6117
|
+
className: "np-bottom-sheet-v2-backdrop"
|
|
6118
|
+
})
|
|
6119
|
+
}), /*#__PURE__*/jsx("div", {
|
|
6120
|
+
className: "np-bottom-sheet-v2",
|
|
6121
|
+
children: /*#__PURE__*/jsx(Transition.Child, {
|
|
6122
|
+
className: "np-bottom-sheet-v2-content",
|
|
6123
|
+
enter: "np-bottom-sheet-v2-content--enter",
|
|
6124
|
+
enterFrom: "np-bottom-sheet-v2-content--enter-from",
|
|
6125
|
+
leave: "np-bottom-sheet-v2-content--leave",
|
|
6126
|
+
leaveTo: "np-bottom-sheet-v2-content--leave-to",
|
|
6127
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6128
|
+
context: context,
|
|
6129
|
+
initialFocus: initialFocusRef,
|
|
6130
|
+
guards: false,
|
|
6131
|
+
modal: false,
|
|
6132
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
6133
|
+
// Force inner state invalidation on open
|
|
6134
|
+
ref: refs.setFloating,
|
|
6135
|
+
className: "np-bottom-sheet-v2-content-inner-container",
|
|
6136
|
+
...getFloatingProps(),
|
|
6137
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
6138
|
+
className: "np-bottom-sheet-v2-header",
|
|
6139
|
+
children: /*#__PURE__*/jsx(CloseButton, {
|
|
6140
|
+
size: Size.SMALL,
|
|
6141
|
+
onClick: () => {
|
|
6142
|
+
onClose?.();
|
|
6143
|
+
}
|
|
6144
|
+
})
|
|
6145
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
6146
|
+
className: classNames('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
|
|
6147
|
+
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
6148
|
+
}),
|
|
6149
|
+
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
6150
|
+
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
6151
|
+
children: title
|
|
6152
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
6153
|
+
className: "np-bottom-sheet-v2-body np-text-body-default",
|
|
6154
|
+
children: children
|
|
6155
|
+
})]
|
|
6314
6156
|
})]
|
|
6315
|
-
})
|
|
6316
|
-
}
|
|
6157
|
+
}, floatingKey)
|
|
6158
|
+
})
|
|
6317
6159
|
})
|
|
6318
|
-
})
|
|
6319
|
-
})
|
|
6160
|
+
})]
|
|
6161
|
+
})
|
|
6320
6162
|
})
|
|
6321
6163
|
})
|
|
6322
6164
|
})]
|
|
@@ -6414,32 +6256,36 @@ function Popover({
|
|
|
6414
6256
|
setFloatingKey(prev => prev + 1);
|
|
6415
6257
|
},
|
|
6416
6258
|
afterLeave: onCloseEnd,
|
|
6417
|
-
children: /*#__PURE__*/jsx(
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6259
|
+
children: /*#__PURE__*/jsx(FocusBoundary, {
|
|
6260
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6261
|
+
context: context,
|
|
6262
|
+
guards: false,
|
|
6263
|
+
modal: false,
|
|
6264
|
+
children: /*#__PURE__*/jsx("div", {
|
|
6265
|
+
// Force inner state invalidation on open
|
|
6266
|
+
ref: refs.setFloating,
|
|
6267
|
+
className: classNames('np-popover-v2-container', {
|
|
6268
|
+
'np-popover-v2-container--size-md': size$1 === 'md',
|
|
6269
|
+
'np-popover-v2-container--size-lg': size$1 === 'lg'
|
|
6270
|
+
})
|
|
6271
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
6272
|
+
,
|
|
6273
|
+
style: floatingStyles,
|
|
6274
|
+
...getFloatingProps(),
|
|
6275
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
6276
|
+
className: classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
|
|
6277
|
+
'np-popover-v2--padding-md': padding === 'md'
|
|
6278
|
+
}),
|
|
6279
|
+
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
6280
|
+
className: "np-popover-v2-title np-text-title-body",
|
|
6281
|
+
children: title
|
|
6282
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
6283
|
+
className: "np-popover-v2-content np-text-body-default",
|
|
6284
|
+
children: children
|
|
6285
|
+
})]
|
|
6286
|
+
})
|
|
6287
|
+
}, floatingKey)
|
|
6288
|
+
})
|
|
6443
6289
|
})
|
|
6444
6290
|
})
|
|
6445
6291
|
})
|
|
@@ -6818,7 +6664,6 @@ function SelectInputOptions({
|
|
|
6818
6664
|
})
|
|
6819
6665
|
}) : null, /*#__PURE__*/jsxs("section", {
|
|
6820
6666
|
ref: listboxContainerRef,
|
|
6821
|
-
tabIndex: -1,
|
|
6822
6667
|
className: classNames('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
|
|
6823
6668
|
children: [resultsEmpty ? /*#__PURE__*/jsxs("div", {
|
|
6824
6669
|
id: statusId,
|
|
@@ -14044,7 +13889,7 @@ function CriticalCommsBanner({
|
|
|
14044
13889
|
type: AvatarType.ICON,
|
|
14045
13890
|
className: classNames(isModern ? 'm-r-2' : 'm-r-1'),
|
|
14046
13891
|
backgroundColor: isModern ? 'var(--color-sentiment-negative)' : 'var(--color-background-negative)',
|
|
14047
|
-
children: isModern ? /*#__PURE__*/jsx(AlertCircleFill, {}) : /*#__PURE__*/jsx(Alert$
|
|
13892
|
+
children: isModern ? /*#__PURE__*/jsx(AlertCircleFill, {}) : /*#__PURE__*/jsx(Alert$1, {
|
|
14048
13893
|
size: 24
|
|
14049
13894
|
})
|
|
14050
13895
|
}), /*#__PURE__*/jsxs("div", {
|
|
@@ -15133,5 +14978,5 @@ const translations = {
|
|
|
15133
14978
|
'zh-HK': zhHK
|
|
15134
14979
|
};
|
|
15135
14980
|
|
|
15136
|
-
export { Accordion, ActionButton, ActionOption, Alert
|
|
14981
|
+
export { Accordion, ActionButton, ActionOption, Alert, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, DynamicFieldDefinitionList$1 as DynamicFieldDefinitionList, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
15137
14982
|
//# sourceMappingURL=index.mjs.map
|