@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.
Files changed (65) hide show
  1. package/dist/cjs/index.js +74 -71
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +5 -5
  4. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +7 -7
  5. package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +3 -3
  6. package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts +4 -4
  7. package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +4 -3
  8. package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +5 -4
  9. package/dist/cjs/lib/components/table/types.d.ts +12 -4
  10. package/dist/esm/TableSection-f6d0028e.js +80 -0
  11. package/dist/esm/TableSection-f6d0028e.js.map +1 -0
  12. package/dist/esm/components/table/Table.js +8 -13
  13. package/dist/esm/components/table/Table.js.map +1 -1
  14. package/dist/esm/components/table/Table.stories.js +61 -35
  15. package/dist/esm/components/table/Table.stories.js.map +1 -1
  16. package/dist/esm/components/table/Table.test.js +3 -6
  17. package/dist/esm/components/table/Table.test.js.map +1 -1
  18. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js +3 -3
  19. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js.map +1 -1
  20. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js +7 -7
  21. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js.map +1 -1
  22. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js +6 -6
  23. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js.map +1 -1
  24. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.stories.js +4 -4
  25. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.stories.js.map +1 -1
  26. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js +3 -3
  27. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js.map +1 -1
  28. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js +5 -4
  29. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js.map +1 -1
  30. package/dist/esm/components/table/components/TableCell/TableCell.js +5 -2
  31. package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
  32. package/dist/esm/components/table/components/TableCell/TableCell.test.js +3 -5
  33. package/dist/esm/components/table/components/TableCell/TableCell.test.js.map +1 -1
  34. package/dist/esm/components/table/components/TableContents/TableContents.js +1 -1
  35. package/dist/esm/components/table/components/TableContents/TableContents.test.js +5 -5
  36. package/dist/esm/components/table/components/TableContents/TableContents.test.js.map +1 -1
  37. package/dist/esm/components/table/components/TableSection/TableSection.js +7 -75
  38. package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
  39. package/dist/esm/components/table/components/TableSection/TableSection.test.js +3 -3
  40. package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
  41. package/dist/esm/index.js +1 -1
  42. package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +5 -5
  43. package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +7 -7
  44. package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +3 -3
  45. package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts +4 -4
  46. package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +4 -3
  47. package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +5 -4
  48. package/dist/esm/lib/components/table/types.d.ts +12 -4
  49. package/package.json +1 -1
  50. package/src/lib/components/table/Table.stories.tsx +61 -35
  51. package/src/lib/components/table/Table.test.tsx +2 -5
  52. package/src/lib/components/table/Table.tsx +7 -14
  53. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.tsx +11 -11
  54. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx +17 -19
  55. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.module.scss +2 -2
  56. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.tsx +13 -13
  57. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.tsx +8 -8
  58. package/src/lib/components/table/components/TableCell/CTACell/CTACell.stories.tsx +9 -6
  59. package/src/lib/components/table/components/TableCell/CTACell/CTACell.tsx +9 -7
  60. package/src/lib/components/table/components/TableCell/TableCell.test.tsx +8 -7
  61. package/src/lib/components/table/components/TableCell/TableCell.tsx +5 -1
  62. package/src/lib/components/table/components/TableContents/TableContents.test.tsx +4 -4
  63. package/src/lib/components/table/components/TableSection/TableSection.test.tsx +2 -2
  64. package/src/lib/components/table/components/TableSection/TableSection.tsx +64 -65
  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 './TableSection.js';
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
- [{ content: 'Cell 1.1' }, { content: 'Cell 1.2' }, { content: 'Cell 1.3' }],
29
- [{ content: 'Cell 2.1' }, { content: 'Cell 2.2' }, { content: 'Cell 2.3' }],
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 [{ content: 'Cell 1.1' }, { content: 'Cell 1.2' }, { content: 'Cell 1.3' }],\n [{ content: 'Cell 2.1' }, { content: 'Cell 2.2' }, { content: 'Cell 2.3' }],\n];\n\nconst mockTitle = 'Test Table';\n\nconst mockOpenModal = jest.fn();\n\nconst defaultProps: 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(tdElements[1]).toHaveTextContent('Cell 2.3');\n });\n});\n"],"names":["render","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AAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;KAC1D,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE;QACxB,IAAA,SAAS,GAAKD,YAAM,CAACC,IAAC,YAAY,eAAK,YAAY,EAAI,CAAC,UAA/C,CAAgD;QAEjE,IAAM,UAAU,GAAG,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAEpD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;KACrD,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE;QAC3B,IAAA,SAAS,GAAKD,YAAM,CAACC,IAAC,YAAY,eAAK,YAAY,EAAI,CAAC,UAA/C,CAAgD;QAEjE,IAAM,UAAU,GAAG,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;KACrD,CAAC,CAAC;AACL,CAAC,CAAC"}
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(tdElements[1]).toHaveTextContent('Cell 2.3');\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,aAAa,GAAuC;IACxD,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAClE,CAAC,EAAE,IAAI,EAAE,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C,IAAC,YAAY,eAAK,YAAY,EAAI,CAAC,UAA/C,CAAgD;QAEjE,IAAM,UAAU,GAAG,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAEpD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;KACrD,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE;QAC3B,IAAA,SAAS,GAAKD,YAAM,CAACC,IAAC,YAAY,eAAK,YAAY,EAAI,CAAC,UAA/C,CAAgD;QAEjE,IAAM,UAAU,GAAG,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;KACrD,CAAC,CAAC;AACL,CAAC,CAAC"}
package/dist/esm/index.js CHANGED
@@ -428,7 +428,7 @@ import './components/table/components/TableCell/CTACell/CTACell.js';
428
428
  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 './components/table/components/TableSection/TableSection.js';
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 ContentFontVariant = 'NORMAL' | 'BIG_WITH_UNDERLINE' | 'PRICE';
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
- content?: ReactNode;
7
+ fontVariant?: FontVariant;
8
+ description?: ReactNode;
8
9
  modalContent?: ReactNode;
