@hellobetterdigitalnz/selwynui 0.0.1-37 → 0.0.1-39
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/Components/DataDisplay/ChatItenaryBlock/ChatItenaryBlockProps.d.ts +8 -1
- package/dist/Components/DataDisplay/PathwayBlock/PathwayBlockProps.d.ts +9 -0
- package/dist/Components/Form/Checkbox/Checkbox.d.ts +3 -0
- package/dist/Components/Form/Checkbox/CheckboxProps.d.ts +22 -0
- package/dist/Components/Form/EmailField/EmailField.d.ts +3 -0
- package/dist/Components/Form/EmailField/EmailField.stories.d.ts +13 -0
- package/dist/Components/Form/FormFieldHolder/FormFieldHolder.d.ts +3 -0
- package/dist/Components/Form/FormFieldHolder/FormFieldHolderProps.d.ts +13 -0
- package/dist/Components/Form/InputProps.d.ts +27 -0
- package/dist/Components/Form/LoadingInput/LoadingInput.d.ts +2 -0
- package/dist/Components/Form/SimpleForm/SimpleForm.d.ts +3 -0
- package/dist/Components/Form/SimpleForm/SimpleFormProps.d.ts +9 -0
- package/dist/Components/Form/SimpleForm/simple-form-bg-design.d.ts +2 -0
- package/dist/Components/Form/TextField/TextField.d.ts +3 -0
- package/dist/Components/Form/TextField/TextField.stories.d.ts +13 -0
- package/dist/Components/Form/TextField/TextFieldProps.d.ts +6 -0
- package/dist/Components/Form/Textarea/Textarea.d.ts +3 -0
- package/dist/Components/Form/Textarea/Textarea.stories.d.ts +14 -0
- package/dist/Components/Form/Textarea/TextareaProps.d.ts +26 -0
- package/dist/Components/Form/index.d.ts +3 -0
- package/dist/Components/Layout/Footer/FooterProps.d.ts +1 -1
- package/dist/index.cjs.js +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1515 -1408
- package/dist/index.es.js.map +1 -1
- package/dist/selwynui.css +1 -1
- package/package.json +3 -1
- package/src/Components/DataDisplay/Accordion/accordion.module.scss +49 -36
- package/src/Components/DataDisplay/ChatItenaryBlock/ChatItenaryBlock.stories.tsx +36 -6
- package/src/Components/DataDisplay/ChatItenaryBlock/ChatItenaryBlock.tsx +39 -20
- package/src/Components/DataDisplay/ChatItenaryBlock/ChatItenaryBlockProps.tsx +8 -1
- package/src/Components/DataDisplay/ChatItenaryBlock/chatItenaryBlock.module.scss +98 -41
- package/src/Components/DataDisplay/ImageContent/ImageContent.tsx +0 -1
- package/src/Components/DataDisplay/KPIBlock/kpiBlock.module.scss +96 -7
- package/src/Components/DataDisplay/ListingDetailBlock/ListingDetailBlock.tsx +5 -2
- package/src/Components/DataDisplay/ListingDetailBlock/listingDetailBlock.module.scss +130 -15
- package/src/Components/DataDisplay/PathwayBlock/PathwayBlock.stories.tsx +6 -0
- package/src/Components/DataDisplay/PathwayBlock/PathwayBlock.tsx +4 -1
- package/src/Components/DataDisplay/PathwayBlock/PathwayBlockProps.tsx +9 -0
- package/src/Components/DataDisplay/TestimonyCard/TestimonyCard.stories.tsx +2 -1
- package/src/Components/DataDisplay/TestimonyCard/TestimonyCard.tsx +1 -1
- package/src/Components/DataDisplay/TestimonyCard/testimonyCard.module.scss +1 -3
- package/src/Components/Form/Checkbox/Checkbox.stories.tsx +51 -0
- package/src/Components/Form/Checkbox/Checkbox.tsx +111 -0
- package/src/Components/Form/Checkbox/CheckboxProps.tsx +24 -0
- package/src/Components/Form/Checkbox/checkbox.module.scss +105 -0
- package/src/Components/Form/EmailField/EmailField.stories.ts +23 -0
- package/src/Components/Form/EmailField/EmailField.tsx +56 -0
- package/src/Components/Form/FormFieldHolder/FormFieldHolder.stories.tsx +31 -0
- package/src/Components/Form/FormFieldHolder/FormFieldHolder.tsx +55 -0
- package/src/Components/Form/FormFieldHolder/FormFieldHolderProps.tsx +15 -0
- package/src/Components/Form/FormFieldHolder/formHolder.module.scss +68 -0
- package/src/Components/Form/InputProps.tsx +30 -0
- package/src/Components/Form/LoadingInput/LoadingInput.tsx +12 -0
- package/src/Components/Form/LoadingInput/loadingInput.module.scss +15 -0
- package/src/Components/Form/SimpleForm/SimpleForm.stories.tsx +54 -0
- package/src/Components/Form/SimpleForm/SimpleForm.tsx +55 -0
- package/src/Components/Form/SimpleForm/SimpleFormProps.tsx +11 -0
- package/src/Components/Form/SimpleForm/simple-form-bg-design.svg +14 -0
- package/src/Components/Form/SimpleForm/simple-form-bg-design.tsx +21 -0
- package/src/Components/Form/SimpleForm/simpleForm.module.scss +36 -0
- package/src/Components/Form/TextField/TextField.stories.ts +22 -0
- package/src/Components/Form/TextField/TextField.tsx +62 -0
- package/src/Components/Form/TextField/TextFieldProps.tsx +8 -0
- package/src/Components/Form/Textarea/Textarea.stories.ts +31 -0
- package/src/Components/Form/Textarea/Textarea.tsx +74 -0
- package/src/Components/Form/Textarea/TextareaProps.tsx +28 -0
- package/src/Components/Form/Textarea/textarea.module.scss +48 -0
- package/src/Components/Form/index.ts +6 -1
- package/src/Components/Form/inputs.module.scss +172 -0
- package/src/Components/Layout/Footer/Footer.tsx +0 -1
- package/src/Components/Layout/Footer/FooterProps.tsx +1 -1
- package/src/Components/Shared/Container/container.module.scss +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
padding: 32px;
|
|
5
5
|
border-radius: 8px;
|
|
6
6
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
7
|
+
position: relative;
|
|
7
8
|
|
|
8
9
|
&::before {
|
|
9
10
|
content: '';
|
|
@@ -16,27 +17,51 @@
|
|
|
16
17
|
transform: translateX(-50%);
|
|
17
18
|
z-index: 1;
|
|
18
19
|
pointer-events: none;
|
|
19
|
-
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
@media (max-width: 900px) {
|
|
23
|
-
&::before {
|
|
21
|
+
@media (max-width: 900px) {
|
|
24
22
|
display: none;
|
|
25
23
|
}
|
|
26
24
|
}
|
|
25
|
+
|
|
26
|
+
@media (max-width: 900px) {
|
|
27
|
+
flex-direction: column-reverse;
|
|
28
|
+
padding: 24px 16px;
|
|
29
|
+
gap: 48px;
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
.mainContent {
|
|
30
34
|
width: 50%;
|
|
31
|
-
padding-left: 152px;
|
|
32
35
|
padding-right: 72px;
|
|
33
36
|
|
|
37
|
+
@media (max-width: 1200px) {
|
|
38
|
+
padding-left: 80px;
|
|
39
|
+
padding-right: 40px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media (max-width: 900px) {
|
|
43
|
+
width: 100%;
|
|
44
|
+
padding-left: 0;
|
|
45
|
+
padding-right: 0;
|
|
46
|
+
order: 2;
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
.title {
|
|
35
50
|
font-size: 48px;
|
|
36
51
|
font-weight: 400;
|
|
37
52
|
line-height: 1;
|
|
38
53
|
letter-spacing: -1.92px;
|
|
39
54
|
margin: 0 0 72px 0;
|
|
55
|
+
|
|
56
|
+
@media (max-width: 900px) {
|
|
57
|
+
font-size: 36px;
|
|
58
|
+
margin: 0 0 40px 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media (max-width: 480px) {
|
|
62
|
+
font-size: 28px;
|
|
63
|
+
margin: 0 0 32px 0;
|
|
64
|
+
}
|
|
40
65
|
}
|
|
41
66
|
|
|
42
67
|
.description {
|
|
@@ -44,12 +69,32 @@
|
|
|
44
69
|
line-height: 1.3;
|
|
45
70
|
font-weight: 400;
|
|
46
71
|
margin-bottom: 72px;
|
|
72
|
+
|
|
73
|
+
@media (max-width: 900px) {
|
|
74
|
+
font-size: 18px;
|
|
75
|
+
margin-bottom: 48px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (max-width: 480px) {
|
|
79
|
+
font-size: 16px;
|
|
80
|
+
margin-bottom: 32px;
|
|
81
|
+
}
|
|
47
82
|
}
|
|
48
83
|
|
|
49
84
|
.sectionTitle {
|
|
50
85
|
font-size: 24px;
|
|
51
86
|
font-weight: 600;
|
|
52
87
|
margin: 72px 0 32px 0;
|
|
88
|
+
|
|
89
|
+
@media (max-width: 900px) {
|
|
90
|
+
font-size: 20px;
|
|
91
|
+
margin: 48px 0 24px 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media (max-width: 480px) {
|
|
95
|
+
font-size: 18px;
|
|
96
|
+
margin: 32px 0 20px 0;
|
|
97
|
+
}
|
|
53
98
|
}
|
|
54
99
|
}
|
|
55
100
|
|
|
@@ -60,6 +105,11 @@
|
|
|
60
105
|
display: grid;
|
|
61
106
|
grid-template-columns: repeat(2, 1fr);
|
|
62
107
|
gap: 12px 24px;
|
|
108
|
+
|
|
109
|
+
@media (max-width: 600px) {
|
|
110
|
+
grid-template-columns: 1fr;
|
|
111
|
+
gap: 16px;
|
|
112
|
+
}
|
|
63
113
|
}
|
|
64
114
|
|
|
65
115
|
.facilityItem {
|
|
@@ -70,19 +120,45 @@
|
|
|
70
120
|
line-height: 1.4;
|
|
71
121
|
gap: 12px;
|
|
72
122
|
|
|
123
|
+
@media (max-width: 900px) {
|
|
124
|
+
font-size: 16px;
|
|
125
|
+
}
|
|
126
|
+
|
|
73
127
|
svg {
|
|
74
128
|
height: 32px;
|
|
75
129
|
width: 32px;
|
|
76
130
|
color: var(--color-bg);
|
|
131
|
+
flex-shrink: 0;
|
|
132
|
+
|
|
133
|
+
@media (max-width: 900px) {
|
|
134
|
+
height: 24px;
|
|
135
|
+
width: 24px;
|
|
136
|
+
}
|
|
77
137
|
}
|
|
78
138
|
}
|
|
79
139
|
|
|
80
|
-
|
|
81
140
|
.sidebar {
|
|
141
|
+
width: 50%;
|
|
82
142
|
display: flex;
|
|
83
143
|
flex-direction: column;
|
|
84
|
-
gap:
|
|
144
|
+
gap: 60px;
|
|
85
145
|
padding-left: 72px;
|
|
146
|
+
|
|
147
|
+
@media (max-width: 1200px) {
|
|
148
|
+
padding-left: 40px;
|
|
149
|
+
gap: 48px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@media (max-width: 900px) {
|
|
153
|
+
width: 100%;
|
|
154
|
+
padding-left: 0;
|
|
155
|
+
gap: 40px;
|
|
156
|
+
order: 1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (max-width: 480px) {
|
|
160
|
+
gap: 32px;
|
|
161
|
+
}
|
|
86
162
|
}
|
|
87
163
|
|
|
88
164
|
.infoItem {
|
|
@@ -90,36 +166,75 @@
|
|
|
90
166
|
gap: 16px;
|
|
91
167
|
align-items: flex-start;
|
|
92
168
|
|
|
169
|
+
@media (max-width: 900px) {
|
|
170
|
+
gap: 12px;
|
|
171
|
+
}
|
|
172
|
+
|
|
93
173
|
svg {
|
|
94
174
|
color: var(--color-taste);
|
|
95
175
|
width: 48px;
|
|
96
176
|
height: 48px;
|
|
177
|
+
flex-shrink: 0;
|
|
178
|
+
|
|
179
|
+
@media (max-width: 900px) {
|
|
180
|
+
width: 40px;
|
|
181
|
+
height: 40px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@media (max-width: 480px) {
|
|
185
|
+
width: 32px;
|
|
186
|
+
height: 32px;
|
|
187
|
+
}
|
|
97
188
|
}
|
|
98
189
|
}
|
|
99
190
|
|
|
191
|
+
.sidebarItems {
|
|
192
|
+
flex: 1;
|
|
193
|
+
}
|
|
100
194
|
|
|
101
195
|
.infoLabel {
|
|
102
196
|
font-size: 24px;
|
|
103
197
|
letter-spacing: -0.48px;
|
|
104
198
|
line-height: 1.3;
|
|
105
199
|
font-weight: 700;
|
|
200
|
+
|
|
201
|
+
@media (max-width: 900px) {
|
|
202
|
+
font-size: 18px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@media (max-width: 480px) {
|
|
206
|
+
font-size: 16px;
|
|
207
|
+
}
|
|
106
208
|
}
|
|
107
209
|
|
|
108
210
|
.infoValue {
|
|
109
211
|
font-size: 24px;
|
|
110
212
|
line-height: 1.3;
|
|
111
213
|
font-weight: 400;
|
|
112
|
-
margin-top:
|
|
113
|
-
|
|
214
|
+
margin-top: 0;
|
|
215
|
+
letter-spacing: -0.48px;
|
|
216
|
+
|
|
217
|
+
@media (max-width: 900px) {
|
|
218
|
+
font-size: 18px;
|
|
219
|
+
}
|
|
114
220
|
|
|
221
|
+
@media (max-width: 480px) {
|
|
222
|
+
font-size: 16px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
115
225
|
|
|
226
|
+
.infoValuePhone {
|
|
227
|
+
font-size: 24px;
|
|
228
|
+
text-decoration: underline;
|
|
229
|
+
line-height: 1.3;
|
|
230
|
+
font-weight: 400;
|
|
231
|
+
margin-top: 0;
|
|
116
232
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
.listingDetail {
|
|
120
|
-
grid-template-columns: 1fr;
|
|
233
|
+
@media (max-width: 900px) {
|
|
234
|
+
font-size: 18px;
|
|
121
235
|
}
|
|
122
|
-
|
|
123
|
-
|
|
236
|
+
|
|
237
|
+
@media (max-width: 480px) {
|
|
238
|
+
font-size: 16px;
|
|
124
239
|
}
|
|
125
240
|
}
|
|
@@ -27,14 +27,20 @@ const PathwayBlockTemplate: Story = {
|
|
|
27
27
|
pillar="visit"
|
|
28
28
|
cards={[
|
|
29
29
|
{
|
|
30
|
+
title: "Lorem ipsum",
|
|
31
|
+
date: "2024-01-15",
|
|
30
32
|
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
|
31
33
|
image: "https://images.pexels.com/photos/1854897/pexels-photo-1854897.jpeg"
|
|
32
34
|
},
|
|
33
35
|
{
|
|
36
|
+
title: "Lorem ipsum",
|
|
37
|
+
date: "2024-01-16",
|
|
34
38
|
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
|
35
39
|
image: "https://images.pexels.com/photos/1595655/pexels-photo-1595655.jpeg"
|
|
36
40
|
},
|
|
37
41
|
{
|
|
42
|
+
title: "Lorem ipsum",
|
|
43
|
+
date: "2024-01-17",
|
|
38
44
|
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
|
|
39
45
|
image: "https://images.pexels.com/photos/3184291/pexels-photo-3184291.jpeg"
|
|
40
46
|
}
|
|
@@ -20,8 +20,11 @@ const PathwayBlock = (props: PathwayBlockProps) => {
|
|
|
20
20
|
<div className={styles.card}>
|
|
21
21
|
<DetailsCard
|
|
22
22
|
key={index}
|
|
23
|
-
title={card.
|
|
23
|
+
title={card.title}
|
|
24
|
+
description={card.description}
|
|
24
25
|
image={card.image}
|
|
26
|
+
link={card.link}
|
|
27
|
+
variation={'long'}
|
|
25
28
|
/>
|
|
26
29
|
</div>
|
|
27
30
|
))}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export interface PathwayCard {
|
|
2
|
+
title: string;
|
|
2
3
|
date: string;
|
|
3
4
|
description: string;
|
|
4
5
|
image: string;
|
|
6
|
+
link?: {
|
|
7
|
+
title?: string
|
|
8
|
+
href?: string
|
|
9
|
+
target?: "_blank" | "_self" | "_parent" | "_top"
|
|
10
|
+
rel?: string
|
|
11
|
+
} | undefined;
|
|
12
|
+
category?: "all" | "adventure" | "ski" | "nature" ;
|
|
13
|
+
variation: 'long' | 'short';
|
|
5
14
|
}
|
|
6
15
|
|
|
7
16
|
interface PathwayBlockProps {
|
|
@@ -21,7 +21,7 @@ const TestimonyCardTemplate: Story = {
|
|
|
21
21
|
render: () => {
|
|
22
22
|
return (
|
|
23
23
|
<>
|
|
24
|
-
<ElementHolder paddingTop="sm" paddingBottom="sm" pillar="visit" level="
|
|
24
|
+
<ElementHolder paddingTop="sm" paddingBottom="sm" pillar="visit" level="primary">
|
|
25
25
|
<TestimonyCard
|
|
26
26
|
testimonies={[
|
|
27
27
|
{
|
|
@@ -30,6 +30,7 @@ const TestimonyCardTemplate: Story = {
|
|
|
30
30
|
author: '— Liam & Emma'
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
+
image:"https://images.pexels.com/photos/1906658/pexels-photo-1906658.jpeg",
|
|
33
34
|
testimony: 'The sense of community here is incredible.',
|
|
34
35
|
author: '— Sarah & James'
|
|
35
36
|
}
|
|
@@ -36,7 +36,7 @@ const TestimonyCard = (props: TestimonyCardProps) => {
|
|
|
36
36
|
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="39" viewBox="0 0 56 39" fill="none">
|
|
37
37
|
<path d="M23.1134 27.0562C23.1134 32.4847 18.9331 36 13.4798 36C8.02648 36 4.75277 33.6194 3.3652 27.0562C1.97764 20.493 7.78599 17.227 13.2393 17.227C18.6926 17.227 23.1134 21.6276 23.1134 27.0562Z" fill="#92C134"/>
|
|
38
38
|
<path d="M53.0015 27.0558C53.0015 32.4844 48.8212 35.9997 43.3679 35.9997C37.9145 35.9997 34.6408 33.619 33.2533 27.0558C31.8657 20.4926 37.674 17.2267 43.1274 17.2267C48.5807 17.2267 53.0015 21.6273 53.0015 27.0558Z" fill="#92C134"/>
|
|
39
|
-
<path d="M3.3652 27.0562C4.75277 33.6194 8.02648 36 13.4798 36C18.9331 36 23.1134 32.4847 23.1134 27.0562C23.1134 21.6276 18.6926 17.227 13.2393 17.227C7.78599 17.227 1.97764 20.493 3.3652 27.0562ZM3.3652 27.0562C1.97764 20.493 4.78431 13.7613 7.99019 9.54638C11.1961 5.33146 17.2399 2.24873 21.5318 3.16115M33.2533 27.0558C34.6408 33.619 37.9145 35.9997 43.3679 35.9997C48.8212 35.9997 53.0015 32.4844 53.0015 27.0558C53.0015 21.6273 48.5807 17.2267 43.1274 17.2267C37.674 17.2267 31.8657 20.4926 33.2533 27.0558ZM33.2533 27.0558C31.8657 20.4926 34.6724 13.761 37.8782 9.54606C41.0841 5.33115 47.1279 2.24841 51.4199 3.16083" stroke="#92C134"
|
|
39
|
+
<path d="M3.3652 27.0562C4.75277 33.6194 8.02648 36 13.4798 36C18.9331 36 23.1134 32.4847 23.1134 27.0562C23.1134 21.6276 18.6926 17.227 13.2393 17.227C7.78599 17.227 1.97764 20.493 3.3652 27.0562ZM3.3652 27.0562C1.97764 20.493 4.78431 13.7613 7.99019 9.54638C11.1961 5.33146 17.2399 2.24873 21.5318 3.16115M33.2533 27.0558C34.6408 33.619 37.9145 35.9997 43.3679 35.9997C48.8212 35.9997 53.0015 32.4844 53.0015 27.0558C53.0015 21.6273 48.5807 17.2267 43.1274 17.2267C37.674 17.2267 31.8657 20.4926 33.2533 27.0558ZM33.2533 27.0558C31.8657 20.4926 34.6724 13.761 37.8782 9.54606C41.0841 5.33115 47.1279 2.24841 51.4199 3.16083" stroke="#92C134" strokeWidth="6" strokeLinecap="round" strokeLinejoin="round"/>
|
|
40
40
|
</svg>
|
|
41
41
|
</div>
|
|
42
42
|
<h6>{testimonies[currentIndex].testimony}</h6>
|
|
@@ -19,13 +19,11 @@
|
|
|
19
19
|
|
|
20
20
|
.testimonyCardLeft {
|
|
21
21
|
flex-shrink: 0;
|
|
22
|
-
padding-top: 96px;
|
|
23
|
-
padding-bottom: 96px;
|
|
24
22
|
|
|
25
23
|
@media (max-width: 834px) {
|
|
26
24
|
padding-top: 0;
|
|
27
25
|
padding-bottom: 0;
|
|
28
|
-
width: 100
|
|
26
|
+
width: calc(100% + 32px);
|
|
29
27
|
display: flex;
|
|
30
28
|
justify-content: center;
|
|
31
29
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Checkbox from "./Checkbox";
|
|
3
|
+
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Form / Checkbox',
|
|
7
|
+
component: Checkbox,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
} satisfies Meta<typeof Checkbox>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
16
|
+
|
|
17
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
checked: false,
|
|
21
|
+
label:'checkbox',
|
|
22
|
+
id:'ch_1'
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Checked: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
checked: true
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Disabled: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
checked: true,
|
|
35
|
+
disabled: true
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const CheckedDisabled: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
checked: true,
|
|
42
|
+
disabled: true
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Error: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
checked: true,
|
|
49
|
+
error: true
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import CheckboxProps from "./CheckboxProps";
|
|
3
|
+
import styles from "./checkbox.module.scss";
|
|
4
|
+
import {useEffect, useState, MouseEvent} from "react";
|
|
5
|
+
|
|
6
|
+
const Checkbox = (props: CheckboxProps) => {
|
|
7
|
+
const {
|
|
8
|
+
label,
|
|
9
|
+
name,
|
|
10
|
+
checked,
|
|
11
|
+
id,
|
|
12
|
+
value,
|
|
13
|
+
placeholder,
|
|
14
|
+
extraClass,
|
|
15
|
+
disabled,
|
|
16
|
+
error,
|
|
17
|
+
ariaLabel,
|
|
18
|
+
required,
|
|
19
|
+
readonly,
|
|
20
|
+
onClick,
|
|
21
|
+
onChange,
|
|
22
|
+
...args
|
|
23
|
+
} = props;
|
|
24
|
+
|
|
25
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
26
|
+
|
|
27
|
+
const classesHolders = ["checkboxHolder", styles.checkboxHolder];
|
|
28
|
+
const classes = ["checkbox", styles.checkbox];
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if (extraClass) {
|
|
32
|
+
classesHolders.push(extraClass);
|
|
33
|
+
}
|
|
34
|
+
if (error) {
|
|
35
|
+
classesHolders.push(styles.error);
|
|
36
|
+
classes.push(styles.error);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (disabled) {
|
|
40
|
+
classesHolders.push(styles.disabled);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setIsChecked(checked ? checked : false);
|
|
46
|
+
}, [checked]);
|
|
47
|
+
|
|
48
|
+
const handleClick = (e: MouseEvent) => {
|
|
49
|
+
setIsChecked(!isChecked);
|
|
50
|
+
if ( onClick) {
|
|
51
|
+
onClick(e, isChecked);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onChangeHandler = (e:any) => {
|
|
56
|
+
if (onChange) {
|
|
57
|
+
onChange(e);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className={cx(classesHolders)}>
|
|
63
|
+
<div className={cx(classes)}>
|
|
64
|
+
<input
|
|
65
|
+
id={id}
|
|
66
|
+
name={name}
|
|
67
|
+
checked={isChecked}
|
|
68
|
+
type={"checkbox"}
|
|
69
|
+
value={value}
|
|
70
|
+
placeholder={placeholder}
|
|
71
|
+
disabled={disabled}
|
|
72
|
+
readOnly={readonly}
|
|
73
|
+
required={required}
|
|
74
|
+
aria-label={ariaLabel ? ariaLabel : name}
|
|
75
|
+
aria-required={required ? "true" : "false"}
|
|
76
|
+
aria-invalid={error ? "true" : "false"}
|
|
77
|
+
aria-disabled={disabled ? "true" : "false"}
|
|
78
|
+
aria-readonly={readonly ? "true" : "false"}
|
|
79
|
+
onClick={handleClick}
|
|
80
|
+
onChange={onChangeHandler}
|
|
81
|
+
{...args}
|
|
82
|
+
/>
|
|
83
|
+
{!!isChecked && (
|
|
84
|
+
<svg
|
|
85
|
+
width="11"
|
|
86
|
+
height="10"
|
|
87
|
+
viewBox="0 0 11 10"
|
|
88
|
+
fill="none"
|
|
89
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
90
|
+
>
|
|
91
|
+
<path
|
|
92
|
+
d="M10.8425 2.10473C11.0378 2.29999 11.0378 2.61658 10.8425 2.81184L4.47856 9.1758C4.2833 9.37106 3.96672 9.37106 3.77146 9.1758L0.353775 5.75812C0.158513 5.56286 0.158513 5.24627 0.353775 5.05101L1.41443 3.99035C1.6097 3.79509 1.92628 3.79509 2.12154 3.99035L4.12501 5.99382L9.07476 1.04407C9.27002 0.84881 9.5866 0.84881 9.78187 1.04407L10.8425 2.10473Z"
|
|
93
|
+
fillRule="evenodd"
|
|
94
|
+
clipRule="evenodd"
|
|
95
|
+
fill="currentColor"
|
|
96
|
+
/>
|
|
97
|
+
</svg>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
{!!label && (
|
|
101
|
+
<label
|
|
102
|
+
htmlFor={id}
|
|
103
|
+
>
|
|
104
|
+
{label}
|
|
105
|
+
</label>
|
|
106
|
+
)}
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default Checkbox;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {ChangeEvent, FocusEvent, MouseEvent} from "react";
|
|
2
|
+
|
|
3
|
+
interface CheckboxProps {
|
|
4
|
+
label?:string;
|
|
5
|
+
name?: string;
|
|
6
|
+
id?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
extraClass?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
disabled?:boolean;
|
|
12
|
+
readonly?: boolean;
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
ariaLabeledby?: string;
|
|
17
|
+
ariaDescribedby?: string;
|
|
18
|
+
onClick?: (e: MouseEvent, checked?: boolean) => void;
|
|
19
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
20
|
+
onFocus?: (e: FocusEvent) => void;
|
|
21
|
+
onBlur?: (e: FocusEvent) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default CheckboxProps;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
.checkboxHolder {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
|
|
5
|
+
label {
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
font-size: var(--font-size-label);
|
|
8
|
+
line-height: var(--line-height-h3);
|
|
9
|
+
font-weight: var(--font-weight-h3);
|
|
10
|
+
margin-left: calc(var(--space-unit) * 3);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&.error {
|
|
14
|
+
label {
|
|
15
|
+
color: var(--color-error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.disabled {
|
|
20
|
+
label {
|
|
21
|
+
cursor: not-allowed;
|
|
22
|
+
color: var(--color-gray-200);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[dir="rtl"] {
|
|
29
|
+
.checkboxHolder {
|
|
30
|
+
label {
|
|
31
|
+
margin-right: calc(var(--space-unit) * 3);
|
|
32
|
+
margin-left: 0px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.checkbox {
|
|
38
|
+
position: relative;
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
flex-grow: 0;
|
|
43
|
+
|
|
44
|
+
input[type="checkbox"] {
|
|
45
|
+
-webkit-appearance: none;
|
|
46
|
+
width: 20px;
|
|
47
|
+
height: 20px;
|
|
48
|
+
border-radius: 4px;
|
|
49
|
+
background-color: var(--color-white);
|
|
50
|
+
border: 1px solid var(--color-visit);
|
|
51
|
+
outline: 2px solid transparent;
|
|
52
|
+
outline-offset: 2px;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
|
|
55
|
+
&:checked {
|
|
56
|
+
background-color: var(--color-gray-800);
|
|
57
|
+
border-color: var(--color-visit);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
border-color: var(--color-visit);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:focus {
|
|
65
|
+
outline: 2px solid var(--color-visit);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:disabled {
|
|
69
|
+
background-color: var(--color-gray-200);
|
|
70
|
+
border-color: var(--color-gray-200);
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
border-color: var(--color-gray-200);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&:checked {
|
|
78
|
+
border-color: var(--color-gray-200);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
svg {
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 50%;
|
|
86
|
+
left: 50%;
|
|
87
|
+
transform: translate(-50%, -50%);
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input[type="checkbox"] ~ svg {
|
|
92
|
+
color: var(--color-white);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&.error {
|
|
96
|
+
input[type="checkbox"] {
|
|
97
|
+
border-color: var(--color-error);
|
|
98
|
+
color: var(--color-white);
|
|
99
|
+
|
|
100
|
+
&:checked {
|
|
101
|
+
background-color: var(--color-error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import EmailField from './EmailField.tsx';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Form / EmailField',
|
|
8
|
+
component: EmailField,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
} satisfies Meta<typeof EmailField>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof EmailField>;
|
|
17
|
+
|
|
18
|
+
export const Example: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
placeholder:"Placeholder",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|