@transferwise/components 0.0.0-experimental-f2eec9e → 0.0.0-experimental-57cdeb9

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 (78) hide show
  1. package/build/avatarLayout/AvatarLayout.js +1 -2
  2. package/build/avatarLayout/AvatarLayout.js.map +1 -1
  3. package/build/avatarLayout/AvatarLayout.mjs +1 -2
  4. package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
  5. package/build/button/Button.js +5 -2
  6. package/build/button/Button.js.map +1 -1
  7. package/build/button/Button.mjs +5 -2
  8. package/build/button/Button.mjs.map +1 -1
  9. package/build/index.js +0 -2
  10. package/build/index.js.map +1 -1
  11. package/build/index.mjs +0 -1
  12. package/build/index.mjs.map +1 -1
  13. package/build/main.css +13 -15
  14. package/build/nudge/Nudge.js.map +1 -1
  15. package/build/nudge/Nudge.mjs.map +1 -1
  16. package/build/styles/avatarLayout/AvatarLayout.css +1 -2
  17. package/build/styles/button/Button.css +12 -2
  18. package/build/styles/main.css +13 -15
  19. package/build/styles/nudge/Nudge.css +0 -11
  20. package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
  21. package/build/types/button/Button.d.ts.map +1 -1
  22. package/build/types/button/Button.types.d.ts +2 -2
  23. package/build/types/index.d.ts +0 -2
  24. package/build/types/index.d.ts.map +1 -1
  25. package/build/types/nudge/Nudge.d.ts +1 -1
  26. package/build/types/nudge/Nudge.d.ts.map +1 -1
  27. package/build/types/uploadInput/uploadButton/getAllowedFileTypes.d.ts.map +1 -1
  28. package/build/uploadInput/uploadButton/getAllowedFileTypes.js +3 -23
  29. package/build/uploadInput/uploadButton/getAllowedFileTypes.js.map +1 -1
  30. package/build/uploadInput/uploadButton/getAllowedFileTypes.mjs +3 -23
  31. package/build/uploadInput/uploadButton/getAllowedFileTypes.mjs.map +1 -1
  32. package/package.json +3 -3
  33. package/src/avatarLayout/AvatarLayout.css +1 -2
  34. package/src/avatarLayout/AvatarLayout.less +1 -1
  35. package/src/avatarLayout/AvatarLayout.tsx +0 -1
  36. package/src/button/Button.css +12 -2
  37. package/src/button/Button.less +16 -5
  38. package/src/button/Button.spec.tsx +51 -26
  39. package/src/button/Button.story.tsx +0 -5
  40. package/src/button/Button.tsx +5 -2
  41. package/src/button/Button.types.ts +2 -2
  42. package/src/drawer/Drawer.rtl.spec.tsx +59 -0
  43. package/src/drawer/Drawer.spec.js +101 -0
  44. package/src/drawer/__snapshots__/Drawer.rtl.spec.tsx.snap +55 -0
  45. package/src/index.ts +0 -12
  46. package/src/main.css +13 -15
  47. package/src/nudge/Nudge.css +0 -11
  48. package/src/nudge/Nudge.less +0 -3
  49. package/src/nudge/Nudge.story.tsx +0 -10
  50. package/src/nudge/Nudge.tsx +1 -2
  51. package/src/uploadInput/UploadInput.tests.story.tsx +5 -5
  52. package/src/uploadInput/uploadButton/getAllowedFileTypes.spec.ts +0 -12
  53. package/src/uploadInput/uploadButton/getAllowedFileTypes.ts +7 -33
  54. package/build/table/Table.js +0 -166
  55. package/build/table/Table.js.map +0 -1
  56. package/build/table/Table.messages.js +0 -24
  57. package/build/table/Table.messages.js.map +0 -1
  58. package/build/table/Table.messages.mjs +0 -22
  59. package/build/table/Table.messages.mjs.map +0 -1
  60. package/build/table/Table.mjs +0 -164
  61. package/build/table/Table.mjs.map +0 -1
  62. package/build/table/TableCell.js +0 -86
  63. package/build/table/TableCell.js.map +0 -1
  64. package/build/table/TableCell.mjs +0 -84
  65. package/build/table/TableCell.mjs.map +0 -1
  66. package/build/table/TableHeader.js +0 -57
  67. package/build/table/TableHeader.js.map +0 -1
  68. package/build/table/TableHeader.mjs +0 -55
  69. package/build/table/TableHeader.mjs.map +0 -1
  70. package/build/table/TableRow.js +0 -85
  71. package/build/table/TableRow.js.map +0 -1
  72. package/build/table/TableRow.mjs +0 -83
  73. package/build/table/TableRow.mjs.map +0 -1
  74. package/build/table/TableStatusText.js +0 -54
  75. package/build/table/TableStatusText.js.map +0 -1
  76. package/build/table/TableStatusText.mjs +0 -52
  77. package/build/table/TableStatusText.mjs.map +0 -1
  78. package/src/drawer/Drawer.spec.tsx +0 -93
