@popsure/dirty-swan 0.54.0 → 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 +281 -260
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/table/Table.d.ts +4 -14
- package/dist/cjs/lib/components/table/Table.stories.d.ts +14 -13
- package/dist/cjs/lib/components/table/components/TableCell/TableCell.d.ts +15 -9
- package/dist/cjs/lib/components/table/components/TableContents/TableContents.d.ts +13 -0
- package/dist/cjs/lib/components/table/components/TableSection/TableSection.d.ts +7 -17
- package/dist/cjs/lib/components/table/types.d.ts +17 -0
- 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 +18 -15
- package/dist/esm/components/table/Table.js.map +1 -1
- package/dist/esm/components/table/Table.stories.js +59 -54
- package/dist/esm/components/table/Table.stories.js.map +1 -1
- package/dist/esm/components/table/Table.test.js +18 -14
- package/dist/esm/components/table/Table.test.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/TableCell.js +23 -6
- package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/TableCell.test.js +4 -4
- package/dist/esm/components/table/components/TableCell/TableCell.test.js.map +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 -39
- package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.test.js +34 -57
- package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
- package/dist/esm/index.js +2 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/components/table/Table.d.ts +4 -14
- package/dist/esm/lib/components/table/Table.stories.d.ts +14 -13
- package/dist/esm/lib/components/table/components/TableCell/TableCell.d.ts +15 -9
- package/dist/esm/lib/components/table/components/TableContents/TableContents.d.ts +13 -0
- package/dist/esm/lib/components/table/components/TableSection/TableSection.d.ts +7 -17
- package/dist/esm/lib/components/table/types.d.ts +17 -0
- package/package.json +1 -1
- package/src/lib/components/table/Table.stories.tsx +64 -59
- package/src/lib/components/table/Table.test.tsx +17 -11
- package/src/lib/components/table/Table.tsx +28 -45
- package/src/lib/components/table/components/TableCell/TableCell.module.scss +64 -1
- package/src/lib/components/table/components/TableCell/TableCell.test.tsx +6 -4
- package/src/lib/components/table/components/TableCell/TableCell.tsx +122 -75
- 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 +98 -94
- package/src/lib/components/table/types.ts +23 -0
- package/dist/cjs/lib/components/table/components/TableColumn/TableColumn.d.ts +0 -10
- 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/TableColumn/TableColumn.js +0 -22
- package/dist/esm/components/table/components/TableColumn/TableColumn.js.map +0 -1
- package/dist/esm/components/table/components/TableColumn/TableColumn.test.js +0 -40
- package/dist/esm/components/table/components/TableColumn/TableColumn.test.js.map +0 -1
- package/dist/esm/components/table/components/TableContent/TableContent.js +0 -45
- package/dist/esm/components/table/components/TableContent/TableContent.js.map +0 -1
- package/dist/esm/components/table/components/TableContent/TableContent.test.js +0 -61
- package/dist/esm/components/table/components/TableContent/TableContent.test.js.map +0 -1
- package/dist/esm/lib/components/table/components/TableColumn/TableColumn.d.ts +0 -10
- package/dist/esm/lib/components/table/components/TableColumn/TableColumn.test.d.ts +0 -1
- package/dist/esm/lib/components/table/components/TableContent/TableContent.d.ts +0 -13
- package/dist/esm/lib/components/table/components/TableContent/TableContent.test.d.ts +0 -1
- package/src/lib/components/table/components/TableColumn/TableColumn.module.scss +0 -38
- package/src/lib/components/table/components/TableColumn/TableColumn.test.tsx +0 -49
- package/src/lib/components/table/components/TableColumn/TableColumn.tsx +0 -37
- package/src/lib/components/table/components/TableContent/TableContent.module.scss +0 -38
- package/src/lib/components/table/components/TableContent/TableContent.test.tsx +0 -56
- package/src/lib/components/table/components/TableContent/TableContent.tsx +0 -127
- /package/dist/cjs/lib/components/table/components/{TableSection → TableContents}/Collapsible.d.ts +0 -0
- /package/dist/cjs/lib/components/table/components/{TableColumn/TableColumn.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/{cjs/lib/components/table/components/TableContent/TableContent.test.d.ts → esm/lib/components/table/components/TableContents/TableContents.test.d.ts} +0 -0
- /package/src/lib/components/table/components/{TableSection → TableContents}/Collapsible.tsx +0 -0
|
@@ -24,36 +24,40 @@ import '../icon/icons/ChevronDown.js';
|
|
|
24
24
|
import '../icon/icons/ChevronUp.js';
|
|
25
25
|
import '../cards/card/index.js';
|
|
26
26
|
import '../icon/icons/ChevronRight.js';
|
|
27
|
-
import '../../Collapsible-
|
|
27
|
+
import '../../Collapsible-a355828b.js';
|
|
28
28
|
import '../../index-a0ef2ab4.js';
|
|
29
|
+
import './components/TableContents/TableContents.js';
|
|
29
30
|
import './components/TableSection/TableSection.js';
|
|
30
|
-
import './components/TableContent/TableContent.js';
|
|
31
|
-
import './components/TableColumn/TableColumn.js';
|
|
32
31
|
import '../../useTableNavigation-8e50b121.js';
|
|
33
32
|
import '../../index-5e72c3d4.js';
|
|
34
33
|
import './components/TableControls/TableControls.js';
|
|
35
34
|
import '../icon/icons/ChevronLeft.js';
|
|
36
35
|
import '../../useScrollSync-b2d28bed.js';
|
|
37
36
|
|
|
38
|
-
var
|
|
37
|
+
var tableData = [
|
|
39
38
|
{
|
|
40
39
|
section: {
|
|
41
40
|
title: 'Section 1',
|
|
42
41
|
icon: jsx("span", { children: "Icon 1" }),
|
|
43
42
|
},
|
|
44
|
-
|
|
43
|
+
rows: [[{ content: 'Item 1' }, { content: 'Item 2' }]],
|
|
45
44
|
},
|
|
46
45
|
{
|
|
47
46
|
section: {
|
|
48
47
|
title: 'Section 2',
|
|
49
48
|
icon: jsx("span", { children: "Icon 2" }),
|
|
50
49
|
},
|
|
51
|
-
|
|
50
|
+
rows: [
|
|
51
|
+
[
|
|
52
|
+
{ content: 'Item 3' },
|
|
53
|
+
{ content: 'Item 4', modalContent: 'Additional item' },
|
|
54
|
+
],
|
|
55
|
+
],
|
|
52
56
|
},
|
|
53
57
|
];
|
|
54
58
|
describe('Table', function () {
|
|
55
59
|
it('renders the table with sections and items', function () {
|
|
56
|
-
customRender(jsx(Table, {
|
|
60
|
+
customRender(jsx(Table, { tableData: tableData, title: "Test Table" }));
|
|
57
61
|
expect(screen.getByText('Section 1')).toBeInTheDocument();
|
|
58
62
|
expect(screen.getByText('Section 2')).toBeInTheDocument();
|
|
59
63
|
expect(screen.getAllByText('Item 1')[0]).toBeInTheDocument();
|
|
@@ -62,21 +66,21 @@ describe('Table', function () {
|
|
|
62
66
|
expect(screen.getByText('Item 4')).toBeInTheDocument();
|
|
63
67
|
});
|
|
64
68
|
it('renders the table without sections', function () {
|
|
65
|
-
var dataWithoutSections = [{
|
|
66
|
-
customRender(jsx(Table, {
|
|
69
|
+
var dataWithoutSections = [{ rows: tableData[0].rows }];
|
|
70
|
+
customRender(jsx(Table, { tableData: dataWithoutSections, title: "Test Table" }));
|
|
67
71
|
expect(screen.getAllByText('Item 1')[0]).toBeVisible();
|
|
68
72
|
expect(screen.getAllByText('Item 2')[0]).toBeVisible();
|
|
69
73
|
});
|
|
70
74
|
it('hides the show/hide details button if hideDetails is false', function () {
|
|
71
|
-
customRender(jsx(Table, {
|
|
75
|
+
customRender(jsx(Table, { tableData: tableData, hideDetails: true, title: "Test Table" }));
|
|
72
76
|
expect(screen.queryByTestId('show-hide-details')).toBeInTheDocument();
|
|
73
77
|
});
|
|
74
78
|
it('shows the show/hide details button if hideDetails is true', function () {
|
|
75
|
-
customRender(jsx(Table, {
|
|
79
|
+
customRender(jsx(Table, { tableData: tableData, hideDetails: true, title: "Test Table" }));
|
|
76
80
|
expect(screen.getByTestId('show-hide-details')).toBeInTheDocument();
|
|
77
81
|
});
|
|
78
82
|
it('hides the sections if hideDetails is true', function () {
|
|
79
|
-
customRender(jsx(Table, {
|
|
83
|
+
customRender(jsx(Table, { tableData: tableData, hideDetails: true, title: "Test Table" }));
|
|
80
84
|
expect(screen.queryByText('Section 2')).not.toBeInTheDocument();
|
|
81
85
|
expect(screen.getByTestId('show-hide-details')).toBeInTheDocument();
|
|
82
86
|
});
|
|
@@ -85,7 +89,7 @@ describe('Table', function () {
|
|
|
85
89
|
return __generator(this, function (_a) {
|
|
86
90
|
switch (_a.label) {
|
|
87
91
|
case 0:
|
|
88
|
-
user = customRender(jsx(Table, {
|
|
92
|
+
user = customRender(jsx(Table, { tableData: tableData, hideDetails: true, title: "Test Table" })).user;
|
|
89
93
|
expect(screen.getByText('Show details')).toBeVisible();
|
|
90
94
|
return [4 /*yield*/, user.click(screen.getByTestId('show-hide-details'))];
|
|
91
95
|
case 1:
|
|
@@ -101,7 +105,7 @@ describe('Table', function () {
|
|
|
101
105
|
return __generator(this, function (_a) {
|
|
102
106
|
switch (_a.label) {
|
|
103
107
|
case 0:
|
|
104
|
-
user = customRender(jsx(Table, {
|
|
108
|
+
user = customRender(jsx(Table, { tableData: tableData, title: "Test Table" })).user;
|
|
105
109
|
return [4 /*yield*/, user.click(screen.getByText('View more info'))];
|
|
106
110
|
case 1:
|
|
107
111
|
_a.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.test.js","sources":["../../../../../src/lib/components/table/Table.test.tsx"],"sourcesContent":["import { render, screen } from '../../util/testUtils';\nimport { Table } from './Table';\n\nconst
|
|
1
|
+
{"version":3,"file":"Table.test.js","sources":["../../../../../src/lib/components/table/Table.test.tsx"],"sourcesContent":["import { render, screen } from '../../util/testUtils';\nimport { Table } from './Table';\nimport { TableSectionData } from './types';\n\nconst tableData: TableSectionData[] = [\n {\n section: {\n title: 'Section 1',\n icon: <span>Icon 1</span>,\n },\n rows: [[{ content: 'Item 1' }, { content: 'Item 2' }]],\n },\n {\n section: {\n title: 'Section 2',\n icon: <span>Icon 2</span>,\n },\n rows: [\n [\n { content: 'Item 3' },\n { content: 'Item 4', modalContent: 'Additional item' },\n ],\n ],\n },\n];\n\ndescribe('Table', () => {\n it('renders the table with sections and items', () => {\n render(<Table tableData={tableData} title=\"Test Table\" />);\n\n expect(screen.getByText('Section 1')).toBeInTheDocument();\n expect(screen.getByText('Section 2')).toBeInTheDocument();\n\n expect(screen.getAllByText('Item 1')[0]).toBeInTheDocument();\n expect(screen.getAllByText('Item 2')[0]).toBeInTheDocument();\n expect(screen.getByText('Item 3')).toBeInTheDocument();\n expect(screen.getByText('Item 4')).toBeInTheDocument();\n });\n\n it('renders the table without sections', () => {\n const dataWithoutSections = [{ rows: tableData[0].rows }];\n\n render(<Table tableData={dataWithoutSections} title=\"Test Table\" />);\n\n expect(screen.getAllByText('Item 1')[0]).toBeVisible();\n expect(screen.getAllByText('Item 2')[0]).toBeVisible();\n });\n\n it('hides the show/hide details button if hideDetails is false', () => {\n render(<Table tableData={tableData} hideDetails title=\"Test Table\" />);\n\n expect(screen.queryByTestId('show-hide-details')).toBeInTheDocument();\n });\n\n it('shows the show/hide details button if hideDetails is true', () => {\n render(<Table tableData={tableData} hideDetails title=\"Test Table\" />);\n\n expect(screen.getByTestId('show-hide-details')).toBeInTheDocument();\n });\n\n it('hides the sections if hideDetails is true', () => {\n render(<Table tableData={tableData} hideDetails title=\"Test Table\" />);\n\n expect(screen.queryByText('Section 2')).not.toBeInTheDocument();\n expect(screen.getByTestId('show-hide-details')).toBeInTheDocument();\n });\n\n it('hides the sections if hideDetails is true and shows if clicking on button', async () => {\n const { user } = render(\n <Table tableData={tableData} hideDetails title=\"Test Table\" />\n );\n\n expect(screen.getByText('Show details')).toBeVisible();\n\n await user.click(screen.getByTestId('show-hide-details'));\n\n expect(screen.getByText('Section 2')).toBeVisible();\n expect(screen.getByText('Hide details')).toBeVisible();\n });\n\n it('shows a modal when clicking on info icon', async () => {\n const { user } = render(<Table tableData={tableData} title=\"Test Table\" />);\n\n await user.click(screen.getByText('View more info'));\n\n expect(screen.getByText('Additional item')).toBeVisible();\n });\n});\n"],"names":["_jsx","render"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,SAAS,GAAuB;IACpC;QACE,OAAO,EAAE;YACP,KAAK,EAAE,WAAW;YAClB,IAAI,EAAEA,mCAAmB;SAC1B;QACD,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;KACvD;IACD;QACE,OAAO,EAAE;YACP,KAAK,EAAE,WAAW;YAClB,IAAI,EAAEA,mCAAmB;SAC1B;QACD,IAAI,EAAE;YACJ;gBACE,EAAE,OAAO,EAAE,QAAQ,EAAE;gBACrB,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE;aACvD;SACF;KACF;CACF,CAAC;AAEF,QAAQ,CAAC,OAAO,EAAE;IAChB,EAAE,CAAC,2CAA2C,EAAE;QAC9CC,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MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;;;;SACxD,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE;;;;;oBACrC,IAAI,GAAKC,YAAM,CAACD,IAAC,KAAK,IAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAC,YAAY,GAAG,CAAC,KAA/D,CAAgE;oBAE5E,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,EAAA;;oBAApD,SAAoD,CAAC;oBAErD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;;;;SAC3D,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __assign } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
import { Button } from '../../../button/index.js';
|
|
3
4
|
import CheckIcon from '../../../icon/icons/Check.js';
|
|
4
5
|
import InfoIcon from '../../../icon/icons/Info.js';
|
|
@@ -7,16 +8,27 @@ import XIcon from '../../../icon/icons/X.js';
|
|
|
7
8
|
import ZapFilledIcon from '../../../icon/icons/ZapFilled.js';
|
|
8
9
|
import { c as classNames } from '../../../../index-6ea95111.js';
|
|
9
10
|
import { s as styleInject } from '../../../../style-inject.es-1f59c1d0.js';
|
|
10
|
-
import '../../../../tslib.es6-a39f91fc.js';
|
|
11
11
|
import 'react';
|
|
12
12
|
import '../../../icon/IconWrapper/IconWrapper.js';
|
|
13
13
|
|
|
14
|
-
var css_248z = ".TableCell-module_button__2MKH1 {\n min-height: initial;\n height: initial;\n width: initial;\n}\n\n.TableCell-module_icon__2o49x {\n margin: 2px;\n}";
|
|
15
|
-
var styles = {"button":"TableCell-module_button__2MKH1","icon":"TableCell-module_icon__2o49x"};
|
|
14
|
+
var css_248z = ".TableCell-module_button__2MKH1 {\n min-height: initial;\n height: initial;\n width: initial;\n padding: 0;\n}\n\n.TableCell-module_icon__2o49x {\n margin: 2px;\n}\n\n.TableCell-module_th__2rjCU {\n vertical-align: middle;\n scroll-snap-align: end;\n width: 50%;\n}\n@media (min-width: 34rem) {\n .TableCell-module_th__2rjCU {\n width: auto;\n scroll-snap-align: unset;\n }\n}\n\n.TableCell-module_thRow__3Qp3k {\n position: sticky;\n top: 0;\n}\n\n.TableCell-module_thCol__34DMO {\n text-align: left;\n}\n\n.TableCell-module_fixedCell__cL3-m {\n position: sticky;\n left: 0;\n z-index: 2;\n}\n.TableCell-module_fixedCell__cL3-m:after {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n width: 1px;\n background-color: #f5f6fb;\n}\n\n.TableCell-module_topLeftCell__3npat {\n position: relative;\n display: none;\n}\n.TableCell-module_topLeftCell__3npat:after {\n content: \"\";\n display: block;\n position: absolute;\n top: calc( 50% + 16px );\n height: 4px;\n width: 100%;\n max-width: 140px;\n background-color: #8e8cee;\n}\n@media (min-width: 34rem) {\n .TableCell-module_topLeftCell__3npat {\n display: flex;\n }\n}";
|
|
15
|
+
var styles = {"button":"TableCell-module_button__2MKH1","icon":"TableCell-module_icon__2o49x","th":"TableCell-module_th__2rjCU","thRow":"TableCell-module_thRow__3Qp3k","thCol":"TableCell-module_thCol__34DMO","fixedCell":"TableCell-module_fixedCell__cL3-m","topLeftCell":"TableCell-module_topLeftCell__3npat"};
|
|
16
16
|
styleInject(css_248z);
|
|
17
17
|
|
|
18
18
|
var TableCell = function (_a) {
|
|
19
|
-
var _b
|
|
19
|
+
var _b;
|
|
20
|
+
var _c = _a.align, align = _c === void 0 ? 'center' : _c, checkmarkValue = _a.checkmarkValue, _d = _a.content, content = _d === void 0 ? '' : _d, _e = _a.isFirstCellInRow, isFirstCellInRow = _e === void 0 ? false : _e, _f = _a.isHeader, isHeader = _f === void 0 ? false : _f, _g = _a.isNavigation, isNavigation = _g === void 0 ? false : _g, _h = _a.isTopLeftCell, isTopLeftCell = _h === void 0 ? false : _h, _j = _a.modalContent, modalContent = _j === void 0 ? '' : _j, openModal = _a.openModal, rating = _a.rating, _k = _a.subContent, subContent = _k === void 0 ? '' : _k;
|
|
21
|
+
// prettier-ignore
|
|
22
|
+
var Tag = isNavigation
|
|
23
|
+
? 'div'
|
|
24
|
+
: isHeader || isFirstCellInRow ? 'th' : 'td';
|
|
25
|
+
// prettier-ignore
|
|
26
|
+
var thScope = isHeader
|
|
27
|
+
? 'col'
|
|
28
|
+
: isFirstCellInRow ? 'row' : undefined;
|
|
29
|
+
var scope = {
|
|
30
|
+
scope: thScope,
|
|
31
|
+
};
|
|
20
32
|
var alignClassName = {
|
|
21
33
|
center: 'ta-center jc-center',
|
|
22
34
|
left: 'ta-left jc-start',
|
|
@@ -24,7 +36,12 @@ var TableCell = function (_a) {
|
|
|
24
36
|
}[align];
|
|
25
37
|
var validRatingValues = [1, 2, 3];
|
|
26
38
|
var SelectedIcon = (rating === null || rating === void 0 ? void 0 : rating.type) === 'zap' ? ZapFilledIcon : StarFilledIcon;
|
|
27
|
-
return (
|
|
39
|
+
return (jsx(Tag, __assign({}, scope, { className: classNames('bg-white py24 px8', styles.th, (_b = {
|
|
40
|
+
'ta-left': isFirstCellInRow
|
|
41
|
+
},
|
|
42
|
+
_b[styles.fixedCell] = isFirstCellInRow,
|
|
43
|
+
_b.pl32 = isFirstCellInRow,
|
|
44
|
+
_b)), children: jsxs("div", { className: "d-flex fd-column gap8", children: [jsxs("div", { className: classNames('d-flex gap8 ai-center', alignClassName), children: [(rating === null || rating === void 0 ? void 0 : rating.value) && (jsx("span", { "data-testid": "table-cell-rating", title: "".concat(rating === null || rating === void 0 ? void 0 : rating.value, " out of 3"), children: validRatingValues.map(function (value) { return (jsx(SelectedIcon, { "aria-hidden": "true", color: value <= (rating === null || rating === void 0 ? void 0 : rating.value) ? 'primary-500' : 'grey-400', className: styles.icon }, value)); }) })), checkmarkValue !== undefined && (jsx("span", { title: checkmarkValue ? 'Yes' : 'No', children: checkmarkValue ? (jsx(CheckIcon, { "data-testid": "table-cell-boolean-yes", size: 24, "aria-hidden": true, color: "primary-500" })) : (jsx(XIcon, { "data-testid": "table-cell-boolean-no", size: 24, "aria-hidden": true, color: "grey-400" })) })), content && !isTopLeftCell && (jsx("div", { className: "p-p", "data-testid": "table-cell-content", children: content })), content && isTopLeftCell && (jsx("div", { "aria-hidden": true, className: classNames('tc-grey-800 p-h2 p--serif', styles.topLeftCell), children: content })), modalContent && openModal && (jsx(Button, { className: styles.button, hideLabel: true, leftIcon: jsx(InfoIcon, { size: 20 }), onClick: function () { return openModal(modalContent); }, type: "button", variant: "textColor", children: "View more info" }))] }), subContent && (jsx("div", { className: classNames('d-flex p-p--small tc-grey-500', alignClassName), children: subContent }))] }) })));
|
|
28
45
|
};
|
|
29
46
|
|
|
30
47
|
export { TableCell };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.js","sources":["../../../../../../../src/lib/components/table/components/TableCell/TableCell.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"TableCell.js","sources":["../../../../../../../src/lib/components/table/components/TableCell/TableCell.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { Button } from '../../../button';\nimport {\n CheckIcon,\n InfoIcon,\n StarFilledIcon,\n XIcon,\n ZapFilledIcon,\n} from '../../../icon';\nimport classNames from 'classnames';\n\nimport styles from './TableCell.module.scss';\n\ninterface BaseTableCellProps {\n align?: 'center' | 'left' | 'right';\n checkmarkValue?: boolean;\n content?: ReactNode;\n modalContent?: ReactNode;\n openModal?: (modalContent: ReactNode) => void;\n subContent?: ReactNode;\n rating?: {\n value: number;\n type: 'zap' | 'star';\n };\n}\n\ninterface PositionalTableCellProps {\n isHeader?: boolean;\n isFirstCellInRow?: boolean;\n isTopLeftCell?: boolean;\n isNavigation?: boolean;\n}\n\nexport type TableCellProps = BaseTableCellProps & PositionalTableCellProps;\n\nconst TableCell = ({\n align = 'center',\n checkmarkValue,\n content = '',\n isFirstCellInRow = false,\n isHeader = false,\n isNavigation = false,\n isTopLeftCell = false,\n modalContent = '',\n openModal,\n rating,\n subContent = '',\n}: TableCellProps) => {\n // prettier-ignore\n const Tag = isNavigation\n ? 'div'\n : isHeader || isFirstCellInRow ? 'th' : 'td';\n\n // prettier-ignore\n const thScope = isHeader\n ? 'col'\n : isFirstCellInRow ? 'row' : undefined;\n\n const scope = {\n scope: thScope,\n };\n\n const alignClassName = {\n center: 'ta-center jc-center',\n left: 'ta-left jc-start',\n right: 'ta-right',\n }[align];\n\n const validRatingValues: number[] = [1, 2, 3];\n const SelectedIcon = rating?.type === 'zap' ? ZapFilledIcon : StarFilledIcon;\n\n return (\n <Tag\n {...scope}\n className={classNames('bg-white py24 px8', styles.th, {\n 'ta-left': isFirstCellInRow,\n [styles.fixedCell]: isFirstCellInRow,\n pl32: isFirstCellInRow,\n })}\n >\n <div className=\"d-flex fd-column gap8\">\n <div className={classNames('d-flex gap8 ai-center', alignClassName)}>\n {rating?.value && (\n <span\n data-testid=\"table-cell-rating\"\n title={`${rating?.value} out of 3`}\n >\n {validRatingValues.map((value) => (\n <SelectedIcon\n aria-hidden=\"true\"\n key={value}\n color={value <= rating?.value ? 'primary-500' : 'grey-400'}\n className={styles.icon}\n />\n ))}\n </span>\n )}\n\n {checkmarkValue !== undefined && (\n <span title={checkmarkValue ? 'Yes' : 'No'}>\n {checkmarkValue ? (\n <CheckIcon\n data-testid=\"table-cell-boolean-yes\"\n size={24}\n aria-hidden\n color=\"primary-500\"\n />\n ) : (\n <XIcon\n data-testid=\"table-cell-boolean-no\"\n size={24}\n aria-hidden\n color=\"grey-400\"\n />\n )}\n </span>\n )}\n\n {content && !isTopLeftCell && (\n <div className=\"p-p\" data-testid=\"table-cell-content\">\n {content}\n </div>\n )}\n\n {content && isTopLeftCell && (\n <div\n aria-hidden\n className={classNames(\n 'tc-grey-800 p-h2 p--serif',\n styles.topLeftCell\n )}\n >\n {content}\n </div>\n )}\n\n {modalContent && openModal && (\n <Button\n className={styles.button}\n hideLabel\n leftIcon={<InfoIcon size={20} />}\n onClick={() => openModal(modalContent)}\n type=\"button\"\n variant=\"textColor\"\n >\n View more info\n </Button>\n )}\n </div>\n\n {subContent && (\n <div\n className={classNames(\n 'd-flex p-p--small tc-grey-500',\n alignClassName\n )}\n >\n {subContent}\n </div>\n )}\n </div>\n </Tag>\n );\n};\n\nexport { TableCell };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;IAmCM,SAAS,GAAG,UAAC,EAYF;;QAXf,aAAgB,EAAhB,KAAK,mBAAG,QAAQ,KAAA,EAChB,cAAc,oBAAA,EACd,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA,EACZ,wBAAwB,EAAxB,gBAAgB,mBAAG,KAAK,KAAA,EACxB,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,oBAAoB,EAApB,YAAY,mBAAG,KAAK,KAAA,EACpB,qBAAqB,EAArB,aAAa,mBAAG,KAAK,KAAA,EACrB,oBAAiB,EAAjB,YAAY,mBAAG,EAAE,KAAA,EACjB,SAAS,eAAA,EACT,MAAM,YAAA,EACN,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA;;IAGf,IAAM,GAAG,GAAG,YAAY;UACpB,KAAK;UACL,QAAQ,IAAI,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;;IAG/C,IAAM,OAAO,GAAG,QAAQ;UACpB,KAAK;UACL,gBAAgB,GAAG,KAAK,GAAG,SAAS,CAAC;IAEzC,IAAM,KAAK,GAAG;QACZ,KAAK,EAAE,OAAO;KACf,CAAC;IAEF,IAAM,cAAc,GAAG;QACrB,MAAM,EAAE,qBAAqB;QAC7B,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,UAAU;KAClB,CAAC,KAAK,CAAC,CAAC;IAET,IAAM,iBAAiB,GAAa,CAAC,CAAC,EAAE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AAO,GACJ,CACP,EAEA,OAAO,IAAI,aAAa,KACvBA,kCAEE,SAAS,EAAE,UAAU,CACnB,2BAA2B,EAC3B,MAAM,CAAC,WAAW,CACnB,YAEA,OAAO,GACJ,CACP,EAEA,YAAY,IAAI,SAAS,KACxBA,IAAC,MAAM,IACL,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,SAAS,QACT,QAAQ,EAAEA,IAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,GAAI,EAChC,OAAO,EAAE,cAAM,OAAA,SAAS,CAAC,YAAY,CAAC,GAAA,EACtC,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,WAAW,+BAGZ,CACV,IACG,EAEL,UAAU,KACTA,aACE,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,cAAc,CACf,YAEA,UAAU,GACP,CACP,IACG,IACF,EACN;AACJ;;;;"}
|
|
@@ -19,12 +19,12 @@ import '../../../icon/icons/ZapFilled.js';
|
|
|
19
19
|
var openModal = jest.fn();
|
|
20
20
|
describe('TableCell', function () {
|
|
21
21
|
it('renders the component with boolean true', function () {
|
|
22
|
-
customRender(jsx(TableCell, {
|
|
22
|
+
customRender(jsx(TableCell, { checkmarkValue: true }));
|
|
23
23
|
expect(screen.getByTitle('Yes')).toBeInTheDocument();
|
|
24
24
|
expect(screen.getByTestId('table-cell-boolean-yes')).toBeInTheDocument();
|
|
25
25
|
});
|
|
26
26
|
it('renders the component with boolean false', function () {
|
|
27
|
-
customRender(jsx(TableCell, {
|
|
27
|
+
customRender(jsx(TableCell, { checkmarkValue: false }));
|
|
28
28
|
expect(screen.getByTitle('No')).toBeInTheDocument();
|
|
29
29
|
expect(screen.getByTestId('table-cell-boolean-no')).toBeInTheDocument();
|
|
30
30
|
});
|
|
@@ -44,7 +44,7 @@ describe('TableCell', function () {
|
|
|
44
44
|
expect(screen.queryByTestId('table-cell-rating')).not.toBeInTheDocument();
|
|
45
45
|
});
|
|
46
46
|
it('renders the component with text', function () {
|
|
47
|
-
customRender(jsx(TableCell, {
|
|
47
|
+
customRender(jsx(TableCell, { content: "Sample text" }));
|
|
48
48
|
expect(screen.getByText('Sample text')).toBeInTheDocument();
|
|
49
49
|
});
|
|
50
50
|
it('renders the component without text', function () {
|
|
@@ -56,7 +56,7 @@ describe('TableCell', function () {
|
|
|
56
56
|
expect(screen.queryByText('View more info')).not.toBeInTheDocument();
|
|
57
57
|
});
|
|
58
58
|
it('calls openModal when info button is clicked', function () {
|
|
59
|
-
customRender(jsx(TableCell, {
|
|
59
|
+
customRender(jsx(TableCell, { modalContent: "Additional information", openModal: openModal }));
|
|
60
60
|
// Click info button
|
|
61
61
|
screen.getByText('View more info').click();
|
|
62
62
|
// Assert openModal is called with info prop
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.test.js","sources":["../../../../../../../src/lib/components/table/components/TableCell/TableCell.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableCell } from './TableCell';\n\nconst openModal = jest.fn();\n\ndescribe('TableCell', () => {\n it('renders the component with boolean true', () => {\n render(<TableCell
|
|
1
|
+
{"version":3,"file":"TableCell.test.js","sources":["../../../../../../../src/lib/components/table/components/TableCell/TableCell.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableCell } from './TableCell';\n\nconst openModal = jest.fn();\n\ndescribe('TableCell', () => {\n it('renders the component with boolean true', () => {\n render(<TableCell checkmarkValue={true} />);\n\n expect(screen.getByTitle('Yes')).toBeInTheDocument();\n expect(screen.getByTestId('table-cell-boolean-yes')).toBeInTheDocument();\n });\n\n it('renders the component with boolean false', () => {\n render(<TableCell checkmarkValue={false} />);\n\n expect(screen.getByTitle('No')).toBeInTheDocument();\n expect(screen.getByTestId('table-cell-boolean-no')).toBeInTheDocument();\n });\n\n it('renders the component without boolean', () => {\n render(<TableCell />);\n\n expect(screen.queryByTitle('Yes')).not.toBeInTheDocument();\n expect(screen.queryByTitle('No')).not.toBeInTheDocument();\n expect(\n screen.queryByTestId('table-cell-boolean-yes')\n ).not.toBeInTheDocument();\n expect(\n screen.queryByTestId('table-cell-boolean-no')\n ).not.toBeInTheDocument();\n });\n\n it('renders the component with rating', () => {\n render(<TableCell rating={{ type: 'star', value: 2 }} />);\n\n expect(screen.getByTitle('2 out of 3')).toBeInTheDocument();\n });\n\n it('renders the component without rating', () => {\n render(<TableCell />);\n\n expect(screen.queryByTestId('table-cell-rating')).not.toBeInTheDocument();\n });\n\n it('renders the component with text', () => {\n render(<TableCell content=\"Sample text\" />);\n\n expect(screen.getByText('Sample text')).toBeInTheDocument();\n });\n\n it('renders the component without text', () => {\n render(<TableCell />);\n\n expect(screen.queryByTestId('table-cell-text')).not.toBeInTheDocument();\n });\n\n it('renders the component without info', () => {\n render(<TableCell />);\n\n expect(screen.queryByText('View more info')).not.toBeInTheDocument();\n });\n\n it('calls openModal when info button is clicked', () => {\n render(\n <TableCell modalContent=\"Additional information\" openModal={openModal} />\n );\n\n // Click info button\n screen.getByText('View more info').click();\n\n // Assert openModal is called with info prop\n expect(openModal).toHaveBeenCalledWith('Additional information');\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAGA,IAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAE5B,QAAQ,CAAC,WAAW,EAAE;IACpB,EAAE,CAAC,yCAAyC,EAAE;QAC5CA,YAAM,CAACC,IAAC,SAAS,IAAC,cAAc,EAAE,IAAI,GAAI,CAAC,CAAC;QAE5C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QACrD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;KAC1E,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE;QAC7CD,YAAM,CAACC,IAAC,SAAS,IAAC,cAAc,EAAE,KAAK,GAAI,CAAC,CAAC;Q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AAC,OAAO,EAAC,aAAa,GAAG,CAAC,CAAC;QAE5C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;KAC7D,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE;QACvCD,YAAM,CAACC,IAAC,SAAS,KAAG,CAAC,CAAC;QAEtB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;KACzE,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE;QACvCD,YAAM,CAACC,IAAC,SAAS,KAAG,CAAC,CAAC;QAEtB,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;KACtE,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE;QAChDD,YAAM,CACJC,IAAC,SAAS,IAAC,YAAY,EAAC,wBAAwB,EAAC,SAAS,EAAE,SAAS,GAAI,CAC1E,CAAC;;QAGF,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,KAAK,EAAE,CAAC;;QAG3C,MAAM,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;KAClE,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'react/jsx-runtime';
|
|
2
2
|
import '../../../../index-a0ef2ab4.js';
|
|
3
|
-
export { C as Collapsible } from '../../../../Collapsible-
|
|
3
|
+
export { C as Collapsible } from '../../../../Collapsible-a355828b.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '../../../../index-6ea95111.js';
|
|
6
6
|
//# sourceMappingURL=Collapsible.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { a as __assign, _ as __spreadArray } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { TableSection } from '../TableSection/TableSection.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';
|
|
9
|
+
import { c as classNames } from '../../../../index-6ea95111.js';
|
|
10
|
+
import { C as Collapsible } from '../../../../Collapsible-a355828b.js';
|
|
11
|
+
import '../TableCell/TableCell.js';
|
|
12
|
+
import '../../../button/index.js';
|
|
13
|
+
import '../../../icon/icons/Check.js';
|
|
14
|
+
import '../../../icon/IconWrapper/IconWrapper.js';
|
|
15
|
+
import '../../../icon/icons/Info.js';
|
|
16
|
+
import '../../../icon/icons/StarFilled.js';
|
|
17
|
+
import '../../../icon/icons/X.js';
|
|
18
|
+
import '../../../icon/icons/ZapFilled.js';
|
|
19
|
+
import '../../../icon/icons/ChevronRight.js';
|
|
20
|
+
import '../../../../index-a0ef2ab4.js';
|
|
21
|
+
|
|
22
|
+
var css_248z = ".TableContents-module_cardWrapper__2OVMv {\n height: 88px;\n}\n\n.TableContents-module_card__Mmz6h {\n position: absolute;\n left: 0;\n right: 0;\n z-index: 3;\n}";
|
|
23
|
+
var styles = {"cardWrapper":"TableContents-module_cardWrapper__2OVMv","card":"TableContents-module_card__Mmz6h"};
|
|
24
|
+
styleInject(css_248z);
|
|
25
|
+
|
|
26
|
+
var TableContents = function (_a) {
|
|
27
|
+
var _b, _c;
|
|
28
|
+
var className = _a.className, collapsibleSections = _a.collapsibleSections, tableData = _a.tableData, hideDetails = _a.hideDetails, isMobile = _a.isMobile, openModal = _a.openModal, shouldHideDetails = _a.shouldHideDetails, title = _a.title;
|
|
29
|
+
var _d = useState(null), isSectionOpen = _d[0], setOpenSection = _d[1];
|
|
30
|
+
var firstHeadRow = (_c = (_b = tableData === null || tableData === void 0 ? void 0 : tableData[0]) === null || _b === void 0 ? void 0 : _b.rows) === null || _c === void 0 ? void 0 : _c[0];
|
|
31
|
+
var tableWidth = isMobile ? "".concat((firstHeadRow === null || firstHeadRow === void 0 ? void 0 : firstHeadRow.length) * 50, "%") : '';
|
|
32
|
+
var handleToggleSection = function (index) {
|
|
33
|
+
setOpenSection(function (currentSection) {
|
|
34
|
+
return currentSection === index ? null : index;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return (jsx("div", { style: { width: tableWidth }, children: tableData.map(function (_a, index) {
|
|
38
|
+
var rows = _a.rows, _b = _a.section, section = _b === void 0 ? {} : _b;
|
|
39
|
+
var isFirstSection = index === 0;
|
|
40
|
+
var isExpanded = !collapsibleSections
|
|
41
|
+
? true
|
|
42
|
+
: isSectionOpen === index || isFirstSection;
|
|
43
|
+
var isVisible = hideDetails ? !shouldHideDetails : true;
|
|
44
|
+
return ((isFirstSection || isVisible) && (jsxs("div", { children: [(section === null || section === void 0 ? void 0 : section.title) && (jsx("div", { className: styles.cardWrapper, children: jsx("div", { className: classNames(styles.card, 'p8'), children: jsx(Card, __assign({ actionIcon: isExpanded ? (jsx(ChevronUpIcon, { size: 24 })) : (jsx(ChevronDownIcon, { size: 24 })), "aria-expanded": isExpanded ? 'true' : 'false', "aria-hidden": true, classNames: {
|
|
45
|
+
wrapper: 'bg-grey-200',
|
|
46
|
+
icon: 'tc-grey-900',
|
|
47
|
+
}, dropShadow: false, icon: section === null || section === void 0 ? void 0 : section.icon, title: section.title, titleVariant: "medium" }, (collapsibleSections
|
|
48
|
+
? {
|
|
49
|
+
onClick: function () { return handleToggleSection(index); },
|
|
50
|
+
}
|
|
51
|
+
: {}))) }) })), jsx(Collapsible, { isExpanded: isExpanded, isMobile: isMobile, children: jsx(TableSection, { className: classNames(className, 'mb24'), tableCellRows: isFirstSection ? rows : __spreadArray([firstHeadRow], rows, true), hideHeader: true, openModal: openModal, title: "".concat(title).concat((section === null || section === void 0 ? void 0 : section.title) ? " - ".concat(section.title) : ''), width: tableWidth }) })] }, index)));
|
|
52
|
+
}) }));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { TableContents };
|
|
56
|
+
//# sourceMappingURL=TableContents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableContents.js","sources":["../../../../../../../src/lib/components/table/components/TableContents/TableContents.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { TableSection } from '../TableSection/TableSection';\nimport { ChevronDownIcon, ChevronUpIcon } from '../../../icon';\nimport { Card } from '../../../cards/card';\n\nimport styles from './TableContents.module.scss';\nimport classNames from 'classnames';\nimport { Collapsible } from './Collapsible';\nimport { ModalFunction, TableData } from '../../types';\n\nexport interface TableContentsProps {\n className?: string;\n collapsibleSections?: boolean;\n tableData: TableData;\n hideDetails?: boolean;\n isMobile?: boolean;\n openModal?: ModalFunction;\n shouldHideDetails?: boolean;\n title: string;\n}\n\nconst TableContents = ({\n className,\n collapsibleSections,\n tableData,\n hideDetails,\n isMobile,\n openModal,\n shouldHideDetails,\n title,\n}: TableContentsProps) => {\n const [isSectionOpen, setOpenSection] = useState<number | null>(null);\n const firstHeadRow = tableData?.[0]?.rows?.[0];\n const tableWidth = isMobile ? `${firstHeadRow?.length * 50}%` : '';\n const handleToggleSection = (index: number) => {\n setOpenSection((currentSection) =>\n currentSection === index ? null : index\n );\n };\n\n return (\n <div style={{ width: tableWidth }}>\n {tableData.map(({ rows, section = {} }, index) => {\n const isFirstSection = index === 0;\n const isExpanded = !collapsibleSections\n ? true\n : isSectionOpen === index || isFirstSection;\n const isVisible = hideDetails ? !shouldHideDetails : true;\n\n return (\n (isFirstSection || isVisible) && (\n <div key={index}>\n {section?.title && (\n <div className={styles.cardWrapper}>\n <div className={classNames(styles.card, 'p8')}>\n <Card\n actionIcon={\n isExpanded ? (\n <ChevronUpIcon size={24} />\n ) : (\n <ChevronDownIcon size={24} />\n )\n }\n aria-expanded={isExpanded ? 'true' : 'false'}\n aria-hidden\n classNames={{\n wrapper: 'bg-grey-200',\n icon: 'tc-grey-900',\n }}\n dropShadow={false}\n icon={section?.icon}\n title={section.title}\n titleVariant=\"medium\"\n {...(collapsibleSections\n ? {\n onClick: () => handleToggleSection(index),\n }\n : {})}\n />\n </div>\n </div>\n )}\n\n <Collapsible isExpanded={isExpanded} isMobile={isMobile}>\n <TableSection\n className={classNames(className, 'mb24')}\n tableCellRows={\n isFirstSection ? rows : [firstHeadRow, ...rows]\n }\n hideHeader\n openModal={openModal}\n title={`${title}${\n section?.title ? ` - ${section.title}` : ''\n }`}\n width={tableWidth}\n />\n </Collapsible>\n </div>\n )\n );\n })}\n </div>\n );\n};\n\nexport { TableContents };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;IAqBM,aAAa,GAAG,UAAC,EASF;;QARnB,SAAS,eAAA,EACT,mBAAmB,yBAAA,EACnB,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,iBAAiB,uBAAA,EACjB,KAAK,WAAA;IAEC,IAAA,KAAkC,QAAQ,CAAgB,IAAI,CAAC,EAA9D,aAAa,QAAA,EAAE,cAAc,QAAiC,CAAC;IACtE,IAAM,YAAY,GAAG,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAG,CAAC,CAAC,CAAC;IAC/C,IAAM,UAAU,GAAG,QAAQ,GAAG,UAAG,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,IAAG,EAAE,MAAG,GAAG,EAAE,CAAC;IACnE,IAAM,mBAAmB,GAAG,UAAC,KAAa;QACxC,cAAc,CAAC,UAAC,cAAc;YAC5B,OAAA,cAAc,KAAK,KAAK,GAAG,IAAI,GAAG,KAAK;SAAA,CACxC,CAAC;KACH,CAAC;IAEF,QACEA,aAAK,KAAK,EAAE,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AS,EAAE,MAAM,CAAC,EACxC,aAAa,EACX,cAAc,GAAG,IAAI,kBAAI,YAAY,GAAK,IAAI,OAAC,EAEjD,UAAU,QACV,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,UAAG,KAAK,SACb,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,IAAG,aAAM,OAAO,CAAC,KAAK,CAAE,GAAG,EAAE,CAC3C,EACF,KAAK,EAAE,UAAU,GACjB,GACU,KA7CN,KAAK,CA8CT,CACP,EACD;SACH,CAAC,GACE,EACN;AACJ;;;;"}
|
|
@@ -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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,CAAC;QAChE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;KAClE,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE;QACtED,YAAM,CACJC,IAAC,aAAa,IACZ,mBAAmB,QACnB,QAAQ,QACR,SAAS,EAAE,QAAQ,EACnB,KAAK,EAAC,OAAO,GACb,CACH,CAAC;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,41 +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 '../TableColumn/TableColumn.js';
|
|
20
|
-
import '../../../icon/icons/ChevronRight.js';
|
|
21
|
-
import '../../../../index-a0ef2ab4.js';
|
|
22
14
|
|
|
23
|
-
var css_248z = ".TableSection-
|
|
24
|
-
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"};
|
|
25
17
|
styleInject(css_248z);
|
|
26
18
|
|
|
27
19
|
var TableSection = function (_a) {
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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),
|
|
36
28
|
});
|
|
37
29
|
};
|
|
38
|
-
return (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
}) })] }));
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
export { TableSection };
|