@transferwise/components 0.0.0-experimental-6c73115 → 0.0.0-experimental-322d55c

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 (44) hide show
  1. package/build/index.js +213 -368
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +215 -370
  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/inputs/SelectInput.d.ts.map +1 -1
  16. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  17. package/build/types/inputs/_Popover.d.ts.map +1 -1
  18. package/build/types/statusIcon/StatusIcon.d.ts +1 -1
  19. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  20. package/package.json +1 -1
  21. package/src/alert/{Alert.spec.js → Alert.spec.tsx} +43 -40
  22. package/src/alert/Alert.story.tsx +1 -2
  23. package/src/alert/Alert.tsx +218 -0
  24. package/src/alert/index.ts +2 -0
  25. package/src/common/propsValues/sentiment.ts +0 -10
  26. package/src/index.ts +1 -1
  27. package/src/inlineAlert/InlineAlert.spec.tsx +0 -7
  28. package/src/inlineAlert/InlineAlert.tsx +19 -47
  29. package/src/inputs/SelectInput.tsx +0 -1
  30. package/src/inputs/_BottomSheet.tsx +54 -44
  31. package/src/inputs/_Popover.tsx +23 -20
  32. package/src/statusIcon/StatusIcon.tsx +14 -14
  33. package/build/types/alert/withArrow/alertArrowPositions.d.ts +0 -9
  34. package/build/types/alert/withArrow/alertArrowPositions.d.ts.map +0 -1
  35. package/build/types/alert/withArrow/index.d.ts +0 -3
  36. package/build/types/alert/withArrow/index.d.ts.map +0 -1
  37. package/build/types/alert/withArrow/withArrow.d.ts +0 -11
  38. package/build/types/alert/withArrow/withArrow.d.ts.map +0 -1
  39. package/src/alert/Alert.js +0 -196
  40. package/src/alert/index.js +0 -1
  41. package/src/alert/withArrow/alertArrowPositions.ts +0 -9
  42. package/src/alert/withArrow/index.js +0 -2
  43. package/src/alert/withArrow/withArrow.js +0 -50
  44. package/src/alert/withArrow/withArrow.spec.js +0 -51
package/build/index.js CHANGED
@@ -7,20 +7,20 @@ 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');
13
14
  var mergeProps = require('merge-props');
14
15
  var index_js = require('use-sync-external-store/shim/index.js');
15
16
  var react = require('@floating-ui/react');
17
+ var focus = require('@react-aria/focus');
16
18
  var overlays = require('@react-aria/overlays');
17
19
  var reactTransitionGroup = require('react-transition-group');
18
20
  var reactPopper = require('react-popper');
19
21
  var throttle = require('lodash.throttle');
20
22
  var reactDom = require('react-dom');
