@popsure/dirty-swan 0.41.0-rc.3 → 0.41.2
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 +2 -2
- package/dist/cjs/index.js +144 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/card/index.d.ts +25 -0
- package/dist/cjs/lib/components/card/index.stories.d.ts +72 -0
- package/dist/cjs/lib/components/input/radio/index.d.ts +2 -1
- package/dist/cjs/lib/components/input/radio/index.stories.d.ts +2 -1
- package/dist/cjs/lib/index.d.ts +3 -3
- package/dist/cjs/lib/models/styles.d.ts +1 -1
- package/dist/cjs/lib/util/images/index.d.ts +135 -1
- package/dist/cjs/lib/util/images/index.stories.d.ts +1 -1
- package/dist/esm/components/card/index.js +39 -0
- package/dist/esm/components/card/index.js.map +1 -0
- package/dist/esm/components/card/index.stories.js +111 -0
- package/dist/esm/components/card/index.stories.js.map +1 -0
- package/dist/esm/components/cards/cardWithLeftIcon/index.stories.js +1 -1
- package/dist/esm/components/cards/cardWithTopIcon/index.stories.js +1 -1
- package/dist/esm/components/cards/infoCard/index.stories.js +1 -1
- package/dist/esm/components/icon/icons/Meh.js +2 -2
- package/dist/esm/components/icon/icons/Meh.js.map +1 -1
- package/dist/esm/components/icon/icons/PlusCircle.js +2 -2
- package/dist/esm/components/icon/icons/PlusCircle.js.map +1 -1
- package/dist/esm/components/icon/icons.stories.js +1 -1
- package/dist/esm/components/icon/index.stories.js +1 -1
- package/dist/esm/components/input/checkbox/index.stories.js +1 -1
- package/dist/esm/components/input/radio/index.js +4 -4
- package/dist/esm/components/input/radio/index.js.map +1 -1
- package/dist/esm/components/input/radio/index.stories.js +24 -2
- package/dist/esm/components/input/radio/index.stories.js.map +1 -1
- package/dist/esm/components/toast/index.js +1 -1
- package/dist/esm/components/toast/index.stories.js +5 -3
- package/dist/esm/components/toast/index.stories.js.map +1 -1
- package/dist/esm/components/toast/index.test.js +1 -1
- package/dist/esm/index-1693701e.js +159 -0
- package/dist/esm/index-1693701e.js.map +1 -0
- package/dist/esm/{index-eff726d3.js → index-45edc7d0.js} +7 -7
- package/dist/esm/index-45edc7d0.js.map +1 -0
- package/dist/esm/{index-0a8de35a.js → index-83ae7f18.js} +5 -5
- package/dist/esm/{index-0a8de35a.js.map → index-83ae7f18.js.map} +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/components/card/index.d.ts +25 -0
- package/dist/esm/lib/components/card/index.stories.d.ts +72 -0
- package/dist/esm/lib/components/input/radio/index.d.ts +2 -1
- package/dist/esm/lib/components/input/radio/index.stories.d.ts +2 -1
- package/dist/esm/lib/index.d.ts +3 -3
- package/dist/esm/lib/models/styles.d.ts +1 -1
- package/dist/esm/lib/util/images/index.d.ts +135 -1
- package/dist/esm/lib/util/images/index.stories.d.ts +1 -1
- package/dist/esm/util/images/index.stories.js +43 -12
- package/dist/esm/util/images/index.stories.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/lib/scss/public/shadows.scss +1 -1
- package/package.json +1 -1
- package/src/index.tsx +2 -0
- package/src/lib/components/card/index.stories.tsx +245 -0
- package/src/lib/components/card/index.tsx +144 -0
- package/src/lib/components/card/style.module.scss +37 -0
- package/src/lib/components/input/radio/index.stories.tsx +33 -0
- package/src/lib/components/input/radio/index.tsx +14 -3
- package/src/lib/components/toast/index.stories.tsx +7 -2
- package/src/lib/components/toast/index.tsx +8 -4
- package/src/lib/components/toast/style.module.scss +9 -5
- package/src/lib/index.tsx +4 -2
- package/src/lib/models/styles.ts +1 -1
- package/src/lib/scss/public/shadows.scss +1 -1
- package/src/lib/util/images/index.stories.tsx +63 -21
- package/src/lib/util/images/index.ts +138 -1
- package/src/lib/util/images/style.module.scss +20 -0
- package/dist/esm/index-31224f74.js +0 -26
- package/dist/esm/index-31224f74.js.map +0 -1
- package/dist/esm/index-eff726d3.js.map +0 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { Card, CardProps } from '.';
|
|
2
|
+
import { illustrations } from '../../util/images';
|
|
3
|
+
import { Button } from '../button';
|
|
4
|
+
import { Badge } from '../badge';
|
|
5
|
+
import { CheckIcon, MehIcon, PlusCircleIcon, XIcon } from '../icon';
|
|
6
|
+
|
|
7
|
+
const story = {
|
|
8
|
+
title: 'JSX/Card',
|
|
9
|
+
component: Card,
|
|
10
|
+
argTypes: {
|
|
11
|
+
density: {
|
|
12
|
+
description: 'Spacing around the card'
|
|
13
|
+
},
|
|
14
|
+
label: {
|
|
15
|
+
description: 'Content to be rendered as label'
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
description: 'Content to be rendered as title'
|
|
19
|
+
},
|
|
20
|
+
titleVariant: {
|
|
21
|
+
description: 'Variant that allows changing title sizing styles.'
|
|
22
|
+
},
|
|
23
|
+
description: {
|
|
24
|
+
description: 'Content to be rendered as description'
|
|
25
|
+
},
|
|
26
|
+
descriptionVariant: {
|
|
27
|
+
description: 'Variant that allows changing description sizing styles.'
|
|
28
|
+
},
|
|
29
|
+
icon: {
|
|
30
|
+
description: 'ReactNode to be rendered on the left side of the card',
|
|
31
|
+
},
|
|
32
|
+
children: {
|
|
33
|
+
control: { type: 'text' },
|
|
34
|
+
description: 'Content that is displayed inside the card under the pre-defined props',
|
|
35
|
+
},
|
|
36
|
+
onClick: {
|
|
37
|
+
description: 'On click action to be triggered on card click.',
|
|
38
|
+
},
|
|
39
|
+
dropShadow: {
|
|
40
|
+
description: 'Wether to display card with drop shadow styles or not.',
|
|
41
|
+
},
|
|
42
|
+
actionIcon: {
|
|
43
|
+
description: 'ReactNode to be rendered on the right side of the card when there is an onClick action. By default it renders the ChevronRightIcon.',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
args: {
|
|
47
|
+
density: 'balanced',
|
|
48
|
+
description: 'Believe you’re a great fit but can’t find a position listed for your skill set? We’d love to hear from you!',
|
|
49
|
+
descriptionVariant: 'large',
|
|
50
|
+
label: 'Label',
|
|
51
|
+
title: 'Honest, simple insurance',
|
|
52
|
+
titleVariant: 'large',
|
|
53
|
+
icon: 'ABC',
|
|
54
|
+
children: '',
|
|
55
|
+
classNames: {
|
|
56
|
+
wrapper: '',
|
|
57
|
+
label: '',
|
|
58
|
+
title: '',
|
|
59
|
+
description: '',
|
|
60
|
+
children: '',
|
|
61
|
+
icon: ''
|
|
62
|
+
},
|
|
63
|
+
dropShadow: true,
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const CardStory = ({
|
|
68
|
+
actionIcon,
|
|
69
|
+
children,
|
|
70
|
+
classNames,
|
|
71
|
+
density,
|
|
72
|
+
description,
|
|
73
|
+
descriptionVariant,
|
|
74
|
+
dropShadow,
|
|
75
|
+
icon,
|
|
76
|
+
label,
|
|
77
|
+
onClick,
|
|
78
|
+
title,
|
|
79
|
+
titleVariant,
|
|
80
|
+
}: CardProps) => (
|
|
81
|
+
<div className='d-flex p24 bg-grey-200'>
|
|
82
|
+
<Card
|
|
83
|
+
classNames={classNames}
|
|
84
|
+
description={description}
|
|
85
|
+
descriptionVariant={descriptionVariant}
|
|
86
|
+
density={density}
|
|
87
|
+
dropShadow={dropShadow}
|
|
88
|
+
icon={icon}
|
|
89
|
+
label={label}
|
|
90
|
+
title={title}
|
|
91
|
+
titleVariant={titleVariant}
|
|
92
|
+
onClick={onClick}
|
|
93
|
+
actionIcon={actionIcon}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
</Card>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
CardStory.storyName = "Card";
|
|
101
|
+
|
|
102
|
+
export const CardDensities = () => (
|
|
103
|
+
<div className='d-flex fd-column gap16 p24 bg-grey-200'>
|
|
104
|
+
<Card
|
|
105
|
+
title={'Card density: Compact'}
|
|
106
|
+
density='compact'
|
|
107
|
+
/>
|
|
108
|
+
<Card
|
|
109
|
+
title={'Card density: Balanced'}
|
|
110
|
+
density='balanced'
|
|
111
|
+
/>
|
|
112
|
+
<Card
|
|
113
|
+
title={'Card density: Spacious'}
|
|
114
|
+
density='spacious'
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
export const CardsWithIcons = ({
|
|
120
|
+
children,
|
|
121
|
+
icon,
|
|
122
|
+
title,
|
|
123
|
+
}: CardProps) => (
|
|
124
|
+
<div className='d-flex gap16 p24 bg-grey-200'>
|
|
125
|
+
<Card
|
|
126
|
+
icon={
|
|
127
|
+
<img
|
|
128
|
+
alt=""
|
|
129
|
+
src={illustrations.aids}
|
|
130
|
+
width={24}
|
|
131
|
+
/>
|
|
132
|
+
}
|
|
133
|
+
title={title}
|
|
134
|
+
/>
|
|
135
|
+
<Card
|
|
136
|
+
icon={<MehIcon size={24} />}
|
|
137
|
+
title={title}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
export const CardWithOnClickAction = ({
|
|
143
|
+
children,
|
|
144
|
+
icon,
|
|
145
|
+
title,
|
|
146
|
+
}: CardProps) => (
|
|
147
|
+
<div className='d-flex p24 bg-grey-200'>
|
|
148
|
+
<Card
|
|
149
|
+
icon={
|
|
150
|
+
<img
|
|
151
|
+
alt=""
|
|
152
|
+
src={illustrations.aids}
|
|
153
|
+
width={24}
|
|
154
|
+
/>
|
|
155
|
+
}
|
|
156
|
+
title={title}
|
|
157
|
+
titleVariant={'medium'}
|
|
158
|
+
onClick={() => {}}
|
|
159
|
+
>
|
|
160
|
+
{children}
|
|
161
|
+
</Card>
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
export const CardOverridesStyles = ({
|
|
166
|
+
children,
|
|
167
|
+
label,
|
|
168
|
+
title,
|
|
169
|
+
}: CardProps) => (
|
|
170
|
+
<div className='d-flex p24 bg-grey-200'>
|
|
171
|
+
<Card
|
|
172
|
+
label={label}
|
|
173
|
+
title={title}
|
|
174
|
+
titleVariant={'medium'}
|
|
175
|
+
icon={<PlusCircleIcon color="grey-100" size={32} />}
|
|
176
|
+
classNames={{
|
|
177
|
+
wrapper: 'bg-grey-700',
|
|
178
|
+
label: 'tc-white',
|
|
179
|
+
title: 'tc-white'
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
{children}
|
|
183
|
+
</Card>
|
|
184
|
+
</div>
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
export const CardsWithinCardsAndComplexLayout = ({
|
|
188
|
+
children,
|
|
189
|
+
label,
|
|
190
|
+
title,
|
|
191
|
+
}: CardProps) => (
|
|
192
|
+
<div className='d-flex p24 bg-grey-200'>
|
|
193
|
+
<Card
|
|
194
|
+
label={(
|
|
195
|
+
<Badge size='small' variant='success'>
|
|
196
|
+
Active
|
|
197
|
+
</Badge>
|
|
198
|
+
)}
|
|
199
|
+
title={(
|
|
200
|
+
<div className='d-flex jc-between ai-center w100'>
|
|
201
|
+
Coverage overview
|
|
202
|
+
|
|
203
|
+
<Button
|
|
204
|
+
onClick={() => {}}
|
|
205
|
+
variant='filledGray'
|
|
206
|
+
>
|
|
207
|
+
Full coverage details
|
|
208
|
+
</Button>
|
|
209
|
+
</div>
|
|
210
|
+
)}
|
|
211
|
+
>
|
|
212
|
+
<div className='d-flex gap16 mt16'>
|
|
213
|
+
<Card
|
|
214
|
+
description="Lost keys"
|
|
215
|
+
classNames={{ wrapper: 'bg-grey-300' }}
|
|
216
|
+
icon={<CheckIcon color={'primary-500'} />}
|
|
217
|
+
density='compact'
|
|
218
|
+
/>
|
|
219
|
+
<Card
|
|
220
|
+
description="Broken glass"
|
|
221
|
+
classNames={{ wrapper: 'bg-grey-300' }}
|
|
222
|
+
icon={<XIcon color={'primary-500'} />}
|
|
223
|
+
density='compact'
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
226
|
+
|
|
227
|
+
<div className='d-flex gap16 mt16'>
|
|
228
|
+
<Card
|
|
229
|
+
description="Damage to property"
|
|
230
|
+
classNames={{ wrapper: 'bg-grey-300' }}
|
|
231
|
+
icon={<CheckIcon color={'primary-500'} />}
|
|
232
|
+
density='compact'
|
|
233
|
+
/>
|
|
234
|
+
<Card
|
|
235
|
+
description="Drones"
|
|
236
|
+
classNames={{ wrapper: 'bg-grey-300' }}
|
|
237
|
+
icon={<XIcon color={'primary-500'} />}
|
|
238
|
+
density='compact'
|
|
239
|
+
/>
|
|
240
|
+
</div>
|
|
241
|
+
</Card>
|
|
242
|
+
</div>
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
export default story;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import classNamesUtil from 'classnames';
|
|
3
|
+
import { ChevronRightIcon } from '../icon';
|
|
4
|
+
|
|
5
|
+
import styles from './style.module.scss';
|
|
6
|
+
|
|
7
|
+
export interface CardProps {
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
classNames?: {
|
|
10
|
+
wrapper?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
children?: string;
|
|
15
|
+
icon?: string;
|
|
16
|
+
actionIcon?: string;
|
|
17
|
+
};
|
|
18
|
+
density?: 'balanced' | 'compact' | 'spacious';
|
|
19
|
+
dropShadow?: boolean;
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
title?: ReactNode;
|
|
22
|
+
titleVariant?: 'small' | 'medium' | 'large';
|
|
23
|
+
description?: ReactNode;
|
|
24
|
+
descriptionVariant?: 'small' | 'large';
|
|
25
|
+
label?: ReactNode;
|
|
26
|
+
onClick?: () => void;
|
|
27
|
+
actionIcon?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const CardContent = ({
|
|
31
|
+
children,
|
|
32
|
+
classNames,
|
|
33
|
+
density = 'balanced',
|
|
34
|
+
description,
|
|
35
|
+
descriptionVariant = 'large',
|
|
36
|
+
dropShadow = true,
|
|
37
|
+
icon,
|
|
38
|
+
label,
|
|
39
|
+
onClick,
|
|
40
|
+
actionIcon,
|
|
41
|
+
title,
|
|
42
|
+
titleVariant = 'large',
|
|
43
|
+
}: CardProps) => (
|
|
44
|
+
<section
|
|
45
|
+
className={classNamesUtil(
|
|
46
|
+
'd-flex fd-column jc-center br8 bg-white w100 ta-left',
|
|
47
|
+
{ 'bs-sm': dropShadow },
|
|
48
|
+
{
|
|
49
|
+
compact: 'p16',
|
|
50
|
+
balanced: 'p24',
|
|
51
|
+
spacious: 'p32'
|
|
52
|
+
}[density],
|
|
53
|
+
classNames?.wrapper,
|
|
54
|
+
)}
|
|
55
|
+
>
|
|
56
|
+
<div className='d-flex w100'>
|
|
57
|
+
{icon && (
|
|
58
|
+
<div
|
|
59
|
+
className={classNamesUtil(
|
|
60
|
+
`d-flex ai-center tc-primary-500`,
|
|
61
|
+
styles.icon,
|
|
62
|
+
styles[`icon${density}`],
|
|
63
|
+
classNames?.icon
|
|
64
|
+
)}
|
|
65
|
+
>
|
|
66
|
+
{icon}
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
|
|
70
|
+
<div className='d-flex jc-between w100'>
|
|
71
|
+
<div className='d-flex jc-center gap8 fd-column tc-grey-900 w100'>
|
|
72
|
+
{label && (
|
|
73
|
+
<h3
|
|
74
|
+
className={classNamesUtil('p-p--small', classNames?.label)}
|
|
75
|
+
>
|
|
76
|
+
{label}
|
|
77
|
+
</h3>
|
|
78
|
+
)}
|
|
79
|
+
|
|
80
|
+
{title && (
|
|
81
|
+
<h2
|
|
82
|
+
className={classNamesUtil(classNames?.title, {
|
|
83
|
+
large:'p-h3',
|
|
84
|
+
medium:'p-h4',
|
|
85
|
+
small:'p-p',
|
|
86
|
+
}[titleVariant])}
|
|
87
|
+
>
|
|
88
|
+
{title}
|
|
89
|
+
</h2>
|
|
90
|
+
)}
|
|
91
|
+
|
|
92
|
+
{description && (
|
|
93
|
+
<div
|
|
94
|
+
className={classNamesUtil(
|
|
95
|
+
'tc-grey-600',
|
|
96
|
+
classNames?.description,
|
|
97
|
+
descriptionVariant === 'small' ? 'p-p--small' : 'p-p'
|
|
98
|
+
)}
|
|
99
|
+
>
|
|
100
|
+
{description}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
{onClick && (
|
|
106
|
+
<div
|
|
107
|
+
className={classNamesUtil(
|
|
108
|
+
styles.actionIcon,
|
|
109
|
+
classNames?.actionIcon,
|
|
110
|
+
styles[`actionIcon${density}`],
|
|
111
|
+
'd-flex ai-center'
|
|
112
|
+
)}
|
|
113
|
+
>
|
|
114
|
+
{actionIcon || <ChevronRightIcon size={24} />}
|
|
115
|
+
</div>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{children && (
|
|
121
|
+
<div className={classNames?.children}>{children}</div>
|
|
122
|
+
)}
|
|
123
|
+
</section>
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const Card = (props: CardProps) => {
|
|
127
|
+
const { onClick } = props;
|
|
128
|
+
|
|
129
|
+
if (onClick) {
|
|
130
|
+
return (
|
|
131
|
+
<button
|
|
132
|
+
className={classNamesUtil('c-pointer d-flex w100 br8', styles.button)}
|
|
133
|
+
onClick={onClick}
|
|
134
|
+
type="button"
|
|
135
|
+
>
|
|
136
|
+
<CardContent {...props} />
|
|
137
|
+
</button>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return <CardContent {...props} />;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { Card };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@use '../../scss/public/colors' as *;
|
|
2
|
+
|
|
3
|
+
.button {
|
|
4
|
+
border: 1px solid transparent;
|
|
5
|
+
color: $ds-grey-900;
|
|
6
|
+
outline-color: $ds-primary-500;
|
|
7
|
+
transition: all 0.2s ease-in-out;
|
|
8
|
+
|
|
9
|
+
&:hover {
|
|
10
|
+
border-color: $ds-primary-500;
|
|
11
|
+
color: $ds-primary-500;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.icon {
|
|
16
|
+
margin-right: 12px;
|
|
17
|
+
|
|
18
|
+
&balanced {
|
|
19
|
+
margin-right: 16px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&spacious {
|
|
23
|
+
margin-right: 24px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.actionIcon {
|
|
28
|
+
margin-left: 12px;
|
|
29
|
+
|
|
30
|
+
&balanced {
|
|
31
|
+
margin-left: 16px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&spacious {
|
|
35
|
+
margin-left: 24px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -207,6 +207,39 @@ export const RadioWithCustomLabel = ({ onChange, wide, classNames, inlineLayout
|
|
|
207
207
|
);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
export const RadioWithCustomLabelInline = ({ onChange, wide, classNames, inlineLayout }: RadioProps<string>) => {
|
|
211
|
+
const [checkedValues, setCheckedValues] = useState<string>();
|
|
212
|
+
|
|
213
|
+
const handleOnChange = (newValue: string) => {
|
|
214
|
+
setCheckedValues(newValue);
|
|
215
|
+
onChange(newValue);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<Radio
|
|
220
|
+
options={{
|
|
221
|
+
BIGDOG: {
|
|
222
|
+
icon: () => <img src={images.bigDog} alt='' />,
|
|
223
|
+
title: 'Dog',
|
|
224
|
+
},
|
|
225
|
+
FISH:{
|
|
226
|
+
icon: () => <img src={images.brokenAquarium} alt='' />,
|
|
227
|
+
title: 'Fish',
|
|
228
|
+
},
|
|
229
|
+
OTHER:{
|
|
230
|
+
icon: () => <img src={images.brokenGlass} alt='' />,
|
|
231
|
+
title: 'Other',
|
|
232
|
+
}
|
|
233
|
+
}}
|
|
234
|
+
onChange={handleOnChange}
|
|
235
|
+
inlineIcon
|
|
236
|
+
value={checkedValues}
|
|
237
|
+
classNames={{ option: "w30" }}
|
|
238
|
+
inlineLayout
|
|
239
|
+
/>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
210
243
|
RadioStory.storyName = 'Radio';
|
|
211
244
|
|
|
212
245
|
export const RadioIconOnly = ({ onChange }: RadioProps<string>) => {
|
|
@@ -15,6 +15,7 @@ export interface RadioProps<ValueType extends string> {
|
|
|
15
15
|
onChange: (value: ValueType) => void;
|
|
16
16
|
wide?: boolean;
|
|
17
17
|
inlineLayout?: boolean;
|
|
18
|
+
inlineIcon?: boolean;
|
|
18
19
|
classNames?: {
|
|
19
20
|
container?: string;
|
|
20
21
|
label?: string;
|
|
@@ -29,6 +30,7 @@ export const Radio = <ValueType extends string>({
|
|
|
29
30
|
onChange,
|
|
30
31
|
wide = false,
|
|
31
32
|
inlineLayout = false,
|
|
33
|
+
inlineIcon = false,
|
|
32
34
|
classNames: classNamesObj,
|
|
33
35
|
bordered = true,
|
|
34
36
|
}: RadioProps<ValueType>) => {
|
|
@@ -81,14 +83,23 @@ export const Radio = <ValueType extends string>({
|
|
|
81
83
|
<label
|
|
82
84
|
htmlFor={currentValue}
|
|
83
85
|
className={classNames(classNamesObj?.label, 'p-label', {
|
|
84
|
-
'jc-center': customIcon,
|
|
85
|
-
'fd-column': customIcon,
|
|
86
|
+
'jc-center': customIcon && !inlineIcon,
|
|
87
|
+
'fd-column': customIcon && !inlineIcon,
|
|
86
88
|
'p-label--bordered': bordered,
|
|
87
89
|
})}
|
|
88
90
|
data-cy={`radio-${currentValue}`}
|
|
89
91
|
data-testid={`radio-${currentValue}`}
|
|
90
92
|
>
|
|
91
|
-
{customIcon &&
|
|
93
|
+
{customIcon && (
|
|
94
|
+
<div
|
|
95
|
+
className={classNames(
|
|
96
|
+
"d-inline-flex ai-center jc-center",
|
|
97
|
+
inlineIcon ? "mr8" : "mt8"
|
|
98
|
+
)}
|
|
99
|
+
>
|
|
100
|
+
{customIcon?.(checked)}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
92
103
|
|
|
93
104
|
{isRadioLabelObject(label) ? (
|
|
94
105
|
<div>
|
|
@@ -35,7 +35,7 @@ const story = {
|
|
|
35
35
|
},
|
|
36
36
|
args: {
|
|
37
37
|
title: 'We couldn’t open the chat',
|
|
38
|
-
description: '
|
|
38
|
+
description: "We couldn't open the chat description. We couldn't open the chat description.",
|
|
39
39
|
action: {
|
|
40
40
|
title: 'Send an email',
|
|
41
41
|
onClick: () => {}
|
|
@@ -52,7 +52,12 @@ const FakeInlineToast = ({
|
|
|
52
52
|
type
|
|
53
53
|
}: Omit<ToastProps, 'onDismiss'>) => (
|
|
54
54
|
<div className='mb32'>
|
|
55
|
-
<div
|
|
55
|
+
<div
|
|
56
|
+
className={classNames(styles.toast, 'br8 bs-lg d-inline-flex')}
|
|
57
|
+
style={{
|
|
58
|
+
padding: "12px 20px"
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
56
61
|
<Toast
|
|
57
62
|
title={title}
|
|
58
63
|
onDismiss={() => {}}
|
|
@@ -37,14 +37,18 @@ const Toast = ({
|
|
|
37
37
|
title,
|
|
38
38
|
type = "success"
|
|
39
39
|
}: ToastProps) => (
|
|
40
|
-
<div
|
|
40
|
+
<div
|
|
41
|
+
className={classNames(
|
|
42
|
+
styles.toastContent,
|
|
43
|
+
'd-flex jc-between w100'
|
|
44
|
+
)}>
|
|
41
45
|
<div
|
|
42
46
|
className={classNames(
|
|
43
47
|
styles.toastSidebar,
|
|
44
48
|
styles[`toastSidebar--${type}`]
|
|
45
49
|
)}
|
|
46
50
|
/>
|
|
47
|
-
<div className='
|
|
51
|
+
<div className='d-flex fd-column jc-center ta-left mr8'>
|
|
48
52
|
<h4 className='p-h4'>{title}</h4>
|
|
49
53
|
|
|
50
54
|
{description && (
|
|
@@ -56,7 +60,7 @@ const Toast = ({
|
|
|
56
60
|
className={classNames(
|
|
57
61
|
styles.actionButton,
|
|
58
62
|
styles[`actionButton--${type}`],
|
|
59
|
-
'mt8 c-pointer'
|
|
63
|
+
'mt8 c-pointer ta-left'
|
|
60
64
|
)}
|
|
61
65
|
onClick={() => {
|
|
62
66
|
action.onClick();
|
|
@@ -75,7 +79,7 @@ const Toast = ({
|
|
|
75
79
|
onClick={onDismiss}
|
|
76
80
|
data-testid="toast-close-button"
|
|
77
81
|
>
|
|
78
|
-
<XIcon />
|
|
82
|
+
<XIcon size={24} />
|
|
79
83
|
</button>
|
|
80
84
|
</div>
|
|
81
85
|
</div>
|
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
.toast {
|
|
9
9
|
position: relative;
|
|
10
10
|
margin: 0;
|
|
11
|
+
padding: 0;
|
|
11
12
|
width: 392px;
|
|
12
13
|
overflow: hidden;
|
|
13
|
-
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.toastContent {
|
|
17
|
+
padding: 4px 0 4px 8px;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
.toastSidebar {
|
|
@@ -67,18 +71,18 @@
|
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
&--success {
|
|
70
|
-
color: $ds-
|
|
74
|
+
color: $ds-spearmint-700;
|
|
71
75
|
|
|
72
76
|
&:hover {
|
|
73
|
-
color: $ds-
|
|
77
|
+
color: $ds-spearmint-900;
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
&--information {
|
|
78
|
-
color: $ds-blue-
|
|
82
|
+
color: $ds-blue-700;
|
|
79
83
|
|
|
80
84
|
&:hover {
|
|
81
|
-
color: $ds-blue-
|
|
85
|
+
color: $ds-blue-900;
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
|
package/src/lib/index.tsx
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
import { SegmentedControl } from './components/segmentedControl';
|
|
45
45
|
import { Markdown } from './components/markdown';
|
|
46
46
|
import { Link } from './components/link';
|
|
47
|
-
import { images } from './util/images';
|
|
47
|
+
import { illustrations, images, IllustrationKeys } from './util/images';
|
|
48
48
|
import { Spinner } from './components/spinner';
|
|
49
49
|
import { Toggle } from './components/input/toggle';
|
|
50
50
|
import { Toaster, toast } from './components/toast';
|
|
@@ -86,13 +86,15 @@ export {
|
|
|
86
86
|
InformationBox,
|
|
87
87
|
Badge,
|
|
88
88
|
images,
|
|
89
|
+
illustrations,
|
|
89
90
|
Spinner,
|
|
90
91
|
Toggle,
|
|
91
92
|
Toaster,
|
|
92
|
-
toast
|
|
93
|
+
toast,
|
|
93
94
|
};
|
|
94
95
|
|
|
95
96
|
export type {
|
|
97
|
+
IllustrationKeys,
|
|
96
98
|
FileType,
|
|
97
99
|
MultiDropzoneProps,
|
|
98
100
|
TableHeader,
|
package/src/lib/models/styles.ts
CHANGED
|
@@ -56,4 +56,4 @@ export type Color = 'transparent' | 'blue-100'
|
|
|
56
56
|
| 'yellow-700'
|
|
57
57
|
| 'yellow-900';
|
|
58
58
|
|
|
59
|
-
export type Size = 0 | 8 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 88 | 96;
|
|
59
|
+
export type Size = 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 88 | 96;
|