@orangesk/orange-design-system 2.0.0-beta.12 → 2.0.0-beta.14
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/index.js +5 -5
- package/build/components/index.js.map +1 -1
- package/build/components/tsconfig.tsbuildinfo +1 -1
- package/build/components/types/index.d.ts +20 -16
- package/build/components/types/src/components/BodyBanner/BodyBanner.d.ts +10 -10
- package/build/components/types/src/components/Modal/Modal.d.ts +0 -2
- package/build/components/types/src/components/Modal/index.d.ts +0 -1
- package/build/components/types/src/components/Pill/Pill.d.ts +1 -1
- package/build/components/types/src/components/Tag/Tag.d.ts +0 -2
- package/build/components/types/src/components/index.d.ts +2 -2
- package/build/fonts/HelveticaNeue-Bold.woff2 +0 -0
- package/build/fonts/HelveticaNeue-Light.woff2 +0 -0
- package/build/fonts/HelveticaNeue-Roman.woff2 +0 -0
- package/build/lib/after-components.css +1 -1
- package/build/lib/after-components.css.map +1 -1
- package/build/lib/before-components.css +1 -1
- package/build/lib/before-components.css.map +1 -1
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/scripts.js +4 -4
- 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/package.json +15 -13
- package/public/fonts/HelveticaNeue-Bold.woff2 +0 -0
- package/public/fonts/HelveticaNeue-Light.woff2 +0 -0
- package/public/fonts/HelveticaNeue-Roman.woff2 +0 -0
- package/src/components/AnchorNavigation/styles/mixins.scss +4 -4
- package/src/components/BodyBanner/BodyBanner.tsx +52 -73
- package/src/components/BodyBanner/styles/mixins.scss +34 -32
- package/src/components/BodyBanner/styles/style.scss +4 -18
- package/src/components/BodyBanner/tests/BodyBanner.conformance.test.js +67 -0
- package/src/components/BodyBanner/tests/BodyBanner.unit.test.js +194 -0
- package/src/components/Carousel/Carousel.static.ts +1 -0
- package/src/components/Carousel/styles/mixins.scss +11 -5
- package/src/components/FeatureAccordion/FeatureAccordion.tsx +1 -1
- package/src/components/Link/styles/mixins.scss +8 -2
- package/src/components/Modal/Modal.tsx +1 -9
- package/src/components/Modal/index.ts +0 -1
- package/src/components/Modal/styles/config.scss +4 -4
- package/src/components/Modal/styles/mixins.scss +13 -59
- package/src/components/Modal/styles/style.scss +0 -16
- package/src/components/Modal/tests/Modal.unit.test.js +0 -37
- package/src/components/Pill/Pill.tsx +3 -0
- package/src/components/Pill/styles/style.scss +3 -1
- package/src/components/PromoBanner/styles/mixins.scss +1 -1
- package/src/components/Tag/Tag.tsx +0 -2
- package/src/components/Tag/styles/style.scss +32 -0
- package/src/components/index.ts +2 -0
- package/src/styles/typography/mixins.scss +0 -5
- package/src/styles/utilities/layout.scss +19 -0
- package/src/styles/utilities/visibility.scss +2 -4
- package/build/components/types/src/components/Modal/ModalProductBody.d.ts +0 -10
- package/src/components/Modal/ModalProductBody.tsx +0 -52
|
@@ -30,20 +30,9 @@
|
|
|
30
30
|
> div:not(.body-banner__button) {
|
|
31
31
|
flex: 1;
|
|
32
32
|
min-width: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&.is-large {
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
gap: 16px;
|
|
39
|
-
padding: space.get("xlarge");
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@include breakpoint.get("sm", "down") {
|
|
46
|
-
padding: space.get("large") 10px;
|
|
34
|
+
> *:last-child {
|
|
35
|
+
margin-bottom: 0;
|
|
47
36
|
}
|
|
48
37
|
}
|
|
49
38
|
|
|
@@ -60,28 +49,13 @@
|
|
|
60
49
|
|
|
61
50
|
@mixin image {
|
|
62
51
|
padding: 0 !important;
|
|
52
|
+
|
|
63
53
|
img {
|
|
64
54
|
width: 80px;
|
|
65
55
|
height: 80px;
|
|
66
56
|
object-fit: cover;
|
|
67
57
|
margin: 0 space.get("large") !important;
|
|
68
58
|
|
|
69
|
-
&.is-large {
|
|
70
|
-
width: 100%;
|
|
71
|
-
height: auto;
|
|
72
|
-
object-fit: cover;
|
|
73
|
-
object-position: left center;
|
|
74
|
-
margin: 0px !important;
|
|
75
|
-
|
|
76
|
-
@include breakpoint.get("xl", "down") {
|
|
77
|
-
height: 100%;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@include breakpoint.get("sm", "down") {
|
|
81
|
-
height: auto;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
59
|
@include breakpoint.get("sm", "down") {
|
|
86
60
|
margin: 15px !important;
|
|
87
61
|
}
|
|
@@ -91,15 +65,43 @@
|
|
|
91
65
|
@mixin button {
|
|
92
66
|
display: flex;
|
|
93
67
|
align-items: center;
|
|
94
|
-
padding: 0 space.get("xlarge");
|
|
68
|
+
padding: 0 0 0 space.get("xlarge");
|
|
95
69
|
margin: 0 !important;
|
|
96
70
|
|
|
97
|
-
|
|
71
|
+
@include breakpoint.get("lg", "down") {
|
|
98
72
|
padding: 0;
|
|
99
73
|
margin-top: space.get("small") !important;
|
|
100
74
|
}
|
|
75
|
+
}
|
|
101
76
|
|
|
102
|
-
|
|
77
|
+
@mixin large {
|
|
78
|
+
.body-banner__content-inner {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: 16px;
|
|
82
|
+
padding: space.get("xlarge");
|
|
83
|
+
|
|
84
|
+
@include breakpoint.get("lg", "down") {
|
|
85
|
+
padding: space.get("xlarge") space.get("large");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@include breakpoint.get("sm", "down") {
|
|
89
|
+
padding: space.get("large") 10px;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.body-banner__image {
|
|
94
|
+
img {
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 100%;
|
|
97
|
+
object-fit: cover;
|
|
98
|
+
object-position: center;
|
|
99
|
+
margin: 0 !important;
|
|
100
|
+
display: block;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.body-banner__button {
|
|
103
105
|
padding: 0;
|
|
104
106
|
margin-top: space.get("small") !important;
|
|
105
107
|
}
|
|
@@ -4,24 +4,6 @@
|
|
|
4
4
|
.body-banner {
|
|
5
5
|
@include mixins.body-banner();
|
|
6
6
|
|
|
7
|
-
&.is-gray {
|
|
8
|
-
--color-background-primary: var(--color-fill-subtle);
|
|
9
|
-
border: none !important;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&.is-orange {
|
|
13
|
-
// TODO: change to color token
|
|
14
|
-
--color-background-primary: #fff0e0;
|
|
15
|
-
border: none !important;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&.is-dark {
|
|
19
|
-
&.is-orange {
|
|
20
|
-
// TODO: change to color token
|
|
21
|
-
color: #000000 !important;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
7
|
&__content {
|
|
26
8
|
@include mixins.content();
|
|
27
9
|
|
|
@@ -37,5 +19,9 @@
|
|
|
37
19
|
&__button {
|
|
38
20
|
@include mixins.button();
|
|
39
21
|
}
|
|
22
|
+
|
|
23
|
+
&--large {
|
|
24
|
+
@include mixins.large();
|
|
25
|
+
}
|
|
40
26
|
}
|
|
41
27
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
import { axe } from "jest-axe";
|
|
3
|
+
|
|
4
|
+
import { BodyBanner } from "../";
|
|
5
|
+
|
|
6
|
+
const example = (
|
|
7
|
+
<>
|
|
8
|
+
<BodyBanner size="small" buttonText="Learn More">
|
|
9
|
+
<h3>Small Banner Example</h3>
|
|
10
|
+
<p>This is a small banner with image and call-to-action button.</p>
|
|
11
|
+
</BodyBanner>
|
|
12
|
+
|
|
13
|
+
<BodyBanner
|
|
14
|
+
size="large"
|
|
15
|
+
buttonText="Get Started"
|
|
16
|
+
imageUrl="https://picsum.photos/seed/test/640/380"
|
|
17
|
+
>
|
|
18
|
+
<h3>Large Banner Example</h3>
|
|
19
|
+
<p>This is a large banner with two-column layout.</p>
|
|
20
|
+
</BodyBanner>
|
|
21
|
+
|
|
22
|
+
<BodyBanner
|
|
23
|
+
size="small"
|
|
24
|
+
color="background-accent"
|
|
25
|
+
buttonText="Discover"
|
|
26
|
+
imageUrl="https://picsum.photos/seed/test2/640/380"
|
|
27
|
+
>
|
|
28
|
+
<h3>Accent Background</h3>
|
|
29
|
+
<p>Brand accent background banner.</p>
|
|
30
|
+
</BodyBanner>
|
|
31
|
+
|
|
32
|
+
<BodyBanner
|
|
33
|
+
size="small"
|
|
34
|
+
color="surface-subtle"
|
|
35
|
+
buttonText="Explore"
|
|
36
|
+
imageUrl="https://picsum.photos/seed/test3/640/380"
|
|
37
|
+
>
|
|
38
|
+
<h3>Subtle Surface</h3>
|
|
39
|
+
<p>Gentle background color banner.</p>
|
|
40
|
+
</BodyBanner>
|
|
41
|
+
|
|
42
|
+
<BodyBanner size="small" buttonText="Learn More">
|
|
43
|
+
<h3>Text-Only Banner</h3>
|
|
44
|
+
<p>Banner without image focusing on text content.</p>
|
|
45
|
+
</BodyBanner>
|
|
46
|
+
|
|
47
|
+
<BodyBanner
|
|
48
|
+
size="large"
|
|
49
|
+
color="background-primary"
|
|
50
|
+
buttonText="Start Now"
|
|
51
|
+
imageUrl="https://picsum.photos/seed/test4/640/380"
|
|
52
|
+
>
|
|
53
|
+
<h3>Primary Background</h3>
|
|
54
|
+
<p>Clean white background banner.</p>
|
|
55
|
+
</BodyBanner>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
it("is valid html", () => {
|
|
60
|
+
const { container } = render(example);
|
|
61
|
+
expect(container).toHTMLValidate();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("is accessible", async () => {
|
|
65
|
+
const { container } = render(example);
|
|
66
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
67
|
+
});
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
|
|
3
|
+
import { BodyBanner } from "../";
|
|
4
|
+
|
|
5
|
+
describe("rendering BodyBanner", () => {
|
|
6
|
+
describe("initial state", () => {
|
|
7
|
+
it("has default className body-banner", () => {
|
|
8
|
+
const { container } = render(<BodyBanner />);
|
|
9
|
+
expect(container.querySelector(".body-banner")).toBeInTheDocument();
|
|
10
|
+
expect(container.querySelector(".body-banner")).toHaveClass(
|
|
11
|
+
"body-banner",
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe("sizes", () => {
|
|
17
|
+
it("doesn't have body-banner--small class when size is small (default)", () => {
|
|
18
|
+
const { container } = render(<BodyBanner />);
|
|
19
|
+
expect(container.querySelector(".body-banner")).not.toHaveClass(
|
|
20
|
+
"body-banner--small",
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("has body-banner--large class when size is large", () => {
|
|
25
|
+
const { container } = render(<BodyBanner size="large" />);
|
|
26
|
+
expect(container.querySelector(".body-banner")).toHaveClass(
|
|
27
|
+
"body-banner--large",
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe("colors", () => {
|
|
33
|
+
it("doesn't have color class when color is background-primary (default)", () => {
|
|
34
|
+
const { container } = render(<BodyBanner color="background-primary" />);
|
|
35
|
+
expect(container.querySelector(".body-banner")).not.toHaveClass(
|
|
36
|
+
"background-primary",
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("has background-primary class by default (when no color specified)", () => {
|
|
41
|
+
const { container } = render(<BodyBanner />);
|
|
42
|
+
expect(container.querySelector(".body-banner")).toHaveClass(
|
|
43
|
+
"body-banner",
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("has background-accent class when color is background-accent", () => {
|
|
48
|
+
const { container } = render(<BodyBanner color="background-accent" />);
|
|
49
|
+
expect(container.querySelector(".body-banner")).toHaveClass(
|
|
50
|
+
"background-accent",
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("has surface-subtle class when color is surface-subtle", () => {
|
|
55
|
+
const { container } = render(<BodyBanner color="surface-subtle" />);
|
|
56
|
+
expect(container.querySelector(".body-banner")).toHaveClass(
|
|
57
|
+
"surface-subtle",
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("supports all available colors", () => {
|
|
62
|
+
const colors = [
|
|
63
|
+
"background-primary",
|
|
64
|
+
"background-accent",
|
|
65
|
+
"surface-subtle",
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
colors.forEach((color) => {
|
|
69
|
+
const { container } = render(<BodyBanner color={color} />);
|
|
70
|
+
|
|
71
|
+
if (color !== "background-primary") {
|
|
72
|
+
expect(container.querySelector(".body-banner")).toHaveClass(color);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe("children and button", () => {
|
|
79
|
+
it("renders children content", () => {
|
|
80
|
+
const { getByText } = render(
|
|
81
|
+
<BodyBanner>
|
|
82
|
+
<h3>Test Title</h3>
|
|
83
|
+
<p>Test Description</p>
|
|
84
|
+
</BodyBanner>,
|
|
85
|
+
);
|
|
86
|
+
expect(getByText("Test Title")).toBeInTheDocument();
|
|
87
|
+
expect(getByText("Test Description")).toBeInTheDocument();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("renders button text", () => {
|
|
91
|
+
const { getByText } = render(<BodyBanner buttonText="Learn More" />);
|
|
92
|
+
expect(getByText("Learn More")).toBeInTheDocument();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("renders both children and button", () => {
|
|
96
|
+
const { getByText } = render(
|
|
97
|
+
<BodyBanner buttonText="Click Me">
|
|
98
|
+
<h3>Content</h3>
|
|
99
|
+
</BodyBanner>,
|
|
100
|
+
);
|
|
101
|
+
expect(getByText("Content")).toBeInTheDocument();
|
|
102
|
+
expect(getByText("Click Me")).toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe("image", () => {
|
|
107
|
+
it("renders image when imageUrl is provided", () => {
|
|
108
|
+
const { getByRole } = render(
|
|
109
|
+
<BodyBanner imageUrl="https://example.com/image.jpg" />,
|
|
110
|
+
);
|
|
111
|
+
const image = getByRole("img");
|
|
112
|
+
expect(image).toBeInTheDocument();
|
|
113
|
+
expect(image).toHaveAttribute("src", "https://example.com/image.jpg");
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("doesn't render image when imageUrl is not provided", () => {
|
|
117
|
+
const { queryByRole } = render(<BodyBanner />);
|
|
118
|
+
const image = queryByRole("img");
|
|
119
|
+
expect(image).not.toBeInTheDocument();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("renders image in separate column when size is large", () => {
|
|
123
|
+
const { container, getAllByRole } = render(
|
|
124
|
+
<BodyBanner size="large" imageUrl="https://example.com/image.jpg" />,
|
|
125
|
+
);
|
|
126
|
+
const images = getAllByRole("img");
|
|
127
|
+
expect(images.length).toBe(1);
|
|
128
|
+
const imageContainer = container.querySelector(".body-banner__image");
|
|
129
|
+
expect(imageContainer).toBeInTheDocument();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("renders image in content when size is small", () => {
|
|
133
|
+
const { container, getByRole } = render(
|
|
134
|
+
<BodyBanner size="small" imageUrl="https://example.com/image.jpg" />,
|
|
135
|
+
);
|
|
136
|
+
const imageContainer = container.querySelector(".body-banner__image");
|
|
137
|
+
expect(imageContainer).toBeInTheDocument();
|
|
138
|
+
const image = getByRole("img");
|
|
139
|
+
expect(image).toBeInTheDocument();
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe("className prop", () => {
|
|
144
|
+
it("has additional class when className is set", () => {
|
|
145
|
+
const { container } = render(<BodyBanner className="custom-class" />);
|
|
146
|
+
expect(container.querySelector(".body-banner")).toHaveClass(
|
|
147
|
+
"body-banner",
|
|
148
|
+
);
|
|
149
|
+
expect(container.querySelector(".body-banner")).toHaveClass(
|
|
150
|
+
"custom-class",
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe("button className prop", () => {
|
|
156
|
+
it("applies buttonClassName to the button", () => {
|
|
157
|
+
const { getByRole } = render(
|
|
158
|
+
<BodyBanner buttonText="Click" buttonClassName="custom-button-class" />,
|
|
159
|
+
);
|
|
160
|
+
const button = getByRole("button");
|
|
161
|
+
expect(button).toHaveClass("custom-button-class");
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe("responsive layout", () => {
|
|
166
|
+
it("renders grid structure with proper content column", () => {
|
|
167
|
+
const { container } = render(
|
|
168
|
+
<BodyBanner size="small">
|
|
169
|
+
<h3>Test</h3>
|
|
170
|
+
</BodyBanner>,
|
|
171
|
+
);
|
|
172
|
+
const gridCol = container.querySelector(".body-banner__content");
|
|
173
|
+
expect(gridCol).toBeInTheDocument();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("has button container", () => {
|
|
177
|
+
const { container } = render(<BodyBanner buttonText="Click" />);
|
|
178
|
+
const buttonContainer = container.querySelector(".body-banner__button");
|
|
179
|
+
expect(buttonContainer).toBeInTheDocument();
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("has content-inner container", () => {
|
|
183
|
+
const { container } = render(
|
|
184
|
+
<BodyBanner>
|
|
185
|
+
<h3>Test</h3>
|
|
186
|
+
</BodyBanner>,
|
|
187
|
+
);
|
|
188
|
+
const contentInner = container.querySelector(
|
|
189
|
+
".body-banner__content-inner",
|
|
190
|
+
);
|
|
191
|
+
expect(contentInner).toBeInTheDocument();
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
});
|
|
@@ -210,6 +210,7 @@ export default class Carousel {
|
|
|
210
210
|
// Only add offset if there's actual bleeding (positive value)
|
|
211
211
|
if (bleedAmount > 0) {
|
|
212
212
|
// Update the Swiper configuration
|
|
213
|
+
// Add offset only on the right side for right bleed effect
|
|
213
214
|
this.instance.params.slidesOffsetAfter = bleedAmount;
|
|
214
215
|
this.instance.update();
|
|
215
216
|
} else {
|
|
@@ -211,15 +211,21 @@
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
@mixin bleed-right-variant {
|
|
214
|
+
// Allow overflow on the left side at the carousel container level
|
|
215
|
+
overflow: visible;
|
|
216
|
+
|
|
217
|
+
.carousel__viewport-wrapper {
|
|
218
|
+
// Allow overflow from viewport
|
|
219
|
+
overflow: visible;
|
|
220
|
+
}
|
|
221
|
+
|
|
214
222
|
.carousel__viewport {
|
|
215
223
|
// Extend the viewport to the right edge of the screen
|
|
216
224
|
width: calc(100% + 50vw - 50%);
|
|
217
225
|
margin-right: 0;
|
|
218
|
-
|
|
219
|
-
//
|
|
220
|
-
|
|
221
|
-
margin-left: convert.to-rem(50px);
|
|
222
|
-
}
|
|
226
|
+
margin-left: 0 !important; // Don't add left margin - let content flow naturally
|
|
227
|
+
overflow: visible !important; // Allow content to overflow on left side
|
|
228
|
+
overflow-y: hidden; // Still hide vertical overflow
|
|
223
229
|
|
|
224
230
|
// On very large screens (above 2K), stop the bleeding effect entirely
|
|
225
231
|
@media (min-width: 2560px) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
@mixin base {
|
|
5
5
|
font-weight: bold;
|
|
6
6
|
text-decoration: underline;
|
|
7
|
-
color:
|
|
7
|
+
color: inherit;
|
|
8
8
|
background: none;
|
|
9
9
|
text-decoration: none;
|
|
10
10
|
cursor: pointer;
|
|
@@ -14,7 +14,13 @@
|
|
|
14
14
|
p &,
|
|
15
15
|
li &,
|
|
16
16
|
dt &,
|
|
17
|
-
dd
|
|
17
|
+
dd &,
|
|
18
|
+
h1 &,
|
|
19
|
+
h2 &,
|
|
20
|
+
h3 &,
|
|
21
|
+
h4 &,
|
|
22
|
+
h5 &,
|
|
23
|
+
h6 & {
|
|
18
24
|
font-weight: inherit;
|
|
19
25
|
}
|
|
20
26
|
}
|
|
@@ -53,8 +53,6 @@ interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
53
53
|
colorScheme?: "dark" | "light";
|
|
54
54
|
/** Disables header paddings */
|
|
55
55
|
disableHeaderSpacing?: boolean;
|
|
56
|
-
/** Disables body paddings */
|
|
57
|
-
disableBodySpacing?: boolean;
|
|
58
56
|
/** Disables footer paddings */
|
|
59
57
|
disableFooterSpacing?: boolean;
|
|
60
58
|
}
|
|
@@ -85,7 +83,6 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
85
83
|
fullHeight,
|
|
86
84
|
colorScheme,
|
|
87
85
|
disableHeaderSpacing,
|
|
88
|
-
disableBodySpacing,
|
|
89
86
|
disableFooterSpacing,
|
|
90
87
|
...other
|
|
91
88
|
}) => {
|
|
@@ -149,12 +146,7 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
149
146
|
{renderBody ? (
|
|
150
147
|
renderBody()
|
|
151
148
|
) : (
|
|
152
|
-
<ModalBody
|
|
153
|
-
disableSpacing={disableBodySpacing}
|
|
154
|
-
withTopPadding={!disableBodySpacing && !!renderHeader}
|
|
155
|
-
>
|
|
156
|
-
{children}
|
|
157
|
-
</ModalBody>
|
|
149
|
+
<ModalBody withTopPadding={!!renderHeader}>{children}</ModalBody>
|
|
158
150
|
)}
|
|
159
151
|
<div
|
|
160
152
|
className={cx(`${CLASS_ROOT}__footer`, {
|
|
@@ -4,4 +4,3 @@ export { ModalTitle } from "./ModalTitle";
|
|
|
4
4
|
export { ModalCloseButton } from "./ModalCloseButton";
|
|
5
5
|
export { ModalProductHeader } from "./ModalProductHeader";
|
|
6
6
|
export { ModalProductFooter } from "./ModalProductFooter";
|
|
7
|
-
export { ModalProductBody } from "./ModalProductBody";
|
|
@@ -42,7 +42,7 @@ $spacing: (
|
|
|
42
42
|
|
|
43
43
|
$spacing-product-footer: (
|
|
44
44
|
default: (
|
|
45
|
-
default: space.get("medium")
|
|
46
|
-
md: space.get("
|
|
47
|
-
)
|
|
48
|
-
)
|
|
45
|
+
default: space.get("medium"),
|
|
46
|
+
md: space.get("large"),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
@@ -33,8 +33,9 @@
|
|
|
33
33
|
z-index: config.$overlay-z-index;
|
|
34
34
|
opacity: 0;
|
|
35
35
|
transform: scale(1.1, 1.1);
|
|
36
|
-
transition:
|
|
37
|
-
|
|
36
|
+
transition:
|
|
37
|
+
opacity config.$overlay-e,
|
|
38
|
+
transform config.$overlay-e;
|
|
38
39
|
backface-visibility: hidden;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -205,7 +206,7 @@
|
|
|
205
206
|
|
|
206
207
|
@at-root {
|
|
207
208
|
.modal__body--colorful + .modal__footer {
|
|
208
|
-
padding: $space
|
|
209
|
+
padding: $space;
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
212
|
}
|
|
@@ -214,11 +215,17 @@
|
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
@mixin sticky-footer() {
|
|
218
|
+
z-index: 1;
|
|
219
|
+
|
|
217
220
|
@media screen and (min-height: 500px) {
|
|
218
221
|
position: sticky;
|
|
219
222
|
bottom: 0;
|
|
220
223
|
background-color: var(--color-surface-primary);
|
|
221
224
|
}
|
|
225
|
+
|
|
226
|
+
&.modal__footer--no-spacing {
|
|
227
|
+
padding: 0 !important;
|
|
228
|
+
}
|
|
222
229
|
}
|
|
223
230
|
|
|
224
231
|
@mixin modal-product-header($spacing) {
|
|
@@ -248,7 +255,9 @@
|
|
|
248
255
|
flex-direction: column;
|
|
249
256
|
}
|
|
250
257
|
|
|
251
|
-
@each $breakpoint,
|
|
258
|
+
@each $breakpoint,
|
|
259
|
+
$value in map.get(config.$spacing-product-footer, "default")
|
|
260
|
+
{
|
|
252
261
|
@include breakpoint.get($breakpoint) {
|
|
253
262
|
padding: $value;
|
|
254
263
|
}
|
|
@@ -284,58 +293,3 @@
|
|
|
284
293
|
object-position: left;
|
|
285
294
|
max-width: convert.to-rem(125px);
|
|
286
295
|
}
|
|
287
|
-
|
|
288
|
-
@mixin modal-product-body-subtitle-section() {
|
|
289
|
-
padding: convert.to-rem(15px) space.get();
|
|
290
|
-
|
|
291
|
-
@include breakpoint.get('md') {
|
|
292
|
-
padding: convert.to-rem(20px) space.get('large');
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
@mixin modal-product-body-list-section() {
|
|
297
|
-
padding: 0 space.get();
|
|
298
|
-
|
|
299
|
-
@include breakpoint.get('md') {
|
|
300
|
-
padding: space.get('small') space.get('large');
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
ul {
|
|
304
|
-
margin-bottom: 0;
|
|
305
|
-
padding: space.get('small') space.get() space.get('small') convert.to-rem(18px);
|
|
306
|
-
@include breakpoint.get('md') {
|
|
307
|
-
padding-right: 0;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
li {
|
|
312
|
-
margin-bottom: convert.to-rem(15px);
|
|
313
|
-
|
|
314
|
-
&:last-child {
|
|
315
|
-
margin-bottom: 0;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
@mixin modal-product-body-accordion-section() {
|
|
321
|
-
padding: convert.to-rem(15px) space.get();
|
|
322
|
-
|
|
323
|
-
.accordion__body {
|
|
324
|
-
padding: 0 space.get() convert.to-rem(15px) space.get('small');
|
|
325
|
-
margin-bottom: 0;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
@include breakpoint.get('md') {
|
|
329
|
-
padding: space.get('small') space.get('large');
|
|
330
|
-
|
|
331
|
-
.accordion__body {
|
|
332
|
-
padding: 0 space.get('large') convert.to-rem(15px) space.get('small');
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
@mixin modal-product-body-section-title() {
|
|
338
|
-
margin-bottom: 0 !important;
|
|
339
|
-
|
|
340
|
-
padding: space.get('small') 0;
|
|
341
|
-
}
|
|
@@ -132,20 +132,4 @@
|
|
|
132
132
|
.modal__product-footer-button {
|
|
133
133
|
@include mixins.modal-product-footer-button();
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
.modal__product-body-subtitle-section {
|
|
137
|
-
@include mixins.modal-product-body-subtitle-section();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.modal__product-body-list-section {
|
|
141
|
-
@include mixins.modal-product-body-list-section();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.modal__product-body-accordion-section {
|
|
145
|
-
@include mixins.modal-product-body-accordion-section();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.modal__product-body-section-title {
|
|
149
|
-
@include mixins.modal-product-body-section-title();
|
|
150
|
-
}
|
|
151
135
|
}
|
|
@@ -111,41 +111,4 @@ describe("rendering Modal", () => {
|
|
|
111
111
|
expect(child[0]).toHaveClass("modal__footer--no-spacing");
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
|
-
describe("disableBodySpacing prop", () => {
|
|
115
|
-
it("should have modal__body--no-spacing class when disableBodySpacing is true", () => {
|
|
116
|
-
const { getByTestId } = render(
|
|
117
|
-
<div id="root">
|
|
118
|
-
<Modal
|
|
119
|
-
id="modal-no-body-spacing"
|
|
120
|
-
data-testid="modal-no-body-spacing"
|
|
121
|
-
disableBodySpacing
|
|
122
|
-
/>
|
|
123
|
-
</div>,
|
|
124
|
-
);
|
|
125
|
-
const child = getByTestId("modal-no-body-spacing").getElementsByClassName(
|
|
126
|
-
"modal__body--no-spacing",
|
|
127
|
-
);
|
|
128
|
-
expect(child.length).toBe(1);
|
|
129
|
-
expect(child[0]).toHaveClass("modal__body--no-spacing");
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("should not apply with-top-padding class on body when custom header renderer is present with disableBodySpacing prop", () => {
|
|
133
|
-
const { getByTestId } = render(
|
|
134
|
-
<div id="root">
|
|
135
|
-
<Modal
|
|
136
|
-
id="modal-no-body-spacing"
|
|
137
|
-
data-testid="modal-no-body-spacing"
|
|
138
|
-
disableBodySpacing
|
|
139
|
-
renderHeader={() => <div>Custom Header</div>}
|
|
140
|
-
/>
|
|
141
|
-
</div>,
|
|
142
|
-
);
|
|
143
|
-
const child = getByTestId("modal-no-body-spacing").getElementsByClassName(
|
|
144
|
-
"modal__body",
|
|
145
|
-
);
|
|
146
|
-
expect(child.length).toBe(1);
|
|
147
|
-
expect(child[0]).not.toHaveClass("with-top-padding");
|
|
148
|
-
expect(child[0]).toHaveClass("modal__body--no-spacing");
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
114
|
});
|