@postnord/pn-marketweb-components 2.9.0 → 2.9.1
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/cjs/loader.cjs.js +1 -1
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-media-block.cjs.entry.js +7 -39
- package/cjs/pn-multi-row-connected-dropdown-row.cjs.entry.js +2 -0
- package/cjs/pn-play-on-scroll.cjs.entry.js +3 -2
- package/collection/components/animation/pn-play-on-scroll/pn-play-on-scroll.js +3 -2
- package/collection/components/animation/pn-play-on-scroll/pn-play-on-scroll.stories.js +6 -86
- package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown-row.js +2 -0
- package/collection/components/media/pn-media-block/media-block.stories.js +6 -15
- package/collection/components/media/pn-media-block/pn-media-block.css +20 -2
- package/collection/components/media/pn-media-block/pn-media-block.js +24 -57
- package/components/pn-media-block.js +8 -40
- package/components/pn-multi-row-connected-dropdown-row2.js +2 -0
- package/components/pn-play-on-scroll2.js +3 -2
- package/esm/loader.js +1 -1
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-media-block.entry.js +7 -39
- package/esm/pn-multi-row-connected-dropdown-row.entry.js +2 -0
- package/esm/pn-play-on-scroll.entry.js +3 -2
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-media-block.entry.js +1 -1
- package/esm-es5/pn-multi-row-connected-dropdown-row.entry.js +1 -1
- package/esm-es5/pn-play-on-scroll.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/p-0c50ded4.entry.js +1 -0
- package/pn-market-web-components/p-4bcf66cb.entry.js +1 -0
- package/pn-market-web-components/p-6f853c29.system.js +1 -1
- package/pn-market-web-components/p-aadb8ed1.system.entry.js +1 -0
- package/pn-market-web-components/p-bc27295a.system.entry.js +1 -0
- package/pn-market-web-components/p-dc136523.entry.js +1 -0
- package/pn-market-web-components/p-ec116d47.system.entry.js +1 -0
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/animation/pn-play-on-scroll/pn-play-on-scroll.d.ts +1 -0
- package/types/components/media/pn-media-block/pn-media-block.d.ts +1 -1
- package/types/components/widgets/pn-proxio-pricegroup/pn-proxio-pricegroup.d.ts +1 -1
- package/types/components.d.ts +2 -2
- package/pn-market-web-components/p-42e969c9.system.entry.js +0 -1
- package/pn-market-web-components/p-5033c1d0.system.entry.js +0 -1
- package/pn-market-web-components/p-8c41af0e.entry.js +0 -1
- package/pn-market-web-components/p-c1738e39.entry.js +0 -1
- package/pn-market-web-components/p-dcf7b3fc.system.entry.js +0 -1
- package/pn-market-web-components/p-e3b61a83.entry.js +0 -1
|
@@ -10,93 +10,13 @@ export default {
|
|
|
10
10
|
|
|
11
11
|
const PlayOnScrollTemplate = args => {
|
|
12
12
|
return `
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
<br>
|
|
17
|
-
<br>
|
|
18
|
-
<br>
|
|
19
|
-
<br>
|
|
20
|
-
<br>
|
|
21
|
-
<br>
|
|
22
|
-
<br>
|
|
23
|
-
<br>
|
|
24
|
-
<br>
|
|
25
|
-
<br>
|
|
26
|
-
<br>
|
|
27
|
-
<br>
|
|
28
|
-
<br>
|
|
29
|
-
<br>
|
|
30
|
-
<br>
|
|
31
|
-
<br>
|
|
32
|
-
<br>
|
|
33
|
-
<br>
|
|
34
|
-
<br>
|
|
35
|
-
<br>
|
|
36
|
-
<br>
|
|
37
|
-
<br>
|
|
38
|
-
<br>
|
|
39
|
-
<br>
|
|
40
|
-
<br>
|
|
41
|
-
<br>
|
|
42
|
-
<br>
|
|
43
|
-
<br>
|
|
44
|
-
<br>
|
|
45
|
-
<br>
|
|
46
|
-
<br>
|
|
47
|
-
<br>
|
|
48
|
-
<br>
|
|
49
|
-
<br>
|
|
50
|
-
<br>
|
|
51
|
-
<br>
|
|
52
|
-
<br>
|
|
53
|
-
<br>
|
|
54
|
-
<br>
|
|
55
|
-
<br>
|
|
56
|
-
<br>
|
|
57
|
-
<br>
|
|
58
|
-
<br>
|
|
59
|
-
<br>
|
|
60
|
-
<br>
|
|
61
|
-
<br>
|
|
62
|
-
<br>
|
|
63
|
-
<br>
|
|
64
|
-
<br>
|
|
65
|
-
<br>
|
|
66
|
-
<br>
|
|
67
|
-
<br>
|
|
68
|
-
<br>
|
|
69
|
-
<br>
|
|
70
|
-
<br>
|
|
71
|
-
<br>
|
|
72
|
-
<br>
|
|
73
|
-
<br>
|
|
74
|
-
<br>
|
|
75
|
-
<br>
|
|
76
|
-
<br>
|
|
77
|
-
<br>
|
|
78
|
-
<br>
|
|
79
|
-
<br>
|
|
80
|
-
<br>
|
|
81
|
-
<br>
|
|
82
|
-
<br>
|
|
83
|
-
<br>
|
|
84
|
-
<pn-play-on-scroll></pn-play-on-scroll>
|
|
85
|
-
<br>
|
|
86
|
-
<br>
|
|
87
|
-
<br>
|
|
88
|
-
<br>
|
|
89
|
-
<br>
|
|
90
|
-
<br>
|
|
91
|
-
<br>
|
|
92
|
-
<br>
|
|
93
|
-
<br>
|
|
94
|
-
<br>
|
|
95
|
-
<br>
|
|
96
|
-
<br>
|
|
97
|
-
<br>
|
|
13
|
+
<div style="height: 140rem;"></div>
|
|
14
|
+
<pn-play-on-scroll video-src="${args.videoSrc}"></pn-play-on-scroll>
|
|
15
|
+
<div style="height: 140rem;"></div>
|
|
98
16
|
`;
|
|
99
17
|
};
|
|
100
18
|
|
|
101
19
|
export const PlayOnScroll = PlayOnScrollTemplate.bind({});
|
|
102
|
-
PlayOnScroll.args = {
|
|
20
|
+
PlayOnScroll.args = {
|
|
21
|
+
videoSrc: "https://com-inte.postnord.com/contentassets/1d0fd381dbde41f69f64df946b3e1e34/postnord-jakaa-turussa-kaikki-paketit-lahibokseihin-paastottomasti-sahkolla.mp4"
|
|
22
|
+
};
|
|
@@ -162,8 +162,10 @@ export class PnMultiRowConnectedDropdownRow {
|
|
|
162
162
|
const emmitValues = debounce(this.emittRowValues.bind(this), 500);
|
|
163
163
|
this.pnInputField.addEventListener('keyup', this.handleInput.bind(this));
|
|
164
164
|
this.pnInputField.addEventListener('change', this.handleInput.bind(this));
|
|
165
|
+
this.pnInputField.addEventListener('input', this.handleInput.bind(this));
|
|
165
166
|
this.pnInputField.addEventListener('keyup', emmitValues);
|
|
166
167
|
this.pnInputField.addEventListener('change', emmitValues);
|
|
168
|
+
this.pnInputField.addEventListener('input', emmitValues);
|
|
167
169
|
if (this.allowMultipleDates) {
|
|
168
170
|
this.pnShowDateRangeFiledButton.addEventListener('click', this.showDateRangeRow.bind(this));
|
|
169
171
|
this.pnStartDate.addEventListener('dateselection', this.HandleRangeDatePickers.bind(this));
|
|
@@ -14,7 +14,6 @@ export default {
|
|
|
14
14
|
imageSrcSmallScreenFormat: { type: 'string' },
|
|
15
15
|
imageAltText: { type: 'string' },
|
|
16
16
|
videoSrc: { type: 'string' },
|
|
17
|
-
parallaxScroll: { type: 'boolean' },
|
|
18
17
|
showOverlayLayer: { type: 'boolean' },
|
|
19
18
|
customOverlayBackground: { type: 'string' },
|
|
20
19
|
animateOverlayBackground: { type: 'boolean' },
|
|
@@ -40,12 +39,12 @@ const Template = ({ ...args }) => {
|
|
|
40
39
|
image-src="${args.imageSrc}"
|
|
41
40
|
image-src-small-screen-format="${args.imageSrcSmallScreenFormat}"
|
|
42
41
|
image-alt-text="${args.imageAltText}"
|
|
43
|
-
parallax-scroll="${args.parallaxScroll}"
|
|
44
42
|
show-overlay-layer="${args.showOverlayLayer}"
|
|
45
43
|
custom-overlay-background="${args.customOverlayBackground}"
|
|
46
44
|
animate-overlay-background="${args.animateOverlayBackground}"
|
|
47
45
|
scroll-snap-block="${args.scrollSnapBlock}"
|
|
48
46
|
fixed-background="${args.fixedBackground}"
|
|
47
|
+
margin-bottom="${args.marginBottom}"
|
|
49
48
|
block-heading="${args.blockHeading}"
|
|
50
49
|
block-heading-level="${args.blockHeadingLevel}"
|
|
51
50
|
block-preamble="${args.blockPreamble}">
|
|
@@ -60,10 +59,10 @@ export const Default = Template.bind({});
|
|
|
60
59
|
Default.args = {
|
|
61
60
|
blockHeight : '100svh',
|
|
62
61
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
63
|
-
parallaxScroll : false,
|
|
64
62
|
showOverlayLayer : true,
|
|
65
63
|
scrollSnapBlock : false,
|
|
66
64
|
fixedBackground : false,
|
|
65
|
+
marginBottom : false,
|
|
67
66
|
blockHeadingLevel: 2,
|
|
68
67
|
blockHeading: "Maximize your e-commerce potential",
|
|
69
68
|
blockPreamble: "Enhance your customers shopping journey. We have simplified delivery solutions for a global marketplace.",
|
|
@@ -73,7 +72,6 @@ export const FixedBackground = Template.bind({});
|
|
|
73
72
|
FixedBackground.args = {
|
|
74
73
|
blockHeight : '100svh',
|
|
75
74
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
76
|
-
parallaxScroll : false,
|
|
77
75
|
showOverlayLayer : true,
|
|
78
76
|
scrollSnapBlock : false,
|
|
79
77
|
fixedBackground : true,
|
|
@@ -86,7 +84,6 @@ export const CompactHeightBlock = Template.bind({});
|
|
|
86
84
|
CompactHeightBlock.args = {
|
|
87
85
|
blockHeight : '65svh',
|
|
88
86
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
89
|
-
parallaxScroll : false,
|
|
90
87
|
showOverlayLayer : true,
|
|
91
88
|
scrollSnapBlock : false,
|
|
92
89
|
fixedBackground : true,
|
|
@@ -99,7 +96,6 @@ export const DynamicHeight = Template.bind({});
|
|
|
99
96
|
DynamicHeight.args = {
|
|
100
97
|
blockHeight : 'dynamic',
|
|
101
98
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
102
|
-
parallaxScroll : false,
|
|
103
99
|
showOverlayLayer : true,
|
|
104
100
|
scrollSnapBlock : false,
|
|
105
101
|
fixedBackground : false,
|
|
@@ -114,7 +110,6 @@ MultipleSrc.args = {
|
|
|
114
110
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
115
111
|
imageSrcSmallScreenFormat : 'https://picsum.photos/1200/1200',
|
|
116
112
|
imageAltText : 'This is an image',
|
|
117
|
-
parallaxScroll : true,
|
|
118
113
|
showOverlayLayer : true,
|
|
119
114
|
scrollSnapBlock : false,
|
|
120
115
|
fixedBackground : false,
|
|
@@ -127,7 +122,6 @@ export const ParallaxBackground = Template.bind({});
|
|
|
127
122
|
ParallaxBackground.args = {
|
|
128
123
|
blockHeight : '100svh',
|
|
129
124
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
130
|
-
parallaxScroll : true,
|
|
131
125
|
showOverlayLayer : true,
|
|
132
126
|
scrollSnapBlock : false,
|
|
133
127
|
fixedBackground : false,
|
|
@@ -140,7 +134,6 @@ export const ScrollSnap = Template.bind({});
|
|
|
140
134
|
ScrollSnap.args = {
|
|
141
135
|
blockHeight : '100svh',
|
|
142
136
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
143
|
-
parallaxScroll : true,
|
|
144
137
|
showOverlayLayer : true,
|
|
145
138
|
scrollSnapBlock : true,
|
|
146
139
|
fixedBackground : false,
|
|
@@ -153,7 +146,6 @@ export const CustomOverlayBackground = Template.bind({});
|
|
|
153
146
|
CustomOverlayBackground.args = {
|
|
154
147
|
blockHeight : '100svh',
|
|
155
148
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
156
|
-
parallaxScroll : false,
|
|
157
149
|
showOverlayLayer : true,
|
|
158
150
|
customOverlayBackground : "linear-gradient(180deg, #0d234b, transparent)",
|
|
159
151
|
scrollSnapBlock : true,
|
|
@@ -167,7 +159,6 @@ export const AnimateOverlayBackground = Template.bind({});
|
|
|
167
159
|
AnimateOverlayBackground.args = {
|
|
168
160
|
blockHeight : '100svh',
|
|
169
161
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
170
|
-
parallaxScroll : false,
|
|
171
162
|
showOverlayLayer : true,
|
|
172
163
|
customOverlayBackground : "linear-gradient(90deg, rgba(131,58,180,0.8253676470588236) 0%, rgba(253,29,29,0.1783088235294118) 50%, rgba(252,176,69,0.727328431372549) 100%)",
|
|
173
164
|
animateOverlayBackground : true,
|
|
@@ -186,7 +177,6 @@ const TemplateWithLink = ({ ...args }) => {
|
|
|
186
177
|
<pn-media-block
|
|
187
178
|
block-height="${args.blockHeight}"
|
|
188
179
|
image-src="${args.imageSrc}"
|
|
189
|
-
parallax-scroll="${args.parallaxScroll}"
|
|
190
180
|
show-overlay-layer="${args.showOverlayLayer}"
|
|
191
181
|
scroll-snap-block="${args.scrollSnapBlock}"
|
|
192
182
|
fixed-background="${args.fixedBackground}"
|
|
@@ -211,7 +201,6 @@ export const WithLink = TemplateWithLink.bind({});
|
|
|
211
201
|
WithLink.args = {
|
|
212
202
|
blockHeight : '100svh',
|
|
213
203
|
imageSrc : 'https://i.redd.it/connections-5160x2160-v0-o914e0x2jkfc1.png?s=5c46aceebe337175ad192d5edb0ed9f66fd3e130',
|
|
214
|
-
parallaxScroll : false,
|
|
215
204
|
fixedBackground : true,
|
|
216
205
|
showOverlayLayer : true,
|
|
217
206
|
blockHeading: "Maximize your e-commerce potential",
|
|
@@ -224,12 +213,13 @@ WithLink.args = {
|
|
|
224
213
|
|
|
225
214
|
const TemplateVideo = ({ ...args }) => {
|
|
226
215
|
return `
|
|
216
|
+
<br>
|
|
217
|
+
<div style="background-color: #f5f5f5; border: 5px solid black; height: 400px; display: flex; align-items: center; justify-content: center; margin-top: 240px; margin-bottom: 240px;"><h2>This is another block</h2></div>
|
|
227
218
|
<br>
|
|
228
219
|
<div style="background-color: #f5f5f5; border: 5px solid black; height: 400px; display: flex; align-items: center; justify-content: center; margin-top: 240px; margin-bottom: 240px;"><h2>This is another block</h2></div>
|
|
229
220
|
<br>
|
|
230
221
|
<pn-media-block block-height="${args.blockHeight}"
|
|
231
222
|
video-src="${args.videoSrc}"
|
|
232
|
-
parallax-scroll="${args.parallaxScroll}"
|
|
233
223
|
show-overlay-layer="${args.showOverlayLayer}"
|
|
234
224
|
scroll-snap-block="${args.scrollSnapBlock}"
|
|
235
225
|
fixed-background="${args.fixedBackground}"
|
|
@@ -240,6 +230,8 @@ const TemplateVideo = ({ ...args }) => {
|
|
|
240
230
|
<br>
|
|
241
231
|
<div style="background-color: #f5f5f5; border: 5px solid black; height: 400px; display: flex; align-items: center; justify-content: center; margin-top: 240px; margin-bottom: 240px;"><h2>This is another block</h2></div>
|
|
242
232
|
<br>
|
|
233
|
+
<div style="background-color: #f5f5f5; border: 5px solid black; height: 400px; display: flex; align-items: center; justify-content: center; margin-top: 240px; margin-bottom: 240px;"><h2>This is another block</h2></div>
|
|
234
|
+
<br>
|
|
243
235
|
`;
|
|
244
236
|
};
|
|
245
237
|
|
|
@@ -247,7 +239,6 @@ export const Video = TemplateVideo.bind({});
|
|
|
247
239
|
Video.args = {
|
|
248
240
|
blockHeight : '100svh',
|
|
249
241
|
videoSrc : 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4',
|
|
250
|
-
parallaxScroll : false,
|
|
251
242
|
fixedBackground : false,
|
|
252
243
|
showOverlayLayer : true,
|
|
253
244
|
blockHeading: "Maximize your e-commerce potential",
|
|
@@ -169,7 +169,7 @@ pn-media-block .media-block .media-block__content-container .media-block__cta-li
|
|
|
169
169
|
margin-top: 3rem;
|
|
170
170
|
}
|
|
171
171
|
pn-media-block .media-block--height-100svh {
|
|
172
|
-
height: 100vh;
|
|
172
|
+
min-height: 100vh;
|
|
173
173
|
}
|
|
174
174
|
@supports (height: 100svh) {
|
|
175
175
|
pn-media-block .media-block--height-100svh {
|
|
@@ -201,7 +201,7 @@ pn-media-block .media-block--height-100svh .media-block__block-container .media-
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
pn-media-block .media-block--height-65svh {
|
|
204
|
-
height: 65svh;
|
|
204
|
+
min-height: 65svh;
|
|
205
205
|
overflow: auto;
|
|
206
206
|
}
|
|
207
207
|
pn-media-block .media-block--height-65svh .media-block__block-container {
|
|
@@ -280,4 +280,22 @@ pn-media-block .media-block--animate-overlay-background .media-block__overlay-fi
|
|
|
280
280
|
100% {
|
|
281
281
|
background-position: 100% 100%;
|
|
282
282
|
}
|
|
283
|
+
}
|
|
284
|
+
pn-media-block .media-block--margin-bottom {
|
|
285
|
+
margin-bottom: 3.2rem;
|
|
286
|
+
}
|
|
287
|
+
@media screen and (min-width: 768px) {
|
|
288
|
+
pn-media-block .media-block--margin-bottom {
|
|
289
|
+
margin-bottom: 4rem;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
@media screen and (min-width: 992px) {
|
|
293
|
+
pn-media-block .media-block--margin-bottom {
|
|
294
|
+
margin-bottom: 5.6rem;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
@media screen and (min-width: 1200px) {
|
|
298
|
+
pn-media-block .media-block--margin-bottom {
|
|
299
|
+
margin-bottom: 7.2rem;
|
|
300
|
+
}
|
|
283
301
|
}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
function userPrefersReducedMotion() {
|
|
3
|
-
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
4
|
-
}
|
|
5
2
|
export class PnmediaBlock {
|
|
6
3
|
constructor() {
|
|
7
4
|
this.handleScroll = () => {
|
|
8
|
-
if (!this.parallaxScroll)
|
|
9
|
-
return;
|
|
10
5
|
const mediaBlockElement = this.block.firstElementChild;
|
|
11
6
|
const scrollTrigger = this.block.querySelector('#scroll-trigger');
|
|
12
7
|
const videoPauseButton = this.block.querySelector('#overlayed-button-pause-video');
|
|
13
8
|
const scrollTriggerTop = scrollTrigger.getBoundingClientRect().top;
|
|
14
9
|
const mediaBlockElementHeight = mediaBlockElement.offsetHeight;
|
|
15
10
|
const scrollPosition = mediaBlockElementHeight - scrollTriggerTop;
|
|
16
|
-
const parallaxSpeedContent = 0.3;
|
|
17
11
|
const parallaxSpeedMedia = 0.2;
|
|
18
12
|
const mediaContainer = this.block.querySelector('.media-block__media-container');
|
|
19
|
-
const content = this.block.querySelector('.media-block__content-container');
|
|
20
13
|
if (mediaContainer != null) {
|
|
21
14
|
// Move the image or video at a slower speed
|
|
22
15
|
mediaContainer.style.transform = `translate(0, ${scrollPosition * (0.1 + parallaxSpeedMedia)}px)`;
|
|
@@ -25,25 +18,18 @@ export class PnmediaBlock {
|
|
|
25
18
|
videoPauseButton.style.transform = `translate(0, ${-scrollPosition * (0.3 + parallaxSpeedMedia)}px)`;
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
|
-
if (content) {
|
|
29
|
-
// Move the content at a faster speed
|
|
30
|
-
content.style.transform = `translate(0, ${scrollPosition * (0.5 + parallaxSpeedContent)}px)`;
|
|
31
|
-
// Change the opacity based on the scroll position
|
|
32
|
-
const opacity = Math.max(0, 1 - scrollPosition / 600);
|
|
33
|
-
content.style.opacity = `${opacity}`;
|
|
34
|
-
}
|
|
35
21
|
};
|
|
36
22
|
this.blockHeight = null;
|
|
37
23
|
this.imageSrc = null;
|
|
38
24
|
this.imageSrcSmallScreenFormat = undefined;
|
|
39
25
|
this.imageAltText = "";
|
|
40
26
|
this.videoSrc = null;
|
|
41
|
-
this.parallaxScroll = false;
|
|
42
27
|
this.showOverlayLayer = false;
|
|
43
28
|
this.customOverlayBackground = null;
|
|
44
29
|
this.animateOverlayBackground = false;
|
|
45
30
|
this.scrollSnapBlock = false;
|
|
46
31
|
this.fixedBackground = false;
|
|
32
|
+
this.marginBottom = false;
|
|
47
33
|
this.blockHeading = null;
|
|
48
34
|
this.blockHeadingLevel = 2;
|
|
49
35
|
this.blockPreamble = null;
|
|
@@ -78,31 +64,12 @@ export class PnmediaBlock {
|
|
|
78
64
|
this.hasButtonSlot = !!this.block.querySelector('[slot="cta-button"]');
|
|
79
65
|
}
|
|
80
66
|
async componentDidLoad() {
|
|
81
|
-
if (userPrefersReducedMotion()) {
|
|
82
|
-
// Handle the case where the user prefers reduced motion.
|
|
83
|
-
// For example, you might disable parallax scrolling:
|
|
84
|
-
this.parallaxScroll = false;
|
|
85
|
-
}
|
|
86
67
|
const scrollTrigger = document.getElementById('scroll-trigger');
|
|
87
68
|
this.calculatedBlockHeight = this.block.offsetHeight;
|
|
88
69
|
const overlayElement = this.block.querySelector('#mediaBlockOverlay');
|
|
89
70
|
if (this.customOverlayBackground != null || this.customOverlayBackground != "undefined") {
|
|
90
71
|
overlayElement.style.background = `${this.customOverlayBackground}`;
|
|
91
72
|
}
|
|
92
|
-
if (this.parallaxScroll) {
|
|
93
|
-
this.observerScroll = new IntersectionObserver(entries => {
|
|
94
|
-
entries.forEach(entry => {
|
|
95
|
-
if (entry.isIntersecting) {
|
|
96
|
-
window.addEventListener('scroll', this.handleScroll);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
window.removeEventListener('scroll', this.handleScroll);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}, { rootMargin: `0px 0px` });
|
|
103
|
-
this.observerScroll.observe(scrollTrigger);
|
|
104
|
-
}
|
|
105
|
-
;
|
|
106
73
|
if (this.scrollSnapBlock) {
|
|
107
74
|
this.observerSnap = new IntersectionObserver(entries => {
|
|
108
75
|
entries.forEach(entry => {
|
|
@@ -138,7 +105,7 @@ export class PnmediaBlock {
|
|
|
138
105
|
window.removeEventListener('scroll', this.handleScroll);
|
|
139
106
|
}
|
|
140
107
|
render() {
|
|
141
|
-
const { showOverlayLayer, fixedBackground, blockHeight, scrollSnapBlock, blockHeadingLevelChecked, hasButtonSlot, hasVideo, hasImage, animateOverlayBackground } = this;
|
|
108
|
+
const { showOverlayLayer, fixedBackground, blockHeight, scrollSnapBlock, blockHeadingLevelChecked, hasButtonSlot, hasVideo, hasImage, animateOverlayBackground, marginBottom } = this;
|
|
142
109
|
const HeadingTag = `h${blockHeadingLevelChecked !== null && blockHeadingLevelChecked !== void 0 ? blockHeadingLevelChecked : 2}`;
|
|
143
110
|
const isVideo = hasVideo;
|
|
144
111
|
const isImage = hasImage;
|
|
@@ -149,12 +116,12 @@ export class PnmediaBlock {
|
|
|
149
116
|
animateOverlayBackground ? `media-block--animate-overlay-background` : '',
|
|
150
117
|
isVideo ? 'media-block--video' : '',
|
|
151
118
|
scrollSnapBlock ? 'scroll-snap' : 'no-scroll-snap',
|
|
152
|
-
fixedBackground ? 'media-block--fixed-background' : ''
|
|
119
|
+
fixedBackground ? 'media-block--fixed-background' : '',
|
|
120
|
+
marginBottom ? 'media-block--margin-bottom' : ''
|
|
153
121
|
].join(' ');
|
|
154
122
|
const pnPlayOnScrollObserverOptions = {
|
|
155
|
-
root: this.blockHeight === "100svh" ?
|
|
156
|
-
threshold: 1,
|
|
157
|
-
rootMargin: '220px 0px 220px 0px',
|
|
123
|
+
root: this.blockHeight === "100svh" ? this.block : null,
|
|
124
|
+
threshold: [0, 0.5, 1], // Callback will be executed when 0%, 50%, and 100% of the target is visible
|
|
158
125
|
};
|
|
159
126
|
return (h("div", { class: classes }, h("div", { class: "media-block__block-container" }, h("div", { class: "media-block__media-container" }, isVideo ? (h("pn-play-on-scroll", { "show-overlay": this.showOverlayLayer, observerOptions: pnPlayOnScrollObserverOptions, "video-src": this.videoSrc })) : isImage ? (h("picture", null, h("source", { media: "(min-width: 1400px)", srcSet: this.imageSrc }), h("source", { media: "(min-width: 1224px)", srcSet: this.imageSrc }), h("source", { media: "(min-width: 1140px)", srcSet: this.imageSrc }), h("source", { media: "(min-width: 1023px)", srcSet: this.imageSrcSmallScreenFormat && this.imageSrcSmallScreenFormat !== "undefined" ? this.imageSrcSmallScreenFormat : this.imageSrc }), h("source", { media: "(min-width: 768px)", srcSet: this.imageSrcSmallScreenFormat && this.imageSrcSmallScreenFormat !== "undefined" ? this.imageSrcSmallScreenFormat : this.imageSrc }), h("source", { media: "(min-width: 500px)", srcSet: this.imageSrcSmallScreenFormat && this.imageSrcSmallScreenFormat !== "undefined" ? this.imageSrcSmallScreenFormat : this.imageSrc }), h("img", { src: this.imageSrcSmallScreenFormat !== "undefined" ? this.imageSrcSmallScreenFormat : this.imageSrc, alt: this.imageAltText !== "undefined" ? this.imageAltText : "", role: this.imageAltText !== "undefined" ? "img" : "presentation", "aria-hidden": this.imageAltText !== "undefined" ? "false" : "true" }))) : null), !isVideo && (h("div", { class: "media-block__overlay-filter", id: "mediaBlockOverlay" })), (this.blockHeading || this.blockPreamble) && (h("div", { class: "media-block__content-container" }, this.blockHeading && h(HeadingTag, { class: "media-block__block-heading" }, this.blockHeading), this.blockPreamble && h("p", { class: "media-block__preamble" }, this.blockPreamble), hasButtonSlot &&
|
|
160
127
|
h("div", { class: "media-block__cta-link" }, h("slot", { name: "cta-button" }))))), h("div", { id: "scroll-trigger" })));
|
|
@@ -262,24 +229,6 @@ export class PnmediaBlock {
|
|
|
262
229
|
"reflect": false,
|
|
263
230
|
"defaultValue": "null"
|
|
264
231
|
},
|
|
265
|
-
"parallaxScroll": {
|
|
266
|
-
"type": "boolean",
|
|
267
|
-
"mutable": false,
|
|
268
|
-
"complexType": {
|
|
269
|
-
"original": "boolean",
|
|
270
|
-
"resolved": "boolean",
|
|
271
|
-
"references": {}
|
|
272
|
-
},
|
|
273
|
-
"required": false,
|
|
274
|
-
"optional": false,
|
|
275
|
-
"docs": {
|
|
276
|
-
"tags": [],
|
|
277
|
-
"text": ""
|
|
278
|
-
},
|
|
279
|
-
"attribute": "parallax-scroll",
|
|
280
|
-
"reflect": false,
|
|
281
|
-
"defaultValue": "false"
|
|
282
|
-
},
|
|
283
232
|
"showOverlayLayer": {
|
|
284
233
|
"type": "boolean",
|
|
285
234
|
"mutable": false,
|
|
@@ -370,6 +319,24 @@ export class PnmediaBlock {
|
|
|
370
319
|
"reflect": false,
|
|
371
320
|
"defaultValue": "false"
|
|
372
321
|
},
|
|
322
|
+
"marginBottom": {
|
|
323
|
+
"type": "boolean",
|
|
324
|
+
"mutable": false,
|
|
325
|
+
"complexType": {
|
|
326
|
+
"original": "boolean",
|
|
327
|
+
"resolved": "boolean",
|
|
328
|
+
"references": {}
|
|
329
|
+
},
|
|
330
|
+
"required": false,
|
|
331
|
+
"optional": false,
|
|
332
|
+
"docs": {
|
|
333
|
+
"tags": [],
|
|
334
|
+
"text": ""
|
|
335
|
+
},
|
|
336
|
+
"attribute": "margin-bottom",
|
|
337
|
+
"reflect": false,
|
|
338
|
+
"defaultValue": "false"
|
|
339
|
+
},
|
|
373
340
|
"blockHeading": {
|
|
374
341
|
"type": "string",
|
|
375
342
|
"mutable": false,
|
|
@@ -3,28 +3,21 @@ import { d as defineCustomElement$4 } from './pn-play-on-scroll2.js';
|
|
|
3
3
|
import { d as defineCustomElement$3 } from './pn-scroll2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './pn-video-overlay2.js';
|
|
5
5
|
|
|
6
|
-
const pnMediaBlockCss = "pn-media-block .media-block .media-block__block-container{display:grid;overflow:hidden}pn-media-block .media-block .media-block__media-container,pn-media-block .media-block .media-block__content-container,pn-media-block .media-block .media-block__overlay-filter{grid-area:1/1;width:100%;position:relative}pn-media-block .media-block .media-block__media-container{height:100vh;overflow:hidden;position:relative}pn-media-block .media-block .media-block__media-container img,pn-media-block .media-block .media-block__media-container video{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);-o-object-fit:cover;object-fit:cover;pointer-events:none;max-width:100%;max-height:none;height:100%;width:100%;pointer-events:none}pn-media-block .media-block .media-block__media-container pn-play-on-scroll{width:100%;height:100%}pn-media-block .media-block .media-block__media-container .scroll-wrapper{width:100%;height:100%}pn-media-block .media-block .media-block__media-container [slot=scroll-affected]{width:100%;height:100%;display:-ms-flexbox;display:flex}pn-media-block .media-block .media-block__media-container .scroll-wrapper,pn-media-block .media-block .media-block__media-container .scroll-affected{width:100%;height:100%;display:-ms-flexbox;display:flex}pn-media-block .media-block .media-block__media-container video{width:100%;height:100%}pn-media-block .media-block .media-block__overlay-filter{z-index:2}pn-media-block .media-block .media-block__content-container{z-index:3;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity 1s;transition:opacity 1s;-ms-flex-direction:column;flex-direction:column;margin:0 auto;padding:3.4rem 0;width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width: 576px){pn-media-block .media-block .media-block__content-container{max-width:540px}}@media (min-width: 768px){pn-media-block .media-block .media-block__content-container{max-width:720px}}@media (min-width: 992px){pn-media-block .media-block .media-block__content-container{max-width:960px}}@media (min-width: 1200px){pn-media-block .media-block .media-block__content-container{max-width:1140px}}@media (min-width: 1640px){pn-media-block .media-block .media-block__content-container{max-width:1440px}}@media screen and (min-width: 992px){pn-media-block .media-block .media-block__content-container{padding:6.4rem 0}}@media screen and (min-width: 1200px){pn-media-block .media-block .media-block__content-container{padding:7.2rem 0}}@media screen and (min-width: 1640px){pn-media-block .media-block .media-block__content-container{padding:8rem 0}}pn-media-block .media-block .media-block__content-container .media-block__block-heading{max-width:100rem;text-wrap:balance;color:white;font-size:3.2rem;text-align:center;font-weight:700;line-height:1.1;margin-bottom:3rem}@media screen and (min-width: 576px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:4rem}}@media screen and (min-width: 768px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:4.8rem}}@media screen and (min-width: 992px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:5.6rem}}@media screen and (min-width: 1200px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:8rem}}@media screen and (min-width: 1640px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:8.8rem}}pn-media-block .media-block .media-block__content-container .media-block__preamble{max-width:80rem;max-width:80ch;text-wrap:balance;display:-ms-flexbox;display:flex;color:white;font-size:1.8rem;text-align:center;font-weight:300}@media screen and (min-width: 576px){pn-media-block .media-block .media-block__content-container .media-block__preamble{font-size:2rem}}@media screen and (min-width: 1200px){pn-media-block .media-block .media-block__content-container .media-block__preamble{font-size:2.4rem}}@media screen and (min-width: 1640px){pn-media-block .media-block .media-block__content-container .media-block__preamble{font-weight:500}}pn-media-block .media-block .media-block__content-container .media-block__cta-link{margin-top:3rem}pn-media-block .media-block--height-100svh{height:100vh}@supports (height: 100svh){pn-media-block .media-block--height-100svh{height:100svh}}pn-media-block .media-block--height-100svh .media-block__block-container{height:100vh}@supports (max-height: 100svh){pn-media-block .media-block--height-100svh .media-block__block-container{max-height:100svh}}pn-media-block .media-block--height-100svh .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-100svh .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-100svh .media-block__block-container .media-block__overlay-filter{height:100vh}@supports (max-height: 100svh){pn-media-block .media-block--height-100svh .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-100svh .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-100svh .media-block__block-container .media-block__overlay-filter{max-height:100svh}}pn-media-block .media-block--height-100svh .media-block__block-container .media-block__media-container picture{height:100vh}@supports (max-height: 100svh){pn-media-block .media-block--height-100svh .media-block__block-container .media-block__media-container picture{max-height:100svh}}pn-media-block .media-block--height-65svh{height:65svh;overflow:auto}pn-media-block .media-block--height-65svh .media-block__block-container{height:65vh}@supports (max-height: 100svh){pn-media-block .media-block--height-65svh .media-block__block-container{max-height:65svh}}pn-media-block .media-block--height-65svh .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-65svh .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-65svh .media-block__block-container .media-block__overlay-filter{height:65vh}@supports (max-height: 100svh){pn-media-block .media-block--height-65svh .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-65svh .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-65svh .media-block__block-container .media-block__overlay-filter{max-height:65svh}}pn-media-block .media-block--height-65svh .media-block__media-container img{max-height:none !important;height:auto !important}pn-media-block .media-block--height-dynamic{height:auto;overflow:auto}pn-media-block .media-block--height-dynamic .media-block__block-container{height:auto;max-height:none}pn-media-block .media-block--height-dynamic .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-dynamic .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-dynamic .media-block__block-container .media-block__overlay-filter{height:auto;max-height:none}pn-media-block .media-block--with-overlay .media-block__block-container .media-block__overlay-filter{z-index:2;background:radial-gradient(circle, rgba(13, 35, 75, 0.68) 7%, rgba(13, 35, 75, 0) 80%)}pn-media-block .media-block--fixed-background .media-block__block-container .media-block__media-container,pn-media-block .media-block--fixed-background .media-block__block-container .media-block__overlay-filter{position:relative;overflow:hidden;top:0;width:100%;display:-ms-flexbox !important;display:flex !important;-webkit-clip-path:inset(0);clip-path:inset(0)}pn-media-block .media-block--fixed-background .media-block__block-container .media-block__media-container picture{position:absolute;top:0;width:100%;display:-ms-flexbox !important;display:flex !important;-webkit-clip-path:inset(0);clip-path:inset(0);height:100%}pn-media-block .media-block--fixed-background .media-block__block-container .media-block__media-container picture img{position:fixed;width:100%;height:100%;-o-object-fit:cover;object-fit:cover;z-index:1}pn-media-block .media-block--video .media-block__content-container{max-width:80%}pn-media-block .media-block--animate-overlay-background .media-block__overlay-filter{background-size:200% 200% !important;-webkit-animation:overlayBackgroundAnimation 20s ease infinite;animation:overlayBackgroundAnimation 20s ease infinite}@-webkit-keyframes overlayBackgroundAnimation{0%{background-position:100% 100%}50%{background-position:50% 60%}100%{background-position:100% 100%}}@keyframes overlayBackgroundAnimation{0%{background-position:100% 100%}50%{background-position:50% 60%}100%{background-position:100% 100%}}";
|
|
6
|
+
const pnMediaBlockCss = "pn-media-block .media-block .media-block__block-container{display:grid;overflow:hidden}pn-media-block .media-block .media-block__media-container,pn-media-block .media-block .media-block__content-container,pn-media-block .media-block .media-block__overlay-filter{grid-area:1/1;width:100%;position:relative}pn-media-block .media-block .media-block__media-container{height:100vh;overflow:hidden;position:relative}pn-media-block .media-block .media-block__media-container img,pn-media-block .media-block .media-block__media-container video{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);-o-object-fit:cover;object-fit:cover;pointer-events:none;max-width:100%;max-height:none;height:100%;width:100%;pointer-events:none}pn-media-block .media-block .media-block__media-container pn-play-on-scroll{width:100%;height:100%}pn-media-block .media-block .media-block__media-container .scroll-wrapper{width:100%;height:100%}pn-media-block .media-block .media-block__media-container [slot=scroll-affected]{width:100%;height:100%;display:-ms-flexbox;display:flex}pn-media-block .media-block .media-block__media-container .scroll-wrapper,pn-media-block .media-block .media-block__media-container .scroll-affected{width:100%;height:100%;display:-ms-flexbox;display:flex}pn-media-block .media-block .media-block__media-container video{width:100%;height:100%}pn-media-block .media-block .media-block__overlay-filter{z-index:2}pn-media-block .media-block .media-block__content-container{z-index:3;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity 1s;transition:opacity 1s;-ms-flex-direction:column;flex-direction:column;margin:0 auto;padding:3.4rem 0;width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width: 576px){pn-media-block .media-block .media-block__content-container{max-width:540px}}@media (min-width: 768px){pn-media-block .media-block .media-block__content-container{max-width:720px}}@media (min-width: 992px){pn-media-block .media-block .media-block__content-container{max-width:960px}}@media (min-width: 1200px){pn-media-block .media-block .media-block__content-container{max-width:1140px}}@media (min-width: 1640px){pn-media-block .media-block .media-block__content-container{max-width:1440px}}@media screen and (min-width: 992px){pn-media-block .media-block .media-block__content-container{padding:6.4rem 0}}@media screen and (min-width: 1200px){pn-media-block .media-block .media-block__content-container{padding:7.2rem 0}}@media screen and (min-width: 1640px){pn-media-block .media-block .media-block__content-container{padding:8rem 0}}pn-media-block .media-block .media-block__content-container .media-block__block-heading{max-width:100rem;text-wrap:balance;color:white;font-size:3.2rem;text-align:center;font-weight:700;line-height:1.1;margin-bottom:3rem}@media screen and (min-width: 576px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:4rem}}@media screen and (min-width: 768px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:4.8rem}}@media screen and (min-width: 992px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:5.6rem}}@media screen and (min-width: 1200px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:8rem}}@media screen and (min-width: 1640px){pn-media-block .media-block .media-block__content-container .media-block__block-heading{font-size:8.8rem}}pn-media-block .media-block .media-block__content-container .media-block__preamble{max-width:80rem;max-width:80ch;text-wrap:balance;display:-ms-flexbox;display:flex;color:white;font-size:1.8rem;text-align:center;font-weight:300}@media screen and (min-width: 576px){pn-media-block .media-block .media-block__content-container .media-block__preamble{font-size:2rem}}@media screen and (min-width: 1200px){pn-media-block .media-block .media-block__content-container .media-block__preamble{font-size:2.4rem}}@media screen and (min-width: 1640px){pn-media-block .media-block .media-block__content-container .media-block__preamble{font-weight:500}}pn-media-block .media-block .media-block__content-container .media-block__cta-link{margin-top:3rem}pn-media-block .media-block--height-100svh{min-height:100vh}@supports (height: 100svh){pn-media-block .media-block--height-100svh{height:100svh}}pn-media-block .media-block--height-100svh .media-block__block-container{height:100vh}@supports (max-height: 100svh){pn-media-block .media-block--height-100svh .media-block__block-container{max-height:100svh}}pn-media-block .media-block--height-100svh .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-100svh .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-100svh .media-block__block-container .media-block__overlay-filter{height:100vh}@supports (max-height: 100svh){pn-media-block .media-block--height-100svh .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-100svh .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-100svh .media-block__block-container .media-block__overlay-filter{max-height:100svh}}pn-media-block .media-block--height-100svh .media-block__block-container .media-block__media-container picture{height:100vh}@supports (max-height: 100svh){pn-media-block .media-block--height-100svh .media-block__block-container .media-block__media-container picture{max-height:100svh}}pn-media-block .media-block--height-65svh{min-height:65svh;overflow:auto}pn-media-block .media-block--height-65svh .media-block__block-container{height:65vh}@supports (max-height: 100svh){pn-media-block .media-block--height-65svh .media-block__block-container{max-height:65svh}}pn-media-block .media-block--height-65svh .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-65svh .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-65svh .media-block__block-container .media-block__overlay-filter{height:65vh}@supports (max-height: 100svh){pn-media-block .media-block--height-65svh .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-65svh .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-65svh .media-block__block-container .media-block__overlay-filter{max-height:65svh}}pn-media-block .media-block--height-65svh .media-block__media-container img{max-height:none !important;height:auto !important}pn-media-block .media-block--height-dynamic{height:auto;overflow:auto}pn-media-block .media-block--height-dynamic .media-block__block-container{height:auto;max-height:none}pn-media-block .media-block--height-dynamic .media-block__block-container .media-block__media-container,pn-media-block .media-block--height-dynamic .media-block__block-container .media-block__content-container,pn-media-block .media-block--height-dynamic .media-block__block-container .media-block__overlay-filter{height:auto;max-height:none}pn-media-block .media-block--with-overlay .media-block__block-container .media-block__overlay-filter{z-index:2;background:radial-gradient(circle, rgba(13, 35, 75, 0.68) 7%, rgba(13, 35, 75, 0) 80%)}pn-media-block .media-block--fixed-background .media-block__block-container .media-block__media-container,pn-media-block .media-block--fixed-background .media-block__block-container .media-block__overlay-filter{position:relative;overflow:hidden;top:0;width:100%;display:-ms-flexbox !important;display:flex !important;-webkit-clip-path:inset(0);clip-path:inset(0)}pn-media-block .media-block--fixed-background .media-block__block-container .media-block__media-container picture{position:absolute;top:0;width:100%;display:-ms-flexbox !important;display:flex !important;-webkit-clip-path:inset(0);clip-path:inset(0);height:100%}pn-media-block .media-block--fixed-background .media-block__block-container .media-block__media-container picture img{position:fixed;width:100%;height:100%;-o-object-fit:cover;object-fit:cover;z-index:1}pn-media-block .media-block--video .media-block__content-container{max-width:80%}pn-media-block .media-block--animate-overlay-background .media-block__overlay-filter{background-size:200% 200% !important;-webkit-animation:overlayBackgroundAnimation 20s ease infinite;animation:overlayBackgroundAnimation 20s ease infinite}@-webkit-keyframes overlayBackgroundAnimation{0%{background-position:100% 100%}50%{background-position:50% 60%}100%{background-position:100% 100%}}@keyframes overlayBackgroundAnimation{0%{background-position:100% 100%}50%{background-position:50% 60%}100%{background-position:100% 100%}}pn-media-block .media-block--margin-bottom{margin-bottom:3.2rem}@media screen and (min-width: 768px){pn-media-block .media-block--margin-bottom{margin-bottom:4rem}}@media screen and (min-width: 992px){pn-media-block .media-block--margin-bottom{margin-bottom:5.6rem}}@media screen and (min-width: 1200px){pn-media-block .media-block--margin-bottom{margin-bottom:7.2rem}}";
|
|
7
7
|
|
|
8
|
-
function userPrefersReducedMotion() {
|
|
9
|
-
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
10
|
-
}
|
|
11
8
|
const PnmediaBlock = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
9
|
constructor() {
|
|
13
10
|
super();
|
|
14
11
|
this.__registerHost();
|
|
15
12
|
this.handleScroll = () => {
|
|
16
|
-
if (!this.parallaxScroll)
|
|
17
|
-
return;
|
|
18
13
|
const mediaBlockElement = this.block.firstElementChild;
|
|
19
14
|
const scrollTrigger = this.block.querySelector('#scroll-trigger');
|
|
20
15
|
const videoPauseButton = this.block.querySelector('#overlayed-button-pause-video');
|
|
21
16
|
const scrollTriggerTop = scrollTrigger.getBoundingClientRect().top;
|
|
22
17
|
const mediaBlockElementHeight = mediaBlockElement.offsetHeight;
|
|
23
18
|
const scrollPosition = mediaBlockElementHeight - scrollTriggerTop;
|
|
24
|
-
const parallaxSpeedContent = 0.3;
|
|
25
19
|
const parallaxSpeedMedia = 0.2;
|
|
26
20
|
const mediaContainer = this.block.querySelector('.media-block__media-container');
|
|
27
|
-
const content = this.block.querySelector('.media-block__content-container');
|
|
28
21
|
if (mediaContainer != null) {
|
|
29
22
|
// Move the image or video at a slower speed
|
|
30
23
|
mediaContainer.style.transform = `translate(0, ${scrollPosition * (0.1 + parallaxSpeedMedia)}px)`;
|
|
@@ -33,25 +26,18 @@ const PnmediaBlock = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
33
26
|
videoPauseButton.style.transform = `translate(0, ${-scrollPosition * (0.3 + parallaxSpeedMedia)}px)`;
|
|
34
27
|
}
|
|
35
28
|
}
|
|
36
|
-
if (content) {
|
|
37
|
-
// Move the content at a faster speed
|
|
38
|
-
content.style.transform = `translate(0, ${scrollPosition * (0.5 + parallaxSpeedContent)}px)`;
|
|
39
|
-
// Change the opacity based on the scroll position
|
|
40
|
-
const opacity = Math.max(0, 1 - scrollPosition / 600);
|
|
41
|
-
content.style.opacity = `${opacity}`;
|
|
42
|
-
}
|
|
43
29
|
};
|
|
44
30
|
this.blockHeight = null;
|
|
45
31
|
this.imageSrc = null;
|
|
46
32
|
this.imageSrcSmallScreenFormat = undefined;
|
|
47
33
|
this.imageAltText = "";
|
|
48
34
|
this.videoSrc = null;
|
|
49
|
-
this.parallaxScroll = false;
|
|
50
35
|
this.showOverlayLayer = false;
|
|
51
36
|
this.customOverlayBackground = null;
|
|
52
37
|
this.animateOverlayBackground = false;
|
|
53
38
|
this.scrollSnapBlock = false;
|
|
54
39
|
this.fixedBackground = false;
|
|
40
|
+
this.marginBottom = false;
|
|
55
41
|
this.blockHeading = null;
|
|
56
42
|
this.blockHeadingLevel = 2;
|
|
57
43
|
this.blockPreamble = null;
|
|
@@ -86,30 +72,12 @@ const PnmediaBlock = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
86
72
|
this.hasButtonSlot = !!this.block.querySelector('[slot="cta-button"]');
|
|
87
73
|
}
|
|
88
74
|
async componentDidLoad() {
|
|
89
|
-
if (userPrefersReducedMotion()) {
|
|
90
|
-
// Handle the case where the user prefers reduced motion.
|
|
91
|
-
// For example, you might disable parallax scrolling:
|
|
92
|
-
this.parallaxScroll = false;
|
|
93
|
-
}
|
|
94
75
|
const scrollTrigger = document.getElementById('scroll-trigger');
|
|
95
76
|
this.calculatedBlockHeight = this.block.offsetHeight;
|
|
96
77
|
const overlayElement = this.block.querySelector('#mediaBlockOverlay');
|
|
97
78
|
if (this.customOverlayBackground != null || this.customOverlayBackground != "undefined") {
|
|
98
79
|
overlayElement.style.background = `${this.customOverlayBackground}`;
|
|
99
80
|
}
|
|
100
|
-
if (this.parallaxScroll) {
|
|
101
|
-
this.observerScroll = new IntersectionObserver(entries => {
|
|
102
|
-
entries.forEach(entry => {
|
|
103
|
-
if (entry.isIntersecting) {
|
|
104
|
-
window.addEventListener('scroll', this.handleScroll);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
window.removeEventListener('scroll', this.handleScroll);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}, { rootMargin: `0px 0px` });
|
|
111
|
-
this.observerScroll.observe(scrollTrigger);
|
|
112
|
-
}
|
|
113
81
|
if (this.scrollSnapBlock) {
|
|
114
82
|
this.observerSnap = new IntersectionObserver(entries => {
|
|
115
83
|
entries.forEach(entry => {
|
|
@@ -144,7 +112,7 @@ const PnmediaBlock = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
144
112
|
window.removeEventListener('scroll', this.handleScroll);
|
|
145
113
|
}
|
|
146
114
|
render() {
|
|
147
|
-
const { showOverlayLayer, fixedBackground, blockHeight, scrollSnapBlock, blockHeadingLevelChecked, hasButtonSlot, hasVideo, hasImage, animateOverlayBackground } = this;
|
|
115
|
+
const { showOverlayLayer, fixedBackground, blockHeight, scrollSnapBlock, blockHeadingLevelChecked, hasButtonSlot, hasVideo, hasImage, animateOverlayBackground, marginBottom } = this;
|
|
148
116
|
const HeadingTag = `h${blockHeadingLevelChecked !== null && blockHeadingLevelChecked !== void 0 ? blockHeadingLevelChecked : 2}`;
|
|
149
117
|
const isVideo = hasVideo;
|
|
150
118
|
const isImage = hasImage;
|
|
@@ -155,12 +123,12 @@ const PnmediaBlock = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
155
123
|
animateOverlayBackground ? `media-block--animate-overlay-background` : '',
|
|
156
124
|
isVideo ? 'media-block--video' : '',
|
|
157
125
|
scrollSnapBlock ? 'scroll-snap' : 'no-scroll-snap',
|
|
158
|
-
fixedBackground ? 'media-block--fixed-background' : ''
|
|
126
|
+
fixedBackground ? 'media-block--fixed-background' : '',
|
|
127
|
+
marginBottom ? 'media-block--margin-bottom' : ''
|
|
159
128
|
].join(' ');
|
|
160
129
|
const pnPlayOnScrollObserverOptions = {
|
|
161
|
-
root: this.blockHeight === "100svh" ?
|
|
162
|
-
threshold: 1,
|
|
163
|
-
rootMargin: '220px 0px 220px 0px',
|
|
130
|
+
root: this.blockHeight === "100svh" ? this.block : null,
|
|
131
|
+
threshold: [0, 0.5, 1], // Callback will be executed when 0%, 50%, and 100% of the target is visible
|
|
164
132
|
};
|
|
165
133
|
return (h("div", { class: classes }, h("div", { class: "media-block__block-container" }, h("div", { class: "media-block__media-container" }, isVideo ? (h("pn-play-on-scroll", { "show-overlay": this.showOverlayLayer, observerOptions: pnPlayOnScrollObserverOptions, "video-src": this.videoSrc })) : isImage ? (h("picture", null, h("source", { media: "(min-width: 1400px)", srcSet: this.imageSrc }), h("source", { media: "(min-width: 1224px)", srcSet: this.imageSrc }), h("source", { media: "(min-width: 1140px)", srcSet: this.imageSrc }), h("source", { media: "(min-width: 1023px)", srcSet: this.imageSrcSmallScreenFormat && this.imageSrcSmallScreenFormat !== "undefined" ? this.imageSrcSmallScreenFormat : this.imageSrc }), h("source", { media: "(min-width: 768px)", srcSet: this.imageSrcSmallScreenFormat && this.imageSrcSmallScreenFormat !== "undefined" ? this.imageSrcSmallScreenFormat : this.imageSrc }), h("source", { media: "(min-width: 500px)", srcSet: this.imageSrcSmallScreenFormat && this.imageSrcSmallScreenFormat !== "undefined" ? this.imageSrcSmallScreenFormat : this.imageSrc }), h("img", { src: this.imageSrcSmallScreenFormat !== "undefined" ? this.imageSrcSmallScreenFormat : this.imageSrc, alt: this.imageAltText !== "undefined" ? this.imageAltText : "", role: this.imageAltText !== "undefined" ? "img" : "presentation", "aria-hidden": this.imageAltText !== "undefined" ? "false" : "true" }))) : null), !isVideo && (h("div", { class: "media-block__overlay-filter", id: "mediaBlockOverlay" })), (this.blockHeading || this.blockPreamble) && (h("div", { class: "media-block__content-container" }, this.blockHeading && h(HeadingTag, { class: "media-block__block-heading" }, this.blockHeading), this.blockPreamble && h("p", { class: "media-block__preamble" }, this.blockPreamble), hasButtonSlot &&
|
|
166
134
|
h("div", { class: "media-block__cta-link" }, h("slot", { name: "cta-button" }))))), h("div", { id: "scroll-trigger" })));
|
|
@@ -173,12 +141,12 @@ const PnmediaBlock = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
173
141
|
"imageSrcSmallScreenFormat": [1, "image-src-small-screen-format"],
|
|
174
142
|
"imageAltText": [1, "image-alt-text"],
|
|
175
143
|
"videoSrc": [1, "video-src"],
|
|
176
|
-
"parallaxScroll": [4, "parallax-scroll"],
|
|
177
144
|
"showOverlayLayer": [4, "show-overlay-layer"],
|
|
178
145
|
"customOverlayBackground": [1, "custom-overlay-background"],
|
|
179
146
|
"animateOverlayBackground": [4, "animate-overlay-background"],
|
|
180
147
|
"scrollSnapBlock": [4, "scroll-snap-block"],
|
|
181
148
|
"fixedBackground": [4, "fixed-background"],
|
|
149
|
+
"marginBottom": [4, "margin-bottom"],
|
|
182
150
|
"blockHeading": [1, "block-heading"],
|
|
183
151
|
"blockHeadingLevel": [2, "block-heading-level"],
|
|
184
152
|
"blockPreamble": [1, "block-preamble"],
|
|
@@ -171,8 +171,10 @@ const PnMultiRowConnectedDropdownRow = /*@__PURE__*/ proxyCustomElement(class ex
|
|
|
171
171
|
const emmitValues = debounce_1.debounce(this.emittRowValues.bind(this), 500);
|
|
172
172
|
this.pnInputField.addEventListener('keyup', this.handleInput.bind(this));
|
|
173
173
|
this.pnInputField.addEventListener('change', this.handleInput.bind(this));
|
|
174
|
+
this.pnInputField.addEventListener('input', this.handleInput.bind(this));
|
|
174
175
|
this.pnInputField.addEventListener('keyup', emmitValues);
|
|
175
176
|
this.pnInputField.addEventListener('change', emmitValues);
|
|
177
|
+
this.pnInputField.addEventListener('input', emmitValues);
|
|
176
178
|
if (this.allowMultipleDates) {
|
|
177
179
|
this.pnShowDateRangeFiledButton.addEventListener('click', this.showDateRangeRow.bind(this));
|
|
178
180
|
this.pnStartDate.addEventListener('dateselection', this.HandleRangeDatePickers.bind(this));
|
|
@@ -10,7 +10,7 @@ const pnPlayOnScrollCss = "pn-play-on-scroll pn-scroll [slot=scroll-affected]{po
|
|
|
10
10
|
*/
|
|
11
11
|
const defaultObserverOptions = {
|
|
12
12
|
root: null,
|
|
13
|
-
threshold:
|
|
13
|
+
threshold: 1,
|
|
14
14
|
rootMargin: '0px 0px 0px 0px',
|
|
15
15
|
};
|
|
16
16
|
const onIntersecting = (video, isManualPaused, togglePaused) => {
|
|
@@ -61,9 +61,10 @@ const PnPlayOnScroll = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
61
61
|
componentDidLoad() {
|
|
62
62
|
this.video = document.getElementById(this.videoId);
|
|
63
63
|
this.video.addEventListener('click', this.handlePlayPauseClicked);
|
|
64
|
+
this.localObserverOptions = this.observerOptions;
|
|
64
65
|
}
|
|
65
66
|
render() {
|
|
66
|
-
return (h(Host, null, h("pn-scroll", { intersectFunc: () => onIntersecting(this.video, this.isManuallyPaused, this.togglePaused), notIntersectFunc: () => onNotIntersecting(this.video, this.togglePaused), shouldLoop: true, behaviourClasses: 'some-behaviour-class', observerOptions: this.
|
|
67
|
+
return (h(Host, null, h("pn-scroll", { intersectFunc: () => onIntersecting(this.video, this.isManuallyPaused, this.togglePaused), notIntersectFunc: () => onNotIntersecting(this.video, this.togglePaused), shouldLoop: true, behaviourClasses: 'some-behaviour-class', observerOptions: this.localObserverOptions }, h("div", { slot: "scroll-affected" }, h("video", { playsinline: true, muted: true, autoPlay: true, id: `${this.videoId}` }, h("source", { src: this.videoSrc, type: "video/mp4" })), h("pn-video-overlay", { showOverlay: this.showOverlay, isPaused: this.isManuallyPaused || this.isPaused, onPlayPauseClicked: this.handlePlayPauseClicked })))));
|
|
67
68
|
}
|
|
68
69
|
get hostElement() { return this; }
|
|
69
70
|
static get style() { return pnPlayOnScrollCss; }
|