@popsure/dirty-swan 0.54.2 → 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 (108) hide show
  1. package/dist/cjs/index.js +355 -262
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +17 -0
  4. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +22 -0
  5. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.d.ts +3 -0
  6. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.d.ts +25 -0
  7. package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +9 -0
  8. package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts +17 -0
  9. package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +10 -0
  10. package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +18 -0
  11. package/dist/cjs/lib/components/table/components/TableCell/TableCell.d.ts +5 -17
  12. package/dist/cjs/lib/components/table/types.d.ts +19 -2
  13. package/dist/cjs/lib/components/table/utils/useTableNavigation/useTableNavigation.d.ts +1 -2
  14. package/dist/esm/TableSection-f6d0028e.js +80 -0
  15. package/dist/esm/TableSection-f6d0028e.js.map +1 -0
  16. package/dist/esm/components/cards/card/index.stories.js +2 -2
  17. package/dist/esm/components/cards/card/index.stories.js.map +1 -1
  18. package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js +2 -2
  19. package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js.map +1 -1
  20. package/dist/esm/components/comparisonTable/index.js +3 -1526
  21. package/dist/esm/components/comparisonTable/index.js.map +1 -1
  22. package/dist/esm/components/comparisonTable/index.stories.js +1 -0
  23. package/dist/esm/components/comparisonTable/index.stories.js.map +1 -1
  24. package/dist/esm/components/icon/icons/Info.js +2 -2
  25. package/dist/esm/components/icon/icons/Info.js.map +1 -1
  26. package/dist/esm/components/icon/icons.stories.js +1 -1
  27. package/dist/esm/components/icon/index.stories.js +1 -1
  28. package/dist/esm/components/table/Table.js +22 -13
  29. package/dist/esm/components/table/Table.js.map +1 -1
  30. package/dist/esm/components/table/Table.stories.js +100 -32
  31. package/dist/esm/components/table/Table.stories.js.map +1 -1
  32. package/dist/esm/components/table/Table.test.js +15 -12
  33. package/dist/esm/components/table/Table.test.js.map +1 -1
  34. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js +50 -0
  35. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js.map +1 -0
  36. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js +43 -0
  37. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js.map +1 -0
  38. package/dist/esm/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.js +15 -0
  39. package/dist/esm/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.js.map +1 -0
  40. package/dist/esm/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.js +31 -0
  41. package/dist/esm/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.js.map +1 -0
  42. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js +23 -0
  43. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js.map +1 -0
  44. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.stories.js +28 -0
  45. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.stories.js.map +1 -0
  46. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js +21 -0
  47. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js.map +1 -0
  48. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js +26 -0
  49. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js.map +1 -0
  50. package/dist/esm/components/table/components/TableCell/TableCell.js +24 -20
  51. package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
  52. package/dist/esm/components/table/components/TableCell/TableCell.test.js +26 -14
  53. package/dist/esm/components/table/components/TableCell/TableCell.test.js.map +1 -1
  54. package/dist/esm/components/table/components/TableContents/TableContents.js +11 -3
  55. package/dist/esm/components/table/components/TableContents/TableContents.js.map +1 -1
  56. package/dist/esm/components/table/components/TableContents/TableContents.test.js +14 -7
  57. package/dist/esm/components/table/components/TableContents/TableContents.test.js.map +1 -1
  58. package/dist/esm/components/table/components/TableSection/TableSection.js +17 -53
  59. package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
  60. package/dist/esm/components/table/components/TableSection/TableSection.test.js +12 -5
  61. package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
  62. package/dist/esm/components/table/utils/useTableNavigation/useTableNavigation.test.js +1 -5
  63. package/dist/esm/components/table/utils/useTableNavigation/useTableNavigation.test.js.map +1 -1
  64. package/dist/esm/index-3d286178.js +1529 -0
  65. package/dist/esm/index-3d286178.js.map +1 -0
  66. package/dist/esm/{index-0bb5a2ee.js → index-7506ae25.js} +3 -3
  67. package/dist/esm/{index-0bb5a2ee.js.map → index-7506ae25.js.map} +1 -1
  68. package/dist/esm/index.js +7 -2
  69. package/dist/esm/index.js.map +1 -1
  70. package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +17 -0
  71. package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +22 -0
  72. package/dist/esm/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.d.ts +3 -0
  73. package/dist/esm/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.d.ts +25 -0
  74. package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +9 -0
  75. package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts +17 -0
  76. package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +10 -0
  77. package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +18 -0
  78. package/dist/esm/lib/components/table/components/TableCell/TableCell.d.ts +5 -17
  79. package/dist/esm/lib/components/table/types.d.ts +19 -2
  80. package/dist/esm/lib/components/table/utils/useTableNavigation/useTableNavigation.d.ts +1 -2
  81. package/dist/esm/{useTableNavigation-8e50b121.js → useTableNavigation-2899712c.js} +12 -16
  82. package/dist/esm/useTableNavigation-2899712c.js.map +1 -0
  83. package/package.json +1 -1
  84. package/src/lib/components/table/Table.stories.tsx +87 -25
  85. package/src/lib/components/table/Table.test.tsx +3 -6
  86. package/src/lib/components/table/Table.tsx +11 -9
  87. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.module.scss +36 -0
  88. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.tsx +45 -0
  89. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx +158 -0
  90. package/src/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.module.scss +44 -0
  91. package/src/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.tsx +29 -0
  92. package/src/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.tsx +35 -0
  93. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.module.scss +43 -0
  94. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.tsx +65 -0
  95. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.tsx +40 -0
  96. package/src/lib/components/table/components/TableCell/CTACell/CTACell.module.scss +3 -0
  97. package/src/lib/components/table/components/TableCell/CTACell/CTACell.stories.tsx +37 -0
  98. package/src/lib/components/table/components/TableCell/CTACell/CTACell.tsx +42 -0
  99. package/src/lib/components/table/components/TableCell/TableCell.module.scss +0 -43
  100. package/src/lib/components/table/components/TableCell/TableCell.test.tsx +26 -13
  101. package/src/lib/components/table/components/TableCell/TableCell.tsx +20 -122
  102. package/src/lib/components/table/components/TableContents/TableContents.test.tsx +6 -6
  103. package/src/lib/components/table/components/TableSection/TableSection.test.tsx +5 -5
  104. package/src/lib/components/table/components/TableSection/TableSection.tsx +67 -41
  105. package/src/lib/components/table/types.ts +16 -2
  106. package/src/lib/components/table/utils/useTableNavigation/useTableNavigation.test.tsx +0 -4
  107. package/src/lib/components/table/utils/useTableNavigation/useTableNavigation.ts +13 -20
  108. package/dist/esm/useTableNavigation-8e50b121.js.map +0 -1
