@transferwise/components 46.114.1 → 46.115.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/build/common/closeButton/CloseButton.messages.js +2 -2
  2. package/build/common/closeButton/CloseButton.messages.js.map +1 -1
  3. package/build/common/closeButton/CloseButton.messages.mjs +2 -2
  4. package/build/common/closeButton/CloseButton.messages.mjs.map +1 -1
  5. package/build/common/closeButton/CloseButton.mjs +2 -2
  6. package/build/common/closeButton/CloseButton.mjs.map +1 -1
  7. package/build/drawer/Drawer.js +18 -9
  8. package/build/drawer/Drawer.js.map +1 -1
  9. package/build/drawer/Drawer.mjs +18 -9
  10. package/build/drawer/Drawer.mjs.map +1 -1
  11. package/build/main.css +17 -127
  12. package/build/modal/Modal.js +20 -21
  13. package/build/modal/Modal.js.map +1 -1
  14. package/build/modal/Modal.mjs +20 -21
  15. package/build/modal/Modal.mjs.map +1 -1
  16. package/build/styles/drawer/Drawer.css +11 -58
  17. package/build/styles/main.css +17 -127
  18. package/build/styles/modal/Modal.css +6 -69
  19. package/build/types/drawer/Drawer.d.ts.map +1 -1
  20. package/build/types/modal/Modal.d.ts.map +1 -1
  21. package/package.json +1 -1
  22. package/src/accordion/Accordion.story.tsx +1 -1
  23. package/src/avatarLayout/AvatarLayout.story.tsx +1 -0
  24. package/src/avatarView/AvatarView.story.tsx +1 -0
  25. package/src/display/Display.story.tsx +1 -0
  26. package/src/drawer/Drawer.css +11 -58
  27. package/src/drawer/Drawer.less +14 -70
  28. package/src/drawer/Drawer.story.tsx +158 -100
  29. package/src/drawer/Drawer.tsx +26 -7
  30. package/src/iconButton/IconButton.story.tsx +1 -0
  31. package/src/main.css +17 -127
  32. package/src/modal/Modal.css +6 -69
  33. package/src/modal/Modal.less +6 -76
  34. package/src/modal/Modal.tsx +23 -23
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var reactIntl = require('react-intl');
6
6
 
