@consent.software/catalog 2.0.0 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consent.software/catalog",
3
- "version": "2.0.0",
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": {
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@consent.software/catalog',
6
- version: '2.0.0',
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
  }
@@ -6,7 +6,6 @@ import {
6
6
  html,
7
7
  css,
8
8
  type TemplateResult,
9
- property,
10
9
  } from '@design.estate/dees-element';
11
10
 
12
11
  import * as csInterfaces from '@consent.software/interfaces';
@@ -25,6 +24,7 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
25
24
 
26
25
  public csWebclientInstance = new csWebclient.CsWebclient();
27
26
  public csWebclientRan = false;
27
+ private isMobile = false;
28
28
 
29
29
  public static styles = [
30
30
  cssManager.defaultStyles,
@@ -43,7 +43,7 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
43
43
  z-index: 1000;
44
44
  background: rgba(0, 0, 0, 0);
45
45
  backdrop-filter: blur(0px);
46
- transition: all 0.2s ease-out;
46
+ transition: background 0.3s ease, backdrop-filter 0.3s ease;
47
47
  }
48
48
 
49
49
  .pageOverlay.shake {
@@ -63,18 +63,42 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
63
63
  min-width: 320px;
64
64
  box-sizing: border-box;
65
65
  overflow: hidden;
66
- will-change: transform;
67
- transition: all 0.2s ease-out;
68
- transform: scale(0.96);
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
69
  opacity: 0;
70
70
  }
71
71
 
72
+ .modalBox.visible {
73
+ transform: scale(1) translateY(0);
74
+ opacity: 1;
75
+ }
76
+
77
+ .modalBox.hiding {
78
+ transform: scale(0.95) translateY(10px);
79
+ opacity: 0;
80
+ }
81
+
82
+ /* Mobile: slide up from bottom */
72
83
  @media (max-width: 560px) {
84
+ .pageOverlay {
85
+ align-items: flex-end;
86
+ }
87
+
73
88
  .modalBox {
74
89
  max-width: 100%;
75
90
  min-width: 100%;
76
- height: 100vh;
77
- border-radius: 0;
91
+ border-radius: 16px 16px 0 0;
92
+ transform: translateY(100%);
93
+ opacity: 1;
94
+ }
95
+
96
+ .modalBox.visible {
97
+ transform: translateY(0);
98
+ }
99
+
100
+ .modalBox.hiding {
101
+ transform: translateY(100%);
78
102
  }
79
103
  }
80
104
 
@@ -122,6 +146,7 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
122
146
  @media (max-width: 560px) {
123
147
  .button-container {
124
148
  grid-template-columns: 1fr;
149
+ padding-bottom: max(16px, env(safe-area-inset-bottom));
125
150
  }
126
151
  }
127
152
 
@@ -143,6 +168,10 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
143
168
  border-color: ${cssManager.bdTheme(colors.light.ring, colors.dark.ring)};
144
169
  }
145
170
 
171
+ .consent-button:active {
172
+ transform: scale(0.98);
173
+ }
174
+
146
175
  .consent-button:last-child {
147
176
  background: ${cssManager.bdTheme(colors.light.primary, colors.dark.primary)};
148
177
  color: ${cssManager.bdTheme(colors.light.primaryForeground, colors.dark.primaryForeground)};
@@ -175,7 +204,6 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
175
204
 
176
205
  constructor() {
177
206
  super();
178
- // Initially hide the consent banner until needed
179
207
  this.setAttribute('show', 'false');
180
208
  }
181
209
 
@@ -234,33 +262,21 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
234
262
  public async connectedCallback() {
235
263
  await super.connectedCallback();
236
264
 
265
+ // Check if mobile
266
+ this.isMobile = window.matchMedia('(max-width: 560px)').matches;
267
+
237
268
  const cookieLevel = await this.csWebclientInstance.getCookieLevels();
238
269
  if (!cookieLevel) {
239
- // Show consent banner if cookie levels haven't been set yet
240
270
  this.setAttribute('show', 'true');
241
- requestAnimationFrame(async () => {
242
- await this.updateComplete;
243
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
244
- if (pageOverlay) {
245
- // Apply subtle backdrop blur when modal appears
246
- pageOverlay.style.background = 'rgba(0,0,0, 0.6)';
247
- pageOverlay.style.backdropFilter = 'blur(4px)';
248
- }
249
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
250
- if (modalBox) {
251
- // Animate modal box appearance
252
- modalBox.style.transform = `scale(1)`;
253
- modalBox.style.opacity = '1';
254
- }
255
- });
271
+ // Small delay to ensure DOM is ready, then animate in
272
+ await delayFor(50);
273
+ this.animateIn();
256
274
  } else {
257
- // Hide banner if cookie levels are already set
258
275
  this.setAttribute('show', 'false');
259
276
  }
260
277
  }
261
278
 
262
279
  public async firstUpdated() {
263
- // Run consent scripts if levels are already set
264
280
  const acceptedCookieLevels = await this.csWebclientInstance.getCookieLevels();
265
281
  if (!this.csWebclientRan && acceptedCookieLevels) {
266
282
  this.csWebclientRan = true;
@@ -268,29 +284,52 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
268
284
  }
269
285
  }
270
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
+
271
319
  /**
272
320
  * Handles consent button clicks, sets cookie levels, and hides the banner.
273
321
  */
274
322
  private async handleConsentButtonClick(
275
- event: MouseEvent,
323
+ _event: MouseEvent,
276
324
  levelsArg: csInterfaces.TCookieLevel[]
277
325
  ) {
278
326
  console.log(`Set level to ${levelsArg}`);
279
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
280
- if (pageOverlay) {
281
- pageOverlay.style.background = 'rgba(0,0,0, 0)';
282
- pageOverlay.style.backdropFilter = 'blur(0px)';
283
- }
284
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
285
- if (modalBox) {
286
- // Scale down and fade out modal box before hiding
287
- modalBox.style.transform = `scale(0.95)`;
288
- modalBox.style.opacity = '0';
289
- }
327
+
328
+ await this.animateOut();
329
+
290
330
  // Save user consent preferences
291
331
  await this.csWebclientInstance.setCookieLevels(levelsArg);
292
- await delayFor(300);
293
- this.setAttribute('show', 'false'); // Hide the consent banner
332
+ this.setAttribute('show', 'false');
294
333
 
295
334
  // Run consent scripts
296
335
  if (!this.csWebclientRan) {
@@ -305,13 +344,10 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
305
344
  */
306
345
  private async pageOverlayClick(e: MouseEvent) {
307
346
  if (e.target === e.currentTarget) {
308
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
309
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
310
- if (pageOverlay && modalBox) {
311
- pageOverlay.classList.add('shake');
347
+ const modalBox = this.shadowRoot?.querySelector('.modalBox') as HTMLDivElement;
348
+ if (modalBox) {
312
349
  modalBox.classList.add('shake');
313
- await delayFor(2000);
314
- pageOverlay.classList.remove('shake');
350
+ await delayFor(300);
315
351
  modalBox.classList.remove('shake');
316
352
  }
317
353
  }