@popsure/dirty-swan 0.51.3 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +210 -39037
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/accordion/index.d.ts +24 -0
- package/dist/cjs/lib/components/accordion/index.stories.d.ts +50 -0
- package/dist/cjs/lib/components/chip/index.d.ts +3 -2
- package/dist/cjs/lib/components/chip/index.stories.d.ts +35 -0
- package/dist/cjs/lib/components/comparisonTable/index.stories.d.ts +172 -0
- package/dist/cjs/lib/index.d.ts +1 -2
- package/dist/esm/{Calendar-ab50ad9c.js → Calendar-da0c3e4e.js} +1 -1
- package/dist/esm/{Calendar-ab50ad9c.js.map → Calendar-da0c3e4e.js.map} +1 -1
- package/dist/esm/components/accordion/index.js +56 -0
- package/dist/esm/components/accordion/index.js.map +1 -0
- package/dist/esm/components/accordion/index.stories.js +89 -0
- package/dist/esm/components/accordion/index.stories.js.map +1 -0
- package/dist/esm/components/autocompleteAddress/index.js +1 -1
- package/dist/esm/components/autocompleteAddress/index.stories.js +1 -1
- package/dist/esm/components/autocompleteAddress/index.test.js +2 -2
- package/dist/esm/components/badge/index.test.js +2 -2
- package/dist/esm/components/button/index.js +1 -1
- package/dist/esm/components/button/index.stories.js +1 -1
- package/dist/esm/components/button/index.test.js +2 -2
- package/dist/esm/components/cards/card/index.js +7 -7
- package/dist/esm/components/cards/card/index.js.map +1 -1
- package/dist/esm/components/cards/card/index.stories.js +1 -1
- package/dist/esm/components/cards/cardButton/index.js +1 -1
- package/dist/esm/components/cards/cardButton/index.stories.js +1 -1
- package/dist/esm/components/cards/index.js +1 -1
- package/dist/esm/components/cards/infoCard/index.js +1 -1
- package/dist/esm/components/cards/infoCard/index.stories.js +1 -1
- package/dist/esm/components/chip/index.js.map +1 -1
- package/dist/esm/components/chip/index.stories.js +70 -0
- package/dist/esm/components/chip/index.stories.js.map +1 -0
- package/dist/esm/components/comparisonTable/components/TableButton/index.test.js +3 -3
- package/dist/esm/components/comparisonTable/components/TableRowHeader/index.test.js +3 -3
- package/dist/esm/components/comparisonTable/index.js +1 -1
- package/dist/esm/components/comparisonTable/index.stories.js +308 -0
- package/dist/esm/components/comparisonTable/index.stories.js.map +1 -0
- package/dist/esm/components/dateSelector/components/Calendar.js +2 -2
- package/dist/esm/components/dateSelector/index.js +2 -2
- package/dist/esm/components/dateSelector/index.stories.js +2 -2
- package/dist/esm/components/dateSelector/index.test.js +3 -3
- package/dist/esm/components/downloadButton/index.js +1 -1
- package/dist/esm/components/downloadButton/index.stories.js +1 -1
- package/dist/esm/components/icon/icons/Arthritis.js +2 -2
- package/dist/esm/components/icon/icons/Arthritis.js.map +1 -1
- package/dist/esm/components/icon/icons/ChevronDown.js +2 -2
- package/dist/esm/components/icon/icons/ChevronDown.js.map +1 -1
- package/dist/esm/components/icon/icons/Cpu.js +2 -2
- package/dist/esm/components/icon/icons/Cpu.js.map +1 -1
- package/dist/esm/components/icon/icons/Wind.js +2 -2
- package/dist/esm/components/icon/icons/Wind.js.map +1 -1
- package/dist/esm/components/icon/icons/Zap.js +2 -2
- package/dist/esm/components/icon/icons/Zap.js.map +1 -1
- package/dist/esm/components/icon/icons.stories.js +2 -2
- package/dist/esm/components/icon/index.stories.js +1 -1
- package/dist/esm/components/informationBox/index.test.js +2 -2
- package/dist/esm/components/input/autoSuggestInput/index.js +1 -1
- package/dist/esm/components/input/autoSuggestInput/index.stories.js +1 -1
- package/dist/esm/components/input/autoSuggestMultiSelect/index.js +1 -1
- package/dist/esm/components/input/autoSuggestMultiSelect/index.stories.js +1 -1
- package/dist/esm/components/input/checkbox/index.js +1 -1
- package/dist/esm/components/input/checkbox/index.stories.js +1 -1
- package/dist/esm/components/input/checkbox/index.test.js +2 -2
- package/dist/esm/components/input/currency/index.js +1 -1
- package/dist/esm/components/input/currency/index.test.js +2 -2
- package/dist/esm/components/input/currency/input.stories.js +1 -1
- package/dist/esm/components/input/iban/index.js +1 -1
- package/dist/esm/components/input/index.js +1 -1
- package/dist/esm/components/input/input.stories.js +1 -1
- package/dist/esm/components/input/radio/index.test.js +2 -2
- package/dist/esm/components/input/toggle/index.js +1 -1
- package/dist/esm/components/input/toggle/index.stories.js +1 -1
- package/dist/esm/components/input/toggle/index.test.js +2 -2
- package/dist/esm/components/link/index.js +1 -1
- package/dist/esm/components/link/index.stories.js +1 -1
- package/dist/esm/components/modal/bottomModal/index.js +1 -1
- package/dist/esm/components/modal/bottomOrRegularModal/index.js +1 -1
- package/dist/esm/components/modal/genericModal/index.js +2 -2
- package/dist/esm/components/modal/genericModal/index.js.map +1 -1
- package/dist/esm/components/modal/index.stories.js +4 -11
- package/dist/esm/components/modal/index.stories.js.map +1 -1
- package/dist/esm/components/modal/regularModal/index.js +1 -1
- package/dist/esm/components/multiDropzone/index.js +1 -1
- package/dist/esm/components/multiDropzone/index.stories.js +1 -1
- package/dist/esm/components/multiDropzone/index.test.js +3 -3
- package/dist/esm/components/segmentedControl/index.test.js +2 -2
- package/dist/esm/components/signaturePad/index.js +1 -1
- package/dist/esm/components/signaturePad/index.stories.js +1 -1
- package/dist/esm/components/spinner/index.test.js +2 -2
- package/dist/esm/components/toast/index.js +2 -2
- package/dist/esm/components/toast/index.stories.js +2 -2
- package/dist/esm/components/toast/index.test.js +3 -3
- package/dist/esm/{customRender-7c4f92fb.js → customRender-b3d1dc00.js} +2 -2
- package/dist/esm/{customRender-7c4f92fb.js.map → customRender-b3d1dc00.js.map} +1 -1
- package/dist/esm/{extend-expect-6a57cfd5.js → extend-expect-5a71e666.js} +2 -2
- package/dist/esm/{extend-expect-6a57cfd5.js.map → extend-expect-5a71e666.js.map} +1 -1
- package/dist/esm/{index-df63ee5a.js → index-27e1f1cc.js} +11 -11
- package/dist/esm/{index-df63ee5a.js.map → index-27e1f1cc.js.map} +1 -1
- package/dist/esm/{index-5abf080f.js → index-2a2fcd04.js} +2 -2
- package/dist/esm/{index-5abf080f.js.map → index-2a2fcd04.js.map} +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +3 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/components/accordion/index.d.ts +24 -0
- package/dist/esm/lib/components/accordion/index.stories.d.ts +50 -0
- package/dist/esm/lib/components/chip/index.d.ts +3 -2
- package/dist/esm/lib/components/chip/index.stories.d.ts +35 -0
- package/dist/esm/lib/components/comparisonTable/index.stories.d.ts +172 -0
- package/dist/esm/lib/index.d.ts +1 -2
- package/dist/esm/{tslib.es6-5bc94358.js → tslib.es6-a39f91fc.js} +2 -2
- package/dist/esm/{tslib.es6-5bc94358.js.map → tslib.es6-a39f91fc.js.map} +1 -1
- package/dist/esm/util/images/index.stories.js +1 -1
- package/dist/esm/util/testUtils/customRender.js +2 -2
- package/package.json +2 -5
- package/src/index.tsx +0 -1
- package/src/lib/components/accordion/index.stories.tsx +85 -0
- package/src/lib/components/accordion/index.tsx +150 -0
- package/src/lib/components/accordion/style.module.scss +62 -0
- package/src/lib/components/cards/card/index.tsx +7 -6
- package/src/lib/components/cards/card/style.module.scss +5 -0
- package/src/lib/components/chip/index.stories.tsx +86 -0
- package/src/lib/components/chip/index.tsx +7 -5
- package/src/lib/components/comparisonTable/index.stories.tsx +360 -0
- package/src/lib/components/modal/genericModal/index.tsx +1 -0
- package/src/lib/components/modal/index.stories.tsx +7 -16
- package/src/lib/index.tsx +0 -2
- package/dist/cjs/lib/components/markdown/config.d.ts +0 -22
- package/dist/cjs/lib/components/markdown/index.d.ts +0 -10
- package/dist/cjs/lib/components/markdown/index.stories.d.ts +0 -39
- package/dist/esm/components/markdown/index.js +0 -38833
- package/dist/esm/components/markdown/index.js.map +0 -1
- package/dist/esm/components/markdown/index.stories.js +0 -61
- package/dist/esm/components/markdown/index.stories.js.map +0 -1
- package/dist/esm/lib/components/markdown/config.d.ts +0 -22
- package/dist/esm/lib/components/markdown/index.d.ts +0 -10
- package/dist/esm/lib/components/markdown/index.stories.d.ts +0 -39
- package/src/lib/components/chip/index.mdx +0 -95
- package/src/lib/components/comparisonTable/index.mdx +0 -570
- package/src/lib/components/markdown/config.ts +0 -45
- package/src/lib/components/markdown/index.stories.tsx +0 -185
- package/src/lib/components/markdown/index.tsx +0 -163
- package/src/lib/components/markdown/styles.module.scss +0 -37
|
@@ -67,7 +67,7 @@ const Card = <E extends ElementType = CardDefaultAsType>({
|
|
|
67
67
|
<Tag
|
|
68
68
|
className={classNamesUtil(
|
|
69
69
|
classNames?.buttonWrapper,
|
|
70
|
-
'
|
|
70
|
+
'd-flex w100 ai-stretch',
|
|
71
71
|
{
|
|
72
72
|
'c-pointer': propsWithActionIcon,
|
|
73
73
|
[styles.button]: propsWithActionIcon
|
|
@@ -81,7 +81,7 @@ const Card = <E extends ElementType = CardDefaultAsType>({
|
|
|
81
81
|
>
|
|
82
82
|
<div
|
|
83
83
|
className={classNamesUtil(
|
|
84
|
-
'd-flex fd-column
|
|
84
|
+
'd-flex fd-column jc-center w100 ta-left',
|
|
85
85
|
{ 'bs-sm': dropShadow },
|
|
86
86
|
{
|
|
87
87
|
compact: 'p16',
|
|
@@ -93,6 +93,7 @@ const Card = <E extends ElementType = CardDefaultAsType>({
|
|
|
93
93
|
center: 'jc-center',
|
|
94
94
|
bottom: 'jc-end',
|
|
95
95
|
}[verticalAlignment as VerticalAlignmentType],
|
|
96
|
+
styles?.wrapper,
|
|
96
97
|
classNames?.wrapper
|
|
97
98
|
)}
|
|
98
99
|
>
|
|
@@ -118,13 +119,13 @@ const Card = <E extends ElementType = CardDefaultAsType>({
|
|
|
118
119
|
<div className="d-flex jc-between w100">
|
|
119
120
|
<div className="d-flex jc-center gap8 fd-column tc-grey-900 w100">
|
|
120
121
|
{label && (
|
|
121
|
-
<
|
|
122
|
+
<h4 className={classNamesUtil('p-p--small', classNames?.label)}>
|
|
122
123
|
{label}
|
|
123
|
-
</
|
|
124
|
+
</h4>
|
|
124
125
|
)}
|
|
125
126
|
|
|
126
127
|
{title && (
|
|
127
|
-
<
|
|
128
|
+
<h3
|
|
128
129
|
className={classNamesUtil(
|
|
129
130
|
classNames?.title,
|
|
130
131
|
{
|
|
@@ -135,7 +136,7 @@ const Card = <E extends ElementType = CardDefaultAsType>({
|
|
|
135
136
|
)}
|
|
136
137
|
>
|
|
137
138
|
{title}
|
|
138
|
-
</
|
|
139
|
+
</h3>
|
|
139
140
|
)}
|
|
140
141
|
|
|
141
142
|
{description && (
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
outline: 1px solid transparent;
|
|
7
7
|
transition: all 0.2s ease-in-out;
|
|
8
8
|
text-decoration: none;
|
|
9
|
+
border-radius: 8px;
|
|
9
10
|
|
|
10
11
|
&:hover {
|
|
11
12
|
outline: 1px solid $ds-primary-500;
|
|
@@ -18,6 +19,10 @@
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
.wrapper {
|
|
23
|
+
background-color: $ds-white;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
.icon {
|
|
22
27
|
margin-right: 12px;
|
|
23
28
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { on } from 'events';
|
|
2
|
+
import Chip, { ChipProps } from '.';
|
|
3
|
+
|
|
4
|
+
import featherLogo from '../cards/icons/feather-logo.svg';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
const story = {
|
|
8
|
+
title: 'JSX/Chip',
|
|
9
|
+
component: Chip,
|
|
10
|
+
argTypes: {
|
|
11
|
+
value: {
|
|
12
|
+
description: 'Value that is displayed inside the Chip',
|
|
13
|
+
},
|
|
14
|
+
onRemove: {
|
|
15
|
+
description: 'Function that is called when the remove button is clicked',
|
|
16
|
+
table: {
|
|
17
|
+
category: 'Callbacks'
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
className: {
|
|
21
|
+
description: 'Class name for the most parent element',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
args: {
|
|
25
|
+
value: {
|
|
26
|
+
value: 'feather3',
|
|
27
|
+
leftIcon: featherLogo,
|
|
28
|
+
},
|
|
29
|
+
className: '',
|
|
30
|
+
},
|
|
31
|
+
parameters: {
|
|
32
|
+
componentSubtitle: 'Chip component displays text and image (optional) of given values.'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const ChipStory = ({
|
|
37
|
+
onRemove,
|
|
38
|
+
value,
|
|
39
|
+
className,
|
|
40
|
+
}: ChipProps) => (
|
|
41
|
+
<Chip
|
|
42
|
+
onRemove={onRemove}
|
|
43
|
+
value={value}
|
|
44
|
+
className={className}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
ChipStory.storyName = "Chip";
|
|
49
|
+
|
|
50
|
+
export const MultipleChips = () => {
|
|
51
|
+
const values = [
|
|
52
|
+
{ value: 'feather', leftIcon: featherLogo },
|
|
53
|
+
{ value: 'feather2', leftIcon: featherLogo },
|
|
54
|
+
{
|
|
55
|
+
value: 'feather3',
|
|
56
|
+
leftIcon: featherLogo,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: 'dirtyswan',
|
|
60
|
+
leftIcon: featherLogo,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: 'test value',
|
|
64
|
+
leftIcon: featherLogo,
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
const [selectedValues, setSelectedValues] = useState(values);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
71
|
+
{selectedValues.map((value) => (
|
|
72
|
+
<Chip
|
|
73
|
+
value={value}
|
|
74
|
+
onRemove={(value) => {
|
|
75
|
+
const newValues = [...selectedValues].filter(
|
|
76
|
+
(selectedValue) => selectedValue.value !== value.value
|
|
77
|
+
);
|
|
78
|
+
setSelectedValues(newValues);
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default story;
|
|
@@ -3,15 +3,17 @@ import { XIcon } from '../icon/icons';
|
|
|
3
3
|
|
|
4
4
|
import styles from './style.module.scss';
|
|
5
5
|
|
|
6
|
+
export interface ChipProps {
|
|
7
|
+
value: Option;
|
|
8
|
+
onRemove: (value: Option) => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
export default ({
|
|
7
13
|
className,
|
|
8
14
|
value,
|
|
9
15
|
onRemove,
|
|
10
|
-
}:
|
|
11
|
-
value: Option;
|
|
12
|
-
onRemove: (value: Option) => void;
|
|
13
|
-
className?: string;
|
|
14
|
-
}) => (
|
|
16
|
+
}: ChipProps) => (
|
|
15
17
|
<div className={`p-p mr8 mb8 d-flex ${className} ${styles['chip']}`}>
|
|
16
18
|
{value.leftIcon && (
|
|
17
19
|
<img
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { ComparisonTable, ComparisonTableProps, TableButton, TableRating, TableRowHeader, TableTrueFalse } from '.';
|
|
2
|
+
import { CardButton } from '../cards';
|
|
3
|
+
|
|
4
|
+
const headers = [
|
|
5
|
+
{
|
|
6
|
+
id: 1,
|
|
7
|
+
default: true,
|
|
8
|
+
cells: [
|
|
9
|
+
{
|
|
10
|
+
id: 1,
|
|
11
|
+
key: 'name',
|
|
12
|
+
label: 'Films',
|
|
13
|
+
render: (value: string) => (
|
|
14
|
+
<TableButton onClick={() => {}}>{value}</TableButton>
|
|
15
|
+
),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 2,
|
|
19
|
+
key: 'country',
|
|
20
|
+
label: 'Country',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 4,
|
|
24
|
+
key: 'imdb',
|
|
25
|
+
label: 'IMDB rating',
|
|
26
|
+
render: (value: string) => (
|
|
27
|
+
<TableButton onClick={() => {}}>{value}</TableButton>
|
|
28
|
+
),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 3,
|
|
32
|
+
key: 'rating',
|
|
33
|
+
label: (
|
|
34
|
+
<TableRowHeader
|
|
35
|
+
label="Our rating of movies found online on IMDB lists"
|
|
36
|
+
onClickInfo={() => {}}
|
|
37
|
+
/>
|
|
38
|
+
),
|
|
39
|
+
render: (value: number) => (
|
|
40
|
+
<TableButton onClick={() => {}}>
|
|
41
|
+
<TableRating type="star" rating={value} />
|
|
42
|
+
</TableButton>
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 5,
|
|
47
|
+
key: 'recommended',
|
|
48
|
+
label: (
|
|
49
|
+
<TableRowHeader
|
|
50
|
+
label="Recommended"
|
|
51
|
+
subtitle="Our favourites"
|
|
52
|
+
onClickInfo={() => {}}
|
|
53
|
+
/>
|
|
54
|
+
),
|
|
55
|
+
render: (value: number) => <TableRating type="zap" rating={value} />,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 5,
|
|
59
|
+
key: 'familyFriendly',
|
|
60
|
+
label: 'Family friendly',
|
|
61
|
+
render: (value: boolean) => <TableTrueFalse value={value} />,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 6,
|
|
65
|
+
key: 'boxOffice',
|
|
66
|
+
label: 'Box office',
|
|
67
|
+
render: (value: number) =>
|
|
68
|
+
value.toLocaleString('de-DE', {
|
|
69
|
+
style: 'currency',
|
|
70
|
+
currency: 'EUR',
|
|
71
|
+
}),
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 2,
|
|
77
|
+
label: 'SUBSECTION',
|
|
78
|
+
cells: [
|
|
79
|
+
{
|
|
80
|
+
id: 1,
|
|
81
|
+
key: 'name',
|
|
82
|
+
label: 'Films',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 2,
|
|
86
|
+
key: 'country',
|
|
87
|
+
label: 'Country',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 4,
|
|
91
|
+
key: 'imdb',
|
|
92
|
+
label: 'IMDB rating',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 3,
|
|
96
|
+
key: 'rating',
|
|
97
|
+
label: 'Our rating',
|
|
98
|
+
render: (value: number) => <TableRating type="star" rating={value} />,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 5,
|
|
102
|
+
key: 'recommended',
|
|
103
|
+
label: 'Recommended',
|
|
104
|
+
render: (value: number) => <TableRating type="zap" rating={value} />,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: 5,
|
|
108
|
+
key: 'familyFriendly',
|
|
109
|
+
label: 'Family friendly',
|
|
110
|
+
render: (value: boolean) => <TableTrueFalse value={value} />,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 6,
|
|
114
|
+
key: 'boxOffice',
|
|
115
|
+
label: 'Box office',
|
|
116
|
+
render: (value: number) =>
|
|
117
|
+
value.toLocaleString('de-DE', {
|
|
118
|
+
style: 'currency',
|
|
119
|
+
currency: 'EUR',
|
|
120
|
+
}),
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
addonId: 'addon-movies',
|
|
124
|
+
label: (
|
|
125
|
+
<CardButton
|
|
126
|
+
title="All Review"
|
|
127
|
+
description="Click here to read all reviews"
|
|
128
|
+
onClick={() => {}}
|
|
129
|
+
/>
|
|
130
|
+
),
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: 3,
|
|
136
|
+
label: 'SUBSECTION 2',
|
|
137
|
+
cells: [
|
|
138
|
+
{
|
|
139
|
+
id: 1,
|
|
140
|
+
key: 'name',
|
|
141
|
+
label: 'Films',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 2,
|
|
145
|
+
key: 'country',
|
|
146
|
+
label: 'Country',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: 4,
|
|
150
|
+
key: 'imdb',
|
|
151
|
+
label: 'IMDB rating',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 3,
|
|
155
|
+
key: 'rating',
|
|
156
|
+
label: 'Our rating',
|
|
157
|
+
render: (value: number) => <TableRating type="star" rating={value} />,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: 5,
|
|
161
|
+
key: 'recommended',
|
|
162
|
+
label: 'Recommended',
|
|
163
|
+
render: (value: number) => <TableRating type="zap" rating={value} />,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: 5,
|
|
167
|
+
key: 'familyFriendly',
|
|
168
|
+
label: 'Family friendly',
|
|
169
|
+
render: (value: boolean) => <TableTrueFalse value={value} />,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: 6,
|
|
173
|
+
key: 'boxOffice',
|
|
174
|
+
label: 'Box office',
|
|
175
|
+
render: (value: number) =>
|
|
176
|
+
value.toLocaleString('de-DE', {
|
|
177
|
+
style: 'currency',
|
|
178
|
+
currency: 'EUR',
|
|
179
|
+
}),
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
const data = [
|
|
186
|
+
{
|
|
187
|
+
id: 1,
|
|
188
|
+
name: 'Pulp Fiction',
|
|
189
|
+
country: 'United States',
|
|
190
|
+
year: '1994',
|
|
191
|
+
rating: 3,
|
|
192
|
+
imdb: 8.9,
|
|
193
|
+
recommended: 3,
|
|
194
|
+
familyFriendly: false,
|
|
195
|
+
boxOffice: 213928762,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: 2,
|
|
199
|
+
name: 'Parasite',
|
|
200
|
+
country: 'South Korea',
|
|
201
|
+
year: '2019',
|
|
202
|
+
rating: 2,
|
|
203
|
+
imdb: 8.6,
|
|
204
|
+
recommended: 3,
|
|
205
|
+
familyFriendly: false,
|
|
206
|
+
boxOffice: 355475245,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: 3,
|
|
210
|
+
name: 'Spirited Away',
|
|
211
|
+
country: 'Japan',
|
|
212
|
+
year: '2001',
|
|
213
|
+
rating: 3,
|
|
214
|
+
imdb: 8.6,
|
|
215
|
+
recommended: 3,
|
|
216
|
+
familyFriendly: true,
|
|
217
|
+
boxOffice: 258908054,
|
|
218
|
+
},
|
|
219
|
+
];
|
|
220
|
+
|
|
221
|
+
const story = {
|
|
222
|
+
title: 'JSX/ComparisonTable',
|
|
223
|
+
component: ComparisonTable,
|
|
224
|
+
argTypes: {
|
|
225
|
+
headers: {
|
|
226
|
+
description: 'The structure of the table',
|
|
227
|
+
},
|
|
228
|
+
data: {
|
|
229
|
+
description: 'The title text that needs to be displayed',
|
|
230
|
+
},
|
|
231
|
+
hideDetails: {
|
|
232
|
+
description: 'Hide table groups that do not have the `default` attribute',
|
|
233
|
+
},
|
|
234
|
+
hideDetailsCaption: {
|
|
235
|
+
description: 'Caption of the button to hide the details',
|
|
236
|
+
},
|
|
237
|
+
showDetailsCaption: {
|
|
238
|
+
description: 'Caption of the button to show the details',
|
|
239
|
+
},
|
|
240
|
+
hideScrollBars: {
|
|
241
|
+
description: 'Hide scroll bars',
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
hideScrollBarsMobile: {
|
|
245
|
+
description: 'Hide scroll bars on mobile only',
|
|
246
|
+
},
|
|
247
|
+
collapsibleSections: {
|
|
248
|
+
description: 'Make table groups with a label collapsible',
|
|
249
|
+
},
|
|
250
|
+
cellWidth: {
|
|
251
|
+
description: 'Width of a table content cell',
|
|
252
|
+
},
|
|
253
|
+
firstColumnWidth: {
|
|
254
|
+
description: 'Width of the first column of the table',
|
|
255
|
+
},
|
|
256
|
+
stickyHeaderTopOffset: {
|
|
257
|
+
description: 'Y-offset of the sticky header row',
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
growContent: {
|
|
261
|
+
description: 'Makes the content area grow to fill the available space',
|
|
262
|
+
},
|
|
263
|
+
classNameOverrides: {
|
|
264
|
+
description: '"className" props to be passed down to various internal components',
|
|
265
|
+
},
|
|
266
|
+
onSelectionChanged: {
|
|
267
|
+
description: 'Callback to be called when the selected tab index changes on mobile',
|
|
268
|
+
table: {
|
|
269
|
+
category: 'Callbacks'
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
args: {
|
|
274
|
+
data,
|
|
275
|
+
headers,
|
|
276
|
+
hideDetails: false,
|
|
277
|
+
hideDetailsCaption: 'Hide details',
|
|
278
|
+
showDetailsCaption: 'Show details',
|
|
279
|
+
hideScrollBars: false,
|
|
280
|
+
hideScrollBarsMobile: false,
|
|
281
|
+
collapsibleSections: false,
|
|
282
|
+
cellWidth: undefined,
|
|
283
|
+
firstColumnWidth: undefined,
|
|
284
|
+
stickyHeaderTopOffset: 0,
|
|
285
|
+
growContent: false,
|
|
286
|
+
classNameOverrides: {
|
|
287
|
+
header: '',
|
|
288
|
+
container: '',
|
|
289
|
+
cell: '',
|
|
290
|
+
headerCell: '',
|
|
291
|
+
collapsibleSection: '',
|
|
292
|
+
section: '',
|
|
293
|
+
hideDetailsButton: '',
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
parameters: {
|
|
297
|
+
componentSubtitle: 'The Comparison Table component provides an easy way to compare vast amounts of information in a fast and easy way.',
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
interface Data {
|
|
302
|
+
id: number;
|
|
303
|
+
name: string;
|
|
304
|
+
country: string;
|
|
305
|
+
year: string;
|
|
306
|
+
rating: number;
|
|
307
|
+
imdb: number;
|
|
308
|
+
recommended: number;
|
|
309
|
+
familyFriendly: boolean;
|
|
310
|
+
boxOffice: number;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export const ComparisonTableStory = ({
|
|
314
|
+
data,
|
|
315
|
+
headers,
|
|
316
|
+
collapsibleSections,
|
|
317
|
+
hideDetails,
|
|
318
|
+
classNameOverrides,
|
|
319
|
+
hideDetailsCaption,
|
|
320
|
+
showDetailsCaption,
|
|
321
|
+
hideScrollBars,
|
|
322
|
+
hideScrollBarsMobile,
|
|
323
|
+
cellWidth,
|
|
324
|
+
firstColumnWidth,
|
|
325
|
+
stickyHeaderTopOffset,
|
|
326
|
+
growContent,
|
|
327
|
+
}: ComparisonTableProps<Data>) => (
|
|
328
|
+
<div className='bg-white'>
|
|
329
|
+
<ComparisonTable
|
|
330
|
+
data={data}
|
|
331
|
+
headers={headers}
|
|
332
|
+
collapsibleSections={collapsibleSections}
|
|
333
|
+
hideDetails={hideDetails}
|
|
334
|
+
classNameOverrides={classNameOverrides}
|
|
335
|
+
hideDetailsCaption={hideDetailsCaption}
|
|
336
|
+
showDetailsCaption={showDetailsCaption}
|
|
337
|
+
hideScrollBars={hideScrollBars}
|
|
338
|
+
hideScrollBarsMobile={hideScrollBarsMobile}
|
|
339
|
+
cellWidth={cellWidth}
|
|
340
|
+
firstColumnWidth={firstColumnWidth}
|
|
341
|
+
stickyHeaderTopOffset={stickyHeaderTopOffset}
|
|
342
|
+
growContent={growContent}
|
|
343
|
+
/>
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
ComparisonTableStory.storyName = "ComparisonTable";
|
|
348
|
+
|
|
349
|
+
export const HeaderType = () => (
|
|
350
|
+
<pre>
|
|
351
|
+
{`export interface Header<T> {
|
|
352
|
+
id: number;
|
|
353
|
+
label?: React.ReactNode;
|
|
354
|
+
cells: Array<Cell<T>>;
|
|
355
|
+
default?: boolean;
|
|
356
|
+
}`}
|
|
357
|
+
</pre>
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
export default story;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { BottomModal, BottomOrRegularModal, Props, RegularModal } from '.';
|
|
4
|
-
import { Markdown } from '../markdown';
|
|
5
4
|
import { Button } from '../button';
|
|
6
5
|
|
|
7
6
|
const story = {
|
|
@@ -117,10 +116,8 @@ export const RegularModalStory = ({
|
|
|
117
116
|
return (
|
|
118
117
|
<>
|
|
119
118
|
Regular modals are primary meant to be used on Desktop or Tablet environment. The modal will appear in the middle of the screen and the user will be able to dismiss them using the top left "X" icon.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Want to use either Regular Modal or Bottom Modal based on the screen width? You can use [Bottom or Regular modal](#bottomorregularmodal).
|
|
123
|
-
</Markdown>
|
|
119
|
+
If you want to use it for Mobile only, you should check BottomModal instead.
|
|
120
|
+
Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.
|
|
124
121
|
|
|
125
122
|
<button
|
|
126
123
|
className="p-btn--primary wmn2 mt24"
|
|
@@ -167,10 +164,8 @@ export const BottomModalStory = ({
|
|
|
167
164
|
return (
|
|
168
165
|
<>
|
|
169
166
|
Bottom modals are primary meant to be used on Mobile environment. The modal will appear from the bottom of the screen and the user will be able to dismiss them using the top left "X" icon.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
Want to use either Regular Modal or Bottom Modal based on the screen width? You can use [Bottom or Regular modal](#bottomorregularmodal).
|
|
173
|
-
</Markdown>
|
|
167
|
+
If you want to use it for Desktop only, you should check Regular modal instead.
|
|
168
|
+
Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.
|
|
174
169
|
|
|
175
170
|
<button
|
|
176
171
|
className="p-btn--primary wmn2 mt24"
|
|
@@ -216,14 +211,10 @@ export const NonDismissibleModal = ({
|
|
|
216
211
|
|
|
217
212
|
return (
|
|
218
213
|
<>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
This prop can be useful if we want the user to explicitly interact with the modal options.
|
|
222
|
-
</Markdown>
|
|
214
|
+
Setting the dismissible prop to false will hide the close button and prevent the user from closing it using the escape key or clicking outside.
|
|
215
|
+
This prop can be useful if we want the user to explicitly interact with the modal options.
|
|
223
216
|
|
|
224
|
-
<
|
|
225
|
-
**Warning:** a modal with the dismissible prop can only be closed by changing the isOpen prop to false.
|
|
226
|
-
</Markdown>
|
|
217
|
+
<strong>Warning:</strong> a modal with the dismissible prop can only be closed by changing the isOpen prop to false.
|
|
227
218
|
|
|
228
219
|
<button
|
|
229
220
|
className="p-btn--primary wmn2 mt24"
|
package/src/lib/index.tsx
CHANGED
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
TableHeader,
|
|
38
38
|
} from './components/comparisonTable';
|
|
39
39
|
import { SegmentedControl } from './components/segmentedControl';
|
|
40
|
-
import { Markdown } from './components/markdown';
|
|
41
40
|
import { Link } from './components/link';
|
|
42
41
|
import { illustrations, images, IllustrationKeys } from './util/images';
|
|
43
42
|
import { Spinner } from './components/spinner';
|
|
@@ -73,7 +72,6 @@ export {
|
|
|
73
72
|
TableButton,
|
|
74
73
|
TableInfoButton,
|
|
75
74
|
SegmentedControl,
|
|
76
|
-
Markdown,
|
|
77
75
|
Checkbox,
|
|
78
76
|
Radio,
|
|
79
77
|
Link,
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface MarkdownStyling {
|
|
2
|
-
a: string;
|
|
3
|
-
p: string;
|
|
4
|
-
h1: string;
|
|
5
|
-
h2: string;
|
|
6
|
-
h3: string;
|
|
7
|
-
h4: string;
|
|
8
|
-
h5: string;
|
|
9
|
-
h6: string;
|
|
10
|
-
ol: string;
|
|
11
|
-
ul: string;
|
|
12
|
-
strong: string;
|
|
13
|
-
em: string;
|
|
14
|
-
table: string;
|
|
15
|
-
th: string;
|
|
16
|
-
tr: string;
|
|
17
|
-
td: string;
|
|
18
|
-
blockquote: string;
|
|
19
|
-
code: string;
|
|
20
|
-
pre: string;
|
|
21
|
-
}
|
|
22
|
-
export declare const defaultStyling: MarkdownStyling;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { MarkdownStyling } from './config';
|
|
2
|
-
export interface MarkdownProps {
|
|
3
|
-
children: string;
|
|
4
|
-
className?: string;
|
|
5
|
-
openLinksInNewTab?: boolean;
|
|
6
|
-
styling?: Partial<MarkdownStyling>;
|
|
7
|
-
renderRawMarkdownChild?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const Markdown: ({ children: rawMarkdownChild, className, openLinksInNewTab, styling: rawStyling, renderRawMarkdownChild }: MarkdownProps) => JSX.Element;
|
|
10
|
-
export { Markdown };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { MarkdownProps } from '.';
|
|
2
|
-
declare const story: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: ({ children: rawMarkdownChild, className, openLinksInNewTab, styling: rawStyling, renderRawMarkdownChild }: MarkdownProps) => JSX.Element;
|
|
5
|
-
argTypes: {
|
|
6
|
-
children: {
|
|
7
|
-
description: string;
|
|
8
|
-
};
|
|
9
|
-
className: {
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
renderRawMarkdownChild: {
|
|
13
|
-
description: string;
|
|
14
|
-
};
|
|
15
|
-
openLinksInNewTab: {
|
|
16
|
-
description: string;
|
|
17
|
-
};
|
|
18
|
-
styling: {
|
|
19
|
-
desription: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
args: {
|
|
23
|
-
children: string;
|
|
24
|
-
className: string;
|
|
25
|
-
renderRawMarkdownChild: boolean;
|
|
26
|
-
openLinksInNewTab: boolean;
|
|
27
|
-
styling: {};
|
|
28
|
-
};
|
|
29
|
-
parameters: {
|
|
30
|
-
componentSubtitle: JSX.Element;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export declare const MarkdownStory: {
|
|
34
|
-
({ children, className }: MarkdownProps): JSX.Element;
|
|
35
|
-
storyName: string;
|
|
36
|
-
};
|
|
37
|
-
export declare const AvailableMDComponents: ({ className }: MarkdownProps) => JSX.Element;
|
|
38
|
-
export declare const AddingCustomComponents: ({ className, openLinksInNewTab, renderRawMarkdownChild }: MarkdownProps) => JSX.Element;
|
|
39
|
-
export default story;
|