7
- var messages = reactIntl.defineMessages({
7
+ var closeBtnMessages = reactIntl.defineMessages({
8
8
  ariaLabel: {
9
9
  id: "neptune.CloseButton.ariaLabel"
10
10
  }
11
11
  });
12
12
 
13
- exports.default = messages;
13
+ exports.default = closeBtnMessages;
14
14
  //# sourceMappingURL=CloseButton.messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CloseButton.messages.js","sources":["../../../src/common/closeButton/CloseButton.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n ariaLabel: {\n id: 'neptune.CloseButton.ariaLabel',\n defaultMessage: 'Close',\n description: 'Description of close button',\n },\n});\n"],"names":["defineMessages","ariaLabel","id"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,SAAS,EAAE;IACTC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"CloseButton.messages.js","sources":["../../../src/common/closeButton/CloseButton.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n ariaLabel: {\n id: 'neptune.CloseButton.ariaLabel',\n defaultMessage: 'Close',\n description: 'Description of close button',\n },\n});\n"],"names":["defineMessages","ariaLabel","id"],"mappings":";;;;;;AAEA,uBAAeA,wBAAc,CAAC;AAC5BC,EAAAA,SAAS,EAAE;IACTC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
@@ -1,10 +1,10 @@
1
1
  import { defineMessages } from 'react-intl';
2
2
 
3
- var messages = defineMessages({
3
+ var closeBtnMessages = defineMessages({
4
4
  ariaLabel: {
5
5
  id: "neptune.CloseButton.ariaLabel"
6
6
  }
7
7
  });
8
8
 
9
- export { messages as default };
9
+ export { closeBtnMessages as default };
10
10
  //# sourceMappingURL=CloseButton.messages.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CloseButton.messages.mjs","sources":["../../../src/common/closeButton/CloseButton.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n ariaLabel: {\n id: 'neptune.CloseButton.ariaLabel',\n defaultMessage: 'Close',\n description: 'Description of close button',\n },\n});\n"],"names":["defineMessages","ariaLabel","id"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,SAAS,EAAE;IACTC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"CloseButton.messages.mjs","sources":["../../../src/common/closeButton/CloseButton.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n ariaLabel: {\n id: 'neptune.CloseButton.ariaLabel',\n defaultMessage: 'Close',\n description: 'Description of close button',\n },\n});\n"],"names":["defineMessages","ariaLabel","id"],"mappings":";;AAEA,uBAAeA,cAAc,CAAC;AAC5BC,EAAAA,SAAS,EAAE;IACTC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
@@ -3,7 +3,7 @@ import { clsx } from 'clsx';
3
3
  import { forwardRef } from 'react';
4
4
  import { useIntl } from 'react-intl';
5
5
  import { Size } from '../propsValues/size.mjs';
6
- import messages from './CloseButton.messages.mjs';
6
+ import closeBtnMessages from './CloseButton.messages.mjs';
7
7
  import { jsx } from 'react/jsx-runtime';
8
8
 
9
9
  const CloseButton = /*#__PURE__*/forwardRef(function CloseButton({
@@ -17,7 +17,7 @@ const CloseButton = /*#__PURE__*/forwardRef(function CloseButton({
17
17
  tabIndex
18
18
  }, reference) {
19
19
  const intl = useIntl();
20
- ariaLabel ??= intl.formatMessage(messages.ariaLabel);
20
+ ariaLabel ??= intl.formatMessage(closeBtnMessages.ariaLabel);
21
21
  const Icon = filled ? CrossCircleFill : Cross;
22
22
  return /*#__PURE__*/jsx("button", {
23
23
  ref: reference,
@@ -1 +1 @@
1
- {"version":3,"file":"CloseButton.mjs","sources":["../../../src/common/closeButton/CloseButton.tsx"],"sourcesContent":["import { Cross, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall, SizeExtraSmall } from '../propsValues/size';\n\nimport messages from './CloseButton.messages';\n\nexport type CloseButtonProps = Pick<\n React.ComponentPropsWithoutRef<'button'>,\n 'aria-label' | 'className' | 'onClick'\n> & {\n size?: SizeExtraSmall | SizeSmall | SizeMedium | SizeLarge;\n filled?: boolean;\n isDisabled?: boolean;\n testId?: string;\n tabIndex?: number;\n};\n\n/**\n * @deprecated Use `<IconButton />` component instead\n */\nexport const CloseButton = forwardRef(function CloseButton(\n {\n 'aria-label': ariaLabel,\n size = Size.MEDIUM,\n filled = false,\n className,\n onClick,\n isDisabled,\n testId,\n tabIndex,\n }: CloseButtonProps,\n reference: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n const intl = useIntl();\n ariaLabel ??= intl.formatMessage(messages.ariaLabel);\n const Icon = filled ? CrossCircleFill : Cross;\n\n return (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-close-button',\n 'close btn-link',\n 'text-no-decoration',\n {\n 'np-close-button--x-small': size === Size.EXTRA_SMALL,\n 'np-close-button--large': size === Size.MEDIUM,\n 'np-close-button--x-large': size === Size.LARGE,\n },\n className,\n )}\n aria-label={ariaLabel}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-testid={testId}\n tabIndex={tabIndex}\n onClick={onClick}\n >\n <Icon size={size === Size.SMALL || size === Size.EXTRA_SMALL ? 16 : 24} />\n </button>\n );\n});\n"],"names":["CloseButton","forwardRef","ariaLabel","size","Size","MEDIUM","filled","className","onClick","isDisabled","testId","tabIndex","reference","intl","useIntl","formatMessage","messages","Icon","CrossCircleFill","Cross","_jsx","ref","type","clsx","EXTRA_SMALL","LARGE","disabled","children","SMALL"],"mappings":";;;;;;;;MAuBaA,WAAW,gBAAGC,UAAU,CAAC,SAASD,WAAWA,CACxD;AACE,EAAA,YAAY,EAAEE,SAAS;EACvBC,IAAI,GAAGC,IAAI,CAACC,MAAM;AAClBC,EAAAA,MAAM,GAAG,KAAK;EACdC,SAAS;EACTC,OAAO;EACPC,UAAU;EACVC,MAAM;AACNC,EAAAA;AAAQ,CACS,EACnBC,SAAuD,EAAA;AAEvD,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtBZ,SAAS,KAAKW,IAAI,CAACE,aAAa,CAACC,QAAQ,CAACd,SAAS,CAAC;AACpD,EAAA,MAAMe,IAAI,GAAGX,MAAM,GAAGY,eAAe,GAAGC,KAAK;AAE7C,EAAA,oBACEC,GAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,GAAG,EAAET,SAAU;AACfU,IAAAA,IAAI,EAAC,QAAQ;IACbf,SAAS,EAAEgB,IAAI,CACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB;AACE,MAAA,0BAA0B,EAAEpB,IAAI,KAAKC,IAAI,CAACoB,WAAW;AACrD,MAAA,wBAAwB,EAAErB,IAAI,KAAKC,IAAI,CAACC,MAAM;AAC9C,MAAA,0BAA0B,EAAEF,IAAI,KAAKC,IAAI,CAACqB;KAC3C,EACDlB,SAAS,CACT;AACF,IAAA,YAAA,EAAYL,SAAU;AACtB,IAAA,eAAA,EAAeO,UAAW;AAC1BiB,IAAAA,QAAQ,EAAEjB,UAAW;AACrB,IAAA,aAAA,EAAaC,MAAO;AACpBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBH,IAAAA,OAAO,EAAEA,OAAQ;IAAAmB,QAAA,eAEjBP,GAAA,CAACH,IAAI,EAAA;AAACd,MAAAA,IAAI,EAAEA,IAAI,KAAKC,IAAI,CAACwB,KAAK,IAAIzB,IAAI,KAAKC,IAAI,CAACoB,WAAW,GAAG,EAAE,GAAG;KAAG;AACzE,GAAQ,CAAC;AAEb,CAAC;;;;"}
1
+ {"version":3,"file":"CloseButton.mjs","sources":["../../../src/common/closeButton/CloseButton.tsx"],"sourcesContent":["import { Cross, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall, SizeExtraSmall } from '../propsValues/size';\n\nimport messages from './CloseButton.messages';\n\nexport type CloseButtonProps = Pick<\n React.ComponentPropsWithoutRef<'button'>,\n 'aria-label' | 'className' | 'onClick'\n> & {\n size?: SizeExtraSmall | SizeSmall | SizeMedium | SizeLarge;\n filled?: boolean;\n isDisabled?: boolean;\n testId?: string;\n tabIndex?: number;\n};\n\n/**\n * @deprecated Use `<IconButton />` component instead\n */\nexport const CloseButton = forwardRef(function CloseButton(\n {\n 'aria-label': ariaLabel,\n size = Size.MEDIUM,\n filled = false,\n className,\n onClick,\n isDisabled,\n testId,\n tabIndex,\n }: CloseButtonProps,\n reference: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n const intl = useIntl();\n ariaLabel ??= intl.formatMessage(messages.ariaLabel);\n const Icon = filled ? CrossCircleFill : Cross;\n\n return (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-close-button',\n 'close btn-link',\n 'text-no-decoration',\n {\n 'np-close-button--x-small': size === Size.EXTRA_SMALL,\n 'np-close-button--large': size === Size.MEDIUM,\n 'np-close-button--x-large': size === Size.LARGE,\n },\n className,\n )}\n aria-label={ariaLabel}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-testid={testId}\n tabIndex={tabIndex}\n onClick={onClick}\n >\n <Icon size={size === Size.SMALL || size === Size.EXTRA_SMALL ? 16 : 24} />\n </button>\n );\n});\n"],"names":["CloseButton","forwardRef","ariaLabel","size","Size","MEDIUM","filled","className","onClick","isDisabled","testId","tabIndex","reference","intl","useIntl","formatMessage","messages","Icon","CrossCircleFill","Cross","_jsx","ref","type","clsx","EXTRA_SMALL","LARGE","disabled","children","SMALL"],"mappings":";;;;;;;;MAuBaA,WAAW,gBAAGC,UAAU,CAAC,SAASD,WAAWA,CACxD;AACE,EAAA,YAAY,EAAEE,SAAS;EACvBC,IAAI,GAAGC,IAAI,CAACC,MAAM;AAClBC,EAAAA,MAAM,GAAG,KAAK;EACdC,SAAS;EACTC,OAAO;EACPC,UAAU;EACVC,MAAM;AACNC,EAAAA;AAAQ,CACS,EACnBC,SAAuD,EAAA;AAEvD,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtBZ,SAAS,KAAKW,IAAI,CAACE,aAAa,CAACC,gBAAQ,CAACd,SAAS,CAAC;AACpD,EAAA,MAAMe,IAAI,GAAGX,MAAM,GAAGY,eAAe,GAAGC,KAAK;AAE7C,EAAA,oBACEC,GAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,GAAG,EAAET,SAAU;AACfU,IAAAA,IAAI,EAAC,QAAQ;IACbf,SAAS,EAAEgB,IAAI,CACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB;AACE,MAAA,0BAA0B,EAAEpB,IAAI,KAAKC,IAAI,CAACoB,WAAW;AACrD,MAAA,wBAAwB,EAAErB,IAAI,KAAKC,IAAI,CAACC,MAAM;AAC9C,MAAA,0BAA0B,EAAEF,IAAI,KAAKC,IAAI,CAACqB;KAC3C,EACDlB,SAAS,CACT;AACF,IAAA,YAAA,EAAYL,SAAU;AACtB,IAAA,eAAA,EAAeO,UAAW;AAC1BiB,IAAAA,QAAQ,EAAEjB,UAAW;AACrB,IAAA,aAAA,EAAaC,MAAO;AACpBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBH,IAAAA,OAAO,EAAEA,OAAQ;IAAAmB,QAAA,eAEjBP,GAAA,CAACH,IAAI,EAAA;AAACd,MAAAA,IAAI,EAAEA,IAAI,KAAKC,IAAI,CAACwB,KAAK,IAAIzB,IAAI,KAAKC,IAAI,CAACoB,WAAW,GAAG,EAAE,GAAG;KAAG;AACzE,GAAQ,CAAC;AAEb,CAAC;;;;"}
@@ -23,7 +23,10 @@ require('../common/propsValues/variant.js');
23
23
  require('../common/propsValues/scroll.js');
24
24
  require('../common/propsValues/markdownNodeType.js');
25
25
  require('../common/fileType.js');
26
- var CloseButton = require('../common/closeButton/CloseButton.js');
26
+ var icons = require('@transferwise/icons');
27
+ var reactIntl = require('react-intl');
28
+ var CloseButton_messages = require('../common/closeButton/CloseButton.messages.js');
29
+ var jsxRuntime = require('react/jsx-runtime');
27
30
  require('@transferwise/neptune-validation');
28
31
  require('../provider/direction/DirectionProvider.js');
29
32
  var useLayout = require('../common/hooks/useLayout/useLayout.js');
@@ -32,7 +35,7 @@ var OverlayIdProvider = require('../provider/overlay/OverlayIdProvider.js');
32
35
  var SlidingPanel = require('../slidingPanel/SlidingPanel.js');
33
36
  var Title = require('../title/Title.js');
34
37
  var logActionRequired = require('../utilities/logActionRequired.js');
35
- var jsxRuntime = require('react/jsx-runtime');
38
+ var IconButton = require('../iconButton/IconButton.js');
36
39
 
37
40
  function Drawer({
38
41
  children,
@@ -46,6 +49,7 @@ function Drawer({
46
49
  role = 'dialog',
47
50
  'aria-labelledby': ariaLabelledBy
48
51
  }) {
52
+ const intl = reactIntl.useIntl();
49
53
  logActionRequired.logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
50
54
  const {
51
55
  isMobile
@@ -66,22 +70,27 @@ function Drawer({
66
70
  "aria-labelledby": ariaLabelledBy || (headerTitle ? titleId : undefined),
67
71
  className: clsx.clsx('np-drawer', className),
68
72
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
69
- className: clsx.clsx('np-drawer-header', {
70
- 'np-drawer-header--withborder': headerTitle
71
- }),
73
+ className: clsx.clsx('np-drawer-header', 'd-flex', 'align-items-center', headerTitle ? 'justify-content-between' : 'justify-content-end', 'flex-wrap'),
72
74
  children: [headerTitle && /*#__PURE__*/jsxRuntime.jsx(Title.default, {
73
75
  id: titleId,
74
- type: typography.Typography.TITLE_BODY,
76
+ type: typography.Typography.TITLE_SUBSECTION,
77
+ className: "np-drawer-title",
75
78
  children: headerTitle
76
- }), /*#__PURE__*/jsxRuntime.jsx(CloseButton.CloseButton, {
77
- onClick: onClose
79
+ }), /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
80
+ size: 40,
81
+ priority: "tertiary",
82
+ "aria-label": intl.formatMessage(CloseButton_messages.default.ariaLabel),
83
+ onClick: onClose,
84
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
78
85
  })]
79
86
  }), children && /*#__PURE__*/jsxRuntime.jsx("div", {
80
87
  className: clsx.clsx('np-drawer-content'),
81
88
  children: children
82
- }), footerContent && /*#__PURE__*/jsxRuntime.jsx("div", {
89
+ }), footerContent ? /*#__PURE__*/jsxRuntime.jsx("div", {
83
90
  className: clsx.clsx('np-drawer-footer'),
84
91
  children: footerContent
92
+ }) : /*#__PURE__*/jsxRuntime.jsx("div", {
93
+ className: "m-t-3"
85
94
  })]
86
95
  })
87
96
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sources":["../../src/drawer/Drawer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { HTMLAttributes, useContext, useId } from 'react';\n\nimport { Position, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../slidingPanel';\nimport Title from '../title';\nimport { logActionRequiredIf } from '../utilities';\n\nexport type DrawerProps = {\n /** The content to appear in the drawer body. */\n children?: React.ReactNode;\n className?: string;\n /** The content to appear in the drawer footer. */\n footerContent?: React.ReactNode;\n /** The content to appear in the drawer header. */\n headerTitle?: React.ReactNode;\n /** The status of Drawer either open or not. */\n open?: boolean;\n /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */\n position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;\n /** The action to perform on close click. */\n onClose?: (event: KeyboardEvent | React.MouseEvent) => void;\n onUnmount?: () => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n onUnmount,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n logActionRequiredIf(\n 'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',\n !onClose,\n );\n\n const { isMobile } = useLayout();\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} onClose={onClose} onExited={onUnmount}>\n <SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>\n <div\n id={overlayId}\n role={role}\n aria-modal\n aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}\n className={clsx('np-drawer', className)}\n >\n <div\n className={clsx('np-drawer-header', {\n 'np-drawer-header--withborder': headerTitle,\n })}\n >\n {headerTitle && (\n <Title id={titleId} type={Typography.TITLE_BODY}>\n {headerTitle}\n </Title>\n )}\n <CloseButton onClick={onClose} />\n </div>\n {children && <div className={clsx('np-drawer-content')}>{children}</div>}\n {footerContent && <div className={clsx('np-drawer-footer')}>{footerContent}</div>}\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n}\n"],"names":["Drawer","children","className","footerContent","headerTitle","onClose","onUnmount","open","position","role","ariaLabelledBy","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","onExited","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_BODY","CloseButton","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Bc,SAAUA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,OAAO;EACPC,SAAS;AACTC,EAAAA,IAAI,GAAG,KAAK;AACZC,YAAAA,UAAQ,GAAG,OAAO;AAClBC,EAAAA,IAAI,GAAG,QAAQ;AACf,EAAA,iBAAiB,EAAEC;AAAc,CACrB,EAAA;AACZC,EAAAA,qCAAmB,CACjB,8GAA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B,cAAA,CAAA,KAAA,EAAA;AAAKjB,UAAAA,SAAS,EAAE0B,SAAI,CAAC,mBAAmB,CAAE;AAAA3B,UAAAA,QAAA,EAAEA;AAAQ,SAAM,CAAC,EACvEE,aAAa,iBAAIgB,cAAA,CAAA,KAAA,EAAA;AAAKjB,UAAAA,SAAS,EAAE0B,SAAI,CAAC,kBAAkB,CAAE;AAAA3B,UAAAA,QAAA,EAAEE;AAAa,SAAM,CAAC;OAC9E;KACO;AAChB,GAAQ,CAAC;AAEb;;;;"}
1
+ {"version":3,"file":"Drawer.js","sources":["../../src/drawer/Drawer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { HTMLAttributes, useContext, useId } from 'react';\n\nimport { Position, Typography } from '../common';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../slidingPanel';\nimport Title from '../title';\nimport { logActionRequiredIf } from '../utilities';\nimport IconButton from '../iconButton';\nimport closeBtnMessages from '../common/closeButton/CloseButton.messages';\nimport { useIntl } from 'react-intl';\nimport { Cross } from '@transferwise/icons';\n\nexport type DrawerProps = {\n /** The content to appear in the drawer body. */\n children?: React.ReactNode;\n className?: string;\n /** The content to appear in the drawer footer. */\n footerContent?: React.ReactNode;\n /** The content to appear in the drawer header. */\n headerTitle?: React.ReactNode;\n /** The status of Drawer either open or not. */\n open?: boolean;\n /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */\n position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;\n /** The action to perform on close click. */\n onClose?: (event: KeyboardEvent | React.MouseEvent) => void;\n onUnmount?: () => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n onUnmount,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n const intl = useIntl();\n logActionRequiredIf(\n 'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',\n !onClose,\n );\n\n const { isMobile } = useLayout();\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} onClose={onClose} onExited={onUnmount}>\n <SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>\n <div\n id={overlayId}\n role={role}\n aria-modal\n aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}\n className={clsx('np-drawer', className)}\n >\n <div\n className={clsx(\n 'np-drawer-header',\n 'd-flex',\n 'align-items-center',\n headerTitle ? 'justify-content-between' : 'justify-content-end',\n 'flex-wrap',\n )}\n >\n {headerTitle && (\n <Title id={titleId} type={Typography.TITLE_SUBSECTION} className=\"np-drawer-title\">\n {headerTitle}\n </Title>\n )}\n <IconButton\n size={40}\n priority=\"tertiary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onClose}\n >\n <Cross />\n </IconButton>\n </div>\n {children && <div className={clsx('np-drawer-content')}>{children}</div>}\n {footerContent ? (\n <div className={clsx('np-drawer-footer')}>{footerContent}</div>\n ) : (\n <div className=\"m-t-3\" />\n )}\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n}\n"],"names":["Drawer","children","className","footerContent","headerTitle","onClose","onUnmount","open","position","role","ariaLabelledBy","intl","useIntl","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","onExited","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_SUBSECTION","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCc,SAAUA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,OAAO;EACPC,SAAS;AACTC,EAAAA,IAAI,GAAG,KAAK;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A,EAAE,EAAEZ,OAAQ;YAACgB,IAAI,EAAEC,qBAAU,CAACC,gBAAiB;AAAChC,YAAAA,SAAS,EAAC,iBAAiB;AAAAD,YAAAA,QAAA,EAC/EG;AAAW,WACP,CACR,eACDiB,cAAA,CAACc,kBAAU,EAAA;AACTC,YAAAA,IAAI,EAAE,EAAG;AACTC,YAAAA,QAAQ,EAAC,UAAU;AACnB,YAAA,YAAA,EAAY1B,IAAI,CAAC2B,aAAa,CAACC,4BAAgB,CAACC,SAAS,CAAE;AAC3DC,YAAAA,OAAO,EAAEpC,OAAQ;AAAAJ,YAAAA,QAAA,eAEjBoB,cAAA,CAACqB,WAAK,EAAA,EAAA;AACR,WAAY,CACd;AAAA,SAAK,CACL,EAACzC,QAAQ,iBAAIoB,cAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAE4B,SAAI,CAAC,mBAAmB,CAAE;AAAA7B,UAAAA,QAAA,EAAEA;AAAQ,SAAM,CAAC,EACvEE,aAAa,gBACZkB,cAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAE4B,SAAI,CAAC,kBAAkB,CAAE;AAAA7B,UAAAA,QAAA,EAAEE;SAAmB,CAAC,gBAE/DkB,cAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAC;AAAO,SAAA,CACvB;OACE;KACO;AAChB,GAAQ,CAAC;AAEb;;;;"}
@@ -19,7 +19,10 @@ import '../common/propsValues/variant.mjs';
19
19
  import '../common/propsValues/scroll.mjs';
20
20
  import '../common/propsValues/markdownNodeType.mjs';
21
21
  import '../common/fileType.mjs';
22
- import { CloseButton } from '../common/closeButton/CloseButton.mjs';
22
+ import { Cross } from '@transferwise/icons';
23
+ import { useIntl } from 'react-intl';
24
+ import closeBtnMessages from '../common/closeButton/CloseButton.messages.mjs';
25
+ import { jsx, jsxs } from 'react/jsx-runtime';
23
26
  import '@transferwise/neptune-validation';
24
27
  import '../provider/direction/DirectionProvider.mjs';
25
28
  import { useLayout } from '../common/hooks/useLayout/useLayout.mjs';
@@ -28,7 +31,7 @@ import { OverlayIdContext } from '../provider/overlay/OverlayIdProvider.mjs';
28
31
  import SlidingPanel from '../slidingPanel/SlidingPanel.mjs';
29
32
  import Title from '../title/Title.mjs';
30
33
  import { logActionRequiredIf } from '../utilities/logActionRequired.mjs';
31
- import { jsx, jsxs } from 'react/jsx-runtime';
34
+ import IconButton from '../iconButton/IconButton.mjs';
32
35
 
33
36
  function Drawer({
34
37
  children,
@@ -42,6 +45,7 @@ function Drawer({
42
45
  role = 'dialog',
43
46
  'aria-labelledby': ariaLabelledBy
44
47
  }) {
48
+ const intl = useIntl();
45
49
  logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
46
50
  const {
47
51
  isMobile
@@ -62,22 +66,27 @@ function Drawer({
62
66
  "aria-labelledby": ariaLabelledBy || (headerTitle ? titleId : undefined),
63
67
  className: clsx('np-drawer', className),
64
68
  children: [/*#__PURE__*/jsxs("div", {
65
- className: clsx('np-drawer-header', {
66
- 'np-drawer-header--withborder': headerTitle
67
- }),
69
+ className: clsx('np-drawer-header', 'd-flex', 'align-items-center', headerTitle ? 'justify-content-between' : 'justify-content-end', 'flex-wrap'),
68
70
  children: [headerTitle && /*#__PURE__*/jsx(Title, {
69
71
  id: titleId,
70
- type: Typography.TITLE_BODY,
72
+ type: Typography.TITLE_SUBSECTION,
73
+ className: "np-drawer-title",
71
74
  children: headerTitle
72
- }), /*#__PURE__*/jsx(CloseButton, {
73
- onClick: onClose
75
+ }), /*#__PURE__*/jsx(IconButton, {
76
+ size: 40,
77
+ priority: "tertiary",
78
+ "aria-label": intl.formatMessage(closeBtnMessages.ariaLabel),
79
+ onClick: onClose,
80
+ children: /*#__PURE__*/jsx(Cross, {})
74
81
  })]
75
82
  }), children && /*#__PURE__*/jsx("div", {
76
83
  className: clsx('np-drawer-content'),
77
84
  children: children
78
- }), footerContent && /*#__PURE__*/jsx("div", {
85
+ }), footerContent ? /*#__PURE__*/jsx("div", {
79
86
  className: clsx('np-drawer-footer'),
80
87
  children: footerContent
88
+ }) : /*#__PURE__*/jsx("div", {
89
+ className: "m-t-3"
81
90
  })]
82
91
  })
83
92
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.mjs","sources":["../../src/drawer/Drawer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { HTMLAttributes, useContext, useId } from 'react';\n\nimport { Position, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../slidingPanel';\nimport Title from '../title';\nimport { logActionRequiredIf } from '../utilities';\n\nexport type DrawerProps = {\n /** The content to appear in the drawer body. */\n children?: React.ReactNode;\n className?: string;\n /** The content to appear in the drawer footer. */\n footerContent?: React.ReactNode;\n /** The content to appear in the drawer header. */\n headerTitle?: React.ReactNode;\n /** The status of Drawer either open or not. */\n open?: boolean;\n /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */\n position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;\n /** The action to perform on close click. */\n onClose?: (event: KeyboardEvent | React.MouseEvent) => void;\n onUnmount?: () => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n onUnmount,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n logActionRequiredIf(\n 'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',\n !onClose,\n );\n\n const { isMobile } = useLayout();\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} onClose={onClose} onExited={onUnmount}>\n <SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>\n <div\n id={overlayId}\n role={role}\n aria-modal\n aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}\n className={clsx('np-drawer', className)}\n >\n <div\n className={clsx('np-drawer-header', {\n 'np-drawer-header--withborder': headerTitle,\n })}\n >\n {headerTitle && (\n <Title id={titleId} type={Typography.TITLE_BODY}>\n {headerTitle}\n </Title>\n )}\n <CloseButton onClick={onClose} />\n </div>\n {children && <div className={clsx('np-drawer-content')}>{children}</div>}\n {footerContent && <div className={clsx('np-drawer-footer')}>{footerContent}</div>}\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n}\n"],"names":["Drawer","children","className","footerContent","headerTitle","onClose","onUnmount","open","position","role","ariaLabelledBy","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","onExited","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_BODY","CloseButton","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Bc,SAAUA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,OAAO;EACPC,SAAS;AACTC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,QAAQ,GAAG,OAAO;AAClBC,EAAAA,IAAI,GAAG,QAAQ;AACf,EAAA,iBAAiB,EAAEC;AAAc,CACrB,EAAA;AACZC,EAAAA,mBAAmB,CACjB,8GAA8G,EAC9G,CAACN,OAAO,CACT;EAED,MAAM;AAAEO,IAAAA;GAAU,GAAGC,SAAS,EAAE;AAChC,EAAA,MAAMC,OAAO,GAAGC,KAAK,EAAE;AAEvB,EAAA,MAAMC,SAAS,GAAGC,UAAU,CAACC,gBAAgB,CAAC;EAE9C,oBACEC,GAAA,CAACC,MAAM,EAAA;AAACb,IAAAA,IAAI,EAAEA,IAAK;AAACF,IAAAA,OAAO,EAAEA,OAAQ;AAACgB,IAAAA,QAAQ,EAAEf,SAAU;IAAAL,QAAA,eACxDkB,GAAA,CAACG,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drawer/Drawer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { HTMLAttributes, useContext, useId } from 'react';\n\nimport { Position, Typography } from '../common';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../slidingPanel';\nimport Title from '../title';\nimport { logActionRequiredIf } from '../utilities';\nimport IconButton from '../iconButton';\nimport closeBtnMessages from '../common/closeButton/CloseButton.messages';\nimport { useIntl } from 'react-intl';\nimport { Cross } from '@transferwise/icons';\n\nexport type DrawerProps = {\n /** The content to appear in the drawer body. */\n children?: React.ReactNode;\n className?: string;\n /** The content to appear in the drawer footer. */\n footerContent?: React.ReactNode;\n /** The content to appear in the drawer header. */\n headerTitle?: React.ReactNode;\n /** The status of Drawer either open or not. */\n open?: boolean;\n /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */\n position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;\n /** The action to perform on close click. */\n onClose?: (event: KeyboardEvent | React.MouseEvent) => void;\n onUnmount?: () => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n onUnmount,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n const intl = useIntl();\n logActionRequiredIf(\n 'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',\n !onClose,\n );\n\n const { isMobile } = useLayout();\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} onClose={onClose} onExited={onUnmount}>\n <SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>\n <div\n id={overlayId}\n role={role}\n aria-modal\n aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}\n className={clsx('np-drawer', className)}\n >\n <div\n className={clsx(\n 'np-drawer-header',\n 'd-flex',\n 'align-items-center',\n headerTitle ? 'justify-content-between' : 'justify-content-end',\n 'flex-wrap',\n )}\n >\n {headerTitle && (\n <Title id={titleId} type={Typography.TITLE_SUBSECTION} className=\"np-drawer-title\">\n {headerTitle}\n </Title>\n )}\n <IconButton\n size={40}\n priority=\"tertiary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onClose}\n >\n <Cross />\n </IconButton>\n </div>\n {children && <div className={clsx('np-drawer-content')}>{children}</div>}\n {footerContent ? (\n <div className={clsx('np-drawer-footer')}>{footerContent}</div>\n ) : (\n <div className=\"m-t-3\" />\n )}\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n}\n"],"names":["Drawer","children","className","footerContent","headerTitle","onClose","onUnmount","open","position","role","ariaLabelledBy","intl","useIntl","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","onExited","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_SUBSECTION","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCc,SAAUA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,OAAO;EACPC,SAAS;AACTC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,QAAQ,GAAG,OAAO;AAClBC,EAAAA,IAAI,GAAG,QAAQ;AACf,EAAA,iBAAiB,EAAEC;AAAc,CACrB,EAAA;AACZ,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;AACtBC,EAAAA,mBAAmB,CACjB,8GAA8G,EAC9G,CAACR,OAAO,CACT;EAED,MAAM;AAAES,IAAAA;GAAU,GAAGC,SAAS,EAAE;AAChC,EAAA,MAAMC,OAAO,GAAGC,KAAK,EAAE;AAEvB,EAAA,MAAMC,SAAS,GAAGC,UAAU,CAACC,gBAAgB,C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QAAA,eAEjBoB,GAAA,CAACqB,KAAK,EAAA,EAAA;AACR,WAAY,CACd;AAAA,SAAK,CACL,EAACzC,QAAQ,iBAAIoB,GAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAE4B,IAAI,CAAC,mBAAmB,CAAE;AAAA7B,UAAAA,QAAA,EAAEA;AAAQ,SAAM,CAAC,EACvEE,aAAa,gBACZkB,GAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAE4B,IAAI,CAAC,kBAAkB,CAAE;AAAA7B,UAAAA,QAAA,EAAEE;SAAmB,CAAC,gBAE/DkB,GAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAC;AAAO,SAAA,CACvB;OACE;KACO;AAChB,GAAQ,CAAC;AAEb;;;;"}
package/build/main.css CHANGED
@@ -2326,89 +2326,42 @@ button.np-option {
2326
2326
  }
2327
2327
  }
2328
2328
  .np-drawer .np-drawer-header {
2329
- display: flex;
2330
- align-items: center;
2331
- flex-wrap: nowrap;
2332
2329
  min-height: 56px;
2333
2330
  min-height: var(--size-56);
2334
- padding: 24px 16px;
2335
- padding: var(--size-24) var(--size-16);
2336
- }
2337
- .np-theme-personal .np-drawer .np-drawer-header {
2338
2331
  padding: 24px;
2339
2332
  padding: var(--size-24);
2340
2333
  }
2341
2334
  @media (max-width: 320px) {
2342
- .np-theme-personal .np-drawer .np-drawer-header {
2335
+ .np-drawer .np-drawer-header {
2343
2336
  padding: 16px;
2344
2337
  padding: var(--size-16);
2345
2338
  }
2346
2339
  }
2347
- .np-theme-personal .np-drawer .np-drawer-header .np-close-button {
2348
- margin-top: calc(8px * -1);
2349
- margin-top: calc(var(--size-8) * -1);
2350
- margin-right: calc(8px * -1);
2351
- margin-right: calc(var(--size-8) * -1);
2352
- margin-bottom: calc(8px * -1);
2353
- margin-bottom: calc(var(--size-8) * -1);
2354
- }
2355
- .np-drawer .np-drawer-header.np-drawer-header--withborder {
2356
- box-shadow: inset 0 -1px 0 0 #e2e6e8;
2357
- }
2358
- .np-theme-personal .np-drawer .np-drawer-header.np-drawer-header--withborder {
2359
- box-shadow: inset 0 -1px 0 0 rgba(0,0,0,0.10196);
2360
- box-shadow: inset 0 -1px 0 0 var(--color-border-neutral);
2361
- }
2362
- .np-drawer .np-drawer-header .np-text-title-body {
2363
- margin-right: 16px;
2364
- margin-right: var(--size-16);
2365
- font-size: 1.125rem;
2366
- font-size: var(--font-size-18);
2367
- letter-spacing: -0.01em;
2368
- letter-spacing: var(--letter-spacing-negative-xs);
2369
- line-height: 1.5rem;
2370
- line-height: var(--line-height-24);
2371
- }
2372
- .np-drawer .np-drawer-header .np-close-button {
2373
- margin-left: auto;
2374
- }
2375
- .np-drawer .np-drawer-header .tw-icon {
2376
- display: block;
2377
- cursor: pointer;
2378
- fill: #00b9ff;
2340
+ .np-drawer .np-drawer-title {
2341
+ max-width: 85%;
2379
2342
  }
2380
2343
  .np-drawer .np-drawer-content {
2381
2344
  overflow-y: auto;
2382
2345
  flex: 1;
2383
- }
2384
- .np-drawer .np-drawer-content .np-theme-personal {
2385
2346
  background-color: transparent;
2386
2347
  }
2387
- .np-drawer .np-drawer-footer,
2388
- .np-drawer .np-drawer-content {
2348
+ .np-drawer .np-drawer-footer {
2389
2349
  padding: 16px;
2390
2350
  padding: var(--size-16);
2391
2351
  }
2392
- .np-drawer .np-drawer-footer {
2393
- box-shadow: inset 0 1px 0 0 #e2e6e8;
2394
- }
2395
- .np-theme-personal .np-drawer .np-drawer-footer {
2396
- box-shadow: inset 0 1px 0 0 rgba(0,0,0,0.10196);
2397
- box-shadow: inset 0 1px 0 0 var(--color-border-neutral);
2352
+ .np-drawer .np-drawer-content {
2353
+ padding: 0 16px;
2354
+ padding: 0 var(--size-16);
2398
2355
  }
2399
2356
  @media (min-width: 768px) {
2400
- .np-drawer .np-drawer-header {
2401
- padding: 32px 24px;
2402
- padding: var(--size-32) var(--size-24);
2403
- }
2404
- .np-theme-personal .np-drawer .np-drawer-header {
2357
+ .np-drawer .np-drawer-header,
2358
+ .np-drawer .np-drawer-footer {
2405
2359
  padding: 24px;
2406
2360
  padding: var(--size-24);
2407
2361
  }
2408
- .np-drawer .np-drawer-footer,
2409
2362
  .np-drawer .np-drawer-content {
2410
- padding: 24px;
2411
- padding: var(--size-24);
2363
+ padding: 0 24px;
2364
+ padding: 0 var(--size-24);
2412
2365
  }
2413
2366
  }
2414
2367
  .wds-Divider {
@@ -4231,14 +4184,9 @@ button.np-link {
4231
4184
  .tw-modal .tw-modal-dialog {
4232
4185
  transition: transform 0.3s ease-out;
4233
4186
  transform: translateY(-25%);
4234
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
4235
- background: #ffffff;
4236
- background: var(--color-background-elevated);
4237
- }
4238
- .np-theme-personal .tw-modal .tw-modal-dialog {
4187
+ box-shadow: none;
4239
4188
  background: #ffffff;
4240
4189
  background: var(--color-background-elevated);
4241
- box-shadow: none;
4242
4190
  border-radius: 24px;
4243
4191
  border-radius: var(--radius-large);
4244
4192
  }
@@ -4247,6 +4195,7 @@ button.np-link {
4247
4195
  }
4248
4196
  .tw-modal .tw-modal-content {
4249
4197
  width: 100%;
4198
+ background-color: transparent;
4250
4199
  }
4251
4200
  .tw-modal .tw-modal-content .tw-modal-body {
4252
4201
  flex: 1;
@@ -4255,26 +4204,6 @@ button.np-link {
4255
4204
  .tw-modal .tw-modal-content .tw-modal-body--scrollable {
4256
4205
  overflow-y: auto;
4257
4206
  }
4258
- .tw-modal .tw-modal-content .tw-modal-header {
4259
- box-shadow: inset 0 -1px 0 0 #e2e6e8;
4260
- }
4261
- .np-theme-personal .tw-modal .tw-modal-content .tw-modal-header {
4262
- box-shadow: inset 0 -1px 0 0 rgba(0,0,0,0.10196);
4263
- box-shadow: inset 0 -1px 0 0 var(--color-border-neutral);
4264
- }
4265
- .np-theme-personal .tw-modal .tw-modal-content .tw-modal-header .np-close-button {
4266
- margin: calc(8px * -1) calc(8px * -1) calc(8px * -1) 0;
4267
- margin: calc(var(--size-8) * -1) calc(var(--size-8) * -1) calc(var(--size-8) * -1) 0;
4268
- }
4269
- .tw-modal .tw-modal-content .tw-modal-header.modal--withoutborder {
4270
- box-shadow: none;
4271
- }
4272
- .tw-modal .tw-modal-content .tw-modal-header .tw-icon {
4273
- fill: #0097c7;
4274
- fill: var(--color-content-accent);
4275
- cursor: pointer;
4276
- display: block;
4277
- }
4278
4207
  .tw-modal .tw-modal-content .tw-modal-header,
4279
4208
  .tw-modal .tw-modal-content .tw-modal-footer,
4280
4209
  .tw-modal .tw-modal-content .tw-modal-body {
@@ -4289,55 +4218,16 @@ button.np-link {
4289
4218
  padding-top: var(--size-12);
4290
4219
  padding-bottom: 12px;
4291
4220
  padding-bottom: var(--size-12);
4292
- box-shadow: inset 0 1px 0 0 #e2e6e8;
4293
- }
4294
- .np-theme-personal .tw-modal .tw-modal-content .tw-modal-footer {
4295
- border-top: 1px solid rgba(0,0,0,0.10196);
4296
- border-top: 1px solid var(--color-border-neutral);
4297
- }
4298
- .np-theme-personal .tw-modal .tw-modal-content .tw-modal-footer,
4299
- .tw-modal .tw-modal-content .tw-modal-footer.modal--withoutborder {
4300
- box-shadow: none;
4301
- }
4302
- .tw-modal .tw-modal-content.tw-modal-no-title .tw-modal-body {
4303
- padding-top: 0 !important;
4304
- }
4305
- .tw-modal .tw-modal-content.tw-modal-no-title .tw-modal-header {
4306
- min-height: 32px;
4307
- min-height: var(--size-32);
4308
- padding-bottom: 4px !important;
4309
- }
4310
- .tw-modal .tw-modal-content .np-theme-personal {
4311
- background-color: transparent;
4312
- }
4313
- .tw-modal table,
4314
- .tw-modal .table {
4315
- background-color: transparent;
4316
4221
  }
4317
4222
  @media (min-width: 576px) {
4318
4223
  .tw-modal .tw-modal-content .tw-modal-header,
4319
- .tw-modal .tw-modal-content .tw-modal-footer,
4320
- .tw-modal .tw-modal-content .tw-modal-body {
4321
- padding: 32px 24px;
4322
- padding: var(--size-32) var(--size-24);
4323
- }
4324
- .np-theme-personal .tw-modal .tw-modal-content .tw-modal-header,
4325
- .np-theme-personal .tw-modal .tw-modal-content .tw-modal-footer,
4326
- .np-theme-personal .tw-modal .tw-modal-content .tw-modal-body {
4224
+ .tw-modal .tw-modal-content .tw-modal-footer {
4327
4225
  padding: 24px;
4328
4226
  padding: var(--size-24);
4329
4227
  }
4330
- .tw-modal .tw-modal-compact .tw-modal-header {
4331
- min-height: calc(8px * 7);
4332
- min-height: calc(var(--size-8) * 7);
4333
- }
4334
- .tw-modal .tw-modal-compact .tw-modal-header,
4335
- .tw-modal .tw-modal-compact .tw-modal-footer,
4336
- .tw-modal .tw-modal-compact .tw-modal-body {
4337
- padding-top: 16px;
4338
- padding-top: var(--size-16);
4339
- padding-bottom: 16px;
4340
- padding-bottom: var(--size-16);
4228
+ .tw-modal .tw-modal-content .tw-modal-body {
4229
+ padding: 0 24px;
4230
+ padding: 0 var(--size-24);
4341
4231
  }
4342
4232
  }
4343
4233
  @media (min-width: 480px) {
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var clsx = require('clsx');
6
6
  var React = require('react');
7
7
  var reactTransitionGroup = require('react-transition-group');
8
+ var reactIntl = require('react-intl');
8
9
  require('../common/theme.js');
9
10
  require('../common/direction.js');
10
11
  require('../common/propsValues/control.js');
@@ -24,7 +25,9 @@ require('../common/propsValues/variant.js');
24
25
  var scroll = require('../common/propsValues/scroll.js');
25
26
  require('../common/propsValues/markdownNodeType.js');
26
27
  require('../common/fileType.js');
27
- var CloseButton = require('../common/closeButton/CloseButton.js');
28
+ var icons = require('@transferwise/icons');
29
+ var CloseButton_messages = require('../common/closeButton/CloseButton.messages.js');
30
+ var jsxRuntime = require('react/jsx-runtime');
28
31
  require('@transferwise/neptune-validation');
29
32
  require('../provider/direction/DirectionProvider.js');
30
33
  var useLayout = require('../common/hooks/useLayout/useLayout.js');
@@ -32,7 +35,7 @@ var Dimmer = require('../dimmer/Dimmer.js');
32
35
  var Drawer = require('../drawer/Drawer.js');
33
36
  var OverlayIdProvider = require('../provider/overlay/OverlayIdProvider.js');
34
37
  var Title = require('../title/Title.js');
35
- var jsxRuntime = require('react/jsx-runtime');
38
+ var IconButton = require('../iconButton/IconButton.js');
36
39
 
37
40
  const TRANSITION_DURATION_IN_MILLISECONDS = 150;
38
41
  const Modal = ({
@@ -49,13 +52,10 @@ const Modal = ({
49
52
  disableDimmerClickToClose = false,
50
53
  ...otherProps
51
54
  }) => {
52
- const checkSpecialClasses = classToCheck => className?.split(' ').includes(classToCheck);
55
+ const intl = reactIntl.useIntl();
53
56
  const {
54
57
  isMedium
55
58
  } = useLayout.useLayout();
56
- // These should be replaced with props in breaking change.
57
- const isCompact = checkSpecialClasses('compact');
58
- const noDivider = checkSpecialClasses('no-divider');
59
59
  const contentReference = React.useRef(null);
60
60
  const titleId = React.useId();
61
61
  const overlayId = React.useContext(OverlayIdProvider.OverlayIdContext);
@@ -96,32 +96,31 @@ const Modal = ({
96
96
  [`tw-modal-${size$1}`]: size$1
97
97
  }),
98
98
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
99
- className: clsx.clsx('tw-modal-content', 'd-flex', 'flex-column', 'justify-content-between', {
100
- 'tw-modal-compact': isCompact,
101
- 'tw-modal-no-title': !title
102
- }),
99
+ className: clsx.clsx('tw-modal-content', 'd-flex', 'flex-column', 'justify-content-between'),
103
100
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
104
- className: clsx.clsx('tw-modal-header', 'd-flex', 'align-items-center', 'justify-content-between', 'flex-wrap', {
105
- 'modal--withoutborder': !title || noDivider
106
- }),
107
- children: [/*#__PURE__*/jsxRuntime.jsx(Title.default, {
101
+ className: clsx.clsx('tw-modal-header', 'd-flex', 'align-items-center', title ? 'justify-content-between' : 'justify-content-end', 'flex-wrap'),
102
+ children: [title && /*#__PURE__*/jsxRuntime.jsx(Title.default, {
108
103
  id: titleId,
109
- type: typography.Typography.TITLE_BODY,
104
+ type: typography.Typography.TITLE_SUBSECTION,
110
105
  className: "tw-modal-title",
111
106
  children: title
112
- }), /*#__PURE__*/jsxRuntime.jsx(CloseButton.CloseButton, {
113
- onClick: onClose
107
+ }), /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
108
+ size: 40,
109
+ priority: "tertiary",
110
+ "aria-label": intl.formatMessage(CloseButton_messages.default.ariaLabel),
111
+ onClick: onClose,
112
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
114
113
  })]
115
114
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
116
115
  className: clsx.clsx('tw-modal-body', {
117
116
  'tw-modal-body--scrollable': scroll$1 === scroll.Scroll.CONTENT
118
117
  }),
119
118
  children: body
120
- }), footer && /*#__PURE__*/jsxRuntime.jsx("div", {
121
- className: clsx.clsx('tw-modal-footer', 'd-flex', 'align-items-center', 'flex-wrap', {
122
- 'modal--withoutborder': noDivider
123
- }),
119
+ }), footer ? /*#__PURE__*/jsxRuntime.jsx("div", {
120
+ className: clsx.clsx('tw-modal-footer', 'd-flex', 'align-items-center', 'flex-wrap'),
124
121
  children: footer
122
+ }) : /*#__PURE__*/jsxRuntime.jsx("div", {
123
+ className: "m-t-3"
125
124
  })]
126
125
  })
127
126
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../src/modal/Modal.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode, useContext, useId, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport {\n Size,\n Position,\n PositionTop,\n PositionCenter,\n Scroll,\n CommonProps,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n SizeExtraLarge,\n ScrollContent,\n ScrollViewport,\n Typography,\n} from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport Drawer from '../drawer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport Title from '../title/Title';\n\nconst TRANSITION_DURATION_IN_MILLISECONDS = 150;\n\nexport type ModalProps = CommonProps & {\n title?: ReactNode;\n body: ReactNode;\n footer?: ReactNode;\n size?: SizeSmall | SizeMedium | SizeLarge | SizeExtraLarge;\n onClose: () => void;\n onUnmount?: () => void;\n open: boolean;\n scroll?: ScrollContent | ScrollViewport;\n position?: PositionTop | PositionCenter;\n disableDimmerClickToClose?: boolean;\n};\n\nconst Modal = ({\n title = null,\n body,\n footer = null,\n onClose,\n onUnmount,\n className,\n open,\n size = Size.MEDIUM,\n scroll = Scroll.VIEWPORT,\n position = Position.CENTER,\n disableDimmerClickToClose = false,\n ...otherProps\n}: ModalProps) => {\n const checkSpecialClasses = (classToCheck: string) =>\n className?.split(' ').includes(classToCheck);\n const { isMedium } = useLayout();\n\n // These should be replaced with props in breaking change.\n const isCompact = checkSpecialClasses('compact');\n const noDivider = checkSpecialClasses('no-divider');\n\n const contentReference = useRef<HTMLDivElement>(null);\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return !isMedium ? (\n <Drawer\n open={open}\n headerTitle={title}\n footerContent={footer}\n position={Position.BOTTOM}\n onClose={onClose}\n onUnmount={onUnmount}\n >\n {body}\n </Drawer>\n ) : (\n <Dimmer\n open={open}\n scrollable={scroll === Scroll.VIEWPORT}\n contentPosition={position}\n disableClickToClose={disableDimmerClickToClose}\n onClose={onClose}\n onExited={onUnmount}\n >\n <CSSTransition\n nodeRef={contentReference}\n appear\n in={open}\n classNames={{ enterDone: 'in' }}\n timeout={TRANSITION_DURATION_IN_MILLISECONDS}\n unmountOnExit\n >\n <div\n ref={contentReference}\n className={clsx(\n 'tw-modal',\n 'd-flex',\n 'fade',\n 'outline-none',\n scroll === Scroll.CONTENT && 'tw-modal--scrollable',\n className,\n )}\n {...otherProps}\n >\n <div\n id={overlayId}\n role=\"dialog\"\n aria-modal\n aria-labelledby={titleId}\n className={clsx('tw-modal-dialog', 'd-flex', {\n [`tw-modal-${size}`]: size,\n })}\n >\n <div\n className={clsx(\n 'tw-modal-content',\n 'd-flex',\n 'flex-column',\n 'justify-content-between',\n {\n 'tw-modal-compact': isCompact,\n 'tw-modal-no-title': !title,\n },\n )}\n >\n <div\n className={clsx(\n 'tw-modal-header',\n 'd-flex',\n 'align-items-center',\n 'justify-content-between',\n 'flex-wrap',\n {\n 'modal--withoutborder': !title || noDivider,\n },\n )}\n >\n <Title id={titleId} type={Typography.TITLE_BODY} className=\"tw-modal-title\">\n {title}\n </Title>\n <CloseButton onClick={onClose} />\n </div>\n <div\n className={clsx('tw-modal-body', {\n 'tw-modal-body--scrollable': scroll === Scroll.CONTENT,\n })}\n >\n {body}\n </div>\n {footer && (\n <div\n className={clsx('tw-modal-footer', 'd-flex', 'align-items-center', 'flex-wrap', {\n 'modal--withoutborder': noDivider,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n </div>\n </div>\n </CSSTransition>\n </Dimmer>\n );\n};\n\nexport default Modal;\n"],"names":["TRANSITION_DURATION_IN_MILLISECONDS","Modal","title","body","footer","onClose","onUnmount","className","open","size","Size","MEDIUM","scroll","Scroll","VIEWPORT","position","Position","CENTER","disableDimmerClickToClose","otherProps","checkSpecialClasses","classToCheck","split","includes","isMedium","useLayout","isCompact","noDivider","contentReference","useRef","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Drawer","headerTitle","footerContent","BOTTOM","children","Dimmer","scrollable","contentPosition","disableClickToClose","onExited","CSSTransition","nodeRef","appear","in","classNames","enterDone","timeout","unmountOnExit","ref","clsx","CONTENT","id","role","_jsxs","Title","type","Typography","TITLE_BODY","CloseButton","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,mCAAmC,GAAG,GAAG;AAe/C,MAAMC,KAAK,GAAGA,CAAC;AACbC,EAAAA,KAAK,GAAG,IAAI;EACZC,IAAI;AACJC,EAAAA,MAAM,GAAG,IAAI;EACbC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,IAAI;QACJC,MAAI,GAAGC,SAAI,CAACC,MAAM;UAClBC,QAAM,GAAGC,aAAM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D,KAAK,IAAIyB;AACnC,eAAA,CACD;cAAAa,QAAA,EAAA,cAEFL,cAAA,CAACyB,aAAK,EAAA;AAACH,gBAAAA,EAAE,EAAE3B,OAAQ;gBAAC+B,IAAI,EAAEC,qBAAU,CAACC,UAAW;AAACxD,gBAAAA,SAAS,EAAC,gBAAgB;AAAAiC,gBAAAA,QAAA,EACxEtC;AAAK,eACD,CACP,eAAAiC,cAAA,CAAC6B,uBAAW,EAAA;AAACC,gBAAAA,OAAO,EAAE5D;AAAQ,eAAA,CAChC;aAAK,CACL,eAAA8B,cAAA,CAAA,KAAA,EAAA;AACE5B,cAAAA,SAAS,EAAEgD,SAAI,CAAC,eAAe,EAAE;AAC/B,gBAAA,2BAA2B,EAAE3C,QAAM,KAAKC,aAAM,CAAC2C;AAChD,eAAA,CAAE;AAAAhB,cAAAA,QAAA,EAEFrC;AAAI,aACF,CACL,EAACC,MAAM,iBACL+B,cAAA,CAAA,KAAA,EAAA;cACE5B,SAAS,EAAEgD,SAAI,CAAC,iBAAiB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,WAAW,EAAE;AAC9E,gBAAA,sBAAsB,EAAE5B;AACzB,eAAA,CAAE;AAAAa,cAAAA,QAAA,EAEFpC;AAAM,aACJ,CACN;WACE;SACF;OACF;KACQ;AACjB,GAAQ,CACT;AACH;;;;"}
1
+ {"version":3,"file":"Modal.js","sources":["../../src/modal/Modal.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode, useContext, useId, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n Position,\n PositionTop,\n PositionCenter,\n Scroll,\n CommonProps,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n SizeExtraLarge,\n ScrollContent,\n ScrollViewport,\n Typography,\n} from '../common';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport Drawer from '../drawer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport Title from '../title/Title';\nimport { Cross } from '@transferwise/icons';\nimport IconButton from '../iconButton';\nimport closeBtnMessages from '../common/closeButton/CloseButton.messages';\n\nconst TRANSITION_DURATION_IN_MILLISECONDS = 150;\n\nexport type ModalProps = CommonProps & {\n title?: ReactNode;\n body: ReactNode;\n footer?: ReactNode;\n size?: SizeSmall | SizeMedium | SizeLarge | SizeExtraLarge;\n onClose: () => void;\n onUnmount?: () => void;\n open: boolean;\n scroll?: ScrollContent | ScrollViewport;\n position?: PositionTop | PositionCenter;\n disableDimmerClickToClose?: boolean;\n};\n\nconst Modal = ({\n title = null,\n body,\n footer = null,\n onClose,\n onUnmount,\n className,\n open,\n size = Size.MEDIUM,\n scroll = Scroll.VIEWPORT,\n position = Position.CENTER,\n disableDimmerClickToClose = false,\n ...otherProps\n}: ModalProps) => {\n const intl = useIntl();\n const { isMedium } = useLayout();\n\n const contentReference = useRef<HTMLDivElement>(null);\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return !isMedium ? (\n <Drawer\n open={open}\n headerTitle={title}\n footerContent={footer}\n position={Position.BOTTOM}\n onClose={onClose}\n onUnmount={onUnmount}\n >\n {body}\n </Drawer>\n ) : (\n <Dimmer\n open={open}\n scrollable={scroll === Scroll.VIEWPORT}\n contentPosition={position}\n disableClickToClose={disableDimmerClickToClose}\n onClose={onClose}\n onExited={onUnmount}\n >\n <CSSTransition\n nodeRef={contentReference}\n appear\n in={open}\n classNames={{ enterDone: 'in' }}\n timeout={TRANSITION_DURATION_IN_MILLISECONDS}\n unmountOnExit\n >\n <div\n ref={contentReference}\n className={clsx(\n 'tw-modal',\n 'd-flex',\n 'fade',\n 'outline-none',\n scroll === Scroll.CONTENT && 'tw-modal--scrollable',\n className,\n )}\n {...otherProps}\n >\n <div\n id={overlayId}\n role=\"dialog\"\n aria-modal\n aria-labelledby={titleId}\n className={clsx('tw-modal-dialog', 'd-flex', {\n [`tw-modal-${size}`]: size,\n })}\n >\n <div\n className={clsx(\n 'tw-modal-content',\n 'd-flex',\n 'flex-column',\n 'justify-content-between',\n )}\n >\n <div\n className={clsx(\n 'tw-modal-header',\n 'd-flex',\n 'align-items-center',\n title ? 'justify-content-between' : 'justify-content-end',\n 'flex-wrap',\n )}\n >\n {title && (\n <Title id={titleId} type={Typography.TITLE_SUBSECTION} className=\"tw-modal-title\">\n {title}\n </Title>\n )}\n <IconButton\n size={40}\n priority=\"tertiary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onClose}\n >\n <Cross />\n </IconButton>\n </div>\n <div\n className={clsx('tw-modal-body', {\n 'tw-modal-body--scrollable': scroll === Scroll.CONTENT,\n })}\n >\n {body}\n </div>\n {footer ? (\n <div\n className={clsx('tw-modal-footer', 'd-flex', 'align-items-center', 'flex-wrap')}\n >\n {footer}\n </div>\n ) : (\n <div className=\"m-t-3\" />\n )}\n </div>\n </div>\n </div>\n </CSSTransition>\n </Dimmer>\n );\n};\n\nexport default Modal;\n"],"names":["TRANSITION_DURATION_IN_MILLISECONDS","Modal","title","body","footer","onClose","onUnmount","className","open","size","Size","MEDIUM","scroll","Scroll","VIEWPORT","position","Position","CENTER","disableDimmerClickToClose","otherProps","intl","useIntl","isMedium","useLayout","contentReference","useRef","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Drawer","headerTitle","footerContent","BOTTOM","children","Dimmer","scrollable","contentPosition","disableClickToClose","onExited","CSSTransition","nodeRef","appear","in","classNames","enterDone","timeout","unmountOnExit","ref","clsx","CONTENT","id","role","_jsxs","Title","type","Typography","TITLE_SUBSECTION","IconButton","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAMA,mCAAmC,GAAG,GAAG;AAe/C,MAAMC,KAAK,GAAGA,CAAC;AACbC,EAAAA,KAAK,GAAG,IAAI;EACZC,IAAI;AACJC,EAAAA,MAAM,GAAG,IAAI;EACbC,OAAO;EACP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