@@ -1,33 +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' },
10
- { content: 'Surgery', modalContent: 'More info on surgery' },
11
- { content: 'Standard' },
12
- { content: 'Premium' },
9
+ { text: 'Our plans' },
10
+ {
11
+ type: 'CTA',
12
+ title: 'Standard',
13
+ price: '€234',
14
+ buttonCaption: 'Get covered',
15
+ href: 'http://example.com',
16
+ },
17
+ {
18
+ type: 'CTA',
19
+ title: 'Plus',
20
+ price: '€344',
21
+ buttonCaption: 'Get covered',
22
+ href: 'http://example.com',
23
+ },
24
+ {
25
+ type: 'CTA',
26
+ title: 'Premium',
27
+ price: '€556',
28
+ buttonCaption: 'Get covered',
29
+ href: 'http://example.com',
30
+ },
31
+ ],
32
+ [
33
+ { text: 'Select a plan' },
34
+ {
35
+ type: 'BUTTON',
36
+ buttonCaption: 'Standard',
37
+ price: '€234',
38
+ onClick: () => {},
39
+ },
40
+ {
41
+ type: 'BUTTON',
42
+ buttonCaption: 'Plus',
43
+ price: '€344',
44
+ onClick: () => {},
45
+ },
46
+ {
47
+ type: 'BUTTON',
48
+ buttonCaption: 'Premium',
49
+ price: '€556',
50
+ onClick: () => {},
51
+ },
52
+ ],
53
+ [
54
+ {
55
+ text: 'Your contribution',
56
+ },
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
+ },
13
75
  ],
14
76
  [
15
77
  {
16
- content: 'Regular vet visits & medication',
17
- subContent: 'Annual Only',
78
+ text: 'Regular vet visits & medication',
79
+ description: 'Annual Only',
18
80
  },
19
- { content: 'No', subContent: 'Annual Only' },
20
- { content: 'Yes' },
21
- { content: 'Yes' },
81
+ { text: 'No', description: 'Annual Only' },
82
+ { text: '50%' },
83
+ { text: '80%-100%' },
22
84
  ],