9
10
  openModal?: (modalContent: ReactNode) => void;
10
- subContent?: ReactNode;
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, content, modalContent, openModal, rating, subContent, contentFontVariant, }: BaseCellProps) => JSX.Element;
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, content, modalContent, openModal, rating, subContent, contentFontVariant, }: import("./BaseCell").BaseCellProps) => JSX.Element;
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
- ({ content, subContent, modalContent, checkmarkValue, rating, contentFontVariant, align, }: React.ComponentProps<typeof BaseCell>): JSX.Element;
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
- content?: ReactNode;
3
+ buttonCaption: ReactNode;
4
4
  disabled?: boolean;
5
5
  isSelected?: boolean;
6
6
  onClick: () => void;
7
- subContent?: ReactNode;
7
+ price?: ReactNode;
8
8
  };
9
- export declare const ButtonCell: ({ isSelected, onClick, content, subContent, disabled, }: ButtonCellProps) => JSX.Element;
9
+ export declare const ButtonCell: ({ isSelected, onClick, buttonCaption, price, disabled, }: ButtonCellProps) => JSX.Element;
@@ -1,17 +1,17 @@
1
1
  import { ButtonCell } from './ButtonCell';
2
2
  declare const story: {
3
3
  title: string;
4
- component: ({ isSelected, onClick, content, subContent, disabled, }: import("./ButtonCell").ButtonCellProps) => JSX.Element;
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, content, subContent, disabled, }: React.ComponentProps<typeof ButtonCell>): JSX.Element;
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
- content?: ReactNode;
4
- subContent?: ReactNode;
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: ({ content, subContent, grey, narrow, href, }: CTACellProps) => JSX.Element;
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: ({ content, subContent, grey, narrow, href, }: import("./CTACell").CTACellProps) => JSX.Element;
4
+ component: ({ title, price, grey, narrow, href, buttonCaption, }: import("./CTACell").CTACellProps) => JSX.Element;
5
5
  argTypes: {};
