@transferwise/components 0.0.0-experimental-4553cce → 0.0.0-experimental-03e1dec

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.
Files changed (38) hide show
  1. package/build/index.js +133 -290
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +135 -292
  4. package/build/index.mjs.map +1 -1
  5. package/build/types/alert/Alert.d.ts +47 -58
  6. package/build/types/alert/Alert.d.ts.map +1 -1
  7. package/build/types/alert/index.d.ts +2 -1
  8. package/build/types/alert/index.d.ts.map +1 -1
  9. package/build/types/common/propsValues/sentiment.d.ts +0 -1
  10. package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
  11. package/build/types/index.d.ts +1 -1
  12. package/build/types/index.d.ts.map +1 -1
  13. package/build/types/inlineAlert/InlineAlert.d.ts +2 -4
  14. package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
  15. package/build/types/statusIcon/StatusIcon.d.ts +1 -1
  16. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  17. package/package.json +2 -2
  18. package/src/alert/{Alert.spec.js → Alert.spec.tsx} +42 -44
  19. package/src/alert/Alert.story.tsx +1 -2
  20. package/src/alert/Alert.tsx +222 -0
  21. package/src/alert/index.ts +2 -0
  22. package/src/common/propsValues/sentiment.ts +0 -10
  23. package/src/index.ts +1 -1
  24. package/src/inlineAlert/InlineAlert.spec.tsx +0 -7
  25. package/src/inlineAlert/InlineAlert.tsx +19 -47
  26. package/src/statusIcon/StatusIcon.tsx +14 -14
  27. package/build/types/alert/withArrow/alertArrowPositions.d.ts +0 -9
  28. package/build/types/alert/withArrow/alertArrowPositions.d.ts.map +0 -1
  29. package/build/types/alert/withArrow/index.d.ts +0 -3
  30. package/build/types/alert/withArrow/index.d.ts.map +0 -1
  31. package/build/types/alert/withArrow/withArrow.d.ts +0 -11
  32. package/build/types/alert/withArrow/withArrow.d.ts.map +0 -1
  33. package/src/alert/Alert.js +0 -196
  34. package/src/alert/index.js +0 -1
  35. package/src/alert/withArrow/alertArrowPositions.ts +0 -9
  36. package/src/alert/withArrow/index.js +0 -2
  37. package/src/alert/withArrow/withArrow.js +0 -50
  38. package/src/alert/withArrow/withArrow.spec.js +0 -51
package/build/index.js CHANGED
@@ -7,6 +7,7 @@ var reactId = require('@radix-ui/react-id');
7
7
  var icons = require('@transferwise/icons');
8
8
  var reactIntl = require('react-intl');
9
9
  var PropTypes = require('prop-types');
10
+ var commonmark = require('commonmark');
10
11
  var componentsTheming = require('@wise/components-theming');
11
12
  var formatting = require('@transferwise/formatting');
12
13
  var react$1 = require('@headlessui/react');
@@ -20,7 +21,6 @@ var reactPopper = require('react-popper');
20
21
  var throttle = require('lodash.throttle');
21
22
  var reactDom = require('react-dom');
22
23
  var neptuneValidation = require('@transferwise/neptune-validation');
23
- var commonmark = require('commonmark');
24
24
  var art = require('@wise/art');
25
25
  var clamp$2 = require('lodash.clamp');
26
26
  var debounce = require('lodash.debounce');
@@ -51,9 +51,9 @@ function _interopNamespace(e) {
51
51
  var classNames__default = /*#__PURE__*/_interopDefault(classNames);
52
52
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
53
53
  var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
54
+ var commonmark__default = /*#__PURE__*/_interopDefault(commonmark);
54
55
  var mergeProps__default = /*#__PURE__*/_interopDefault(mergeProps);
55
56
  var throttle__default = /*#__PURE__*/_interopDefault(throttle);
56
- var commonmark__default = /*#__PURE__*/_interopDefault(commonmark);
57
57
  var clamp__default = /*#__PURE__*/_interopDefault(clamp$2);
58
58
  var debounce__default = /*#__PURE__*/_interopDefault(debounce);
59
59
  var requiredIf__default = /*#__PURE__*/_interopDefault(requiredIf);
@@ -807,22 +807,22 @@ const Link = ({
807
807
  });
808
808
  };
809
809
 