23
85
  [
24
- { content: 'Operations', modalContent: 'Operations info' },
86
+ { text: 'Operations', modalContent: 'Operations info' },
25
87
  { checkmarkValue: true, modalContent: 'Operations info column 2' },
26
88
  { checkmarkValue: false },
27
89
  { checkmarkValue: true },
28
90
  ],
29
91
  [
30
- { content: 'Rating', modalContent: 'Rating info' },
92
+ { text: 'Rating', modalContent: 'Rating info' },
31
93
  { rating: { type: 'zap', value: 1 } },
32
94
  {
33
95
  rating: { type: 'zap', value: 3 },
@@ -44,19 +106,19 @@ const initialData: TableData = [
44
106
  },
45
107
  rows: [
46
108
  [
47
- { content: 'Regular vet visits & medication' },
48
- { content: 'No' },
49
- { content: 'Yes' },
50
- { content: 'Yes' },
109
+ { text: 'Regular vet visits & medication' },
110
+ { text: 'No' },
111
+ { text: 'Yes' },
112
+ { text: 'Yes' },
51
113
  ],
52
114
  [
53
- { content: 'Operations', modalContent: 'info' },
115
+ { text: 'Operations', modalContent: 'info' },
54
116
  { checkmarkValue: true, modalContent: 'Maybe' },
55
117
  { checkmarkValue: false },
56
118
  { checkmarkValue: true },
57
119
  ],
58
120
  [
59
- { content: 'Rating', modalContent: 'info' },
121
+ { text: 'Rating', modalContent: 'info' },
60
122
  { rating: { type: 'zap', value: 1 }, modalContent: 'Maybe' },
61
123
  { rating: { type: 'zap', value: 3 } },
62
124
  { rating: { type: 'star', value: 3 } },
@@ -70,19 +132,19 @@ const initialData: TableData = [
70
132
  },
71
133
  rows: [
72
134
  [
73
- { content: 'Regular vet visits & medication' },
74
- { content: 'No', checkmarkValue: false },
75
- { content: 'Yes' },
76
- { content: 'Yes' },
135
+ { text: 'Regular vet visits & medication' },
136
+ { text: 'No', checkmarkValue: false },
137
+ { text: 'Yes' },
138
+ { text: 'Yes' },
77
139
  ],
78
140
  [
79
- { content: 'Operations', modalContent: 'info' },
141
+ { text: 'Operations', modalContent: 'info' },
80
142
  { checkmarkValue: true, modalContent: 'Maybe' },
81
143
  { checkmarkValue: false },
82
144
  { checkmarkValue: true },
83
145
  ],
84
146
  [
85
- { content: 'Rating', modalContent: 'info' },
147
+ { text: 'Rating', modalContent: 'info' },
86
148
  { rating: { type: 'zap', value: 1 }, modalContent: 'Maybe' },
87
149
  { rating: { type: 'zap', value: 3 } },
88
150
  { rating: { type: 'star', value: 3 } },
@@ -180,7 +242,7 @@ type TableData = {
180
242
  rows: {
181
243
  align?: 'center' | 'left' | 'right';
182
244
  checkmarkValue?: boolean;
183
- content?: ReactNode;
245
+ text?: ReactNode;
184
246
  modalContent?: ReactNode;
185
247
  subContent?: ReactNode;
186
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
  ];
@@ -81,7 +78,7 @@ describe('Table', () => {
81
78
  it('shows a modal when clicking on info icon', async () => {
82
79
  const { user } = render(<Table tableData={tableData} title="Test Table" />);
83
80
 
84
- await user.click(screen.getByText('View more info'));
81
+ await user.click(screen.getByTestId('ds-table-info-button'));
85
82
 
86
83
  expect(screen.getByText('Additional item')).toBeVisible();
87
84
  });
@@ -1,6 +1,6 @@
1
1
  import { TableCell, TableCellProps } from './components/TableCell/TableCell';
2
2
  import { BottomOrRegularModal } from '../modal';
3
- import { useRef, useState } from 'react';
3
+ import { ReactNode, useRef, useState } from 'react';
4
4
  import { ChevronDownIcon, ChevronUpIcon } from '../icon';
5
5
  import { Card } from '../cards/card';
6
6
 
@@ -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;
@@ -60,7 +60,6 @@ const Table = ({
60
60
  const { activeSection, navigateTable } = useTableNavigation({
61
61
  enabled: isMobile,
62
62
  containerRef,
63
- columnsLength,
64
63
  onSelectionChanged,
65
64
  });
66
65
 
@@ -82,12 +81,15 @@ const Table = ({
82
81
  >
83
82
  <TableCell
84
83
  {...currentActiveSection}
85
- openModal={(body) =>
86
- handleOpenModal({
87
- body,
88
- title: currentActiveSection?.content,
89
- })
90
- }
84
+ {...(isBaseCell(currentActiveSection)
85
+ ? {
86
+ openModal: (body: ReactNode) =>
87
+ handleOpenModal({
88
+ body,
89
+ title: currentActiveSection?.text,
90
+ }),
91
+ }
92
+ : {})}
91
93
  isNavigation
92
94
  />
93
95
  </TableControls>
@@ -0,0 +1,36 @@
1
+ @use "../../../../../scss/public/grid" as *;
2
+ @use "../../../../../scss/public/colors" as *;
3
+
4
+ .infoButton {
5
+ min-height: initial;
6
+ height: initial;
7
+ width: initial;
8
+ padding: 0;
9
+ }
10
+
11
+ .icon {
12
+ margin: 2px;
13
+ }
14
+
15
+ .bigWithUnderline {
16
+ position: relative;
17
+ display: none;
18
+
19
+ &:after {
20
+ content: '';
21
+ display: block;
22
+ position: absolute;
23
+ top: calc(
24
+ 50% + 16px
25
+ ); // Display bottom border at the same distance regardless of cell height
26
+
27
+ height: 4px;
28
+ width: 100%;
29
+ max-width: 140px;
30
+ background-color: $ds-primary-500;
31
+ }
32
+
33
+ @include p-size-tablet {
34
+ display: flex;
35
+ }
36
+ }
@@ -0,0 +1,45 @@
1
+ import { BaseCell } from './BaseCell';
2
+
3
+ const story = {
4
+ title: 'JSX/Table/Cells',
5
+ component: BaseCell,
6
+ argTypes: {},
7
+ args: {
8
+ text: 'For dogs',
9
+ description: 'Annual only',
10
+ modalContent: 'More info',
11
+ fontVariant: 'NORMAL',
12
+ checkmarkValue: undefined,
13
+ rating: {
14
+ value: 2,
15
+ type: 'zap',
16
+ },
17
+ },
18
+ };
19
+
20
+ export const BaseCellStory = ({
21
+ text,
22
+ description,
23
+ modalContent,
24
+ checkmarkValue,
25
+ rating,
26
+ fontVariant,
27
+ align,
28
+ }: React.ComponentProps<typeof BaseCell>) => (
29
+ <div className="p48 d-flex fd-column gap16 bg-white">
30
+ <BaseCell
31
+ align={align}
32
+ checkmarkValue={checkmarkValue}
33
+ fontVariant={fontVariant}
34
+ description={description}
35
+ modalContent={modalContent}
36
+ openModal={() => {}}
37
+ rating={rating}
38
+ text={text}
39
+ />
40
+ </div>
41
+ );
42
+
43
+ BaseCellStory.storyName = 'BaseCell';
44
+
45
+ export default story;
@@ -0,0 +1,158 @@
1
+ import classNames from 'classnames';
2
+ import {
3
+ CheckIcon,
4
+ XIcon,
5
+ StarFilledIcon,
6
+ ZapFilledIcon,
7
+ } from '../../../../icon';
8
+ import { ReactNode } from 'react';
9
+ import styles from './BaseCell.module.scss';
10
+ import { MiniProgressBar } from './MiniProgressBar/MiniProgressBar';
11
+ import { TableInfoButton } from '../../../../comparisonTable';
12
+
13
+ export type FontVariant = 'NORMAL' | 'BIG_WITH_UNDERLINE' | 'PRICE';
14
+
15
+ const progressLookup: Record<string, number> = {
16
+ '30%': 1,
17
+ '50%': 2,
18
+ '70%': 3,
19
+ '75%': 4,
20
+ '80%': 4,
21
+ '90%': 4,
22
+ '75%-90%': 4,
23
+ '75%-100%': 4,
24
+ '80%-100%': 4,
25
+ '100%': 5,
26
+ };
27
+
28
+ export type Alignment = 'center' | 'left' | 'right';
29
+
30
+ export type BaseCellProps = {
31
+ align?: Alignment;
32
+ checkmarkValue?: boolean;
33
+ fontVariant?: FontVariant;
34
+ description?: ReactNode;
35
+ modalContent?: ReactNode;
36
+ openModal?: (modalContent: ReactNode) => void;
37
+ text?: ReactNode;
38
+ rating?: {
39
+ value: number;
40
+ type: 'zap' | 'star';
41
+ };
42
+ };
43
+
44
+ export const BaseCell = ({
45
+ align = 'center',
46
+ checkmarkValue,
47
+ fontVariant = 'NORMAL',
48
+ description = '',
49
+ modalContent = '',
50
+ openModal,
51
+ rating,
52
+ text = '',
53
+ }: BaseCellProps) => {
54
+ const alignClassName = {
55
+ center: 'ta-center jc-center ai-center',
56
+ left: 'ta-left jc-start',
57
+ right: 'ta-right jc-end ai-end',
58
+ }[align];
59
+
60
+ const validRatingValues: number[] = [1, 2, 3];
61
+ const SelectedIcon = rating?.type === 'zap' ? ZapFilledIcon : StarFilledIcon;
62
+
63
+ const progressBarValue =
64
+ typeof text === 'string' ? progressLookup[text] : undefined;
65
+
66
+ return (
67
+ <div
68
+ className={classNames('d-flex gap8 ai-center', {
69
+ 'jc-center': align === 'center',
70
+ })}
71
+ >
72
+ <div className={classNames('d-flex fd-column', alignClassName)}>
73
+ {progressBarValue !== undefined && (
74
+ <MiniProgressBar nFilledBars={progressBarValue} />
75
+ )}
76
+
77
+ {rating?.value && (
78
+ <span
79
+ data-testid="table-cell-rating"
80
+ title={`${rating?.value} out of 3`}
81
+ >
82
+ {validRatingValues.map((value) => (
83
+ <SelectedIcon
84
+ aria-hidden="true"
85
+ key={value}
86
+ color={value <= rating?.value ? 'primary-500' : 'grey-400'}
87
+ className={styles.icon}
88
+ />
89
+ ))}
90
+ </span>
91
+ )}
92
+
93
+ <div className="d-flex ai-center">
94
+ {checkmarkValue !== undefined && (
95
+ <span title={checkmarkValue ? 'Yes' : 'No'}>
96
+ {checkmarkValue ? (
97
+ <CheckIcon
98
+ data-testid="table-cell-boolean-yes"
99
+ size={24}
100
+ aria-hidden
101
+ color="primary-500"
102
+ />
103
+ ) : (
104
+ <XIcon
105
+ data-testid="table-cell-boolean-no"
106
+ size={24}
107
+ aria-hidden
108
+ color="grey-400"
109
+ />
110
+ )}
111
+ </span>
112
+ )}
113
+
114
+ {text && fontVariant === 'NORMAL' && (
115
+ <div className="p-p" data-testid="table-cell-text">
116
+ {text}
117
+ </div>
118
+ )}
119
+
120
+ {text && fontVariant === 'PRICE' && (
121
+ <div
122
+ className="p-h1 p--serif tc-primary-500"
123
+ data-testid="table-cell-content"
124
+ >
125
+ {text}
126
+ </div>
127
+ )}
128
+
129
+ {text && fontVariant === 'BIG_WITH_UNDERLINE' && (
130
+ <div
131
+ aria-hidden
132
+ className={classNames(
133
+ 'tc-grey-800 p-h2 p--serif',
134
+ styles.bigWithUnderline
135
+ )}
136
+ >
137
+ {text}
138
+ </div>
139
+ )}
140
+ </div>
141
+
142
+ {description && (
143
+ <div
144
+ className={classNames(
145
+ 'd-flex p-p--small tc-grey-500',
146
+ alignClassName
147
+ )}
148
+ >
149
+ {description}
150
+ </div>
151
+ )}
152
+ </div>
153
+ {modalContent && openModal && (
154
+ <TableInfoButton onClick={() => openModal(modalContent)} />
155
+ )}
156
+ </div>
157
+ );
158
+ };
@@ -0,0 +1,44 @@
1
+ @use "../../../../../../scss/public/colors" as *;
2
+
3
+ $defaultColor: $ds-purple-100;
4
+ $oneOrTwoColor: $ds-grey-500;
5
+ $threeOrFourColor: $ds-blue-300;
6
+ $allFilledColor: $ds-purple-500;
7
+
8
+ .progressBar {
9
+ margin-bottom: 4px;
10
+
11
+ rect {
12
+ fill: $defaultColor;
13
+ }
14
+ }
15
+
16
+ .filledBars1 {
17
+ rect:first-child {
18
+ fill: $oneOrTwoColor;
19
+ }
20
+ }
21
+
22
+ .filledBars2 {
23
+ rect:nth-child(-n + 2) {
24
+ fill: $oneOrTwoColor;
25
+ }
26
+ }
27
+
28
+ .filledBars3 {
29
+ rect:nth-child(-n + 3) {
30
+ fill: $threeOrFourColor;
31
+ }
32
+ }
33
+
34
+ .filledBars4 {
35
+ rect:nth-child(-n + 4) {
36
+ fill: $threeOrFourColor;
37
+ }
38
+ }
39
+
40
+ .filledBars5 {
41
+ rect {
42
+ fill: $allFilledColor;
43
+ }
44
+ }
@@ -0,0 +1,29 @@
1
+ import { MiniProgressBar } from './MiniProgressBar';
2
+
3
+ const story = {
4
+ title: 'JSX/Table/Misc',
5
+ component: MiniProgressBar,
6
+ argTypes: {
7
+ nFilledBars: {
8
+ description: 'Number of filled bars to show (0-5)',
9
+ control: {
10
+ min: 0,
11
+ max: 5,
12
+ type: 'number',
13
+ },
14
+ },
15
+ },
16
+ args: {
17
+ nFilledBars: 3,
18
+ },
19
+ };
20
+
21
+ export const MiniProgressBarStory = ({
22
+ nFilledBars,
23
+ }: React.ComponentProps<typeof MiniProgressBar>) => (
24
+ <MiniProgressBar nFilledBars={nFilledBars} />
25
+ );
26
+
27
+ MiniProgressBarStory.storyName = 'MiniProgressBar';
28
+
29
+ export default story;
@@ -0,0 +1,35 @@
1
+ import classNames from 'classnames';
2
+
3
+ import styles from './MiniProgressBar.module.scss';
4
+
5
+ export const MiniProgressBar = ({ nFilledBars }: { nFilledBars: number }) => (
6
+ <svg
7
+ className={classNames(
8
+ styles.progressBar,
9
+ styles[`filledBars${nFilledBars}`]
10
+ )}
11
+ width="40"
12
+ height="6"
13
+ viewBox="0 0 40 6"
14
+ fill="none"
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ >
17
+ <g clipPath="url(#clip0_37507_20658)">
18
+ <rect id="r1" x="0.5" y="0.5" width="7" height="5" rx="1" />
19
+ <rect id="r2" x="8.5" y="0.5" width="7" height="5" rx="1" />
20
+ <rect id="r3" x="16.5" y="0.5" width="7" height="5" rx="1" />
21
+ <rect id="r4" x="24.5" y="0.5" width="7" height="5" rx="1" />
22
+ <rect id="r5" x="32.5" y="0.5" width="7" height="5" rx="1" />
23
+ </g>
24
+ <defs>
25
+ <clipPath id="clip0_37507_20658">
26
+ <rect
27
+ width="39"
28
+ height="5"
29
+ fill="white"
30
+ transform="translate(0.5 0.5)"
31
+ />
32
+ </clipPath>
33
+ </defs>
34
+ </svg>
35
+ );
@@ -0,0 +1,43 @@
1
+ @use "../../../../../scss/public/grid" as *;
2
+ @use "../../../../../scss/public/colors" as *;
3
+
4
+ .buttonCell {
5
+ color: $ds-grey-900;
6
+ border: 1px solid $ds-grey-400;
7
+
8
+ transition: all 0.3s ease-in-out;
9
+
10
+ @include p-size-mobile {
11
+ max-width: calc(100% - 96px);
12
+ }
13
+
14
+ &:disabled {
15
+ border: none;
16
+ background-color: $ds-grey-200;
17
+ color: $ds-grey-900;
18
+ opacity: 1;
19
+ cursor: default;
20
+
21
+ &:hover {
22
+ background-color: $ds-grey-200;
23
+ }
24
+ }
25
+
26
+ @include p-size-mobile {
27
+ pointer-events: none;
28
+ }
29
+ }
30
+
31
+ .withoutPrice {
32
+ height: 64px;
33
+ }
34
+
35
+ .withPrice {
36
+ height: 75px;
37
+ }
38
+
39
+ .selected {
40
+ transition: all 0.3 ease-in-out;
41
+ border: 2px solid $ds-purple-500;
42
+ background-color: $ds-purple-50;
43
+ }