@popsure/dirty-swan 0.54.1 → 0.54.2
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.
- package/dist/cjs/index.js +21 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/table/Table.d.ts +3 -4
- package/dist/cjs/lib/components/table/Table.stories.d.ts +5 -4
- package/dist/cjs/lib/components/table/components/TableContents/TableContents.d.ts +13 -0
- package/dist/cjs/lib/components/table/components/TableSection/TableSection.d.ts +6 -17
- package/dist/cjs/lib/components/table/types.d.ts +6 -4
- package/dist/esm/{Collapsible-ac67187a.js → Collapsible-a355828b.js} +1 -1
- package/dist/esm/Collapsible-a355828b.js.map +1 -0
- package/dist/esm/components/table/Table.js +7 -7
- package/dist/esm/components/table/Table.js.map +1 -1
- package/dist/esm/components/table/Table.stories.js +9 -9
- package/dist/esm/components/table/Table.stories.js.map +1 -1
- package/dist/esm/components/table/Table.test.js +13 -13
- package/dist/esm/components/table/Table.test.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/TableCell.js +1 -1
- package/dist/esm/components/table/components/{TableSection → TableContents}/Collapsible.js +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.js +56 -0
- package/dist/esm/components/table/components/TableContents/TableContents.js.map +1 -0
- package/dist/esm/components/table/components/TableContents/TableContents.test.js +82 -0
- package/dist/esm/components/table/components/TableContents/TableContents.test.js.map +1 -0
- package/dist/esm/components/table/components/TableControls/TableControls.js +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.js +41 -38
- package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.test.js +34 -56
- package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/components/table/Table.d.ts +3 -4
- package/dist/esm/lib/components/table/Table.stories.d.ts +5 -4
- package/dist/esm/lib/components/table/components/TableContents/TableContents.d.ts +13 -0
- package/dist/esm/lib/components/table/components/TableSection/TableSection.d.ts +6 -17
- package/dist/esm/lib/components/table/types.d.ts +6 -4
- package/package.json +1 -1
- package/src/lib/components/table/Table.stories.tsx +13 -13
- package/src/lib/components/table/Table.test.tsx +11 -11
- package/src/lib/components/table/Table.tsx +11 -13
- package/src/lib/components/table/components/TableCell/TableCell.module.scss +1 -0
- package/src/lib/components/table/components/TableContents/TableContents.module.scss +10 -0
- package/src/lib/components/table/components/TableContents/TableContents.test.tsx +86 -0
- package/src/lib/components/table/components/TableContents/TableContents.tsx +106 -0
- package/src/lib/components/table/components/TableControls/TableControls.module.scss +2 -1
- package/src/lib/components/table/components/TableSection/TableSection.module.scss +13 -8
- package/src/lib/components/table/components/TableSection/TableSection.test.tsx +38 -64
- package/src/lib/components/table/components/TableSection/TableSection.tsx +97 -94
- package/src/lib/components/table/types.ts +8 -4
- package/dist/cjs/lib/components/table/components/TableContent/TableContent.d.ts +0 -13
- package/dist/esm/Collapsible-ac67187a.js.map +0 -1
- package/dist/esm/components/table/components/TableContent/TableContent.js +0 -59
- package/dist/esm/components/table/components/TableContent/TableContent.js.map +0 -1
- package/dist/esm/components/table/components/TableContent/TableContent.test.js +0 -60
- package/dist/esm/components/table/components/TableContent/TableContent.test.js.map +0 -1
- package/dist/esm/lib/components/table/components/TableContent/TableContent.d.ts +0 -13
- package/src/lib/components/table/components/TableContent/TableContent.module.scss +0 -15
- package/src/lib/components/table/components/TableContent/TableContent.test.tsx +0 -56
- package/src/lib/components/table/components/TableContent/TableContent.tsx +0 -121
- /package/dist/cjs/lib/components/table/components/{TableSection → TableContents}/Collapsible.d.ts +0 -0
- /package/dist/cjs/lib/components/table/components/{TableContent/TableContent.test.d.ts → TableContents/TableContents.test.d.ts} +0 -0
- /package/dist/esm/components/table/components/{TableSection → TableContents}/Collapsible.js.map +0 -0
- /package/dist/esm/lib/components/table/components/{TableSection → TableContents}/Collapsible.d.ts +0 -0
- /package/dist/esm/lib/components/table/components/{TableContent/TableContent.test.d.ts → TableContents/TableContents.test.d.ts} +0 -0
- /package/src/lib/components/table/components/{TableSection → TableContents}/Collapsible.tsx +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { c as __awaiter, d as __generator } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { c as customRender, s as screen } from '../../../../customRender-d03c10b6.js';
|
|
4
|
+
import { TableContents } from './TableContents.js';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'react-dom';
|
|
7
|
+
import '../../../../_commonjsHelpers-4730bd53.js';
|
|
8
|
+
import 'react-dom/test-utils';
|
|
9
|
+
import '../TableSection/TableSection.js';
|
|
10
|
+
import '../../../../index-6ea95111.js';
|
|
11
|
+
import '../../../../style-inject.es-1f59c1d0.js';
|
|
12
|
+
import '../TableCell/TableCell.js';
|
|
13
|
+
import '../../../button/index.js';
|
|
14
|
+
import '../../../icon/icons/Check.js';
|
|
15
|
+
import '../../../icon/IconWrapper/IconWrapper.js';
|
|
16
|
+
import '../../../icon/icons/Info.js';
|
|
17
|
+
import '../../../icon/icons/StarFilled.js';
|
|
18
|
+
import '../../../icon/icons/X.js';
|
|
19
|
+
import '../../../icon/icons/ZapFilled.js';
|
|
20
|
+
import '../../../icon/icons/ChevronDown.js';
|
|
21
|
+
import '../../../icon/icons/ChevronUp.js';
|
|
22
|
+
import '../../../cards/card/index.js';
|
|
23
|
+
import '../../../icon/icons/ChevronRight.js';
|
|
24
|
+
import '../../../../Collapsible-a355828b.js';
|
|
25
|
+
import '../../../../index-a0ef2ab4.js';
|
|
26
|
+
|
|
27
|
+
var mockData = [
|
|
28
|
+
{
|
|
29
|
+
rows: [
|
|
30
|
+
[{ content: 'Item 1.1.1' }, { content: 'Item 1.1.2' }],
|
|
31
|
+
[{ content: 'Item 1.2.1' }, { content: 'Item 1.2.2' }],
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
section: {
|
|
36
|
+
title: 'Section 2',
|
|
37
|
+
},
|
|
38
|
+
rows: [
|
|
39
|
+
[{ content: 'Item 2.1.1' }, { content: 'Item 2.1.2' }],
|
|
40
|
+
[{ content: 'Item 2.2.1' }, { content: 'Item 2.2.2' }],
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
describe('TableContents', function () {
|
|
45
|
+
it('renders the table sections with sections', function () {
|
|
46
|
+
customRender(jsx(TableContents, { collapsibleSections: true, tableData: mockData, title: "Table" }));
|
|
47
|
+
expect(screen.getByText('Section 2')).toBeInTheDocument();
|
|
48
|
+
});
|
|
49
|
+
it('renders the table sections with sections data', function () {
|
|
50
|
+
customRender(jsx(TableContents, { collapsibleSections: true, tableData: mockData, title: "Table" }));
|
|
51
|
+
expect(screen.getByText('Item 1.2.1')).toBeInTheDocument();
|
|
52
|
+
expect(screen.getByText('Item 1.2.2')).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByText('Item 2.1.2')).toBeInTheDocument();
|
|
54
|
+
expect(screen.getByText('Item 2.2.1')).toBeInTheDocument();
|
|
55
|
+
});
|
|
56
|
+
it('hides the table sections when hideDetails and shouldHideDetails is true', function () {
|
|
57
|
+
customRender(jsx(TableContents, { hideDetails: true, shouldHideDetails: true, tableData: mockData, title: "Table" }));
|
|
58
|
+
expect(screen.queryByText('Section 2')).not.toBeInTheDocument();
|
|
59
|
+
expect(screen.queryByText('Item 2.1.1')).not.toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
it('hides the table sections details when collapsibleSections is true', function () {
|
|
62
|
+
customRender(jsx(TableContents, { collapsibleSections: true, isMobile: true, tableData: mockData, title: "Table" }));
|
|
63
|
+
expect(screen.getByText('Section 2')).toBeVisible();
|
|
64
|
+
expect(screen.queryByText('Item 2.1.1')).not.toBeVisible();
|
|
65
|
+
});
|
|
66
|
+
it('shows the table sections when hideDetails is collapsibleSections true has expanded ', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var user;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0:
|
|
71
|
+
user = customRender(jsx(TableContents, { collapsibleSections: true, isMobile: true, tableData: mockData, title: "Table" })).user;
|
|
72
|
+
expect(screen.queryByText('Item 2.1.1')).not.toBeVisible();
|
|
73
|
+
return [4 /*yield*/, user.click(screen.getByText('Section 2'))];
|
|
74
|
+
case 1:
|
|
75
|
+
_a.sent();
|
|
76
|
+
expect(screen.getByText('Item 2.1.1')).toBeVisible();
|
|
77
|
+
return [2 /*return*/];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}); });
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=TableContents.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableContents.test.js","sources":["../../../../../../../src/lib/components/table/components/TableContents/TableContents.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableContents, TableSectionProps } from './TableContents';\n\nconst mockData: TableSectionProps['tableData'] = [\n {\n rows: [\n [{ content: 'Item 1.1.1' }, { content: 'Item 1.1.2' }],\n [{ content: 'Item 1.2.1' }, { content: 'Item 1.2.2' }],\n ],\n },\n {\n section: {\n title: 'Section 2',\n },\n rows: [\n [{ content: 'Item 2.1.1' }, { content: 'Item 2.1.2' }],\n [{ content: 'Item 2.2.1' }, { content: 'Item 2.2.2' }],\n ],\n },\n];\n\ndescribe('TableContents', () => {\n it('renders the table sections with sections', () => {\n render(\n <TableContents collapsibleSections tableData={mockData} title=\"Table\" />\n );\n\n expect(screen.getByText('Section 2')).toBeInTheDocument();\n });\n\n it('renders the table sections with sections data', () => {\n render(\n <TableContents collapsibleSections tableData={mockData} title=\"Table\" />\n );\n\n expect(screen.getByText('Item 1.2.1')).toBeInTheDocument();\n expect(screen.getByText('Item 1.2.2')).toBeInTheDocument();\n expect(screen.getByText('Item 2.1.2')).toBeInTheDocument();\n expect(screen.getByText('Item 2.2.1')).toBeInTheDocument();\n });\n\n it('hides the table sections when hideDetails and shouldHideDetails is true', () => {\n render(\n <TableContents\n hideDetails\n shouldHideDetails\n tableData={mockData}\n title=\"Table\"\n />\n );\n\n expect(screen.queryByText('Section 2')).not.toBeInTheDocument();\n expect(screen.queryByText('Item 2.1.1')).not.toBeInTheDocument();\n });\n\n it('hides the table sections details when collapsibleSections is true', () => {\n render(\n <TableContents\n collapsibleSections\n isMobile\n tableData={mockData}\n title=\"Table\"\n />\n );\n\n expect(screen.getByText('Section 2')).toBeVisible();\n expect(screen.queryByText('Item 2.1.1')).not.toBeVisible();\n });\n\n it('shows the table sections when hideDetails is collapsibleSections true has expanded ', async () => {\n const { user } = render(\n <TableContents\n collapsibleSections\n isMobile\n tableData={mockData}\n title=\"Table\"\n />\n );\n\n expect(screen.queryByText('Item 2.1.1')).not.toBeVisible();\n\n await user.click(screen.getByText('Section 2'));\n\n expect(screen.getByText('Item 2.1.1')).toBeVisible();\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,QAAQ,GAAmC;IAC/C;QACE,IAAI,EAAE;YACJ,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;YACtD,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;SACvD;KACF;IACD;QACE,OAAO,EAAE;YACP,KAAK,EAAE,WAAW;SACnB;QACD,IAAI,EAAE;YACJ,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;YACtD,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;SACvD;KACF;CACF,CAAC;AAEF,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,0CAA0C,EAAE;QAC7CA,YAAM,CACJC,IAAC,a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QAEF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACpD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;KAC5D,CAAC,CAAC;IAEH,EAAE,CAAC,qFAAqF,EAAE;;;;;oBAChF,IAAI,GAAKD,YAAM,CACrBC,IAAC,aAAa,IACZ,mBAAmB,QACnB,QAAQ,QACR,SAAS,EAAE,QAAQ,EACnB,KAAK,EAAC,OAAO,GACb,CACH,KAPW,CAOV;oBAEF,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;oBAE3D,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAA;;oBAA/C,SAA+C,CAAC;oBAEhD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;;;;SACtD,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -8,7 +8,7 @@ import 'react';
|
|
|
8
8
|
import '../../../icon/IconWrapper/IconWrapper.js';
|
|
9
9
|
import '../../../../tslib.es6-a39f91fc.js';
|
|
10
10
|
|
|
11
|
-
var css_248z = ".TableControls-module_stickyHeader__1f6Ta {\n display: flex;\n position: sticky;\n left: 0;\n right: 0;\n min-height: 72px;\n z-index:
|
|
11
|
+
var css_248z = ".TableControls-module_stickyHeader__1f6Ta {\n display: flex;\n position: sticky;\n left: 0;\n right: 0;\n min-height: 72px;\n z-index: 9;\n}\n\n.TableControls-module_controlButton__2kQiG {\n border-radius: 50% !important;\n width: 32px;\n height: 32px;\n padding: 0;\n}";
|
|
12
12
|
var styles = {"stickyHeader":"TableControls-module_stickyHeader__1f6Ta","controlButton":"TableControls-module_controlButton__2kQiG"};
|
|
13
13
|
styleInject(css_248z);
|
|
14
14
|
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { a as __assign
|
|
2
|
-
import {
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { TableContent } from '../TableContent/TableContent.js';
|
|
5
|
-
import ChevronDownIcon from '../../../icon/icons/ChevronDown.js';
|
|
6
|
-
import ChevronUpIcon from '../../../icon/icons/ChevronUp.js';
|
|
7
|
-
import { Card } from '../../../cards/card/index.js';
|
|
8
|
-
import { s as styleInject } from '../../../../style-inject.es-1f59c1d0.js';
|
|
1
|
+
import { a as __assign } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
3
|
import { c as classNames } from '../../../../index-6ea95111.js';
|
|
10
|
-
import {
|
|
11
|
-
import '../TableCell/TableCell.js';
|
|
4
|
+
import { s as styleInject } from '../../../../style-inject.es-1f59c1d0.js';
|
|
5
|
+
import { TableCell } from '../TableCell/TableCell.js';
|
|
6
|
+
import { useCallback } from 'react';
|
|
12
7
|
import '../../../button/index.js';
|
|
13
8
|
import '../../../icon/icons/Check.js';
|
|
14
9
|
import '../../../icon/IconWrapper/IconWrapper.js';
|
|
@@ -16,40 +11,48 @@ import '../../../icon/icons/Info.js';
|
|
|
16
11
|
import '../../../icon/icons/StarFilled.js';
|
|
17
12
|
import '../../../icon/icons/X.js';
|
|
18
13
|
import '../../../icon/icons/ZapFilled.js';
|
|
19
|
-
import '../../../icon/icons/ChevronRight.js';
|
|
20
|
-
import '../../../../index-a0ef2ab4.js';
|
|
21
14
|
|
|
22
|
-
var css_248z = ".TableSection-
|
|
23
|
-
var styles = {"
|
|
15
|
+
var css_248z = ".TableSection-module_table__sNbDq {\n border-collapse: collapse;\n table-layout: fixed;\n}\n@media (min-width: 34rem) {\n .TableSection-module_table__sNbDq {\n min-width: 845px;\n }\n}\n\n.TableSection-module_tr__UbkbE {\n min-height: 72px;\n}";
|
|
16
|
+
var styles = {"table":"TableSection-module_table__sNbDq","tr":"TableSection-module_tr__UbkbE"};
|
|
24
17
|
styleInject(css_248z);
|
|
25
18
|
|
|
26
19
|
var TableSection = function (_a) {
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
var className = _a.className, tableCellRows = _a.tableCellRows, hideHeader = _a.hideHeader, openModal = _a.openModal, title = _a.title, width = _a.width;
|
|
21
|
+
var headerRow = tableCellRows === null || tableCellRows === void 0 ? void 0 : tableCellRows[0];
|
|
22
|
+
var getColumnContentByKey = useCallback(function (key) { var _a, _b; return ((_b = (_a = tableCellRows === null || tableCellRows === void 0 ? void 0 : tableCellRows[0]) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.content) || ''; }, [tableCellRows]);
|
|
23
|
+
var handleOpenModal = function (_a) {
|
|
24
|
+
var cellIndex = _a.cellIndex, body = _a.body, title = _a.title;
|
|
25
|
+
return openModal === null || openModal === void 0 ? void 0 : openModal({
|
|
26
|
+
body: body,
|
|
27
|
+
title: title || getColumnContentByKey(cellIndex),
|
|
35
28
|
});
|
|
36
29
|
};
|
|
37
|
-
return (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
30
|
+
return (jsxs("table", { className: classNames(className, 'w100', styles.table), width: width, children: [jsx("caption", { className: "sr-only", children: title }), headerRow && (jsx("thead", { className: hideHeader ? 'sr-only' : '', children: jsx("tr", { children: headerRow.map(function (tableCellProps, cellIndex) {
|
|
31
|
+
var isFirstCellInRow = cellIndex === 0;
|
|
32
|
+
return (jsx(TableCell, __assign({ isHeader: true, isFirstCellInRow: isFirstCellInRow, isTopLeftCell: isFirstCellInRow, align: isFirstCellInRow ? 'left' : 'center', openModal: function (body) {
|
|
33
|
+
return handleOpenModal({
|
|
34
|
+
cellIndex: cellIndex,
|
|
35
|
+
body: body,
|
|
36
|
+
title: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.content,
|
|
37
|
+
});
|
|
38
|
+
} }, tableCellProps), cellIndex));
|
|
39
|
+
}) }) })), jsx("tbody", { children: tableCellRows.map(function (row, rowIndex) {
|
|
40
|
+
var isSingleCell = row.length === 1;
|
|
41
|
+
return (rowIndex > 0 && (jsx("tr", { className: styles.tr, children: row.map(function (tableCellProps, cellIndex) {
|
|
42
|
+
var key = "".concat(rowIndex, "-").concat(cellIndex);
|
|
43
|
+
var isFirstCellInRow = cellIndex === 0;
|
|
44
|
+
var onCelInfoClick = function (body) {
|
|
45
|
+
return handleOpenModal({
|
|
46
|
+
cellIndex: cellIndex,
|
|
47
|
+
body: body,
|
|
48
|
+
title: isFirstCellInRow
|
|
49
|
+
? tableCellProps.content
|
|
50
|
+
: undefined,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
return (jsx(TableCell, __assign({ align: isFirstCellInRow && !isSingleCell ? 'left' : 'center', isFirstCellInRow: isFirstCellInRow, openModal: onCelInfoClick }, tableCellProps), key));
|
|
54
|
+
}) }, rowIndex)));
|
|
55
|
+
}) })] }));
|
|
53
56
|
};
|
|
54
57
|
|
|
55
58
|
export { TableSection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSection.js","sources":["../../../../../../../src/lib/components/table/components/TableSection/TableSection.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"TableSection.js","sources":["../../../../../../../src/lib/components/table/components/TableSection/TableSection.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './TableSection.module.scss';\nimport { TableCell, TableCellProps } from '../TableCell/TableCell';\nimport { ReactNode, useCallback } from 'react';\nimport { ModalData, ModalFunction, TableCellRowData } from '../../types';\n\nexport interface TableSectionProps {\n className?: string;\n tableCellRows: TableCellRowData[];\n hideHeader?: boolean;\n openModal?: ModalFunction;\n title: string;\n width?: number | string;\n}\n\nconst TableSection = ({\n className,\n tableCellRows,\n hideHeader,\n openModal,\n title,\n width,\n}: TableSectionProps) => {\n const headerRow = tableCellRows?.[0];\n\n const getColumnContentByKey = useCallback(\n (key: number) => tableCellRows?.[0]?.[key]?.content || '',\n [tableCellRows]\n );\n\n const handleOpenModal = ({\n cellIndex,\n body,\n title,\n }: ModalData & {\n cellIndex: number;\n }) =>\n openModal?.({\n body,\n title: title || getColumnContentByKey(cellIndex),\n });\n\n return (\n <table\n className={classNames(className, 'w100', styles.table)}\n width={width}\n >\n <caption className=\"sr-only\">{title}</caption>\n\n {headerRow && (\n <thead className={hideHeader ? 'sr-only' : ''}>\n <tr>\n {headerRow.map((tableCellProps, cellIndex) => {\n const isFirstCellInRow = cellIndex === 0;\n return (\n <TableCell\n key={cellIndex}\n isHeader\n isFirstCellInRow={isFirstCellInRow}\n isTopLeftCell={isFirstCellInRow}\n align={isFirstCellInRow ? 'left' : 'center'}\n openModal={(body) =>\n handleOpenModal({\n cellIndex,\n body,\n title: tableCellProps?.content,\n })\n }\n {...tableCellProps}\n />\n );\n })}\n </tr>\n </thead>\n )}\n\n <tbody>\n {tableCellRows.map((row, rowIndex) => {\n const isSingleCell = row.length === 1;\n\n return (\n rowIndex > 0 && (\n <tr key={rowIndex} className={styles.tr}>\n {row.map((tableCellProps, cellIndex) => {\n const key = `${rowIndex}-${cellIndex}`;\n const isFirstCellInRow = cellIndex === 0;\n\n const onCelInfoClick = (body: ReactNode) =>\n handleOpenModal({\n cellIndex,\n body,\n title: isFirstCellInRow\n ? tableCellProps.content\n : undefined,\n });\n\n return (\n <TableCell\n align={\n isFirstCellInRow && !isSingleCell ? 'left' : 'center'\n }\n isFirstCellInRow={isFirstCellInRow}\n openModal={onCelInfoClick}\n key={key}\n {...tableCellProps}\n />\n );\n })}\n </tr>\n )\n );\n })}\n </tbody>\n </table>\n );\n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MAAM,GAAG,QAAQ,EAC3C,SAAS,EAAE,UAAC,IAAI;gCACd,OAAA,eAAe,CAAC;oCACd,SAAS,WAAA;oCACT,IAAI,MAAA;oCACJ,KAAK,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO;iCAC/B,CAAC;6BAAA,IAEA,cAAc,GAZb,SAAS,CAad,EACF;qBACH,CAAC,GACC,GACC,CACT,EAEDA,yBACG,aAAa,CAAC,GAAG,CAAC,UAAC,GAAG,EAAE,QAAQ;oBAC/B,IAAM,YAAY,GAAG,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;oBAEtC,QACE,QAAQ,GAAG,CAAC,KACVA,YAAmB,SAAS,EAAE,MAAM,CAAC,EAAE,YACpC,GAAG,CAAC,GAAG,CAAC,UAAC,cAAc,EAAE,SAAS;4BACjC,IAAM,GAAG,GAAG,UAAG,QAAQ,cAAI,SAAS,CAAE,CAAC;4BACvC,IAAM,gBAAgB,GAAG,SAAS,KAAK,CAAC,CAAC;4BAEzC,IAAM,cAAc,GAAG,UAAC,IAAe;gCACrC,OAAA,eAAe,CAAC;oCACd,SAAS,WAAA;oCACT,IAAI,MAAA;oCACJ,KAAK,EAAE,gBAAgB;0CACnB,cAAc,CAAC,OAAO;0CACtB,SAAS;iCACd,CAAC;6BAAA,CAAC;4BAEL,QACEA,IAAC,SAAS,aACR,KAAK,EACH,gBAAgB,IAAI,CAAC,YAAY,GAAG,MAAM,GAAG,QAAQ,EAEvD,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,cAAc,IAErB,cAAc,GADb,GAAG,CAER,EACF;yBACH,CAAC,IAzBK,QAAQ,CA0BZ,CACN,EACD;iBACH,CAAC,GACI,IACF,EACR;AACJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __assign } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { c as customRender, s as screen } from '../../../../customRender-d03c10b6.js';
|
|
4
4
|
import { TableSection } from './TableSection.js';
|
|
@@ -6,7 +6,6 @@ import 'react';
|
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../../../_commonjsHelpers-4730bd53.js';
|
|
8
8
|
import 'react-dom/test-utils';
|
|
9
|
-
import '../TableContent/TableContent.js';
|
|
10
9
|
import '../../../../index-6ea95111.js';
|
|
11
10
|
import '../../../../style-inject.es-1f59c1d0.js';
|
|
12
11
|
import '../TableCell/TableCell.js';
|
|
@@ -17,66 +16,45 @@ import '../../../icon/icons/Info.js';
|
|
|
17
16
|
import '../../../icon/icons/StarFilled.js';
|
|
18
17
|
import '../../../icon/icons/X.js';
|
|
19
18
|
import '../../../icon/icons/ZapFilled.js';
|
|
20
|
-
import '../../../icon/icons/ChevronDown.js';
|
|
21
|
-
import '../../../icon/icons/ChevronUp.js';
|
|
22
|
-
import '../../../cards/card/index.js';
|
|
23
|
-
import '../../../icon/icons/ChevronRight.js';
|
|
24
|
-
import '../../../../Collapsible-ac67187a.js';
|
|
25
|
-
import '../../../../index-a0ef2ab4.js';
|
|
26
19
|
|
|
27
|
-
var
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
[{ content: 'Item 1.1.1' }, { content: 'Item 1.1.2' }],
|
|
31
|
-
[{ content: 'Item 1.2.1' }, { content: 'Item 1.2.2' }],
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
section: {
|
|
36
|
-
title: 'Section 2',
|
|
37
|
-
},
|
|
38
|
-
items: [
|
|
39
|
-
[{ content: 'Item 2.1.1' }, { content: 'Item 2.1.2' }],
|
|
40
|
-
[{ content: 'Item 2.2.1' }, { content: 'Item 2.2.2' }],
|
|
41
|
-
],
|
|
42
|
-
},
|
|
20
|
+
var tableCellRows = [
|
|
21
|
+
[{ content: 'Cell 1.1' }, { content: 'Cell 1.2' }, { content: 'Cell 1.3' }],
|
|
22
|
+
[{ content: 'Cell 2.1' }, { content: 'Cell 2.2' }, { content: 'Cell 2.3' }],
|
|
43
23
|
];
|
|
24
|
+
var mockTitle = 'Test Table';
|
|
25
|
+
var mockOpenModal = jest.fn();
|
|
26
|
+
var defaultProps = {
|
|
27
|
+
tableCellRows: tableCellRows,
|
|
28
|
+
title: mockTitle,
|
|
29
|
+
openModal: mockOpenModal,
|
|
30
|
+
};
|
|
44
31
|
describe('TableSection', function () {
|
|
45
|
-
it('renders the table
|
|
46
|
-
customRender(jsx(TableSection, {
|
|
47
|
-
expect(screen.getByText(
|
|
32
|
+
it('renders the table caption', function () {
|
|
33
|
+
customRender(jsx(TableSection, __assign({}, defaultProps)));
|
|
34
|
+
expect(screen.getByText(mockTitle)).toBeInTheDocument();
|
|
48
35
|
});
|
|
49
|
-
it('renders the table
|
|
50
|
-
customRender(jsx(TableSection, {
|
|
51
|
-
expect(screen.getByText('
|
|
52
|
-
expect(screen.getByText('
|
|
53
|
-
expect(screen.getByText('
|
|
54
|
-
expect(screen.getByText('
|
|
36
|
+
it('renders the table with correct data', function () {
|
|
37
|
+
customRender(jsx(TableSection, __assign({}, defaultProps)));
|
|
38
|
+
expect(screen.getByText('Cell 1.1')).toBeInTheDocument();
|
|
39
|
+
expect(screen.getByText('Cell 1.2')).toBeInTheDocument();
|
|
40
|
+
expect(screen.getByText('Cell 1.3')).toBeInTheDocument();
|
|
41
|
+
expect(screen.getByText('Cell 2.1')).toBeInTheDocument();
|
|
42
|
+
expect(screen.getByText('Cell 2.2')).toBeInTheDocument();
|
|
43
|
+
expect(screen.getByText('Cell 2.3')).toBeInTheDocument();
|
|
55
44
|
});
|
|
56
|
-
it('
|
|
57
|
-
customRender(jsx(TableSection, {
|
|
58
|
-
|
|
59
|
-
expect(
|
|
45
|
+
it('should render table headers', function () {
|
|
46
|
+
var container = customRender(jsx(TableSection, __assign({}, defaultProps))).container;
|
|
47
|
+
var thElements = container.querySelectorAll('th');
|
|
48
|
+
expect(thElements.length).toBe(4);
|
|
49
|
+
expect(thElements[0]).toHaveTextContent('Cell 1.1');
|
|
50
|
+
expect(thElements[3]).toHaveTextContent('Cell 2.1');
|
|
60
51
|
});
|
|
61
|
-
it('
|
|
62
|
-
customRender(jsx(TableSection, {
|
|
63
|
-
|
|
64
|
-
expect(
|
|
52
|
+
it('should render table data cells', function () {
|
|
53
|
+
var container = customRender(jsx(TableSection, __assign({}, defaultProps))).container;
|
|
54
|
+
var tdElements = container.querySelectorAll('td');
|
|
55
|
+
expect(tdElements.length).toBe(2);
|
|
56
|
+
expect(tdElements[0]).toHaveTextContent('Cell 2.2');
|
|
57
|
+
expect(tdElements[1]).toHaveTextContent('Cell 2.3');
|
|
65
58
|
});
|
|
66
|
-
it('shows the table sections when hideDetails is collapsibleSections true has expanded ', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
-
var user;
|
|
68
|
-
return __generator(this, function (_a) {
|
|
69
|
-
switch (_a.label) {
|
|
70
|
-
case 0:
|
|
71
|
-
user = customRender(jsx(TableSection, { collapsibleSections: true, isMobile: true, data: mockData, title: "Table" })).user;
|
|
72
|
-
expect(screen.queryByText('Item 2.1.1')).not.toBeVisible();
|
|
73
|
-
return [4 /*yield*/, user.click(screen.getByText('Section 2'))];
|
|
74
|
-
case 1:
|
|
75
|
-
_a.sent();
|
|
76
|
-
expect(screen.getByText('Item 2.1.1')).toBeVisible();
|
|
77
|
-
return [2 /*return*/];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}); });
|
|
81
59
|
});
|
|
82
60
|
//# sourceMappingURL=TableSection.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSection.test.js","sources":["../../../../../../../src/lib/components/table/components/TableSection/TableSection.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableSection,
|
|
1
|
+
{"version":3,"file":"TableSection.test.js","sources":["../../../../../../../src/lib/components/table/components/TableSection/TableSection.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableSection, TableContentProps } from './TableSection';\n\nconst tableCellRows: TableContentProps['tableCellRows'] = [\n [{ content: 'Cell 1.1' }, { content: 'Cell 1.2' }, { content: 'Cell 1.3' }],\n [{ content: 'Cell 2.1' }, { content: 'Cell 2.2' }, { content: 'Cell 2.3' }],\n];\n\nconst mockTitle = 'Test Table';\n\nconst mockOpenModal = jest.fn();\n\nconst defaultProps: TableContentProps = {\n tableCellRows,\n title: mockTitle,\n openModal: mockOpenModal,\n};\n\ndescribe('TableSection', () => {\n it('renders the table caption', () => {\n render(<TableSection {...defaultProps} />);\n\n expect(screen.getByText(mockTitle)).toBeInTheDocument();\n });\n\n it('renders the table with correct data', () => {\n render(<TableSection {...defaultProps} />);\n\n expect(screen.getByText('Cell 1.1')).toBeInTheDocument();\n expect(screen.getByText('Cell 1.2')).toBeInTheDocument();\n expect(screen.getByText('Cell 1.3')).toBeInTheDocument();\n\n expect(screen.getByText('Cell 2.1')).toBeInTheDocument();\n expect(screen.getByText('Cell 2.2')).toBeInTheDocument();\n expect(screen.getByText('Cell 2.3')).toBeInTheDocument();\n });\n\n it('should render table headers', () => {\n const { container } = render(<TableSection {...defaultProps} />);\n\n const thElements = container.querySelectorAll('th');\n\n expect(thElements.length).toBe(4);\n expect(thElements[0]).toHaveTextContent('Cell 1.1');\n expect(thElements[3]).toHaveTextContent('Cell 2.1');\n });\n\n it('should render table data cells', () => {\n const { container } = render(<TableSection {...defaultProps} />);\n\n const tdElements = container.querySelectorAll('td');\n expect(tdElements.length).toBe(2);\n expect(tdElements[0]).toHaveTextContent('Cell 2.2');\n expect(tdElements[1]).toHaveTextContent('Cell 2.3');\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,IAAM,aAAa,GAAuC;IACxD,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAC3E,CAAC,EAAE,OAAO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AAM,CAACC,IAAC,YAAY,eAAK,YAAY,EAAI,CAAC,UAA/C,CAAgD;QAEjE,IAAM,UAAU,GAAG,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAEpD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;KACrD,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE;QAC3B,IAAA,SAAS,GAAKD,YAAM,CAACC,IAAC,YAAY,eAAK,YAAY,EAAI,CAAC,UAA/C,CAAgD;QAEjE,IAAM,UAAU,GAAG,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;KACrD,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -421,9 +421,9 @@ import './components/comparisonTable/components/AccordionItem/AccordionItem.js';
|
|
|
421
421
|
import './components/comparisonTable/components/TableRating/StarIcon.js';
|
|
422
422
|
import './components/comparisonTable/components/TableRating/ZapIcon.js';
|
|
423
423
|
import './components/table/components/TableCell/TableCell.js';
|
|
424
|
-
import './Collapsible-
|
|
424
|
+
import './Collapsible-a355828b.js';
|
|
425
|
+
import './components/table/components/TableContents/TableContents.js';
|
|
425
426
|
import './components/table/components/TableSection/TableSection.js';
|
|
426
|
-
import './components/table/components/TableContent/TableContent.js';
|
|
427
427
|
import './useTableNavigation-8e50b121.js';
|
|
428
428
|
import './components/table/components/TableControls/TableControls.js';
|
|
429
429
|
import './useScrollSync-b2d28bed.js';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { ModalFunction,
|
|
1
|
+
import { ModalFunction, TableData } from './types';
|
|
2
2
|
type TextOverrides = {
|
|
3
3
|
showDetails?: string;
|
|
4
4
|
hideDetails?: string;
|
|
5
5
|
};
|
|
6
|
-
export type TableData = TableSectionData[];
|
|
7
6
|
export interface TableProps {
|
|
8
7
|
className?: string;
|
|
9
8
|
collapsibleSections?: boolean;
|
|
10
|
-
|
|
9
|
+
tableData: TableData;
|
|
11
10
|
hideDetails?: boolean;
|
|
12
11
|
onModalOpen?: ModalFunction;
|
|
13
12
|
onSelectionChanged?: (index: number) => void;
|
|
@@ -15,5 +14,5 @@ export interface TableProps {
|
|
|
15
14
|
textOverrides?: TextOverrides;
|
|
16
15
|
title: string;
|
|
17
16
|
}
|
|
18
|
-
declare const Table: ({ className, collapsibleSections,
|
|
17
|
+
declare const Table: ({ className, collapsibleSections, tableData, hideDetails, onModalOpen, onSelectionChanged, stickyHeaderTopOffset, textOverrides: definedTextOverrides, title, }: TableProps) => JSX.Element;
|
|
19
18
|
export { Table };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableProps } from './Table';
|
|
2
|
+
import { TableData } from './types';
|
|
2
3
|
declare const story: {
|
|
3
4
|
title: string;
|
|
4
|
-
component: ({ className, collapsibleSections,
|
|
5
|
+
component: ({ className, collapsibleSections, tableData, hideDetails, onModalOpen, onSelectionChanged, stickyHeaderTopOffset, textOverrides: definedTextOverrides, title, }: TableProps) => JSX.Element;
|
|
5
6
|
argTypes: {
|
|
6
7
|
data: {
|
|
7
8
|
subContent: string;
|
|
@@ -38,7 +39,7 @@ declare const story: {
|
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
args: {
|
|
41
|
-
|
|
42
|
+
tableData: TableData;
|
|
42
43
|
collapsibleSections: boolean;
|
|
43
44
|
hideDetails: boolean;
|
|
44
45
|
stickyHeaderTopOffset: number;
|
|
@@ -51,7 +52,7 @@ declare const story: {
|
|
|
51
52
|
};
|
|
52
53
|
};
|
|
53
54
|
export declare const TableStory: {
|
|
54
|
-
({ collapsibleSections,
|
|
55
|
+
({ collapsibleSections, tableData, hideDetails, stickyHeaderTopOffset, textOverrides, title, }: TableProps): JSX.Element;
|
|
55
56
|
storyName: string;
|
|
56
57
|
};
|
|
57
58
|
export declare const TableDataType: () => JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModalFunction, TableData } from '../../types';
|
|
2
|
+
export interface TableContentsProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
collapsibleSections?: boolean;
|
|
5
|
+
tableData: TableData;
|
|
6
|
+
hideDetails?: boolean;
|
|
7
|
+
isMobile?: boolean;
|
|
8
|
+
openModal?: ModalFunction;
|
|
9
|
+
shouldHideDetails?: boolean;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
declare const TableContents: ({ className, collapsibleSections, tableData, hideDetails, isMobile, openModal, shouldHideDetails, title, }: TableContentsProps) => JSX.Element;
|
|
13
|
+
export { TableContents };
|
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
import { TableCellProps } from '../TableCell/TableCell';
|
|
2
|
-
import {
|
|
3
|
-
import { ModalFunction } from '../../types';
|
|
4
|
-
export type TableSectionType = {
|
|
5
|
-
title?: string;
|
|
6
|
-
icon?: ReactNode;
|
|
7
|
-
};
|
|
8
|
-
interface TableSectionData {
|
|
9
|
-
section?: TableSectionType;
|
|
10
|
-
items: TableCellProps[][];
|
|
11
|
-
}
|
|
12
|
-
export type TableData = TableSectionData[];
|
|
2
|
+
import { ModalFunction, TableCellRowData } from '../../types';
|
|
13
3
|
export interface TableSectionProps {
|
|
14
4
|
className?: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
hideDetails?: boolean;
|
|
18
|
-
isMobile?: boolean;
|
|
5
|
+
tableCellRows: TableCellRowData[];
|
|
6
|
+
hideHeader?: boolean;
|
|
19
7
|
openModal?: ModalFunction;
|
|
20
|
-
shouldHideDetails?: boolean;
|
|
21
8
|
title: string;
|
|
9
|
+
width?: number | string;
|
|
22
10
|
}
|
|
23
|
-
declare const TableSection: ({ className,
|
|
11
|
+
declare const TableSection: ({ className, tableCellRows, hideHeader, openModal, title, width, }: TableSectionProps) => JSX.Element;
|
|
12
|
+
export type { TableCellProps };
|
|
24
13
|
export { TableSection };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { TableCellProps } from './components/TableCell/TableCell';
|
|
2
|
+
import type { TableCellProps } from './components/TableCell/TableCell';
|
|
3
3
|
export type TableSectionType = {
|
|
4
4
|
title?: string;
|
|
5
5
|
icon?: ReactNode;
|
|
@@ -8,8 +8,10 @@ export type ModalData = {
|
|
|
8
8
|
title?: ReactNode;
|
|
9
9
|
body?: ReactNode;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type TableCellRowData = TableCellProps[];
|
|
12
|
+
export type TableSectionData = {
|
|
12
13
|
section?: TableSectionType;
|
|
13
|
-
|
|
14
|
-
}
|
|
14
|
+
rows: TableCellRowData[];
|
|
15
|
+
};
|
|
16
|
+
export type TableData = TableSectionData[];
|
|
15
17
|
export type ModalFunction = (modalData: ModalData) => void;
|