@popsure/dirty-swan 0.26.10 → 0.26.11
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/package.json +2 -1
- package/src/App.tsx +50 -0
- package/src/bin/index.ts +71 -0
- package/src/bin/tsconfig.json +13 -0
- package/src/bin/util/index.test.ts +85 -0
- package/src/bin/util/index.ts +132 -0
- package/src/bin/util/test/data.json +13 -0
- package/src/colors.scss +1 -0
- package/src/font-weight.scss +1 -0
- package/src/grid.scss +1 -0
- package/src/index.tsx +37 -0
- package/src/intro.stories.mdx +41 -0
- package/src/lib/components/autocompleteAddress/demo.tsx +38 -0
- package/src/lib/components/autocompleteAddress/index.stories.mdx +44 -0
- package/src/lib/components/autocompleteAddress/index.tsx +316 -0
- package/src/lib/components/autocompleteAddress/mapStyle.ts +187 -0
- package/src/lib/components/autocompleteAddress/style.module.scss +82 -0
- package/src/lib/components/autocompleteAddress/util/index.test.ts +51 -0
- package/src/lib/components/autocompleteAddress/util/index.ts +55 -0
- package/src/lib/components/button/icons/index.ts +14 -0
- package/src/lib/components/button/icons/send-purple.svg +4 -0
- package/src/lib/components/button/icons/send-white.svg +4 -0
- package/src/lib/components/button/index.stories.mdx +121 -0
- package/src/lib/components/button/index.tsx +64 -0
- package/src/lib/components/button/styles.module.scss +5 -0
- package/src/lib/components/cards/a.stories.mdx +44 -0
- package/src/lib/components/cards/cardButton/index.stories.mdx +47 -0
- package/src/lib/components/cards/cardButton/index.tsx +61 -0
- package/src/lib/components/cards/cardButton/style.module.scss +33 -0
- package/src/lib/components/cards/cardWithLeftIcon/index.stories.mdx +103 -0
- package/src/lib/components/cards/cardWithLeftIcon/index.tsx +87 -0
- package/src/lib/components/cards/cardWithLeftIcon/style.module.scss +23 -0
- package/src/lib/components/cards/cardWithTopIcon/index.stories.mdx +105 -0
- package/src/lib/components/cards/cardWithTopIcon/index.tsx +60 -0
- package/src/lib/components/cards/cardWithTopIcon/style.module.scss +10 -0
- package/src/lib/components/cards/cardWithTopLeftIcon/index.stories.mdx +101 -0
- package/src/lib/components/cards/cardWithTopLeftIcon/index.tsx +72 -0
- package/src/lib/components/cards/cardWithTopLeftIcon/style.module.scss +21 -0
- package/src/lib/components/cards/icons/arrow-right.svg +4 -0
- package/src/lib/components/cards/icons/chevron-right.svg +3 -0
- package/src/lib/components/cards/icons/feather-logo.svg +10 -0
- package/src/lib/components/cards/icons/index.ts +36 -0
- package/src/lib/components/cards/icons/info.svg +12 -0
- package/src/lib/components/cards/index.test.ts +37 -0
- package/src/lib/components/cards/index.tsx +57 -0
- package/src/lib/components/cards/infoCard/index.stories.mdx +61 -0
- package/src/lib/components/cards/infoCard/index.tsx +47 -0
- package/src/lib/components/cards/infoCard/style.module.scss +53 -0
- package/src/lib/components/chip/icons/remove-button-highlighted.svg +4 -0
- package/src/lib/components/chip/icons/remove-button.svg +4 -0
- package/src/lib/components/chip/index.stories.mdx +101 -0
- package/src/lib/components/chip/index.tsx +38 -0
- package/src/lib/components/chip/style.module.scss +54 -0
- package/src/lib/components/comparisonTable/components/Chevron.tsx +19 -0
- package/src/lib/components/comparisonTable/components/Row/index.tsx +68 -0
- package/src/lib/components/comparisonTable/components/Row/style.module.scss +114 -0
- package/src/lib/components/comparisonTable/components/TableArrows/Arrow.tsx +19 -0
- package/src/lib/components/comparisonTable/components/TableArrows/index.tsx +52 -0
- package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +53 -0
- package/src/lib/components/comparisonTable/components/TableInfoButton/index.tsx +37 -0
- package/src/lib/components/comparisonTable/components/TableInfoButton/style.module.scss +30 -0
- package/src/lib/components/comparisonTable/components/TableRating/StarIcon.tsx +13 -0
- package/src/lib/components/comparisonTable/components/TableRating/ZapIcon.tsx +17 -0
- package/src/lib/components/comparisonTable/components/TableRating/index.tsx +45 -0
- package/src/lib/components/comparisonTable/components/TableRating/style.module.scss +13 -0
- package/src/lib/components/comparisonTable/components/TableRowHeader/index.tsx +35 -0
- package/src/lib/components/comparisonTable/components/TableRowHeader/style.module.scss +3 -0
- package/src/lib/components/comparisonTable/components/TableTrueFalse.tsx +40 -0
- package/src/lib/components/comparisonTable/hooks/useActiveTableArrows.ts +63 -0
- package/src/lib/components/comparisonTable/index.stories.mdx +254 -0
- package/src/lib/components/comparisonTable/index.tsx +211 -0
- package/src/lib/components/comparisonTable/style.module.scss +104 -0
- package/src/lib/components/dateSelector/datepicker.scss +406 -0
- package/src/lib/components/dateSelector/icons/calendar.svg +6 -0
- package/src/lib/components/dateSelector/icons/chevron-left.svg +3 -0
- package/src/lib/components/dateSelector/icons/chevron-right.svg +3 -0
- package/src/lib/components/dateSelector/index.stories.mdx +62 -0
- package/src/lib/components/dateSelector/index.test.ts +33 -0
- package/src/lib/components/dateSelector/index.tsx +247 -0
- package/src/lib/components/dateSelector/style.module.scss +77 -0
- package/src/lib/components/downloadButton/icons/check.svg +3 -0
- package/src/lib/components/downloadButton/icons/download.svg +5 -0
- package/src/lib/components/downloadButton/index.stories.mdx +59 -0
- package/src/lib/components/downloadButton/index.tsx +67 -0
- package/src/lib/components/downloadButton/style.module.scss +19 -0
- package/src/lib/components/downloadRing/icons/check-outside-circle.tsx +26 -0
- package/src/lib/components/downloadRing/icons/download-cloud.tsx +18 -0
- package/src/lib/components/downloadRing/icons/style.module.scss +7 -0
- package/src/lib/components/downloadRing/index.stories.mdx +35 -0
- package/src/lib/components/downloadRing/index.tsx +79 -0
- package/src/lib/components/downloadRing/style.module.scss +66 -0
- package/src/lib/components/dropzone/images/error.tsx +18 -0
- package/src/lib/components/dropzone/images/file.tsx +26 -0
- package/src/lib/components/dropzone/images/style.module.scss +7 -0
- package/src/lib/components/dropzone/images/upload-complete.tsx +24 -0
- package/src/lib/components/dropzone/images/upload.tsx +18 -0
- package/src/lib/components/dropzone/index.stories.mdx +44 -0
- package/src/lib/components/dropzone/index.tsx +152 -0
- package/src/lib/components/dropzone/style.module.scss +90 -0
- package/src/lib/components/input/a.stories.mdx +28 -0
- package/src/lib/components/input/autoSuggestInput/index.stories.mdx +137 -0
- package/src/lib/components/input/autoSuggestInput/index.tsx +81 -0
- package/src/lib/components/input/autoSuggestInput/style.module.scss +71 -0
- package/src/lib/components/input/autoSuggestMultiSelect/index.stories.mdx +115 -0
- package/src/lib/components/input/autoSuggestMultiSelect/index.tsx +75 -0
- package/src/lib/components/input/autoSuggestMultiSelect/style.module.scss +4 -0
- package/src/lib/components/input/currency/format/index.test.ts +49 -0
- package/src/lib/components/input/currency/format/index.ts +15 -0
- package/src/lib/components/input/currency/index.stories.mdx +25 -0
- package/src/lib/components/input/currency/index.test.tsx +56 -0
- package/src/lib/components/input/currency/index.tsx +53 -0
- package/src/lib/components/input/iban/formatIban/index.test.ts +11 -0
- package/src/lib/components/input/iban/formatIban/index.ts +22 -0
- package/src/lib/components/input/iban/index.stories.mdx +21 -0
- package/src/lib/components/input/iban/index.tsx +20 -0
- package/src/lib/components/input/index.stories.mdx +62 -0
- package/src/lib/components/input/index.tsx +51 -0
- package/src/lib/components/input/style.module.scss +94 -0
- package/src/lib/components/modal/bottomModal/img/close.svg +4 -0
- package/src/lib/components/modal/bottomModal/index.tsx +68 -0
- package/src/lib/components/modal/bottomModal/style.module.scss +104 -0
- package/src/lib/components/modal/bottomOrRegularModal/index.tsx +43 -0
- package/src/lib/components/modal/bottomOrRegularModal/style.module.scss +16 -0
- package/src/lib/components/modal/hooks/useOnClose.ts +51 -0
- package/src/lib/components/modal/index.stories.mdx +316 -0
- package/src/lib/components/modal/index.ts +14 -0
- package/src/lib/components/modal/regularModal/img/close.svg +4 -0
- package/src/lib/components/modal/regularModal/index.tsx +55 -0
- package/src/lib/components/modal/regularModal/style.module.scss +106 -0
- package/src/lib/components/multiDropzone/UploadFileCell/index.tsx +138 -0
- package/src/lib/components/multiDropzone/UploadFileCell/style.module.scss +101 -0
- package/src/lib/components/multiDropzone/icons/bmp-complete.svg +10 -0
- package/src/lib/components/multiDropzone/icons/bmp.svg +10 -0
- package/src/lib/components/multiDropzone/icons/doc-complete.svg +11 -0
- package/src/lib/components/multiDropzone/icons/doc.svg +11 -0
- package/src/lib/components/multiDropzone/icons/docx-complete.svg +12 -0
- package/src/lib/components/multiDropzone/icons/docx.svg +12 -0
- package/src/lib/components/multiDropzone/icons/eye.svg +4 -0
- package/src/lib/components/multiDropzone/icons/generic-complete.svg +4 -0
- package/src/lib/components/multiDropzone/icons/generic-error.svg +7 -0
- package/src/lib/components/multiDropzone/icons/generic.svg +4 -0
- package/src/lib/components/multiDropzone/icons/heic-complete.svg +11 -0
- package/src/lib/components/multiDropzone/icons/heic.svg +11 -0
- package/src/lib/components/multiDropzone/icons/index.ts +51 -0
- package/src/lib/components/multiDropzone/icons/jpeg-complete.svg +11 -0
- package/src/lib/components/multiDropzone/icons/jpeg.svg +11 -0
- package/src/lib/components/multiDropzone/icons/jpg-complete.svg +10 -0
- package/src/lib/components/multiDropzone/icons/jpg.svg +10 -0
- package/src/lib/components/multiDropzone/icons/pdf-complete.svg +8 -0
- package/src/lib/components/multiDropzone/icons/pdf.svg +8 -0
- package/src/lib/components/multiDropzone/icons/png-complete.svg +10 -0
- package/src/lib/components/multiDropzone/icons/png.svg +10 -0
- package/src/lib/components/multiDropzone/icons/trash.svg +6 -0
- package/src/lib/components/multiDropzone/icons/upload.svg +5 -0
- package/src/lib/components/multiDropzone/index.stories.mdx +91 -0
- package/src/lib/components/multiDropzone/index.tsx +99 -0
- package/src/lib/components/multiDropzone/style.module.scss +32 -0
- package/src/lib/components/segmentedControl/index.stories.mdx +47 -0
- package/src/lib/components/segmentedControl/index.tsx +105 -0
- package/src/lib/components/segmentedControl/style.module.scss +36 -0
- package/src/lib/components/signaturePad/img/reset.svg +4 -0
- package/src/lib/components/signaturePad/img/sign.svg +3 -0
- package/src/lib/components/signaturePad/index.stories.mdx +17 -0
- package/src/lib/components/signaturePad/index.tsx +96 -0
- package/src/lib/components/signaturePad/style.module.scss +90 -0
- package/src/lib/index.tsx +71 -0
- package/src/lib/models/autoSuggestInput/index.ts +4 -0
- package/src/lib/models/download.ts +1 -0
- package/src/lib/models/downloadRing/index.ts +6 -0
- package/src/lib/scss/index.scss +22 -0
- package/src/lib/scss/private/_reset.scss +149 -0
- package/src/lib/scss/private/base/_colors.scss +19 -0
- package/src/lib/scss/private/base/_cursors.scss +31 -0
- package/src/lib/scss/private/base/_display.scss +35 -0
- package/src/lib/scss/private/base/_grid.scss +52 -0
- package/src/lib/scss/private/base/_index.scss +9 -0
- package/src/lib/scss/private/base/_shadows.scss +2 -0
- package/src/lib/scss/private/base/_spacing.scss +89 -0
- package/src/lib/scss/private/base/_typography.scss +128 -0
- package/src/lib/scss/private/base/_width_and_height.scss +25 -0
- package/src/lib/scss/private/base/cursors.stories.mdx +18 -0
- package/src/lib/scss/private/base/demo.tsx +119 -0
- package/src/lib/scss/private/base/display.stories.mdx +19 -0
- package/src/lib/scss/private/base/flex/_flex.scss +63 -0
- package/src/lib/scss/private/base/flex/flex.stories.mdx +139 -0
- package/src/lib/scss/private/base/flex/style.module.scss +24 -0
- package/src/lib/scss/private/base/spacing.stories.mdx +173 -0
- package/src/lib/scss/private/base/style.module.scss +42 -0
- package/src/lib/scss/private/base/typography.stories.mdx +71 -0
- package/src/lib/scss/private/base/width_and_height.stories.mdx +172 -0
- package/src/lib/scss/private/components/_badge.scss +41 -0
- package/src/lib/scss/private/components/_buttons.scss +193 -0
- package/src/lib/scss/private/components/_cards.scss +32 -0
- package/src/lib/scss/private/components/_index.scss +6 -0
- package/src/lib/scss/private/components/_input.scss +241 -0
- package/src/lib/scss/private/components/_notices.scss +39 -0
- package/src/lib/scss/private/components/_spinner.scss +60 -0
- package/src/lib/scss/private/components/assets/checkmark.svg +3 -0
- package/src/lib/scss/private/components/assets/icon-form-dropdown.svg +3 -0
- package/src/lib/scss/private/components/badge.stories.mdx +37 -0
- package/src/lib/scss/private/components/button.stories.mdx +107 -0
- package/src/lib/scss/private/components/cards.stories.mdx +35 -0
- package/src/lib/scss/private/components/checkbox.stories.mdx +47 -0
- package/src/lib/scss/private/components/input.stories.mdx +33 -0
- package/src/lib/scss/private/components/notices.stories.mdx +37 -0
- package/src/lib/scss/private/components/radio.stories.mdx +47 -0
- package/src/lib/scss/private/components/select.stories.mdx +17 -0
- package/src/lib/scss/private/components/spinner.stories.mdx +25 -0
- package/src/lib/scss/public/colors/_index.scss +2 -0
- package/src/lib/scss/public/colors/default.scss +125 -0
- package/src/lib/scss/public/colors/overrides.scss +0 -0
- package/src/lib/scss/public/colors.stories.mdx +27 -0
- package/src/lib/scss/public/demo.tsx +285 -0
- package/src/lib/scss/public/font/_index.scss +2 -0
- package/src/lib/scss/public/font/default.scss +3 -0
- package/src/lib/scss/public/font/overrides.scss +0 -0
- package/src/lib/scss/public/font-weight.scss +9 -0
- package/src/lib/scss/public/font-weight.stories.mdx +32 -0
- package/src/lib/scss/public/grid.scss +21 -0
- package/src/lib/scss/public/grid.stories.mdx +41 -0
- package/src/lib/scss/third-party/_google_places.scss +62 -0
- package/src/lib/scss/third-party/_index.scss +1 -0
- package/src/lib/scss/utils/_index.scss +3 -0
- package/src/lib/util/calendarDate/index.test.ts +32 -0
- package/src/lib/util/calendarDate/index.ts +30 -0
- package/src/lib/util/zeroFill.test.ts +15 -0
- package/src/lib/util/zeroFill.ts +7 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/setupTests.js +8 -0
- package/src/theme.stories.mdx +54 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@use "../../../scss/public/grid" as *;
|
|
2
|
+
|
|
3
|
+
@keyframes appear-in {
|
|
4
|
+
from {
|
|
5
|
+
opacity: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
to {
|
|
9
|
+
opacity: 1;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.root-container {
|
|
14
|
+
position: relative;
|
|
15
|
+
padding-top: 40px;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
.right-icon {
|
|
19
|
+
visibility: visible;
|
|
20
|
+
|
|
21
|
+
animation-name: appear-in;
|
|
22
|
+
animation-duration: 0.3s;
|
|
23
|
+
animation-fill-mode: both;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.top-icon {
|
|
29
|
+
position: absolute;
|
|
30
|
+
|
|
31
|
+
left: 50%;
|
|
32
|
+
transform: translateX(-50%) translateY(-40px);
|
|
33
|
+
|
|
34
|
+
&--muted {
|
|
35
|
+
opacity: 0.25;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.right-icon {
|
|
40
|
+
visibility: hidden;
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 64px;
|
|
43
|
+
right: 24px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.container {
|
|
47
|
+
padding: 0 24px 24px 24px;
|
|
48
|
+
height: 100%;
|
|
49
|
+
|
|
50
|
+
@include p-size-mobile {
|
|
51
|
+
height: fit-content;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 4L4 12" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
3
|
+
<path d="M4 4L12 12" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12.4167 4L4.41666 12" stroke="#B1B0F5" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
3
|
+
<path d="M4.41666 4L12.4167 12" stroke="#B1B0F5" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Meta, Preview } from '@storybook/addon-docs/blocks';
|
|
3
|
+
|
|
4
|
+
import Chip from '.';
|
|
5
|
+
import featherLogo from '../cards/icons/feather-logo.svg';
|
|
6
|
+
|
|
7
|
+
<Meta title="JSX/Chip" />
|
|
8
|
+
|
|
9
|
+
# Chip
|
|
10
|
+
|
|
11
|
+
Chip component displays text and image (optional) of given values.
|
|
12
|
+
|
|
13
|
+
The X button in the right calls the prop `onRemove` function to keep track of removed selected values.
|
|
14
|
+
|
|
15
|
+
<Preview>
|
|
16
|
+
<iframe
|
|
17
|
+
width="100%"
|
|
18
|
+
height="450"
|
|
19
|
+
src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FMKs4cbojdVOBKUxv7okb93%2FDirty-Swan-Design-System%3Fnode-id%3D245%253A42"
|
|
20
|
+
allowFullScreen
|
|
21
|
+
></iframe>
|
|
22
|
+
</Preview>
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
export const ChipStory = () => {
|
|
27
|
+
const values = [
|
|
28
|
+
{ value: 'feather', leftIcon: featherLogo },
|
|
29
|
+
{ value: 'feather2', leftIcon: featherLogo },
|
|
30
|
+
{
|
|
31
|
+
value: 'feather3',
|
|
32
|
+
leftIcon: featherLogo,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: 'dirtyswan',
|
|
36
|
+
leftIcon: featherLogo,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: 'test value',
|
|
40
|
+
leftIcon: featherLogo,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
const [selectedValues, setSelectedValues] = useState(values);
|
|
44
|
+
return (
|
|
45
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
46
|
+
{selectedValues.map((value) => (
|
|
47
|
+
<Chip
|
|
48
|
+
value={value}
|
|
49
|
+
onRemove={(value) => {
|
|
50
|
+
const newValues = [...selectedValues].filter(
|
|
51
|
+
(selectedValue) => selectedValue.value !== value.value
|
|
52
|
+
);
|
|
53
|
+
setSelectedValues(newValues);
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
<ChipStory />
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import React, { useState } from 'react';
|
|
65
|
+
import { Chip } from '@popsure/dirty-swan';
|
|
66
|
+
|
|
67
|
+
export default () => {
|
|
68
|
+
const values = [
|
|
69
|
+
{ value: 'feather', leftIcon: featherLogo },
|
|
70
|
+
{ value: 'feather2', leftIcon: featherLogo },
|
|
71
|
+
{
|
|
72
|
+
value: 'feather3',
|
|
73
|
+
leftIcon: featherLogo,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
value: 'dirtyswan',
|
|
77
|
+
leftIcon: featherLogo,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
value: 'test value',
|
|
81
|
+
leftIcon: featherLogo,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
const [selectedValues, setSelectedValues] = useState(values);
|
|
85
|
+
return (
|
|
86
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
87
|
+
{selectedValues.map((value) => (
|
|
88
|
+
<Chip
|
|
89
|
+
value={value}
|
|
90
|
+
onRemove={(value) => {
|
|
91
|
+
const newValues = [...selectedValues].filter(
|
|
92
|
+
(selectedValue) => selectedValue.value !== value.value
|
|
93
|
+
);
|
|
94
|
+
setSelectedValues(newValues);
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styles from './style.module.scss';
|
|
2
|
+
import removeButtonIcon from './icons/remove-button.svg';
|
|
3
|
+
import removeButtonHighlightedIcon from './icons/remove-button-highlighted.svg';
|
|
4
|
+
import { Option } from '../../models/autoSuggestInput';
|
|
5
|
+
|
|
6
|
+
export default ({
|
|
7
|
+
value,
|
|
8
|
+
onRemove,
|
|
9
|
+
}: {
|
|
10
|
+
value: Option;
|
|
11
|
+
onRemove: (value: Option) => void;
|
|
12
|
+
}) => (
|
|
13
|
+
<div className={`p-p mr8 mb8 d-flex ${styles['chip']}`}>
|
|
14
|
+
{value.leftIcon && (
|
|
15
|
+
<img
|
|
16
|
+
className={`mr8 ${styles['chip-image']}`}
|
|
17
|
+
src={value.leftIcon}
|
|
18
|
+
alt={value.value}
|
|
19
|
+
/>
|
|
20
|
+
)}
|
|
21
|
+
<div className="mr8">{value.value}</div>
|
|
22
|
+
<div
|
|
23
|
+
className={`c-pointer ${styles['chip-button-container']}`}
|
|
24
|
+
onClick={() => onRemove(value)}
|
|
25
|
+
>
|
|
26
|
+
<img
|
|
27
|
+
className={styles['chip-remove-button-highlighted']}
|
|
28
|
+
src={removeButtonHighlightedIcon}
|
|
29
|
+
alt="removal x button highlighted"
|
|
30
|
+
/>
|
|
31
|
+
<img
|
|
32
|
+
className={styles['chip-remove-button']}
|
|
33
|
+
src={removeButtonIcon}
|
|
34
|
+
alt="removal x button"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.chip {
|
|
2
|
+
background: var(--ds-primary-100);
|
|
3
|
+
|
|
4
|
+
border: 2px solid var(--ds-primary-100);
|
|
5
|
+
border-radius: 8px;
|
|
6
|
+
|
|
7
|
+
padding: 4px 8px;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
width: -moz-fit-content;
|
|
10
|
+
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
|
|
14
|
+
animation-name: appearInAnimation;
|
|
15
|
+
animation-duration: 0.5s;
|
|
16
|
+
animation-fill-mode: both;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.chip:hover {
|
|
20
|
+
transition: 0.2s ease-in;
|
|
21
|
+
border: 2px solid var(--ds-primary-500);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.chip-image {
|
|
25
|
+
width: 24px;
|
|
26
|
+
height: 14px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.chip-button-container {
|
|
30
|
+
width: 16px;
|
|
31
|
+
height: 16px;
|
|
32
|
+
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.chip-remove-button,
|
|
37
|
+
.chip-remove-button-highlighted {
|
|
38
|
+
position: absolute;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.chip-remove-button:hover {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@keyframes appearInAnimation {
|
|
46
|
+
from {
|
|
47
|
+
opacity: 0;
|
|
48
|
+
transform: translateX(16px);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
to {
|
|
52
|
+
opacity: 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const Chevron = ({ className }: { className?: string }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width="20"
|
|
4
|
+
height="20"
|
|
5
|
+
fill="none"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
className={className}
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M15 12.5l-5-5-5 5"
|
|
11
|
+
stroke="#8E8CEE"
|
|
12
|
+
strokeWidth="2"
|
|
13
|
+
strokeLinecap="round"
|
|
14
|
+
strokeLinejoin="round"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default Chevron;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Cell } from '../../index';
|
|
4
|
+
|
|
5
|
+
import styles from './style.module.scss';
|
|
6
|
+
|
|
7
|
+
interface RowProps<T> {
|
|
8
|
+
cell: Cell<T>;
|
|
9
|
+
data: Array<T>;
|
|
10
|
+
isRowHeader?: boolean;
|
|
11
|
+
rowId: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Row = <T extends { id: number }>(props: RowProps<T>) => {
|
|
15
|
+
const { cell, data, isRowHeader, rowId } = props;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
key={rowId}
|
|
20
|
+
className={`
|
|
21
|
+
d-flex
|
|
22
|
+
w-100
|
|
23
|
+
${isRowHeader ? styles.header : ''}
|
|
24
|
+
`}
|
|
25
|
+
>
|
|
26
|
+
<h4
|
|
27
|
+
className={`
|
|
28
|
+
wmx4
|
|
29
|
+
${styles.cell}
|
|
30
|
+
${styles.sticky}
|
|
31
|
+
${isRowHeader ? `p-h2 p--serif ${styles.title}` : ''}
|
|
32
|
+
${typeof cell.key === 'undefined' ? styles.addon : ''}
|
|
33
|
+
`}
|
|
34
|
+
>
|
|
35
|
+
{cell.label}
|
|
36
|
+
</h4>
|
|
37
|
+
|
|
38
|
+
{Array.isArray(data) &&
|
|
39
|
+
data.map((item) => {
|
|
40
|
+
/**
|
|
41
|
+
* Do not render a cell if
|
|
42
|
+
* the data source object doesn't have the current key
|
|
43
|
+
*/
|
|
44
|
+
if (typeof cell.key === 'undefined') return null;
|
|
45
|
+
if (typeof item[cell.key] === 'undefined') return null;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
className={`ta-center ${styles.cell}`}
|
|
50
|
+
key={`${rowId}-${item.id}`}
|
|
51
|
+
>
|
|
52
|
+
{
|
|
53
|
+
/**
|
|
54
|
+
* Return a function if `render` option is present
|
|
55
|
+
* else print the current data source value
|
|
56
|
+
*/
|
|
57
|
+
typeof cell.render === 'function'
|
|
58
|
+
? cell.render(item[cell.key], item)
|
|
59
|
+
: `${item[cell.key]}`
|
|
60
|
+
}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
})}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default React.memo(Row) as typeof Row;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@use "../../../../scss/public/colors" as *;
|
|
2
|
+
@use "../../../../scss/public/grid" as *;
|
|
3
|
+
|
|
4
|
+
$cell-min-width: 256px;
|
|
5
|
+
|
|
6
|
+
.header {
|
|
7
|
+
position: relative;
|
|
8
|
+
|
|
9
|
+
& > div {
|
|
10
|
+
width: 100vw;
|
|
11
|
+
|
|
12
|
+
&:nth-child(n + 3) {
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@include p-size-tablet {
|
|
17
|
+
width: $cell-min-width;
|
|
18
|
+
scroll-snap-align: unset;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.cell {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
align-items: center;
|
|
27
|
+
|
|
28
|
+
scroll-snap-align: end;
|
|
29
|
+
|
|
30
|
+
line-height: 24px;
|
|
31
|
+
|
|
32
|
+
padding: 16px;
|
|
33
|
+
|
|
34
|
+
color: $ds-grey-700;
|
|
35
|
+
|
|
36
|
+
width: 50vw;
|
|
37
|
+
|
|
38
|
+
&:first-child {
|
|
39
|
+
background-color: white;
|
|
40
|
+
/** Add scroll snap to every column except the first one */
|
|
41
|
+
scroll-snap-align: unset;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:nth-child(n + 3) {
|
|
45
|
+
margin-left: 50vw;
|
|
46
|
+
|
|
47
|
+
@include p-size-tablet {
|
|
48
|
+
margin-left: unset;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@include p-size-tablet {
|
|
53
|
+
flex: 1 0 $cell-min-width;
|
|
54
|
+
width: $cell-min-width;
|
|
55
|
+
padding: 24px;
|
|
56
|
+
|
|
57
|
+
&:last-child {
|
|
58
|
+
padding: 24px 8px 24px 24px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.title {
|
|
64
|
+
position: relative;
|
|
65
|
+
color: $ds-grey-900;
|
|
66
|
+
|
|
67
|
+
display: none;
|
|
68
|
+
|
|
69
|
+
&:after {
|
|
70
|
+
content: '';
|
|
71
|
+
display: block;
|
|
72
|
+
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: calc(
|
|
75
|
+
50% + 16px
|
|
76
|
+
); // Display bottom border at the same distance regardless of cell height
|
|
77
|
+
|
|
78
|
+
height: 4px;
|
|
79
|
+
width: 100%;
|
|
80
|
+
max-width: 140px;
|
|
81
|
+
|
|
82
|
+
background-color: $ds-primary-500;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@include p-size-tablet {
|
|
86
|
+
display: flex;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.sticky {
|
|
91
|
+
position: sticky;
|
|
92
|
+
justify-content: flex-start;
|
|
93
|
+
z-index: 1;
|
|
94
|
+
|
|
95
|
+
top: 0;
|
|
96
|
+
left: 0;
|
|
97
|
+
|
|
98
|
+
width: 50vw;
|
|
99
|
+
|
|
100
|
+
@include p-size-tablet {
|
|
101
|
+
border-right: 1px solid $ds-grey-100;
|
|
102
|
+
flex: 1 0 288px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.addon {
|
|
107
|
+
width: 100%;
|
|
108
|
+
border-right: none;
|
|
109
|
+
max-width: 100vw;
|
|
110
|
+
|
|
111
|
+
@include p-size-desktop {
|
|
112
|
+
max-width: 944px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const ArrowIcon = ({ className }: { className?: string }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width="14"
|
|
4
|
+
height="8"
|
|
5
|
+
viewBox="0 0 14 8"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
className={className}
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
d="M1 1.00003L7 7.00003L13 1.00003"
|
|
12
|
+
strokeWidth="2"
|
|
13
|
+
strokeLinecap="round"
|
|
14
|
+
strokeLinejoin="round"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default ArrowIcon;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import ArrowIcon from './Arrow';
|
|
5
|
+
import { ActiveTableArrows } from '../../hooks/useActiveTableArrows';
|
|
6
|
+
|
|
7
|
+
import styles from './style.module.scss';
|
|
8
|
+
|
|
9
|
+
export type ArrowValues = 'prev' | 'next';
|
|
10
|
+
|
|
11
|
+
interface TableArrowsProps {
|
|
12
|
+
onClick: (value: ArrowValues) => void;
|
|
13
|
+
active: ActiveTableArrows;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TableArrows = (props: TableArrowsProps) => {
|
|
17
|
+
const { active, onClick } = props;
|
|
18
|
+
const handleButtonClick = (value: ArrowValues) => () => onClick(value);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={`mt24 ${styles.container}`}>
|
|
22
|
+
<button
|
|
23
|
+
onClick={handleButtonClick('prev')}
|
|
24
|
+
className={classNames(
|
|
25
|
+
`p-btn--secondary d-flex`,
|
|
26
|
+
styles.prev,
|
|
27
|
+
styles.arrow,
|
|
28
|
+
{
|
|
29
|
+
[styles.active]: active.left,
|
|
30
|
+
}
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
<ArrowIcon />
|
|
34
|
+
</button>
|
|
35
|
+
<button
|
|
36
|
+
onClick={handleButtonClick('next')}
|
|
37
|
+
className={classNames(
|
|
38
|
+
`p-btn--secondary d-flex`,
|
|
39
|
+
styles.next,
|
|
40
|
+
styles.arrow,
|
|
41
|
+
{
|
|
42
|
+
[styles.active]: active.right,
|
|
43
|
+
}
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
<ArrowIcon />
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default TableArrows;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@use "../../../../scss/public/colors" as *;
|
|
2
|
+
@use "../../../../scss/public/grid" as *;
|
|
3
|
+
|
|
4
|
+
.container {
|
|
5
|
+
position: absolute;
|
|
6
|
+
width: 100vw;
|
|
7
|
+
padding: 0 16px;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
z-index: 1;
|
|
10
|
+
display: flex;
|
|
11
|
+
@include p-size-tablet {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.next {
|
|
17
|
+
transform: rotate(-90deg);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.prev {
|
|
21
|
+
transform: rotate(90deg);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.arrow {
|
|
25
|
+
width: 32px;
|
|
26
|
+
height: 32px;
|
|
27
|
+
|
|
28
|
+
padding: 0;
|
|
29
|
+
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
background-color: $ds-grey-200;
|
|
32
|
+
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
|
|
36
|
+
stroke: $ds-primary-100;
|
|
37
|
+
|
|
38
|
+
&:hover,
|
|
39
|
+
&:focus {
|
|
40
|
+
background-color: $ds-grey-200;
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.active {
|
|
46
|
+
stroke: $ds-primary-500;
|
|
47
|
+
|
|
48
|
+
&:hover,
|
|
49
|
+
&:focus {
|
|
50
|
+
background-color: $ds-grey-200;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import styles from './style.module.scss';
|
|
2
|
+
|
|
3
|
+
const TableInfoButton = ({
|
|
4
|
+
onClick,
|
|
5
|
+
className = '',
|
|
6
|
+
}: {
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}) => (
|
|
10
|
+
<span
|
|
11
|
+
role="button"
|
|
12
|
+
className={`p-btn--secondary ${styles.button} ${className}`}
|
|
13
|
+
onClick={onClick}
|
|
14
|
+
>
|
|
15
|
+
<svg
|
|
16
|
+
width="20"
|
|
17
|
+
height="20"
|
|
18
|
+
viewBox="0 0 20 20"
|
|
19
|
+
fill="none"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
>
|
|
22
|
+
<path
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
clipRule="evenodd"
|
|
25
|
+
d="M10 2.66667C5.94991 2.66667 2.66667 5.94991 2.66667 10C2.66667 14.0501 5.94991 17.3333 10 17.3333C14.0501 17.3333 17.3333 14.0501 17.3333 10C17.3333 5.94991 14.0501 2.66667 10 2.66667ZM0.666667 10C0.666667 4.84534 4.84534 0.666667 10 0.666667C15.1547 0.666667 19.3333 4.84534 19.3333 10C19.3333 15.1547 15.1547 19.3333 10 19.3333C4.84534 19.3333 0.666667 15.1547 0.666667 10Z"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
fillRule="evenodd"
|
|
29
|
+
clipRule="evenodd"
|
|
30
|
+
d="M10 9C10.5523 9 11 9.44772 11 10V13.3333C11 13.8856 10.5523 14.3333 10 14.3333C9.44772 14.3333 9 13.8856 9 13.3333V10C9 9.44772 9.44772 9 10 9Z"
|
|
31
|
+
/>
|
|
32
|
+
<path d="M10.8333 6.66667C10.8333 7.1269 10.4602 7.5 10 7.5C9.53976 7.5 9.16667 7.1269 9.16667 6.66667C9.16667 6.20643 9.53976 5.83333 10 5.83333C10.4602 5.83333 10.8333 6.20643 10.8333 6.66667Z" />
|
|
33
|
+
</svg>
|
|
34
|
+
</span>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export default TableInfoButton;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@use "../../../../scss/public/colors" as *;
|
|
2
|
+
|
|
3
|
+
.button {
|
|
4
|
+
padding: 0;
|
|
5
|
+
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: center;
|
|
9
|
+
|
|
10
|
+
vertical-align: bottom;
|
|
11
|
+
|
|
12
|
+
width: 24px;
|
|
13
|
+
height: 24px;
|
|
14
|
+
|
|
15
|
+
transition: all 0.3s ease;
|
|
16
|
+
|
|
17
|
+
&:hover,
|
|
18
|
+
&:focus {
|
|
19
|
+
background-color: $ds-primary-50;
|
|
20
|
+
|
|
21
|
+
svg {
|
|
22
|
+
fill: $ds-primary-300;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
svg {
|
|
27
|
+
fill: $ds-primary-100;
|
|
28
|
+
transition: all 0.3s ease;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const StarIcon = ({ className }: { className: string }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width="12"
|
|
4
|
+
height="12"
|
|
5
|
+
fill="none"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
className={className}
|
|
8
|
+
>
|
|
9
|
+
<path d="M5.933.004a.73.73 0 01.756.468L7.891 3.67l3.407.16c.677.03.954.886.422 1.306l-2.66 2.145.899 3.296c.17.647-.545 1.166-1.105.8l-2.85-1.872-2.858 1.873c-.561.368-1.28-.152-1.107-.801l.9-3.296L.278 5.136C-.253 4.716.024 3.86.7 3.831l3.407-.161L5.322.472a.73.73 0 01.61-.468z" />
|
|
10
|
+
</svg>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export default StarIcon;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const ZapIcon = ({ className }: { className: string }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width="12"
|
|
4
|
+
height="12"
|
|
5
|
+
fill="none"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
className={className}
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
fillRule="evenodd"
|
|
11
|
+
clipRule="evenodd"
|
|
12
|
+
d="M7.492 1.124A1 1 0 005.732.36l-5 6A1 1 0 001.5 8h3.367l-.36 2.876a1 1 0 001.761.764l5-6A1 1 0 0010.5 4H7.133l.36-2.876z"
|
|
13
|
+
/>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default ZapIcon;
|