@orangesk/orange-design-system 2.0.0-beta.27 → 2.0.0-beta.29
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/Carousel/style.css +1 -1
- package/build/components/Carousel/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/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 +8 -0
- package/build/components/types/src/components/Carousel/Carousel.static.d.ts +7 -0
- package/build/components/types/src/components/Forms/File/File.d.ts +2 -0
- package/build/components/types/src/components/Forms/Group/Group.d.ts +2 -0
- package/build/components/types/src/components/Forms/InputStepper/InputStepper.d.ts +2 -0
- package/build/components/types/src/components/Forms/RangeSlider/RangeSlider.d.ts +2 -0
- package/build/components/types/src/components/Modal/Modal.static.d.ts +2 -0
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/megamenu.css +1 -1
- package/build/lib/megamenu.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/tsconfig.tsbuildinfo +1 -1
- package/build/search-index.json +418 -0
- package/package.json +7 -7
- package/src/components/Carousel/Carousel.static.ts +45 -7
- package/src/components/Carousel/styles/mixins.scss +0 -5
- package/src/components/Forms/Checkbox/styles/config.scss +6 -3
- package/src/components/Forms/Field/Control.tsx +49 -46
- package/src/components/Forms/Field/styles/config.scss +1 -1
- package/src/components/Forms/Field/tests/Group.Field.conformance.test.js +35 -11
- package/src/components/Forms/File/File.tsx +7 -2
- package/src/components/Forms/Group/Group.tsx +17 -8
- package/src/components/Forms/InputStepper/InputStepper.tsx +3 -0
- package/src/components/Forms/InputStepper/styles/style.scss +39 -44
- package/src/components/Forms/Message/styles/config.scss +2 -1
- package/src/components/Forms/Radio/styles/config.scss +6 -3
- package/src/components/Forms/RangeSlider/RangeSlider.tsx +3 -0
- package/src/components/Forms/styles/config.scss +5 -4
- package/src/components/Modal/Modal.static.ts +14 -3
- package/src/components/Modal/Modal.tsx +12 -3
- package/src/components/PromoBanner/PromoBanner.tsx +52 -50
- package/src/components/PromoBanner/tests/PromoBanner.conformance.test.js +4 -2
- package/src/components/PromoBanner/tests/PromoBanner.unit.test.js +5 -1
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
@use "../../../styles/tokens/space";
|
|
4
4
|
|
|
5
5
|
$default: (
|
|
6
|
-
background-color: color
|
|
7
|
-
border: 2px solid var(--color-
|
|
6
|
+
background-color: var(--color-fill-primary),
|
|
7
|
+
border: 2px solid var(--color-border-strong),
|
|
8
|
+
color: var(--color-text-default),
|
|
8
9
|
);
|
|
9
10
|
|
|
10
11
|
$focus: (
|
|
@@ -15,12 +16,12 @@ $focus: (
|
|
|
15
16
|
|
|
16
17
|
$disabled: (
|
|
17
18
|
background-color: var(--color-surface-subtle),
|
|
18
|
-
border-color: var(--color-
|
|
19
|
+
border-color: var(--color-border-strong),
|
|
19
20
|
color: var(--color-text-secondary),
|
|
20
21
|
);
|
|
21
22
|
|
|
22
23
|
$disabled-checked: (
|
|
23
|
-
background-color: var(--color-
|
|
24
|
+
background-color: var(--color-border-strong),
|
|
24
25
|
);
|
|
25
26
|
|
|
26
27
|
$readonly: (
|
|
@@ -10,6 +10,8 @@ interface ModalConfig {
|
|
|
10
10
|
root: string;
|
|
11
11
|
/** Move modal into this element selector (must be unique in DOM) */
|
|
12
12
|
modalsRoot: string;
|
|
13
|
+
/** Disable moving modal to #root-modals (for React controlled mode) */
|
|
14
|
+
disablePortal?: boolean;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
const defaultConfig = (): ModalConfig => ({
|
|
@@ -111,7 +113,7 @@ export default class Modal {
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
init(): void {
|
|
114
|
-
if (this.config.modalsRoot) {
|
|
116
|
+
if (this.config.modalsRoot && !this.config.disablePortal) {
|
|
115
117
|
Modal.moveToModalRoot(
|
|
116
118
|
this.element,
|
|
117
119
|
document.querySelector(this.config.modalsRoot),
|
|
@@ -180,11 +182,15 @@ export default class Modal {
|
|
|
180
182
|
const scrollY = window.scrollY;
|
|
181
183
|
document.body.setAttribute("data-lock-scrolltop", scrollY.toString());
|
|
182
184
|
|
|
185
|
+
const scrollbarWidth =
|
|
186
|
+
window.innerWidth - document.documentElement.clientWidth;
|
|
187
|
+
|
|
183
188
|
// Lock body with position fixed and offset
|
|
184
189
|
document.body.style.position = "fixed";
|
|
185
190
|
document.body.style.top = `-${scrollY}px`;
|
|
186
191
|
document.body.style.left = "0";
|
|
187
192
|
document.body.style.right = "0";
|
|
193
|
+
document.body.style.paddingRight = `${scrollbarWidth}px`;
|
|
188
194
|
|
|
189
195
|
// add modal class
|
|
190
196
|
document.body.classList.add(actualClassName);
|
|
@@ -203,12 +209,17 @@ export default class Modal {
|
|
|
203
209
|
document.body.style.top = "";
|
|
204
210
|
document.body.style.left = "";
|
|
205
211
|
document.body.style.right = "";
|
|
212
|
+
document.body.style.paddingRight = "";
|
|
206
213
|
|
|
207
214
|
// remove modal class
|
|
208
215
|
document.body.classList.remove(actualClassName);
|
|
209
216
|
|
|
210
|
-
// Restore scroll position
|
|
211
|
-
window.scrollTo(
|
|
217
|
+
// Restore scroll position instantly (ignore scroll-behavior: smooth)
|
|
218
|
+
window.scrollTo({
|
|
219
|
+
top: parseInt(scrollTop, 10),
|
|
220
|
+
left: 0,
|
|
221
|
+
behavior: "instant",
|
|
222
|
+
});
|
|
212
223
|
Modal.isLocked = false;
|
|
213
224
|
}
|
|
214
225
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import React, { useEffect } from "react";
|
|
3
|
+
import React, { useEffect, useMemo } from "react";
|
|
4
4
|
import cx from "classnames";
|
|
5
5
|
|
|
6
6
|
import { useStatic } from "../../utils/hooks";
|
|
@@ -80,7 +80,16 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
80
80
|
disableFooterSpacing,
|
|
81
81
|
...other
|
|
82
82
|
}) => {
|
|
83
|
-
|
|
83
|
+
// In React controlled mode (using isActive), we skip data-modal
|
|
84
|
+
// so vanilla JS won't initialize and move modal to #root-modals
|
|
85
|
+
// onHide alone works in uncontrolled mode - it's just a callback
|
|
86
|
+
const isReactControlled = isActive !== undefined;
|
|
87
|
+
|
|
88
|
+
const modalConfig = useMemo(
|
|
89
|
+
() => (isReactControlled ? { disablePortal: true } : {}),
|
|
90
|
+
[isReactControlled],
|
|
91
|
+
);
|
|
92
|
+
const [modalRef, instance] = useStatic(ModalStatic, modalConfig);
|
|
84
93
|
|
|
85
94
|
useEffect(() => {
|
|
86
95
|
if (!instance.current || !onHide) return;
|
|
@@ -128,7 +137,7 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
128
137
|
return (
|
|
129
138
|
<div
|
|
130
139
|
id={id}
|
|
131
|
-
data-modal
|
|
140
|
+
{...(!isReactControlled && { "data-modal": true })}
|
|
132
141
|
className={CLASS_ROOT}
|
|
133
142
|
ref={modalRef}
|
|
134
143
|
role="dialog"
|
|
@@ -30,64 +30,66 @@ export const PromoBanner = ({
|
|
|
30
30
|
}: PromoBannerProps) => {
|
|
31
31
|
const classes = cx(CLASS_ROOT, className);
|
|
32
32
|
return (
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<GridCol
|
|
52
|
-
size={
|
|
53
|
-
variant === "vertical"
|
|
54
|
-
? { xs: 12, sm: 10, md: 8, lg: 6 }
|
|
55
|
-
: { xs: 12, md: image ? 6 : 7 }
|
|
56
|
-
}
|
|
57
|
-
className={cx(
|
|
58
|
-
`${CLASS_ROOT}__item`,
|
|
59
|
-
{
|
|
60
|
-
"align-items-center align-center align-self-center":
|
|
61
|
-
variant === "vertical",
|
|
62
|
-
},
|
|
63
|
-
itemClassName,
|
|
33
|
+
<div className={classes}>
|
|
34
|
+
<Grid columnGapSize="large">
|
|
35
|
+
{variant === "reverse" && image && (
|
|
36
|
+
<GridCol
|
|
37
|
+
size={{ xs: 12, md: 6 }}
|
|
38
|
+
className={cx(
|
|
39
|
+
`${CLASS_ROOT}__image`,
|
|
40
|
+
"align-center align-md-left",
|
|
41
|
+
imageClassName,
|
|
42
|
+
)}
|
|
43
|
+
>
|
|
44
|
+
<Image
|
|
45
|
+
src={image}
|
|
46
|
+
alt="Obrázok"
|
|
47
|
+
className={cx("mb-none", { fullwidth: imageFullWidth })}
|
|
48
|
+
/>
|
|
49
|
+
</GridCol>
|
|
64
50
|
)}
|
|
65
|
-
>
|
|
66
|
-
{children}
|
|
67
|
-
</GridCol>
|
|
68
51
|
|
|
69
|
-
{image && variant !== "reverse" && (
|
|
70
52
|
<GridCol
|
|
71
|
-
size={
|
|
53
|
+
size={
|
|
54
|
+
variant === "vertical"
|
|
55
|
+
? { xs: 12, sm: 10, md: 8, lg: 6 }
|
|
56
|
+
: { xs: 12, md: image ? 6 : 7 }
|
|
57
|
+
}
|
|
72
58
|
className={cx(
|
|
73
|
-
`${CLASS_ROOT}
|
|
59
|
+
`${CLASS_ROOT}__item`,
|
|
74
60
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"pt-none": alignImage === "top",
|
|
78
|
-
"pb-none": alignImage === "bottom",
|
|
79
|
-
"align-center": variant === "vertical",
|
|
61
|
+
"align-items-center align-center align-self-center":
|
|
62
|
+
variant === "vertical",
|
|
80
63
|
},
|
|
81
|
-
|
|
64
|
+
itemClassName,
|
|
82
65
|
)}
|
|
83
66
|
>
|
|
84
|
-
|
|
85
|
-
src={image}
|
|
86
|
-
alt="Obrázok"
|
|
87
|
-
className={cx("mb-none", { fullwidth: imageFullWidth })}
|
|
88
|
-
/>
|
|
67
|
+
{children}
|
|
89
68
|
</GridCol>
|
|
90
|
-
|
|
91
|
-
|
|
69
|
+
|
|
70
|
+
{image && variant !== "reverse" && (
|
|
71
|
+
<GridCol
|
|
72
|
+
size={variant === "vertical" ? { xs: 12 } : { xs: 12, md: 6 }}
|
|
73
|
+
className={cx(
|
|
74
|
+
`${CLASS_ROOT}__image`,
|
|
75
|
+
{
|
|
76
|
+
[`${CLASS_ROOT}__image--bleed-right`]: bleedImage,
|
|
77
|
+
[`align-self-${alignImage}`]: alignImage,
|
|
78
|
+
"pt-none": alignImage === "top",
|
|
79
|
+
"pb-none": alignImage === "bottom",
|
|
80
|
+
"align-center": variant === "vertical",
|
|
81
|
+
},
|
|
82
|
+
imageClassName,
|
|
83
|
+
)}
|
|
84
|
+
>
|
|
85
|
+
<Image
|
|
86
|
+
src={image}
|
|
87
|
+
alt="Obrázok"
|
|
88
|
+
className={cx("mb-none", { fullwidth: imageFullWidth })}
|
|
89
|
+
/>
|
|
90
|
+
</GridCol>
|
|
91
|
+
)}
|
|
92
|
+
</Grid>
|
|
93
|
+
</div>
|
|
92
94
|
);
|
|
93
95
|
};
|
|
@@ -714,10 +714,12 @@ describe("PromoBanner Component Conformance Tests", () => {
|
|
|
714
714
|
</PromoBanner>,
|
|
715
715
|
);
|
|
716
716
|
|
|
717
|
-
const
|
|
717
|
+
const banner = container.querySelector(".promo-banner");
|
|
718
|
+
const grid = banner.querySelector(".grid");
|
|
718
719
|
const gridCol = container.querySelector(".grid__col");
|
|
719
720
|
|
|
720
|
-
expect(
|
|
721
|
+
expect(banner).toHaveClass("promo-banner", "test-grid");
|
|
722
|
+
expect(grid).toHaveClass("grid");
|
|
721
723
|
expect(gridCol).toHaveClass("grid__col");
|
|
722
724
|
});
|
|
723
725
|
|
|
@@ -20,12 +20,16 @@ describe("PromoBanner", () => {
|
|
|
20
20
|
render(<PromoBanner />);
|
|
21
21
|
const banner = document.querySelector(".promo-banner");
|
|
22
22
|
expect(banner).toHaveClass("promo-banner");
|
|
23
|
+
const grid = banner.querySelector(".grid");
|
|
24
|
+
expect(grid).toBeInTheDocument();
|
|
23
25
|
});
|
|
24
26
|
|
|
25
27
|
it("renders as Grid component", () => {
|
|
26
28
|
const { container } = render(<PromoBanner />);
|
|
27
|
-
const
|
|
29
|
+
const banner = container.querySelector(".promo-banner");
|
|
30
|
+
const grid = banner.querySelector(".grid");
|
|
28
31
|
expect(grid).toBeInTheDocument();
|
|
32
|
+
expect(grid).toHaveClass("grid");
|
|
29
33
|
});
|
|
30
34
|
});
|
|
31
35
|
|