@sankhyatronics/sankhya-cms 0.1.18 → 0.3.0
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 +11634 -3153
- package/dist/attention-panel/index.js +2 -2
- package/dist/bar-chart/index.js +2 -2
- package/dist/bento-grid/index.d.ts +33 -1
- package/dist/bento-grid/index.js +4 -3
- package/dist/booking/index.d.ts +309 -0
- package/dist/booking/index.js +20 -0
- package/dist/booking/index.js.map +1 -0
- package/dist/card/index.d.ts +3 -4
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.d.ts +20 -6
- package/dist/carousel/index.js +3 -3
- package/dist/chip/index.js +2 -2
- package/dist/{chunk-JQY2G4QK.js → chunk-2GTR37PU.js} +2 -2
- package/dist/chunk-2GTR37PU.js.map +1 -0
- package/dist/{chunk-FLY7TNRT.js → chunk-2HMOX253.js} +128 -25
- package/dist/chunk-2HMOX253.js.map +1 -0
- package/dist/{chunk-DH53HZPB.js → chunk-37KFBKPD.js} +32 -4
- package/dist/chunk-37KFBKPD.js.map +1 -0
- package/dist/{chunk-ALI26WOB.js → chunk-4XPKKYVZ.js} +54 -15
- package/dist/chunk-4XPKKYVZ.js.map +1 -0
- package/dist/chunk-535QAZ6A.js +236 -0
- package/dist/chunk-535QAZ6A.js.map +1 -0
- package/dist/{chunk-AKJQ345O.js → chunk-5AWGZQWU.js} +2 -2
- package/dist/chunk-6OZKZG5J.js +300 -0
- package/dist/chunk-6OZKZG5J.js.map +1 -0
- package/dist/chunk-AYNT7G3J.js +805 -0
- package/dist/chunk-AYNT7G3J.js.map +1 -0
- package/dist/chunk-BEWX3E6P.js +32 -0
- package/dist/chunk-BEWX3E6P.js.map +1 -0
- package/dist/chunk-CZUGPKXV.js +275 -0
- package/dist/chunk-CZUGPKXV.js.map +1 -0
- package/dist/{chunk-LEXZKGQX.js → chunk-DJFWZOZM.js} +107 -11
- package/dist/chunk-DJFWZOZM.js.map +1 -0
- package/dist/chunk-DPANTC3O.js +1714 -0
- package/dist/chunk-DPANTC3O.js.map +1 -0
- package/dist/chunk-EKZFFY45.js +426 -0
- package/dist/chunk-EKZFFY45.js.map +1 -0
- package/dist/chunk-ER7MCPDV.js +7 -0
- package/dist/chunk-ER7MCPDV.js.map +1 -0
- package/dist/chunk-EW2RK5Y6.js +383 -0
- package/dist/chunk-EW2RK5Y6.js.map +1 -0
- package/dist/{chunk-BLQV2YMO.js → chunk-EZOKT7NJ.js} +2 -2
- package/dist/chunk-FF2LWEF3.js +386 -0
- package/dist/chunk-FF2LWEF3.js.map +1 -0
- package/dist/chunk-FOUK3NHR.js +7 -0
- package/dist/chunk-FOUK3NHR.js.map +1 -0
- package/dist/chunk-GB4NGCZI.js +181 -0
- package/dist/chunk-GB4NGCZI.js.map +1 -0
- package/dist/{chunk-7NLZND6Q.js → chunk-GOFSMD6W.js} +35 -11
- package/dist/chunk-GOFSMD6W.js.map +1 -0
- package/dist/{chunk-6D6ROU7X.js → chunk-IGMVF3KK.js} +2 -2
- package/dist/{chunk-INMSEYT6.js → chunk-IVPVYVWG.js} +2 -2
- package/dist/chunk-JURCF4OD.js +381 -0
- package/dist/chunk-JURCF4OD.js.map +1 -0
- package/dist/{chunk-FZ36KL73.js → chunk-KZ7PMFWS.js} +11 -1
- package/dist/chunk-KZ7PMFWS.js.map +1 -0
- package/dist/{chunk-EMCQBT3S.js → chunk-LO6TZBGD.js} +129 -35
- package/dist/chunk-LO6TZBGD.js.map +1 -0
- package/dist/chunk-MFRGAT6D.js +860 -0
- package/dist/chunk-MFRGAT6D.js.map +1 -0
- package/dist/chunk-MIBVQXRU.js +1098 -0
- package/dist/chunk-MIBVQXRU.js.map +1 -0
- package/dist/{chunk-35TX3AOA.js → chunk-NABSRUXG.js} +2 -2
- package/dist/{chunk-R5G6KFTJ.js → chunk-NXKDZWS7.js} +44 -6
- package/dist/chunk-NXKDZWS7.js.map +1 -0
- package/dist/{chunk-KMU6ABQF.js → chunk-NXUS2CH7.js} +14 -1
- package/dist/chunk-NXUS2CH7.js.map +1 -0
- package/dist/{chunk-GJO3RGOB.js → chunk-OCPGOLVF.js} +56 -11
- package/dist/chunk-OCPGOLVF.js.map +1 -0
- package/dist/chunk-OEOE6IFY.js +628 -0
- package/dist/chunk-OEOE6IFY.js.map +1 -0
- package/dist/{chunk-SMLR736E.js → chunk-PV6OCXXN.js} +2 -2
- package/dist/chunk-PV6OCXXN.js.map +1 -0
- package/dist/chunk-Q66CJO3P.js +534 -0
- package/dist/chunk-Q66CJO3P.js.map +1 -0
- package/dist/{chunk-MG2VTZA4.js → chunk-QS3ANOWN.js} +2 -2
- package/dist/{chunk-ZN4LIKVG.js → chunk-QSJ543V2.js} +2 -2
- package/dist/chunk-QSJ543V2.js.map +1 -0
- package/dist/{chunk-FML6AG2V.js → chunk-RANC3OI6.js} +2 -2
- package/dist/chunk-T4BIN37Q.js +32 -0
- package/dist/chunk-T4BIN37Q.js.map +1 -0
- package/dist/{chunk-YVTFQHVY.js → chunk-TEAZZPDQ.js} +2 -2
- package/dist/chunk-TJK55CJ2.js +49 -0
- package/dist/chunk-TJK55CJ2.js.map +1 -0
- package/dist/chunk-UKIVLF7S.js +32 -0
- package/dist/chunk-UKIVLF7S.js.map +1 -0
- package/dist/chunk-V4R7PYP5.js +905 -0
- package/dist/chunk-V4R7PYP5.js.map +1 -0
- package/dist/{chunk-AG2COC64.js → chunk-VVYQ2DDS.js} +2 -2
- package/dist/chunk-WAMOAAMN.js +16 -0
- package/dist/chunk-WAMOAAMN.js.map +1 -0
- package/dist/chunk-WAYHHL4J.js +1234 -0
- package/dist/chunk-WAYHHL4J.js.map +1 -0
- package/dist/{chunk-YQ42EBK5.js → chunk-WH6HE6SY.js} +10 -4
- package/dist/chunk-WH6HE6SY.js.map +1 -0
- package/dist/chunk-XP6DI3VY.js +180 -0
- package/dist/chunk-XP6DI3VY.js.map +1 -0
- package/dist/{chunk-5EBWMPJS.js → chunk-XS6LNTSH.js} +76 -14
- package/dist/chunk-XS6LNTSH.js.map +1 -0
- package/dist/{chunk-WT4OATGP.js → chunk-ZKFCDVB4.js} +16 -7
- package/dist/chunk-ZKFCDVB4.js.map +1 -0
- package/dist/cms-theme.css +29 -0
- package/dist/contact-form/index.d.ts +220 -0
- package/dist/contact-form/index.js +16 -0
- package/dist/contact-form/index.js.map +1 -0
- package/dist/content-block/index.d.ts +39 -4
- package/dist/content-block/index.js +8 -4
- package/dist/cookie-consent/index.d.ts +60 -12
- package/dist/cookie-consent/index.js +3 -2
- package/dist/date-tile/index.js +2 -2
- package/dist/dropdown/index.d.ts +29 -11
- package/dist/dropdown/index.js +4 -2
- package/dist/feature-split/index.d.ts +6 -1
- package/dist/feature-split/index.js +5 -4
- package/dist/features-section/index.d.ts +53 -9
- package/dist/features-section/index.js +6 -5
- package/dist/flow/index.d.ts +35 -0
- package/dist/flow/index.js +9 -0
- package/dist/flow/index.js.map +1 -0
- package/dist/footer/index.d.ts +13 -0
- package/dist/footer/index.js +2 -2
- package/dist/header/index.d.ts +135 -16
- package/dist/header/index.js +3 -2
- package/dist/hero/index.d.ts +92 -8
- package/dist/hero/index.js +6 -3
- package/dist/icon-button/index.d.ts +7 -7
- package/dist/icon-button/index.js +2 -2
- package/dist/index.d.ts +12 -3
- package/dist/index.js +121 -47
- package/dist/items-accordion/index.d.ts +9 -0
- package/dist/items-accordion/index.js +4 -3
- package/dist/kpi-card/index.js +2 -2
- package/dist/markdown/index.d.ts +19 -2
- package/dist/markdown/index.js +3 -2
- package/dist/mega-menu/index.d.ts +95 -7
- package/dist/mega-menu/index.js +7 -2
- package/dist/menu-grid/index.d.ts +2 -3
- package/dist/menu-grid/index.js +2 -2
- package/dist/menu-grid-item/index.d.ts +6 -8
- package/dist/menu-grid-item/index.js +2 -2
- package/dist/menu-item/index.d.ts +11 -7
- package/dist/menu-item/index.js +3 -2
- package/dist/plan-cards/index.d.ts +69 -0
- package/dist/plan-cards/index.js +13 -0
- package/dist/plan-cards/index.js.map +1 -0
- package/dist/product-nav/index.d.ts +127 -0
- package/dist/product-nav/index.js +11 -0
- package/dist/product-nav/index.js.map +1 -0
- package/dist/promo-banner/index.d.ts +42 -4
- package/dist/promo-banner/index.js +6 -3
- package/dist/quote-dialog/index.d.ts +174 -0
- package/dist/quote-dialog/index.js +22 -0
- package/dist/quote-dialog/index.js.map +1 -0
- package/dist/schema/index.d.ts +11 -0
- package/dist/schema/index.js +9 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/screenshot-tour/index.d.ts +54 -0
- package/dist/screenshot-tour/index.js +9 -0
- package/dist/screenshot-tour/index.js.map +1 -0
- package/dist/section/index.d.ts +3 -0
- package/dist/section/index.js +3 -3
- package/dist/segmented-control/index.js +2 -2
- package/dist/select/index.js +2 -2
- package/dist/shared/styles.d.ts +7 -1
- package/dist/shared/styles.js +3 -1
- package/dist/stats/index.js +2 -2
- package/dist/steps/index.d.ts +45 -0
- package/dist/steps/index.js +11 -0
- package/dist/steps/index.js.map +1 -0
- package/dist/tag-strip/index.d.ts +33 -0
- package/dist/tag-strip/index.js +9 -0
- package/dist/tag-strip/index.js.map +1 -0
- package/dist/testimonials/index.d.ts +9 -1
- package/dist/testimonials/index.js +3 -3
- package/dist/tooltip/index.js +2 -2
- package/package.json +38 -2
- package/dist/chunk-5EBWMPJS.js.map +0 -1
- package/dist/chunk-76AVBQUA.js +0 -252
- package/dist/chunk-76AVBQUA.js.map +0 -1
- package/dist/chunk-7NLZND6Q.js.map +0 -1
- package/dist/chunk-ALI26WOB.js.map +0 -1
- package/dist/chunk-BMHMNXIA.js +0 -158
- package/dist/chunk-BMHMNXIA.js.map +0 -1
- package/dist/chunk-DH53HZPB.js.map +0 -1
- package/dist/chunk-EMCQBT3S.js.map +0 -1
- package/dist/chunk-FLY7TNRT.js.map +0 -1
- package/dist/chunk-FZ36KL73.js.map +0 -1
- package/dist/chunk-GJO3RGOB.js.map +0 -1
- package/dist/chunk-J6EO4R73.js +0 -633
- package/dist/chunk-J6EO4R73.js.map +0 -1
- package/dist/chunk-JKBWZLG4.js +0 -348
- package/dist/chunk-JKBWZLG4.js.map +0 -1
- package/dist/chunk-JQY2G4QK.js.map +0 -1
- package/dist/chunk-KMU6ABQF.js.map +0 -1
- package/dist/chunk-LEXZKGQX.js.map +0 -1
- package/dist/chunk-MSSH3HFK.js +0 -205
- package/dist/chunk-MSSH3HFK.js.map +0 -1
- package/dist/chunk-R5G6KFTJ.js.map +0 -1
- package/dist/chunk-SMLR736E.js.map +0 -1
- package/dist/chunk-VWS53WY4.js +0 -157
- package/dist/chunk-VWS53WY4.js.map +0 -1
- package/dist/chunk-WT4OATGP.js.map +0 -1
- package/dist/chunk-XWB4CKDU.js +0 -708
- package/dist/chunk-XWB4CKDU.js.map +0 -1
- package/dist/chunk-YQ42EBK5.js.map +0 -1
- package/dist/chunk-ZN4LIKVG.js.map +0 -1
- /package/dist/{chunk-AKJQ345O.js.map → chunk-5AWGZQWU.js.map} +0 -0
- /package/dist/{chunk-BLQV2YMO.js.map → chunk-EZOKT7NJ.js.map} +0 -0
- /package/dist/{chunk-6D6ROU7X.js.map → chunk-IGMVF3KK.js.map} +0 -0
- /package/dist/{chunk-INMSEYT6.js.map → chunk-IVPVYVWG.js.map} +0 -0
- /package/dist/{chunk-35TX3AOA.js.map → chunk-NABSRUXG.js.map} +0 -0
- /package/dist/{chunk-MG2VTZA4.js.map → chunk-QS3ANOWN.js.map} +0 -0
- /package/dist/{chunk-FML6AG2V.js.map → chunk-RANC3OI6.js.map} +0 -0
- /package/dist/{chunk-YVTFQHVY.js.map → chunk-TEAZZPDQ.js.map} +0 -0
- /package/dist/{chunk-AG2COC64.js.map → chunk-VVYQ2DDS.js.map} +0 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MODAL_OPEN_ATTRIBUTE
|
|
3
|
+
} from "./chunk-WAMOAAMN.js";
|
|
4
|
+
import {
|
|
5
|
+
buttonResetStyles,
|
|
6
|
+
controlBaseStyles,
|
|
7
|
+
rootFontFamilyStyles
|
|
8
|
+
} from "./chunk-NXUS2CH7.js";
|
|
9
|
+
import {
|
|
10
|
+
__decorateClass
|
|
11
|
+
} from "./chunk-EUXUH3YW.js";
|
|
12
|
+
|
|
13
|
+
// src/cookie-consent/CookieConsent.ts
|
|
14
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
15
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
+
var MODAL_HIDDEN_ATTRIBUTE = "data-st-modal-hidden";
|
|
17
|
+
var DRAWER_OPEN_ATTRIBUTE = "data-st-drawer-open";
|
|
18
|
+
var DRAWER_HIDDEN_ATTRIBUTE = "data-st-drawer-hidden";
|
|
19
|
+
var BANNER_HEIGHT_PROPERTY = "--st-cookie-banner-height";
|
|
20
|
+
var DEFAULT_STORAGE_KEY = "sankhya_ui_cookie_consent";
|
|
21
|
+
var DEFAULT_MESSAGE = "We use cookies that are needed for this site to work. With your permission we would also use optional cookies; they stay off until you accept them.";
|
|
22
|
+
var CookieConsent = class extends LitElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.message = "";
|
|
26
|
+
this.acceptButtonText = "Accept";
|
|
27
|
+
this.refuseButtonText = "Reject";
|
|
28
|
+
this.settingsButtonText = "Settings";
|
|
29
|
+
this.saveButtonText = "Save choices";
|
|
30
|
+
this.settingsHeading = "Cookie settings";
|
|
31
|
+
this.categories = [];
|
|
32
|
+
this.privacyPolicyLink = "";
|
|
33
|
+
this.privacyPolicyText = "Privacy Policy";
|
|
34
|
+
this.storageKey = DEFAULT_STORAGE_KEY;
|
|
35
|
+
this.consent = null;
|
|
36
|
+
this.settingsOpen = false;
|
|
37
|
+
this.picked = {};
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
this.consent = this.readStored();
|
|
42
|
+
this.pageObserver = new MutationObserver(() => this.syncPageState());
|
|
43
|
+
this.pageObserver.observe(document.documentElement, {
|
|
44
|
+
attributes: true,
|
|
45
|
+
attributeFilter: [MODAL_OPEN_ATTRIBUTE, DRAWER_OPEN_ATTRIBUTE]
|
|
46
|
+
});
|
|
47
|
+
this.sizeObserver = new ResizeObserver(() => this.publishBannerHeight());
|
|
48
|
+
this.sizeObserver.observe(this);
|
|
49
|
+
this.syncPageState();
|
|
50
|
+
}
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
this.pageObserver?.disconnect();
|
|
53
|
+
this.pageObserver = void 0;
|
|
54
|
+
this.sizeObserver?.disconnect();
|
|
55
|
+
this.sizeObserver = void 0;
|
|
56
|
+
document.documentElement.style.removeProperty(BANNER_HEIGHT_PROPERTY);
|
|
57
|
+
super.disconnectedCallback();
|
|
58
|
+
}
|
|
59
|
+
updated() {
|
|
60
|
+
this.publishBannerHeight();
|
|
61
|
+
}
|
|
62
|
+
/** Follows the page: a modal hides and disables the bar, an open nav drawer hides it (the stored choice is untouched). */
|
|
63
|
+
syncPageState() {
|
|
64
|
+
const root = document.documentElement;
|
|
65
|
+
const blocked = root.hasAttribute(MODAL_OPEN_ATTRIBUTE);
|
|
66
|
+
this.toggleAttribute(MODAL_HIDDEN_ATTRIBUTE, blocked);
|
|
67
|
+
this.toggleAttribute("inert", blocked);
|
|
68
|
+
this.toggleAttribute(DRAWER_HIDDEN_ATTRIBUTE, root.hasAttribute(DRAWER_OPEN_ATTRIBUTE));
|
|
69
|
+
this.publishBannerHeight();
|
|
70
|
+
}
|
|
71
|
+
/** Publishes the bar's height on <html> while it is shown; removes it once dismissed or hidden. */
|
|
72
|
+
publishBannerHeight() {
|
|
73
|
+
const root = document.documentElement;
|
|
74
|
+
const shown = this.isConnected && this.consent === null && !this.hasAttribute(DRAWER_HIDDEN_ATTRIBUTE);
|
|
75
|
+
if (!shown) {
|
|
76
|
+
root.style.removeProperty(BANNER_HEIGHT_PROPERTY);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
root.style.setProperty(BANNER_HEIGHT_PROPERTY, `${this.getBoundingClientRect().height}px`);
|
|
80
|
+
}
|
|
81
|
+
readStored() {
|
|
82
|
+
try {
|
|
83
|
+
const saved = localStorage.getItem(this.storageKey);
|
|
84
|
+
if (saved === "accepted" || saved === "refused") return { status: saved };
|
|
85
|
+
if (saved?.startsWith("{")) {
|
|
86
|
+
const parsed = JSON.parse(saved);
|
|
87
|
+
if (parsed.status === "custom" && parsed.categories && typeof parsed.categories === "object") return parsed;
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
} catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** Every category id mapped to whether it is allowed under `status`. */
|
|
95
|
+
allowedFor(status, picked) {
|
|
96
|
+
return Object.fromEntries(
|
|
97
|
+
this.categories.map((category) => [
|
|
98
|
+
category.id,
|
|
99
|
+
Boolean(category.required) || status === "accepted" || status === "custom" && Boolean(picked[category.id])
|
|
100
|
+
])
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
choose(status) {
|
|
104
|
+
const categories = this.allowedFor(status, this.picked);
|
|
105
|
+
const stored = status === "custom" ? { status, categories } : { status };
|
|
106
|
+
this.consent = stored;
|
|
107
|
+
try {
|
|
108
|
+
localStorage.setItem(this.storageKey, status === "custom" ? JSON.stringify(stored) : status);
|
|
109
|
+
} catch {
|
|
110
|
+
}
|
|
111
|
+
const name = { accepted: "cookie-consent-accept", refused: "cookie-consent-refuse", custom: "cookie-consent-save" }[status];
|
|
112
|
+
this.dispatchEvent(new CustomEvent(name, { detail: { status, categories }, bubbles: true, composed: true }));
|
|
113
|
+
}
|
|
114
|
+
toggleSettings() {
|
|
115
|
+
this.settingsOpen = !this.settingsOpen;
|
|
116
|
+
if (this.settingsOpen) {
|
|
117
|
+
void this.updateComplete.then(() => this.renderRoot.querySelector(".settings input:not([disabled])")?.focus());
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
renderLink() {
|
|
121
|
+
if (!this.privacyPolicyLink) return nothing;
|
|
122
|
+
const external = /^[a-z][a-z0-9+.-]*:/i.test(this.privacyPolicyLink);
|
|
123
|
+
return external ? html`<a class="link" part="link" href=${this.privacyPolicyLink} target="_blank" rel="noopener noreferrer">${this.privacyPolicyText}</a>` : html`<a class="link" part="link" href=${this.privacyPolicyLink}>${this.privacyPolicyText}</a>`;
|
|
124
|
+
}
|
|
125
|
+
renderSettings() {
|
|
126
|
+
return html`<fieldset class="settings" part="settings" id="cookie-settings">
|
|
127
|
+
<legend>${this.settingsHeading}</legend>
|
|
128
|
+
${this.categories.map(
|
|
129
|
+
(category) => html`<label class="category">
|
|
130
|
+
<input
|
|
131
|
+
type="checkbox"
|
|
132
|
+
name=${category.id}
|
|
133
|
+
.checked=${Boolean(category.required) || Boolean(this.picked[category.id])}
|
|
134
|
+
?disabled=${category.required}
|
|
135
|
+
@change=${(event) => this.picked = { ...this.picked, [category.id]: event.target.checked }}
|
|
136
|
+
/>
|
|
137
|
+
<span>
|
|
138
|
+
<span class="category-label">${category.label}</span>
|
|
139
|
+
${category.description ? html`<span class="category-description">${category.description}</span>` : nothing}
|
|
140
|
+
</span>
|
|
141
|
+
</label>`
|
|
142
|
+
)}
|
|
143
|
+
<div class="actions">
|
|
144
|
+
<button class="btn save" part="save" type="button" @click=${() => this.choose("custom")}>${this.saveButtonText}</button>
|
|
145
|
+
</div>
|
|
146
|
+
</fieldset>`;
|
|
147
|
+
}
|
|
148
|
+
render() {
|
|
149
|
+
if (this.consent !== null) return nothing;
|
|
150
|
+
const hasSettings = this.categories.length > 0 && Boolean(this.settingsButtonText);
|
|
151
|
+
return html`
|
|
152
|
+
<div class="bar">
|
|
153
|
+
<div class="content" part="content">
|
|
154
|
+
<p class="message" part="message">
|
|
155
|
+
<slot>${this.message || DEFAULT_MESSAGE} ${this.renderLink()}</slot>
|
|
156
|
+
</p>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="actions" part="actions">
|
|
159
|
+
${hasSettings ? html`<button
|
|
160
|
+
class="btn settings-toggle"
|
|
161
|
+
part="settings-toggle"
|
|
162
|
+
type="button"
|
|
163
|
+
aria-expanded=${this.settingsOpen ? "true" : "false"}
|
|
164
|
+
aria-controls="cookie-settings"
|
|
165
|
+
@click=${this.toggleSettings}
|
|
166
|
+
>
|
|
167
|
+
${this.settingsButtonText}
|
|
168
|
+
</button>` : nothing}
|
|
169
|
+
<button class="btn refuse" part="refuse" type="button" @click=${() => this.choose("refused")}>${this.refuseButtonText}</button>
|
|
170
|
+
<button class="btn accept" part="accept" type="button" @click=${() => this.choose("accepted")}>${this.acceptButtonText}</button>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
${hasSettings && this.settingsOpen ? this.renderSettings() : nothing}
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
CookieConsent.styles = css`
|
|
178
|
+
${controlBaseStyles}
|
|
179
|
+
|
|
180
|
+
@keyframes st-cookie-slide-up {
|
|
181
|
+
from {
|
|
182
|
+
transform: translateY(100%);
|
|
183
|
+
}
|
|
184
|
+
to {
|
|
185
|
+
transform: translateY(0);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
:host {
|
|
190
|
+
position: fixed;
|
|
191
|
+
bottom: 0;
|
|
192
|
+
left: 0;
|
|
193
|
+
width: 100%;
|
|
194
|
+
max-height: 100vh;
|
|
195
|
+
overflow-y: auto;
|
|
196
|
+
box-sizing: border-box;
|
|
197
|
+
z-index: 9999;
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
gap: var(--st-space-12);
|
|
201
|
+
/* Compact on a phone: the padding is the mobile value; the desktop rule below widens it.
|
|
202
|
+
!important: a page-level reset (e.g. Tailwind Preflight) otherwise zeroes a shadow host's
|
|
203
|
+
padding; override with --st-cookie-consent-padding instead. */
|
|
204
|
+
padding: var(--st-cookie-consent-padding, var(--st-space-16)) !important;
|
|
205
|
+
background: var(--st-color-surface);
|
|
206
|
+
color: var(--st-color-text);
|
|
207
|
+
border-top: 1px solid var(--st-color-border);
|
|
208
|
+
box-shadow: 0 -4px 10px var(--st-shadow-color-sm);
|
|
209
|
+
animation: st-cookie-slide-up 0.3s ease-out;
|
|
210
|
+
${rootFontFamilyStyles}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
:host([data-st-modal-hidden]) {
|
|
214
|
+
visibility: hidden;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
:host([data-st-drawer-hidden]) {
|
|
218
|
+
display: none;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.bar {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
gap: var(--st-space-12);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.content {
|
|
228
|
+
flex: 1;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.message {
|
|
232
|
+
margin: 0;
|
|
233
|
+
font-size: var(--st-text-sm);
|
|
234
|
+
line-height: 1.5;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* Phone: the copy at 14px (the smallest body size the site uses). */
|
|
238
|
+
@media (max-width: 767px) {
|
|
239
|
+
.message {
|
|
240
|
+
font-size: 14px;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.link {
|
|
245
|
+
color: var(--st-color-accent-text);
|
|
246
|
+
text-decoration: underline;
|
|
247
|
+
margin-left: var(--st-space-4);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.link:hover {
|
|
251
|
+
text-decoration: none;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* One row of buttons on every screen. On a phone they share the row equally. */
|
|
255
|
+
.actions {
|
|
256
|
+
display: flex;
|
|
257
|
+
flex-wrap: nowrap;
|
|
258
|
+
gap: var(--st-space-12);
|
|
259
|
+
flex-shrink: 0;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.btn {
|
|
263
|
+
${buttonResetStyles}
|
|
264
|
+
flex: 1 1 0;
|
|
265
|
+
min-width: 0;
|
|
266
|
+
min-height: 44px;
|
|
267
|
+
padding: 0 var(--st-space-12);
|
|
268
|
+
border: 1px solid transparent;
|
|
269
|
+
border-radius: 9999px;
|
|
270
|
+
font-weight: var(--st-font-weight-semibold);
|
|
271
|
+
font-size: var(--st-text-md);
|
|
272
|
+
white-space: nowrap;
|
|
273
|
+
transition:
|
|
274
|
+
background-color 0.2s ease,
|
|
275
|
+
color 0.2s ease;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.btn:focus-visible {
|
|
279
|
+
outline: 2px solid var(--st-color-accent);
|
|
280
|
+
outline-offset: 2px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* Reject and Accept carry the same weight (refusing must be as easy as accepting): the same size,
|
|
284
|
+
type and outline. Settings uses the same outline. */
|
|
285
|
+
.refuse,
|
|
286
|
+
.accept,
|
|
287
|
+
.settings-toggle {
|
|
288
|
+
background: var(--st-color-surface);
|
|
289
|
+
border-color: var(--st-color-text-strong);
|
|
290
|
+
color: var(--st-color-text-strong);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.refuse:hover,
|
|
294
|
+
.accept:hover,
|
|
295
|
+
.settings-toggle:hover {
|
|
296
|
+
background: var(--st-color-hover);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* The settings panel's save button is the one primary action in that panel. */
|
|
300
|
+
.save {
|
|
301
|
+
background: var(--st-button-primary-bg);
|
|
302
|
+
border-color: transparent;
|
|
303
|
+
color: var(--st-button-primary-color);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.save:hover {
|
|
307
|
+
opacity: 0.9;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.settings {
|
|
311
|
+
display: flex;
|
|
312
|
+
flex-direction: column;
|
|
313
|
+
gap: var(--st-space-12);
|
|
314
|
+
margin: 0;
|
|
315
|
+
padding: var(--st-space-16) 0 0;
|
|
316
|
+
border: 0;
|
|
317
|
+
border-top: 1px solid var(--st-color-border);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.settings legend {
|
|
321
|
+
padding: 0;
|
|
322
|
+
margin-bottom: var(--st-space-8);
|
|
323
|
+
font-weight: var(--st-font-weight-semibold);
|
|
324
|
+
color: var(--st-color-text-strong);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.category {
|
|
328
|
+
display: flex;
|
|
329
|
+
gap: var(--st-space-12);
|
|
330
|
+
align-items: flex-start;
|
|
331
|
+
font-size: var(--st-text-md);
|
|
332
|
+
line-height: 1.5;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.category input {
|
|
336
|
+
width: 18px;
|
|
337
|
+
height: 18px;
|
|
338
|
+
margin: 3px 0 0;
|
|
339
|
+
flex: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.category-label {
|
|
343
|
+
font-weight: var(--st-font-weight-semibold);
|
|
344
|
+
color: var(--st-color-text-strong);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.category-description {
|
|
348
|
+
display: block;
|
|
349
|
+
color: var(--st-color-text);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
@media (min-width: 768px) {
|
|
353
|
+
:host {
|
|
354
|
+
gap: var(--st-space-16);
|
|
355
|
+
padding: var(--st-cookie-consent-padding, var(--st-space-16) var(--st-space-32)) !important;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.bar {
|
|
359
|
+
flex-direction: row;
|
|
360
|
+
align-items: center;
|
|
361
|
+
justify-content: space-between;
|
|
362
|
+
gap: var(--st-space-16);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.btn {
|
|
366
|
+
flex: none;
|
|
367
|
+
padding: 0 var(--st-space-20);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@media (prefers-reduced-motion: reduce) {
|
|
372
|
+
:host {
|
|
373
|
+
animation: none;
|
|
374
|
+
}
|
|
375
|
+
.btn {
|
|
376
|
+
transition: none;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
`;
|
|
380
|
+
__decorateClass([
|
|
381
|
+
property({ type: String })
|
|
382
|
+
], CookieConsent.prototype, "message", 2);
|
|
383
|
+
__decorateClass([
|
|
384
|
+
property({ type: String, attribute: "accept-button-text" })
|
|
385
|
+
], CookieConsent.prototype, "acceptButtonText", 2);
|
|
386
|
+
__decorateClass([
|
|
387
|
+
property({ type: String, attribute: "refuse-button-text" })
|
|
388
|
+
], CookieConsent.prototype, "refuseButtonText", 2);
|
|
389
|
+
__decorateClass([
|
|
390
|
+
property({ type: String, attribute: "settings-button-text" })
|
|
391
|
+
], CookieConsent.prototype, "settingsButtonText", 2);
|
|
392
|
+
__decorateClass([
|
|
393
|
+
property({ type: String, attribute: "save-button-text" })
|
|
394
|
+
], CookieConsent.prototype, "saveButtonText", 2);
|
|
395
|
+
__decorateClass([
|
|
396
|
+
property({ type: String, attribute: "settings-heading" })
|
|
397
|
+
], CookieConsent.prototype, "settingsHeading", 2);
|
|
398
|
+
__decorateClass([
|
|
399
|
+
property({ attribute: false })
|
|
400
|
+
], CookieConsent.prototype, "categories", 2);
|
|
401
|
+
__decorateClass([
|
|
402
|
+
property({ type: String, attribute: "privacy-policy-link" })
|
|
403
|
+
], CookieConsent.prototype, "privacyPolicyLink", 2);
|
|
404
|
+
__decorateClass([
|
|
405
|
+
property({ type: String, attribute: "privacy-policy-text" })
|
|
406
|
+
], CookieConsent.prototype, "privacyPolicyText", 2);
|
|
407
|
+
__decorateClass([
|
|
408
|
+
property({ type: String, attribute: "storage-key" })
|
|
409
|
+
], CookieConsent.prototype, "storageKey", 2);
|
|
410
|
+
__decorateClass([
|
|
411
|
+
state()
|
|
412
|
+
], CookieConsent.prototype, "consent", 2);
|
|
413
|
+
__decorateClass([
|
|
414
|
+
state()
|
|
415
|
+
], CookieConsent.prototype, "settingsOpen", 2);
|
|
416
|
+
__decorateClass([
|
|
417
|
+
state()
|
|
418
|
+
], CookieConsent.prototype, "picked", 2);
|
|
419
|
+
CookieConsent = __decorateClass([
|
|
420
|
+
customElement("st-cookie-consent")
|
|
421
|
+
], CookieConsent);
|
|
422
|
+
|
|
423
|
+
export {
|
|
424
|
+
CookieConsent
|
|
425
|
+
};
|
|
426
|
+
//# sourceMappingURL=chunk-EKZFFY45.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cookie-consent/CookieConsent.ts"],"sourcesContent":["import { LitElement, css, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { MODAL_OPEN_ATTRIBUTE } from '../shared/modal-state';\nimport { buttonResetStyles, controlBaseStyles, rootFontFamilyStyles } from '../shared/styles';\nimport type { CookieCategory, CookieConsentEventDetail, CookieConsentStatus } from './CookieConsentEvents';\n\n/** Host attribute set while a modal is open: the bar is hidden and inert until it closes. */\nconst MODAL_HIDDEN_ATTRIBUTE = 'data-st-modal-hidden';\n/** `<html>` attribute set while the mobile nav drawer is open (by st-header). */\nconst DRAWER_OPEN_ATTRIBUTE = 'data-st-drawer-open';\n/** Host attribute set while the drawer is open: the bar is hidden until it closes. */\nconst DRAWER_HIDDEN_ATTRIBUTE = 'data-st-drawer-hidden';\n/** `<html>` custom property holding the bar's height while it is shown, so the footer can pad past it. */\nconst BANNER_HEIGHT_PROPERTY = '--st-cookie-banner-height';\n\nconst DEFAULT_STORAGE_KEY = 'sankhya_ui_cookie_consent';\n\nconst DEFAULT_MESSAGE =\n 'We use cookies that are needed for this site to work. With your permission we would also use optional cookies; they stay off until you accept them.';\n\ninterface StoredConsent {\n status: CookieConsentStatus;\n /** Only stored for `custom`: the optional categories the visitor allowed. */\n categories?: Record<string, boolean>;\n}\n\n/**\n * Fixed bottom consent bar with explicit choices: accept all, reject all optional cookies, or (with\n * `categories` and a `settings-button-text`) open a settings panel to allow categories one by one.\n * Optional categories are off until the visitor turns them on. The choice is kept in localStorage\n * (`storage-key`, default `sankhya_ui_cookie_consent`; storage errors are ignored) and the bar renders\n * nothing once a choice exists. Fires `cookie-consent-accept`, `cookie-consent-refuse` or\n * `cookie-consent-save` (detail `{ status, categories }`). The default slot replaces the message\n * text. `privacy-policy-link` opens in the same tab for a site path, in a new tab for an external URL.\n *\n * While a modal is open (`<html data-st-modal-open>`, set by st-quote-dialog) the bar is hidden\n * (`visibility: hidden`) and inert, and it reappears unchanged when the modal closes. While the mobile\n * nav drawer is open (`<html data-st-drawer-open>`, set by st-header) the bar is not displayed.\n *\n * While the bar is shown its height is published as `--st-cookie-banner-height` on `<html>` (removed\n * when it is dismissed), so a page's footer can pad its last row above the bar.\n *\n * @fires cookie-consent-accept - Every category allowed.\n * @fires cookie-consent-refuse - Only required categories allowed.\n * @fires cookie-consent-save - The categories picked in the settings panel.\n * @cssprop --st-cookie-consent-padding - Overrides the bar's padding.\n * @csspart settings - The settings panel.\n */\n@customElement('st-cookie-consent')\nexport class CookieConsent extends LitElement {\n static styles = css`\n ${controlBaseStyles}\n\n @keyframes st-cookie-slide-up {\n from {\n transform: translateY(100%);\n }\n to {\n transform: translateY(0);\n }\n }\n\n :host {\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100%;\n max-height: 100vh;\n overflow-y: auto;\n box-sizing: border-box;\n z-index: 9999;\n display: flex;\n flex-direction: column;\n gap: var(--st-space-12);\n /* Compact on a phone: the padding is the mobile value; the desktop rule below widens it.\n !important: a page-level reset (e.g. Tailwind Preflight) otherwise zeroes a shadow host's\n padding; override with --st-cookie-consent-padding instead. */\n padding: var(--st-cookie-consent-padding, var(--st-space-16)) !important;\n background: var(--st-color-surface);\n color: var(--st-color-text);\n border-top: 1px solid var(--st-color-border);\n box-shadow: 0 -4px 10px var(--st-shadow-color-sm);\n animation: st-cookie-slide-up 0.3s ease-out;\n ${rootFontFamilyStyles}\n }\n\n :host([data-st-modal-hidden]) {\n visibility: hidden;\n }\n\n :host([data-st-drawer-hidden]) {\n display: none;\n }\n\n .bar {\n display: flex;\n flex-direction: column;\n gap: var(--st-space-12);\n }\n\n .content {\n flex: 1;\n }\n\n .message {\n margin: 0;\n font-size: var(--st-text-sm);\n line-height: 1.5;\n }\n\n /* Phone: the copy at 14px (the smallest body size the site uses). */\n @media (max-width: 767px) {\n .message {\n font-size: 14px;\n }\n }\n\n .link {\n color: var(--st-color-accent-text);\n text-decoration: underline;\n margin-left: var(--st-space-4);\n }\n\n .link:hover {\n text-decoration: none;\n }\n\n /* One row of buttons on every screen. On a phone they share the row equally. */\n .actions {\n display: flex;\n flex-wrap: nowrap;\n gap: var(--st-space-12);\n flex-shrink: 0;\n }\n\n .btn {\n ${buttonResetStyles}\n flex: 1 1 0;\n min-width: 0;\n min-height: 44px;\n padding: 0 var(--st-space-12);\n border: 1px solid transparent;\n border-radius: 9999px;\n font-weight: var(--st-font-weight-semibold);\n font-size: var(--st-text-md);\n white-space: nowrap;\n transition:\n background-color 0.2s ease,\n color 0.2s ease;\n }\n\n .btn:focus-visible {\n outline: 2px solid var(--st-color-accent);\n outline-offset: 2px;\n }\n\n /* Reject and Accept carry the same weight (refusing must be as easy as accepting): the same size,\n type and outline. Settings uses the same outline. */\n .refuse,\n .accept,\n .settings-toggle {\n background: var(--st-color-surface);\n border-color: var(--st-color-text-strong);\n color: var(--st-color-text-strong);\n }\n\n .refuse:hover,\n .accept:hover,\n .settings-toggle:hover {\n background: var(--st-color-hover);\n }\n\n /* The settings panel's save button is the one primary action in that panel. */\n .save {\n background: var(--st-button-primary-bg);\n border-color: transparent;\n color: var(--st-button-primary-color);\n }\n\n .save:hover {\n opacity: 0.9;\n }\n\n .settings {\n display: flex;\n flex-direction: column;\n gap: var(--st-space-12);\n margin: 0;\n padding: var(--st-space-16) 0 0;\n border: 0;\n border-top: 1px solid var(--st-color-border);\n }\n\n .settings legend {\n padding: 0;\n margin-bottom: var(--st-space-8);\n font-weight: var(--st-font-weight-semibold);\n color: var(--st-color-text-strong);\n }\n\n .category {\n display: flex;\n gap: var(--st-space-12);\n align-items: flex-start;\n font-size: var(--st-text-md);\n line-height: 1.5;\n }\n\n .category input {\n width: 18px;\n height: 18px;\n margin: 3px 0 0;\n flex: none;\n }\n\n .category-label {\n font-weight: var(--st-font-weight-semibold);\n color: var(--st-color-text-strong);\n }\n\n .category-description {\n display: block;\n color: var(--st-color-text);\n }\n\n @media (min-width: 768px) {\n :host {\n gap: var(--st-space-16);\n padding: var(--st-cookie-consent-padding, var(--st-space-16) var(--st-space-32)) !important;\n }\n\n .bar {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: var(--st-space-16);\n }\n\n .btn {\n flex: none;\n padding: 0 var(--st-space-20);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host {\n animation: none;\n }\n .btn {\n transition: none;\n }\n }\n `;\n\n @property({ type: String })\n message = '';\n\n @property({ type: String, attribute: 'accept-button-text' })\n acceptButtonText = 'Accept';\n\n @property({ type: String, attribute: 'refuse-button-text' })\n refuseButtonText = 'Reject';\n\n /** Label of the button that opens the settings panel. Shown only with `categories`. */\n @property({ type: String, attribute: 'settings-button-text' })\n settingsButtonText = 'Settings';\n\n @property({ type: String, attribute: 'save-button-text' })\n saveButtonText = 'Save choices';\n\n @property({ type: String, attribute: 'settings-heading' })\n settingsHeading = 'Cookie settings';\n\n /** Cookie groups for the settings panel. Without any, the bar only offers accept and reject. */\n @property({ attribute: false })\n categories: CookieCategory[] = [];\n\n @property({ type: String, attribute: 'privacy-policy-link' })\n privacyPolicyLink = '';\n\n @property({ type: String, attribute: 'privacy-policy-text' })\n privacyPolicyText = 'Privacy Policy';\n\n @property({ type: String, attribute: 'storage-key' })\n storageKey = DEFAULT_STORAGE_KEY;\n\n /** The stored choice, or `null` while undecided (the bar is only shown then). */\n @state() private consent: StoredConsent | null = null;\n @state() private settingsOpen = false;\n /** Optional categories ticked in the settings panel (all off until the visitor ticks them). */\n @state() private picked: Record<string, boolean> = {};\n\n private pageObserver?: MutationObserver;\n private sizeObserver?: ResizeObserver;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.consent = this.readStored();\n this.pageObserver = new MutationObserver(() => this.syncPageState());\n this.pageObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [MODAL_OPEN_ATTRIBUTE, DRAWER_OPEN_ATTRIBUTE]\n });\n this.sizeObserver = new ResizeObserver(() => this.publishBannerHeight());\n this.sizeObserver.observe(this);\n this.syncPageState();\n }\n\n disconnectedCallback(): void {\n this.pageObserver?.disconnect();\n this.pageObserver = undefined;\n this.sizeObserver?.disconnect();\n this.sizeObserver = undefined;\n document.documentElement.style.removeProperty(BANNER_HEIGHT_PROPERTY);\n super.disconnectedCallback();\n }\n\n protected updated(): void {\n this.publishBannerHeight();\n }\n\n /** Follows the page: a modal hides and disables the bar, an open nav drawer hides it (the stored choice is untouched). */\n private syncPageState(): void {\n const root = document.documentElement;\n const blocked = root.hasAttribute(MODAL_OPEN_ATTRIBUTE);\n this.toggleAttribute(MODAL_HIDDEN_ATTRIBUTE, blocked);\n this.toggleAttribute('inert', blocked);\n this.toggleAttribute(DRAWER_HIDDEN_ATTRIBUTE, root.hasAttribute(DRAWER_OPEN_ATTRIBUTE));\n this.publishBannerHeight();\n }\n\n /** Publishes the bar's height on <html> while it is shown; removes it once dismissed or hidden. */\n private publishBannerHeight(): void {\n const root = document.documentElement;\n const shown = this.isConnected && this.consent === null && !this.hasAttribute(DRAWER_HIDDEN_ATTRIBUTE);\n if (!shown) {\n root.style.removeProperty(BANNER_HEIGHT_PROPERTY);\n return;\n }\n // The height is the box's own: the slide-up animation moves it with a transform, which does not change it.\n root.style.setProperty(BANNER_HEIGHT_PROPERTY, `${this.getBoundingClientRect().height}px`);\n }\n\n private readStored(): StoredConsent | null {\n try {\n const saved = localStorage.getItem(this.storageKey);\n if (saved === 'accepted' || saved === 'refused') return { status: saved };\n if (saved?.startsWith('{')) {\n const parsed = JSON.parse(saved) as StoredConsent;\n if (parsed.status === 'custom' && parsed.categories && typeof parsed.categories === 'object') return parsed;\n }\n return null;\n } catch {\n return null;\n }\n }\n\n /** Every category id mapped to whether it is allowed under `status`. */\n private allowedFor(status: CookieConsentStatus, picked: Record<string, boolean>): Record<string, boolean> {\n return Object.fromEntries(\n this.categories.map(category => [\n category.id,\n Boolean(category.required) || status === 'accepted' || (status === 'custom' && Boolean(picked[category.id]))\n ])\n );\n }\n\n private choose(status: CookieConsentStatus): void {\n const categories = this.allowedFor(status, this.picked);\n const stored: StoredConsent = status === 'custom' ? { status, categories } : { status };\n this.consent = stored;\n try {\n localStorage.setItem(this.storageKey, status === 'custom' ? JSON.stringify(stored) : status);\n } catch {\n // Storage unavailable (private mode, blocked): the choice just doesn't persist.\n }\n const name = { accepted: 'cookie-consent-accept', refused: 'cookie-consent-refuse', custom: 'cookie-consent-save' }[status];\n this.dispatchEvent(new CustomEvent<CookieConsentEventDetail>(name, { detail: { status, categories }, bubbles: true, composed: true }));\n }\n\n private toggleSettings(): void {\n this.settingsOpen = !this.settingsOpen;\n if (this.settingsOpen) {\n void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLInputElement>('.settings input:not([disabled])')?.focus());\n }\n }\n\n private renderLink() {\n if (!this.privacyPolicyLink) return nothing;\n const external = /^[a-z][a-z0-9+.-]*:/i.test(this.privacyPolicyLink);\n return external\n ? html`<a class=\"link\" part=\"link\" href=${this.privacyPolicyLink} target=\"_blank\" rel=\"noopener noreferrer\">${this.privacyPolicyText}</a>`\n : html`<a class=\"link\" part=\"link\" href=${this.privacyPolicyLink}>${this.privacyPolicyText}</a>`;\n }\n\n private renderSettings() {\n return html`<fieldset class=\"settings\" part=\"settings\" id=\"cookie-settings\">\n <legend>${this.settingsHeading}</legend>\n ${this.categories.map(\n category => html`<label class=\"category\">\n <input\n type=\"checkbox\"\n name=${category.id}\n .checked=${Boolean(category.required) || Boolean(this.picked[category.id])}\n ?disabled=${category.required}\n @change=${(event: Event) =>\n (this.picked = { ...this.picked, [category.id]: (event.target as HTMLInputElement).checked })}\n />\n <span>\n <span class=\"category-label\">${category.label}</span>\n ${category.description ? html`<span class=\"category-description\">${category.description}</span>` : nothing}\n </span>\n </label>`\n )}\n <div class=\"actions\">\n <button class=\"btn save\" part=\"save\" type=\"button\" @click=${() => this.choose('custom')}>${this.saveButtonText}</button>\n </div>\n </fieldset>`;\n }\n\n render() {\n if (this.consent !== null) return nothing;\n const hasSettings = this.categories.length > 0 && Boolean(this.settingsButtonText);\n return html`\n <div class=\"bar\">\n <div class=\"content\" part=\"content\">\n <p class=\"message\" part=\"message\">\n <slot>${this.message || DEFAULT_MESSAGE} ${this.renderLink()}</slot>\n </p>\n </div>\n <div class=\"actions\" part=\"actions\">\n ${hasSettings\n ? html`<button\n class=\"btn settings-toggle\"\n part=\"settings-toggle\"\n type=\"button\"\n aria-expanded=${this.settingsOpen ? 'true' : 'false'}\n aria-controls=\"cookie-settings\"\n @click=${this.toggleSettings}\n >\n ${this.settingsButtonText}\n </button>`\n : nothing}\n <button class=\"btn refuse\" part=\"refuse\" type=\"button\" @click=${() => this.choose('refused')}>${this.refuseButtonText}</button>\n <button class=\"btn accept\" part=\"accept\" type=\"button\" @click=${() => this.choose('accepted')}>${this.acceptButtonText}</button>\n </div>\n </div>\n ${hasSettings && this.settingsOpen ? this.renderSettings() : nothing}\n `;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,KAAK,MAAM,eAAe;AAC/C,SAAS,eAAe,UAAU,aAAa;AAO/C,IAAM,yBAAyB;AAE/B,IAAM,wBAAwB;AAE9B,IAAM,0BAA0B;AAEhC,IAAM,yBAAyB;AAE/B,IAAM,sBAAsB;AAE5B,IAAM,kBACJ;AA+BK,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC;AAAA;AA8ML,mBAAU;AAGV,4BAAmB;AAGnB,4BAAmB;AAInB,8BAAqB;AAGrB,0BAAiB;AAGjB,2BAAkB;AAIlB,sBAA+B,CAAC;AAGhC,6BAAoB;AAGpB,6BAAoB;AAGpB,sBAAa;AAGJ,SAAQ,UAAgC;AACxC,SAAQ,eAAe;AAEvB,SAAQ,SAAkC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":3,"sources":["../src/mega-menu/MegaMenuEvents.ts"],"sourcesContent":["export interface MegaMenuSelectEventDetail {\n href: string;\n}\n\n/**\n * Fired on `st-mega-menu` (bubbles, composed) when the number of grid tracks it lays out changes: the intro\n * column, each link column and the featured column. The `mega` dropdown around it uses this to keep a panel\n * with few columns from stretching to the full width.\n */\nexport const MEGA_MENU_LAYOUT_EVENT = 'st-mega-menu-layout';\n\nexport interface MegaMenuLayoutEventDetail {\n tracks: number;\n}\n"],"mappings":";AASO,IAAM,yBAAyB;","names":[]}
|