@sankhyatronics/sankhya-cms 0.1.0 → 0.1.2
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/custom-elements.json +1843 -952
- package/dist/carousel/index.d.ts +38 -2
- package/dist/carousel/index.js +1 -1
- package/dist/chunk-47RPYNFG.js +527 -0
- package/dist/chunk-47RPYNFG.js.map +1 -0
- package/dist/chunk-5DNVCMOO.js +509 -0
- package/dist/chunk-5DNVCMOO.js.map +1 -0
- package/dist/{chunk-RMIJVTFS.js → chunk-FWIG6GEZ.js} +8 -4
- package/dist/chunk-FWIG6GEZ.js.map +1 -0
- package/dist/{chunk-U7YKCCJG.js → chunk-K4ZICRZL.js} +134 -14
- package/dist/chunk-K4ZICRZL.js.map +1 -0
- package/dist/chunk-N63TVWK3.js +203 -0
- package/dist/chunk-N63TVWK3.js.map +1 -0
- package/dist/{chunk-23IHTBAB.js → chunk-PKTRYUGP.js} +108 -2
- package/dist/chunk-PKTRYUGP.js.map +1 -0
- package/dist/{chunk-LHU23TF6.js → chunk-TH5NZXA7.js} +5 -4
- package/dist/chunk-TH5NZXA7.js.map +1 -0
- package/dist/dropdown/index.js +1 -1
- package/dist/header/index.d.ts +18 -0
- package/dist/header/index.js +1 -1
- package/dist/hero/index.d.ts +29 -4
- package/dist/hero/index.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +23 -19
- package/dist/menu-item/index.js +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/section/index.d.ts +33 -0
- package/dist/section/index.js +10 -0
- package/dist/section/index.js.map +1 -0
- package/dist/testimonials/index.d.ts +62 -6
- package/dist/testimonials/index.js +2 -1
- package/package.json +10 -3
- package/dist/chunk-23IHTBAB.js.map +0 -1
- package/dist/chunk-LHU23TF6.js.map +0 -1
- package/dist/chunk-RMIJVTFS.js.map +0 -1
- package/dist/chunk-U7YKCCJG.js.map +0 -1
- package/dist/chunk-WCO7JAIK.js +0 -195
- package/dist/chunk-WCO7JAIK.js.map +0 -1
- package/dist/chunk-XHBC23TV.js +0 -254
- package/dist/chunk-XHBC23TV.js.map +0 -1
|
@@ -25,29 +25,41 @@ var Hero = class extends LitElement {
|
|
|
25
25
|
this.padding = "none";
|
|
26
26
|
this.inverted = false;
|
|
27
27
|
this.focalPoint = "center";
|
|
28
|
-
this.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (action.defaultPrevented) event.preventDefault();
|
|
37
|
-
};
|
|
28
|
+
this.eyebrow = "";
|
|
29
|
+
this.secondaryActionLabel = "";
|
|
30
|
+
this.secondaryHref = "";
|
|
31
|
+
this.size = "auto";
|
|
32
|
+
this.contentPosition = "center";
|
|
33
|
+
this.overlay = "even";
|
|
34
|
+
this.onClick = (event) => this.emitAction(event, this.href, "primary");
|
|
35
|
+
this.onSecondaryClick = (event) => this.emitAction(event, this.secondaryHref, "secondary");
|
|
38
36
|
}
|
|
39
37
|
willUpdate() {
|
|
40
38
|
this.style.backgroundImage = this.imageSrc ? `url(${JSON.stringify(this.imageSrc)})` : "";
|
|
41
39
|
this.style.setProperty("--st-hero-position", Hero.positions[this.focalPoint] ?? Hero.positions.center);
|
|
42
40
|
}
|
|
41
|
+
emitAction(event, href, kind) {
|
|
42
|
+
const action = new CustomEvent("action", {
|
|
43
|
+
detail: { href, kind },
|
|
44
|
+
bubbles: true,
|
|
45
|
+
composed: true,
|
|
46
|
+
cancelable: true
|
|
47
|
+
});
|
|
48
|
+
this.dispatchEvent(action);
|
|
49
|
+
if (action.defaultPrevented) event.preventDefault();
|
|
50
|
+
}
|
|
43
51
|
render() {
|
|
44
52
|
return html`
|
|
45
53
|
<div class="overlay" part="overlay"></div>
|
|
46
54
|
<div class="content" part="content">
|
|
55
|
+
${this.eyebrow ? html`<p class="eyebrow" part="eyebrow">${this.eyebrow}</p>` : nothing}
|
|
47
56
|
<h1 class="title" part="title">${this.title}</h1>
|
|
48
57
|
${this.subtitle ? html`<p class="subtitle" part="subtitle">${this.subtitle}</p>` : nothing}
|
|
49
|
-
${this.actionLabel ? html`<div class="actions" part="actions">
|
|
50
|
-
|
|
58
|
+
${this.actionLabel || this.secondaryActionLabel ? html`<div class="actions" part="actions">
|
|
59
|
+
${this.actionLabel ? html`<a class="cta" part="action" href=${this.href || nothing} @click=${this.onClick}>${this.actionLabel}</a>` : nothing}
|
|
60
|
+
${this.secondaryActionLabel ? html`<a class="cta secondary" part="secondary-action" href=${this.secondaryHref || nothing} @click=${this.onSecondaryClick}
|
|
61
|
+
>${this.secondaryActionLabel}</a
|
|
62
|
+
>` : nothing}
|
|
51
63
|
</div>` : nothing}
|
|
52
64
|
<slot></slot>
|
|
53
65
|
</div>
|
|
@@ -172,15 +184,105 @@ Hero.styles = css`
|
|
|
172
184
|
transform: scale(0.98);
|
|
173
185
|
}
|
|
174
186
|
|
|
187
|
+
.eyebrow {
|
|
188
|
+
margin: 0;
|
|
189
|
+
font-size: var(--st-text-sm);
|
|
190
|
+
font-weight: var(--st-font-weight-bold);
|
|
191
|
+
letter-spacing: 0.12em;
|
|
192
|
+
text-transform: uppercase;
|
|
193
|
+
color: inherit;
|
|
194
|
+
opacity: 0.85;
|
|
195
|
+
animation: st-hero-fade 0.8s 0.2s ease-out backwards;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.actions {
|
|
199
|
+
flex-wrap: wrap;
|
|
200
|
+
gap: var(--st-space-12);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.cta.secondary {
|
|
204
|
+
background: transparent;
|
|
205
|
+
color: inherit;
|
|
206
|
+
box-shadow: inset 0 0 0 1.5px currentColor;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.cta.secondary:hover {
|
|
210
|
+
background: color-mix(in oklch, currentColor 12%, transparent);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* size="large" / "full": a tall editorial hero. */
|
|
214
|
+
:host([size='large']) {
|
|
215
|
+
min-height: var(--st-hero-min-height, 640px);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
:host([size='full']) {
|
|
219
|
+
min-height: 100svh;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
:host([size='large']) .title,
|
|
223
|
+
:host([size='full']) .title {
|
|
224
|
+
font-size: clamp(2.5rem, 6vw, 5rem);
|
|
225
|
+
letter-spacing: -0.02em;
|
|
226
|
+
line-height: 1.05;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* content-position="bottom": copy sits in the lower part of the hero, on the container grid. */
|
|
230
|
+
:host([content-position='bottom']) {
|
|
231
|
+
align-items: flex-end;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
:host([content-position='bottom']) .content {
|
|
235
|
+
width: 100%;
|
|
236
|
+
max-width: var(--st-cms-container-max);
|
|
237
|
+
box-sizing: border-box;
|
|
238
|
+
padding: var(--st-space-48) var(--st-space-24);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
:host([content-position='bottom']) .title,
|
|
242
|
+
:host([content-position='bottom']) .subtitle {
|
|
243
|
+
max-width: 18ch;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
:host([content-position='bottom']) .subtitle {
|
|
247
|
+
max-width: 48ch;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:host([content-position='bottom']:not([text-alignment='center']):not([text-alignment='right'])) .actions {
|
|
251
|
+
justify-content: flex-start;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:host([content-position='bottom'][text-alignment='center']) .title,
|
|
255
|
+
:host([content-position='bottom'][text-alignment='center']) .subtitle {
|
|
256
|
+
margin-inline: auto;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* overlay="gradient": darkest behind the copy, clearing towards the far side of the image. */
|
|
260
|
+
:host([overlay='gradient']) .overlay {
|
|
261
|
+
background:
|
|
262
|
+
linear-gradient(to top, color-mix(in oklch, var(--st-color-text-strong) 85%, transparent), transparent 70%),
|
|
263
|
+
linear-gradient(to right, color-mix(in oklch, var(--st-color-text-strong) 70%, transparent), transparent 75%);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
:host([overlay='gradient'][text-alignment='right']) .overlay {
|
|
267
|
+
background:
|
|
268
|
+
linear-gradient(to top, color-mix(in oklch, var(--st-color-text-strong) 85%, transparent), transparent 70%),
|
|
269
|
+
linear-gradient(to left, color-mix(in oklch, var(--st-color-text-strong) 70%, transparent), transparent 75%);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
:host([overlay='none']) .overlay {
|
|
273
|
+
display: none;
|
|
274
|
+
}
|
|
275
|
+
|
|
175
276
|
@media (min-width: 768px) {
|
|
176
277
|
.content { padding: var(--st-space-32); }
|
|
177
278
|
}
|
|
178
279
|
@media (min-width: 1024px) {
|
|
179
280
|
.content { padding: var(--st-space-48); }
|
|
281
|
+
:host([content-position='bottom']) .content { padding: var(--st-space-48) var(--st-space-32) 6rem; }
|
|
180
282
|
}
|
|
181
283
|
|
|
182
284
|
@media (prefers-reduced-motion: reduce) {
|
|
183
|
-
:host, .title, .subtitle, .cta { animation: none; }
|
|
285
|
+
:host, .eyebrow, .title, .subtitle, .cta { animation: none; }
|
|
184
286
|
.cta { transition: none; }
|
|
185
287
|
}
|
|
186
288
|
`;
|
|
@@ -218,6 +320,24 @@ __decorateClass([
|
|
|
218
320
|
__decorateClass([
|
|
219
321
|
property({ type: String, attribute: "focal-point" })
|
|
220
322
|
], Hero.prototype, "focalPoint", 2);
|
|
323
|
+
__decorateClass([
|
|
324
|
+
property({ type: String })
|
|
325
|
+
], Hero.prototype, "eyebrow", 2);
|
|
326
|
+
__decorateClass([
|
|
327
|
+
property({ type: String, attribute: "secondary-action-label" })
|
|
328
|
+
], Hero.prototype, "secondaryActionLabel", 2);
|
|
329
|
+
__decorateClass([
|
|
330
|
+
property({ type: String, attribute: "secondary-href" })
|
|
331
|
+
], Hero.prototype, "secondaryHref", 2);
|
|
332
|
+
__decorateClass([
|
|
333
|
+
property({ type: String, reflect: true })
|
|
334
|
+
], Hero.prototype, "size", 2);
|
|
335
|
+
__decorateClass([
|
|
336
|
+
property({ type: String, reflect: true, attribute: "content-position" })
|
|
337
|
+
], Hero.prototype, "contentPosition", 2);
|
|
338
|
+
__decorateClass([
|
|
339
|
+
property({ type: String, reflect: true })
|
|
340
|
+
], Hero.prototype, "overlay", 2);
|
|
221
341
|
Hero = __decorateClass([
|
|
222
342
|
customElement("st-hero")
|
|
223
343
|
], Hero);
|
|
@@ -225,4 +345,4 @@ Hero = __decorateClass([
|
|
|
225
345
|
export {
|
|
226
346
|
Hero
|
|
227
347
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
348
|
+
//# sourceMappingURL=chunk-K4ZICRZL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hero/Hero.ts"],"sourcesContent":["import { LitElement, css, html, nothing } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\n\r\nimport { controlBaseStyles, rootFontFamilyStyles } from '../shared/styles';\r\nimport { ctaLinkStyles, paddingScaleStyles } from '../shared/section-styles';\r\nimport type { HeroActionEventDetail } from './HeroEvents';\r\n\r\n/**\r\n * Full-width hero banner: background image with a darkening overlay, optional eyebrow, title,\r\n * optional subtitle and up to two call-to-action links. Port of `SankhyaUI`'s React `Hero`; the\r\n * framer-motion entrance is redone as CSS keyframes (skipped under `prefers-reduced-motion`).\r\n *\r\n * `size`, `content-position` and `overlay=\"gradient\"` give the large editorial layout (copy on the\r\n * lower left over a gradient that darkens towards it) used by enterprise marketing heroes; the\r\n * defaults keep the original centered banner. Put several heroes in an `st-carousel` with\r\n * `indicator-style=\"tabs\"` for a tabbed hero carousel.\r\n *\r\n * @fires action - Cancelable, before navigating. Detail `{ href, kind }`, `kind` being `primary` or `secondary`.\r\n * @cssprop --st-hero-text-color - Text colour over the image.\r\n * @cssprop --st-hero-min-height - Minimum height when `size` is `large` (default `640px`).\r\n * @csspart eyebrow - The small label above the title.\r\n * @csspart secondary-action - The outlined second button.\r\n */\r\n@customElement('st-hero')\r\nexport class Hero extends LitElement {\r\n static styles = css`\r\n ${controlBaseStyles}\r\n ${paddingScaleStyles}\r\n\r\n @keyframes st-hero-zoom {\r\n from { opacity: 0; transform: scale(1.1); }\r\n to { opacity: 1; transform: scale(1); }\r\n }\r\n @keyframes st-hero-rise {\r\n from { opacity: 0; transform: translateY(30px); }\r\n to { opacity: 1; transform: none; }\r\n }\r\n @keyframes st-hero-fade {\r\n from { opacity: 0; }\r\n to { opacity: 1; }\r\n }\r\n\r\n :host {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n position: relative;\r\n overflow: hidden;\r\n width: 100%;\r\n box-sizing: border-box;\r\n background-color: var(--st-color-text-strong);\r\n background-repeat: no-repeat;\r\n background-size: cover;\r\n background-position: var(--st-hero-position, center center);\r\n color: var(--st-color-on-solid);\r\n ${rootFontFamilyStyles}\r\n animation: st-hero-zoom 1.5s ease-out;\r\n }\r\n\r\n :host([inverted]) {\r\n background-color: var(--st-color-surface);\r\n color: var(--st-color-text-strong);\r\n }\r\n\r\n .overlay {\r\n position: absolute;\r\n inset: 0;\r\n z-index: 1;\r\n background: linear-gradient(\r\n to bottom,\r\n color-mix(in oklch, var(--st-color-text-strong) 40%, transparent),\r\n color-mix(in oklch, var(--st-color-text-strong) 20%, transparent),\r\n color-mix(in oklch, var(--st-color-text-strong) 40%, transparent)\r\n );\r\n }\r\n\r\n :host([inverted]) .overlay {\r\n display: none;\r\n }\r\n\r\n .content {\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--st-space-20);\r\n position: relative;\r\n z-index: 2;\r\n width: 80%;\r\n margin: 0 auto;\r\n text-align: center;\r\n align-items: center;\r\n /* Set here, not only on :host: text sits on the image/overlay, so a colour class the page puts\r\n on the host (e.g. a theme text colour) must not turn it dark. */\r\n color: var(--st-hero-text-color, var(--st-color-on-solid));\r\n }\r\n\r\n :host([inverted]) .content {\r\n color: var(--st-hero-text-color, var(--st-color-text-strong));\r\n }\r\n\r\n :host([text-alignment='left']) .content { text-align: left; align-items: flex-start; }\r\n :host([text-alignment='right']) .content { text-align: right; align-items: flex-end; }\r\n :host([text-alignment='justify']) .content { text-align: justify; align-items: stretch; }\r\n\r\n .title {\r\n font-size: var(--st-cms-text-display);\r\n font-weight: var(--st-font-weight-bold);\r\n line-height: 1.1;\r\n color: inherit;\r\n margin: 0;\r\n animation: st-hero-rise 0.8s 0.3s ease-out backwards;\r\n }\r\n\r\n .subtitle {\r\n font-size: var(--st-cms-text-xl);\r\n line-height: 1.5;\r\n color: inherit;\r\n margin: 0;\r\n animation: st-hero-fade 0.8s 0.5s ease-out backwards;\r\n }\r\n\r\n .actions {\r\n display: flex;\r\n justify-content: center;\r\n width: 100%;\r\n }\r\n\r\n .cta {\r\n ${ctaLinkStyles}\r\n background: var(--st-button-primary-bg);\r\n color: var(--st-button-primary-color);\r\n font-weight: var(--st-button-font-weight);\r\n font-size: var(--st-text-md);\r\n animation: st-hero-rise 0.6s 0.7s ease-out backwards;\r\n }\r\n\r\n .cta:hover {\r\n transform: scale(1.05);\r\n }\r\n\r\n .cta:active {\r\n transform: scale(0.98);\r\n }\r\n\r\n .eyebrow {\r\n margin: 0;\r\n font-size: var(--st-text-sm);\r\n font-weight: var(--st-font-weight-bold);\r\n letter-spacing: 0.12em;\r\n text-transform: uppercase;\r\n color: inherit;\r\n opacity: 0.85;\r\n animation: st-hero-fade 0.8s 0.2s ease-out backwards;\r\n }\r\n\r\n .actions {\r\n flex-wrap: wrap;\r\n gap: var(--st-space-12);\r\n }\r\n\r\n .cta.secondary {\r\n background: transparent;\r\n color: inherit;\r\n box-shadow: inset 0 0 0 1.5px currentColor;\r\n }\r\n\r\n .cta.secondary:hover {\r\n background: color-mix(in oklch, currentColor 12%, transparent);\r\n }\r\n\r\n /* size=\"large\" / \"full\": a tall editorial hero. */\r\n :host([size='large']) {\r\n min-height: var(--st-hero-min-height, 640px);\r\n }\r\n\r\n :host([size='full']) {\r\n min-height: 100svh;\r\n }\r\n\r\n :host([size='large']) .title,\r\n :host([size='full']) .title {\r\n font-size: clamp(2.5rem, 6vw, 5rem);\r\n letter-spacing: -0.02em;\r\n line-height: 1.05;\r\n }\r\n\r\n /* content-position=\"bottom\": copy sits in the lower part of the hero, on the container grid. */\r\n :host([content-position='bottom']) {\r\n align-items: flex-end;\r\n }\r\n\r\n :host([content-position='bottom']) .content {\r\n width: 100%;\r\n max-width: var(--st-cms-container-max);\r\n box-sizing: border-box;\r\n padding: var(--st-space-48) var(--st-space-24);\r\n }\r\n\r\n :host([content-position='bottom']) .title,\r\n :host([content-position='bottom']) .subtitle {\r\n max-width: 18ch;\r\n }\r\n\r\n :host([content-position='bottom']) .subtitle {\r\n max-width: 48ch;\r\n }\r\n\r\n :host([content-position='bottom']:not([text-alignment='center']):not([text-alignment='right'])) .actions {\r\n justify-content: flex-start;\r\n }\r\n\r\n :host([content-position='bottom'][text-alignment='center']) .title,\r\n :host([content-position='bottom'][text-alignment='center']) .subtitle {\r\n margin-inline: auto;\r\n }\r\n\r\n /* overlay=\"gradient\": darkest behind the copy, clearing towards the far side of the image. */\r\n :host([overlay='gradient']) .overlay {\r\n background:\r\n linear-gradient(to top, color-mix(in oklch, var(--st-color-text-strong) 85%, transparent), transparent 70%),\r\n linear-gradient(to right, color-mix(in oklch, var(--st-color-text-strong) 70%, transparent), transparent 75%);\r\n }\r\n\r\n :host([overlay='gradient'][text-alignment='right']) .overlay {\r\n background:\r\n linear-gradient(to top, color-mix(in oklch, var(--st-color-text-strong) 85%, transparent), transparent 70%),\r\n linear-gradient(to left, color-mix(in oklch, var(--st-color-text-strong) 70%, transparent), transparent 75%);\r\n }\r\n\r\n :host([overlay='none']) .overlay {\r\n display: none;\r\n }\r\n\r\n @media (min-width: 768px) {\r\n .content { padding: var(--st-space-32); }\r\n }\r\n @media (min-width: 1024px) {\r\n .content { padding: var(--st-space-48); }\r\n :host([content-position='bottom']) .content { padding: var(--st-space-48) var(--st-space-32) 6rem; }\r\n }\r\n\r\n @media (prefers-reduced-motion: reduce) {\r\n :host, .eyebrow, .title, .subtitle, .cta { animation: none; }\r\n .cta { transition: none; }\r\n }\r\n `;\r\n\r\n @property({ type: String })\r\n title = '';\r\n\r\n @property({ type: String })\r\n subtitle = '';\r\n\r\n @property({ type: String, attribute: 'image-src' })\r\n imageSrc = '';\r\n\r\n @property({ type: String, attribute: 'action-label' })\r\n actionLabel = '';\r\n\r\n @property({ type: String })\r\n href = '';\r\n\r\n @property({ type: String, reflect: true, attribute: 'text-alignment' })\r\n textAlignment: 'left' | 'center' | 'right' | 'justify' = 'left';\r\n\r\n @property({ type: String, reflect: true })\r\n padding: 'none' | 'small' | 'medium' | 'large' = 'none';\r\n\r\n @property({ type: Boolean, reflect: true })\r\n inverted = false;\r\n\r\n @property({ type: String, attribute: 'focal-point' })\r\n focalPoint: 'top' | 'left' | 'right' | 'bottom' | 'center' = 'center';\r\n\r\n /** Small uppercase label above the title (e.g. an event or product name). */\r\n @property({ type: String })\r\n eyebrow = '';\r\n\r\n /** Label of an outlined second button next to the primary one. */\r\n @property({ type: String, attribute: 'secondary-action-label' })\r\n secondaryActionLabel = '';\r\n\r\n @property({ type: String, attribute: 'secondary-href' })\r\n secondaryHref = '';\r\n\r\n /** `auto` sizes to the content; `large` is a tall editorial hero (`--st-hero-min-height`); `full` fills the viewport. */\r\n @property({ type: String, reflect: true })\r\n size: 'auto' | 'large' | 'full' = 'auto';\r\n\r\n /** `center` keeps the copy in the middle; `bottom` puts it in the lower part of the hero, on the page container. */\r\n @property({ type: String, reflect: true, attribute: 'content-position' })\r\n contentPosition: 'center' | 'bottom' = 'center';\r\n\r\n /** `even` darkens the whole image; `gradient` darkens behind the copy only; `none` shows the image as is. */\r\n @property({ type: String, reflect: true })\r\n overlay: 'even' | 'gradient' | 'none' = 'even';\r\n\r\n private static positions = {\r\n top: 'center top',\r\n left: 'left center',\r\n right: 'right center',\r\n bottom: 'center bottom',\r\n center: 'center center'\r\n } as const;\r\n\r\n protected willUpdate(): void {\r\n this.style.backgroundImage = this.imageSrc ? `url(${JSON.stringify(this.imageSrc)})` : '';\r\n this.style.setProperty('--st-hero-position', Hero.positions[this.focalPoint] ?? Hero.positions.center);\r\n }\r\n\r\n private emitAction(event: MouseEvent, href: string, kind: 'primary' | 'secondary'): void {\r\n const action = new CustomEvent<HeroActionEventDetail>('action', {\r\n detail: { href, kind },\r\n bubbles: true,\r\n composed: true,\r\n cancelable: true\r\n });\r\n this.dispatchEvent(action);\r\n if (action.defaultPrevented) event.preventDefault();\r\n }\r\n\r\n private onClick = (event: MouseEvent): void => this.emitAction(event, this.href, 'primary');\r\n\r\n private onSecondaryClick = (event: MouseEvent): void => this.emitAction(event, this.secondaryHref, 'secondary');\r\n\r\n render() {\r\n return html`\r\n <div class=\"overlay\" part=\"overlay\"></div>\r\n <div class=\"content\" part=\"content\">\r\n ${this.eyebrow ? html`<p class=\"eyebrow\" part=\"eyebrow\">${this.eyebrow}</p>` : nothing}\r\n <h1 class=\"title\" part=\"title\">${this.title}</h1>\r\n ${this.subtitle ? html`<p class=\"subtitle\" part=\"subtitle\">${this.subtitle}</p>` : nothing}\r\n ${this.actionLabel || this.secondaryActionLabel\r\n ? html`<div class=\"actions\" part=\"actions\">\r\n ${this.actionLabel\r\n ? html`<a class=\"cta\" part=\"action\" href=${this.href || nothing} @click=${this.onClick}>${this.actionLabel}</a>`\r\n : nothing}\r\n ${this.secondaryActionLabel\r\n ? html`<a class=\"cta secondary\" part=\"secondary-action\" href=${this.secondaryHref || nothing} @click=${this.onSecondaryClick}\r\n >${this.secondaryActionLabel}</a\r\n >`\r\n : nothing}\r\n </div>`\r\n : nothing}\r\n <slot></slot>\r\n </div>\r\n `;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,KAAK,MAAM,eAAe;AAC/C,SAAS,eA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MAAM,QAAQ,WAAW,yBAAyB,CAAC;AAAA,GA9PpD,KA+PX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,iBAAiB,CAAC;AAAA,GAjQ5C,KAkQX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GArQ9B,KAsQX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,mBAAmB,CAAC;AAAA,GAzQ7D,KA0QX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GA7Q9B,KA8QX;AA9QW,OAAN;AAAA,EADN,cAAc,SAAS;AAAA,GACX;","names":[]}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sectionSubtitleStyles,
|
|
3
|
+
sectionTitleStyles
|
|
4
|
+
} from "./chunk-3VE6VFJ4.js";
|
|
5
|
+
import {
|
|
6
|
+
controlBaseStyles,
|
|
7
|
+
rootFontFamilyStyles
|
|
8
|
+
} from "./chunk-RHAOQ6K4.js";
|
|
9
|
+
import {
|
|
10
|
+
__decorateClass
|
|
11
|
+
} from "./chunk-EUXUH3YW.js";
|
|
12
|
+
|
|
13
|
+
// src/section/Section.ts
|
|
14
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
15
|
+
import { customElement, property } from "lit/decorators.js";
|
|
16
|
+
var Section = class extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.eyebrow = "";
|
|
20
|
+
this.title = "";
|
|
21
|
+
this.subtitle = "";
|
|
22
|
+
this.background = "default";
|
|
23
|
+
this.spacingAbove = "m";
|
|
24
|
+
this.spacingBelow = "m";
|
|
25
|
+
this.width = "contained";
|
|
26
|
+
this.textAlignment = "left";
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
const heading = this.eyebrow || this.title || this.subtitle;
|
|
30
|
+
return html`
|
|
31
|
+
<div class="inner" part="inner">
|
|
32
|
+
${heading ? html`<div class="header" part="header">
|
|
33
|
+
${this.eyebrow ? html`<p class="eyebrow" part="eyebrow">${this.eyebrow}</p>` : nothing}
|
|
34
|
+
${this.title ? html`<h2 class="title" part="title">${this.title}</h2>` : nothing}
|
|
35
|
+
${this.subtitle ? html`<p class="subtitle" part="subtitle">${this.subtitle}</p>` : nothing}
|
|
36
|
+
</div>` : nothing}
|
|
37
|
+
<slot></slot>
|
|
38
|
+
</div>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
Section.styles = css`
|
|
43
|
+
${controlBaseStyles}
|
|
44
|
+
|
|
45
|
+
:host {
|
|
46
|
+
--st-section-space-none: 0;
|
|
47
|
+
--st-section-space-s: var(--st-space-24);
|
|
48
|
+
--st-section-space-m: var(--st-space-48);
|
|
49
|
+
--st-section-space-l: 4.5rem;
|
|
50
|
+
--st-section-space-xl: 6rem;
|
|
51
|
+
--st-section-space-xxl: 8rem;
|
|
52
|
+
|
|
53
|
+
display: block;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
width: 100%;
|
|
56
|
+
padding: var(--st-section-space-m) var(--st-space-24);
|
|
57
|
+
background: var(--st-section-bg, var(--st-color-surface));
|
|
58
|
+
color: var(--st-color-text-strong);
|
|
59
|
+
${rootFontFamilyStyles}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([background='subtle']) {
|
|
63
|
+
background: var(--st-section-bg, var(--st-color-subtle));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host([background='dark']) {
|
|
67
|
+
background: var(--st-section-bg, var(--st-color-text-strong));
|
|
68
|
+
color: var(--st-color-on-solid);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([background='accent']) {
|
|
72
|
+
background: var(--st-section-bg, var(--st-color-accent));
|
|
73
|
+
color: var(--st-color-on-solid);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([background='transparent']) {
|
|
77
|
+
background: var(--st-section-bg, transparent);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:host([spacing-above='none']) { padding-top: var(--st-section-space-none); }
|
|
81
|
+
:host([spacing-above='s']) { padding-top: var(--st-section-space-s); }
|
|
82
|
+
:host([spacing-above='l']) { padding-top: var(--st-section-space-l); }
|
|
83
|
+
:host([spacing-above='xl']) { padding-top: var(--st-section-space-xl); }
|
|
84
|
+
:host([spacing-above='xxl']) { padding-top: var(--st-section-space-xxl); }
|
|
85
|
+
|
|
86
|
+
:host([spacing-below='none']) { padding-bottom: var(--st-section-space-none); }
|
|
87
|
+
:host([spacing-below='s']) { padding-bottom: var(--st-section-space-s); }
|
|
88
|
+
:host([spacing-below='l']) { padding-bottom: var(--st-section-space-l); }
|
|
89
|
+
:host([spacing-below='xl']) { padding-bottom: var(--st-section-space-xl); }
|
|
90
|
+
:host([spacing-below='xxl']) { padding-bottom: var(--st-section-space-xxl); }
|
|
91
|
+
|
|
92
|
+
:host([width='full']) {
|
|
93
|
+
padding-left: 0;
|
|
94
|
+
padding-right: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.inner {
|
|
98
|
+
max-width: var(--st-cms-container-max);
|
|
99
|
+
margin: 0 auto;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:host([width='narrow']) .inner {
|
|
103
|
+
max-width: 800px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host([width='full']) .inner {
|
|
107
|
+
max-width: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.header {
|
|
111
|
+
margin-bottom: var(--st-space-48);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host([text-alignment='center']) .header {
|
|
115
|
+
text-align: center;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([text-alignment='center']) .subtitle {
|
|
119
|
+
margin-inline: auto;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([width='full']) .header {
|
|
123
|
+
max-width: var(--st-cms-container-max);
|
|
124
|
+
margin-inline: auto;
|
|
125
|
+
padding-inline: var(--st-space-24);
|
|
126
|
+
box-sizing: border-box;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.eyebrow {
|
|
130
|
+
margin: 0 0 var(--st-space-12);
|
|
131
|
+
font-size: var(--st-text-sm);
|
|
132
|
+
font-weight: var(--st-font-weight-bold);
|
|
133
|
+
letter-spacing: 0.12em;
|
|
134
|
+
text-transform: uppercase;
|
|
135
|
+
color: var(--st-color-text-muted);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.title {
|
|
139
|
+
${sectionTitleStyles}
|
|
140
|
+
color: inherit;
|
|
141
|
+
letter-spacing: -0.02em;
|
|
142
|
+
max-width: 24ch;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([text-alignment='center']) .title {
|
|
146
|
+
margin-inline: auto;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.subtitle {
|
|
150
|
+
${sectionSubtitleStyles}
|
|
151
|
+
max-width: 60ch;
|
|
152
|
+
margin-bottom: 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:host([background='dark']) .eyebrow,
|
|
156
|
+
:host([background='dark']) .subtitle,
|
|
157
|
+
:host([background='accent']) .eyebrow,
|
|
158
|
+
:host([background='accent']) .subtitle {
|
|
159
|
+
color: color-mix(in oklch, var(--st-color-on-solid) 80%, transparent);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@media (max-width: 768px) {
|
|
163
|
+
:host {
|
|
164
|
+
--st-section-space-l: 3.5rem;
|
|
165
|
+
--st-section-space-xl: 4.5rem;
|
|
166
|
+
--st-section-space-xxl: 5.5rem;
|
|
167
|
+
padding-left: var(--st-space-20);
|
|
168
|
+
padding-right: var(--st-space-20);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
__decorateClass([
|
|
173
|
+
property({ type: String })
|
|
174
|
+
], Section.prototype, "eyebrow", 2);
|
|
175
|
+
__decorateClass([
|
|
176
|
+
property({ type: String })
|
|
177
|
+
], Section.prototype, "title", 2);
|
|
178
|
+
__decorateClass([
|
|
179
|
+
property({ type: String })
|
|
180
|
+
], Section.prototype, "subtitle", 2);
|
|
181
|
+
__decorateClass([
|
|
182
|
+
property({ type: String, reflect: true })
|
|
183
|
+
], Section.prototype, "background", 2);
|
|
184
|
+
__decorateClass([
|
|
185
|
+
property({ type: String, reflect: true, attribute: "spacing-above" })
|
|
186
|
+
], Section.prototype, "spacingAbove", 2);
|
|
187
|
+
__decorateClass([
|
|
188
|
+
property({ type: String, reflect: true, attribute: "spacing-below" })
|
|
189
|
+
], Section.prototype, "spacingBelow", 2);
|
|
190
|
+
__decorateClass([
|
|
191
|
+
property({ type: String, reflect: true })
|
|
192
|
+
], Section.prototype, "width", 2);
|
|
193
|
+
__decorateClass([
|
|
194
|
+
property({ type: String, reflect: true, attribute: "text-alignment" })
|
|
195
|
+
], Section.prototype, "textAlignment", 2);
|
|
196
|
+
Section = __decorateClass([
|
|
197
|
+
customElement("st-section")
|
|
198
|
+
], Section);
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
Section
|
|
202
|
+
};
|
|
203
|
+
//# sourceMappingURL=chunk-N63TVWK3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/section/Section.ts"],"sourcesContent":["import { LitElement, css, html, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { controlBaseStyles, rootFontFamilyStyles } from '../shared/styles';\nimport { sectionSubtitleStyles, sectionTitleStyles } from '../shared/section-styles';\n\n/**\n * A page band that holds other content: sets the background, the spacing above and below, and\n * the content width, with an optional eyebrow/title/subtitle heading over its slotted children.\n * Use it to give a run of components one dark or tinted backdrop and a consistent vertical rhythm,\n * the way enterprise marketing pages stack full-width sections.\n *\n * @slot - The section's content.\n * @cssprop --st-section-bg - Overrides the background colour picked by `background`.\n * @csspart inner - The width-limited content box.\n * @csspart header - The heading block.\n */\n@customElement('st-section')\nexport class Section extends LitElement {\n static styles = css`\n ${controlBaseStyles}\n\n :host {\n --st-section-space-none: 0;\n --st-section-space-s: var(--st-space-24);\n --st-section-space-m: var(--st-space-48);\n --st-section-space-l: 4.5rem;\n --st-section-space-xl: 6rem;\n --st-section-space-xxl: 8rem;\n\n display: block;\n box-sizing: border-box;\n width: 100%;\n padding: var(--st-section-space-m) var(--st-space-24);\n background: var(--st-section-bg, var(--st-color-surface));\n color: var(--st-color-text-strong);\n ${rootFontFamilyStyles}\n }\n\n :host([background='subtle']) {\n background: var(--st-section-bg, var(--st-color-subtle));\n }\n\n :host([background='dark']) {\n background: var(--st-section-bg, var(--st-color-text-strong));\n color: var(--st-color-on-solid);\n }\n\n :host([background='accent']) {\n background: var(--st-section-bg, var(--st-color-accent));\n color: var(--st-color-on-solid);\n }\n\n :host([background='transparent']) {\n background: var(--st-section-bg, transparent);\n }\n\n :host([spacing-above='none']) { padding-top: var(--st-section-space-none); }\n :host([spacing-above='s']) { padding-top: var(--st-section-space-s); }\n :host([spacing-above='l']) { padding-top: var(--st-section-space-l); }\n :host([spacing-above='xl']) { padding-top: var(--st-section-space-xl); }\n :host([spacing-above='xxl']) { padding-top: var(--st-section-space-xxl); }\n\n :host([spacing-below='none']) { padding-bottom: var(--st-section-space-none); }\n :host([spacing-below='s']) { padding-bottom: var(--st-section-space-s); }\n :host([spacing-below='l']) { padding-bottom: var(--st-section-space-l); }\n :host([spacing-below='xl']) { padding-bottom: var(--st-section-space-xl); }\n :host([spacing-below='xxl']) { padding-bottom: var(--st-section-space-xxl); }\n\n :host([width='full']) {\n padding-left: 0;\n padding-right: 0;\n }\n\n .inner {\n max-width: var(--st-cms-container-max);\n margin: 0 auto;\n }\n\n :host([width='narrow']) .inner {\n max-width: 800px;\n }\n\n :host([width='full']) .inner {\n max-width: none;\n }\n\n .header {\n margin-bottom: var(--st-space-48);\n }\n\n :host([text-alignment='center']) .header {\n text-align: center;\n }\n\n :host([text-alignment='center']) .subtitle {\n margin-inline: auto;\n }\n\n :host([width='full']) .header {\n max-width: var(--st-cms-container-max);\n margin-inline: auto;\n padding-inline: var(--st-space-24);\n box-sizing: border-box;\n }\n\n .eyebrow {\n margin: 0 0 var(--st-space-12);\n font-size: var(--st-text-sm);\n font-weight: var(--st-font-weight-bold);\n letter-spacing: 0.12em;\n text-transform: uppercase;\n color: var(--st-color-text-muted);\n }\n\n .title {\n ${sectionTitleStyles}\n color: inherit;\n letter-spacing: -0.02em;\n max-width: 24ch;\n }\n\n :host([text-alignment='center']) .title {\n margin-inline: auto;\n }\n\n .subtitle {\n ${sectionSubtitleStyles}\n max-width: 60ch;\n margin-bottom: 0;\n }\n\n :host([background='dark']) .eyebrow,\n :host([background='dark']) .subtitle,\n :host([background='accent']) .eyebrow,\n :host([background='accent']) .subtitle {\n color: color-mix(in oklch, var(--st-color-on-solid) 80%, transparent);\n }\n\n @media (max-width: 768px) {\n :host {\n --st-section-space-l: 3.5rem;\n --st-section-space-xl: 4.5rem;\n --st-section-space-xxl: 5.5rem;\n padding-left: var(--st-space-20);\n padding-right: var(--st-space-20);\n }\n }\n `;\n\n @property({ type: String })\n eyebrow = '';\n\n @property({ type: String })\n title = '';\n\n @property({ type: String })\n subtitle = '';\n\n /** `default` (page surface), `subtle`, `dark`, `accent` or `transparent`. */\n @property({ type: String, reflect: true })\n background: 'default' | 'subtle' | 'dark' | 'accent' | 'transparent' = 'default';\n\n /** Space above the content: `none`, `s`, `m` (default), `l`, `xl` or `xxl`. */\n @property({ type: String, reflect: true, attribute: 'spacing-above' })\n spacingAbove: 'none' | 's' | 'm' | 'l' | 'xl' | 'xxl' = 'm';\n\n /** Space below the content: `none`, `s`, `m` (default), `l`, `xl` or `xxl`. */\n @property({ type: String, reflect: true, attribute: 'spacing-below' })\n spacingBelow: 'none' | 's' | 'm' | 'l' | 'xl' | 'xxl' = 'm';\n\n /** `contained` (default, the page container width), `narrow` (reading width) or `full` (edge to edge). */\n @property({ type: String, reflect: true })\n width: 'contained' | 'narrow' | 'full' = 'contained';\n\n /** Alignment of the heading. */\n @property({ type: String, reflect: true, attribute: 'text-alignment' })\n textAlignment: 'left' | 'center' = 'left';\n\n render() {\n const heading = this.eyebrow || this.title || this.subtitle;\n return html`\n <div class=\"inner\" part=\"inner\">\n ${heading\n ? html`<div class=\"header\" part=\"header\">\n ${this.eyebrow ? html`<p class=\"eyebrow\" part=\"eyebrow\">${this.eyebrow}</p>` : nothing}\n ${this.title ? html`<h2 class=\"title\" part=\"title\">${this.title}</h2>` : nothing}\n ${this.subtitle ? html`<p class=\"subtitle\" part=\"subtitle\">${this.subtitle}</p>` : nothing}\n </div>`\n : nothing}\n <slot></slot>\n </div>\n `;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,KAAK,MAAM,eAAe;AAC/C,SAAS,eAAe,gBAAgB;AAiBjC,IAAM,UAAN,cAAsB,WAAW;AAAA,EAAjC;AAAA;AAqIL,mBAAU;AAGV,iBAAQ;AAGR,oBAAW;AAIX,sBAAuE;AAIvE,wBAAwD;AAIxD,wBAAwD;AAIxD,iBAAyC;AAIzC,yBAAmC;AAAA;AAAA,EAEnC,SAAS;AACP,UAAM,UAAU,KAAK,WAAW,KAAK,SAAS,KAAK;AACnD,WAAO;AAAA;AAAA,UAED,UACE;AAAA,gBACI,KAAK,UAAU,yCAAyC,KAAK,OAAO,SAAS,OAAO;AAAA,gBACpF,KAAK,QAAQ,sCAAsC,KAAK,KAAK,UAAU,OAAO;AAAA,gBAC9E,KAAK,WAAW,2CAA2C,KAAK,QAAQ,SAAS,OAAO;AAAA,sBAE5F,OAAO;AAAA;AAAA;AAAA;AAAA,EAIjB;AACF;AAhLa,QACJ,SAAS;AAAA,MACZ,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAgBf,oBAAoB;AAAA;AAAA;AA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AAA,GA1J9B,QA2JX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,iBAAiB,CAAC;AAAA,GA9J3D,QA+JX;AA/JW,UAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":[]}
|
|
@@ -28,6 +28,28 @@ var Header = class extends LitElement {
|
|
|
28
28
|
this.logoClassName = "";
|
|
29
29
|
this.inverted = false;
|
|
30
30
|
this.sticky = false;
|
|
31
|
+
this.transparent = false;
|
|
32
|
+
this.hideOnScroll = false;
|
|
33
|
+
this.scrollThreshold = 8;
|
|
34
|
+
this.scrolled = false;
|
|
35
|
+
this.scrollHidden = false;
|
|
36
|
+
this.lastScrollY = 0;
|
|
37
|
+
this.scrollFrame = 0;
|
|
38
|
+
this.onScroll = () => {
|
|
39
|
+
if (this.scrollFrame) return;
|
|
40
|
+
this.scrollFrame = requestAnimationFrame(() => {
|
|
41
|
+
this.scrollFrame = 0;
|
|
42
|
+
const y = Math.max(0, window.scrollY);
|
|
43
|
+
this.scrolled = y > this.scrollThreshold;
|
|
44
|
+
if (this.hideOnScroll) {
|
|
45
|
+
const delta = y - this.lastScrollY;
|
|
46
|
+
if (Math.abs(delta) > 4) this.scrollHidden = delta > 0 && y > this.offsetHeight && !this.mobileOpen;
|
|
47
|
+
} else {
|
|
48
|
+
this.scrollHidden = false;
|
|
49
|
+
}
|
|
50
|
+
this.lastScrollY = y;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
31
53
|
this.languages = [];
|
|
32
54
|
this.currentLanguageCode = "";
|
|
33
55
|
this.languageMenuLabel = "Language";
|
|
@@ -122,6 +144,8 @@ var Header = class extends LitElement {
|
|
|
122
144
|
super.connectedCallback();
|
|
123
145
|
window.addEventListener("keydown", this.closeOnEscape);
|
|
124
146
|
window.addEventListener("click", this.closeLanguageMenuOnOutsideClick);
|
|
147
|
+
window.addEventListener("scroll", this.onScroll, { passive: true });
|
|
148
|
+
this.onScroll();
|
|
125
149
|
this.narrowQuery = window.matchMedia(`(max-width: ${BREAKPOINT_TABLET}px)`);
|
|
126
150
|
this.narrowQuery.addEventListener("change", this.syncInlineDropdowns);
|
|
127
151
|
this.lightDomObserver = new MutationObserver(this.syncInlineDropdowns);
|
|
@@ -133,6 +157,9 @@ var Header = class extends LitElement {
|
|
|
133
157
|
this.resizeObserver?.disconnect();
|
|
134
158
|
window.removeEventListener("keydown", this.closeOnEscape);
|
|
135
159
|
window.removeEventListener("click", this.closeLanguageMenuOnOutsideClick);
|
|
160
|
+
window.removeEventListener("scroll", this.onScroll);
|
|
161
|
+
if (this.scrollFrame) cancelAnimationFrame(this.scrollFrame);
|
|
162
|
+
this.scrollFrame = 0;
|
|
136
163
|
super.disconnectedCallback();
|
|
137
164
|
}
|
|
138
165
|
renderLanguageMenu() {
|
|
@@ -248,6 +275,68 @@ Header.styles = css`
|
|
|
248
275
|
border-bottom-color: transparent;
|
|
249
276
|
}
|
|
250
277
|
|
|
278
|
+
:host([sticky]),
|
|
279
|
+
:host([transparent]),
|
|
280
|
+
:host([hide-on-scroll]) {
|
|
281
|
+
transition:
|
|
282
|
+
background-color 0.3s ease,
|
|
283
|
+
color 0.3s ease,
|
|
284
|
+
box-shadow 0.3s ease,
|
|
285
|
+
border-color 0.3s ease,
|
|
286
|
+
transform 0.3s ease;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* Once the page has scrolled, a sticky/fixed header lifts off the content. */
|
|
290
|
+
:host([scrolled][sticky]),
|
|
291
|
+
:host([scrolled][transparent]),
|
|
292
|
+
:host([scrolled][hide-on-scroll]) {
|
|
293
|
+
box-shadow: 0 4px 16px var(--st-shadow-color-md);
|
|
294
|
+
border-bottom-color: transparent !important;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* transparent: fixed over the top of the page (e.g. a dark hero), see-through until scrolled. */
|
|
298
|
+
:host([transparent]) {
|
|
299
|
+
position: fixed;
|
|
300
|
+
top: 0;
|
|
301
|
+
left: 0;
|
|
302
|
+
right: 0;
|
|
303
|
+
z-index: 100;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
:host([transparent]:not([scrolled]):not([mobile-open])) {
|
|
307
|
+
background: transparent;
|
|
308
|
+
border-bottom-color: transparent !important;
|
|
309
|
+
color: var(--st-header-transparent-color, var(--st-color-on-solid));
|
|
310
|
+
/* Read by st-menu-item / st-dropdown triggers in the bar (their panels reset them). */
|
|
311
|
+
--st-nav-color: var(--st-header-transparent-color, var(--st-color-on-solid));
|
|
312
|
+
--st-nav-hover-bg: color-mix(in oklch, currentColor 14%, transparent);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
:host([transparent]:not([scrolled]):not([mobile-open])) .utility-row {
|
|
316
|
+
border-left-color: color-mix(in oklch, currentColor 35%, transparent);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
:host([transparent]:not([scrolled]):not([mobile-open])) .lang-trigger {
|
|
320
|
+
color: inherit;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
:host([transparent]:not([scrolled]):not([mobile-open])) .lang-trigger:hover,
|
|
324
|
+
:host([transparent]:not([scrolled]):not([mobile-open])) .toggle:hover {
|
|
325
|
+
background: color-mix(in oklch, currentColor 14%, transparent);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* hide-on-scroll: slides away while scrolling down, back as soon as the user scrolls up. */
|
|
329
|
+
:host([hide-on-scroll]:not([sticky]):not([transparent])) {
|
|
330
|
+
position: sticky;
|
|
331
|
+
top: 0;
|
|
332
|
+
z-index: 100;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
:host([scroll-hidden]:not([mobile-open])) {
|
|
336
|
+
transform: translateY(-100%);
|
|
337
|
+
box-shadow: none;
|
|
338
|
+
}
|
|
339
|
+
|
|
251
340
|
.brand {
|
|
252
341
|
display: flex;
|
|
253
342
|
align-items: center;
|
|
@@ -346,7 +435,7 @@ Header.styles = css`
|
|
|
346
435
|
border: 0;
|
|
347
436
|
border-radius: var(--st-radius-sm);
|
|
348
437
|
background: transparent;
|
|
349
|
-
color:
|
|
438
|
+
color: inherit;
|
|
350
439
|
cursor: pointer;
|
|
351
440
|
}
|
|
352
441
|
|
|
@@ -497,8 +586,10 @@ Header.styles = css`
|
|
|
497
586
|
}
|
|
498
587
|
|
|
499
588
|
@media (prefers-reduced-motion: reduce) {
|
|
589
|
+
:host,
|
|
500
590
|
.mobile-panel {
|
|
501
591
|
animation: none !important;
|
|
592
|
+
transition: none !important;
|
|
502
593
|
}
|
|
503
594
|
}
|
|
504
595
|
`;
|
|
@@ -526,6 +617,21 @@ __decorateClass([
|
|
|
526
617
|
__decorateClass([
|
|
527
618
|
property({ type: Boolean, reflect: true })
|
|
528
619
|
], Header.prototype, "sticky", 2);
|
|
620
|
+
__decorateClass([
|
|
621
|
+
property({ type: Boolean, reflect: true })
|
|
622
|
+
], Header.prototype, "transparent", 2);
|
|
623
|
+
__decorateClass([
|
|
624
|
+
property({ type: Boolean, reflect: true, attribute: "hide-on-scroll" })
|
|
625
|
+
], Header.prototype, "hideOnScroll", 2);
|
|
626
|
+
__decorateClass([
|
|
627
|
+
property({ type: Number, attribute: "scroll-threshold" })
|
|
628
|
+
], Header.prototype, "scrollThreshold", 2);
|
|
629
|
+
__decorateClass([
|
|
630
|
+
property({ type: Boolean, reflect: true })
|
|
631
|
+
], Header.prototype, "scrolled", 2);
|
|
632
|
+
__decorateClass([
|
|
633
|
+
property({ type: Boolean, reflect: true, attribute: "scroll-hidden" })
|
|
634
|
+
], Header.prototype, "scrollHidden", 2);
|
|
529
635
|
__decorateClass([
|
|
530
636
|
property({ attribute: false })
|
|
531
637
|
], Header.prototype, "languages", 2);
|
|
@@ -554,4 +660,4 @@ Header = __decorateClass([
|
|
|
554
660
|
export {
|
|
555
661
|
Header
|
|
556
662
|
};
|
|
557
|
-
//# sourceMappingURL=chunk-
|
|
663
|
+
//# sourceMappingURL=chunk-PKTRYUGP.js.map
|