@consent.software/catalog 1.6.1 → 2.0.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.
Files changed (28) hide show
  1. package/dist_bundle/bundle.js +655 -329
  2. package/dist_bundle/bundle.js.map +4 -4
  3. package/dist_ts_web/00_commitinfo_data.js +1 -1
  4. package/dist_ts_web/elements/consentsoftware-cookieconsent.d.ts +7 -20
  5. package/dist_ts_web/elements/consentsoftware-cookieconsent.js +200 -252
  6. package/dist_ts_web/elements/consentsoftware-header.d.ts +3 -4
  7. package/dist_ts_web/elements/consentsoftware-header.js +35 -23
  8. package/dist_ts_web/elements/consentsoftware-mainselection.d.ts +4 -5
  9. package/dist_ts_web/elements/consentsoftware-mainselection.js +54 -28
  10. package/dist_ts_web/elements/consentsoftware-tabs.d.ts +4 -5
  11. package/dist_ts_web/elements/consentsoftware-tabs.js +44 -36
  12. package/dist_ts_web/elements/consentsoftware-toggle.d.ts +11 -9
  13. package/dist_ts_web/elements/consentsoftware-toggle.js +103 -94
  14. package/dist_ts_web/elements/shared.d.ts +35 -1
  15. package/dist_ts_web/elements/shared.js +36 -2
  16. package/dist_ts_web/pages/page1.d.ts +1 -1
  17. package/dist_ts_web/pages/page1.js +2 -2
  18. package/dist_watch/bundle.js +503 -437
  19. package/dist_watch/bundle.js.map +3 -3
  20. package/package.json +3 -3
  21. package/ts_web/00_commitinfo_data.ts +1 -1
  22. package/ts_web/elements/consentsoftware-cookieconsent.ts +218 -250
  23. package/ts_web/elements/consentsoftware-header.ts +40 -23
  24. package/ts_web/elements/consentsoftware-mainselection.ts +60 -30
  25. package/ts_web/elements/consentsoftware-tabs.ts +51 -37
  26. package/ts_web/elements/consentsoftware-toggle.ts +123 -107
  27. package/ts_web/elements/shared.ts +38 -2
  28. package/ts_web/pages/page1.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consent.software/catalog",
3
- "version": "1.6.1",
3
+ "version": "2.0.1",
4
4
  "private": false,
5
5
  "description": "A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.",