21
- var focus = require('@react-aria/focus');
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
@@ -901,7 +863,7 @@ function Markdown({
901
863
  const linkTarget = config?.link?.target ?? '_self';
902
864
  const paragraphClass = config?.paragraph?.className ?? '';
903
865
  if (allowList != null && blockList != null) {
904
- logActionRequired$1('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
866
+ logActionRequired('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
905
867
  }
906
868
  const parser = nodes => {
907
869
  const parsed = reader.parse(nodes);
@@ -962,146 +924,98 @@ InlineMarkdown.defaultProps = {
962
924
  };
963
925
  var InlineMarkdown$1 = InlineMarkdown;
964
926
 
965
- // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
966
- exports.AlertArrowPosition = void 0;
967
- (function (ArrowPosition) {
968
- ArrowPosition["TOP_LEFT"] = "up-left";
969
- ArrowPosition["TOP"] = "up-center";
970
- ArrowPosition["TOP_RIGHT"] = "up-right";
971
- ArrowPosition["BOTTOM_LEFT"] = "down-left";
972
- ArrowPosition["BOTTOM"] = "down-center";
973
- ArrowPosition["BOTTOM_RIGHT"] = "down-right";
974
- })(exports.AlertArrowPosition || (exports.AlertArrowPosition = {}));
975
-
976
- function withArrow(Alert, arrow) {
977
- const AlertWithArrow = props => /*#__PURE__*/jsxRuntime.jsx(Alert, {
978
- ...props,
979
- className: classNames__default.default(props.className, arrowClasses(arrow)),
980
- arrow: undefined
981
- });
982
- AlertWithArrow.propTypes = {
983
- className: PropTypes__default.default.string
984
- };
985
- AlertWithArrow.defaultProps = {
986
- className: undefined
987
- };
988
- return AlertWithArrow;
927
+ var AlertArrowPosition;
928
+ (function (AlertArrowPosition) {
929
+ AlertArrowPosition["TOP_LEFT"] = "up-left";
930
+ AlertArrowPosition["TOP"] = "up-center";
931
+ AlertArrowPosition["TOP_RIGHT"] = "up-right";
932
+ AlertArrowPosition["BOTTOM_LEFT"] = "down-left";
933
+ AlertArrowPosition["BOTTOM"] = "down-center";
934
+ AlertArrowPosition["BOTTOM_RIGHT"] = "down-right";
935
+ })(AlertArrowPosition || (AlertArrowPosition = {}));
936
+ function resolveType(type) {
937
+ switch (type) {
938
+ case 'success':
939
+ return 'positive';
940
+ case 'info':
941
+ return 'neutral';
942
+ case 'error':
943
+ return 'negative';
944
+ }
945
+ return type;
989
946
  }
990
- function arrowClasses(arrow) {
991
- if (arrow) {
992
- const classes = ['arrow'];
993
- const {
994
- BOTTOM,
995
- BOTTOM_LEFT,
996
- BOTTOM_RIGHT,
997
- TOP,
998
- TOP_RIGHT,
999
- TOP_LEFT
1000
- } = exports.AlertArrowPosition;
1001
- switch (arrow) {
1002
- case BOTTOM:
1003
- return classes.concat('arrow-bottom', 'arrow-center');
1004
- case BOTTOM_LEFT:
1005
- return classes.concat('arrow-bottom', 'arrow-left');
1006
- case BOTTOM_RIGHT:
1007
- return classes.concat('arrow-bottom', 'arrow-right');
1008
- case TOP:
1009
- return classes.concat('arrow-center');
1010
- case TOP_RIGHT:
1011
- return classes.concat('arrow-right');
1012
- case TOP_LEFT:
1013
- default:
1014
- return classes;
947
+ function Alert({
948
+ arrow,
949
+ action,
950
+ children,
951
+ className,
952
+ dismissible,
953
+ icon,
954
+ onDismiss,
955
+ message,
956
+ size,
957
+ title,
958
+ type = 'neutral',
959
+ variant = 'desktop'
960
+ }) {
961
+ React.useEffect(() => {
962
+ if (arrow !== undefined) {
963
+ logActionRequired("Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.");
1015
964
  }
1016
- }
1017
- return '';
1018
- }
1019
-
1020
- const deprecatedTypeMap$1 = {
1021
- [exports.Sentiment.SUCCESS]: exports.Sentiment.POSITIVE,
1022
- [exports.Sentiment.INFO]: exports.Sentiment.NEUTRAL,
1023
- [exports.Sentiment.ERROR]: exports.Sentiment.NEGATIVE
1024
- };
1025
- const Alert = props => {
1026
- const {
1027
- isModern
1028
- } = componentsTheming.useTheme();
1029
- const iconTypeMap = {
1030
- [exports.Sentiment.POSITIVE]: icons.CheckCircle,
1031
- [exports.Sentiment.NEUTRAL]: icons.InfoCircle,
1032
- [exports.Sentiment.WARNING]: icons.Warning,
1033
- [exports.Sentiment.NEGATIVE]: icons.CrossCircle,
1034
- [exports.Sentiment.PENDING]: icons.Clock
1035
- };
1036
- const [shouldFire, setShouldFire] = React.useState(false);
1037
- const {
1038
- arrow,
1039
- action,
1040
- children,
1041
- className,
1042
- icon,
1043
- onDismiss,
1044
- message,
1045
- title,
1046
- type,
1047
- variant
1048
- } = props;
1049
- const closeButtonReference = React.useRef(null);
1050
- if (arrow) {
1051
- const AlertWithArrow = withArrow(Alert, arrow);
1052
- return /*#__PURE__*/jsxRuntime.jsx(AlertWithArrow, {
1053
- ...props
1054
- });
1055
- }
1056
- logActionRequired(props);
1057
- const mappedType = deprecatedTypeMap$1[type] || type;
1058
- const Icon = iconTypeMap[mappedType];
1059
- function generateIcon() {
1060
- if (icon) {
1061
- return /*#__PURE__*/jsxRuntime.jsx("div", {
1062
- className: "alert__icon",
1063
- children: icon
1064
- });
965
+ }, [arrow]);
966
+ React.useEffect(() => {
967
+ if (children !== undefined) {
968
+ logActionRequired("Alert component doesn't support 'children' anymore, use 'message' instead.");
1065
969
  }
1066
- if (isModern) {
1067
- return /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
1068
- size: exports.Size.LARGE,
1069
- sentiment: mappedType
1070
- });
1071
- } else {
1072
- return /*#__PURE__*/jsxRuntime.jsx(Icon, {
1073
- size: 24
1074
- });
970
+ }, [children]);
971
+ React.useEffect(() => {
972
+ if (dismissible !== undefined) {
973
+ logActionRequired("Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.");
1075
974
  }
1076
- }
1077
- const handleTouchStart = () => setShouldFire(true);
1078
- const handleTouchMove = () => setShouldFire(false);
1079
- const handleTouchEnd = event => {
1080
- if (shouldFire && action) {
975
+ }, [dismissible]);
976
+ React.useEffect(() => {
977
+ if (size !== undefined) {
978
+ logActionRequired("Alert component doesn't support 'size' anymore, please remove that prop.");
979
+ }
980
+ }, [size]);
981
+ const resolvedType = resolveType(type);
982
+ React.useEffect(() => {
983
+ if (resolvedType !== type) {
984
+ logActionRequired(`Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`);
985
+ }
986
+ }, [resolvedType, type]);
987
+ const [shouldFire, setShouldFire] = React.useState(false);
988
+ const closeButtonReference = React.useRef(null);
989
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
990
+ className: classNames__default.default('alert d-flex', `alert-${resolvedType}`, arrow != null && alertArrowClassNames(arrow), className),
991
+ "data-testid": "alert",
992
+ onTouchStart: () => setShouldFire(true),
993
+ onTouchEnd: event => {
994
+ if (shouldFire && action &&
1081
995
  // Check if current event is triggered from closeButton
1082
- if (closeButtonReference?.current && !closeButtonReference.current.contains(event.target)) {
1083
- if (action?.target === '_blank') {
1084
- window.top.open(action.href);
996
+ event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
997
+ if (action.target === '_blank') {
998
+ window.top?.open(action.href);
1085
999
  } else {
1086
- window.top.location.assign(action.href);
1000
+ window.top?.location.assign(action.href);
1087
1001
  }
1088
1002
  }
1089
- }
1090
- setShouldFire(false);
1091
- };
1092
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1093
- className: classNames__default.default('alert d-flex', `alert-${mappedType}`, className),
1094
- "data-testid": "alert",
1095
- onTouchStart: handleTouchStart,
1096
- onTouchEnd: handleTouchEnd,
1097
- onTouchMove: handleTouchMove,
1003
+ setShouldFire(false);
1004
+ },
1005
+ onTouchMove: () => setShouldFire(false),
1098
1006
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1099
1007
  className: classNames__default.default('alert__content', 'd-flex', 'flex-grow-1', variant),
1100
1008
  "data-testid": variant,
1101
- children: [generateIcon(), /*#__PURE__*/jsxRuntime.jsxs("div", {
1009
+ children: [icon ? /*#__PURE__*/jsxRuntime.jsx("div", {
1010
+ className: "alert__icon",
1011
+ children: icon
1012
+ }) : /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
1013
+ size: exports.Size.LARGE,
1014
+ sentiment: resolvedType
1015
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1102
1016
  className: "alert__message",
1103
1017
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1104
- role: exports.Sentiment.NEGATIVE === mappedType ? 'alert' : 'status',
1018
+ role: exports.Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status',
1105
1019
  children: [title && /*#__PURE__*/jsxRuntime.jsx(Title, {
1106
1020
  className: "m-b-1",
1107
1021
  type: exports.Typography.TITLE_BODY,
@@ -1129,72 +1043,24 @@ const Alert = props => {
1129
1043
  onClick: onDismiss
1130
1044
  })]
1131
1045
  });
1132
- };
1133
- const deprecatedTypeMapMessage$1 = {
1134
- [exports.Sentiment.SUCCESS]: 'Sentiment.POSITIVE',
1135
- [exports.Sentiment.INFO]: 'Sentiment.NEUTRAL',
1136
- [exports.Sentiment.ERROR]: 'Sentiment.NEGATIVE'
1137
- };
1138
- const deprecatedTypes$1 = Object.keys(deprecatedTypeMap$1);
1139
- function logActionRequired({
1140
- size,
1141
- type
1142
- }) {
1143
- logActionRequiredIf('Alert no longer supports any possible variations in size. Please remove the `size` prop.', !!size);
1144
- logActionRequiredIf(`Alert has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage$1[type]}.`, deprecatedTypes$1.includes(type));
1145
1046
  }
1146
- Alert.propTypes = {
1147
- /** 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 */
1148
- action: PropTypes__default.default.shape({
1149
- 'aria-label': PropTypes__default.default.string,
1150
- href: PropTypes__default.default.string.isRequired,
1151
- target: PropTypes__default.default.string,
1152
- text: PropTypes__default.default.node.isRequired
1153
- }),
1154
- className: PropTypes__default.default.string,
1155
- /** An optional icon. If not provided, we will default the icon to something appropriate for the type */
1156
- icon: PropTypes__default.default.element,
1157
- /** Title for the alert component */
1158
- title: PropTypes__default.default.string,
1159
- /** The main body of the alert. Accepts plain text and bold words specified with **double stars*/
1160
- message: requiredIf__default.default(PropTypes__default.default.node, ({
1161
- children
1162
- }) => !children),
1163
- /** The presence of the onDismiss handler will trigger the visibility of the close button */
1164
- onDismiss: PropTypes__default.default.func,
1165
- /** The type dictates which icon and colour will be used */
1166
- type: PropTypes__default.default.oneOf(['negative', 'neutral', 'positive', 'warning', 'info', 'error', 'success']),
1167
- variant: PropTypes__default.default.oneOf(['desktop', 'mobile']),
1168
- /** @deprecated no arrow for `Alert` component anymore, consider to use [`InlineAlert`](https://transferwise.github.io/neptune-web/components/alerts/InlineAlert) component */
1169
- arrow: deprecated$1(PropTypes__default.default.oneOf(['up-left', 'up-center', 'up-right', 'down-left', 'down-center', 'down-right']), {
1170
- component: 'Alert',
1171
- expiryDate: new Date('03-01-2021')
1172
- }),
1173
- /** @deprecated use `message` property instead */
1174
- children: deprecated$1(requiredIf__default.default(PropTypes__default.default.node, ({
1175
- message
1176
- }) => !message), {
1177
- component: 'Alert',
1178
- message: 'You should now use the `message` prop. Be aware `message` only accepts plain text or text with **bold** markdown.',
1179
- expiryDate: new Date('03-01-2021')
1180
- }),
1181
- /** @deprecated use `onDismiss` instead */
1182
- dismissible: deprecated$1(PropTypes__default.default.bool, {
1183
- component: 'Alert',
1184
- message: 'The Alert will now be considered dismissible if an `onDismiss` hander is present.',
1185
- expiryDate: new Date('03-01-2021')
1186
- })
1187
- };
1188
- Alert.defaultProps = {
1189
- action: undefined,
1190
- arrow: undefined,
1191
- className: undefined,
1192
- dismissible: undefined,
1193
- icon: undefined,
1194
- type: exports.Sentiment.NEUTRAL,
1195
- variant: exports.Variant.DESKTOP
1196
- };
1197
- var Alert$1 = Alert;
1047
+ function alertArrowClassNames(arrow) {
1048
+ switch (arrow) {
1049
+ case 'down-center':
1050
+ return 'arrow arrow-bottom arrow-center';
1051
+ case 'down-left':
1052
+ return 'arrow arrow-bottom arrow-left';
1053
+ case 'down-right':
1054
+ return 'arrow arrow-bottom arrow-right';
1055
+ case 'up-center':
1056
+ return 'arrow arrow-center';
1057
+ case 'up-right':
1058
+ return 'arrow arrow-right';
1059
+ case 'up-left':
1060
+ default:
1061
+ return 'arrow';
1062
+ }
1063
+ }
1198
1064
 
1199
1065
  // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
1200
1066
  exports.AvatarType = void 0;
@@ -1420,7 +1286,6 @@ const FocusBoundary = ({
1420
1286
  })
1421
1287
  });
1422
1288
  };
1423
- var FocusBoundary$1 = FocusBoundary;
1424
1289
 
1425
1290
  function withNextPortalWrapper(Component) {
1426
1291
  return function (props) {
@@ -1562,7 +1427,7 @@ const Dimmer = ({
1562
1427
  onExited: onExited,
1563
1428
  children: /*#__PURE__*/jsxRuntime.jsx(DimmerContentWrapper, {
1564
1429
  scrollBody: !transparent,
1565
- children: /*#__PURE__*/jsxRuntime.jsx(FocusBoundary$1, {
1430
+ children: /*#__PURE__*/jsxRuntime.jsx(FocusBoundary, {
1566
1431
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
1567
1432
  ref: dimmerReference,
1568
1433
  className: classNames__default.default('dimmer', {
@@ -2194,7 +2059,7 @@ var messages$b = reactIntl.defineMessages({
2194
2059
  }
2195
2060
  });
2196
2061
 
2197
- const typeClassMap$1 = {
2062
+ const typeClassMap = {
2198
2063
  [exports.ControlType.ACCENT]: 'btn-accent',
2199
2064
  [exports.ControlType.POSITIVE]: 'btn-positive',
2200
2065
  [exports.ControlType.NEGATIVE]: 'btn-negative'
@@ -2278,7 +2143,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
2278
2143
  },
2279
2144
  // @ts-expect-error fix when refactor `typeClassMap` to TypeScript
2280
2145
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2281
- typeClassMap$1[newType],
2146
+ typeClassMap[newType],
2282
2147
  // @ts-expect-error fix when refactor `typeClassMap` to TypeScript
2283
2148
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2284
2149
  priorityClassMap[newPriority], className);
@@ -2663,7 +2528,7 @@ const CircularButton = ({
2663
2528
  type = exports.ControlType.ACCENT,
2664
2529
  ...rest
2665
2530
  }) => {
2666
- const classes = classNames__default.default('btn np-btn', typeClassMap$1[type], priorityClassMap[priority]);
2531
+ const classes = classNames__default.default('btn np-btn', typeClassMap[type], priorityClassMap[priority]);
2667
2532
  const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
2668
2533
  size: 24
2669
2534
  }) : icon;
@@ -5899,7 +5764,7 @@ function Popover$1({
5899
5764
  const resolvedPlacement = resolvePlacement(preferredPlacement);
5900
5765
  React.useEffect(() => {
5901
5766
  if (resolvedPlacement !== preferredPlacement) {
5902
- logActionRequired$1(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
5767
+ logActionRequired(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
5903
5768
  }
5904
5769
  }, [preferredPlacement, resolvedPlacement]);
5905
5770
  const anchorReference = React.useRef(null);
@@ -6004,49 +5869,22 @@ const Info = ({
6004
5869
  });
6005
5870
  };
6006
5871
 
6007
- const typeClassMap = {
6008
- [exports.Sentiment.ERROR]: 'danger',
6009
- [exports.Sentiment.NEGATIVE]: 'danger'
6010
- };
6011
- const InlineAlert = ({
5872
+ function InlineAlert({
6012
5873
  id,
6013
- type = exports.Sentiment.NEUTRAL,
5874
+ type = 'neutral',
6014
5875
  className,
6015
5876
  children
6016
- }) => {
6017
- const {
6018
- isModern
6019
- } = componentsTheming.useTheme();
6020
- const typeClass = `alert-${typeClassMap[type] || type}`;
6021
- if (isModern) {
6022
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
6023
- role: "alert",
6024
- id: id,
6025
- className: classNames__default.default('alert alert-detach', typeClass, className),
6026
- children: [(type === 'error' || type === 'negative') && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
6027
- children: children
6028
- })]
6029
- });
6030
- }
6031
- const getAlertContents = ({
6032
- children,
6033
- className
6034
- }) => {
6035
- return /*#__PURE__*/jsxRuntime.jsx("div", {
6036
- role: "alert",
6037
- id: id,
6038
- className: classNames__default.default('alert alert-detach p-x-2 p-y-1', typeClass, className),
5877
+ }) {
5878
+ const danger = type === 'negative' || type === 'error';
5879
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
5880
+ role: "alert",
5881
+ id: id,
5882
+ className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
5883
+ children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
6039
5884
  children: children
6040
- });
6041
- };
6042
- const AlertWithArrow = withArrow(getAlertContents, exports.AlertArrowPosition.TOP_LEFT);
6043
- return /*#__PURE__*/jsxRuntime.jsx(AlertWithArrow, {
6044
- id,
6045
- type,
6046
- className,
6047
- children
5885
+ })]
6048
5886
  });
6049
- };
5887
+ }
6050
5888
 
6051
5889
  /*
6052
5890
  * Inspired by:
@@ -6294,61 +6132,65 @@ function BottomSheet({
6294
6132
  theme: "personal",
6295
6133
  screenMode: theme === 'personal' ? screenMode : 'light',
6296
6134
  isNotRootProvider: true,
6297
- children: /*#__PURE__*/jsxRuntime.jsxs(react$1.Transition, {
6135
+ children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition, {
6298
6136
  show: open,
6299
6137
  className: "np-bottom-sheet-v2-container",
6300
6138
  beforeEnter: () => {
6301
6139
  setFloatingKey(prev => prev + 1);
6302
6140
  },
6303
6141
  afterLeave: onCloseEnd,
6304
- children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
6305
- enter: "np-bottom-sheet-v2-backdrop-container--enter",
6306
- enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
6307
- leave: "np-bottom-sheet-v2-backdrop-container--leave",
6308
- leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
6309
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
6310
- className: "np-bottom-sheet-v2-backdrop"
6311
- })
6312
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
6313
- className: "np-bottom-sheet-v2",
6314
- children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
6315
- className: "np-bottom-sheet-v2-content",
6316
- enter: "np-bottom-sheet-v2-content--enter",
6317
- enterFrom: "np-bottom-sheet-v2-content--enter-from",
6318
- leave: "np-bottom-sheet-v2-content--leave",
6319
- leaveTo: "np-bottom-sheet-v2-content--leave-to",
6320
- children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6321
- context: context,
6322
- initialFocus: initialFocusRef,
6323
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6324
- // Force inner state invalidation on open
6325
- ref: refs.setFloating,
6326
- className: "np-bottom-sheet-v2-content-inner-container",
6327
- ...getFloatingProps(),
6328
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
6329
- className: "np-bottom-sheet-v2-header",
6330
- children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
6331
- size: exports.Size.SMALL,
6332
- onClick: () => {
6333
- onClose?.();
6334
- }
6335
- })
6336
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
6337
- className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
6338
- 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
6339
- }),
6340
- children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6341
- className: "np-bottom-sheet-v2-title np-text-title-body",
6342
- children: title
6343
- }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6344
- className: "np-bottom-sheet-v2-body np-text-body-default",
6345
- children: children
6142
+ children: /*#__PURE__*/jsxRuntime.jsxs(FocusBoundary, {
6143
+ children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
6144
+ enter: "np-bottom-sheet-v2-backdrop-container--enter",
6145
+ enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
6146
+ leave: "np-bottom-sheet-v2-backdrop-container--leave",
6147
+ leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
6148
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
6149
+ className: "np-bottom-sheet-v2-backdrop"
6150
+ })
6151
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
6152
+ className: "np-bottom-sheet-v2",
6153
+ children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
6154
+ className: "np-bottom-sheet-v2-content",
6155
+ enter: "np-bottom-sheet-v2-content--enter",
6156
+ enterFrom: "np-bottom-sheet-v2-content--enter-from",
6157
+ leave: "np-bottom-sheet-v2-content--leave",
6158
+ leaveTo: "np-bottom-sheet-v2-content--leave-to",
6159
+ children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6160
+ context: context,
6161
+ initialFocus: initialFocusRef,
6162
+ guards: false,
6163
+ modal: false,
6164
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6165
+ // Force inner state invalidation on open
6166
+ ref: refs.setFloating,
6167
+ className: "np-bottom-sheet-v2-content-inner-container",
6168
+ ...getFloatingProps(),
6169
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
6170
+ className: "np-bottom-sheet-v2-header",
6171
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
6172
+ size: exports.Size.SMALL,
6173
+ onClick: () => {
6174
+ onClose?.();
6175
+ }
6176
+ })
6177
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
6178
+ className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
6179
+ 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
6180
+ }),
6181
+ children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6182
+ className: "np-bottom-sheet-v2-title np-text-title-body",
6183
+ children: title
6184
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6185
+ className: "np-bottom-sheet-v2-body np-text-body-default",
6186
+ children: children
6187
+ })]
6346
6188
  })]
6347
- })]
6348
- }, floatingKey)
6189
+ }, floatingKey)
6190
+ })
6349
6191
  })
