@orangesk/orange-design-system 3.3.0 → 3.4.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/build/apple--dark.svg +4 -0
- package/build/apple--white.svg +5 -0
- package/build/apple.svg +4 -0
- package/build/components/BodyBanner/style.css +1 -1
- package/build/components/BodyBanner/style.css.map +1 -1
- package/build/components/FeatureAccordion/style.css +1 -1
- package/build/components/FeatureAccordion/style.css.map +1 -1
- package/build/components/Footer/style.css +1 -1
- package/build/components/Footer/style.css.map +1 -1
- package/build/components/Megamenu/style.css +1 -1
- package/build/components/Megamenu/style.css.map +1 -1
- package/build/components/PromoBanner/style.css +1 -1
- package/build/components/PromoBanner/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 +19 -4
- package/build/components/types/src/components/Megamenu/Megamenu.d.ts +8 -2
- package/build/components/types/src/components/Megamenu/MegamenuBlog.d.ts +1 -1
- package/build/components/types/src/components/Megamenu/MyOrangeMobilePanel.d.ts +2 -1
- package/build/components/types/src/components/Megamenu/constants.d.ts +19 -2
- package/build/components/types/src/components/Megamenu/data.d.ts +8 -0
- package/build/components/types/src/components/Megamenu/shared.d.ts +40 -0
- package/build/components/types/src/components/PromoBanner/PromoBanner.d.ts +3 -1
- package/build/huawei--dark.svg +4 -0
- package/build/huawei--white.svg +5 -0
- package/build/huawei.svg +4 -0
- package/build/images/phones.png +0 -0
- package/build/lib/base.css +1 -1
- 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/footer.css +1 -1
- package/build/lib/footer.css.map +1 -1
- package/build/lib/megamenu.css +1 -1
- package/build/lib/megamenu.css.map +1 -1
- package/build/lib/megamenu.js +1 -1
- package/build/lib/megamenu.js.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/tsconfig.tsbuildinfo +1 -1
- package/build/lib/utilities.css +1 -1
- package/build/lib/utilities.css.map +1 -1
- package/build/play--dark.svg +7 -0
- package/build/play--white.svg +7 -0
- package/build/play.svg +7 -0
- package/package.json +14 -14
- package/src/components/BodyBanner/styles/mixins.scss +6 -0
- package/src/components/FeatureAccordion/styles/mixins.scss +6 -0
- package/src/components/Forms/Autocomplete/styles/mixins.scss +1 -0
- package/src/components/Forms/Autocomplete/styles/style.scss +4 -0
- package/src/components/Forms/Autocomplete/tests/Autocomplete.styles.unit.test.jsx +3 -0
- package/src/components/Megamenu/LogoJeTu.tsx +12 -7
- package/src/components/Megamenu/Megamenu.static.ts +1 -1
- package/src/components/Megamenu/Megamenu.tsx +420 -316
- package/src/components/Megamenu/MegamenuBlog.tsx +90 -123
- package/src/components/Megamenu/MyOrangeMobilePanel.tsx +116 -84
- package/src/components/Megamenu/constants.ts +19 -2
- package/src/components/Megamenu/data.ts +53 -15
- package/src/components/Megamenu/shared.tsx +154 -0
- package/src/components/Megamenu/styles/mixins.scss +307 -28
- package/src/components/Megamenu/styles/style.scss +91 -8
- package/src/components/Megamenu/tests/Megamenu.unit.test.jsx +77 -4
- package/src/components/PromoBanner/PromoBanner.tsx +7 -2
- package/src/components/PromoBanner/styles/mixins.scss +19 -4
- package/src/components/PromoBanner/styles/style.scss +4 -0
- package/src/components/PromoBanner/tests/PromoBanner.unit.test.jsx +21 -3
- package/src/styles/base/globals.scss +5 -5
- package/src/styles/base/styleguide.scss +1 -1
- package/src/styles/export/color.js +1 -1
- package/src/styles/shame.scss +1 -1
- package/src/styles/tokens/color.scss +1 -1
|
@@ -4,8 +4,19 @@ import "@testing-library/jest-dom/vitest";
|
|
|
4
4
|
import { Megamenu, MegamenuBlog } from "../";
|
|
5
5
|
|
|
6
6
|
describe("Megamenu logo markup", () => {
|
|
7
|
+
it("is sticky by default and supports disabling stickiness", () => {
|
|
8
|
+
const { container, rerender } = render(<Megamenu />);
|
|
9
|
+
const nav = container.querySelector("[data-megamenu]");
|
|
10
|
+
|
|
11
|
+
expect(nav).not.toHaveClass("non-sticky");
|
|
12
|
+
|
|
13
|
+
rerender(<Megamenu notSticky />);
|
|
14
|
+
|
|
15
|
+
expect(nav).toHaveClass("non-sticky");
|
|
16
|
+
});
|
|
17
|
+
|
|
7
18
|
it("renders brand-mark wrapper for default Megamenu logo swap", () => {
|
|
8
|
-
const { container } = render(<Megamenu
|
|
19
|
+
const { container } = render(<Megamenu notSticky />);
|
|
9
20
|
|
|
10
21
|
const logo = container.querySelector(".megamenu__nav-logo");
|
|
11
22
|
const brandMark = logo?.querySelector(
|
|
@@ -22,9 +33,7 @@ describe("Megamenu logo markup", () => {
|
|
|
22
33
|
});
|
|
23
34
|
|
|
24
35
|
it("keeps compactLogoOnly output without brand-mark wrapper", () => {
|
|
25
|
-
const { container } = render(
|
|
26
|
-
<MegamenuBlog compactLogoOnly isSticky={false} />,
|
|
27
|
-
);
|
|
36
|
+
const { container } = render(<MegamenuBlog compactLogoOnly notSticky />);
|
|
28
37
|
|
|
29
38
|
const logo = container.querySelector(".megamenu__nav-logo");
|
|
30
39
|
|
|
@@ -38,4 +47,68 @@ describe("Megamenu logo markup", () => {
|
|
|
38
47
|
logo?.querySelector("[data-megamenu-logo-compact]"),
|
|
39
48
|
).not.toBeInTheDocument();
|
|
40
49
|
});
|
|
50
|
+
|
|
51
|
+
it("renders desktop CTA link in default megamenu", () => {
|
|
52
|
+
const { container } = render(<Megamenu notSticky />);
|
|
53
|
+
|
|
54
|
+
const cta = container.querySelector(
|
|
55
|
+
".megamenu__nav-item--main .megamenu__nav-link--cta",
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
expect(cta).toBeInTheDocument();
|
|
59
|
+
expect(cta).toHaveTextContent("Prejdite k nám");
|
|
60
|
+
expect(cta.querySelector(".megamenu__nav-icon--cta")).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("renders mobile CTA before quick-access links", () => {
|
|
64
|
+
const { container } = render(<Megamenu notSticky />);
|
|
65
|
+
|
|
66
|
+
const mobileCta = container.querySelector(".megamenu__mobile-cta");
|
|
67
|
+
const quickAccess = container.querySelector("#mobile-quick-access-heading");
|
|
68
|
+
|
|
69
|
+
expect(mobileCta).toBeInTheDocument();
|
|
70
|
+
expect(mobileCta).toHaveTextContent("Prejdite k nám");
|
|
71
|
+
expect(mobileCta.compareDocumentPosition(quickAccess)).toBe(
|
|
72
|
+
Node.DOCUMENT_POSITION_FOLLOWING,
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("renders quick-access tiles below menu content", () => {
|
|
77
|
+
const { container } = render(<Megamenu notSticky />);
|
|
78
|
+
|
|
79
|
+
expect(container.querySelectorAll(".megamenu__tile")).toHaveLength(18);
|
|
80
|
+
expect(
|
|
81
|
+
container.querySelectorAll(".megamenu__tile .megamenu__tag"),
|
|
82
|
+
).toHaveLength(12);
|
|
83
|
+
expect(
|
|
84
|
+
container.querySelector('.megamenu__tile[href="/"]'),
|
|
85
|
+
).toHaveTextContent("Chcem nové číslo");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("renders orange cart dot by default", () => {
|
|
89
|
+
const { container } = render(<Megamenu notSticky />);
|
|
90
|
+
|
|
91
|
+
const cart = container.querySelector(
|
|
92
|
+
".megamenu__nav-cart-icon:not([data-items-in-cart])",
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
expect(cart).toBeInTheDocument();
|
|
96
|
+
expect(cart?.parentElement).toHaveAttribute("aria-label", "Košík");
|
|
97
|
+
expect(cart?.nextElementSibling).not.toBeInTheDocument();
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("renders optional cart item count", () => {
|
|
101
|
+
const { container } = render(<Megamenu cartItems={3} notSticky />);
|
|
102
|
+
|
|
103
|
+
const cart = container.querySelector(
|
|
104
|
+
".megamenu__nav-cart-icon[data-items-in-cart]",
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
expect(cart).toHaveAttribute("data-items-in-cart", "3");
|
|
108
|
+
expect(cart?.parentElement).toHaveAttribute(
|
|
109
|
+
"aria-label",
|
|
110
|
+
"Košík, 3 položka",
|
|
111
|
+
);
|
|
112
|
+
expect(cart?.nextElementSibling).toHaveTextContent("3 položka v košíku");
|
|
113
|
+
});
|
|
41
114
|
});
|
|
@@ -19,6 +19,8 @@ interface PromoBannerProps {
|
|
|
19
19
|
imageFullWidth?: boolean;
|
|
20
20
|
/** Make image extend to the edge of viewport even when inside container */
|
|
21
21
|
bleedImage?: boolean;
|
|
22
|
+
/** Make image extend to Container boundaries on sm and smaller breakpoints */
|
|
23
|
+
bleedImageSmDown?: boolean;
|
|
22
24
|
children?: React.ReactNode;
|
|
23
25
|
itemClassName?: string;
|
|
24
26
|
imageClassName?: string;
|
|
@@ -42,6 +44,7 @@ export const PromoBanner = ({
|
|
|
42
44
|
flushTopSmDown,
|
|
43
45
|
flushBottomSmDown,
|
|
44
46
|
bleedImage,
|
|
47
|
+
bleedImageSmDown,
|
|
45
48
|
children,
|
|
46
49
|
itemClassName,
|
|
47
50
|
imageClassName,
|
|
@@ -65,6 +68,9 @@ export const PromoBanner = ({
|
|
|
65
68
|
className={cx(
|
|
66
69
|
`${CLASS_ROOT}__image`,
|
|
67
70
|
"align-center align-md-left",
|
|
71
|
+
{
|
|
72
|
+
[`${CLASS_ROOT}__image--bleed-sm-down`]: bleedImageSmDown,
|
|
73
|
+
},
|
|
68
74
|
imageClassName,
|
|
69
75
|
)}
|
|
70
76
|
>
|
|
@@ -102,9 +108,8 @@ export const PromoBanner = ({
|
|
|
102
108
|
`${CLASS_ROOT}__image`,
|
|
103
109
|
{
|
|
104
110
|
[`${CLASS_ROOT}__image--bleed-right`]: bleedImage,
|
|
111
|
+
[`${CLASS_ROOT}__image--bleed-sm-down`]: bleedImageSmDown,
|
|
105
112
|
[`align-self-${alignImage}`]: alignImage,
|
|
106
|
-
"pt-none": alignImage === "top",
|
|
107
|
-
"pb-none": alignImage === "bottom",
|
|
108
113
|
"align-center": variant === "vertical",
|
|
109
114
|
},
|
|
110
115
|
imageClassName,
|
|
@@ -51,10 +51,9 @@
|
|
|
51
51
|
text-align: end;
|
|
52
52
|
align-self: center;
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
padding-bottom: 0;
|
|
54
|
+
// Page-builder output may wrap image content in a div.
|
|
55
|
+
> :not(img):not(picture):not(svg) {
|
|
56
|
+
width: 100%;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
&[class*="grid__col"] {
|
|
@@ -64,6 +63,12 @@
|
|
|
64
63
|
|
|
65
64
|
padding-right: 0 !important;
|
|
66
65
|
}
|
|
66
|
+
|
|
67
|
+
> * {
|
|
68
|
+
@include breakpoint.get("sm", "down") {
|
|
69
|
+
width: 100%;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
@mixin promo-banner-image-bleed-right() {
|
|
@@ -81,6 +86,16 @@
|
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
|
|
89
|
+
@mixin promo-banner-image-bleed-sm-down() {
|
|
90
|
+
@include breakpoint.get("sm", "down") {
|
|
91
|
+
> * {
|
|
92
|
+
width: calc(100% + (2 * #{space.get("small")}));
|
|
93
|
+
max-width: none;
|
|
94
|
+
margin-left: calc(-1 * #{space.get("small")});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
84
99
|
@mixin promo-banner-vertical() {
|
|
85
100
|
.promo-banner__item {
|
|
86
101
|
padding-top: 0 !important;
|
|
@@ -151,6 +151,24 @@ describe("PromoBanner", () => {
|
|
|
151
151
|
expect(banner).not.toHaveClass("promo-banner--flush-bottom-sm-down");
|
|
152
152
|
});
|
|
153
153
|
});
|
|
154
|
+
|
|
155
|
+
describe("bleedImageSmDown", () => {
|
|
156
|
+
it("applies image bleed modifier class", () => {
|
|
157
|
+
render(
|
|
158
|
+
<PromoBanner image="test.jpg" bleedImageSmDown>
|
|
159
|
+
Content
|
|
160
|
+
</PromoBanner>,
|
|
161
|
+
);
|
|
162
|
+
const image = document.querySelector(".promo-banner__image");
|
|
163
|
+
expect(image).toHaveClass("promo-banner__image--bleed-sm-down");
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("does not apply image bleed modifier class when disabled", () => {
|
|
167
|
+
render(<PromoBanner image="test.jpg">Content</PromoBanner>);
|
|
168
|
+
const image = document.querySelector(".promo-banner__image");
|
|
169
|
+
expect(image).not.toHaveClass("promo-banner__image--bleed-sm-down");
|
|
170
|
+
});
|
|
171
|
+
});
|
|
154
172
|
});
|
|
155
173
|
|
|
156
174
|
describe("variant", () => {
|
|
@@ -318,7 +336,7 @@ describe("PromoBanner", () => {
|
|
|
318
336
|
it("renders image from object src when image object is provided", () => {
|
|
319
337
|
render(
|
|
320
338
|
<PromoBanner
|
|
321
|
-
image={{ src: "https://example.com/test.jpg", srcSet: "test
|
|
339
|
+
image={{ src: "https://example.com/test.jpg", srcSet: "test" }}
|
|
322
340
|
>
|
|
323
341
|
Content
|
|
324
342
|
</PromoBanner>,
|
|
@@ -333,7 +351,7 @@ describe("PromoBanner", () => {
|
|
|
333
351
|
image={{
|
|
334
352
|
src: "https://example.com/test.jpg",
|
|
335
353
|
srcSet:
|
|
336
|
-
"https://example.com/test.jpg
|
|
354
|
+
"https://example.com/test.jpg, https://example.com/test@2x.jpg 2x",
|
|
337
355
|
}}
|
|
338
356
|
>
|
|
339
357
|
Content
|
|
@@ -342,7 +360,7 @@ describe("PromoBanner", () => {
|
|
|
342
360
|
const image = screen.getByRole("img");
|
|
343
361
|
expect(image).toHaveAttribute(
|
|
344
362
|
"srcSet",
|
|
345
|
-
"https://example.com/test.jpg
|
|
363
|
+
"https://example.com/test.jpg, https://example.com/test@2x.jpg 2x",
|
|
346
364
|
);
|
|
347
365
|
});
|
|
348
366
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
html:has(
|
|
18
|
-
.megamenu.
|
|
18
|
+
.megamenu:not(.non-sticky):not(.top-hidden)
|
|
19
19
|
.megamenu__nav-logo
|
|
20
20
|
> [data-megamenu-brand-mark]
|
|
21
21
|
+ span
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
html:has(
|
|
27
|
-
.megamenu.
|
|
27
|
+
.megamenu:not(.non-sticky):not(.top-hidden)
|
|
28
28
|
.megamenu__nav-logo
|
|
29
29
|
> [data-megamenu-brand-mark]
|
|
30
30
|
):not(
|
|
31
31
|
:has(
|
|
32
|
-
.megamenu.
|
|
32
|
+
.megamenu:not(.non-sticky):not(.top-hidden)
|
|
33
33
|
.megamenu__nav-logo
|
|
34
34
|
> [data-megamenu-brand-mark]
|
|
35
35
|
+ span
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
--header-height: 147px;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
html:has(.megamenu.
|
|
42
|
-
html:has(.megamenu.
|
|
41
|
+
html:has(.megamenu:not(.non-sticky).top-hidden),
|
|
42
|
+
html:has(.megamenu:not(.non-sticky) + .megamenu-spacer--small) {
|
|
43
43
|
--header-height: 80px;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -66,7 +66,7 @@ export const exports = {
|
|
|
66
66
|
"dark-surface-subtle": "#333333",
|
|
67
67
|
"dark-surface-moderate": "#595959",
|
|
68
68
|
"dark-surface-contrast": "#ffffff",
|
|
69
|
-
"dark-surface-accent": "#
|
|
69
|
+
"dark-surface-accent": "#333333",
|
|
70
70
|
"dark-fill-primary": "#000000",
|
|
71
71
|
"dark-fill-secondary": "#ff7900",
|
|
72
72
|
"dark-fill-tertiary": "#f15e00",
|
package/src/styles/shame.scss
CHANGED