@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,7 +1,7 @@
|
|
|
1
1
|
import { a as __assign } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { c as customRender, s as screen } from '../../../../customRender-d03c10b6.js';
|
|
4
|
-
import { TableSection } from '
|
|
4
|
+
import { T as TableSection } from '../../../../TableSection-f6d0028e.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../../../_commonjsHelpers-4730bd53.js';
|
|
@@ -25,8 +25,8 @@ import '../TableCell/ButtonCell/ButtonCell.js';
|
|
|
25
25
|
import '../../../button/index.js';
|
|
26
26
|
|
|
27
27
|
var tableCellRows = [
|
|
28
|
-
[{
|
|
29
|
-
[{
|
|
28
|
+
[{ text: 'Cell 1.1' }, { text: 'Cell 1.2' }, { text: 'Cell 1.3' }],
|
|
29
|
+
[{ text: 'Cell 2.1' }, { text: 'Cell 2.2' }, { text: 'Cell 2.3' }],
|
|
30
30
|
];
|
|
31
31
|
var mockTitle = 'Test Table';
|
|
32
32
|
var mockOpenModal = jest.fn();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSection.test.js","sources":["../../../../../../../src/lib/components/table/components/TableSection/TableSection.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableSection, TableSectionProps } from './TableSection';\n\nconst tableCellRows: TableSectionProps['tableCellRows'] = [\n [{
|
|
1
|
+
{"version":3,"file":"TableSection.test.js","sources":["../../../../../../../src/lib/components/table/components/TableSection/TableSection.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableSection, TableSectionProps } from './TableSection';\n\nconst tableCellRows: TableSectionProps['tableCellRows'] = [\n [{ text: 'Cell 1.1' }, { text: 'Cell 1.2' }, { text: 'Cell 1.3' }],\n [{ text: 'Cell 2.1' }, { text: 'Cell 2.2' }, { text: 'Cell 2.3' }],\n];\n\nconst mockTitle = 'Test Table';\n\nconst mockOpenModal = jest.fn();\n\nconst defaultProps: TableSectionProps = {\n tableCellRows,\n title: mockTitle,\n openModal: mockOpenModal,\n};\n\ndescribe('TableSection', () => {\n it('renders the table caption', () => {\n render(<TableSection {...defaultProps} />);\n\n expect(screen.getByText(mockTitle)).toBeInTheDocument();\n });\n\n it('renders the table with correct data', () => {\n render(<TableSection {...defaultProps} />);\n\n expect(screen.getByText('Cell 1.1')).toBeInTheDocument();\n expect(screen.getByText('Cell 1.2')).toBeInTheDocument();\n expect(screen.getByText('Cell 1.3')).toBeInTheDocument();\n\n expect(screen.getByText('Cell 2.1')).toBeInTheDocument();\n expect(screen.getByText('Cell 2.2')).toBeInTheDocument();\n expect(screen.getByText('Cell 2.3')).toBeInTheDocument();\n });\n\n it('should render table headers', () => {\n const { container } = render(<TableSection {...defaultProps} />);\n\n const thElements = container.querySelectorAll('th');\n\n expect(thElements.length).toBe(4);\n expect(thElements[0]).toHaveTextContent('Cell 1.1');\n expect(thElements[3]).toHaveTextContent('Cell 2.1');\n });\n\n it('should render table data cells', () => {\n const { container } = render(<TableSection {...defaultProps} />);\n\n const tdElements = container.querySelectorAll('td');\n expect(tdElements.length).toBe(2);\n expect(tdElements[0]).toHaveTextContent('Cell 2.2');\n expect(t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
import './components/table/components/TableCell/ButtonCell/ButtonCell.js';
|
|
429
429
|
import './Collapsible-a355828b.js';
|
|
430
430
|
import './components/table/components/TableContents/TableContents.js';
|
|
431
|
-
import './
|
|
431
|
+
import './TableSection-f6d0028e.js';
|
|
432
432
|
import './useTableNavigation-2899712c.js';
|
|
433
433
|
import './components/table/components/TableControls/TableControls.js';
|
|
434
434
|
import './useScrollSync-b2d28bed.js';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export type
|
|
2
|
+
export type FontVariant = 'NORMAL' | 'BIG_WITH_UNDERLINE' | 'PRICE';
|
|
3
3
|
export type Alignment = 'center' | 'left' | 'right';
|
|
4
4
|
export type BaseCellProps = {
|
|
5
5
|
align?: Alignment;
|
|
6
6
|
checkmarkValue?: boolean;
|
|
7
|
-
|
|
7
|
+
fontVariant?: FontVariant;
|
|
8
|
+
description?: ReactNode;
|
|
8
9
|
modalContent?: ReactNode;
|
|
9
10
|
openModal?: (modalContent: ReactNode) => void;
|
|
10
|
-
|
|
11
|
+
text?: ReactNode;
|
|
11
12
|
rating?: {
|
|
12
13
|
value: number;
|
|
13
14
|
type: 'zap' | 'star';
|
|
14
15
|
};
|
|
15
|
-
contentFontVariant?: ContentFontVariant;
|
|
16
16
|
};
|
|
17
|
-
export declare const BaseCell: ({ align, checkmarkValue,
|
|
17
|
+
export declare const BaseCell: ({ align, checkmarkValue, fontVariant, description, modalContent, openModal, rating, text, }: BaseCellProps) => JSX.Element;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { BaseCell } from './BaseCell';
|
|
2
2
|
declare const story: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ align, checkmarkValue,
|
|
4
|
+
component: ({ align, checkmarkValue, fontVariant, description, modalContent, openModal, rating, text, }: import("./BaseCell").BaseCellProps) => JSX.Element;
|
|
5
5
|
argTypes: {};
|
|
6
6
|
args: {
|
|
7
|
+
text: string;
|
|
8
|
+
description: string;
|
|
9
|
+
modalContent: string;
|
|
10
|
+
fontVariant: string;
|
|
11
|
+
checkmarkValue: undefined;
|
|
7
12
|
rating: {
|
|
8
13
|
value: number;
|
|
9
14
|
type: string;
|
|
10
15
|
};
|
|
11
|
-
content: string;
|
|
12
|
-
subContent: string;
|
|
13
|
-
modalContent: string;
|
|
14
|
-
checkmarkValue: undefined;
|
|
15
|
-
contentFontVariant: string;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
export declare const BaseCellStory: {
|
|
19
|
-
({
|
|
19
|
+
({ text, description, modalContent, checkmarkValue, rating, fontVariant, align, }: React.ComponentProps<typeof BaseCell>): JSX.Element;
|
|
20
20
|
storyName: string;
|
|
21
21
|
};
|
|
22
22
|
export default story;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export type ButtonCellProps = {
|
|
3
|
-
|
|
3
|
+
buttonCaption: ReactNode;
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
isSelected?: boolean;
|
|
6
6
|
onClick: () => void;
|
|
7
|
-
|
|
7
|
+
price?: ReactNode;
|
|
8
8
|
};
|
|
9
|
-
export declare const ButtonCell: ({ isSelected, onClick,
|
|
9
|
+
export declare const ButtonCell: ({ isSelected, onClick, buttonCaption, price, disabled, }: ButtonCellProps) => JSX.Element;
|
package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ButtonCell } from './ButtonCell';
|
|
2
2
|
declare const story: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ isSelected, onClick,
|
|
4
|
+
component: ({ isSelected, onClick, buttonCaption, price, disabled, }: import("./ButtonCell").ButtonCellProps) => JSX.Element;
|
|
5
5
|
argTypes: {};
|
|
6
6
|
args: {
|
|
7
|
+
buttonCaption: string;
|
|
8
|
+
price: string;
|
|
7
9
|
isSelected: boolean;
|
|
8
|
-
content: string;
|
|
9
|
-
subContent: string;
|
|
10
10
|
disabled: boolean;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export declare const ButtonCellStory: {
|
|
14
|
-
({ isSelected,
|
|
14
|
+
({ isSelected, buttonCaption, price, disabled, }: React.ComponentProps<typeof ButtonCell>): JSX.Element;
|
|
15
15
|
storyName: string;
|
|
16
16
|
};
|
|
17
17
|
export default story;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export type CTACellProps = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
title: ReactNode;
|
|
4
|
+
price?: ReactNode;
|
|
5
|
+
buttonCaption?: ReactNode;
|
|
5
6
|
grey?: boolean;
|
|
6
7
|
narrow?: boolean;
|
|
7
8
|
href: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const CTACell: ({
|
|
10
|
+
export declare const CTACell: ({ title, price, grey, narrow, href, buttonCaption, }: CTACellProps) => JSX.Element;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { CTACell } from './CTACell';
|
|
2
2
|
declare const story: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({
|
|
4
|
+
component: ({ title, price, grey, narrow, href, buttonCaption, }: import("./CTACell").CTACellProps) => JSX.Element;
|
|
5
5
|
argTypes: {};
|
|
6
6
|
args: {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
title: string;
|
|
8
|
+
price: string;
|
|
9
|
+
buttonCaption: string;
|
|
9
10
|
grey: boolean;
|
|
10
11
|
narrow: boolean;
|
|
11
12
|
};
|
|
12
13
|
};
|
|
13
14
|
export declare const CTACellStory: {
|
|
14
|
-
({
|
|
15
|
+
({ title, price, buttonCaption, grey, narrow, }: React.ComponentProps<typeof CTACell>): JSX.Element;
|
|
15
16
|
storyName: string;
|
|
16
17
|
};
|
|
17
18
|
export default story;
|
|
@@ -2,13 +2,20 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { BaseCellProps } from './components/TableCell/BaseCell/BaseCell';
|
|
3
3
|
import { CTACellProps } from './components/TableCell/CTACell/CTACell';
|
|
4
4
|
import { ButtonCellProps } from './components/TableCell/ButtonCell/ButtonCell';
|
|
5
|
-
|
|
5
|
+
type BaseCellData = BaseCellProps & {
|
|
6
6
|
type?: undefined;
|
|
7
|
-
|
|
7
|
+
cellId?: string;
|
|
8
|
+
};
|
|
9
|
+
type CTACellData = CTACellProps & {
|
|
8
10
|
type: 'CTA';
|
|
9
|
-
|
|
11
|
+
cellId?: string;
|
|
12
|
+
};
|
|
13
|
+
type ButtonCellData = ButtonCellProps & {
|
|
10
14
|
type: 'BUTTON';
|
|
11
|
-
|
|
15
|
+
cellId?: string;
|
|
16
|
+
};
|
|
17
|
+
export type TableCellData = BaseCellData | CTACellData | ButtonCellData;
|
|
18
|
+
export declare const isBaseCell: (tableCellData: TableCellData) => tableCellData is BaseCellData;
|
|
12
19
|
export type TableSectionType = {
|
|
13
20
|
title?: string;
|
|
14
21
|
icon?: ReactNode;
|
|
@@ -24,3 +31,4 @@ export type TableSectionData = {
|
|
|
24
31
|
};
|
|
25
32
|
export type TableData = TableSectionData[];
|
|
26
33
|
export type ModalFunction = (modalData: ModalData) => void;
|
|
34
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,69 +1,95 @@
|
|
|
1
1
|
import { Table, TableProps } from './Table';
|
|
2
2
|
import { DentalPlusIcon, PlaneIcon } from '../icon';
|
|
3
|
-
import { TableData } from './types';
|
|
3
|
+
import { TableCellData, TableData } from './types';
|
|
4
4
|
|
|
5
5
|
const initialData: TableData = [
|
|
6
6
|
{
|
|
7
7
|
rows: [
|
|
8
8
|
[
|
|
9
|
-
{
|
|
9
|
+
{ text: 'Our plans' },
|
|
10
10
|
{
|
|
11
11
|
type: 'CTA',
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
title: 'Standard',
|
|
13
|
+
price: '€234',
|
|
14
|
+
buttonCaption: 'Get covered',
|
|
14
15
|
href: 'http://example.com',
|
|
15
16
|
},
|
|
16
17
|
{
|
|
17
18
|
type: 'CTA',
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
title: 'Plus',
|
|
20
|
+
price: '€344',
|
|
21
|
+
buttonCaption: 'Get covered',
|
|
20
22
|
href: 'http://example.com',
|
|
21
23
|
},
|
|
22
24
|
{
|
|
23
25
|
type: 'CTA',
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
title: 'Premium',
|
|
27
|
+
price: '€556',
|
|
28
|
+
buttonCaption: 'Get covered',
|
|
26
29
|
href: 'http://example.com',
|
|
27
30
|
},
|
|
28
31
|
],
|
|
29
32
|
[
|
|
30
|
-
{
|
|
33
|
+
{ text: 'Select a plan' },
|
|
31
34
|
{
|
|
32
35
|
type: 'BUTTON',
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
buttonCaption: 'Standard',
|
|
37
|
+
price: '€234',
|
|
35
38
|
onClick: () => {},
|
|
36
39
|
},
|
|
37
40
|
{
|
|
38
41
|
type: 'BUTTON',
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
buttonCaption: 'Plus',
|
|
43
|
+
price: '€344',
|
|
41
44
|
onClick: () => {},
|
|
42
45
|
},
|
|
43
46
|
{
|
|
44
47
|
type: 'BUTTON',
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
buttonCaption: 'Premium',
|
|
49
|
+
price: '€556',
|
|
47
50
|
onClick: () => {},
|
|
48
51
|
},
|
|
49
52
|
],
|
|
50
53
|
[
|
|
51
54
|
{
|
|
52
|
-
|
|
53
|
-
subContent: 'Annual Only',
|
|
55
|
+
text: 'Your contribution',
|
|
54
56
|
},
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
{
|
|
58
|
+
text: '€210',
|
|
59
|
+
description: 'per month',
|
|
60
|
+
fontVariant: 'PRICE',
|
|
61
|
+
modalContent: 'Price info',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
text: '€275',
|
|
65
|
+
description: 'per month',
|
|
66
|
+
fontVariant: 'PRICE',
|
|
67
|
+
modalContent: 'Price info',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
text: '€310',
|
|
71
|
+
description: 'per month',
|
|
72
|
+
fontVariant: 'PRICE',
|
|
73
|
+
modalContent: 'Price info',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
text: 'Regular vet visits & medication',
|
|
79
|
+
description: 'Annual Only',
|
|
80
|
+
},
|
|
81
|
+
{ text: 'No', description: 'Annual Only' },
|
|
82
|
+
{ text: '50%' },
|
|
83
|
+
{ text: '80%-100%' },
|
|
58
84
|
],
|
|
59
85
|
[
|
|
60
|
-
{
|
|
86
|
+
{ text: 'Operations', modalContent: 'Operations info' },
|
|
61
87
|
{ checkmarkValue: true, modalContent: 'Operations info column 2' },
|
|
62
88
|
{ checkmarkValue: false },
|
|
63
89
|
{ checkmarkValue: true },
|
|
64
90
|
],
|
|
65
91
|
[
|
|
66
|
-
{
|
|
92
|
+
{ text: 'Rating', modalContent: 'Rating info' },
|
|
67
93
|
{ rating: { type: 'zap', value: 1 } },
|
|
68
94
|
{
|
|
69
95
|
rating: { type: 'zap', value: 3 },
|
|
@@ -80,19 +106,19 @@ const initialData: TableData = [
|
|
|
80
106
|
},
|
|
81
107
|
rows: [
|
|
82
108
|
[
|
|
83
|
-
{
|
|
84
|
-
{
|
|
85
|
-
{
|
|
86
|
-
{
|
|
109
|
+
{ text: 'Regular vet visits & medication' },
|
|
110
|
+
{ text: 'No' },
|
|
111
|
+
{ text: 'Yes' },
|
|
112
|
+
{ text: 'Yes' },
|
|
87
113
|
],
|
|
88
114
|
[
|
|
89
|
-
{
|
|
115
|
+
{ text: 'Operations', modalContent: 'info' },
|
|
90
116
|
{ checkmarkValue: true, modalContent: 'Maybe' },
|
|
91
117
|
{ checkmarkValue: false },
|
|
92
118
|
{ checkmarkValue: true },
|
|
93
119
|
],
|
|
94
120
|
[
|
|
95
|
-
{
|
|
121
|
+
{ text: 'Rating', modalContent: 'info' },
|
|
96
122
|
{ rating: { type: 'zap', value: 1 }, modalContent: 'Maybe' },
|
|
97
123
|
{ rating: { type: 'zap', value: 3 } },
|
|
98
124
|
{ rating: { type: 'star', value: 3 } },
|
|
@@ -106,19 +132,19 @@ const initialData: TableData = [
|
|
|
106
132
|
},
|
|
107
133
|
rows: [
|
|
108
134
|
[
|
|
109
|
-
{
|
|
110
|
-
{
|
|
111
|
-
{
|
|
112
|
-
{
|
|
135
|
+
{ text: 'Regular vet visits & medication' },
|
|
136
|
+
{ text: 'No', checkmarkValue: false },
|
|
137
|
+
{ text: 'Yes' },
|
|
138
|
+
{ text: 'Yes' },
|
|
113
139
|
],
|
|
114
140
|
[
|
|
115
|
-
{
|
|
141
|
+
{ text: 'Operations', modalContent: 'info' },
|
|
116
142
|
{ checkmarkValue: true, modalContent: 'Maybe' },
|
|
117
143
|
{ checkmarkValue: false },
|
|
118
144
|
{ checkmarkValue: true },
|
|
119
145
|
],
|
|
120
146
|
[
|
|
121
|
-
{
|
|
147
|
+
{ text: 'Rating', modalContent: 'info' },
|
|
122
148
|
{ rating: { type: 'zap', value: 1 }, modalContent: 'Maybe' },
|
|
123
149
|
{ rating: { type: 'zap', value: 3 } },
|
|
124
150
|
{ rating: { type: 'star', value: 3 } },
|
|
@@ -216,7 +242,7 @@ type TableData = {
|
|
|
216
242
|
rows: {
|
|
217
243
|
align?: 'center' | 'left' | 'right';
|
|
218
244
|
checkmarkValue?: boolean;
|
|
219
|
-
|
|
245
|
+
text?: ReactNode;
|
|
220
246
|
modalContent?: ReactNode;
|
|
221
247
|
subContent?: ReactNode;
|
|
222
248
|
rating?: {
|
|
@@ -8,7 +8,7 @@ const tableData: TableSectionData[] = [
|
|
|
8
8
|
title: 'Section 1',
|
|
9
9
|
icon: <span>Icon 1</span>,
|
|
10
10
|
},
|
|
11
|
-
rows: [[{
|
|
11
|
+
rows: [[{ text: 'Item 1' }, { text: 'Item 2' }]],
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
section: {
|
|
@@ -16,10 +16,7 @@ const tableData: TableSectionData[] = [
|
|
|
16
16
|
icon: <span>Icon 2</span>,
|
|
17
17
|
},
|
|
18
18
|
rows: [
|
|
19
|
-
[
|
|
20
|
-
{ content: 'Item 3' },
|
|
21
|
-
{ content: 'Item 4', modalContent: 'Additional item' },
|
|
22
|
-
],
|
|
19
|
+
[{ text: 'Item 3' }, { text: 'Item 4', modalContent: 'Additional item' }],
|
|
23
20
|
],
|
|
24
21
|
},
|
|
25
22
|
];
|
|
@@ -12,7 +12,7 @@ import { useTableNavigation } from './utils/useTableNavigation/useTableNavigatio
|
|
|
12
12
|
import { TableControls } from './components/TableControls/TableControls';
|
|
13
13
|
import { TableSection } from './components/TableSection/TableSection';
|
|
14
14
|
import { useScrollSync } from './utils/useScrollSync/useScrollSync';
|
|
15
|
-
import { ModalData, ModalFunction, TableData } from './types';
|
|
15
|
+
import { isBaseCell, ModalData, ModalFunction, TableData } from './types';
|
|
16
16
|
|
|
17
17
|
type TextOverrides = {
|
|
18
18
|
showDetails?: string;
|
|
@@ -70,17 +70,6 @@ const Table = ({
|
|
|
70
70
|
setInfoModalData({ body, title });
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
const isBaseCell = !currentActiveSection.type;
|
|
74
|
-
let openModal;
|
|
75
|
-
|
|
76
|
-
if (isBaseCell) {
|
|
77
|
-
openModal = (body: ReactNode) =>
|
|
78
|
-
handleOpenModal({
|
|
79
|
-
body,
|
|
80
|
-
title: currentActiveSection?.content,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
73
|
return (
|
|
85
74
|
<div className={classNames(styles.wrapper, 'bg-white')}>
|
|
86
75
|
{isMobile ? (
|
|
@@ -92,9 +81,13 @@ const Table = ({
|
|
|
92
81
|
>
|
|
93
82
|
<TableCell
|
|
94
83
|
{...currentActiveSection}
|
|
95
|
-
{...(isBaseCell
|
|
84
|
+
{...(isBaseCell(currentActiveSection)
|
|
96
85
|
? {
|
|
97
|
-
openModal
|
|
86
|
+
openModal: (body: ReactNode) =>
|
|
87
|
+
handleOpenModal({
|
|
88
|
+
body,
|
|
89
|
+
title: currentActiveSection?.text,
|
|
90
|
+
}),
|
|
98
91
|
}
|
|
99
92
|
: {})}
|
|
100
93
|
isNavigation
|
|
@@ -5,37 +5,37 @@ const story = {
|
|
|
5
5
|
component: BaseCell,
|
|
6
6
|
argTypes: {},
|
|
7
7
|
args: {
|
|
8
|
+
text: 'For dogs',
|
|
9
|
+
description: 'Annual only',
|
|
10
|
+
modalContent: 'More info',
|
|
11
|
+
fontVariant: 'NORMAL',
|
|
12
|
+
checkmarkValue: undefined,
|
|
8
13
|
rating: {
|
|
9
14
|
value: 2,
|
|
10
15
|
type: 'zap',
|
|
11
16
|
},
|
|
12
|
-
content: 'For dogs',
|
|
13
|
-
subContent: 'Annual only',
|
|
14
|
-
modalContent: 'More info',
|
|
15
|
-
checkmarkValue: undefined,
|
|
16
|
-
contentFontVariant: 'NORMAL',
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const BaseCellStory = ({
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
text,
|
|
22
|
+
description,
|
|
23
23
|
modalContent,
|
|
24
24
|
checkmarkValue,
|
|
25
25
|
rating,
|
|
26
|
-
|
|
26
|
+
fontVariant,
|
|
27
27
|
align,
|
|
28
28
|
}: React.ComponentProps<typeof BaseCell>) => (
|
|
29
29
|
<div className="p48 d-flex fd-column gap16 bg-white">
|
|
30
30
|
<BaseCell
|
|
31
31
|
align={align}
|
|
32
32
|
checkmarkValue={checkmarkValue}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
fontVariant={fontVariant}
|
|
34
|
+
description={description}
|
|
35
35
|
modalContent={modalContent}
|
|
36
36
|
openModal={() => {}}
|
|
37
37
|
rating={rating}
|
|
38
|
-
|
|
38
|
+
text={text}
|
|
39
39
|
/>
|
|
40
40
|
</div>
|
|
41
41
|
);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { Button } from '../../../../button';
|
|
3
2
|
import {
|
|
4
3
|
CheckIcon,
|
|
5
4
|
XIcon,
|
|
6
|
-
InfoIcon,
|
|
7
5
|
StarFilledIcon,
|
|
8
6
|
ZapFilledIcon,
|
|
9
7
|
} from '../../../../icon';
|
|
@@ -12,7 +10,7 @@ import styles from './BaseCell.module.scss';
|
|
|
12
10
|
import { MiniProgressBar } from './MiniProgressBar/MiniProgressBar';
|
|
13
11
|
import { TableInfoButton } from '../../../../comparisonTable';
|
|
14
12
|
|
|
15
|
-
export type
|
|
13
|
+
export type FontVariant = 'NORMAL' | 'BIG_WITH_UNDERLINE' | 'PRICE';
|
|
16
14
|
|
|
17
15
|
const progressLookup: Record<string, number> = {
|
|
18
16
|
'30%': 1,
|
|
@@ -32,26 +30,26 @@ export type Alignment = 'center' | 'left' | 'right';
|
|
|
32
30
|
export type BaseCellProps = {
|
|
33
31
|
align?: Alignment;
|
|
34
32
|
checkmarkValue?: boolean;
|
|
35
|
-
|
|
33
|
+
fontVariant?: FontVariant;
|
|
34
|
+
description?: ReactNode;
|
|
36
35
|
modalContent?: ReactNode;
|
|
37
36
|
openModal?: (modalContent: ReactNode) => void;
|
|
38
|
-
|
|
37
|
+
text?: ReactNode;
|
|
39
38
|
rating?: {
|
|
40
39
|
value: number;
|
|
41
40
|
type: 'zap' | 'star';
|
|
42
41
|
};
|
|
43
|
-
contentFontVariant?: ContentFontVariant;
|
|
44
42
|
};
|
|
45
43
|
|
|
46
44
|
export const BaseCell = ({
|
|
47
45
|
align = 'center',
|
|
48
46
|
checkmarkValue,
|
|
49
|
-
|
|
47
|
+
fontVariant = 'NORMAL',
|
|
48
|
+
description = '',
|
|
50
49
|
modalContent = '',
|
|
51
50
|
openModal,
|
|
52
51
|
rating,
|
|
53
|
-
|
|
54
|
-
contentFontVariant = 'NORMAL',
|
|
52
|
+
text = '',
|
|
55
53
|
}: BaseCellProps) => {
|
|
56
54
|
const alignClassName = {
|
|
57
55
|
center: 'ta-center jc-center ai-center',
|
|
@@ -63,7 +61,7 @@ export const BaseCell = ({
|
|
|
63
61
|
const SelectedIcon = rating?.type === 'zap' ? ZapFilledIcon : StarFilledIcon;
|
|
64
62
|
|
|
65
63
|
const progressBarValue =
|
|
66
|
-
typeof
|
|
64
|
+
typeof text === 'string' ? progressLookup[text] : undefined;
|
|
67
65
|
|
|
68
66
|
return (
|
|
69
67
|
<div
|
|
@@ -113,22 +111,22 @@ export const BaseCell = ({
|
|
|
113
111
|
</span>
|
|
114
112
|
)}
|
|
115
113
|
|
|
116
|
-
{
|
|
117
|
-
<div className="p-p" data-testid="table-cell-
|
|
118
|
-
{
|
|
114
|
+
{text && fontVariant === 'NORMAL' && (
|
|
115
|
+
<div className="p-p" data-testid="table-cell-text">
|
|
116
|
+
{text}
|
|
119
117
|
</div>
|
|
120
118
|
)}
|
|
121
119
|
|
|
122
|
-
{
|
|
120
|
+
{text && fontVariant === 'PRICE' && (
|
|
123
121
|
<div
|
|
124
122
|
className="p-h1 p--serif tc-primary-500"
|
|
125
123
|
data-testid="table-cell-content"
|
|
126
124
|
>
|
|
127
|
-
{
|
|
125
|
+
{text}
|
|
128
126
|
</div>
|
|
129
127
|
)}
|
|
130
128
|
|
|
131
|
-
{
|
|
129
|
+
{text && fontVariant === 'BIG_WITH_UNDERLINE' && (
|
|
132
130
|
<div
|
|
133
131
|
aria-hidden
|
|
134
132
|
className={classNames(
|
|
@@ -136,19 +134,19 @@ export const BaseCell = ({
|
|
|
136
134
|
styles.bigWithUnderline
|
|
137
135
|
)}
|
|
138
136
|
>
|
|
139
|
-
{
|
|
137
|
+
{text}
|
|
140
138
|
</div>
|
|
141
139
|
)}
|
|
142
140
|
</div>
|
|
143
141
|
|
|
144
|
-
{
|
|
142
|
+
{description && (
|
|
145
143
|
<div
|
|
146
144
|
className={classNames(
|
|
147
145
|
'd-flex p-p--small tc-grey-500',
|
|
148
146
|
alignClassName
|
|
149
147
|
)}
|
|
150
148
|
>
|
|
151
|
-
{
|
|
149
|
+
{description}
|
|
152
150
|
</div>
|
|
153
151
|
)}
|
|
154
152
|
</div>
|