@popsure/dirty-swan 0.26.9 → 0.26.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +63 -1
- package/dist/index.css.map +1 -1
- package/dist/lib/scss/private/base/_border_radius.scss +15 -0
- package/dist/lib/scss/private/base/_grid.scss +8 -0
- package/dist/lib/scss/private/base/_index.scss +1 -0
- package/dist/lib/scss/private/base/style.module.scss +10 -0
- package/dist/lib/scss/private/components/_buttons.scss +1 -1
- package/dist/lib/scss/public/colors/default.scss +2 -0
- package/dist/lib/scss/public/demo.tsx +13 -1
- 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/_border_radius.scss +15 -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 +60 -0
- package/src/lib/scss/private/base/_index.scss +10 -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/border_radius.stories.mdx +43 -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 +185 -0
- package/src/lib/scss/private/base/style.module.scss +52 -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 +127 -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 +297 -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,37 @@
|
|
|
1
|
+
import { associatedClassForCardState } from '.';
|
|
2
|
+
|
|
3
|
+
describe('Associated class for card state', () => {
|
|
4
|
+
it('Should be an actionable class', () => {
|
|
5
|
+
expect(associatedClassForCardState('actionable', true)).toEqual(
|
|
6
|
+
'ds-card--actionable'
|
|
7
|
+
);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('Should be a muted class', () => {
|
|
11
|
+
expect(associatedClassForCardState('muted', true)).toEqual(
|
|
12
|
+
'ds-card--muted'
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('Should be a static class', () => {
|
|
17
|
+
expect(associatedClassForCardState('static', true)).toEqual('ds-card');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('Should be an actionable class without dropshadow', () => {
|
|
21
|
+
expect(associatedClassForCardState('actionable', false)).toEqual(
|
|
22
|
+
'ds-card--actionable ds-card--no-dropshadow'
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('Should be a muted class without dropshadow', () => {
|
|
27
|
+
expect(associatedClassForCardState('muted', false)).toEqual(
|
|
28
|
+
'ds-card--muted ds-card--no-dropshadow'
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('Should be a static class without dropshadow', () => {
|
|
33
|
+
expect(associatedClassForCardState('static', false)).toEqual(
|
|
34
|
+
'ds-card ds-card--no-dropshadow'
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import CardWithTopLeftIcon from './cardWithTopLeftIcon';
|
|
2
|
+
import CardWithLeftIcon from './cardWithLeftIcon';
|
|
3
|
+
import CardWithTopIcon from './cardWithTopIcon';
|
|
4
|
+
import InfoCard from './infoCard';
|
|
5
|
+
import CardButton from './cardButton';
|
|
6
|
+
|
|
7
|
+
type CardState = 'actionable' | 'static' | 'muted';
|
|
8
|
+
|
|
9
|
+
export type CardProps = {
|
|
10
|
+
title: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
state?: CardState;
|
|
13
|
+
dropshadow?: boolean;
|
|
14
|
+
} & JSX.IntrinsicElements['div'];
|
|
15
|
+
|
|
16
|
+
export const headingForCardSize = (
|
|
17
|
+
cardSize: 'xsmall' | 'small' | 'medium' | 'big'
|
|
18
|
+
): string => {
|
|
19
|
+
switch (cardSize) {
|
|
20
|
+
case 'xsmall':
|
|
21
|
+
case 'small':
|
|
22
|
+
return 'p-h4';
|
|
23
|
+
case 'medium':
|
|
24
|
+
return 'p-h3';
|
|
25
|
+
case 'big':
|
|
26
|
+
return 'p-h2';
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const associatedClassForCardState = (
|
|
31
|
+
state: CardState,
|
|
32
|
+
dropshadow: boolean
|
|
33
|
+
): string => {
|
|
34
|
+
const baseClass = (() => {
|
|
35
|
+
switch (state) {
|
|
36
|
+
case 'actionable':
|
|
37
|
+
return 'ds-card--actionable';
|
|
38
|
+
case 'muted':
|
|
39
|
+
return 'ds-card--muted';
|
|
40
|
+
case 'static':
|
|
41
|
+
return 'ds-card';
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
44
|
+
|
|
45
|
+
if (dropshadow === false) {
|
|
46
|
+
return `${baseClass} ds-card--no-dropshadow`;
|
|
47
|
+
}
|
|
48
|
+
return baseClass;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
CardWithTopLeftIcon,
|
|
53
|
+
CardWithLeftIcon,
|
|
54
|
+
CardWithTopIcon,
|
|
55
|
+
InfoCard,
|
|
56
|
+
CardButton,
|
|
57
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Meta, Preview } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
import InfoCard from '.';
|
|
4
|
+
import { featherLogo } from '../icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="JSX/Cards/Info card" />
|
|
7
|
+
|
|
8
|
+
# Info card
|
|
9
|
+
|
|
10
|
+
| attribute | unit | description | default value | required |
|
|
11
|
+
| ---------- | ----------------------------------------------------------- | --------------------------------------------------------------- | ------------- | -------- |
|
|
12
|
+
| title | string | The title text that needs to be displayed | n/a | true |
|
|
13
|
+
| topIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the top of the card, inside the purple circle | n/a | true |
|
|
14
|
+
| rightIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the top right corner of the card | n/a | false |
|
|
15
|
+
| state | [Card State](?path=/story/jsx-cards-intro--page#card-state) | State that describe the interation with the card | actionable | false |
|
|
16
|
+
| dropshadow | boolean | If the card should have a box-shadow or not | true | false |
|
|
17
|
+
|
|
18
|
+
<Preview>
|
|
19
|
+
<>
|
|
20
|
+
<h4 className="p-h4">With right icon</h4>
|
|
21
|
+
<InfoCard
|
|
22
|
+
className="wmx6 mt8"
|
|
23
|
+
title="Lorem ipsum"
|
|
24
|
+
rightIcon="info"
|
|
25
|
+
topIcon={featherLogo}
|
|
26
|
+
>
|
|
27
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
28
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
29
|
+
eros at, rhoncus imperdiet nunc
|
|
30
|
+
</InfoCard>
|
|
31
|
+
<h4 className="p-h4 mt24">Without right icon</h4>
|
|
32
|
+
<InfoCard className="wmx6 mt8" title="Lorem ipsum" topIcon={featherLogo}>
|
|
33
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
34
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
35
|
+
eros at, rhoncus imperdiet nunc
|
|
36
|
+
</InfoCard>
|
|
37
|
+
<h4 className="p-h4 mt24">Muted</h4>
|
|
38
|
+
<InfoCard
|
|
39
|
+
className="wmx6 mt8"
|
|
40
|
+
title="Lorem ipsum"
|
|
41
|
+
topIcon={featherLogo}
|
|
42
|
+
state="muted"
|
|
43
|
+
>
|
|
44
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
45
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
46
|
+
eros at, rhoncus imperdiet nunc
|
|
47
|
+
</InfoCard>
|
|
48
|
+
<h4 className="p-h4">No dropshadow</h4>
|
|
49
|
+
<InfoCard
|
|
50
|
+
className="wmx6 mt8"
|
|
51
|
+
title="Lorem ipsum"
|
|
52
|
+
rightIcon="info"
|
|
53
|
+
topIcon={featherLogo}
|
|
54
|
+
dropshadow={false}
|
|
55
|
+
>
|
|
56
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
57
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
58
|
+
eros at, rhoncus imperdiet nunc
|
|
59
|
+
</InfoCard>
|
|
60
|
+
</>
|
|
61
|
+
</Preview>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { associatedClassForCardState, CardProps } from '..';
|
|
2
|
+
import { Icon, info } from '../icons';
|
|
3
|
+
|
|
4
|
+
import styles from './style.module.scss';
|
|
5
|
+
|
|
6
|
+
export default ({
|
|
7
|
+
className,
|
|
8
|
+
title,
|
|
9
|
+
children,
|
|
10
|
+
topIcon,
|
|
11
|
+
rightIcon,
|
|
12
|
+
state = 'actionable',
|
|
13
|
+
dropshadow = true,
|
|
14
|
+
...props
|
|
15
|
+
}: CardProps & {
|
|
16
|
+
topIcon: Icon;
|
|
17
|
+
rightIcon?: 'info' | Icon;
|
|
18
|
+
}) => (
|
|
19
|
+
<div className={`${styles['root-container']} ${className ?? ''}`} {...props}>
|
|
20
|
+
<img
|
|
21
|
+
src={topIcon.src}
|
|
22
|
+
alt={topIcon.alt}
|
|
23
|
+
className={`${styles['top-icon']} ${
|
|
24
|
+
state === 'muted' ? styles['top-icon--muted'] : ''
|
|
25
|
+
} `}
|
|
26
|
+
width="80px"
|
|
27
|
+
height="80px"
|
|
28
|
+
/>
|
|
29
|
+
<div
|
|
30
|
+
className={`${associatedClassForCardState(state, dropshadow)} ${
|
|
31
|
+
styles.container
|
|
32
|
+
}`}
|
|
33
|
+
>
|
|
34
|
+
{rightIcon && (
|
|
35
|
+
<img
|
|
36
|
+
width="20px"
|
|
37
|
+
height="20px"
|
|
38
|
+
className={styles['right-icon']}
|
|
39
|
+
src={rightIcon === 'info' ? info.src : rightIcon.src}
|
|
40
|
+
alt={rightIcon === 'info' ? info.alt : rightIcon.alt}
|
|
41
|
+
/>
|
|
42
|
+
)}
|
|
43
|
+
<div className="p-h4 ta-center mt64">{title}</div>
|
|
44
|
+
<p className="p-p mt16 tc-grey-600">{children}</p>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
@@ -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;
|