@popsure/dirty-swan 0.54.3 → 0.54.4
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 +74 -71
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +5 -5
- package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +7 -7
- package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +3 -3
- package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts +4 -4
- package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +4 -3
- package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +5 -4
- package/dist/cjs/lib/components/table/types.d.ts +12 -4
- package/dist/esm/TableSection-f6d0028e.js +80 -0
- package/dist/esm/TableSection-f6d0028e.js.map +1 -0
- package/dist/esm/components/table/Table.js +8 -13
- package/dist/esm/components/table/Table.js.map +1 -1
- package/dist/esm/components/table/Table.stories.js +61 -35
- package/dist/esm/components/table/Table.stories.js.map +1 -1
- package/dist/esm/components/table/Table.test.js +3 -6
- package/dist/esm/components/table/Table.test.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js +3 -3
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js +7 -7
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js +6 -6
- package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.stories.js +4 -4
- package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.stories.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js +3 -3
- package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js +5 -4
- package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/TableCell.js +5 -2
- package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/TableCell.test.js +3 -5
- package/dist/esm/components/table/components/TableCell/TableCell.test.js.map +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.js +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.test.js +5 -5
- package/dist/esm/components/table/components/TableContents/TableContents.test.js.map +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.js +7 -75
- package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.test.js +3 -3
- package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +5 -5
- package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +7 -7
- package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +3 -3
- package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts +4 -4
- package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +4 -3
- package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +5 -4
- package/dist/esm/lib/components/table/types.d.ts +12 -4
- package/package.json +1 -1
- package/src/lib/components/table/Table.stories.tsx +61 -35
- package/src/lib/components/table/Table.test.tsx +2 -5
- package/src/lib/components/table/Table.tsx +7 -14
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.tsx +11 -11
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx +17 -19
- package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.module.scss +2 -2
- package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.tsx +13 -13
- package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.tsx +8 -8
- package/src/lib/components/table/components/TableCell/CTACell/CTACell.stories.tsx +9 -6
- package/src/lib/components/table/components/TableCell/CTACell/CTACell.tsx +9 -7
- package/src/lib/components/table/components/TableCell/TableCell.test.tsx +8 -7
- package/src/lib/components/table/components/TableCell/TableCell.tsx +5 -1
- package/src/lib/components/table/components/TableContents/TableContents.test.tsx +4 -4
- package/src/lib/components/table/components/TableSection/TableSection.test.tsx +2 -2
- package/src/lib/components/table/components/TableSection/TableSection.tsx +64 -65
- package/src/lib/components/table/types.ts +11 -4
|
@@ -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';\nimport { TableSectionData } from './types';\n\nconst tableData: TableSectionData[] = [\n {\n section: {\n title: 'Section 1',\n icon: <span>Icon 1</span>,\n },\n rows: [[{
|
|
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: [[{ text: 'Item 1' }, { text: 'Item 2' }]],\n },\n {\n section: {\n title: 'Section 2',\n icon: <span>Icon 2</span>,\n },\n rows: [\n [{ text: 'Item 3' }, { text: 'Item 4', modalContent: 'Additional item' }],\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.getByTestId('ds-table-info-button'));\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,C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IAAC,KAAK,IAAC,SAAS,EAAE,SAAS,EAAE,WAAW,QAAC,KAAK,EAAC,YAAY,GAAG,CAC/D,KAFW,CAEV;oBAEF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;oBAEvD,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,EAAA;;oBAAzD,SAAyD,CAAC;oBAE1D,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;oBACpD,MAAM,CAAC,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,WAAW,CAAC,sBAAsB,CAAC,CAAC,EAAA;;oBAA5D,SAA4D,CAAC;oBAE7D,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;;;;SAC3D,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -32,7 +32,7 @@ var progressLookup = {
|
|
|
32
32
|
'100%': 5,
|
|
33
33
|
};
|
|
34
34
|
var BaseCell = function (_a) {
|
|
35
|
-
var _b = _a.align, align = _b === void 0 ? 'center' : _b, checkmarkValue = _a.checkmarkValue, _c = _a.
|
|
35
|
+
var _b = _a.align, align = _b === void 0 ? 'center' : _b, checkmarkValue = _a.checkmarkValue, _c = _a.fontVariant, fontVariant = _c === void 0 ? 'NORMAL' : _c, _d = _a.description, description = _d === void 0 ? '' : _d, _e = _a.modalContent, modalContent = _e === void 0 ? '' : _e, openModal = _a.openModal, rating = _a.rating, _f = _a.text, text = _f === void 0 ? '' : _f;
|
|
36
36
|
var alignClassName = {
|
|
37
37
|
center: 'ta-center jc-center ai-center',
|
|
38
38
|
left: 'ta-left jc-start',
|
|
@@ -40,10 +40,10 @@ var BaseCell = function (_a) {
|
|
|
40
40
|
}[align];
|
|
41
41
|
var validRatingValues = [1, 2, 3];
|
|
42
42
|
var SelectedIcon = (rating === null || rating === void 0 ? void 0 : rating.type) === 'zap' ? ZapFilledIcon : StarFilledIcon;
|
|
43
|
-
var progressBarValue = typeof
|
|
43
|
+
var progressBarValue = typeof text === 'string' ? progressLookup[text] : undefined;
|
|
44
44
|
return (jsxs("div", { className: classNames('d-flex gap8 ai-center', {
|
|
45
45
|
'jc-center': align === 'center',
|
|
46
|
-
}), children: [jsxs("div", { className: classNames('d-flex fd-column', alignClassName), children: [progressBarValue !== undefined && (jsx(MiniProgressBar, { nFilledBars: progressBarValue })), (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)); }) })), jsxs("div", { className: "d-flex ai-center", children: [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" })) })),
|
|
46
|
+
}), children: [jsxs("div", { className: classNames('d-flex fd-column', alignClassName), children: [progressBarValue !== undefined && (jsx(MiniProgressBar, { nFilledBars: progressBarValue })), (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)); }) })), jsxs("div", { className: "d-flex ai-center", children: [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" })) })), text && fontVariant === 'NORMAL' && (jsx("div", { className: "p-p", "data-testid": "table-cell-text", children: text })), text && fontVariant === 'PRICE' && (jsx("div", { className: "p-h1 p--serif tc-primary-500", "data-testid": "table-cell-content", children: text })), text && fontVariant === 'BIG_WITH_UNDERLINE' && (jsx("div", { "aria-hidden": true, className: classNames('tc-grey-800 p-h2 p--serif', styles.bigWithUnderline), children: text }))] }), description && (jsx("div", { className: classNames('d-flex p-p--small tc-grey-500', alignClassName), children: description }))] }), modalContent && openModal && (jsx(TableInfoButton, { onClick: function () { return openModal(modalContent); } }))] }));
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
export { BaseCell };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {
|
|
1
|
+
{"version":3,"file":"BaseCell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CheckIcon,\n XIcon,\n StarFilledIcon,\n ZapFilledIcon,\n} from '../../../../icon';\nimport { ReactNode } from 'react';\nimport styles from './BaseCell.module.scss';\nimport { MiniProgressBar } from './MiniProgressBar/MiniProgressBar';\nimport { TableInfoButton } from '../../../../comparisonTable';\n\nexport type FontVariant = 'NORMAL' | 'BIG_WITH_UNDERLINE' | 'PRICE';\n\nconst progressLookup: Record<string, number> = {\n '30%': 1,\n '50%': 2,\n '70%': 3,\n '75%': 4,\n '80%': 4,\n '90%': 4,\n '75%-90%': 4,\n '75%-100%': 4,\n '80%-100%': 4,\n '100%': 5,\n};\n\nexport type Alignment = 'center' | 'left' | 'right';\n\nexport type BaseCellProps = {\n align?: Alignment;\n checkmarkValue?: boolean;\n fontVariant?: FontVariant;\n description?: ReactNode;\n modalContent?: ReactNode;\n openModal?: (modalContent: ReactNode) => void;\n text?: ReactNode;\n rating?: {\n value: number;\n type: 'zap' | 'star';\n };\n};\n\nexport const BaseCell = ({\n align = 'center',\n checkmarkValue,\n fontVariant = 'NORMAL',\n description = '',\n modalContent = '',\n openModal,\n rating,\n text = '',\n}: BaseCellProps) => {\n const alignClassName = {\n center: 'ta-center jc-center ai-center',\n left: 'ta-left jc-start',\n right: 'ta-right jc-end ai-end',\n }[align];\n\n const validRatingValues: number[] = [1, 2, 3];\n const SelectedIcon = rating?.type === 'zap' ? ZapFilledIcon : StarFilledIcon;\n\n const progressBarValue =\n typeof text === 'string' ? progressLookup[text] : undefined;\n\n return (\n <div\n className={classNames('d-flex gap8 ai-center', {\n 'jc-center': align === 'center',\n })}\n >\n <div className={classNames('d-flex fd-column', alignClassName)}>\n {progressBarValue !== undefined && (\n <MiniProgressBar nFilledBars={progressBarValue} />\n )}\n\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 <div className=\"d-flex ai-center\">\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 {text && fontVariant === 'NORMAL' && (\n <div className=\"p-p\" data-testid=\"table-cell-text\">\n {text}\n </div>\n )}\n\n {text && fontVariant === 'PRICE' && (\n <div\n className=\"p-h1 p--serif tc-primary-500\"\n data-testid=\"table-cell-content\"\n >\n {text}\n </div>\n )}\n\n {text && fontVariant === 'BIG_WITH_UNDERLINE' && (\n <div\n aria-hidden\n className={classNames(\n 'tc-grey-800 p-h2 p--serif',\n styles.bigWithUnderline\n )}\n >\n {text}\n </div>\n )}\n </div>\n\n {description && (\n <div\n className={classNames(\n 'd-flex p-p--small tc-grey-500',\n alignClassName\n )}\n >\n {description}\n </div>\n )}\n </div>\n {modalContent && openModal && (\n <TableInfoButton onClick={() => openModal(modalContent)} />\n )}\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAcA,IAAM,cAAc,GAA2B;IAC7C,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC;CACV,CAAC;IAkBW,QAAQ,GAAG,UAAC,EAST;QARd,aAAgB,EAAhB,KAAK,mBAAG,QAAQ,KAAA,EAChB,cAAc,oBAAA,EACd,mBAAsB,EAAtB,WAAW,mBAAG,QAAQ,KAAA,EACtB,mBAAgB,EAAhB,WAAW,mBAAG,EAAE,KAAA,EAChB,oBAAiB,EAAjB,YAAY,mBAAG,EAAE,KAAA,EACjB,SAAS,eAAA,EACT,MAAM,YAAA,EACN,YAAS,EAAT,IAAI,mBAAG,EAAE,KAAA;IAET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AAS,mBACI,wBAAwB,EACpC,IAAI,EAAE,EAAE,uBAER,KAAK,EAAC,aAAa,GACnB,KAEFA,IAAC,KAAK,mBACQ,uBAAuB,EACnC,IAAI,EAAE,EAAE,uBAER,KAAK,EAAC,UAAU,GAChB,CACH,GACI,CACR,EAEA,IAAI,IAAI,WAAW,KAAK,QAAQ,KAC/BA,aAAK,SAAS,EAAC,KAAK,iBAAa,iBAAiB,YAC/C,IAAI,GACD,CACP,EAEA,IAAI,IAAI,WAAW,KAAK,OAAO,KAC9BA,aACE,SAAS,EAAC,8BAA8B,iBAC5B,oBAAoB,YAE/B,IAAI,GACD,CACP,EAEA,IAAI,IAAI,WAAW,KAAK,oBAAoB,KAC3CA,kCAEE,SAAS,EAAE,UAAU,CACnB,2BAA2B,EAC3B,MAAM,CAAC,gBAAgB,CACxB,YAEA,IAAI,GACD,CACP,IACG,EAEL,WAAW,KACVA,aACE,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,cAAc,CACf,YAEA,WAAW,GACR,CACP,IACG,EACL,YAAY,IAAI,SAAS,KACxBA,IAAC,eAAe,IAAC,OAAO,EAAE,cAAM,OAAA,SAAS,CAAC,YAAY,CAAC,GAAA,GAAI,CAC5D,IACG,EACN;AACJ;;;;"}
|
|
@@ -21,20 +21,20 @@ var story = {
|
|
|
21
21
|
component: BaseCell,
|
|
22
22
|
argTypes: {},
|
|
23
23
|
args: {
|
|
24
|
+
text: 'For dogs',
|
|
25
|
+
description: 'Annual only',
|
|
26
|
+
modalContent: 'More info',
|
|
27
|
+
fontVariant: 'NORMAL',
|
|
28
|
+
checkmarkValue: undefined,
|
|
24
29
|
rating: {
|
|
25
30
|
value: 2,
|
|
26
31
|
type: 'zap',
|
|
27
32
|
},
|
|
28
|
-
content: 'For dogs',
|
|
29
|
-
subContent: 'Annual only',
|
|
30
|
-
modalContent: 'More info',
|
|
31
|
-
checkmarkValue: undefined,
|
|
32
|
-
contentFontVariant: 'NORMAL',
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
35
|
var BaseCellStory = function (_a) {
|
|
36
|
-
var
|
|
37
|
-
return (jsx("div", { className: "p48 d-flex fd-column gap16 bg-white", children: jsx(BaseCell, { align: align, checkmarkValue: checkmarkValue,
|
|
36
|
+
var text = _a.text, description = _a.description, modalContent = _a.modalContent, checkmarkValue = _a.checkmarkValue, rating = _a.rating, fontVariant = _a.fontVariant, align = _a.align;
|
|
37
|
+
return (jsx("div", { className: "p48 d-flex fd-column gap16 bg-white", children: jsx(BaseCell, { align: align, checkmarkValue: checkmarkValue, fontVariant: fontVariant, description: description, modalContent: modalContent, openModal: function () { }, rating: rating, text: text }) }));
|
|
38
38
|
};
|
|
39
39
|
BaseCellStory.storyName = 'BaseCell';
|
|
40
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCell.stories.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.tsx"],"sourcesContent":["import { BaseCell } from './BaseCell';\n\nconst story = {\n title: 'JSX/Table/Cells',\n component: BaseCell,\n argTypes: {},\n args: {\n
|
|
1
|
+
{"version":3,"file":"BaseCell.stories.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.tsx"],"sourcesContent":["import { BaseCell } from './BaseCell';\n\nconst story = {\n title: 'JSX/Table/Cells',\n component: BaseCell,\n argTypes: {},\n args: {\n text: 'For dogs',\n description: 'Annual only',\n modalContent: 'More info',\n fontVariant: 'NORMAL',\n checkmarkValue: undefined,\n rating: {\n value: 2,\n type: 'zap',\n },\n },\n};\n\nexport const BaseCellStory = ({\n text,\n description,\n modalContent,\n checkmarkValue,\n rating,\n fontVariant,\n align,\n}: React.ComponentProps<typeof BaseCell>) => (\n <div className=\"p48 d-flex fd-column gap16 bg-white\">\n <BaseCell\n align={align}\n checkmarkValue={checkmarkValue}\n fontVariant={fontVariant}\n description={description}\n modalContent={modalContent}\n openModal={() => {}}\n rating={rating}\n text={text}\n />\n </div>\n);\n\nBaseCellStory.storyName = 'BaseCell';\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;IAEM,KAAK,GAAG;IACZ,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,WAAW;QACzB,WAAW,EAAE,QAAQ;QACrB,cAAc,EAAE,SAAS;QACzB,MAAM,EAAE;YACN,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,KAAK;SACZ;KACF;EACD;IAEW,aAAa,GAAG,UAAC,EAQU;QAPtC,IAAI,UAAA,EACJ,WAAW,iBAAA,EACX,YAAY,kBAAA,EACZ,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,WAAW,iBAAA,EACX,KAAK,WAAA;IACsC,QAC3CA,aAAK,SAAS,EAAC,qCAAqC,YAClDA,IAAC,QAAQ,IACP,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,eAAQ,EACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,GACV,GACE;AAZqC,EAa3C;AAEF,aAAa,CAAC,SAAS,GAAG,UAAU;;;;;"}
|
|
@@ -5,18 +5,18 @@ import { Button } from '../../../../button/index.js';
|
|
|
5
5
|
import '../../../../../tslib.es6-a39f91fc.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
|
|
8
|
-
var css_248z = ".ButtonCell-module_buttonCell__x4NNi {\n color: #26262e;\n border: 1px solid #d2d2d8;\n transition: all 0.3s ease-in-out;\n}\n@media (max-width: 34rem) {\n .ButtonCell-module_buttonCell__x4NNi {\n max-width: calc(100% - 96px);\n }\n}\n.ButtonCell-module_buttonCell__x4NNi:disabled {\n border: none;\n background-color: #f5f6fb;\n color: #26262e;\n opacity: 1;\n cursor: default;\n}\n.ButtonCell-module_buttonCell__x4NNi:disabled:hover {\n background-color: #f5f6fb;\n}\n@media (max-width: 34rem) {\n .ButtonCell-module_buttonCell__x4NNi {\n pointer-events: none;\n }\n}\n\n.ButtonCell-
|
|
9
|
-
var styles = {"buttonCell":"ButtonCell-module_buttonCell__x4NNi","
|
|
8
|
+
var css_248z = ".ButtonCell-module_buttonCell__x4NNi {\n color: #26262e;\n border: 1px solid #d2d2d8;\n transition: all 0.3s ease-in-out;\n}\n@media (max-width: 34rem) {\n .ButtonCell-module_buttonCell__x4NNi {\n max-width: calc(100% - 96px);\n }\n}\n.ButtonCell-module_buttonCell__x4NNi:disabled {\n border: none;\n background-color: #f5f6fb;\n color: #26262e;\n opacity: 1;\n cursor: default;\n}\n.ButtonCell-module_buttonCell__x4NNi:disabled:hover {\n background-color: #f5f6fb;\n}\n@media (max-width: 34rem) {\n .ButtonCell-module_buttonCell__x4NNi {\n pointer-events: none;\n }\n}\n\n.ButtonCell-module_withoutPrice__2rpe9 {\n height: 64px;\n}\n\n.ButtonCell-module_withPrice__3bd_t {\n height: 75px;\n}\n\n.ButtonCell-module_selected__22pF_ {\n transition: all 0.3 ease-in-out;\n border: 2px solid #8e8cee;\n background-color: #f7f7ff;\n}";
|
|
9
|
+
var styles = {"buttonCell":"ButtonCell-module_buttonCell__x4NNi","withoutPrice":"ButtonCell-module_withoutPrice__2rpe9","withPrice":"ButtonCell-module_withPrice__3bd_t","selected":"ButtonCell-module_selected__22pF_"};
|
|
10
10
|
styleInject(css_248z);
|
|
11
11
|
|
|
12
12
|
var ButtonCell = function (_a) {
|
|
13
13
|
var _b;
|
|
14
|
-
var isSelected = _a.isSelected, onClick = _a.onClick,
|
|
14
|
+
var isSelected = _a.isSelected, onClick = _a.onClick, buttonCaption = _a.buttonCaption, price = _a.price, disabled = _a.disabled;
|
|
15
15
|
return (jsx("div", { className: "w100 d-flex fd-column ai-center jc-center gap8", children: jsxs(Button, { className: classNames('w100 wmx5 d-flex fd-column', styles.buttonCell, (_b = {},
|
|
16
16
|
_b[styles.selected] = isSelected,
|
|
17
|
-
_b[styles.
|
|
18
|
-
_b[styles.
|
|
19
|
-
_b)), variant: "filledWhite", type: "submit", onClick: onClick, disabled: disabled, children: [
|
|
17
|
+
_b[styles.withoutPrice] = !price,
|
|
18
|
+
_b[styles.withPrice] = !!price,
|
|
19
|
+
_b)), variant: "filledWhite", type: "submit", onClick: onClick, disabled: disabled, children: [buttonCaption, price && jsx("span", { className: "p-p tc-purple-500", children: price })] }) }));
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export { ButtonCell };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonCell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './ButtonCell.module.scss';\nimport { Button } from '../../../../button';\nimport { ReactNode } from 'react';\n\nexport type ButtonCellProps = {\n
|
|
1
|
+
{"version":3,"file":"ButtonCell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './ButtonCell.module.scss';\nimport { Button } from '../../../../button';\nimport { ReactNode } from 'react';\n\nexport type ButtonCellProps = {\n buttonCaption: ReactNode;\n disabled?: boolean;\n isSelected?: boolean;\n onClick: () => void;\n price?: ReactNode;\n};\n\nexport const ButtonCell = ({\n isSelected,\n onClick,\n buttonCaption,\n price,\n disabled,\n}: ButtonCellProps) => {\n return (\n <div className=\"w100 d-flex fd-column ai-center jc-center gap8\">\n <Button\n className={classNames('w100 wmx5 d-flex fd-column', styles.buttonCell, {\n [styles.selected]: isSelected,\n [styles.withoutPrice]: !price,\n [styles.withPrice]: !!price,\n })}\n variant=\"filledWhite\"\n type=\"submit\"\n onClick={onClick}\n disabled={disabled}\n >\n {buttonCaption}\n {price && <span className=\"p-p tc-purple-500\">{price}</span>}\n </Button>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;IAca,UAAU,GAAG,UAAC,EAMT;;QALhB,UAAU,gBAAA,EACV,OAAO,aAAA,EACP,aAAa,mBAAA,EACb,KAAK,WAAA,EACL,QAAQ,cAAA;IAER,QACEA,aAAK,SAAS,EAAC,gDAAgD,YAC7DC,KAAC,MAAM,IACL,SAAS,EAAE,UAAU,CAAC,4BAA4B,EAAE,MAAM,CAAC,UAAU;gBACnE,GAAC,MAAM,CAAC,QAAQ,IAAG,UAAU;gBAC7B,GAAC,MAAM,CAAC,YAAY,IAAG,CAAC,KAAK;gBAC7B,GAAC,MAAM,CAAC,SAAS,IAAG,CAAC,CAAC,KAAK;oBAC3B,EACF,OAAO,EAAC,aAAa,EACrB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,aAEjB,aAAa,EACb,KAAK,IAAID,cAAM,SAAS,EAAC,mBAAmB,YAAE,KAAK,GAAQ,IACrD,GACL,EACN;AACJ;;;;"}
|
|
@@ -11,15 +11,15 @@ var story = {
|
|
|
11
11
|
component: ButtonCell,
|
|
12
12
|
argTypes: {},
|
|
13
13
|
args: {
|
|
14
|
+
buttonCaption: 'Premium',
|
|
15
|
+
price: '€277/mo',
|
|
14
16
|
isSelected: false,
|
|
15
|
-
content: 'Premium',
|
|
16
|
-
subContent: '€277/mo',
|
|
17
17
|
disabled: false,
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
var ButtonCellStory = function (_a) {
|
|
21
|
-
var isSelected = _a.isSelected,
|
|
22
|
-
return (jsxs("div", { className: "p48 d-flex fd-column gap16 bg-white", children: [jsx(ButtonCell, {
|
|
21
|
+
var isSelected = _a.isSelected, buttonCaption = _a.buttonCaption, price = _a.price, disabled = _a.disabled;
|
|
22
|
+
return (jsxs("div", { className: "p48 d-flex fd-column gap16 bg-white", children: [jsx(ButtonCell, { buttonCaption: buttonCaption, price: price, isSelected: isSelected, disabled: disabled, onClick: function () { } }), jsx(ButtonCell, { buttonCaption: buttonCaption, price: price, isSelected: true, disabled: disabled, onClick: function () { } }), jsx(ButtonCell, { buttonCaption: buttonCaption, price: price, disabled: true, onClick: function () { } }), jsx(ButtonCell, { buttonCaption: buttonCaption, isSelected: isSelected, disabled: disabled, onClick: function () { } }), jsx(ButtonCell, { buttonCaption: buttonCaption, isSelected: true, disabled: disabled, onClick: function () { } }), jsx(ButtonCell, { buttonCaption: buttonCaption, disabled: true, onClick: function () { } })] }));
|
|
23
23
|
};
|
|
24
24
|
ButtonCellStory.storyName = 'ButtonCell';
|
|
25
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonCell.stories.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.tsx"],"sourcesContent":["import { ButtonCell } from './ButtonCell';\n\nconst story = {\n title: 'JSX/Table/Cells',\n component: ButtonCell,\n argTypes: {},\n args: {\n
|
|
1
|
+
{"version":3,"file":"ButtonCell.stories.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.tsx"],"sourcesContent":["import { ButtonCell } from './ButtonCell';\n\nconst story = {\n title: 'JSX/Table/Cells',\n component: ButtonCell,\n argTypes: {},\n args: {\n buttonCaption: 'Premium',\n price: '€277/mo',\n isSelected: false,\n disabled: false,\n },\n};\n\nexport const ButtonCellStory = ({\n isSelected,\n buttonCaption,\n price,\n disabled,\n}: React.ComponentProps<typeof ButtonCell>) => (\n <div className=\"p48 d-flex fd-column gap16 bg-white\">\n <ButtonCell\n buttonCaption={buttonCaption}\n price={price}\n isSelected={isSelected}\n disabled={disabled}\n onClick={() => {}}\n />\n\n <ButtonCell\n buttonCaption={buttonCaption}\n price={price}\n isSelected\n disabled={disabled}\n onClick={() => {}}\n />\n\n <ButtonCell\n buttonCaption={buttonCaption}\n price={price}\n disabled\n onClick={() => {}}\n />\n\n <ButtonCell\n buttonCaption={buttonCaption}\n isSelected={isSelected}\n disabled={disabled}\n onClick={() => {}}\n />\n\n <ButtonCell\n buttonCaption={buttonCaption}\n isSelected\n disabled={disabled}\n onClick={() => {}}\n />\n\n <ButtonCell buttonCaption={buttonCaption} disabled onClick={() => {}} />\n </div>\n);\n\nButtonCellStory.storyName = 'ButtonCell';\n\nexport default story;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;IAEM,KAAK,GAAG;IACZ,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACJ,aAAa,EAAE,SAAS;QACxB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;KAChB;EACD;IAEW,eAAe,GAAG,UAAC,EAKU;QAJxC,UAAU,gBAAA,EACV,aAAa,mBAAA,EACb,KAAK,WAAA,EACL,QAAQ,cAAA;IACqC,QAC7CA,cAAK,SAAS,EAAC,qCAAqC,aAClDC,IAAC,UAAU,IACT,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,eAAQ,GACjB,EAEFA,IAAC,UAAU,IACT,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,UAAU,QACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,eAAQ,GACjB,EAEFA,IAAC,UAAU,IACT,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,QAAQ,QACR,OAAO,EAAE,eAAQ,GACjB,EAEFA,IAAC,UAAU,IACT,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,eAAQ,GACjB,EAEFA,IAAC,UAAU,IACT,aAAa,EAAE,aAAa,EAC5B,UAAU,QACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,eAAQ,GACjB,EAEFA,IAAC,UAAU,IAAC,aAAa,EAAE,aAAa,EAAE,QAAQ,QAAC,OAAO,EAAE,eAAQ,GAAI,IACpE;AAxCuC,EAyC7C;AAEF,eAAe,CAAC,SAAS,GAAG,YAAY;;;;;"}
|
|
@@ -8,13 +8,13 @@ styleInject(css_248z);
|
|
|
8
8
|
|
|
9
9
|
var CTACell = function (_a) {
|
|
10
10
|
var _b;
|
|
11
|
-
var
|
|
12
|
-
return (jsxs("div", { className: "wmn3 ta-center", children: [jsxs("p", { className: "p-h3", children: [
|
|
11
|
+
var title = _a.title, price = _a.price, grey = _a.grey, narrow = _a.narrow, href = _a.href, buttonCaption = _a.buttonCaption;
|
|
12
|
+
return (jsxs("div", { className: "wmn3 ta-center", children: [jsxs("p", { className: "p-h3", children: [title, price && jsxs("span", { className: "tc-purple-500", children: [" ", price] })] }), jsx("a", { className: classNames('mt16', (_b = {
|
|
13
13
|
'p-btn--primary': !grey,
|
|
14
14
|
'p-btn--secondary-grey': grey
|
|
15
15
|
},
|
|
16
16
|
_b[styles.narrow] = narrow,
|
|
17
|
-
_b)), href: href, target: "_blank", rel: "noopener noreferrer", children:
|
|
17
|
+
_b)), href: href, target: "_blank", rel: "noopener noreferrer", children: buttonCaption })] }));
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export { CTACell };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CTACell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/CTACell/CTACell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ReactNode } from 'react';\n\nexport type CTACellProps = {\n
|
|
1
|
+
{"version":3,"file":"CTACell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/CTACell/CTACell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ReactNode } from 'react';\n\nexport type CTACellProps = {\n title: ReactNode;\n price?: ReactNode;\n buttonCaption?: ReactNode;\n grey?: boolean;\n narrow?: boolean;\n href: string;\n};\nimport styles from './CTACell.module.scss';\n\nexport const CTACell = ({\n title,\n price,\n grey,\n narrow,\n href,\n buttonCaption,\n}: CTACellProps) => {\n return (\n <div className=\"wmn3 ta-center\">\n <p className=\"p-h3\">\n {title}\n {price && <span className=\"tc-purple-500\"> {price}</span>}\n </p>\n <a\n className={classNames('mt16', {\n 'p-btn--primary': !grey,\n 'p-btn--secondary-grey': grey,\n [styles.narrow]: narrow,\n })}\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {buttonCaption}\n </a>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;IAaa,OAAO,GAAG,UAAC,EAOT;;QANb,KAAK,WAAA,EACL,KAAK,WAAA,EACL,IAAI,UAAA,EACJ,MAAM,YAAA,EACN,IAAI,UAAA,EACJ,aAAa,mBAAA;IAEb,QACEA,cAAK,SAAS,EAAC,gBAAgB,aAC7BA,YAAG,SAAS,EAAC,MAAM,aAChB,KAAK,EACL,KAAK,IAAIA,eAAM,SAAS,EAAC,eAAe,kBAAG,KAAK,IAAQ,IACvD,EACJC,WACE,SAAS,EAAE,UAAU,CAAC,MAAM;wBAC1B,gBAAgB,EAAE,CAAC,IAAI;wBACvB,uBAAuB,EAAE,IAAI;;oBAC7B,GAAC,MAAM,CAAC,MAAM,IAAG,MAAM;wBACvB,EACF,IAAI,EAAE,IAAI,EACV,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,YAExB,aAAa,GACZ,IACA,EACN;AACJ;;;;"}
|
|
@@ -8,15 +8,16 @@ var story = {
|
|
|
8
8
|
component: CTACell,
|
|
9
9
|
argTypes: {},
|
|
10
10
|
args: {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
title: 'Premium',
|
|
12
|
+
price: '€277',
|
|
13
|
+
buttonCaption: 'Get covered',
|
|
13
14
|
grey: false,
|
|
14
15
|
narrow: false,
|
|
15
16
|
},
|
|
16
17
|
};
|
|
17
18
|
var CTACellStory = function (_a) {
|
|
18
|
-
var
|
|
19
|
-
return (jsx("div", { className: "p48 d-flex fd-column gap16 bg-white", children: jsx(CTACell, {
|
|
19
|
+
var title = _a.title, price = _a.price, buttonCaption = _a.buttonCaption, grey = _a.grey, narrow = _a.narrow;
|
|
20
|
+
return (jsx("div", { className: "p48 d-flex fd-column gap16 bg-white", children: jsx(CTACell, { title: title, price: price, buttonCaption: buttonCaption, href: "", grey: grey, narrow: narrow }) }));
|
|
20
21
|
};
|
|
21
22
|
CTACellStory.storyName = 'CTACell';
|
|
22
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CTACell.stories.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/CTACell/CTACell.stories.tsx"],"sourcesContent":["import { CTACell } from './CTACell';\n\nconst story = {\n title: 'JSX/Table/Cells',\n component: CTACell,\n argTypes: {},\n args: {\n
|
|
1
|
+
{"version":3,"file":"CTACell.stories.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/CTACell/CTACell.stories.tsx"],"sourcesContent":["import { CTACell } from './CTACell';\n\nconst story = {\n title: 'JSX/Table/Cells',\n component: CTACell,\n argTypes: {},\n args: {\n title: 'Premium',\n price: '€277',\n buttonCaption: 'Get covered',\n grey: false,\n narrow: false,\n },\n};\n\nexport const CTACellStory = ({\n title,\n price,\n buttonCaption,\n grey,\n narrow,\n}: React.ComponentProps<typeof CTACell>) => (\n <div className=\"p48 d-flex fd-column gap16 bg-white\">\n <CTACell\n title={title}\n price={price}\n buttonCaption={buttonCaption}\n href=\"\"\n grey={grey}\n narrow={narrow}\n />\n </div>\n);\n\nCTACellStory.storyName = 'CTACell';\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;IAEM,KAAK,GAAG;IACZ,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACJ,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,MAAM;QACb,aAAa,EAAE,aAAa;QAC5B,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;KACd;EACD;IAEW,YAAY,GAAG,UAAC,EAMU;QALrC,KAAK,WAAA,EACL,KAAK,WAAA,EACL,aAAa,mBAAA,EACb,IAAI,UAAA,EACJ,MAAM,YAAA;IACoC,QAC1CA,aAAK,SAAS,EAAC,qCAAqC,YAClDA,IAAC,OAAO,IACN,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAC,EAAE,EACP,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACd,GACE;AAVoC,EAW1C;AAEF,YAAY,CAAC,SAAS,GAAG,SAAS;;;;;"}
|
|
@@ -25,7 +25,8 @@ styleInject(css_248z);
|
|
|
25
25
|
|
|
26
26
|
var TableCell = function (_a) {
|
|
27
27
|
var _b;
|
|
28
|
-
var _c
|
|
28
|
+
var _c;
|
|
29
|
+
var _d = _a.isFirstCellInRow, isFirstCellInRow = _d === void 0 ? false : _d, _e = _a.isHeader, isHeader = _e === void 0 ? false : _e, _f = _a.isNavigation, isNavigation = _f === void 0 ? false : _f, _g = _a.isTopLeftCell, isTopLeftCell = _g === void 0 ? false : _g, cellProps = __rest(_a, ["isFirstCellInRow", "isHeader", "isNavigation", "isTopLeftCell"]);
|
|
29
30
|
// prettier-ignore
|
|
30
31
|
var Tag = isNavigation
|
|
31
32
|
? 'div'
|
|
@@ -42,7 +43,9 @@ var TableCell = function (_a) {
|
|
|
42
43
|
},
|
|
43
44
|
_b[styles.fixedCell] = isFirstCellInRow,
|
|
44
45
|
_b.pl32 = isFirstCellInRow,
|
|
45
|
-
_b)), children: [!cellProps.type && (jsx(BaseCell, __assign({}, cellProps, {
|
|
46
|
+
_b)), children: [!cellProps.type && (jsx(BaseCell, __assign({}, cellProps, { fontVariant: isTopLeftCell
|
|
47
|
+
? 'BIG_WITH_UNDERLINE'
|
|
48
|
+
: (_c = cellProps.fontVariant) !== null && _c !== void 0 ? _c : 'NORMAL' }))), cellProps.type === 'CTA' && jsx(CTACell, __assign({}, cellProps)), cellProps.type === 'BUTTON' && jsx(ButtonCell, __assign({}, cellProps))] })));
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
export { TableCell };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.js","sources":["../../../../../../../src/lib/components/table/components/TableCell/TableCell.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './TableCell.module.scss';\nimport { BaseCell, BaseCellProps } from './BaseCell/BaseCell';\nimport { TableCellData } from '../../types';\nimport { CTACell } from './CTACell/CTACell';\nimport { ButtonCell } from './ButtonCell/ButtonCell';\n\ntype PositionalTableCellProps = {\n isHeader?: boolean;\n isFirstCellInRow?: boolean;\n isTopLeftCell?: boolean;\n isNavigation?: boolean;\n};\n\nexport type TableCellProps = TableCellData & PositionalTableCellProps;\n\nconst TableCell = ({\n isFirstCellInRow = false,\n isHeader = false,\n isNavigation = false,\n isTopLeftCell = false,\n ...cellProps\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 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 {!cellProps.type && (\n <BaseCell\n {...cellProps}\n
|
|
1
|
+
{"version":3,"file":"TableCell.js","sources":["../../../../../../../src/lib/components/table/components/TableCell/TableCell.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './TableCell.module.scss';\nimport { BaseCell, BaseCellProps } from './BaseCell/BaseCell';\nimport { TableCellData } from '../../types';\nimport { CTACell } from './CTACell/CTACell';\nimport { ButtonCell } from './ButtonCell/ButtonCell';\n\ntype PositionalTableCellProps = {\n isHeader?: boolean;\n isFirstCellInRow?: boolean;\n isTopLeftCell?: boolean;\n isNavigation?: boolean;\n};\n\nexport type TableCellProps = TableCellData & PositionalTableCellProps;\n\nconst TableCell = ({\n isFirstCellInRow = false,\n isHeader = false,\n isNavigation = false,\n isTopLeftCell = false,\n ...cellProps\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 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 {!cellProps.type && (\n <BaseCell\n {...cellProps}\n fontVariant={\n isTopLeftCell\n ? 'BIG_WITH_UNDERLINE'\n : cellProps.fontVariant ?? 'NORMAL'\n }\n />\n )}\n {cellProps.type === 'CTA' && <CTACell {...cellProps} />}\n {cellProps.type === 'BUTTON' && <ButtonCell {...cellProps} />}\n </Tag>\n );\n};\n\nexport { TableCell };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;IAiBM,SAAS,GAAG,UAAC,EAMF;;;IALf,IAAA,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,EAClB,SAAS,cALK,iEAMlB,CADa;;IAGZ,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,QACEA,KAAC,GAAG,eACE,KAAK,IACT,SAAS,EAAE,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,EAAE;gBAClD,SAAS,EAAE,gBAAgB;;YAC3B,GAAC,MAAM,CAAC,SAAS,IAAG,gBAAgB;YACpC,OAAI,GAAE,gBAAgB;gBACtB,aAED,CAAC,SAAS,CAAC,IAAI,KACdC,IAAC,QAAQ,eACH,SAAS,IACb,WAAW,EACT,aAAa;sBACT,oBAAoB;sBACpB,MAAA,SAAS,CAAC,WAAW,mCAAI,QAAQ,IAEvC,CACH,EACA,SAAS,CAAC,IAAI,KAAK,KAAK,IAAIA,IAAC,OAAO,eAAK,SAAS,EAAI,EACtD,SAAS,CAAC,IAAI,KAAK,QAAQ,IAAIA,IAAC,UAAU,eAAK,SAAS,EAAI,KACzD,EACN;AACJ;;;;"}
|
|
@@ -27,9 +27,7 @@ var openModal = jest.fn();
|
|
|
27
27
|
var setup = function (_a) {
|
|
28
28
|
if (_a === void 0) { _a = {}; }
|
|
29
29
|
var isNavigation = _a.isNavigation, rest = __rest(_a, ["isNavigation"]);
|
|
30
|
-
return customRender(isNavigation
|
|
31
|
-
? jsx(TableCell, __assign({}, rest, { isNavigation: true }))
|
|
32
|
-
: (jsx("table", { children: jsx("tbody", { children: jsx("tr", { children: jsx(TableCell, __assign({}, rest)) }) }) })));
|
|
30
|
+
return customRender(isNavigation ? (jsx(TableCell, __assign({}, rest, { isNavigation: true }))) : (jsx("table", { children: jsx("tbody", { children: jsx("tr", { children: jsx(TableCell, __assign({}, rest)) }) }) })));
|
|
33
31
|
};
|
|
34
32
|
describe('TableCell', function () {
|
|
35
33
|
it('renders the component with boolean true', function () {
|
|
@@ -58,7 +56,7 @@ describe('TableCell', function () {
|
|
|
58
56
|
expect(screen.queryByTestId('table-cell-rating')).not.toBeInTheDocument();
|
|
59
57
|
});
|
|
60
58
|
it('renders the component with text', function () {
|
|
61
|
-
setup({
|
|
59
|
+
setup({ text: 'Sample text' });
|
|
62
60
|
expect(screen.getByText('Sample text')).toBeInTheDocument();
|
|
63
61
|
});
|
|
64
62
|
it('renders the component without text', function () {
|
|
@@ -70,7 +68,7 @@ describe('TableCell', function () {
|
|
|
70
68
|
expect(screen.queryByText('View more info')).not.toBeInTheDocument();
|
|
71
69
|
});
|
|
72
70
|
it('calls openModal when info button is clicked', function () {
|
|
73
|
-
setup({ modalContent:
|
|
71
|
+
setup({ modalContent: 'Additional information', openModal: openModal });
|
|
74
72
|
// Click info button
|
|
75
73
|
screen.getByTestId('ds-table-info-button').click();
|
|
76
74
|
// 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, TableCellProps } from './TableCell';\n\nconst openModal = jest.fn();\n\nconst setup = ({ isNavigation, ...rest }: TableCellProps = {})
|
|
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, TableCellProps } from './TableCell';\n\nconst openModal = jest.fn();\n\nconst setup = ({ isNavigation, ...rest }: TableCellProps = {}) =>\n render(\n isNavigation ? (\n <TableCell {...rest} isNavigation />\n ) : (\n <table>\n <tbody>\n <tr>\n <TableCell {...rest} />\n </tr>\n </tbody>\n </table>\n )\n );\n\ndescribe('TableCell', () => {\n it('renders the component with boolean true', () => {\n setup({ 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 setup({ 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 setup();\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 setup({ 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 setup();\n\n expect(screen.queryByTestId('table-cell-rating')).not.toBeInTheDocument();\n });\n\n it('renders the component with text', () => {\n setup({ text: 'Sample text' });\n\n expect(screen.getByText('Sample text')).toBeInTheDocument();\n });\n\n it('renders the component without text', () => {\n setup();\n\n expect(screen.queryByTestId('table-cell-text')).not.toBeInTheDocument();\n });\n\n it('renders the component without info', () => {\n setup();\n\n expect(screen.queryByText('View more info')).not.toBeInTheDocument();\n });\n\n it('calls openModal when info button is clicked', () => {\n setup({ modalContent: 'Additional information', openModal });\n\n // Click info button\n screen.getByTestId('ds-table-info-button').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,IAAM,KAAK,GAAG,UAAC,EAA8C;IAA9C,mBAAA,EAAA,OAA8C;IAA5C,IAAA,YAAY,kBAAA,EAAK,IAAI,cAAvB,gBAAyB,CAAF;IACpC,OAAAA,YAAM,CACJ,YAAY,IACVC,IAAC,SAAS,eAAK,IAAI,IAAE,YAAY,UAAG,KAEpCA,yBACEA,yBACEA,sBACEA,IAAC,SAAS,eAAK,IAAI,EAAI,GACpB,GACC,GACF,CACT,CACF,CAAA;CAAA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|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { TableSection } from '
|
|
4
|
+
import { T as TableSection } from '../../../../TableSection-f6d0028e.js';
|
|
5
5
|
import ChevronDownIcon from '../../../icon/icons/ChevronDown.js';
|
|
6
6
|
import ChevronUpIcon from '../../../icon/icons/ChevronUp.js';
|
|
7
7
|
import { Card } from '../../../cards/card/index.js';
|
|
@@ -6,7 +6,7 @@ import 'react';
|
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../../../_commonjsHelpers-4730bd53.js';
|
|
8
8
|
import 'react-dom/test-utils';
|
|
9
|
-
import '
|
|
9
|
+
import '../../../../TableSection-f6d0028e.js';
|
|
10
10
|
import '../../../../index-6ea95111.js';
|
|
11
11
|
import '../../../../style-inject.es-1f59c1d0.js';
|
|
12
12
|
import '../TableCell/TableCell.js';
|
|
@@ -34,8 +34,8 @@ import '../../../../index-a0ef2ab4.js';
|
|
|
34
34
|
var mockData = [
|
|
35
35
|
{
|
|
36
36
|
rows: [
|
|
37
|
-
[{
|
|
38
|
-
[{
|
|
37
|
+
[{ text: 'Item 1.1.1' }, { text: 'Item 1.1.2' }],
|
|
38
|
+
[{ text: 'Item 1.2.1' }, { text: 'Item 1.2.2' }],
|
|
39
39
|
],
|
|
40
40
|
},
|
|
41
41
|
{
|
|
@@ -43,8 +43,8 @@ var mockData = [
|
|
|
43
43
|
title: 'Section 2',
|
|
44
44
|
},
|
|
45
45
|
rows: [
|
|
46
|
-
[{
|
|
47
|
-
[{
|
|
46
|
+
[{ text: 'Item 2.1.1' }, { text: 'Item 2.1.2' }],
|
|
47
|
+
[{ text: 'Item 2.2.1' }, { text: 'Item 2.2.2' }],
|
|
48
48
|
],
|
|
49
49
|
},
|
|
50
50
|
];
|
|
@@ -1 +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, TableContentsProps } from './TableContents';\n\nconst mockData: TableContentsProps['tableData'] = [\n {\n rows: [\n [{
|
|
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, TableContentsProps } from './TableContents';\n\nconst mockData: TableContentsProps['tableData'] = [\n {\n rows: [\n [{ text: 'Item 1.1.1' }, { text: 'Item 1.1.2' }],\n [{ text: 'Item 1.2.1' }, { text: 'Item 1.2.2' }],\n ],\n },\n {\n section: {\n title: 'Section 2',\n },\n rows: [\n [{ text: 'Item 2.1.1' }, { text: 'Item 2.1.2' }],\n [{ text: 'Item 2.2.1' }, { text: '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,GAAoC;IAChD;QACE,IAAI,EAAE;YACJ,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;YAChD,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;SACjD;KACF;IACD;QACE,OAAO,EAAE;YACP,KAAK,EAAE,WAAW;SACnB;QACD,IAAI,EAAE;YACJ,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;YAChD,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;SACjD;KACF;CACF,CAAC;AAEF,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,0CAA0C,EAAE;QAC7CA,YAAM,CACJC,IAAC,aAAa,IAAC,mBAAmB,QAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAC,OAAO,GAAG,CACzE,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;KAC3D,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE;QAClDD,YAAM,CACJC,IAAC,aAAa,IAAC,mBAAmB,QAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAC,OAAO,GAAG,CACzE,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,SAA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W,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"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import '../../../../tslib.es6-a39f91fc.js';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '../../../../index-6ea95111.js';
|
|
4
|
+
export { T as TableSection } from '../../../../TableSection-f6d0028e.js';
|
|
5
|
+
import '../TableCell/TableCell.js';
|
|
6
|
+
import '../../../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
import '../TableCell/BaseCell/BaseCell.js';
|
|
8
8
|
import '../../../icon/icons/Check.js';
|
|
9
|
+
import 'react';
|
|
9
10
|
import '../../../icon/IconWrapper/IconWrapper.js';
|
|
10
11
|
import '../../../icon/icons/StarFilled.js';
|
|
11
12
|
import '../../../icon/icons/X.js';
|
|
@@ -19,73 +20,4 @@ import '../../../../index-5e72c3d4.js';
|
|
|
19
20
|
import '../TableCell/CTACell/CTACell.js';
|
|
20
21
|
import '../TableCell/ButtonCell/ButtonCell.js';
|
|
21
22
|
import '../../../button/index.js';
|
|
22
|
-
|
|
23
|
-
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}";
|
|
24
|
-
var styles = {"table":"TableSection-module_table__sNbDq","tr":"TableSection-module_tr__UbkbE"};
|
|
25
|
-
styleInject(css_248z);
|
|
26
|
-
|
|
27
|
-
var TableSection = function (_a) {
|
|
28
|
-
var className = _a.className, tableCellRows = _a.tableCellRows, hideHeader = _a.hideHeader, openModal = _a.openModal, title = _a.title, width = _a.width;
|
|
29
|
-
var headerRow = tableCellRows === null || tableCellRows === void 0 ? void 0 : tableCellRows[0];
|
|
30
|
-
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]);
|
|
31
|
-
var handleOpenModal = function (_a) {
|
|
32
|
-
var cellIndex = _a.cellIndex, body = _a.body, title = _a.title;
|
|
33
|
-
return openModal === null || openModal === void 0 ? void 0 : openModal({
|
|
34
|
-
body: body,
|
|
35
|
-
title: title || getColumnContentByKey(cellIndex),
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
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) {
|
|
39
|
-
var isFirstCellInRow = cellIndex === 0;
|
|
40
|
-
var isBaseCell = !tableCellProps.type;
|
|
41
|
-
var openModal;
|
|
42
|
-
var align = 'left';
|
|
43
|
-
if (isBaseCell) {
|
|
44
|
-
openModal = function (body) {
|
|
45
|
-
return handleOpenModal({
|
|
46
|
-
cellIndex: cellIndex,
|
|
47
|
-
body: body,
|
|
48
|
-
title: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.content,
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
align = isFirstCellInRow ? 'left' : 'center';
|
|
52
|
-
}
|
|
53
|
-
return (jsx(TableCell, __assign({ isHeader: true, isFirstCellInRow: isFirstCellInRow, isTopLeftCell: isFirstCellInRow }, tableCellProps, (isBaseCell
|
|
54
|
-
? {
|
|
55
|
-
openModal: openModal,
|
|
56
|
-
align: align,
|
|
57
|
-
}
|
|
58
|
-
: {})), cellIndex));
|
|
59
|
-
}) }) })), jsx("tbody", { children: tableCellRows.map(function (row, rowIndex) {
|
|
60
|
-
row.length === 1;
|
|
61
|
-
return (rowIndex > 0 && (jsx("tr", { className: styles.tr, children: row.map(function (tableCellProps, cellIndex) {
|
|
62
|
-
var key = "".concat(rowIndex, "-").concat(cellIndex);
|
|
63
|
-
var isFirstCellInRow = cellIndex === 0;
|
|
64
|
-
var onCelInfoClick = function (body) {
|
|
65
|
-
return handleOpenModal({
|
|
66
|
-
cellIndex: cellIndex,
|
|
67
|
-
body: body,
|
|
68
|
-
title: isFirstCellInRow
|
|
69
|
-
? tableCellProps.content
|
|
70
|
-
: undefined,
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
var openModal;
|
|
74
|
-
var align = 'left';
|
|
75
|
-
var isBaseCell = !tableCellProps.type;
|
|
76
|
-
if (isBaseCell) {
|
|
77
|
-
openModal = onCelInfoClick;
|
|
78
|
-
align = isFirstCellInRow ? 'left' : 'center';
|
|
79
|
-
}
|
|
80
|
-
return (createElement(TableCell, __assign({}, (isBaseCell
|
|
81
|
-
? {
|
|
82
|
-
openModal: openModal,
|
|
83
|
-
align: align,
|
|
84
|
-
}
|
|
85
|
-
: {}), { isFirstCellInRow: isFirstCellInRow, key: key }, tableCellProps)));
|
|
86
|
-
}) }, rowIndex)));
|
|
87
|
-
}) })] }));
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export { TableSection };
|
|
91
23
|
//# sourceMappingURL=TableSection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSection.js","sources":[
|
|
1
|
+
{"version":3,"file":"TableSection.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|