@@ -1,83 +0,0 @@
1
- import 'react';
2
- import TableCell from './TableCell.mjs';
3
- import Chevron from '../chevron/Chevron.mjs';
4
- import '../common/theme.mjs';
5
- import '../common/direction.mjs';
6
- import '../common/propsValues/control.mjs';
7
- import '../common/propsValues/breakpoint.mjs';
8
- import '../common/propsValues/size.mjs';
9
- import '../common/propsValues/typography.mjs';
10
- import '../common/propsValues/width.mjs';
11
- import '../common/propsValues/type.mjs';
12
- import '../common/propsValues/dateMode.mjs';
13
- import '../common/propsValues/monthFormat.mjs';
14
- import { Position } from '../common/propsValues/position.mjs';
15
- import '../common/propsValues/layouts.mjs';
16
- import '../common/propsValues/status.mjs';
17
- import '../common/propsValues/sentiment.mjs';
18
- import '../common/propsValues/profileType.mjs';
19
- import '../common/propsValues/variant.mjs';
20
- import '../common/propsValues/scroll.mjs';
21
- import '../common/propsValues/markdownNodeType.mjs';
22
- import '../common/fileType.mjs';
23
- import '@transferwise/icons';
24
- import { clsx } from 'clsx';
25
- import 'react-intl';
26
- import '../common/closeButton/CloseButton.messages.mjs';
27
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
28
-
29
- const TableRow = ({
30
- rowData,
31
- hasSeparator = false,
32
- children,
33
- onRowClick
34
- }) => {
35
- return /*#__PURE__*/jsxs(Fragment, {
36
- children: [/*#__PURE__*/jsxs("tr", {
37
- className: clsx('np-table-row', {
38
- 'np-table-row--clickable': !!onRowClick
39
- }),
40
- "data-testid": "np-table-row",
41
- role: onRowClick ? 'button' : undefined,
42
- tabIndex: 0,
43
- onClick: onRowClick && rowData ? () => onRowClick(rowData) : undefined,
44
- onKeyDown: ({
45
- key
46
- }) => {
47
- if (onRowClick && rowData && key === 'Enter') {
48
- onRowClick(rowData);
49
- }
50
- },
51
- children: [rowData?.cells ? rowData?.cells?.map((item, index) => {
52
- const itemIndex = item.cell?.text ? item.cell?.text.concat(index.toString()) : index;
53
- return /*#__PURE__*/jsx(TableCell, {
54
- ...item
55
- }, itemIndex);
56
- }) : children, onRowClick && /*#__PURE__*/jsx(TableCell, {
57
- className: "np-table-cell--action",
58
- children: /*#__PURE__*/jsx("div", {
59
- "aria-hidden": "true",
60
- children: /*#__PURE__*/jsx(Chevron, {
61
- orientation: Position.RIGHT
62
- })
63
- })
64
- })]
65
- }), hasSeparator && /*#__PURE__*/jsx("tr", {
66
- "aria-hidden": "true",
67
- className: "np-table-row np-table-row--separator",
68
- "data-testid": "np-table-row--separator",
69
- children: /*#__PURE__*/jsx("td", {
70
- className: "np-table-cell np-table-cell--cosmetic",
71
- colSpan: onRowClick ? Number(rowData?.cells?.length) + 1 : rowData?.cells?.length,
72
- "data-testid": "np-table-cell--cosmetic",
73
- children: /*#__PURE__*/jsx("div", {
74
- className: "np-table-cell-separator",
75
- "data-testid": "np-table-cell-separator"
76
- })
77
- })
78
- })]
79
- });
80
- };
81
-
82
- export { TableRow as default };
83
- //# sourceMappingURL=TableRow.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableRow.mjs","sources":["../../src/table/TableRow.tsx"],"sourcesContent":["import React from 'react';\nimport TableCell, { TableCellProps } from './TableCell';\nimport Chevron from '../chevron';\nimport { Position } from '../common';\nimport { clsx } from 'clsx';\n\nexport interface TableRowType {\n cells?: TableCellProps[];\n}\n\nexport interface TableRowClickableType extends TableRowType {\n id: number | string; // `id` is mandatory for clickable rows\n}\n\nexport interface TableRowProps {\n rowData?: TableRowType | TableRowClickableType;\n hasSeparator?: boolean;\n children?: React.ReactNode;\n onRowClick?: (rowData: TableRowType | TableRowClickableType) => void;\n}\n\nconst TableRow = ({ rowData, hasSeparator = false, children, onRowClick }: TableRowProps) => {\n return (\n <>\n <tr\n className={clsx('np-table-row', { 'np-table-row--clickable': !!onRowClick })}\n data-testid=\"np-table-row\"\n role={onRowClick ? 'button' : undefined}\n tabIndex={0}\n onClick={onRowClick && rowData ? () => onRowClick(rowData) : undefined}\n onKeyDown={({ key }) => {\n if (onRowClick && rowData && key === 'Enter') {\n onRowClick(rowData);\n }\n }}\n >\n {rowData?.cells\n ? rowData?.cells?.map((item, index) => {\n const itemIndex = item.cell?.text ? item.cell?.text.concat(index.toString()) : index;\n return <TableCell key={itemIndex} {...item} />;\n })\n : children}\n {onRowClick && (\n <TableCell className=\"np-table-cell--action\">\n <div aria-hidden=\"true\">\n <Chevron orientation={Position.RIGHT} />\n </div>\n </TableCell>\n )}\n </tr>\n {hasSeparator && (\n <tr\n aria-hidden=\"true\"\n className=\"np-table-row np-table-row--separator\"\n data-testid=\"np-table-row--separator\"\n >\n <td\n className=\"np-table-cell np-table-cell--cosmetic\"\n colSpan={onRowClick ? Number(rowData?.cells?.length) + 1 : rowData?.cells?.length}\n data-testid=\"np-table-cell--cosmetic\"\n >\n <div className=\"np-table-cell-separator\" data-testid=\"np-table-cell-separator\" />\n </td>\n </tr>\n )}\n </>\n );\n};\n\nexport default TableRow;\n"],"names":["TableRow","rowData","hasSeparator","children","onRowClick","_jsxs","_Fragment","className","clsx","role","undefined","tabIndex","onClick","onKeyDown","key","cells","map","item","index","itemIndex","cell","text","concat","toString","_jsx","TableCell","Chevron","orientation","Position","RIGHT","colSpan","Number","length"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBMA,MAAAA,QAAQ,GAAGA,CAAC;EAAEC,OAAO;AAAEC,EAAAA,YAAY,GAAG,KAAK;EAAEC,QAAQ;AAAEC,EAAAA,UAAAA;AAAU,CAAiB,KAAI;EAC1F,oBACEC,IAAA,CAAAC,QAAA,EAAA;AAAAH,IAAAA,QAAA,gBACEE,IAAA,CAAA,IAAA,EAAA;AACEE,MAAAA,SAAS,EAAEC,IAAI,CAAC,cAAc,EAAE;QAAE,yBAAyB,EAAE,CAAC,CAACJ,UAAAA;AAAY,OAAA,CAAE;AAC7E,MAAA,aAAA,EAAY,cAAc;AAC1BK,MAAAA,IAAI,EAAEL,UAAU,GAAG,QAAQ,GAAGM,SAAU;AACxCC,MAAAA,QAAQ,EAAE,CAAE;MACZC,OAAO,EAAER,UAAU,IAAIH,OAAO,GAAG,MAAMG,UAAU,CAACH,OAAO,CAAC,GAAGS,SAAU;AACvEG,MAAAA,SAAS,EAAEA,CAAC;AAAEC,QAAAA,GAAAA;AAAG,OAAE,KAAI;AACrB,QAAA,IAAIV,UAAU,IAAIH,OAAO,IAAIa,GAAG,KAAK,OAAO,EAAE;UAC5CV,UAAU,CAACH,OAAO,CAAC,CAAA;AACrB,SAAA;OACA;AAAAE,MAAAA,QAAA,EAEDF,CAAAA,OAAO,EAAEc,KAAK,GACXd,OAAO,EAAEc,KAAK,EAAEC,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAI;QAClC,MAAMC,SAAS,GAAGF,IAAI,CAACG,IAAI,EAAEC,IAAI,GAAGJ,IAAI,CAACG,IAAI,EAAEC,IAAI,CAACC,MAAM,CAACJ,KAAK,CAACK,QAAQ,EAAE,CAAC,GAAGL,KAAK,CAAA;QACpF,oBAAOM,GAAA,CAACC,SAAS,EAAA;UAAA,GAAqBR,IAAAA;AAAI,SAAA,EAAnBE,UAAuB,CAAA;OAC/C,CAAC,GACFhB,QAAQ,EACXC,UAAU,iBACToB,GAAA,CAACC,SAAS,EAAA;AAAClB,QAAAA,SAAS,EAAC,uBAAuB;AAAAJ,QAAAA,QAAA,eAC1CqB,GAAA,CAAA,KAAA,EAAA;AAAK,UAAA,aAAA,EAAY,MAAM;UAAArB,QAAA,eACrBqB,GAAA,CAACE,OAAO,EAAA;YAACC,WAAW,EAAEC,QAAQ,CAACC,KAAAA;WACjC,CAAA;SAAK,CAAA;AACP,OAAW,CACZ,CAAA;AAAA,KACC,CACJ,EAAC3B,YAAY,iBACXsB,GAAA,CAAA,IAAA,EAAA;AACE,MAAA,aAAA,EAAY,MAAM;AAClBjB,MAAAA,SAAS,EAAC,sCAAsC;AAChD,MAAA,aAAA,EAAY,yBAAyB;AAAAJ,MAAAA,QAAA,eAErCqB,GAAA,CAAA,IAAA,EAAA;AACEjB,QAAAA,SAAS,EAAC,uCAAuC;AACjDuB,QAAAA,OAAO,EAAE1B,UAAU,GAAG2B,MAAM,CAAC9B,OAAO,EAAEc,KAAK,EAAEiB,MAAM,CAAC,GAAG,CAAC,GAAG/B,OAAO,EAAEc,KAAK,EAAEiB,MAAO;AAClF,QAAA,aAAA,EAAY,yBAAyB;AAAA7B,QAAAA,QAAA,eAErCqB,GAAA,CAAA,KAAA,EAAA;AAAKjB,UAAAA,SAAS,EAAC,yBAAyB;UAAC,aAAY,EAAA,yBAAA;SACvD,CAAA;OAAI,CAAA;AACN,KAAI,CACL,CAAA;AAAA,GACH,CAAG,CAAA;AAEP;;;;"}
@@ -1,54 +0,0 @@
1
- 'use strict';
2
-
3
- var icons = require('@transferwise/icons');
4
- var clsx = require('clsx');
5
- require('react');
6
- var Body = require('../body/Body.js');
7
- require('../common/theme.js');
8
- require('../common/direction.js');
9
- require('../common/propsValues/control.js');
10
- require('../common/propsValues/breakpoint.js');
11
- require('../common/propsValues/size.js');
12
- var typography = require('../common/propsValues/typography.js');
13
- require('../common/propsValues/width.js');
14
- require('../common/propsValues/type.js');
15
- require('../common/propsValues/dateMode.js');
16
- require('../common/propsValues/monthFormat.js');
17
- require('../common/propsValues/position.js');
18
- require('../common/propsValues/layouts.js');
19
- require('../common/propsValues/status.js');
20
- require('../common/propsValues/sentiment.js');
21
- require('../common/propsValues/profileType.js');
22
- require('../common/propsValues/variant.js');
23
- require('../common/propsValues/scroll.js');
24
- require('../common/propsValues/markdownNodeType.js');
25
- require('../common/fileType.js');
26
- require('react-intl');
27
- require('../common/closeButton/CloseButton.messages.js');
28
- var jsxRuntime = require('react/jsx-runtime');
29
-
30
- const TableStatusText = ({
31
- text,
32
- className,
33
- status,
34
- typography: typography$1 = 'default'
35
- }) => {
36
- const typographyType = status ?? typography$1 === 'default-bold' ? typography.Typography.BODY_DEFAULT_BOLD : typography.Typography.BODY_DEFAULT;
37
- return /*#__PURE__*/jsxRuntime.jsxs(Body, {
38
- type: typographyType,
39
- className: clsx.clsx(className, {
40
- 'np-table-content--success': status === 'success',
41
- 'np-table-content--error': status === 'error'
42
- }),
43
- children: [text, status === 'success' && /*#__PURE__*/jsxRuntime.jsx(icons.CheckCircle, {
44
- className: "tw-icon--status",
45
- "data-testid": "check-icon"
46
- }), status === 'error' && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {
47
- className: "tw-icon--status",
48
- "data-testid": "alert-icon"
49
- })]
50
- });
51
- };
52
-
53
- module.exports = TableStatusText;
54
- //# sourceMappingURL=TableStatusText.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableStatusText.js","sources":["../../src/table/TableStatusText.tsx"],"sourcesContent":["import { AlertCircle, CheckCircle } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport React from 'react';\nimport Body from '../body';\nimport { Typography } from '../common';\n\nexport interface TableStatusTextProps {\n text: string | React.ReactNode;\n className?: string;\n status?: 'success' | 'error';\n typography?: 'default' | 'default-bold';\n}\n\nconst TableStatusText = ({\n text,\n className,\n status,\n typography = 'default',\n}: TableStatusTextProps) => {\n const typographyType =\n (status ?? typography === 'default-bold')\n ? Typography.BODY_DEFAULT_BOLD\n : Typography.BODY_DEFAULT;\n\n return (\n <Body\n type={typographyType}\n className={clsx(className, {\n 'np-table-content--success': status === 'success',\n 'np-table-content--error': status === 'error',\n })}\n >\n {text}\n {status === 'success' && <CheckCircle className=\"tw-icon--status\" data-testid=\"check-icon\" />}\n {status === 'error' && <AlertCircle className=\"tw-icon--status\" data-testid=\"alert-icon\" />}\n </Body>\n );\n};\n\nexport default TableStatusText;\n"],"names":["TableStatusText","text","className","status","typography","typographyType","Typography","BODY_DEFAULT_BOLD","BODY_DEFAULT","_jsxs","Body","type","clsx","children","_jsx","CheckCircle","AlertCircle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaMA,MAAAA,eAAe,GAAGA,CAAC;EACvBC,IAAI;EACJC,SAAS;EACTC,MAAM;AACNC,cAAAA,YAAU,GAAG,SAAA;AAAS,CACD,KAAI;AACzB,EAAA,MAAMC,cAAc,GACjBF,MAAM,IAAIC,YAAU,KAAK,cAAc,GACpCE,qBAAU,CAACC,iBAAiB,GAC5BD,qBAAU,CAACE,YAAY,CAAA;EAE7B,oBACEC,eAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,IAAI,EAAEN,cAAe;AACrBH,IAAAA,SAAS,EAAEU,SAAI,CAACV,SAAS,EAAE;MACzB,2BAA2B,EAAEC,MAAM,KAAK,SAAS;MACjD,yBAAyB,EAAEA,MAAM,KAAK,OAAA;AACvC,KAAA,CAAE;IAAAU,QAAA,EAAA,CAEFZ,IAAI,EACJE,MAAM,KAAK,SAAS,iBAAIW,cAAA,CAACC,iBAAW,EAAA;AAACb,MAAAA,SAAS,EAAC,iBAAiB;MAAC,aAAY,EAAA,YAAA;MAAe,EAC5FC,MAAM,KAAK,OAAO,iBAAIW,cAAA,CAACE,iBAAW,EAAA;AAACd,MAAAA,SAAS,EAAC,iBAAiB;MAAC,aAAY,EAAA,YAAA;AAAY,MAAG,CAAA;AAAA,GACvF,CAAC,CAAA;AAEX;;;;"}
@@ -1,52 +0,0 @@
1
- import { CheckCircle, AlertCircle } from '@transferwise/icons';
2
- import { clsx } from 'clsx';
3
- import 'react';
4
- import Body from '../body/Body.mjs';
5
- import '../common/theme.mjs';
6
- import '../common/direction.mjs';
7
- import '../common/propsValues/control.mjs';
8
- import '../common/propsValues/breakpoint.mjs';
9
- import '../common/propsValues/size.mjs';
10
- import { Typography } from '../common/propsValues/typography.mjs';
11
- import '../common/propsValues/width.mjs';
12
- import '../common/propsValues/type.mjs';
13
- import '../common/propsValues/dateMode.mjs';
14
- import '../common/propsValues/monthFormat.mjs';
15
- import '../common/propsValues/position.mjs';
16
- import '../common/propsValues/layouts.mjs';
17
- import '../common/propsValues/status.mjs';
18
- import '../common/propsValues/sentiment.mjs';
19
- import '../common/propsValues/profileType.mjs';
20
- import '../common/propsValues/variant.mjs';
21
- import '../common/propsValues/scroll.mjs';
22
- import '../common/propsValues/markdownNodeType.mjs';
23
- import '../common/fileType.mjs';
24
- import 'react-intl';
25
- import '../common/closeButton/CloseButton.messages.mjs';
26
- import { jsxs, jsx } from 'react/jsx-runtime';
27
-
28
- const TableStatusText = ({
29
- text,
30
- className,
31
- status,
32
- typography = 'default'
33
- }) => {
34
- const typographyType = status ?? typography === 'default-bold' ? Typography.BODY_DEFAULT_BOLD : Typography.BODY_DEFAULT;
35
- return /*#__PURE__*/jsxs(Body, {
36
- type: typographyType,
37
- className: clsx(className, {
38
- 'np-table-content--success': status === 'success',
39
- 'np-table-content--error': status === 'error'
40
- }),
41
- children: [text, status === 'success' && /*#__PURE__*/jsx(CheckCircle, {
42
- className: "tw-icon--status",
43
- "data-testid": "check-icon"
44
- }), status === 'error' && /*#__PURE__*/jsx(AlertCircle, {
45
- className: "tw-icon--status",
46
- "data-testid": "alert-icon"
47
- })]
48
- });
49
- };
50
-
51
- export { TableStatusText as default };
52
- //# sourceMappingURL=TableStatusText.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableStatusText.mjs","sources":["../../src/table/TableStatusText.tsx"],"sourcesContent":["import { AlertCircle, CheckCircle } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport React from 'react';\nimport Body from '../body';\nimport { Typography } from '../common';\n\nexport interface TableStatusTextProps {\n text: string | React.ReactNode;\n className?: string;\n status?: 'success' | 'error';\n typography?: 'default' | 'default-bold';\n}\n\nconst TableStatusText = ({\n text,\n className,\n status,\n typography = 'default',\n}: TableStatusTextProps) => {\n const typographyType =\n (status ?? typography === 'default-bold')\n ? Typography.BODY_DEFAULT_BOLD\n : Typography.BODY_DEFAULT;\n\n return (\n <Body\n type={typographyType}\n className={clsx(className, {\n 'np-table-content--success': status === 'success',\n 'np-table-content--error': status === 'error',\n })}\n >\n {text}\n {status === 'success' && <CheckCircle className=\"tw-icon--status\" data-testid=\"check-icon\" />}\n {status === 'error' && <AlertCircle className=\"tw-icon--status\" data-testid=\"alert-icon\" />}\n </Body>\n );\n};\n\nexport default TableStatusText;\n"],"names":["TableStatusText","text","className","status","typography","typographyType","Typography","BODY_DEFAULT_BOLD","BODY_DEFAULT","_jsxs","Body","type","clsx","children","_jsx","CheckCircle","AlertCircle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaMA,MAAAA,eAAe,GAAGA,CAAC;EACvBC,IAAI;EACJC,SAAS;EACTC,MAAM;AACNC,EAAAA,UAAU,GAAG,SAAA;AAAS,CACD,KAAI;AACzB,EAAA,MAAMC,cAAc,GACjBF,MAAM,IAAIC,UAAU,KAAK,cAAc,GACpCE,UAAU,CAACC,iBAAiB,GAC5BD,UAAU,CAACE,YAAY,CAAA;EAE7B,oBACEC,IAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,IAAI,EAAEN,cAAe;AACrBH,IAAAA,SAAS,EAAEU,IAAI,CAACV,SAAS,EAAE;MACzB,2BAA2B,EAAEC,MAAM,KAAK,SAAS;MACjD,yBAAyB,EAAEA,MAAM,KAAK,OAAA;AACvC,KAAA,CAAE;IAAAU,QAAA,EAAA,CAEFZ,IAAI,EACJE,MAAM,KAAK,SAAS,iBAAIW,GAAA,CAACC,WAAW,EAAA;AAACb,MAAAA,SAAS,EAAC,iBAAiB;MAAC,aAAY,EAAA,YAAA;MAAe,EAC5FC,MAAM,KAAK,OAAO,iBAAIW,GAAA,CAACE,WAAW,EAAA;AAACd,MAAAA,SAAS,EAAC,iBAAiB;MAAC,aAAY,EAAA,YAAA;AAAY,MAAG,CAAA;AAAA,GACvF,CAAC,CAAA;AAEX;;;;"}
@@ -1,93 +0,0 @@
1
- import { render, screen, userEvent, mockMatchMedia } from '../test-utils';
2
- import { Position } from '../common';
3
-
4
- import Drawer from './Drawer';
5
-
6
- jest.mock('../common/DOMOperations');
7
- mockMatchMedia();
8
-
9
- describe('Drawer', () => {
10
- const renderedComponent = (props: React.ComponentProps<typeof Drawer>) =>
11
- render(<Drawer {...props} />);
12
-
13
- const props = {
14
- open: true,
15
- onClose: jest.fn(),
16
- headerTitle: 'Drawer Title',
17
- footerContent: <div>Footer Content</div>,
18
- children: <p>Drawer Content</p>,
19
- className: 'drawer-class',
20
- };
21
-
22
- beforeEach(() => {
23
- jest.clearAllMocks();
24
- });
25
-
26
- it('renders the Drawer component', () => {
27
- renderedComponent(props);
28
- expect(screen.getByRole('dialog')).toBeInTheDocument();
29
- });
30
-
31
- it('renders the header title', () => {
32
- renderedComponent(props);
33
- expect(screen.getByText('Drawer Title')).toBeInTheDocument();
34
- });
35
-
36
- it('renders the footer content', () => {
37
- renderedComponent(props);
38
- expect(screen.getByText('Footer Content')).toBeInTheDocument();
39
- });
40
-
41
- it('renders the children content', () => {
42
- renderedComponent(props);
43
- expect(screen.getByText('Drawer Content')).toBeInTheDocument();
44
- });
45
-
46
- it('passes through the className prop', () => {
47
- renderedComponent({ ...props, className: 'drawer-class' });
48
- expect(screen.getByRole('dialog')).toHaveClass('drawer-class');
49
- });
50
-
51
- it('calls onClose when the close button is clicked', async () => {
52
- renderedComponent(props);
53
- await userEvent.click(screen.getByLabelText('Close'));
54
- expect(props.onClose).toHaveBeenCalled();
55
- });
56
-
57
- it('calls onClose if the dimmer is clicked', async () => {
58
- render(<Drawer {...props} />);
59
- await userEvent.click(screen.getByRole('button'));
60
- expect(props.onClose).toHaveBeenCalledTimes(1);
61
- });
62
-
63
- it('does not call onClose if the drawer content is clicked', async () => {
64
- render(<Drawer {...props}>Drawer Content</Drawer>);
65
- await userEvent.click(screen.getByText('Drawer Content'));
66
- expect(props.onClose).not.toHaveBeenCalled();
67
- });
68
-
69
- it('does not render the Drawer when open is false', () => {
70
- renderedComponent({ ...props, open: false });
71
- expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
72
- });
73
-
74
- it('renders the Drawer with the correct aria-labelledby attribute', () => {
75
- renderedComponent(props);
76
- expect(screen.getByRole('dialog')).toHaveAttribute('aria-labelledby');
77
- });
78
-
79
- it('renders the Drawer with the correct position', () => {
80
- renderedComponent({ ...props, position: Position.LEFT });
81
- expect(screen.getByRole('dialog').parentElement).toHaveClass('sliding-panel--open-left');
82
- });
83
-
84
- it('renders the Drawer with the correct role attribute', () => {
85
- renderedComponent(props);
86
- expect(screen.getByRole('dialog')).toHaveAttribute('role', 'dialog');
87
- });
88
-
89
- it('renders the Drawer with the correct aria-modal attribute', () => {
90
- renderedComponent(props);
91
- expect(screen.getByRole('dialog')).toHaveAttribute('aria-modal', 'true');
92
- });
93
- });