810
+ const iconTypeMap = {
811
+ positive: icons.Check,
812
+ neutral: icons.Info,
813
+ warning: icons.Alert,
814
+ negative: icons.Cross,
815
+ pending: icons.ClockBorderless,
816
+ info: icons.Info,
817
+ error: icons.Cross,
818
+ success: icons.Check
819
+ };
810
820
  const StatusIcon = ({
811
- sentiment = exports.Sentiment.NEUTRAL,
812
- size = exports.Size.MEDIUM
821
+ sentiment = 'neutral',
822
+ size = 'md'
813
823
  }) => {
814
- const iconTypeMap = {
815
- [exports.Sentiment.POSITIVE]: icons.Check,
816
- [exports.Sentiment.NEUTRAL]: icons.Info,
817
- [exports.Sentiment.WARNING]: icons.Alert,
818
- [exports.Sentiment.NEGATIVE]: icons.Cross,
819
- [exports.Sentiment.PENDING]: icons.ClockBorderless,
820
- [exports.Sentiment.INFO]: icons.Info,
821
- [exports.Sentiment.ERROR]: icons.Cross,
822
- [exports.Sentiment.SUCCESS]: icons.Check
823
- };
824
- const iconColor = [exports.Sentiment.WARNING, exports.Sentiment.PENDING].includes(sentiment) ? 'dark' : 'light';
825
824
  const Icon = iconTypeMap[sentiment];
825
+ const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
826
826
  return /*#__PURE__*/jsxRuntime.jsx("span", {
827
827
  "data-testid": "status-icon",
828
828
  className: classNames__default.default('status-circle', 'status-circle-' + size, sentiment),
@@ -832,7 +832,7 @@ const StatusIcon = ({
832
832
  });
833
833
  };
834
834
 
835
- function logActionRequired$1(message) {
835
+ function logActionRequired(message) {
836
836
  if (['development', 'test'].includes(process?.env?.NODE_ENV)) {
837
837
  // eslint-disable-next-line no-console
838
838
  console.warn(message);
@@ -840,48 +840,10 @@ function logActionRequired$1(message) {
840
840
  }
841
841
  function logActionRequiredIf(message, conditional) {
842
842
  if (conditional) {
843
- logActionRequired$1(message);
843
+ logActionRequired(message);
844
844
  }
845
845
  }
846
846
 
847
- const deprecatedMessage = ({
848
- component,
849
- propName,
850
- message,
851
- expiryDate
852
- }) => {
853
- const messages = [`${component} has deprecated the use of ${propName}.`];
854
- if (message) {
855
- messages.push(message);
856
- }
857
- if (expiryDate) {
858
- messages.push(`${propName} will be removed on or after ${expiryDate.toLocaleString('en-GB', {
859
- year: 'numeric',
860
- month: 'numeric',
861
- day: 'numeric'
862
- })}`);
863
- }
864
- return messages.join(' ');
865
- };
866
- const deprecated = (validator, {
867
- component,
868
- message = '',
869
- newProp: newProperty = null,
870
- expiryDate = null
871
- }) => (props, propertyName, ...rest) => {
872
- const newPropertyMessage = newProperty ? `Please use ${newProperty} instead.` : message;
873
- if (props[propertyName] != null && typeof props[propertyName] !== 'undefined') {
874
- logActionRequired$1(deprecatedMessage({
875
- component,
876
- propName: propertyName,
877
- message: newPropertyMessage,
878
- expiryDate
879
- }));
880
- }
881
- return validator(props, propertyName, ...rest);
882
- };
883
- var deprecated$1 = deprecated;
884
-
885
847
  const reader = new commonmark__default.default.Parser();
886
848
  const writer = new commonmark__default.default.HtmlRenderer({
887
849
  safe: true
@@ -900,7 +862,7 @@ function Markdown({
900
862
  }
901
863
  const linkTarget = config?.link?.target ?? '_self';
902
864
  if (allowList != null && blockList != null) {
903
- logActionRequired$1('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
865
+ logActionRequired('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
904
866
  }
905
867
  const parser = nodes => {
906
868
  const parsed = reader.parse(nodes);
@@ -961,146 +923,98 @@ InlineMarkdown.defaultProps = {
961
923
  };
962
924
  var InlineMarkdown$1 = InlineMarkdown;
963
925
 
964
- // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
965
- exports.AlertArrowPosition = void 0;
966
- (function (ArrowPosition) {
967
- ArrowPosition["TOP_LEFT"] = "up-left";
968
- ArrowPosition["TOP"] = "up-center";
969
- ArrowPosition["TOP_RIGHT"] = "up-right";
970
- ArrowPosition["BOTTOM_LEFT"] = "down-left";
971
- ArrowPosition["BOTTOM"] = "down-center";
972
- ArrowPosition["BOTTOM_RIGHT"] = "down-right";
973
- })(exports.AlertArrowPosition || (exports.AlertArrowPosition = {}));
974
-
975
- function withArrow(Alert, arrow) {
976
- const AlertWithArrow = props => /*#__PURE__*/jsxRuntime.jsx(Alert, {
977
- ...props,
978
- className: classNames__default.default(props.className, arrowClasses(arrow)),
979
- arrow: undefined
980
- });
981
- AlertWithArrow.propTypes = {
982
- className: PropTypes__default.default.string
983
- };
984
- AlertWithArrow.defaultProps = {
985
- className: undefined
986
- };
987
- return AlertWithArrow;
926
+ var AlertArrowPosition;
927
+ (function (AlertArrowPosition) {
928
+ AlertArrowPosition["TOP_LEFT"] = "up-left";
929
+ AlertArrowPosition["TOP"] = "up-center";
930
+ AlertArrowPosition["TOP_RIGHT"] = "up-right";
931
+ AlertArrowPosition["BOTTOM_LEFT"] = "down-left";
932
+ AlertArrowPosition["BOTTOM"] = "down-center";
933
+ AlertArrowPosition["BOTTOM_RIGHT"] = "down-right";
934
+ })(AlertArrowPosition || (AlertArrowPosition = {}));
935
+ function resolveType(type) {
936
+ switch (type) {
937
+ case 'success':
938
+ return 'positive';
939
+ case 'info':
940
+ return 'neutral';
941
+ case 'error':
942
+ return 'negative';
943
+ }
944
+ return type;
988
945
  }
989
- function arrowClasses(arrow) {
990
- if (arrow) {
991
- const classes = ['arrow'];
992
- const {
993
- BOTTOM,
994
- BOTTOM_LEFT,
995
- BOTTOM_RIGHT,
996
- TOP,
997
- TOP_RIGHT,
998
- TOP_LEFT
999
- } = exports.AlertArrowPosition;
1000
- switch (arrow) {
1001
- case BOTTOM:
1002
- return classes.concat('arrow-bottom', 'arrow-center');
1003
- case BOTTOM_LEFT:
1004
- return classes.concat('arrow-bottom', 'arrow-left');
1005
- case BOTTOM_RIGHT:
1006
- return classes.concat('arrow-bottom', 'arrow-right');
1007
- case TOP:
1008
- return classes.concat('arrow-center');
1009
- case TOP_RIGHT:
1010
- return classes.concat('arrow-right');
1011
- case TOP_LEFT:
1012
- default:
1013
- return classes;
946
+ function Alert({
947
+ arrow,
948
+ action,
949
+ children,
950
+ className,
951
+ dismissible,
952
+ icon,
953
+ onDismiss,
954
+ message,
955
+ size,
956
+ title,
957
+ type = 'neutral',
958
+ variant = 'desktop'
959
+ }) {
960
+ React.useEffect(() => {
961
+ if (arrow !== undefined) {
962
+ logActionRequired("Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.");
1014
963
  }
1015
- }
1016
- return '';
1017
- }
1018
-
1019
- const deprecatedTypeMap$1 = {
1020
- [exports.Sentiment.SUCCESS]: exports.Sentiment.POSITIVE,
1021
- [exports.Sentiment.INFO]: exports.Sentiment.NEUTRAL,
1022
- [exports.Sentiment.ERROR]: exports.Sentiment.NEGATIVE
1023
- };
1024
- const Alert = props => {
1025
- const {
1026
- isModern
1027
- } = componentsTheming.useTheme();
1028
- const iconTypeMap = {
1029
- [exports.Sentiment.POSITIVE]: icons.CheckCircle,
1030
- [exports.Sentiment.NEUTRAL]: icons.InfoCircle,
1031
- [exports.Sentiment.WARNING]: icons.Warning,
1032
- [exports.Sentiment.NEGATIVE]: icons.CrossCircle,
1033
- [exports.Sentiment.PENDING]: icons.Clock
1034
- };
1035
- const [shouldFire, setShouldFire] = React.useState(false);
1036
- const {
1037
- arrow,
1038
- action,
1039
- children,
1040
- className,
1041
- icon,
1042
- onDismiss,
1043
- message,
1044
- title,
1045
- type,
1046
- variant
1047
- } = props;
1048
- const closeButtonReference = React.useRef(null);
1049
- if (arrow) {
1050
- const AlertWithArrow = withArrow(Alert, arrow);
1051
- return /*#__PURE__*/jsxRuntime.jsx(AlertWithArrow, {
1052
- ...props
1053
- });
1054
- }
1055
- logActionRequired(props);
1056
- const mappedType = deprecatedTypeMap$1[type] || type;
1057
- const Icon = iconTypeMap[mappedType];
1058
- function generateIcon() {
1059
- if (icon) {
1060
- return /*#__PURE__*/jsxRuntime.jsx("div", {
1061
- className: "alert__icon",
1062
- children: icon
1063
- });
964
+ }, [arrow]);
965
+ React.useEffect(() => {
966
+ if (children !== undefined) {
967
+ logActionRequired("Alert component doesn't support 'children' anymore, use 'message' instead.");
1064
968
  }
1065
- if (isModern) {
1066
- return /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
1067
- size: exports.Size.LARGE,
1068
- sentiment: mappedType
1069
- });
1070
- } else {
1071
- return /*#__PURE__*/jsxRuntime.jsx(Icon, {
1072
- size: 24
1073
- });
969
+ }, [children]);
970
+ React.useEffect(() => {
971
+ if (dismissible !== undefined) {
972
+ logActionRequired("Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.");
1074
973
  }
1075
- }
1076
- const handleTouchStart = () => setShouldFire(true);
1077
- const handleTouchMove = () => setShouldFire(false);
1078
- const handleTouchEnd = event => {
1079
- if (shouldFire && action) {
974
+ }, [dismissible]);
975
+ React.useEffect(() => {
976
+ if (size !== undefined) {
977
+ logActionRequired("Alert component doesn't support 'size' anymore, please remove that prop.");
978
+ }
979
+ }, [size]);
980
+ const resolvedType = resolveType(type);
981
+ React.useEffect(() => {
982
+ if (resolvedType !== type) {
983
+ logActionRequired(`Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`);
984
+ }
985
+ }, [resolvedType, type]);
986
+ const [shouldFire, setShouldFire] = React.useState(false);
987
+ const closeButtonReference = React.useRef(null);
988
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
989
+ className: classNames__default.default('alert d-flex', `alert-${resolvedType}`, arrow != null && alertArrowClassNames(arrow), className),
990
+ "data-testid": "alert",
991
+ onTouchStart: () => setShouldFire(true),
992
+ onTouchEnd: event => {
993
+ if (shouldFire && action &&
1080
994
  // Check if current event is triggered from closeButton
1081
- if (closeButtonReference?.current && !closeButtonReference.current.contains(event.target)) {
1082
- if (action?.target === '_blank') {
1083
- window.top.open(action.href);
995
+ closeButtonReference.current && !closeButtonReference.current.contains(event.currentTarget)) {
996
+ if (action.target === '_blank') {
997
+ window.top?.open(action.href);
1084
998
  } else {
1085
- window.top.location.assign(action.href);
999
+ window.top?.location.assign(action.href);
1086
1000
  }
1087
1001
  }
1088
- }
1089
- setShouldFire(false);
1090
- };
1091
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1092
- className: classNames__default.default('alert d-flex', `alert-${mappedType}`, className),
1093
- "data-testid": "alert",
1094
- onTouchStart: handleTouchStart,
1095
- onTouchEnd: handleTouchEnd,
1096
- onTouchMove: handleTouchMove,
1002
+ setShouldFire(false);
1003
+ },
1004
+ onTouchMove: () => setShouldFire(false),
1097
1005
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1098
1006
  className: classNames__default.default('alert__content', 'd-flex', 'flex-grow-1', variant),
1099
1007
  "data-testid": variant,
1100
- children: [generateIcon(), /*#__PURE__*/jsxRuntime.jsxs("div", {
1008
+ children: [icon ? /*#__PURE__*/jsxRuntime.jsx("div", {
1009
+ className: "alert__icon",
1010
+ children: icon
1011
+ }) : /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
1012
+ size: exports.Size.LARGE,
1013
+ sentiment: resolvedType
1014
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1101
1015
  className: "alert__message",
1102
1016
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1103
- role: exports.Sentiment.NEGATIVE === mappedType ? 'alert' : 'status',
1017
+ role: exports.Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status',
1104
1018
  children: [title && /*#__PURE__*/jsxRuntime.jsx(Title, {
1105
1019
  className: "m-b-1",
1106
1020
  type: exports.Typography.TITLE_BODY,
@@ -1128,72 +1042,28 @@ const Alert = props => {
1128
1042
  onClick: onDismiss
1129
1043
  })]
1130
1044
  });
1131
- };
1132
- const deprecatedTypeMapMessage$1 = {
1133
- [exports.Sentiment.SUCCESS]: 'Sentiment.POSITIVE',
1134
- [exports.Sentiment.INFO]: 'Sentiment.NEUTRAL',
1135
- [exports.Sentiment.ERROR]: 'Sentiment.NEGATIVE'
1136
- };
1137
- const deprecatedTypes$1 = Object.keys(deprecatedTypeMap$1);
1138
- function logActionRequired({
1139
- size,
1140
- type
1141
- }) {
1142
- logActionRequiredIf('Alert no longer supports any possible variations in size. Please remove the `size` prop.', !!size);
1143
- logActionRequiredIf(`Alert has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage$1[type]}.`, deprecatedTypes$1.includes(type));
1144
1045
  }
1145
- Alert.propTypes = {
1146
- /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */
1147
- action: PropTypes__default.default.shape({
1148
- 'aria-label': PropTypes__default.default.string,
1149
- href: PropTypes__default.default.string.isRequired,
1150
- target: PropTypes__default.default.string,
1151
- text: PropTypes__default.default.node.isRequired
1152
- }),
1153
- className: PropTypes__default.default.string,
1154
- /** An optional icon. If not provided, we will default the icon to something appropriate for the type */
1155
- icon: PropTypes__default.default.element,
1156
- /** Title for the alert component */
1157
- title: PropTypes__default.default.string,
1158
- /** The main body of the alert. Accepts plain text and bold words specified with **double stars*/
1159
- message: requiredIf__default.default(PropTypes__default.default.node, ({
1160
- children
1161
- }) => !children),
1162
- /** The presence of the onDismiss handler will trigger the visibility of the close button */
1163
- onDismiss: PropTypes__default.default.func,
1164
- /** The type dictates which icon and colour will be used */
1165
- type: PropTypes__default.default.oneOf(['negative', 'neutral', 'positive', 'warning', 'info', 'error', 'success']),
1166
- variant: PropTypes__default.default.oneOf(['desktop', 'mobile']),
1167
- /** @deprecated no arrow for `Alert` component anymore, consider to use [`InlineAlert`](https://transferwise.github.io/neptune-web/components/alerts/InlineAlert) component */
1168
- arrow: deprecated$1(PropTypes__default.default.oneOf(['up-left', 'up-center', 'up-right', 'down-left', 'down-center', 'down-right']), {
1169
- component: 'Alert',
1170
- expiryDate: new Date('03-01-2021')
1171
- }),
1172
- /** @deprecated use `message` property instead */
1173
- children: deprecated$1(requiredIf__default.default(PropTypes__default.default.node, ({
1174
- message
1175
- }) => !message), {
1176
- component: 'Alert',
1177
- message: 'You should now use the `message` prop. Be aware `message` only accepts plain text or text with **bold** markdown.',
1178
- expiryDate: new Date('03-01-2021')
1179
- }),
1180
- /** @deprecated use `onDismiss` instead */
1181
- dismissible: deprecated$1(PropTypes__default.default.bool, {
1182
- component: 'Alert',
1183
- message: 'The Alert will now be considered dismissible if an `onDismiss` hander is present.',
1184
- expiryDate: new Date('03-01-2021')
1185
- })
1186
- };
1187
- Alert.defaultProps = {
1188
- action: undefined,
1189
- arrow: undefined,
1190
- className: undefined,
1191
- dismissible: undefined,
1192
- icon: undefined,
1193
- type: exports.Sentiment.NEUTRAL,
1194
- variant: exports.Variant.DESKTOP
1195
- };
1196
- var Alert$1 = Alert;
1046
+ function alertArrowClassNames(arrow) {
1047
+ if (arrow) {
1048
+ const classes = 'arrow';
1049
+ switch (arrow) {
1050
+ case 'down-center':
1051
+ return `${classes} arrow-bottom arrow-center`;
1052
+ case 'down-left':
1053
+ return `${classes} arrow-bottom arrow-left`;
1054
+ case 'down-right':
1055
+ return `${classes} arrow-bottom arrow-right`;
1056
+ case 'up-center':
1057
+ return `${classes} arrow-center`;
1058
+ case 'up-right':
1059
+ return `${classes} arrow-right`;
1060
+ case 'up-left':
1061
+ default:
1062
+ return classes;
1063
+ }
1064
+ }
1065
+ return '';
1066
+ }
1197
1067
 
1198
1068
  // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
1199
1069
  exports.AvatarType = void 0;
@@ -2192,7 +2062,7 @@ var messages$b = reactIntl.defineMessages({
2192
2062
  }
2193
2063
  });
2194
2064
 
2195
- const typeClassMap$1 = {
2065
+ const typeClassMap = {
2196
2066
  [exports.ControlType.ACCENT]: 'btn-accent',
2197
2067
  [exports.ControlType.POSITIVE]: 'btn-positive',
2198
2068
  [exports.ControlType.NEGATIVE]: 'btn-negative'
@@ -2276,7 +2146,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
2276
2146
  },
2277
2147
  // @ts-expect-error fix when refactor `typeClassMap` to TypeScript
2278
2148
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2279
- typeClassMap$1[newType],
2149
+ typeClassMap[newType],
2280
2150
  // @ts-expect-error fix when refactor `typeClassMap` to TypeScript
2281
2151
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2282
2152
  priorityClassMap[newPriority], className);
@@ -2661,7 +2531,7 @@ const CircularButton = ({
2661
2531
  type = exports.ControlType.ACCENT,
2662
2532
  ...rest
2663
2533
  }) => {
2664
- const classes = classNames__default.default('btn np-btn', typeClassMap$1[type], priorityClassMap[priority]);
2534
+ const classes = classNames__default.default('btn np-btn', typeClassMap[type], priorityClassMap[priority]);
2665
2535
  const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
2666
2536
  size: 24
2667
2537
  }) : icon;
@@ -5831,7 +5701,7 @@ function Popover$1({
5831
5701
  const resolvedPlacement = resolvePlacement(preferredPlacement);
5832
5702
  React.useEffect(() => {
5833
5703
  if (resolvedPlacement !== preferredPlacement) {
5834
- logActionRequired$1(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
5704
+ logActionRequired(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
5835
5705
  }
5836
5706
  }, [preferredPlacement, resolvedPlacement]);
5837
5707
  const anchorReference = React.useRef(null);
@@ -5936,49 +5806,22 @@ const Info = ({
5936
5806
  });
5937
5807
  };
5938
5808
 
5939
- const typeClassMap = {
5940
- [exports.Sentiment.ERROR]: 'danger',
5941
- [exports.Sentiment.NEGATIVE]: 'danger'
5942
- };
5943
- const InlineAlert = ({
5809
+ function InlineAlert({
5944
5810
  id,
5945
5811
  type = exports.Sentiment.NEUTRAL,
5946
5812
  className,
5947
5813
  children
5948
- }) => {
5949
- const {
5950
- isModern
5951
- } = componentsTheming.useTheme();
5952
- const typeClass = `alert-${typeClassMap[type] || type}`;
5953
- if (isModern) {
5954
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
5955
- role: "alert",
5956
- id: id,
5957
- className: classNames__default.default('alert alert-detach', typeClass, className),
5958
- children: [(type === 'error' || type === 'negative') && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
5959
- children: children
5960
- })]
5961
- });
5962
- }
5963
- const getAlertContents = ({
5964
- children,
5965
- className
5966
- }) => {
5967
- return /*#__PURE__*/jsxRuntime.jsx("div", {
5968
- role: "alert",
5969
- id: id,
5970
- className: classNames__default.default('alert alert-detach p-x-2 p-y-1', typeClass, className),
5814
+ }) {
5815
+ const danger = type === 'negative' || type === 'error';
5816
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
5817
+ role: "alert",
5818
+ id: id,
5819
+ className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
5820
+ children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
5971
5821
  children: children
5972
- });
5973
- };
5974
- const AlertWithArrow = withArrow(getAlertContents, exports.AlertArrowPosition.TOP_LEFT);
5975
- return /*#__PURE__*/jsxRuntime.jsx(AlertWithArrow, {
5976
- id,
5977
- type,
5978
- className,
5979
- children
5822
+ })]
5980
5823
  });
5981
- };
5824
+ }
5982
5825
 
5983
5826
  /*
5984
5827
  * Inspired by:
@@ -15106,7 +14949,7 @@ const translations = {
15106
14949
  exports.Accordion = Accordion;
15107
14950
  exports.ActionButton = ActionButton;
15108
14951
  exports.ActionOption = ActionOption;
15109
- exports.Alert = Alert$1;
14952
+ exports.Alert = Alert;
15110
14953
  exports.Avatar = Avatar;
15111
14954
  exports.AvatarWrapper = AvatarWrapper;
15112
14955
  exports.Badge = Badge;