@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.
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.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, useEffect, useCallback, useLayoutEffect, createContext, useContext, useImperativeHandle, createElement, Component, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
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$2, ClockBorderless, CheckCircle, InfoCircle, Warning, CrossCircle, Clock, Briefcase, Person, ArrowLeft, QuestionMarkCircle, AlertCircle, Search, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, AlertCircleFill } from '@transferwise/icons';
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 = Sentiment.NEUTRAL,
780
- size = Size.MEDIUM
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$1(message) {
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$1(message);
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$1('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
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
- // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
934
- var ArrowPosition;
935
- (function (ArrowPosition) {
936
- ArrowPosition["TOP_LEFT"] = "up-left";
937
- ArrowPosition["TOP"] = "up-center";
938
- ArrowPosition["TOP_RIGHT"] = "up-right";
939
- ArrowPosition["BOTTOM_LEFT"] = "down-left";
940
- ArrowPosition["BOTTOM"] = "down-center";
941
- ArrowPosition["BOTTOM_RIGHT"] = "down-right";
942
- })(ArrowPosition || (ArrowPosition = {}));
943
-
944
- function withArrow(Alert, arrow) {
945
- const AlertWithArrow = props => /*#__PURE__*/jsx(Alert, {
946
- ...props,
947
- className: classNames(props.className, arrowClasses(arrow)),
948
- arrow: undefined
949
- });
950
- AlertWithArrow.propTypes = {
951
- className: PropTypes.string
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 arrowClasses(arrow) {
959
- if (arrow) {
960
- const classes = ['arrow'];
961
- const {
962
- BOTTOM,
963
- BOTTOM_LEFT,
964
- BOTTOM_RIGHT,
965
- TOP,
966
- TOP_RIGHT,
967
- TOP_LEFT
968
- } = ArrowPosition;
969
- switch (arrow) {
970
- case BOTTOM:
971
- return classes.concat('arrow-bottom', 'arrow-center');
972
- case BOTTOM_LEFT:
973
- return classes.concat('arrow-bottom', 'arrow-left');
974
- case BOTTOM_RIGHT:
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
- return '';
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
- if (isModern) {
1035
- return /*#__PURE__*/jsx(StatusIcon, {
1036
- size: Size.LARGE,
1037
- sentiment: mappedType
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
- const handleTouchStart = () => setShouldFire(true);
1046
- const handleTouchMove = () => setShouldFire(false);
1047
- const handleTouchEnd = event => {
1048
- if (shouldFire && action) {
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
- if (closeButtonReference?.current && !closeButtonReference.current.contains(event.target)) {
1051
- if (action?.target === '_blank') {
1052
- window.top.open(action.href);
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.location.assign(action.href);
968
+ window.top?.location.assign(action.href);
1055
969
  }
1056
970
  }
1057
- }
1058
- setShouldFire(false);
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: [generateIcon(), /*#__PURE__*/jsxs("div", {
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 === mappedType ? 'alert' : 'status',
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
- Alert.propTypes = {
1115
- /** 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 */
1116
- action: PropTypes.shape({
1117
- 'aria-label': PropTypes.string,
1118
- href: PropTypes.string.isRequired,
1119
- target: PropTypes.string,
1120
- text: PropTypes.node.isRequired
1121
- }),
1122
- className: PropTypes.string,
1123
- /** An optional icon. If not provided, we will default the icon to something appropriate for the type */
1124
- icon: PropTypes.element,
1125
- /** Title for the alert component */
1126
- title: PropTypes.string,
1127
- /** The main body of the alert. Accepts plain text and bold words specified with **double stars*/
1128
- message: requiredIf(PropTypes.node, ({
1129
- children
1130
- }) => !children),
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$1, {
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$1 = {
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$1[newType],
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$1[type], priorityClassMap[priority]);
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$1(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
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
- const typeClassMap = {
5976
- [Sentiment.ERROR]: 'danger',
5977
- [Sentiment.NEGATIVE]: 'danger'
5978
- };
5979
- const InlineAlert = ({
5840
+ function InlineAlert({
5980
5841
  id,
5981
- type = Sentiment.NEUTRAL,
5842
+ type = 'neutral',
5982
5843
  className,
5983
5844
  children
5984
- }) => {
5985
- const {
5986
- isModern
5987
- } = useTheme();
5988
- const typeClass = `alert-${typeClassMap[type] || type}`;
5989
- if (isModern) {
5990
- return /*#__PURE__*/jsxs("div", {
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__*/jsxs(Transition, {
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: [/*#__PURE__*/jsx(Transition.Child, {
6273
- enter: "np-bottom-sheet-v2-backdrop-container--enter",
6274
- enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
6275
- leave: "np-bottom-sheet-v2-backdrop-container--leave",
6276
- leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
6277
- children: /*#__PURE__*/jsx("div", {
6278
- className: "np-bottom-sheet-v2-backdrop"
6279
- })
6280
- }), /*#__PURE__*/jsx("div", {
6281
- className: "np-bottom-sheet-v2",
6282
- children: /*#__PURE__*/jsx(Transition.Child, {
6283
- className: "np-bottom-sheet-v2-content",
6284
- enter: "np-bottom-sheet-v2-content--enter",
6285
- enterFrom: "np-bottom-sheet-v2-content--enter-from",
6286
- leave: "np-bottom-sheet-v2-content--leave",
6287
- leaveTo: "np-bottom-sheet-v2-content--leave-to",
6288
- children: /*#__PURE__*/jsx(FloatingFocusManager, {
6289
- context: context,
6290
- initialFocus: initialFocusRef,
6291
- children: /*#__PURE__*/jsxs("div", {
6292
- // Force inner state invalidation on open
6293
- ref: refs.setFloating,
6294
- className: "np-bottom-sheet-v2-content-inner-container",
6295
- ...getFloatingProps(),
6296
- children: [/*#__PURE__*/jsx("div", {
6297
- className: "np-bottom-sheet-v2-header",
6298
- children: /*#__PURE__*/jsx(CloseButton, {
6299
- size: Size.SMALL,
6300
- onClick: () => {
6301
- onClose?.();
6302
- }
6303
- })
6304
- }), /*#__PURE__*/jsxs("div", {
6305
- className: classNames('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
6306
- 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
6307
- }),
6308
- children: [title ? /*#__PURE__*/jsx("h2", {
6309
- className: "np-bottom-sheet-v2-title np-text-title-body",
6310
- children: title
6311
- }) : null, /*#__PURE__*/jsx("div", {
6312
- className: "np-bottom-sheet-v2-body np-text-body-default",
6313
- children: children
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
- }, floatingKey)
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(FloatingFocusManager, {
6418
- context: context,
6419
- children: /*#__PURE__*/jsx("div", {
6420
- // Force inner state invalidation on open
6421
- ref: refs.setFloating,
6422
- className: classNames('np-popover-v2-container', {
6423
- 'np-popover-v2-container--size-md': size$1 === 'md',
6424
- 'np-popover-v2-container--size-lg': size$1 === 'lg'
6425
- })
6426
- // eslint-disable-next-line react/forbid-dom-props
6427
- ,
6428
- style: floatingStyles,
6429
- ...getFloatingProps(),
6430
- children: /*#__PURE__*/jsxs("div", {
6431
- className: classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
6432
- 'np-popover-v2--padding-md': padding === 'md'
6433
- }),
6434
- children: [title ? /*#__PURE__*/jsx("h2", {
6435
- className: "np-popover-v2-title np-text-title-body",
6436
- children: title
6437
- }) : null, /*#__PURE__*/jsx("div", {
6438
- className: "np-popover-v2-content np-text-body-default",
6439
- children: children
6440
- })]
6441
- })
6442
- }, floatingKey)
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$2, {
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$1 as Alert, ArrowPosition as AlertArrowPosition, 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 };
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