@orangesk/orange-design-system 2.0.0-beta.45 → 2.0.0-beta.46
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/build/components/Breadcrumbs/style.css +1 -1
- package/build/components/Breadcrumbs/style.css.map +1 -1
- package/build/components/Grid/style.css +1 -1
- package/build/components/Grid/style.css.map +1 -1
- package/build/components/index.js +1 -1
- package/build/components/index.js.map +1 -1
- package/build/components/tsconfig.tsbuildinfo +1 -1
- package/build/components/types/index.d.ts +1 -0
- package/build/components/types/src/components/CarouselHero/CarouselHero.d.ts +1 -0
- package/build/lib/base.css.map +1 -1
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/scripts.js +1 -1
- package/build/lib/scripts.js.map +1 -1
- package/build/lib/style.css +1 -1
- package/build/lib/style.css.map +1 -1
- package/build/lib/utilities.css +1 -1
- package/build/lib/utilities.css.map +1 -1
- package/build/search-index.json +3 -3
- package/package.json +9 -9
- package/src/components/Breadcrumbs/styles/mixins.scss +5 -1
- package/src/components/CarouselHero/CarouselHero.tsx +20 -6
- package/src/components/CarouselHero/tests/CarouselHero.conformance.test.jsx +2 -0
- package/src/components/CarouselHero/tests/CarouselHero.unit.test.jsx +78 -9
- package/src/components/Forms/InputStepper/InputStepper.tsx +2 -0
- package/src/components/Forms/InputStepper/styles/style.scss +12 -2
- package/src/components/Forms/InputStepper/tests/InputStepper.unit.test.jsx +8 -0
- package/src/styles/shame.scss +16 -3
- package/src/styles/tools/convert.scss +8 -0
|
@@ -79,7 +79,9 @@ describe("rendering CarouselHero", () => {
|
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
it("play/pause button has proper ARIA label when displayed", () => {
|
|
82
|
-
const { container } = render(
|
|
82
|
+
const { container } = render(
|
|
83
|
+
<CarouselHero enableAutoplay interval={3000} />,
|
|
84
|
+
);
|
|
83
85
|
|
|
84
86
|
const playPauseButton = container.querySelector(
|
|
85
87
|
".carousel-hero__play-pause",
|
|
@@ -171,9 +173,11 @@ describe("rendering CarouselHero", () => {
|
|
|
171
173
|
expect(tabButtons[2]).toHaveAttribute("tabIndex", "-1");
|
|
172
174
|
});
|
|
173
175
|
|
|
174
|
-
it("shows play/pause button when interval is provided", () => {
|
|
176
|
+
it("shows play/pause button when autoplay is enabled and interval is provided", () => {
|
|
175
177
|
const { container } = render(
|
|
176
|
-
<CarouselHero interval={3000}>
|
|
178
|
+
<CarouselHero enableAutoplay interval={3000}>
|
|
179
|
+
{children}
|
|
180
|
+
</CarouselHero>,
|
|
177
181
|
);
|
|
178
182
|
|
|
179
183
|
expect(
|
|
@@ -181,6 +185,16 @@ describe("rendering CarouselHero", () => {
|
|
|
181
185
|
).toBe(1);
|
|
182
186
|
});
|
|
183
187
|
|
|
188
|
+
it("does not show play/pause button when autoplay is not enabled", () => {
|
|
189
|
+
const { container } = render(
|
|
190
|
+
<CarouselHero interval={3000}>{children}</CarouselHero>,
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
expect(
|
|
194
|
+
container.getElementsByClassName("carousel-hero__play-pause").length,
|
|
195
|
+
).toBe(0);
|
|
196
|
+
});
|
|
197
|
+
|
|
184
198
|
it("does not show play/pause button when interval is not provided", () => {
|
|
185
199
|
const { container } = render(<CarouselHero>{children}</CarouselHero>);
|
|
186
200
|
|
|
@@ -199,15 +213,26 @@ describe("rendering CarouselHero", () => {
|
|
|
199
213
|
).toBe(0);
|
|
200
214
|
});
|
|
201
215
|
|
|
202
|
-
it("sets data-interval attribute when interval is provided", () => {
|
|
216
|
+
it("sets data-interval attribute when autoplay is enabled and interval is provided", () => {
|
|
203
217
|
const { container } = render(
|
|
204
|
-
<CarouselHero interval={5000}>
|
|
218
|
+
<CarouselHero enableAutoplay interval={5000}>
|
|
219
|
+
{children}
|
|
220
|
+
</CarouselHero>,
|
|
205
221
|
);
|
|
206
222
|
|
|
207
223
|
const carousel = container.querySelector(".carousel-hero");
|
|
208
224
|
expect(carousel).toHaveAttribute("data-interval", "5000");
|
|
209
225
|
});
|
|
210
226
|
|
|
227
|
+
it("does not set data-interval attribute when autoplay is not enabled", () => {
|
|
228
|
+
const { container } = render(
|
|
229
|
+
<CarouselHero interval={5000}>{children}</CarouselHero>,
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
const carousel = container.querySelector(".carousel-hero");
|
|
233
|
+
expect(carousel).not.toHaveAttribute("data-interval");
|
|
234
|
+
});
|
|
235
|
+
|
|
211
236
|
it("does not set data-interval attribute when interval is not provided", () => {
|
|
212
237
|
const { container } = render(<CarouselHero>{children}</CarouselHero>);
|
|
213
238
|
|
|
@@ -243,7 +268,7 @@ describe("rendering CarouselHero", () => {
|
|
|
243
268
|
expect(carousel.hasAttribute("data-swiper-options")).toBe(false);
|
|
244
269
|
});
|
|
245
270
|
|
|
246
|
-
it("shows play/pause button when swiperOptions has autoplay with delay >= 1000ms", () => {
|
|
271
|
+
it("shows play/pause button when autoplay is enabled and swiperOptions has autoplay with delay >= 1000ms", () => {
|
|
247
272
|
const swiperOptions = {
|
|
248
273
|
autoplay: {
|
|
249
274
|
delay: 3000,
|
|
@@ -251,7 +276,9 @@ describe("rendering CarouselHero", () => {
|
|
|
251
276
|
},
|
|
252
277
|
};
|
|
253
278
|
const { container } = render(
|
|
254
|
-
<CarouselHero swiperOptions={swiperOptions}>
|
|
279
|
+
<CarouselHero enableAutoplay swiperOptions={swiperOptions}>
|
|
280
|
+
{children}
|
|
281
|
+
</CarouselHero>,
|
|
255
282
|
);
|
|
256
283
|
|
|
257
284
|
expect(
|
|
@@ -259,6 +286,28 @@ describe("rendering CarouselHero", () => {
|
|
|
259
286
|
).toBe(1);
|
|
260
287
|
});
|
|
261
288
|
|
|
289
|
+
it("does not show play/pause button when autoplay is not enabled, even if swiperOptions includes autoplay", () => {
|
|
290
|
+
const swiperOptions = {
|
|
291
|
+
autoplay: {
|
|
292
|
+
delay: 3000,
|
|
293
|
+
disableOnInteraction: false,
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
const { container } = render(
|
|
297
|
+
<CarouselHero swiperOptions={swiperOptions}>{children}</CarouselHero>,
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
expect(
|
|
301
|
+
container.getElementsByClassName("carousel-hero__play-pause").length,
|
|
302
|
+
).toBe(0);
|
|
303
|
+
|
|
304
|
+
const carousel = container.querySelector(".carousel-hero");
|
|
305
|
+
expect(carousel).not.toHaveAttribute(
|
|
306
|
+
"data-swiper-options",
|
|
307
|
+
JSON.stringify(swiperOptions),
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
|
|
262
311
|
it("does not show play/pause button when swiperOptions autoplay delay < 1000ms", () => {
|
|
263
312
|
const swiperOptions = {
|
|
264
313
|
autoplay: {
|
|
@@ -266,7 +315,9 @@ describe("rendering CarouselHero", () => {
|
|
|
266
315
|
},
|
|
267
316
|
};
|
|
268
317
|
const { container } = render(
|
|
269
|
-
<CarouselHero swiperOptions={swiperOptions}>
|
|
318
|
+
<CarouselHero enableAutoplay swiperOptions={swiperOptions}>
|
|
319
|
+
{children}
|
|
320
|
+
</CarouselHero>,
|
|
270
321
|
);
|
|
271
322
|
|
|
272
323
|
expect(
|
|
@@ -279,13 +330,31 @@ describe("rendering CarouselHero", () => {
|
|
|
279
330
|
autoplay: true,
|
|
280
331
|
};
|
|
281
332
|
const { container } = render(
|
|
282
|
-
<CarouselHero swiperOptions={swiperOptions}>
|
|
333
|
+
<CarouselHero enableAutoplay swiperOptions={swiperOptions}>
|
|
334
|
+
{children}
|
|
335
|
+
</CarouselHero>,
|
|
283
336
|
);
|
|
284
337
|
|
|
285
338
|
expect(
|
|
286
339
|
container.getElementsByClassName("carousel-hero__play-pause").length,
|
|
287
340
|
).toBe(0);
|
|
288
341
|
});
|
|
342
|
+
it("removes autoplay from forwarded swiperOptions until autoplay is enabled", () => {
|
|
343
|
+
const swiperOptions = {
|
|
344
|
+
autoplay: {
|
|
345
|
+
delay: 3000,
|
|
346
|
+
},
|
|
347
|
+
speed: 500,
|
|
348
|
+
};
|
|
349
|
+
const { container } = render(
|
|
350
|
+
<CarouselHero swiperOptions={swiperOptions}>{children}</CarouselHero>,
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
const carousel = container.querySelector(".carousel-hero");
|
|
354
|
+
expect(carousel.getAttribute("data-swiper-options")).toBe(
|
|
355
|
+
JSON.stringify({ speed: 500 }),
|
|
356
|
+
);
|
|
357
|
+
});
|
|
289
358
|
});
|
|
290
359
|
|
|
291
360
|
describe("Swiper integration", () => {
|
|
@@ -52,6 +52,7 @@ const InputStepper: React.FC<InputStepperProps> = ({
|
|
|
52
52
|
<div
|
|
53
53
|
className={cx(CLASS_ROOT, className, {
|
|
54
54
|
[`${CLASS_ROOT}--disabled`]: isDisabled,
|
|
55
|
+
[`${CLASS_ROOT}--invalid`]: isInvalid,
|
|
55
56
|
})}
|
|
56
57
|
ref={elementRef}
|
|
57
58
|
data-inputstepper={config ? JSON.stringify(config) : true}
|
|
@@ -70,6 +71,7 @@ const InputStepper: React.FC<InputStepperProps> = ({
|
|
|
70
71
|
id={id}
|
|
71
72
|
name={name}
|
|
72
73
|
disabled={isDisabled}
|
|
74
|
+
isInvalid={isInvalid}
|
|
73
75
|
htmlType="number"
|
|
74
76
|
inputMode="numeric"
|
|
75
77
|
/>
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
appearance: textfield;
|
|
15
15
|
z-index: 0;
|
|
16
16
|
border-radius: 0;
|
|
17
|
-
padding: space.get("xsmall")
|
|
18
|
-
space.get("xsmall");
|
|
17
|
+
padding: space.get("xsmall");
|
|
19
18
|
text-align: center;
|
|
20
19
|
border-left: 0;
|
|
21
20
|
border-right: 0;
|
|
@@ -109,6 +108,17 @@
|
|
|
109
108
|
z-index: 1;
|
|
110
109
|
}
|
|
111
110
|
|
|
111
|
+
&--invalid {
|
|
112
|
+
.input-stepper__button,
|
|
113
|
+
.input-stepper__number,
|
|
114
|
+
.input-stepper__button--minus:hover:not(:disabled),
|
|
115
|
+
.input-stepper__button--plus:hover:not(:disabled),
|
|
116
|
+
.input-stepper__button--minus:active:not(:disabled),
|
|
117
|
+
.input-stepper__button--plus:active:not(:disabled) {
|
|
118
|
+
border-color: var(--color-border-negative);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
112
122
|
&__button--minus:disabled,
|
|
113
123
|
&__button--plus:disabled {
|
|
114
124
|
&::before {
|
|
@@ -28,6 +28,14 @@ describe("rendering InputStepper", () => {
|
|
|
28
28
|
expect(getByLabelText("zvýšiť počet")).toBeDisabled();
|
|
29
29
|
expect(getByRole("spinbutton")).toBeDisabled();
|
|
30
30
|
});
|
|
31
|
+
it("has invalid classes when isInvalid prop is passed", () => {
|
|
32
|
+
const { getByTestId, getByRole } = render(
|
|
33
|
+
<InputStepper data-testid="test-id" id="id" isInvalid />,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
expect(getByTestId("test-id")).toHaveClass("input-stepper--invalid");
|
|
37
|
+
expect(getByRole("spinbutton")).toHaveClass("is-invalid");
|
|
38
|
+
});
|
|
31
39
|
it("has InputStepper removed input field, replaced it with text number and set defaultValue with when config prop is passed", () => {
|
|
32
40
|
const { getByText } = render(
|
|
33
41
|
<InputStepper
|
package/src/styles/shame.scss
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@layer utilities {
|
|
2
2
|
/**
|
|
3
|
-
* Resets for megamenu and footer
|
|
4
|
-
* This reset is required due to default list spacing in ods 1 and will be removed once megamenu and footer components are migrated to 1.
|
|
5
|
-
**/
|
|
3
|
+
* Resets for megamenu and footer
|
|
4
|
+
* This reset is required due to default list spacing in ods 1 and will be removed once megamenu and footer components are migrated to 1.
|
|
5
|
+
**/
|
|
6
6
|
.osk-footer-menu,
|
|
7
7
|
.mm-header ul,
|
|
8
8
|
.megamenu-header ul {
|
|
@@ -14,4 +14,17 @@
|
|
|
14
14
|
margin-bottom: 0;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Fixes for header and megamenu when modal is open
|
|
20
|
+
* This is required to prevent the header and megamenu from shifting when a modal is open due to scrollbar disappearance.
|
|
21
|
+
* This is a temporary fix and will be removed once the header and megamenu components are migrated to ods2
|
|
22
|
+
**/
|
|
23
|
+
body.has-modal {
|
|
24
|
+
.mm-header.is-sticky,
|
|
25
|
+
.megamenu-header.is-sticky,
|
|
26
|
+
[data-megamenu].is-sticky:not(.megamenu) {
|
|
27
|
+
padding-right: var(--ods-modal-scrollbar-width, 0px);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
17
30
|
}
|
|
@@ -3,10 +3,18 @@
|
|
|
3
3
|
@use "../tokens/base";
|
|
4
4
|
|
|
5
5
|
@function to-em($size, $font-size: base.$font-size) {
|
|
6
|
+
@if $size == 0 {
|
|
7
|
+
@return 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
@return math.div($size, $font-size) * 1em;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
@function to-rem($size, $base: base.$font-size) {
|
|
14
|
+
@if $size == 0 {
|
|
15
|
+
@return 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
@return math.div($size, $base) * 1rem;
|
|
11
19
|
}
|
|
12
20
|
|