6
6
  "exports": {
@@ -12,8 +12,8 @@
12
12
  "dependencies": {
13
13
  "@consent.software/interfaces": "^1.0.14",
14
14
  "@consent.software/webclient": "^1.1.0",
15
- "@push.rocks/smartdelay": "^3.0.5",
16
- "lit": "^3.3.1"
15
+ "@design.estate/dees-element": "^2.1.3",
16
+ "@push.rocks/smartdelay": "^3.0.5"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@design.estate/dees-wcctools": "^1.2.1",
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@consent.software/catalog',
6
- version: '1.6.1',
6
+ version: '2.0.1',
7
7
  description: 'A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.'
8
8
  }
@@ -1,8 +1,12 @@
1
- import * as shared from './shared.js';
1
+ import { cssManager, colors } from './shared.js';
2
2
 
3
- import { LitElement, html, css, type TemplateResult } from 'lit';
4
- import { customElement } from 'lit/decorators.js';
5
- import { property } from 'lit/decorators/property.js';
3
+ import {
4
+ DeesElement,
5
+ customElement,
6
+ html,
7
+ css,
8
+ type TemplateResult,
9
+ } from '@design.estate/dees-element';
6
10
 
7
11
  import * as csInterfaces from '@consent.software/interfaces';
8
12
  import * as csWebclient from '@consent.software/webclient';
@@ -15,215 +19,191 @@ declare global {
15
19
  }
16
20
 
17
21
  @customElement('consentsoftware-cookieconsent')
18
- export class ConsentsoftwareCookieconsent extends LitElement {
22
+ export class ConsentsoftwareCookieconsent extends DeesElement {
19
23
  public static demo = () => html`<consentsoftware-cookieconsent></consentsoftware-cookieconsent>`;
20
24
 
21
25
  public csWebclientInstance = new csWebclient.CsWebclient();
22
26
  public csWebclientRan = false;
27
+ private isMobile = false;
28
+
29
+ public static styles = [
30
+ cssManager.defaultStyles,
31
+ css`
32
+ :host {
33
+ font-size: 14px;
34
+ user-select: none;
35
+ }
23
36
 
24
- // Reflects the current theme ('light' or 'dark')
25
- @property({ type: String, reflect: true })
26
- public accessor theme: 'light' | 'dark' = 'light';
37
+ .pageOverlay {
38
+ position: fixed;
39
+ inset: 0;
40
+ display: grid;
41
+ align-items: center;
42
+ justify-content: center;
43
+ z-index: 1000;
44
+ background: rgba(0, 0, 0, 0);
45
+ backdrop-filter: blur(0px);
46
+ transition: background 0.3s ease, backdrop-filter 0.3s ease;
47
+ }
27
48
 
28
- /**
29
- * Define component styles with CSS variables that adjust based on theme.
30
- * The default variables serve as baseline for the light theme.
31
- * Theme-specific overrides modify these for dark mode.
32
- */
33
- public static styles = css`
34
- :host {
35
- font-family: ${shared.fontStack};
36
- user-select: none;
37
- /* Default variables for Light Theme */
38
- --text-color: #333;
39
- --background-color: #eeeeee;
40
- --accent-color: #333333;
41
- --button-bg: #ffffff;
42
- --button-hover-bg: #f2f2f2;
43
- --icon-color: #4496f5;
44
- --link-color: #333;
45
- --padding-sides: 16px;
46
- /* Additional variables for modal and info container styling */
47
- --info-bg: rgba(0, 0, 0, 0.1);
48
- --info-text: rgba(255, 255, 255, 0.5);
49
- --modal-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
50
- }
49
+ .pageOverlay.shake {
50
+ background: rgba(0, 0, 0, 0.6) !important;
51
+ }
51
52
 
52
- /* Dark Theme Overrides:
53
- When theme attribute is 'dark', override variables accordingly. */
54
- :host([theme='dark']) {
55
- --text-color: #fff;
56
- --background-color: #111;
57
- --accent-color: #333333;
58
- --button-bg: #252525;
59
- --button-hover-bg: #222222;
60
- --icon-color: #4496f5;
61
- --link-color: #fff;
62
- --info-bg: rgba(0, 0, 0, 0.1);
63
- --info-text: rgba(255, 255, 255, 0.5);
64
- --modal-box-shadow: 0px 0px 8px rgba(255, 255, 255, 0.6);
65
- }
53
+ .modalBox {
54
+ display: block;
55
+ color: ${cssManager.bdTheme(colors.light.foreground, colors.dark.foreground)};
56
+ background: ${cssManager.bdTheme(colors.light.background, colors.dark.background)};
57
+ box-shadow:
58
+ 0 0 0 1px ${cssManager.bdTheme(colors.light.border, colors.dark.border)},
59
+ 0 16px 70px ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(0, 0, 0, 0.35)')};
60
+ position: relative;
61
+ border-radius: 8px;
62
+ max-width: 520px;
63
+ min-width: 320px;
64
+ box-sizing: border-box;
65
+ overflow: hidden;
66
+ will-change: transform, opacity;
67
+ transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
68
+ transform: scale(0.92) translateY(20px);
69
+ opacity: 0;
70
+ }
66
71
 
67
- /* Light Theme Overrides:
68
- Explicit light theme settings, currently matching defaults.
69
- Can be customized independently if desired. */
70
- :host([theme='light']) {
71
- --text-color: #333;
72
- --background-color: #eeeeee;
73
- --accent-color: #333333;
74
- --button-bg: #ffffff;
75
- --button-hover-bg: #f2f2f2;
76
- --icon-color: #4496f5;
77
- --link-color: #333;
78
- --info-bg: rgba(0, 0, 0, 0.1);
79
- --info-text: rgba(0, 0, 0, 0.5);
80
- --modal-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
81
- }
72
+ .modalBox.visible {
73
+ transform: scale(1) translateY(0);
74
+ opacity: 1;
75
+ }
82
76
 
83
- /* Overlay covering the page behind the modal */
84
- .pageOverlay {
85
- position: fixed;
86
- top: 0;
87
- bottom: 0;
88
- right: 0;
89
- left: 0;
90
- display: grid;
91
- align-items: center;
92
- justify-content: center;
93
- z-index: 1000; /* Ensures the overlay is on top of other elements */
94
- background: rgba(255, 255, 255, 0);
95
- backdrop-filter: blur(0px);
96
- transition: all 0.2s;
97
- }
77
+ .modalBox.hiding {
78
+ transform: scale(0.95) translateY(10px);
79
+ opacity: 0;
80
+ }
98
81
 
99
- /* Shake animation for overlay when clicked */
100
- .pageOverlay.shake {
101
- background: rgba(0, 0, 0, 0.5) !important;
102
- }
82
+ /* Mobile: slide up from bottom */
83
+ @media (max-width: 560px) {
84
+ .pageOverlay {
85
+ align-items: flex-end;
86
+ }
103
87
 
104
- /* Modal box styling using theme variables for colors and shadows */
105
- .modalBox {
106
- display: block;
107
- color: var(--text-color);
108
- background: var(--background-color);
109
- box-shadow: var(--modal-box-shadow);
110
- position: relative;
111
- border: 1px dotted rgba(255, 255, 255, 0.1);
112
- border-top: 1px solid var(--accent-color);
113
- border-radius: 16px;
114
- max-width: 1100px;
115
- min-width: calc(100vw / 3);
116
- box-sizing: border-box;
117
- overflow: hidden;
118
- will-change: transform;
119
- transition: all 0.3s;
120
- transform: scale(0.95);
121
- opacity: 0;
122
- }
88
+ .modalBox {
89
+ max-width: 100%;
90
+ min-width: 100%;
91
+ border-radius: 16px 16px 0 0;
92
+ transform: translateY(100%);
93
+ opacity: 1;
94
+ }
123
95
 
124
- /* Media query for mobile devices: stack buttons vertically */
125
- @media (max-width: 600px) {
126
- .modalBox {
127
- height: 100vh;
128
- box-shadow: none;
129
- border-radius: 0px;
96
+ .modalBox.visible {
97
+ transform: translateY(0);
98
+ }
99
+
100
+ .modalBox.hiding {
101
+ transform: translateY(100%);
102
+ }
130
103
  }
131
- }
132
104
 
133
- /* Shake animation for modal box */
134
- .modalBox.shake {
135
- animation: shake 150ms 2 linear;
136
- }
105
+ .modalBox.shake {
106
+ animation: shake 120ms 2 linear;
107
+ }
137
108
 
138
- @keyframes shake {
139
- 0% {
140
- transform: translate(3px, 0);
109
+ @keyframes shake {
110
+ 0% { transform: translateX(3px); }
111
+ 50% { transform: translateX(-3px); }
112
+ 100% { transform: translateX(0); }
141
113
  }
142
- 50% {
143
- transform: translate(-3px, 0);
114
+
115
+ :host([show='false']) { display: none; }
116
+ :host([show='true']) { display: block; }
117
+
118
+ .content {
119
+ margin: auto;
144
120
  }
145
- 100% {
146
- transform: translate(0, 0);
121
+
122
+ .text-container {
123
+ padding: 12px 16px;
124
+ font-size: 0.9em;
125
+ line-height: 1.5;
126
+ color: ${cssManager.bdTheme(colors.light.mutedForeground, colors.dark.mutedForeground)};
147
127
  }
148
- }
149
128
 
150
- /* Toggle display based on [show] attribute */
151
- :host([show='false']) {
152
- display: none;
153
- }
154
- :host([show='true']) {
155
- display: block;
156
- }
129
+ .text-container a {
130
+ color: ${cssManager.bdTheme(colors.light.foreground, colors.dark.foreground)};
131
+ text-decoration: underline;
132
+ text-underline-offset: 2px;
133
+ }
157
134
 
158
- .content {
159
- margin: auto;
160
- }
135
+ .text-container a:hover {
136
+ opacity: 0.8;
137
+ }
161
138
 
162
- .text-container {
163
- padding-left: var(--padding-sides);
164
- padding-right: var(--padding-sides);
165
- display: grid;
166
- grid-template-columns: auto;
167
- }
139
+ .button-container {
140
+ padding: 12px 16px 16px;
141
+ display: grid;
142
+ grid-template-columns: repeat(3, 1fr);
143
+ gap: 8px;
144
+ }
168
145
 
169
- .text-container a {
170
- color: var(--link-color);
171
- text-decoration: none;
172
- }
146
+ @media (max-width: 560px) {
147
+ .button-container {
148
+ grid-template-columns: 1fr;
149
+ padding-bottom: max(16px, env(safe-area-inset-bottom));
150
+ }
151
+ }
173
152
 
174
- .button-container {
175
- padding: var(--padding-sides);
176
- display: grid;
177
- grid-template-columns: repeat(3, 1fr);
178
- gap: 16px;
179
- }
153
+ .consent-button {
154
+ border-radius: 6px;
155
+ background: ${cssManager.bdTheme(colors.light.secondary, colors.dark.secondary)};
156
+ border: 1px solid ${cssManager.bdTheme(colors.light.border, colors.dark.border)};
157
+ padding: 8px 16px;
158
+ font-size: 0.85em;
159
+ font-weight: 500;
160
+ text-align: center;
161
+ cursor: pointer;
162
+ transition: all 0.15s ease;
163
+ color: ${cssManager.bdTheme(colors.light.secondaryForeground, colors.dark.secondaryForeground)};
164
+ }
180
165
 
181
- /* Media query for mobile devices: stack buttons vertically */
182
- @media (max-width: 600px) {
183
- .button-container {
184
- grid-template-columns: 1fr;
166
+ .consent-button:hover {
167
+ background: ${cssManager.bdTheme(colors.light.accent, colors.dark.accent)};
168
+ border-color: ${cssManager.bdTheme(colors.light.ring, colors.dark.ring)};
185
169
  }
186
- }
187
170
 
188
- /* Consent button styling using theme variables */
189
- .consent-button {
190
- border-radius: 3px;
191
- background: var(--button-bg);
192
- box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
193
- padding: 10px;
194
- line-height: 30px;
195
- text-align: center;
196
- cursor: pointer;
197
- transition: all 0.2s;
198
- }
171
+ .consent-button:active {
172
+ transform: scale(0.98);
173
+ }
199
174
 
200
- .consent-button:hover {
201
- background: var(--button-hover-bg);
202
- }
175
+ .consent-button:last-child {
176
+ background: ${cssManager.bdTheme(colors.light.primary, colors.dark.primary)};
177
+ color: ${cssManager.bdTheme(colors.light.primaryForeground, colors.dark.primaryForeground)};
178
+ border-color: ${cssManager.bdTheme(colors.light.primary, colors.dark.primary)};
179
+ }
203
180
 
204
- /* Use theme variables for info container background and text */
205
- .info-container {
206
- text-align: center;
207
- line-height: 3em;
208
- background: var(--info-bg);
209
- border-top: 1px dotted rgba(255, 255, 255, 0.1);
210
- font-size: 0.8em;
211
- color: var(--info-text);
212
- }
181
+ .consent-button:last-child:hover {
182
+ opacity: 0.9;
183
+ }
213
184
 
214
- .info-container a {
215
- text-decoration: underline;
216
- color: var(--link-color);
217
- transition: color 0.2s;
218
- }
219
- .info-container a:hover {
220
- color: #ffffff;
221
- }
222
- `;
185
+ .info-container {
186
+ text-align: center;
187
+ padding: 10px 16px;
188
+ background: ${cssManager.bdTheme(colors.light.muted, colors.dark.muted)};
189
+ border-top: 1px solid ${cssManager.bdTheme(colors.light.border, colors.dark.border)};
190
+ font-size: 0.75em;
191
+ color: ${cssManager.bdTheme(colors.light.mutedForeground, colors.dark.mutedForeground)};
192
+ }
193
+
194
+ .info-container a {
195
+ color: ${cssManager.bdTheme(colors.light.foreground, colors.dark.foreground)};
196
+ text-decoration: none;
197
+ }
198
+
199
+ .info-container a:hover {
200
+ text-decoration: underline;
201
+ }
202
+ `,
203
+ ];
223
204
 
224
205
  constructor() {
225
206
  super();
226
- // Initially hide the consent banner until needed
227
207
  this.setAttribute('show', 'false');
228
208
  }
229
209
 
@@ -234,11 +214,11 @@ export class ConsentsoftwareCookieconsent extends LitElement {
234
214
  <div class="content">
235
215
  <consentsoftware-header></consentsoftware-header>
236
216
  <consentsoftware-tabs></consentsoftware-tabs>
237
- <div class="text-container" style="padding: 16px;">
217
+ <div class="text-container">
238
218
  <div class="toptext">
239
- This page uses cookies. Please review our
219
+ We use cookies to enhance your experience. Review our
240
220
  <a href="https://lossless.gmbh/cookie" target="_blank">cookie policy</a>
241
- and choose which cookie level you are willing to accept.
221
+ and select your preferences.
242
222
  </div>
243
223
  </div>
244
224
  <consentsoftware-mainselection></consentsoftware-mainselection>
@@ -277,46 +257,26 @@ export class ConsentsoftwareCookieconsent extends LitElement {
277
257
 
278
258
  /**
279
259
  * Lifecycle method called when the element is connected to the DOM.
280
- * It sets up the theme and displays the consent banner if no cookie levels are set.
260
+ * Displays the consent banner if no cookie levels are set.
281
261
  */
282
262
  public async connectedCallback() {
283
- super.connectedCallback();
284
- this.updateTheme(); // Initialize theme based on system preference
263
+ await super.connectedCallback();
264
+
265
+ // Check if mobile
266
+ this.isMobile = window.matchMedia('(max-width: 560px)').matches;
285
267
 
286
268
  const cookieLevel = await this.csWebclientInstance.getCookieLevels();
287
269
  if (!cookieLevel) {
288
- // Show consent banner if cookie levels haven't been set yet
289
270
  this.setAttribute('show', 'true');
290
- requestAnimationFrame(async () => {
291
- await this.updated();
292
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
293
- if (pageOverlay) {
294
- // Apply dark overlay styling when modal appears
295
- pageOverlay.style.background = 'rgba(0,0,0, 0.5)';
296
- pageOverlay.style.backdropFilter = 'blur(20px)';
297
- }
298
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
299
- if (modalBox) {
300
- // Animate modal box appearance
301
- modalBox.style.transform = `scale(1)`;
302
- modalBox.style.opacity = '1';
303
- }
304
- });
271
+ // Small delay to ensure DOM is ready, then animate in
272
+ await delayFor(50);
273
+ this.animateIn();
305
274
  } else {
306
- // Hide banner if cookie levels are already set
307
275
  this.setAttribute('show', 'false');
308
276
  }
309
277
  }
310
278
 
311
279
  public async firstUpdated() {
312
- // Placeholder for any logic needed after first render
313
- }
314
-
315
- /**
316
- * Called after updates. Logs banner height and runs consent scripts if necessary.
317
- */
318
- public async updated() {
319
- console.log(`The height of the cookie banner is ${this.shadowRoot?.host?.clientHeight}px`);
320
280
  const acceptedCookieLevels = await this.csWebclientInstance.getCookieLevels();
321
281
  if (!this.csWebclientRan && acceptedCookieLevels) {
322
282
  this.csWebclientRan = true;
@@ -324,32 +284,58 @@ export class ConsentsoftwareCookieconsent extends LitElement {
324
284
  }
325
285
  }
326
286
 
287
+ private animateIn() {
288
+ const pageOverlay = this.shadowRoot?.querySelector('.pageOverlay') as HTMLDivElement;
289
+ const modalBox = this.shadowRoot?.querySelector('.modalBox') as HTMLDivElement;
290
+
291
+ if (pageOverlay) {
292
+ pageOverlay.style.background = 'rgba(0, 0, 0, 0.5)';
293
+ pageOverlay.style.backdropFilter = 'blur(4px)';
294
+ }
295
+
296
+ if (modalBox) {
297
+ modalBox.classList.remove('hiding');
298
+ modalBox.classList.add('visible');
299
+ }
300
+ }
301
+
302
+ private async animateOut() {
303
+ const pageOverlay = this.shadowRoot?.querySelector('.pageOverlay') as HTMLDivElement;
304
+ const modalBox = this.shadowRoot?.querySelector('.modalBox') as HTMLDivElement;
305
+
306
+ if (pageOverlay) {
307
+ pageOverlay.style.background = 'rgba(0, 0, 0, 0)';
308
+ pageOverlay.style.backdropFilter = 'blur(0px)';
309
+ }
310
+
311
+ if (modalBox) {
312
+ modalBox.classList.remove('visible');
313
+ modalBox.classList.add('hiding');
314
+ }
315
+
316
+ await delayFor(350);
317
+ }
318
+
327
319
  /**
328
320
  * Handles consent button clicks, sets cookie levels, and hides the banner.
329
- * Uses theme variables for styling transitions.
330
321
  */
331
322
  private async handleConsentButtonClick(
332
- event: MouseEvent,
323
+ _event: MouseEvent,
333
324
  levelsArg: csInterfaces.TCookieLevel[]
334
325
  ) {
335
326
  console.log(`Set level to ${levelsArg}`);
336
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
337
- if (pageOverlay) {
338
- // Fade out overlay effect using inline styles for transition
339
- pageOverlay.style.background = 'rgba(255,255,255, 0)';
340
- pageOverlay.style.backdropFilter = 'blur(0px)';
341
- }
342
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
343
- if (modalBox) {
344
- // Scale down and fade out modal box before hiding
345
- modalBox.style.transform = `scale(0.95)`;
346
- modalBox.style.opacity = '0';
347
- }
327
+
328
+ await this.animateOut();
329
+
348
330
  // Save user consent preferences
349
331
  await this.csWebclientInstance.setCookieLevels(levelsArg);
350
- await delayFor(300);
351
- this.setAttribute('show', 'false'); // Hide the consent banner
352
- this.updated(); // Trigger any post-consent actions
332
+ this.setAttribute('show', 'false');
333
+
334
+ // Run consent scripts
335
+ if (!this.csWebclientRan) {
336
+ this.csWebclientRan = true;
337
+ await this.csWebclientInstance.getAndRunConsentTuples();
338
+ }
353
339
  }
354
340
 
355
341
  /**
@@ -358,30 +344,12 @@ export class ConsentsoftwareCookieconsent extends LitElement {
358
344
  */
359
345
  private async pageOverlayClick(e: MouseEvent) {
360
346
  if (e.target === e.currentTarget) {
361
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
362
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
363
- if (pageOverlay && modalBox) {
364
- pageOverlay.classList.add('shake');
347
+ const modalBox = this.shadowRoot?.querySelector('.modalBox') as HTMLDivElement;
348
+ if (modalBox) {
365
349
  modalBox.classList.add('shake');
366
- await delayFor(2000);
367
- pageOverlay.classList.remove('shake');
350
+ await delayFor(300);
368
351
  modalBox.classList.remove('shake');
369
352
  }
370
353
  }
371
354
  }
372
-
373
- /**
374
- * Dynamically switches the theme between light and dark.
375
- * Listens for system theme changes to update the component's theme.
376
- */
377
- private updateTheme() {
378
- // Check the initial system preference for dark mode
379
- const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
380
- this.theme = prefersDark ? 'dark' : 'light';
381
-
382
- // Listen for changes in the system color scheme preference
383
- window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
384
- this.theme = e.matches ? 'dark' : 'light';
385
- });
386
- }
387
355
  }
@@ -1,36 +1,53 @@
1
- import * as shared from './shared.js';
1
+ import { cssManager, colors } from './shared.js';
2
2
 
3
- import { LitElement, html, css, type TemplateResult } from 'lit';
4
- import { customElement } from 'lit/decorators.js';
5
- import { property } from 'lit/decorators/property.js';
3
+ import {
4
+ DeesElement,
5
+ customElement,
6
+ html,
7
+ css,
8
+ type TemplateResult,
9
+ } from '@design.estate/dees-element';
6
10
 
7
11
  @customElement('consentsoftware-header')
8
- export class ConsentsoftwareHeader extends LitElement {
9
- public static demo = () => html`<consentsoftware-tabs></consentsoftware-tabs>`;
12
+ export class ConsentsoftwareHeader extends DeesElement {
13
+ public static demo = () => html`<consentsoftware-header></consentsoftware-header>`;
10
14
 
11
- public static styles = css`
12
- :host {
13
- display: block;
14
- line-height: 3em;
15
- text-align: center;
16
- font-family: ${shared.fontStack};
17
- border-bottom: 1px dotted rgba(255, 255, 255, 0.1);
18
- }
15
+ public static styles = [
16
+ cssManager.defaultStyles,
17
+ css`
18
+ :host {
19
+ display: block;
20
+ padding: 14px 16px;
21
+ border-bottom: 1px solid ${cssManager.bdTheme(colors.light.border, colors.dark.border)};
22
+ }
19
23
 
20
- .heading {
21
-
22
- }
23
- `;
24
+ .heading {
25
+ display: flex;
26
+ align-items: center;
27
+ gap: 8px;
28
+ font-size: 0.95em;
29
+ font-weight: 600;
30
+ color: ${cssManager.bdTheme(colors.light.foreground, colors.dark.foreground)};
31
+ }
24
32
 
25
- constructor() {
26
- super();
27
- }
33
+ .icon {
34
+ width: 18px;
35
+ height: 18px;
36
+ opacity: 0.7;
37
+ }
38
+ `,
39
+ ];
28
40
 
29
41
  public render(): TemplateResult {
30
42
  return html`
31
43
  <div class="heading">
32
- What about cookies?
44
+ <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
45
+ <circle cx="12" cy="12" r="10"/>
46
+ <path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>
47
+ <path d="M12 17h.01"/>
48
+ </svg>
49
+ Cookie Preferences
33
50
  </div>
34
51
  `;
35
52
  }
36
- }
53
+ }