6
6
  args: {
7
- content: string;
8
- subContent: string;
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
- ({ content, subContent, grey, narrow, }: React.ComponentProps<typeof CTACell>): JSX.Element;
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
- export type TableCellData = (BaseCellProps & {
5
+ type BaseCellData = BaseCellProps & {
6
6
  type?: undefined;
7
- }) | (CTACellProps & {
7
+ cellId?: string;
8
+ };
9
+ type CTACellData = CTACellProps & {
8
10
  type: 'CTA';
9
- }) | (ButtonCellProps & {
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.54.3",
3
+ "version": "0.54.4",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -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
- { content: 'Our plans' },
9
+ { text: 'Our plans' },
10
10
  {
11
11
  type: 'CTA',
12
- content: 'Standard',
13
- subContent: '€234',
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
- content: 'Plus',
19
- subContent: '€344',
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
- content: 'Premium',
25
- subContent: '€556',
26
+ title: 'Premium',
27
+ price: '€556',
28
+ buttonCaption: 'Get covered',
26
29
  href: 'http://example.com',
27
30
  },
28
31
  ],
29
32
  [
30
- { content: 'Select a plan' },
33
+ { text: 'Select a plan' },
31
34
  {
32
35
  type: 'BUTTON',
33
- content: 'Standard',
34
- subContent: '€234',
36
+ buttonCaption: 'Standard',
37
+ price: '€234',
35
38
  onClick: () => {},
36
39
  },
37
40
  {
38
41
  type: 'BUTTON',
39
- content: 'Plus',
40
- subContent: '€344',
42
+ buttonCaption: 'Plus',
43
+ price: '€344',
41
44
  onClick: () => {},
42
45
  },
43
46
  {
44
47
  type: 'BUTTON',
45
- content: 'Premium',
46
- subContent: '€556',
48
+ buttonCaption: 'Premium',
49
+ price: '€556',
47
50
  onClick: () => {},
48
51
  },
49
52
  ],
50
53
  [
51
54
  {
52
- content: 'Regular vet visits & medication',
53
- subContent: 'Annual Only',
55
+ text: 'Your contribution',
54
56
  },
55
- { content: 'No', subContent: 'Annual Only' },
56
- { content: '50%' },
57
- { content: '80%-100%' },
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
- { content: 'Operations', modalContent: 'Operations info' },
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
- { content: 'Rating', modalContent: 'Rating info' },
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
- { content: 'Regular vet visits & medication' },
84
- { content: 'No' },
85
- { content: 'Yes' },
86
- { content: 'Yes' },
109
+ { text: 'Regular vet visits & medication' },
110
+ { text: 'No' },
111
+ { text: 'Yes' },
112
+ { text: 'Yes' },
87
113
  ],
88
114
  [
89
- { content: 'Operations', modalContent: 'info' },
115
+ { text: 'Operations', modalContent: 'info' },
90
116
  { checkmarkValue: true, modalContent: 'Maybe' },
91
117
  { checkmarkValue: false },
92
118
  { checkmarkValue: true },
93
119
  ],
94
120
  [
95
- { content: 'Rating', modalContent: 'info' },
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
- { content: 'Regular vet visits & medication' },
110
- { content: 'No', checkmarkValue: false },
111
- { content: 'Yes' },
112
- { content: 'Yes' },
135
+ { text: 'Regular vet visits & medication' },
136
+ { text: 'No', checkmarkValue: false },
137
+ { text: 'Yes' },
138
+ { text: 'Yes' },
113
139
  ],
114
140
  [
115
- { content: 'Operations', modalContent: 'info' },
141
+ { text: 'Operations', modalContent: 'info' },
116
142
  { checkmarkValue: true, modalContent: 'Maybe' },
117
143
  { checkmarkValue: false },
118
144
  { checkmarkValue: true },
119
145
  ],
120
146
  [
121
- { content: 'Rating', modalContent: 'info' },
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
- content?: ReactNode;
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: [[{ content: 'Item 1' }, { content: 'Item 2' }]],
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
- content,
22
- subContent,
21
+ text,
22
+ description,
23
23
  modalContent,
24
24
  checkmarkValue,
25
25
  rating,
26
- contentFontVariant,
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
- content={content}
34
- contentFontVariant={contentFontVariant}
33
+ fontVariant={fontVariant}
34
+ description={description}
35
35
  modalContent={modalContent}
36
36
  openModal={() => {}}
37
37
  rating={rating}
38
- subContent={subContent}
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 ContentFontVariant = 'NORMAL' | 'BIG_WITH_UNDERLINE' | 'PRICE';
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
- content?: ReactNode;
33
+ fontVariant?: FontVariant;
34
+ description?: ReactNode;
36
35
  modalContent?: ReactNode;
37
36
  openModal?: (modalContent: ReactNode) => void;
38
- subContent?: ReactNode;
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
- content = '',
47
+ fontVariant = 'NORMAL',
48
+ description = '',
50
49
  modalContent = '',
51
50
  openModal,
52
51
  rating,
53
- subContent = '',
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 content === 'string' ? progressLookup[content] : undefined;
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
- {content && contentFontVariant === 'NORMAL' && (
117
- <div className="p-p" data-testid="table-cell-content">
118
- {content}
114
+ {text && fontVariant === 'NORMAL' && (
115
+ <div className="p-p" data-testid="table-cell-text">
116
+ {text}
119
117
  </div>
120
118
  )}
121
119
 
122
- {content && contentFontVariant === 'PRICE' && (
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
- {content}
125
+ {text}
128
126
  </div>
129
127
  )}
130
128
 
131
- {content && contentFontVariant === 'BIG_WITH_UNDERLINE' && (
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
- {content}
137
+ {text}
140
138
  </div>
141
139
  )}
142
140
  </div>
143
141
 
144
- {subContent && (
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
- {subContent}
149
+ {description}
152
150
  </div>
153
151
  )}
154
152
  </div>
@@ -28,11 +28,11 @@
28
28
  }
29
29
  }
30
30
 
31
- .withoutSubContent {
31
+ .withoutPrice {
32
32
  height: 64px;
33
33
  }
34
34
 
35
- .withSubContent {
35
+ .withPrice {
36
36
  height: 75px;
37
37
  }
38
38