6350
- })
6351
- })]
6192
+ })]
6193
+ })
6352
6194
  })
6353
6195
  })
6354
6196
  })]
@@ -6446,32 +6288,36 @@ function Popover({
6446
6288
  setFloatingKey(prev => prev + 1);
6447
6289
  },
6448
6290
  afterLeave: onCloseEnd,
6449
- children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6450
- context: context,
6451
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
6452
- // Force inner state invalidation on open
6453
- ref: refs.setFloating,
6454
- className: classNames__default.default('np-popover-v2-container', {
6455
- 'np-popover-v2-container--size-md': size === 'md',
6456
- 'np-popover-v2-container--size-lg': size === 'lg'
6457
- })
6458
- // eslint-disable-next-line react/forbid-dom-props
6459
- ,
6460
- style: floatingStyles,
6461
- ...getFloatingProps(),
6462
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6463
- className: classNames__default.default('np-popover-v2', title && 'np-popover-v2--has-title', {
6464
- 'np-popover-v2--padding-md': padding === 'md'
6465
- }),
6466
- children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6467
- className: "np-popover-v2-title np-text-title-body",
6468
- children: title
6469
- }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6470
- className: "np-popover-v2-content np-text-body-default",
6471
- children: children
6472
- })]
6473
- })
6474
- }, floatingKey)
6291
+ children: /*#__PURE__*/jsxRuntime.jsx(FocusBoundary, {
6292
+ children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6293
+ context: context,
6294
+ guards: false,
6295
+ modal: false,
6296
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
6297
+ // Force inner state invalidation on open
6298
+ ref: refs.setFloating,
6299
+ className: classNames__default.default('np-popover-v2-container', {
6300
+ 'np-popover-v2-container--size-md': size === 'md',
6301
+ 'np-popover-v2-container--size-lg': size === 'lg'
6302
+ })
6303
+ // eslint-disable-next-line react/forbid-dom-props
6304
+ ,
6305
+ style: floatingStyles,
6306
+ ...getFloatingProps(),
6307
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6308
+ className: classNames__default.default('np-popover-v2', title && 'np-popover-v2--has-title', {
6309
+ 'np-popover-v2--padding-md': padding === 'md'
6310
+ }),
6311
+ children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6312
+ className: "np-popover-v2-title np-text-title-body",
6313
+ children: title
6314
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6315
+ className: "np-popover-v2-content np-text-body-default",
6316
+ children: children
6317
+ })]
6318
+ })
6319
+ }, floatingKey)
6320
+ })
6475
6321
  })
6476
6322
  })
6477
6323
  })
@@ -6850,7 +6696,6 @@ function SelectInputOptions({
6850
6696
  })
6851
6697
  }) : null, /*#__PURE__*/jsxRuntime.jsxs("section", {
6852
6698
  ref: listboxContainerRef,
6853
- tabIndex: -1,
6854
6699
  className: classNames__default.default('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
6855
6700
  children: [resultsEmpty ? /*#__PURE__*/jsxRuntime.jsxs("div", {
6856
6701
  id: statusId,
@@ -15168,7 +15013,7 @@ const translations = {
15168
15013
  exports.Accordion = Accordion;
15169
15014
  exports.ActionButton = ActionButton;
15170
15015
  exports.ActionOption = ActionOption;
15171
- exports.Alert = Alert$1;
15016
+ exports.Alert = Alert;
15172
15017
  exports.Avatar = Avatar;
15173
15018
  exports.AvatarWrapper = AvatarWrapper;
15174
15019
  exports.Badge = Badge;