@kaizen/components 1.61.2 → 1.62.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/codemods/README.md +0 -1
- package/dist/cjs/{__containers__/GuidanceBlock/v2 → GuidanceBlock}/GuidanceBlock.cjs +6 -6
- package/dist/cjs/GuidanceBlock/GuidanceBlock.module.scss.cjs +33 -0
- package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +1 -1
- package/dist/cjs/__future__/Select/Select.cjs +1 -6
- package/dist/cjs/__future__/Select/subcomponents/ListBox/ListBox.cjs +1 -2
- package/dist/cjs/__future__/Select/subcomponents/ListBox/ListBox.module.scss.cjs +1 -2
- package/dist/cjs/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.cjs +2 -4
- package/dist/cjs/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.cjs +2 -3
- package/dist/cjs/index.cjs +2 -2
- package/dist/esm/{__containers__/GuidanceBlock/v2 → GuidanceBlock}/GuidanceBlock.mjs +6 -6
- package/dist/esm/GuidanceBlock/GuidanceBlock.module.scss.mjs +31 -0
- package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +1 -1
- package/dist/esm/__future__/Select/Select.mjs +1 -6
- package/dist/esm/__future__/Select/subcomponents/ListBox/ListBox.mjs +1 -2
- package/dist/esm/__future__/Select/subcomponents/ListBox/ListBox.module.scss.mjs +1 -2
- package/dist/esm/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.mjs +2 -4
- package/dist/esm/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.mjs +2 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/styles.css +1450 -1777
- package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.d.ts +4 -4
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/Collapsible/Collapsible/_docs/Collapsible.mdx +0 -2
- package/src/Filter/FilterSelect/FilterSelect.spec.tsx +1 -3
- package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.module.scss +2 -2
- package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.mdx +2 -2
- package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.stickersheet.stories.tsx +1 -1
- package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.stories.tsx +1 -1
- package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +5 -1
- package/src/MultiSelect/subcomponents/Popover/Popover.module.scss +1 -0
- package/src/__future__/Select/Select.spec.tsx +4 -4
- package/src/__future__/Select/Select.tsx +1 -10
- package/src/__future__/Select/subcomponents/ListBox/ListBox.module.scss +3 -3
- package/src/__future__/Select/subcomponents/ListBox/ListBox.tsx +1 -1
- package/src/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.scss +8 -2
- package/src/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.tsx +2 -7
- package/src/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.css +5 -0
- package/src/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.tsx +2 -6
- package/src/index.ts +1 -2
- package/codemods/updateGuidanceBlockVariantProp/index.ts +0 -19
- package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.spec.ts +0 -135
- package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.ts +0 -77
- package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.cjs +0 -160
- package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.cjs +0 -33
- package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.cjs +0 -28
- package/dist/cjs/containersV1.cjs +0 -4
- package/dist/cjs/containersV2.cjs +0 -4
- package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.mjs +0 -153
- package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.mjs +0 -31
- package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.mjs +0 -26
- package/dist/esm/containersV1.mjs +0 -1
- package/dist/esm/containersV2.mjs +0 -1
- package/dist/types/__containers__/GuidanceBlock/v2/GuidanceBlock.d.ts +0 -59
- package/dist/types/__containers__/GuidanceBlock/v2/index.d.ts +0 -1
- package/dist/types/__containers__/v1.d.ts +0 -1
- package/dist/types/__containers__/v2.d.ts +0 -1
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss +0 -356
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.spec.tsx +0 -82
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.tsx +0 -262
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.mdx +0 -38
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stickersheet.stories.tsx +0 -118
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stories.tsx +0 -152
- package/src/__containers__/GuidanceBlock/v2/index.ts +0 -1
- package/src/__containers__/v1.ts +0 -1
- package/src/__containers__/v2.ts +0 -1
- package/v1/containers/package.json +0 -5
- package/v2/containers/package.json +0 -5
- /package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/index.d.ts +0 -0
- /package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/types.d.ts +0 -0
- /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.spec.tsx +0 -0
- /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.tsx +0 -0
- /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/index.ts +0 -0
- /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/types.ts +0 -0
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
@import "~@kaizen/design-tokens/sass/shadow";
|
|
2
|
-
@import "~@kaizen/design-tokens/sass/border";
|
|
3
|
-
@import "~@kaizen/design-tokens/sass/layout";
|
|
4
|
-
@import "~@kaizen/design-tokens/sass/color";
|
|
5
|
-
@import "~@kaizen/design-tokens/sass/animation";
|
|
6
|
-
@import "~@kaizen/design-tokens/sass/spacing";
|
|
7
|
-
@import "../../../../styles/utils/responsive";
|
|
8
|
-
@import "../../../../styles/utils/button-reset";
|
|
9
|
-
|
|
10
|
-
@mixin guidance-block-under-480 {
|
|
11
|
-
@media (max-width: 480px) {
|
|
12
|
-
@content;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
$bannerPadding: $spacing-lg;
|
|
17
|
-
$ca-banner-fade-out: opacity $animation-duration-slow ease;
|
|
18
|
-
$ca-banner-collapse-height-delayed: margin-top $animation-duration-fast
|
|
19
|
-
$animation-duration-slow ease;
|
|
20
|
-
$illustration-size: 155px;
|
|
21
|
-
$scene-illustration-size: 300px;
|
|
22
|
-
|
|
23
|
-
.rightMargin {
|
|
24
|
-
margin-right: $spacing-8;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.noRightMargin {
|
|
28
|
-
margin-right: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.banner.noMaxWidth {
|
|
32
|
-
max-width: inherit;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.banner {
|
|
36
|
-
--border-width: var(--border-width-1);
|
|
37
|
-
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: column;
|
|
40
|
-
gap: $spacing-sm;
|
|
41
|
-
min-width: 320px;
|
|
42
|
-
max-width: $layout-breakpoints-large;
|
|
43
|
-
border: var(--border-width) var(--border-solid-border-style);
|
|
44
|
-
border-radius: $border-solid-border-radius;
|
|
45
|
-
padding: calc(#{$bannerPadding} - var(--border-width));
|
|
46
|
-
box-shadow: $shadow-small-box-shadow;
|
|
47
|
-
position: relative;
|
|
48
|
-
top: -1px;
|
|
49
|
-
transition: $ca-banner-fade-out, $ca-banner-collapse-height-delayed;
|
|
50
|
-
color: $color-purple-800;
|
|
51
|
-
|
|
52
|
-
@include ca-media-desktop {
|
|
53
|
-
min-height: calc(12rem - calc(#{$bannerPadding} * 2));
|
|
54
|
-
flex-direction: row;
|
|
55
|
-
gap: $spacing-md;
|
|
56
|
-
width: auto;
|
|
57
|
-
align-items: center;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@include ca-media-mobile {
|
|
61
|
-
min-width: unset;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.illustrationWrapper {
|
|
66
|
-
display: flex;
|
|
67
|
-
|
|
68
|
-
@include ca-media-tablet {
|
|
69
|
-
text-align: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
align-self: center;
|
|
72
|
-
padding: $spacing-sm;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@include ca-media-mobile {
|
|
76
|
-
display: none;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.illustration {
|
|
81
|
-
width: $illustration-size;
|
|
82
|
-
height: $illustration-size;
|
|
83
|
-
|
|
84
|
-
// This has been created to handle scene illustrations consistently until the tile component is created
|
|
85
|
-
.hasSceneIllustration & {
|
|
86
|
-
display: flex;
|
|
87
|
-
justify-content: center;
|
|
88
|
-
max-width: $scene-illustration-size;
|
|
89
|
-
max-height: $scene-illustration-size;
|
|
90
|
-
width: $scene-illustration-size;
|
|
91
|
-
height: auto;
|
|
92
|
-
|
|
93
|
-
figure {
|
|
94
|
-
max-height: 100%;
|
|
95
|
-
max-width: 100%;
|
|
96
|
-
aspect-ratio: 4/3;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
img {
|
|
100
|
-
height: 100%;
|
|
101
|
-
object-fit: contain;
|
|
102
|
-
object-position: center;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.descriptionContainer {
|
|
108
|
-
flex: 1;
|
|
109
|
-
text-align: center;
|
|
110
|
-
align-self: center;
|
|
111
|
-
max-width: 780px;
|
|
112
|
-
|
|
113
|
-
@include ca-media-desktop {
|
|
114
|
-
padding: 0 $spacing-sm;
|
|
115
|
-
text-align: left;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
@include ca-media-mobile {
|
|
119
|
-
margin: $spacing-sm;
|
|
120
|
-
max-width: 100%;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
[dir="rtl"] & {
|
|
124
|
-
@include ca-media-desktop {
|
|
125
|
-
padding: 0 $spacing-sm;
|
|
126
|
-
text-align: right;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.descriptionAndActions {
|
|
132
|
-
display: flex;
|
|
133
|
-
flex: 1;
|
|
134
|
-
align-items: center;
|
|
135
|
-
justify-content: space-between;
|
|
136
|
-
gap: $spacing-md;
|
|
137
|
-
|
|
138
|
-
@include ca-media-tablet-and-under {
|
|
139
|
-
flex-direction: column;
|
|
140
|
-
width: 100%;
|
|
141
|
-
align-items: unset;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.buttonContainer {
|
|
146
|
-
display: flex;
|
|
147
|
-
flex: 1 0 auto;
|
|
148
|
-
justify-content: center;
|
|
149
|
-
flex-direction: row-reverse;
|
|
150
|
-
gap: $spacing-sm;
|
|
151
|
-
min-width: max-content;
|
|
152
|
-
|
|
153
|
-
@include ca-media-tablet-and-up {
|
|
154
|
-
text-align: center;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
@include ca-media-mobile {
|
|
158
|
-
flex-direction: column;
|
|
159
|
-
width: 100%;
|
|
160
|
-
margin-top: $spacing-xs;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
[dir="rtl"] & svg {
|
|
164
|
-
transform: rotate(180deg);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.hidden {
|
|
169
|
-
opacity: 0%;
|
|
170
|
-
margin-bottom: 0;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.headingWrapper {
|
|
174
|
-
margin-bottom: $spacing-md;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.cancel {
|
|
178
|
-
@include button-reset;
|
|
179
|
-
|
|
180
|
-
cursor: pointer;
|
|
181
|
-
|
|
182
|
-
.icon {
|
|
183
|
-
opacity: 70%;
|
|
184
|
-
transition: $animation-duration-fast opacity;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&:disabled,
|
|
188
|
-
&.disabled {
|
|
189
|
-
.icon {
|
|
190
|
-
opacity: 30%;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
&:not(:disabled, .disabled) {
|
|
195
|
-
&:hover,
|
|
196
|
-
&:focus,
|
|
197
|
-
&.hover {
|
|
198
|
-
.icon {
|
|
199
|
-
opacity: 100%;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&:active,
|
|
204
|
-
&.active {
|
|
205
|
-
.icon {
|
|
206
|
-
opacity: 100%;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
position: absolute;
|
|
212
|
-
top: $spacing-sm;
|
|
213
|
-
right: $spacing-sm;
|
|
214
|
-
color: $color-purple-800;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.default {
|
|
218
|
-
border-color: var(--color-gray-500);
|
|
219
|
-
background: var(--color-white);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.expert-advice {
|
|
223
|
-
border-color: var(--color-purple-400);
|
|
224
|
-
background: $color-purple-100;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.inline,
|
|
228
|
-
.stacked {
|
|
229
|
-
flex-flow: row wrap;
|
|
230
|
-
align-items: unset;
|
|
231
|
-
gap: $spacing-md;
|
|
232
|
-
min-width: unset;
|
|
233
|
-
|
|
234
|
-
@include ca-media-tablet-and-under {
|
|
235
|
-
flex-direction: unset;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.illustrationWrapper {
|
|
239
|
-
margin-right: $spacing-sm;
|
|
240
|
-
|
|
241
|
-
[dir="rtl"] & {
|
|
242
|
-
margin-left: $spacing-sm;
|
|
243
|
-
margin-right: inherit;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
@include ca-media-tablet {
|
|
247
|
-
padding: 0;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
@include ca-media-mobile {
|
|
251
|
-
display: flex;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.descriptionAndActions {
|
|
256
|
-
margin: auto 0;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.descriptionContainer {
|
|
260
|
-
text-align: left;
|
|
261
|
-
max-width: unset;
|
|
262
|
-
min-width: 320px;
|
|
263
|
-
|
|
264
|
-
@include ca-media-desktop {
|
|
265
|
-
padding: 0;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
@include ca-media-mobile {
|
|
269
|
-
margin: 0;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
[dir="rtl"] & {
|
|
273
|
-
text-align: right;
|
|
274
|
-
|
|
275
|
-
@include ca-media-desktop {
|
|
276
|
-
padding: 0;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.buttonContainer {
|
|
282
|
-
padding-left: $spacing-sm;
|
|
283
|
-
justify-content: flex-start;
|
|
284
|
-
width: unset;
|
|
285
|
-
min-width: unset;
|
|
286
|
-
|
|
287
|
-
@include ca-media-mobile {
|
|
288
|
-
flex-direction: row-reverse;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
[dir="rtl"] & {
|
|
292
|
-
padding-left: 0;
|
|
293
|
-
padding-right: $spacing-sm;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
> * {
|
|
297
|
-
width: unset;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
&.hasSceneIllustration {
|
|
302
|
-
justify-content: center;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
&.centerContent {
|
|
306
|
-
flex-direction: column;
|
|
307
|
-
|
|
308
|
-
&.hasSceneIllustration .illustration {
|
|
309
|
-
width: 100%;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.illustrationWrapper {
|
|
313
|
-
margin: 0 auto;
|
|
314
|
-
align-self: center;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.descriptionContainer {
|
|
318
|
-
text-align: center;
|
|
319
|
-
min-width: unset;
|
|
320
|
-
|
|
321
|
-
[dir="rtl"] & {
|
|
322
|
-
text-align: center;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.buttonContainer {
|
|
327
|
-
padding: 0;
|
|
328
|
-
flex-direction: column;
|
|
329
|
-
min-width: unset;
|
|
330
|
-
justify-content: center;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
&.centerContent.smallScreenTextAlignment {
|
|
335
|
-
.descriptionContainer {
|
|
336
|
-
text-align: left;
|
|
337
|
-
|
|
338
|
-
[dir="rtl"] & {
|
|
339
|
-
text-align: right;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/* stylelint-disable no-descending-specificity */
|
|
346
|
-
.stacked {
|
|
347
|
-
.descriptionAndActions {
|
|
348
|
-
flex-direction: column;
|
|
349
|
-
align-items: unset;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.descriptionContainer {
|
|
353
|
-
align-self: flex-start;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
/* stylelint-enable no-descending-specificity */
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { cleanup, render, waitFor } from "@testing-library/react"
|
|
3
|
-
import userEvent from "@testing-library/user-event"
|
|
4
|
-
import { vi } from "vitest"
|
|
5
|
-
import { Informative } from "~components/Illustration"
|
|
6
|
-
import { GuidanceBlock } from "./GuidanceBlock"
|
|
7
|
-
const user = userEvent.setup()
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
10
|
-
window.matchMedia = vi.fn().mockImplementation(() => ({
|
|
11
|
-
matches: false,
|
|
12
|
-
media: "",
|
|
13
|
-
onchange: null,
|
|
14
|
-
addListener: vi.fn(),
|
|
15
|
-
removeListener: vi.fn(),
|
|
16
|
-
}))
|
|
17
|
-
|
|
18
|
-
describe("GuidanceBlock", () => {
|
|
19
|
-
afterEach(cleanup)
|
|
20
|
-
|
|
21
|
-
it("calls the action function when action button is clicked", async () => {
|
|
22
|
-
const onAction = vi.fn()
|
|
23
|
-
const { container } = render(
|
|
24
|
-
<GuidanceBlock
|
|
25
|
-
illustration={<Informative alt="" />}
|
|
26
|
-
text={{
|
|
27
|
-
title: "This is the call to action title",
|
|
28
|
-
description:
|
|
29
|
-
"Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite divinis.",
|
|
30
|
-
}}
|
|
31
|
-
actions={{
|
|
32
|
-
primary: { label: "Action!", onClick: onAction },
|
|
33
|
-
}}
|
|
34
|
-
/>
|
|
35
|
-
)
|
|
36
|
-
const actionButton = container.querySelector("button")
|
|
37
|
-
actionButton && (await user.click(actionButton))
|
|
38
|
-
|
|
39
|
-
await waitFor(() => {
|
|
40
|
-
expect(onAction).toHaveBeenCalledTimes(1)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it("has a default title tag of h3", () => {
|
|
45
|
-
const { getByRole } = render(
|
|
46
|
-
<GuidanceBlock
|
|
47
|
-
illustration={<Informative alt="" />}
|
|
48
|
-
text={{
|
|
49
|
-
title: "This is the call to action title",
|
|
50
|
-
description:
|
|
51
|
-
"Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite divinis.",
|
|
52
|
-
}}
|
|
53
|
-
/>
|
|
54
|
-
)
|
|
55
|
-
expect(
|
|
56
|
-
getByRole("heading", {
|
|
57
|
-
level: 3,
|
|
58
|
-
name: "This is the call to action title",
|
|
59
|
-
})
|
|
60
|
-
).toBeInTheDocument()
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it("can allow the user to override the title tag", () => {
|
|
64
|
-
const { getByRole } = render(
|
|
65
|
-
<GuidanceBlock
|
|
66
|
-
illustration={<Informative alt="" />}
|
|
67
|
-
text={{
|
|
68
|
-
title: "This is the call to action title",
|
|
69
|
-
description:
|
|
70
|
-
"Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite divinis.",
|
|
71
|
-
titleTag: "h2",
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
)
|
|
75
|
-
expect(
|
|
76
|
-
getByRole("heading", {
|
|
77
|
-
level: 2,
|
|
78
|
-
name: "This is the call to action title",
|
|
79
|
-
})
|
|
80
|
-
).toBeInTheDocument()
|
|
81
|
-
})
|
|
82
|
-
})
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react"
|
|
2
|
-
import classNames from "classnames"
|
|
3
|
-
import Media from "react-media"
|
|
4
|
-
import { Heading, HeadingProps } from "~components/Heading"
|
|
5
|
-
import { ArrowForwardIcon } from "~components/Icon"
|
|
6
|
-
import { SceneProps, SpotProps } from "~components/Illustration"
|
|
7
|
-
import { Text } from "~components/Text"
|
|
8
|
-
import { Button, ButtonProps } from "~components/__actions__/v2"
|
|
9
|
-
import { Tooltip, TooltipProps } from "~components/__overlays__/Tooltip/v1"
|
|
10
|
-
import styles from "./GuidanceBlock.module.scss"
|
|
11
|
-
|
|
12
|
-
export type ActionProps = ButtonProps & {
|
|
13
|
-
tooltip?: TooltipProps
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type LayoutType = "default" | "inline" | "stacked"
|
|
17
|
-
|
|
18
|
-
type IllustrationType = "spot" | "scene"
|
|
19
|
-
|
|
20
|
-
type TextAlignment = "center" | "left"
|
|
21
|
-
|
|
22
|
-
type GuidanceBlockActions = {
|
|
23
|
-
primary: ActionProps
|
|
24
|
-
secondary?: ActionProps
|
|
25
|
-
dismiss?: {
|
|
26
|
-
onClick: () => void
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type BaseGuidanceBlockProps = {
|
|
31
|
-
layout?: LayoutType
|
|
32
|
-
illustration: React.ReactElement<SpotProps | SceneProps>
|
|
33
|
-
/*
|
|
34
|
-
* Sets how the width and aspect ratio will respond to the Illustration passed in.
|
|
35
|
-
*/
|
|
36
|
-
illustrationType?: IllustrationType
|
|
37
|
-
|
|
38
|
-
smallScreenTextAlignment?: TextAlignment
|
|
39
|
-
actions?: GuidanceBlockActions
|
|
40
|
-
/*
|
|
41
|
-
* This will still require the secondary object to be passed into the actions ie: {secondary: { label: "Dismiss action" }}`
|
|
42
|
-
*/
|
|
43
|
-
secondaryDismiss?: boolean
|
|
44
|
-
/**
|
|
45
|
-
* If you are migrating from the KAIO v1:
|
|
46
|
-
* - `prominent` is now `expert-advice`
|
|
47
|
-
* - All other variants are removed in favour of `default`
|
|
48
|
-
*/
|
|
49
|
-
variant?: "default" | "expert-advice"
|
|
50
|
-
withActionButtonArrow?: boolean
|
|
51
|
-
noMaxWidth?: boolean
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
type GuidanceBlockWithText = {
|
|
55
|
-
text: {
|
|
56
|
-
title: string
|
|
57
|
-
titleTag?: HeadingProps["tag"]
|
|
58
|
-
description: string | React.ReactNode
|
|
59
|
-
}
|
|
60
|
-
} & BaseGuidanceBlockProps
|
|
61
|
-
|
|
62
|
-
type GuidanceBlockPropsWithContent = {
|
|
63
|
-
content: React.ReactElement
|
|
64
|
-
} & BaseGuidanceBlockProps
|
|
65
|
-
|
|
66
|
-
export type GuidanceBlockProps =
|
|
67
|
-
| GuidanceBlockWithText
|
|
68
|
-
| GuidanceBlockPropsWithContent
|
|
69
|
-
|
|
70
|
-
export type GuidanceBlockState = {
|
|
71
|
-
hidden: boolean
|
|
72
|
-
removed: boolean
|
|
73
|
-
mediaQueryLayout: string
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
type WithTooltipProps = {
|
|
77
|
-
children: React.ReactNode
|
|
78
|
-
tooltipProps?: TooltipProps
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const WithTooltip = ({
|
|
82
|
-
tooltipProps,
|
|
83
|
-
children,
|
|
84
|
-
}: WithTooltipProps): JSX.Element =>
|
|
85
|
-
!!tooltipProps ? (
|
|
86
|
-
<Tooltip {...tooltipProps}>{children}</Tooltip>
|
|
87
|
-
) : (
|
|
88
|
-
<>{children}</>
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093807/Guidance+Block Guidance} |
|
|
93
|
-
* {@link https://cultureamp.design/?path=/docs/components-guidanceblock--docs Storybook}
|
|
94
|
-
*/
|
|
95
|
-
export const GuidanceBlock = ({
|
|
96
|
-
layout = "default",
|
|
97
|
-
variant = "default",
|
|
98
|
-
withActionButtonArrow = true,
|
|
99
|
-
noMaxWidth = false,
|
|
100
|
-
illustrationType = "spot",
|
|
101
|
-
smallScreenTextAlignment = "center",
|
|
102
|
-
actions,
|
|
103
|
-
illustration,
|
|
104
|
-
secondaryDismiss,
|
|
105
|
-
...restProps
|
|
106
|
-
}: GuidanceBlockProps): JSX.Element => {
|
|
107
|
-
const [hidden, setHidden] = useState<boolean>(false)
|
|
108
|
-
const [removed, setRemoved] = useState<boolean>(false)
|
|
109
|
-
const [mediaQueryLayout, setMediaQueryLayout] = useState<string>("")
|
|
110
|
-
|
|
111
|
-
const containerRef = React.createRef<HTMLDivElement>()
|
|
112
|
-
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (layout === "inline" || layout === "stacked") {
|
|
115
|
-
containerQuery()
|
|
116
|
-
}
|
|
117
|
-
}, [])
|
|
118
|
-
|
|
119
|
-
const handleDismissBanner = (): void => {
|
|
120
|
-
setHidden(true)
|
|
121
|
-
actions?.dismiss?.onClick()
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const onTransitionEnd = (e: React.TransitionEvent<HTMLDivElement>): void => {
|
|
125
|
-
// Be careful: this assumes the final CSS property to be animated is "margin-top".
|
|
126
|
-
if (hidden && e.propertyName === "margin-top") {
|
|
127
|
-
setRemoved(true)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const containerQuery = (): void => {
|
|
132
|
-
const resizeObserver = new ResizeObserver(entries => {
|
|
133
|
-
if (entries.length === 1) {
|
|
134
|
-
handleMediaQueryLayout(entries[0].contentRect.width)
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
resizeObserver.observe(containerRef.current as HTMLElement)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const handleMediaQueryLayout = (width: number): void => {
|
|
142
|
-
if (width <= 320) {
|
|
143
|
-
setMediaQueryLayout("centerContent")
|
|
144
|
-
} else {
|
|
145
|
-
setMediaQueryLayout("")
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const marginTop = (): string => {
|
|
150
|
-
if (hidden && containerRef.current) {
|
|
151
|
-
return -containerRef.current.clientHeight + "px"
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return "0"
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (removed) {
|
|
158
|
-
return <></>
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const componentIsMobile = mediaQueryLayout.includes("centerContent")
|
|
162
|
-
|
|
163
|
-
return (
|
|
164
|
-
<div
|
|
165
|
-
className={classNames(
|
|
166
|
-
styles.banner,
|
|
167
|
-
variant && styles[variant],
|
|
168
|
-
layout && styles[layout],
|
|
169
|
-
hidden && styles.hidden,
|
|
170
|
-
mediaQueryLayout === "centerContent" && styles.centerContent,
|
|
171
|
-
noMaxWidth && styles.noMaxWidth,
|
|
172
|
-
illustrationType === "scene" && styles.hasSceneIllustration,
|
|
173
|
-
smallScreenTextAlignment === "left" && styles.smallScreenTextAlignment
|
|
174
|
-
)}
|
|
175
|
-
style={{
|
|
176
|
-
marginTop: marginTop(),
|
|
177
|
-
}}
|
|
178
|
-
ref={containerRef}
|
|
179
|
-
onTransitionEnd={onTransitionEnd}
|
|
180
|
-
>
|
|
181
|
-
<div className={styles.illustrationWrapper}>
|
|
182
|
-
<div className={styles.illustration}>
|
|
183
|
-
{illustrationType === "scene"
|
|
184
|
-
? React.cloneElement(illustration, { enableAspectRatio: true })
|
|
185
|
-
: illustration}
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
<div className={styles.descriptionAndActions}>
|
|
189
|
-
<div className={styles.descriptionContainer}>
|
|
190
|
-
{"content" in restProps && restProps.content}
|
|
191
|
-
{"text" in restProps && (
|
|
192
|
-
<>
|
|
193
|
-
<div className={styles.headingWrapper}>
|
|
194
|
-
<Heading
|
|
195
|
-
tag={restProps?.text?.titleTag ?? "h3"}
|
|
196
|
-
variant="heading-3"
|
|
197
|
-
>
|
|
198
|
-
{restProps?.text?.title}
|
|
199
|
-
</Heading>
|
|
200
|
-
</div>
|
|
201
|
-
<Text tag="p" variant="body">
|
|
202
|
-
{restProps?.text?.description}
|
|
203
|
-
</Text>
|
|
204
|
-
</>
|
|
205
|
-
)}
|
|
206
|
-
</div>
|
|
207
|
-
{actions?.primary && (
|
|
208
|
-
<Media query="(max-width: 767px)">
|
|
209
|
-
{(isMobile: boolean): JSX.Element => (
|
|
210
|
-
<div
|
|
211
|
-
className={classNames({
|
|
212
|
-
noRightMargin: isMobile || componentIsMobile,
|
|
213
|
-
rightMargin:
|
|
214
|
-
!(isMobile || componentIsMobile) && layout === "default",
|
|
215
|
-
})}
|
|
216
|
-
>
|
|
217
|
-
<div
|
|
218
|
-
className={classNames(
|
|
219
|
-
styles.buttonContainer,
|
|
220
|
-
actions?.secondary && styles.secondaryAction
|
|
221
|
-
)}
|
|
222
|
-
>
|
|
223
|
-
<WithTooltip tooltipProps={actions.primary.tooltip}>
|
|
224
|
-
<Button
|
|
225
|
-
icon={
|
|
226
|
-
withActionButtonArrow ? (
|
|
227
|
-
<ArrowForwardIcon role="presentation" />
|
|
228
|
-
) : undefined
|
|
229
|
-
}
|
|
230
|
-
iconPosition="end"
|
|
231
|
-
{...actions.primary}
|
|
232
|
-
fullWidth={isMobile || componentIsMobile}
|
|
233
|
-
/>
|
|
234
|
-
</WithTooltip>
|
|
235
|
-
|
|
236
|
-
{actions?.secondary && (
|
|
237
|
-
<WithTooltip tooltipProps={actions.secondary.tooltip}>
|
|
238
|
-
<div className={styles.secondaryAction}>
|
|
239
|
-
<Button
|
|
240
|
-
secondary
|
|
241
|
-
{...actions.secondary}
|
|
242
|
-
onClick={
|
|
243
|
-
secondaryDismiss
|
|
244
|
-
? (): void => handleDismissBanner()
|
|
245
|
-
: actions?.secondary?.onClick
|
|
246
|
-
}
|
|
247
|
-
fullWidth={isMobile || componentIsMobile}
|
|
248
|
-
/>
|
|
249
|
-
</div>
|
|
250
|
-
</WithTooltip>
|
|
251
|
-
)}
|
|
252
|
-
</div>
|
|
253
|
-
</div>
|
|
254
|
-
)}
|
|
255
|
-
</Media>
|
|
256
|
-
)}
|
|
257
|
-
</div>
|
|
258
|
-
</div>
|
|
259
|
-
)
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
GuidanceBlock.displayName = "GuidanceBlock"
|