@doyourjob/gravity-ui-page-constructor 5.31.227 → 5.31.230
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/cjs/blocks/LogoRotator/Item.d.ts +1 -1
- package/build/cjs/blocks/LogoRotator/Item.js +8 -2
- package/build/cjs/blocks/LogoRotator/LogoRotator.js +11 -2
- package/build/cjs/blocks/LogoRotator/schema.js +1 -1
- package/build/cjs/blocks/Scroller/Scroller.css +90 -0
- package/build/cjs/blocks/Scroller/Scroller.js +142 -9
- package/build/cjs/blocks/Scroller/schema.d.ts +33 -4
- package/build/cjs/blocks/Scroller/schema.js +19 -3
- package/build/cjs/blocks/WhatsNew/WhatsNew.js +2 -2
- package/build/cjs/blocks/WhatsNew/schema.d.ts +12 -0
- package/build/cjs/blocks/WhatsNew/schema.js +2 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +6 -2
- package/build/esm/blocks/LogoRotator/Item.d.ts +1 -1
- package/build/esm/blocks/LogoRotator/Item.js +8 -2
- package/build/esm/blocks/LogoRotator/LogoRotator.js +11 -2
- package/build/esm/blocks/LogoRotator/schema.js +1 -1
- package/build/esm/blocks/Scroller/Scroller.css +90 -0
- package/build/esm/blocks/Scroller/Scroller.js +143 -10
- package/build/esm/blocks/Scroller/schema.d.ts +33 -4
- package/build/esm/blocks/Scroller/schema.js +18 -2
- package/build/esm/blocks/WhatsNew/WhatsNew.js +2 -2
- package/build/esm/blocks/WhatsNew/schema.d.ts +12 -0
- package/build/esm/blocks/WhatsNew/schema.js +2 -1
- package/build/esm/models/constructor-items/blocks.d.ts +6 -2
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/constructor-items/blocks.d.ts +6 -2
- package/widget/index.js +1 -1
|
@@ -10,8 +10,14 @@ const utils_1 = require("../../utils");
|
|
|
10
10
|
const b = (0, utils_1.block)('logo-rotator-block');
|
|
11
11
|
const defaultColSizes = { all: 3 };
|
|
12
12
|
const Item = ({ url, src, hidden, colSizes }) => {
|
|
13
|
-
const renderItem = react_1.default.useMemo(() =>
|
|
14
|
-
|
|
13
|
+
const renderItem = react_1.default.useMemo(() => {
|
|
14
|
+
if (url) {
|
|
15
|
+
return (react_1.default.createElement(uikit_1.Link, { href: url, className: b('item', { hidden }) },
|
|
16
|
+
react_1.default.createElement(components_1.Image, { src: src, className: b('image'), alt: "", "aria-hidden": "true" })));
|
|
17
|
+
}
|
|
18
|
+
return (react_1.default.createElement("div", { className: b('item', { hidden }) },
|
|
19
|
+
react_1.default.createElement(components_1.Image, { src: src, className: b('image'), alt: "", "aria-hidden": "true" })));
|
|
20
|
+
}, [hidden, src, url]);
|
|
15
21
|
return react_1.default.createElement(grid_1.Col, { sizes: colSizes || defaultColSizes }, renderItem);
|
|
16
22
|
};
|
|
17
23
|
exports.Item = Item;
|
|
@@ -91,8 +91,17 @@ const LogoRotatorBlock = (props) => {
|
|
|
91
91
|
return (react_1.default.createElement(AnimateBlock_1.default, { className: b({ theme }), animate: animated },
|
|
92
92
|
react_1.default.createElement("div", { className: b('root') },
|
|
93
93
|
hasTitle && (react_1.default.createElement(components_1.Title, { title: titleProps, className: b('title'), colSizes: { all: 12 } })),
|
|
94
|
-
rowMode ? (react_1.default.createElement("div", { className: b('row-items') }, slots.map((slot, index) =>
|
|
95
|
-
|
|
94
|
+
rowMode ? (react_1.default.createElement("div", { className: b('row-items') }, slots.map((slot, index) => {
|
|
95
|
+
const item = items[slot];
|
|
96
|
+
if (!item)
|
|
97
|
+
return null;
|
|
98
|
+
if (item.url) {
|
|
99
|
+
return (react_1.default.createElement(uikit_1.Link, { key: index, href: item.url, className: b('row-item', { hidden: hidden[index] }) },
|
|
100
|
+
react_1.default.createElement(components_1.ImageBase, { src: item.src, className: b('image'), alt: "", "aria-hidden": "true" })));
|
|
101
|
+
}
|
|
102
|
+
return (react_1.default.createElement("div", { key: index, className: b('row-item', { hidden: hidden[index] }) },
|
|
103
|
+
react_1.default.createElement(components_1.ImageBase, { src: item.src, className: b('image'), alt: "", "aria-hidden": "true" })));
|
|
104
|
+
}))) : (react_1.default.createElement(grid_1.Grid, { className: b('items') },
|
|
96
105
|
react_1.default.createElement(grid_1.Row, { className: b('row') }, renderItems))))));
|
|
97
106
|
};
|
|
98
107
|
exports.LogoRotatorBlock = LogoRotatorBlock;
|
|
@@ -31,9 +31,99 @@ unpredictable css rules order in build */
|
|
|
31
31
|
.pc-scroller-block__content_gapLong {
|
|
32
32
|
gap: 48px;
|
|
33
33
|
}
|
|
34
|
+
@media (min-width: 769px) {
|
|
35
|
+
.pc-scroller-block__content {
|
|
36
|
+
--scroller-edge-margin: calc(100% / 2.5);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
.pc-scroller-block__content .pc-scroller-block__item:first-child {
|
|
40
|
+
margin-left: 48px;
|
|
41
|
+
}
|
|
42
|
+
@media (min-width: 769px) {
|
|
43
|
+
.pc-scroller-block__content .pc-scroller-block__item:first-child {
|
|
44
|
+
margin-left: var(--scroller-edge-margin);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
.pc-scroller-block__content .pc-scroller-block__item:last-child {
|
|
48
|
+
margin-right: 48px;
|
|
49
|
+
}
|
|
50
|
+
@media (min-width: 769px) {
|
|
51
|
+
.pc-scroller-block__content .pc-scroller-block__item:last-child {
|
|
52
|
+
margin-right: var(--scroller-edge-margin);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
.pc-scroller-block__content_scroll-snap-center {
|
|
56
|
+
scroll-snap-type: x mandatory;
|
|
57
|
+
}
|
|
58
|
+
.pc-scroller-block__content_scroll-snap-center .pc-scroller-block__item {
|
|
59
|
+
scroll-snap-align: center;
|
|
60
|
+
}
|
|
34
61
|
.pc-scroller-block__item {
|
|
35
62
|
position: relative;
|
|
36
63
|
z-index: 1;
|
|
37
64
|
flex: none;
|
|
38
65
|
max-width: 100%;
|
|
66
|
+
}
|
|
67
|
+
.pc-scroller-block__pagination-container {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
gap: 12px;
|
|
72
|
+
margin-top: 32px;
|
|
73
|
+
}
|
|
74
|
+
.pc-scroller-block__pagination {
|
|
75
|
+
display: flex;
|
|
76
|
+
gap: 8px;
|
|
77
|
+
align-items: center;
|
|
78
|
+
width: fit-content;
|
|
79
|
+
padding: 12px;
|
|
80
|
+
border-radius: 9999px;
|
|
81
|
+
background: #f3f4f5;
|
|
82
|
+
height: 30px;
|
|
83
|
+
}
|
|
84
|
+
.pc-scroller-block__pagination-button {
|
|
85
|
+
display: inline-block;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0;
|
|
88
|
+
font: inherit;
|
|
89
|
+
border: none;
|
|
90
|
+
outline: none;
|
|
91
|
+
color: inherit;
|
|
92
|
+
background: none;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
border-radius: 9999px;
|
|
98
|
+
background: #f3f4f5;
|
|
99
|
+
width: 30px;
|
|
100
|
+
height: 30px;
|
|
101
|
+
}
|
|
102
|
+
.pc-scroller-block__pip {
|
|
103
|
+
flex: none;
|
|
104
|
+
width: 6px;
|
|
105
|
+
height: 6px;
|
|
106
|
+
border-radius: 50%;
|
|
107
|
+
background: rgba(0, 26, 43, 0.3);
|
|
108
|
+
transition: width 0.3s ease, border-radius 0.3s ease;
|
|
109
|
+
}
|
|
110
|
+
.pc-scroller-block__pip_active {
|
|
111
|
+
width: 48px;
|
|
112
|
+
border-radius: 9999px;
|
|
113
|
+
}
|
|
114
|
+
.pc-scroller-block__pip-inner {
|
|
115
|
+
height: 100%;
|
|
116
|
+
min-width: 6px;
|
|
117
|
+
width: 0%;
|
|
118
|
+
border-radius: 9999px;
|
|
119
|
+
background-color: transparent;
|
|
120
|
+
transition: opacity 0.5s ease;
|
|
121
|
+
}
|
|
122
|
+
.pc-scroller-block__pip-inner_active {
|
|
123
|
+
width: 100%;
|
|
124
|
+
background-color: rgb(0, 26, 43);
|
|
125
|
+
}
|
|
126
|
+
.pc-scroller-block__pip-inner_paused {
|
|
127
|
+
width: 0;
|
|
128
|
+
opacity: 0;
|
|
39
129
|
}
|
|
@@ -6,29 +6,162 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const components_1 = require("../../components");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('scroller-block');
|
|
9
|
+
const getChild = (parent, index) => {
|
|
10
|
+
const child = parent.children[index];
|
|
11
|
+
return child instanceof HTMLElement ? child : null;
|
|
12
|
+
};
|
|
13
|
+
const getCenteredChildIndex = (content) => {
|
|
14
|
+
const midLine = content.getBoundingClientRect().left + content.clientWidth / 2;
|
|
15
|
+
for (let i = 0; i < content.children.length; i++) {
|
|
16
|
+
const rect = content.children[i].getBoundingClientRect();
|
|
17
|
+
if (rect.left <= midLine && rect.right >= midLine) {
|
|
18
|
+
return i;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
};
|
|
23
|
+
const scrollToChild = (content, child, behavior = 'smooth') => {
|
|
24
|
+
const left = child.offsetLeft - (content.offsetWidth - child.offsetWidth) / 2;
|
|
25
|
+
content.scrollTo({ left, behavior });
|
|
26
|
+
};
|
|
27
|
+
const PlayIcon = () => {
|
|
28
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", fill: "none" },
|
|
29
|
+
react_1.default.createElement("path", { d: "M13.765 9.83831L20.3154 13.7086C21.2977 14.289 21.298 15.7102 20.3159 16.2911L13.7714 20.1618C12.7719 20.7529 11.5086 20.033 11.5078 18.8718L11.502 11.1309C11.5011 9.96894 12.7646 9.24725 13.765 9.83831Z", fill: "currentColor" })));
|
|
30
|
+
};
|
|
31
|
+
const PauseIcon = () => {
|
|
32
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", fill: "none" },
|
|
33
|
+
react_1.default.createElement("path", { d: "M12.5 10C13.3284 10 14 10.6716 14 11.5V18.5C14 19.3284 13.3284 20 12.5 20C11.6716 20 11 19.3284 11 18.5V11.5C11 10.6716 11.6716 10 12.5 10ZM17.5 10C18.3284 10 19 10.6716 19 11.5V18.5C19 19.3284 18.3284 20 17.5 20C16.6716 20 16 19.3284 16 18.5V11.5C16 10.6716 16.6716 10 17.5 10Z", fill: "currentColor" })));
|
|
34
|
+
};
|
|
9
35
|
const ScrollerBlock = (props) => {
|
|
10
|
-
const { animated, widths, gapLong, fullWidth, children } = props;
|
|
36
|
+
const { animated, widths, gapLong, fullWidth, scrollSnapCenter, children, autoScroll = true, autoScrollInterval = 3000, infinite = false, } = props;
|
|
37
|
+
const childCount = react_1.default.Children.count(children);
|
|
11
38
|
const rootRef = (0, react_1.useRef)(null);
|
|
12
39
|
const contentRef = (0, react_1.useRef)(null);
|
|
40
|
+
const [currentElement, setCurrentElement] = (0, react_1.useState)(0);
|
|
41
|
+
const [isPaused, setIsPaused] = (0, react_1.useState)(true);
|
|
13
42
|
(0, react_1.useEffect)(() => {
|
|
43
|
+
const content = contentRef.current;
|
|
44
|
+
const root = rootRef.current;
|
|
14
45
|
const updateSize = () => {
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
if (!content || !root) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (fullWidth) {
|
|
50
|
+
const space = (window.innerWidth - root.clientWidth) / 2;
|
|
51
|
+
content.style.setProperty('padding-left', `${space}px`);
|
|
52
|
+
content.style.setProperty('padding-right', `${space}px`);
|
|
53
|
+
content.style.setProperty('left', `${-space}px`);
|
|
54
|
+
content.style.setProperty('width', `calc(100% + ${2 * space}px)`);
|
|
21
55
|
}
|
|
22
56
|
};
|
|
57
|
+
const determineCurrentElement = () => {
|
|
58
|
+
if (!content || childCount <= 1) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setCurrentElement(getCenteredChildIndex(content) % childCount);
|
|
62
|
+
};
|
|
23
63
|
updateSize();
|
|
64
|
+
determineCurrentElement();
|
|
24
65
|
window.addEventListener('resize', updateSize, { passive: true });
|
|
66
|
+
content === null || content === void 0 ? void 0 : content.addEventListener('scroll', determineCurrentElement, { passive: true });
|
|
25
67
|
return () => {
|
|
26
68
|
window.removeEventListener('resize', updateSize);
|
|
69
|
+
content === null || content === void 0 ? void 0 : content.removeEventListener('scroll', determineCurrentElement);
|
|
70
|
+
};
|
|
71
|
+
}, [fullWidth, childCount, children]);
|
|
72
|
+
(0, react_1.useEffect)(() => {
|
|
73
|
+
const content = contentRef.current;
|
|
74
|
+
if (!content || !infinite || childCount <= 1) {
|
|
75
|
+
return () => { };
|
|
76
|
+
}
|
|
77
|
+
const middleCenterIndex = Math.floor(childCount * 1.5);
|
|
78
|
+
const copyStartIndex = childCount;
|
|
79
|
+
const endCopyStartIndex = childCount * 2;
|
|
80
|
+
const scrollToMiddle = () => {
|
|
81
|
+
const middleChild = getChild(content, middleCenterIndex);
|
|
82
|
+
if (middleChild) {
|
|
83
|
+
content.scrollTo(middleChild.offsetLeft + content.offsetWidth / 2 - middleChild.offsetWidth / 2, 0);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const handleInfiniteScroll = () => {
|
|
87
|
+
const scrollLeft = content.scrollLeft;
|
|
88
|
+
const endCopyChild = getChild(content, endCopyStartIndex);
|
|
89
|
+
const copyStartChild = getChild(content, copyStartIndex);
|
|
90
|
+
if (endCopyChild && scrollLeft > endCopyChild.offsetLeft) {
|
|
91
|
+
const delta = endCopyChild.offsetLeft - scrollLeft;
|
|
92
|
+
const resetChild = getChild(content, copyStartIndex);
|
|
93
|
+
if (resetChild) {
|
|
94
|
+
content.scrollTo(resetChild.offsetLeft + delta, 0);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (copyStartChild && scrollLeft < copyStartChild.offsetLeft - content.clientWidth) {
|
|
98
|
+
const endChild = getChild(content, endCopyStartIndex);
|
|
99
|
+
if (endChild) {
|
|
100
|
+
content.scrollTo(endChild.offsetLeft - content.clientWidth, 0);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
content.addEventListener('scroll', handleInfiniteScroll, { passive: true });
|
|
105
|
+
scrollToMiddle();
|
|
106
|
+
return () => {
|
|
107
|
+
content.removeEventListener('scroll', handleInfiniteScroll);
|
|
108
|
+
};
|
|
109
|
+
}, [infinite, childCount]);
|
|
110
|
+
(0, react_1.useEffect)(() => {
|
|
111
|
+
if (autoScroll) {
|
|
112
|
+
setIsPaused(false);
|
|
113
|
+
}
|
|
114
|
+
}, [autoScroll]);
|
|
115
|
+
const scrollToNext = (0, react_1.useCallback)(() => {
|
|
116
|
+
const content = contentRef.current;
|
|
117
|
+
if (!content || childCount <= 1) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (infinite) {
|
|
121
|
+
const centeredIndex = getCenteredChildIndex(content);
|
|
122
|
+
const nextElement = getChild(content, centeredIndex + 1);
|
|
123
|
+
if (nextElement) {
|
|
124
|
+
scrollToChild(content, nextElement);
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const nextIndex = (currentElement + 1) % childCount;
|
|
129
|
+
const nextElement = getChild(content, nextIndex);
|
|
130
|
+
if (nextElement) {
|
|
131
|
+
scrollToChild(content, nextElement);
|
|
132
|
+
}
|
|
133
|
+
}, [childCount, currentElement, infinite]);
|
|
134
|
+
(0, react_1.useEffect)(() => {
|
|
135
|
+
let timeout = null;
|
|
136
|
+
if (!isPaused) {
|
|
137
|
+
timeout = setTimeout(() => {
|
|
138
|
+
scrollToNext();
|
|
139
|
+
}, autoScrollInterval);
|
|
140
|
+
}
|
|
141
|
+
return () => {
|
|
142
|
+
if (timeout) {
|
|
143
|
+
clearTimeout(timeout);
|
|
144
|
+
}
|
|
27
145
|
};
|
|
28
|
-
}, [
|
|
146
|
+
}, [isPaused, currentElement, autoScrollInterval, scrollToNext]);
|
|
29
147
|
return (react_1.default.createElement(components_1.AnimateBlock, { className: b({ fullWidth }), animate: animated },
|
|
30
148
|
react_1.default.createElement("div", { className: b('root'), ref: rootRef },
|
|
31
|
-
react_1.default.createElement("div", { className: b('content', {
|
|
149
|
+
react_1.default.createElement("div", { className: b('content', {
|
|
150
|
+
gapLong,
|
|
151
|
+
fullWidth,
|
|
152
|
+
'scroll-snap-center': infinite ? false : scrollSnapCenter,
|
|
153
|
+
}), ref: contentRef }, (infinite ? [0, 1, 2] : [0])
|
|
154
|
+
.map((mi) => react_1.default.Children.map(children, (child, index) => (react_1.default.createElement("div", { key: mi * childCount + index, className: b('item'), style: { width: (widths === null || widths === void 0 ? void 0 : widths[index]) || 'auto' } }, child))))
|
|
155
|
+
.flat())),
|
|
156
|
+
autoScroll && childCount > 0 && (react_1.default.createElement("div", { className: b('pagination-container') },
|
|
157
|
+
react_1.default.createElement("div", { className: b('pagination') }, Array.from({ length: childCount }, (_, index) => (react_1.default.createElement("div", { key: index, className: b('pip', { active: index === currentElement }) },
|
|
158
|
+
react_1.default.createElement("div", { style: {
|
|
159
|
+
transition: `width ${autoScrollInterval}ms, opacity 0.5s ease`,
|
|
160
|
+
}, className: b('pip-inner', {
|
|
161
|
+
active: index === currentElement,
|
|
162
|
+
paused: isPaused,
|
|
163
|
+
}) }))))),
|
|
164
|
+
react_1.default.createElement("button", { className: b('pagination-button'), onClick: () => setIsPaused(!isPaused) }, isPaused ? react_1.default.createElement(PlayIcon, null) : react_1.default.createElement(PauseIcon, null))))));
|
|
32
165
|
};
|
|
33
166
|
exports.ScrollerBlock = ScrollerBlock;
|
|
34
167
|
exports.default = exports.ScrollerBlock;
|
|
@@ -1,8 +1,40 @@
|
|
|
1
|
+
export declare const ScrollerControlsProps: {
|
|
2
|
+
infinite: {
|
|
3
|
+
type: string;
|
|
4
|
+
};
|
|
5
|
+
scrollSnapCenter: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
autoScroll: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
autoScrollInterval: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
1
15
|
export declare const ScrollerBlock: {
|
|
2
16
|
'scroller-block': {
|
|
3
17
|
additionalProperties: boolean;
|
|
4
18
|
required: boolean;
|
|
5
19
|
properties: {
|
|
20
|
+
children: {
|
|
21
|
+
type: string;
|
|
22
|
+
items: {
|
|
23
|
+
$ref: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
infinite: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
scrollSnapCenter: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
autoScroll: {
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
autoScrollInterval: {
|
|
36
|
+
type: string;
|
|
37
|
+
};
|
|
6
38
|
widths: {
|
|
7
39
|
type: string;
|
|
8
40
|
items: {
|
|
@@ -12,11 +44,8 @@ export declare const ScrollerBlock: {
|
|
|
12
44
|
gapLong: {
|
|
13
45
|
type: string;
|
|
14
46
|
};
|
|
15
|
-
|
|
47
|
+
fullWidth: {
|
|
16
48
|
type: string;
|
|
17
|
-
items: {
|
|
18
|
-
$ref: string;
|
|
19
|
-
};
|
|
20
49
|
};
|
|
21
50
|
animated: {
|
|
22
51
|
type: string;
|
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ScrollerBlock = void 0;
|
|
3
|
+
exports.ScrollerBlock = exports.ScrollerControlsProps = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
exports.ScrollerControlsProps = {
|
|
6
|
+
infinite: {
|
|
7
|
+
type: 'boolean',
|
|
8
|
+
},
|
|
9
|
+
scrollSnapCenter: {
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
},
|
|
12
|
+
autoScroll: {
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
},
|
|
15
|
+
autoScrollInterval: {
|
|
16
|
+
type: 'number',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
5
19
|
exports.ScrollerBlock = {
|
|
6
20
|
'scroller-block': {
|
|
7
21
|
additionalProperties: false,
|
|
8
22
|
required: false,
|
|
9
|
-
properties: Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.AnimatableProps), { widths: {
|
|
23
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.AnimatableProps), { widths: {
|
|
10
24
|
type: 'array',
|
|
11
25
|
items: {
|
|
12
26
|
type: 'string',
|
|
13
27
|
},
|
|
14
28
|
}, gapLong: {
|
|
15
29
|
type: 'boolean',
|
|
16
|
-
},
|
|
30
|
+
}, fullWidth: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
} }), exports.ScrollerControlsProps), { children: common_1.ChildrenCardsProps }),
|
|
17
33
|
},
|
|
18
34
|
};
|
|
@@ -7,12 +7,12 @@ const NewsCard_1 = tslib_1.__importDefault(require("../../sub-blocks/NewsCard/Ne
|
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const Scroller_1 = tslib_1.__importDefault(require("../Scroller/Scroller"));
|
|
9
9
|
const b = (0, utils_1.block)('whats-new-block');
|
|
10
|
-
const WhatsNew = ({ title, items, footnote, links, animated }) => {
|
|
10
|
+
const WhatsNew = ({ title, items, footnote, links, animated, infinite, scrollSnapCenter, autoScroll, autoScrollInterval, }) => {
|
|
11
11
|
return (react_1.default.createElement(components_1.AnimateBlock, { className: b(), animate: animated },
|
|
12
12
|
react_1.default.createElement("div", { className: b('root') },
|
|
13
13
|
title && (react_1.default.createElement("div", { className: b('head') },
|
|
14
14
|
react_1.default.createElement("h2", { className: b('title') }, title))),
|
|
15
|
-
react_1.default.createElement(Scroller_1.default, { fullWidth: true }, items.map((item, index) => (react_1.default.createElement(NewsCard_1.default, Object.assign({ key: index }, item))))),
|
|
15
|
+
react_1.default.createElement(Scroller_1.default, { fullWidth: true, infinite: infinite, scrollSnapCenter: scrollSnapCenter, autoScroll: autoScroll !== null && autoScroll !== void 0 ? autoScroll : true, autoScrollInterval: autoScrollInterval }, items.map((item, index) => (react_1.default.createElement(NewsCard_1.default, Object.assign({ key: index }, item))))),
|
|
16
16
|
(footnote || (links === null || links === void 0 ? void 0 : links.length)) && (react_1.default.createElement("div", { className: b('footer') },
|
|
17
17
|
footnote && react_1.default.createElement("div", { className: b('footnote') }, footnote),
|
|
18
18
|
(links === null || links === void 0 ? void 0 : links.length) ? (react_1.default.createElement("div", { className: b('links') }, links.map((link, index) => (react_1.default.createElement("a", { key: index, href: link.url, className: b('link'), target: "_blank", rel: "noopener noreferrer" },
|
|
@@ -56,6 +56,18 @@ export declare const WhatsNewBlock: {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
infinite: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
scrollSnapCenter: {
|
|
63
|
+
type: string;
|
|
64
|
+
};
|
|
65
|
+
autoScroll: {
|
|
66
|
+
type: string;
|
|
67
|
+
};
|
|
68
|
+
autoScrollInterval: {
|
|
69
|
+
type: string;
|
|
70
|
+
};
|
|
59
71
|
title: {
|
|
60
72
|
oneOf: ({
|
|
61
73
|
type: string;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WhatsNewBlock = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const schema_1 = require("../Scroller/schema");
|
|
5
6
|
exports.WhatsNewBlock = {
|
|
6
7
|
'whats-new-block': {
|
|
7
8
|
additionalProperties: false,
|
|
8
9
|
required: ['items'],
|
|
9
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), common_1.BlockHeaderProps), { items: {
|
|
10
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), common_1.BlockHeaderProps), schema_1.ScrollerControlsProps), { items: {
|
|
10
11
|
type: 'array',
|
|
11
12
|
items: {
|
|
12
13
|
type: 'object',
|
|
@@ -298,7 +298,7 @@ export interface BannerBlockProps extends BannerCardProps, Animatable {
|
|
|
298
298
|
export interface LogoRotatorBlockProps extends Animatable {
|
|
299
299
|
title?: TitleItemBaseProps | string;
|
|
300
300
|
items: {
|
|
301
|
-
url
|
|
301
|
+
url?: string;
|
|
302
302
|
src: string;
|
|
303
303
|
isStatic?: boolean;
|
|
304
304
|
}[];
|
|
@@ -359,6 +359,10 @@ export interface ScrollerBlockProps extends Animatable {
|
|
|
359
359
|
widths?: string[];
|
|
360
360
|
gapLong?: boolean;
|
|
361
361
|
fullWidth?: boolean;
|
|
362
|
+
infinite?: boolean;
|
|
363
|
+
scrollSnapCenter?: boolean;
|
|
364
|
+
autoScroll?: boolean;
|
|
365
|
+
autoScrollInterval?: number;
|
|
362
366
|
}
|
|
363
367
|
export interface CompaniesBlockProps extends Animatable {
|
|
364
368
|
title: string;
|
|
@@ -638,7 +642,7 @@ export interface BenchmarkBlockProps extends Animatable {
|
|
|
638
642
|
postfix?: string;
|
|
639
643
|
}[];
|
|
640
644
|
}
|
|
641
|
-
export interface WhatsNewBlockProps extends Animatable {
|
|
645
|
+
export interface WhatsNewBlockProps extends Animatable, Pick<ScrollerBlockProps, 'infinite' | 'scrollSnapCenter' | 'autoScroll' | 'autoScrollInterval'> {
|
|
642
646
|
title?: string;
|
|
643
647
|
items: NewsCardProps[];
|
|
644
648
|
footnote?: string;
|
|
@@ -7,8 +7,14 @@ import './LogoRotator.css';
|
|
|
7
7
|
const b = block('logo-rotator-block');
|
|
8
8
|
const defaultColSizes = { all: 3 };
|
|
9
9
|
export const Item = ({ url, src, hidden, colSizes }) => {
|
|
10
|
-
const renderItem = React.useMemo(() =>
|
|
11
|
-
|
|
10
|
+
const renderItem = React.useMemo(() => {
|
|
11
|
+
if (url) {
|
|
12
|
+
return (React.createElement(Link, { href: url, className: b('item', { hidden }) },
|
|
13
|
+
React.createElement(Image, { src: src, className: b('image'), alt: "", "aria-hidden": "true" })));
|
|
14
|
+
}
|
|
15
|
+
return (React.createElement("div", { className: b('item', { hidden }) },
|
|
16
|
+
React.createElement(Image, { src: src, className: b('image'), alt: "", "aria-hidden": "true" })));
|
|
17
|
+
}, [hidden, src, url]);
|
|
12
18
|
return React.createElement(Col, { sizes: colSizes || defaultColSizes }, renderItem);
|
|
13
19
|
};
|
|
14
20
|
export default React.memo(Item);
|
|
@@ -88,8 +88,17 @@ export const LogoRotatorBlock = (props) => {
|
|
|
88
88
|
return (React.createElement(AnimateBlock, { className: b({ theme }), animate: animated },
|
|
89
89
|
React.createElement("div", { className: b('root') },
|
|
90
90
|
hasTitle && (React.createElement(Title, { title: titleProps, className: b('title'), colSizes: { all: 12 } })),
|
|
91
|
-
rowMode ? (React.createElement("div", { className: b('row-items') }, slots.map((slot, index) =>
|
|
92
|
-
|
|
91
|
+
rowMode ? (React.createElement("div", { className: b('row-items') }, slots.map((slot, index) => {
|
|
92
|
+
const item = items[slot];
|
|
93
|
+
if (!item)
|
|
94
|
+
return null;
|
|
95
|
+
if (item.url) {
|
|
96
|
+
return (React.createElement(Link, { key: index, href: item.url, className: b('row-item', { hidden: hidden[index] }) },
|
|
97
|
+
React.createElement(ImageBase, { src: item.src, className: b('image'), alt: "", "aria-hidden": "true" })));
|
|
98
|
+
}
|
|
99
|
+
return (React.createElement("div", { key: index, className: b('row-item', { hidden: hidden[index] }) },
|
|
100
|
+
React.createElement(ImageBase, { src: item.src, className: b('image'), alt: "", "aria-hidden": "true" })));
|
|
101
|
+
}))) : (React.createElement(Grid, { className: b('items') },
|
|
93
102
|
React.createElement(Row, { className: b('row') }, renderItems))))));
|
|
94
103
|
};
|
|
95
104
|
export default LogoRotatorBlock;
|
|
@@ -31,9 +31,99 @@ unpredictable css rules order in build */
|
|
|
31
31
|
.pc-scroller-block__content_gapLong {
|
|
32
32
|
gap: 48px;
|
|
33
33
|
}
|
|
34
|
+
@media (min-width: 769px) {
|
|
35
|
+
.pc-scroller-block__content {
|
|
36
|
+
--scroller-edge-margin: calc(100% / 2.5);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
.pc-scroller-block__content .pc-scroller-block__item:first-child {
|
|
40
|
+
margin-left: 48px;
|
|
41
|
+
}
|
|
42
|
+
@media (min-width: 769px) {
|
|
43
|
+
.pc-scroller-block__content .pc-scroller-block__item:first-child {
|
|
44
|
+
margin-left: var(--scroller-edge-margin);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
.pc-scroller-block__content .pc-scroller-block__item:last-child {
|
|
48
|
+
margin-right: 48px;
|
|
49
|
+
}
|
|
50
|
+
@media (min-width: 769px) {
|
|
51
|
+
.pc-scroller-block__content .pc-scroller-block__item:last-child {
|
|
52
|
+
margin-right: var(--scroller-edge-margin);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
.pc-scroller-block__content_scroll-snap-center {
|
|
56
|
+
scroll-snap-type: x mandatory;
|
|
57
|
+
}
|
|
58
|
+
.pc-scroller-block__content_scroll-snap-center .pc-scroller-block__item {
|
|
59
|
+
scroll-snap-align: center;
|
|
60
|
+
}
|
|
34
61
|
.pc-scroller-block__item {
|
|
35
62
|
position: relative;
|
|
36
63
|
z-index: 1;
|
|
37
64
|
flex: none;
|
|
38
65
|
max-width: 100%;
|
|
66
|
+
}
|
|
67
|
+
.pc-scroller-block__pagination-container {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
gap: 12px;
|
|
72
|
+
margin-top: 32px;
|
|
73
|
+
}
|
|
74
|
+
.pc-scroller-block__pagination {
|
|
75
|
+
display: flex;
|
|
76
|
+
gap: 8px;
|
|
77
|
+
align-items: center;
|
|
78
|
+
width: fit-content;
|
|
79
|
+
padding: 12px;
|
|
80
|
+
border-radius: 9999px;
|
|
81
|
+
background: #f3f4f5;
|
|
82
|
+
height: 30px;
|
|
83
|
+
}
|
|
84
|
+
.pc-scroller-block__pagination-button {
|
|
85
|
+
display: inline-block;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0;
|
|
88
|
+
font: inherit;
|
|
89
|
+
border: none;
|
|
90
|
+
outline: none;
|
|
91
|
+
color: inherit;
|
|
92
|
+
background: none;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
border-radius: 9999px;
|
|
98
|
+
background: #f3f4f5;
|
|
99
|
+
width: 30px;
|
|
100
|
+
height: 30px;
|
|
101
|
+
}
|
|
102
|
+
.pc-scroller-block__pip {
|
|
103
|
+
flex: none;
|
|
104
|
+
width: 6px;
|
|
105
|
+
height: 6px;
|
|
106
|
+
border-radius: 50%;
|
|
107
|
+
background: rgba(0, 26, 43, 0.3);
|
|
108
|
+
transition: width 0.3s ease, border-radius 0.3s ease;
|
|
109
|
+
}
|
|
110
|
+
.pc-scroller-block__pip_active {
|
|
111
|
+
width: 48px;
|
|
112
|
+
border-radius: 9999px;
|
|
113
|
+
}
|
|
114
|
+
.pc-scroller-block__pip-inner {
|
|
115
|
+
height: 100%;
|
|
116
|
+
min-width: 6px;
|
|
117
|
+
width: 0%;
|
|
118
|
+
border-radius: 9999px;
|
|
119
|
+
background-color: transparent;
|
|
120
|
+
transition: opacity 0.5s ease;
|
|
121
|
+
}
|
|
122
|
+
.pc-scroller-block__pip-inner_active {
|
|
123
|
+
width: 100%;
|
|
124
|
+
background-color: rgb(0, 26, 43);
|
|
125
|
+
}
|
|
126
|
+
.pc-scroller-block__pip-inner_paused {
|
|
127
|
+
width: 0;
|
|
128
|
+
opacity: 0;
|
|
39
129
|
}
|