Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
2184d8be18 | |||
46602851aa | |||
fc2ba54725 | |||
a9ae67b43b | |||
599b529744 | |||
d15f8ecf39 | |||
ed51ea2049 | |||
7ab409ca80 | |||
e4b611c86d | |||
5bb5e8e458 | |||
e4efdcd9a6 | |||
6b31a80f07 | |||
7829e6a052 | |||
8b18e33c6e | |||
9407295866 | |||
472fa6b684 | |||
bdf9aa7e54 | |||
72c318a793 |
57
changelog.md
57
changelog.md
@ -1,5 +1,62 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-01-22 - 1.6.0 - feat(elements)
|
||||||
|
Enhance theme handling and CSS organization for consent component
|
||||||
|
|
||||||
|
- Introduced theme-specific CSS variables for better theming support in consentsoftware-cookieconsent.
|
||||||
|
- Reorganized styles in consentsoftware-cookieconsent for cleaner look and consistency.
|
||||||
|
- Added media queries for responsive design in consentsoftware-tabs.
|
||||||
|
|
||||||
|
## 2025-01-21 - 1.5.4 - fix(consentsoftware-components)
|
||||||
|
Add interactive consent software components for managing cookie levels.
|
||||||
|
|
||||||
|
- Implemented 'consentsoftware-cookieconsent' component for cookie management
|
||||||
|
- Introduced 'consentsoftware-toggle' for user interaction improvements
|
||||||
|
- Added theme support for light/dark modes in consent components
|
||||||
|
- Enhanced consent interface with responsive design and accessibility features
|
||||||
|
|
||||||
|
## 2025-01-20 - 1.5.3 - fix(consentsoftware-cookieconsent)
|
||||||
|
Fix visual inconsistencies in the consent software modal overlay and shadow.
|
||||||
|
|
||||||
|
- Updated the shadow color in the modal box to use a consistent color.
|
||||||
|
- Restored backdrop blur effect in the page overlay when visible.
|
||||||
|
|
||||||
|
## 2025-01-20 - 1.5.2 - fix(core)
|
||||||
|
No changes detected
|
||||||
|
|
||||||
|
|
||||||
|
## 2025-01-20 - 1.5.1 - fix(consentsoftware-cookieconsent)
|
||||||
|
Adjusted shake animation duration and box-shadow for modalBox in consent cookie component.
|
||||||
|
|
||||||
|
- Changed the box-shadow to be softer with reduced spread for more subtle visual effect.
|
||||||
|
- Increased the duration of shake animation from 300ms to 2000ms for enhanced user feedback upon overlay interaction.
|
||||||
|
|
||||||
|
## 2025-01-20 - 1.5.0 - feat(consentsoftware-cookieconsent)
|
||||||
|
Enhance consent modal with shake animation on overlay click
|
||||||
|
|
||||||
|
- Added shake animation to the modal and overlay when clicked outside the modal.
|
||||||
|
- Updated dependency @consent.software/interfaces to version ^1.0.14.
|
||||||
|
|
||||||
|
## 2025-01-17 - 1.4.5 - fix(elements)
|
||||||
|
Fix issues in consentsoftware-cookieconsent component
|
||||||
|
|
||||||
|
- Removed unused attribute handling for 'gotIt'.
|
||||||
|
- Fixed background and backdrop-filter transitions to ensure proper UI behavior.
|
||||||
|
- Consolidated consent button click handling into handleConsentButtonClick.
|
||||||
|
- Improved modal visibility toggling and acceptance flow.
|
||||||
|
|
||||||
|
## 2025-01-17 - 1.4.4 - fix(core)
|
||||||
|
Update LitElement properties to use accessors
|
||||||
|
|
||||||
|
- Changes made in ts_web/elements/consentsoftware-toggle.ts
|
||||||
|
- Updated properties 'required' and 'selected' to use accessors
|
||||||
|
|
||||||
|
## 2025-01-17 - 1.4.3 - fix(consentsoftware-cookieconsent)
|
||||||
|
Fix transition property in consent button styles and add HTMLElementTagNameMap declaration for global interface.
|
||||||
|
|
||||||
|
- Updated the transition property for consent buttons to transition all properties instead of just the background.
|
||||||
|
- Added global interface HTMLElementTagNameMap for custom element type support.
|
||||||
|
|
||||||
## 2025-01-16 - 1.4.2 - fix(cookieconsent)
|
## 2025-01-16 - 1.4.2 - fix(cookieconsent)
|
||||||
Fix user-select property in consentsoftware-cookieconsent component for consistency in interaction.
|
Fix user-select property in consentsoftware-cookieconsent component for consistency in interaction.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@consent.software/catalog",
|
"name": "@consent.software/catalog",
|
||||||
"version": "1.4.2",
|
"version": "1.6.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.",
|
"description": "A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.",
|
||||||
"exports": {
|
"exports": {
|
||||||
@ -15,7 +15,7 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@consent.software/interfaces": "^1.0.11",
|
"@consent.software/interfaces": "^1.0.14",
|
||||||
"@consent.software/webclient": "^1.1.0",
|
"@consent.software/webclient": "^1.1.0",
|
||||||
"@push.rocks/smartdelay": "^3.0.5",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"lit": "^3.2.1"
|
"lit": "^3.2.1"
|
||||||
|
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
@ -9,8 +9,8 @@ importers:
|
|||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@consent.software/interfaces':
|
'@consent.software/interfaces':
|
||||||
specifier: ^1.0.11
|
specifier: ^1.0.14
|
||||||
version: 1.0.13
|
version: 1.0.14
|
||||||
'@consent.software/webclient':
|
'@consent.software/webclient':
|
||||||
specifier: ^1.1.0
|
specifier: ^1.1.0
|
||||||
version: 1.1.0
|
version: 1.1.0
|
||||||
@ -42,9 +42,6 @@ packages:
|
|||||||
'@api.global/typedrequest-interfaces@2.0.2':
|
'@api.global/typedrequest-interfaces@2.0.2':
|
||||||
resolution: {integrity: sha512-D+mkr4IiUZ/eUgrdp5jXjBKOW/iuMcl0z2ZLQsLLypKX/psFGD3viZJ58FNRa+/1OSM38JS5wFyoWl8oPEFLrw==}
|
resolution: {integrity: sha512-D+mkr4IiUZ/eUgrdp5jXjBKOW/iuMcl0z2ZLQsLLypKX/psFGD3viZJ58FNRa+/1OSM38JS5wFyoWl8oPEFLrw==}
|
||||||
|
|
||||||
'@api.global/typedrequest-interfaces@3.0.1':
|
|
||||||
resolution: {integrity: sha512-eR2Cr01BYRwIq/X2ajOenWhm8l+/YE4A5kK/9V6I8ZnhtEBMFHG6YjF6Fg8npLJWbvhZXhOms+axZ6JKI71o8g==}
|
|
||||||
|
|
||||||
'@api.global/typedrequest-interfaces@3.0.19':
|
'@api.global/typedrequest-interfaces@3.0.19':
|
||||||
resolution: {integrity: sha512-uuHUXJeOy/inWSDrwD0Cwax2rovpxYllDhM2RWh+6mVpQuNmZ3uw6IVg6dA2G1rOe24Ebs+Y9SzEogo+jYN7vw==}
|
resolution: {integrity: sha512-uuHUXJeOy/inWSDrwD0Cwax2rovpxYllDhM2RWh+6mVpQuNmZ3uw6IVg6dA2G1rOe24Ebs+Y9SzEogo+jYN7vw==}
|
||||||
|
|
||||||
@ -227,8 +224,8 @@ packages:
|
|||||||
'@cloudflare/workers-types@4.20241230.0':
|
'@cloudflare/workers-types@4.20241230.0':
|
||||||
resolution: {integrity: sha512-dtLD4jY35Lb750cCVyO1i/eIfdZJg2Z0i+B1RYX6BVeRPlgaHx/H18ImKAkYmy0g09Ow8R2jZy3hIxMgXun0WQ==}
|
resolution: {integrity: sha512-dtLD4jY35Lb750cCVyO1i/eIfdZJg2Z0i+B1RYX6BVeRPlgaHx/H18ImKAkYmy0g09Ow8R2jZy3hIxMgXun0WQ==}
|
||||||
|
|
||||||
'@consent.software/interfaces@1.0.13':
|
'@consent.software/interfaces@1.0.14':
|
||||||
resolution: {integrity: sha512-xB1h5n5vltRLBrvQhrKz4K6tz+TN5RHHvcbQbTIphxetiWOJJq/RwyEN2iH8TtwWIGBSqHRtoljBQqY8t8Oanw==}
|
resolution: {integrity: sha512-xfOhDuj4ECEMyutJCSwEOX1SPN/MlReR40D/x7CsKg1mSauoq0pZbZEUb9m4z5EoPfywZl8gkLVzFoiGyg1IcA==}
|
||||||
|
|
||||||
'@consent.software/webclient@1.1.0':
|
'@consent.software/webclient@1.1.0':
|
||||||
resolution: {integrity: sha512-VX7e8ygZwgU8WEzn22fdvvEytLYl4kfp/u40GusaBU4iFtjrCY2hxDy9Z1FTKicpGcRxf3t13lM0Jaugq7Jj/w==}
|
resolution: {integrity: sha512-VX7e8ygZwgU8WEzn22fdvvEytLYl4kfp/u40GusaBU4iFtjrCY2hxDy9Z1FTKicpGcRxf3t13lM0Jaugq7Jj/w==}
|
||||||
@ -2981,8 +2978,6 @@ snapshots:
|
|||||||
|
|
||||||
'@api.global/typedrequest-interfaces@2.0.2': {}
|
'@api.global/typedrequest-interfaces@2.0.2': {}
|
||||||
|
|
||||||
'@api.global/typedrequest-interfaces@3.0.1': {}
|
|
||||||
|
|
||||||
'@api.global/typedrequest-interfaces@3.0.19': {}
|
'@api.global/typedrequest-interfaces@3.0.19': {}
|
||||||
|
|
||||||
'@api.global/typedrequest@3.1.10':
|
'@api.global/typedrequest@3.1.10':
|
||||||
@ -3569,14 +3564,14 @@ snapshots:
|
|||||||
|
|
||||||
'@cloudflare/workers-types@4.20241230.0': {}
|
'@cloudflare/workers-types@4.20241230.0': {}
|
||||||
|
|
||||||
'@consent.software/interfaces@1.0.13':
|
'@consent.software/interfaces@1.0.14':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@api.global/typedrequest-interfaces': 3.0.1
|
'@api.global/typedrequest-interfaces': 3.0.19
|
||||||
|
|
||||||
'@consent.software/webclient@1.1.0':
|
'@consent.software/webclient@1.1.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@api.global/typedrequest': 3.1.10
|
'@api.global/typedrequest': 3.1.10
|
||||||
'@consent.software/interfaces': 1.0.13
|
'@consent.software/interfaces': 1.0.14
|
||||||
'@push.rocks/smarttime': 4.1.1
|
'@push.rocks/smarttime': 4.1.1
|
||||||
'@push.rocks/webstore': 2.0.20
|
'@push.rocks/webstore': 2.0.20
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@consent.software/catalog',
|
name: '@consent.software/catalog',
|
||||||
version: '1.4.2',
|
version: '1.6.0',
|
||||||
description: 'A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.'
|
description: 'A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.'
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,12 @@ import * as csInterfaces from '@consent.software/interfaces';
|
|||||||
import * as csWebclient from '@consent.software/webclient';
|
import * as csWebclient from '@consent.software/webclient';
|
||||||
import { delayFor } from '@push.rocks/smartdelay';
|
import { delayFor } from '@push.rocks/smartdelay';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'consentsoftware-cookieconsent': ConsentsoftwareCookieconsent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@customElement('consentsoftware-cookieconsent')
|
@customElement('consentsoftware-cookieconsent')
|
||||||
export class ConsentsoftwareCookieconsent extends LitElement {
|
export class ConsentsoftwareCookieconsent extends LitElement {
|
||||||
public static demo = () => html`<consentsoftware-cookieconsent></consentsoftware-cookieconsent>`;
|
public static demo = () => html`<consentsoftware-cookieconsent></consentsoftware-cookieconsent>`;
|
||||||
@ -15,18 +21,20 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
public csWebclientInstance = new csWebclient.CsWebclient();
|
public csWebclientInstance = new csWebclient.CsWebclient();
|
||||||
public csWebclientRan = false;
|
public csWebclientRan = false;
|
||||||
|
|
||||||
|
// Reflects the current theme ('light' or 'dark')
|
||||||
@property({ type: String, reflect: true })
|
@property({ type: String, reflect: true })
|
||||||
public theme: 'light' | 'dark' = 'light';
|
public theme: 'light' | 'dark' = 'light';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We bind `heightPixels` to a CSS variable (--cookieconsent-height).
|
* Define component styles with CSS variables that adjust based on theme.
|
||||||
* Then we can do margin-bottom animations in CSS.
|
* The default variables serve as baseline for the light theme.
|
||||||
|
* Theme-specific overrides modify these for dark mode.
|
||||||
*/
|
*/
|
||||||
public static styles = css`
|
public static styles = css`
|
||||||
:host {
|
:host {
|
||||||
font-family: ${shared.fontStack};
|
font-family: ${shared.fontStack};
|
||||||
user-select: none;
|
user-select: none;
|
||||||
/* Default theme variables */
|
/* Default variables for Light Theme */
|
||||||
--text-color: #333;
|
--text-color: #333;
|
||||||
--background-color: #eeeeee;
|
--background-color: #eeeeee;
|
||||||
--accent-color: #333333;
|
--accent-color: #333333;
|
||||||
@ -35,8 +43,14 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
--icon-color: #4496f5;
|
--icon-color: #4496f5;
|
||||||
--link-color: #333;
|
--link-color: #333;
|
||||||
--padding-sides: 16px;
|
--padding-sides: 16px;
|
||||||
|
/* Additional variables for modal and info container styling */
|
||||||
|
--info-bg: rgba(0, 0, 0, 0.1);
|
||||||
|
--info-text: rgba(255, 255, 255, 0.5);
|
||||||
|
--modal-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dark Theme Overrides:
|
||||||
|
When theme attribute is 'dark', override variables accordingly. */
|
||||||
:host([theme='dark']) {
|
:host([theme='dark']) {
|
||||||
--text-color: #fff;
|
--text-color: #fff;
|
||||||
--background-color: #111;
|
--background-color: #111;
|
||||||
@ -45,8 +59,14 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
--button-hover-bg: #222222;
|
--button-hover-bg: #222222;
|
||||||
--icon-color: #4496f5;
|
--icon-color: #4496f5;
|
||||||
--link-color: #fff;
|
--link-color: #fff;
|
||||||
|
--info-bg: rgba(0, 0, 0, 0.1);
|
||||||
|
--info-text: rgba(255, 255, 255, 0.5);
|
||||||
|
--modal-box-shadow: 0px 0px 8px rgba(255, 255, 255, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Light Theme Overrides:
|
||||||
|
Explicit light theme settings, currently matching defaults.
|
||||||
|
Can be customized independently if desired. */
|
||||||
:host([theme='light']) {
|
:host([theme='light']) {
|
||||||
--text-color: #333;
|
--text-color: #333;
|
||||||
--background-color: #eeeeee;
|
--background-color: #eeeeee;
|
||||||
@ -55,29 +75,39 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
--button-hover-bg: #f2f2f2;
|
--button-hover-bg: #f2f2f2;
|
||||||
--icon-color: #4496f5;
|
--icon-color: #4496f5;
|
||||||
--link-color: #333;
|
--link-color: #333;
|
||||||
|
--info-bg: rgba(0, 0, 0, 0.1);
|
||||||
|
--info-text: rgba(0, 0, 0, 0.5);
|
||||||
|
--modal-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Overlay covering the page behind the modal */
|
||||||
.pageOverlay {
|
.pageOverlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0px;
|
top: 0;
|
||||||
bottom: 0px;
|
bottom: 0;
|
||||||
right: 0px;
|
right: 0;
|
||||||
left: 0px;
|
left: 0;
|
||||||
display: grid;
|
display: grid;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
z-index: 1000; /* standard z-index for fixed elements */
|
z-index: 1000; /* Ensures the overlay is on top of other elements */
|
||||||
background: rgba(0, 0, 0, 0);
|
background: rgba(255, 255, 255, 0);
|
||||||
backdrop-filter: blur(0px);
|
backdrop-filter: blur(0px);
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Shake animation for overlay when clicked */
|
||||||
|
.pageOverlay.shake {
|
||||||
|
background: rgba(0, 0, 0, 0.5) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal box styling using theme variables for colors and shadows */
|
||||||
.modalBox {
|
.modalBox {
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
background: var(--background-color);
|
background: var(--background-color);
|
||||||
box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.6);
|
box-shadow: var(--modal-box-shadow);
|
||||||
position: realtive;
|
position: relative;
|
||||||
border: 1px dotted rgba(255, 255, 255, 0.1);
|
border: 1px dotted rgba(255, 255, 255, 0.1);
|
||||||
border-top: 1px solid var(--accent-color);
|
border-top: 1px solid var(--accent-color);
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
@ -85,20 +115,39 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
min-width: calc(100vw / 3);
|
min-width: calc(100vw / 3);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/*
|
will-change: transform;
|
||||||
* We start with margin-bottom as negative to hide the banner.
|
|
||||||
* The animation occurs when we toggle the gotIt/show attributes.
|
|
||||||
*/
|
|
||||||
will-change: transform; /* ensure efficient rendering */
|
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
transform: scale(0.95);
|
transform: scale(0.95);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Media query for mobile devices: stack buttons vertically */
|
||||||
* Toggle display based on [show] attribute
|
@media (max-width: 600px) {
|
||||||
* (so if show=false, the banner doesn't show at all).
|
.modalBox {
|
||||||
*/
|
height: 100vh;
|
||||||
|
box-shadow: none;
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Shake animation for modal box */
|
||||||
|
.modalBox.shake {
|
||||||
|
animation: shake 150ms 2 linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes shake {
|
||||||
|
0% {
|
||||||
|
transform: translate(3px, 0);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: translate(-3px, 0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translate(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Toggle display based on [show] attribute */
|
||||||
:host([show='false']) {
|
:host([show='false']) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -106,18 +155,6 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Animate margin-bottom when [gotIt] toggles.
|
|
||||||
* If gotIt=true, push the banner down off-screen.
|
|
||||||
* If gotIt=false, pull the banner into view.
|
|
||||||
*/
|
|
||||||
:host([gotIt='true']) {
|
|
||||||
background: blue;
|
|
||||||
}
|
|
||||||
:host([gotIt='false']) {
|
|
||||||
background: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
@ -141,14 +178,37 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
gap: 16px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Media query for mobile devices: stack buttons vertically */
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.button-container {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Consent button styling using theme variables */
|
||||||
|
.consent-button {
|
||||||
|
border-radius: 3px;
|
||||||
|
background: var(--button-bg);
|
||||||
|
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
|
||||||
|
padding: 10px;
|
||||||
|
line-height: 30px;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.consent-button:hover {
|
||||||
|
background: var(--button-hover-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Use theme variables for info container background and text */
|
||||||
.info-container {
|
.info-container {
|
||||||
color: var(--text-color);
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 3em;
|
line-height: 3em;
|
||||||
background: rgba(0, 0, 0, 0.1);
|
background: var(--info-bg);
|
||||||
border-top: 1px dotted rgba(255, 255, 255, 0.1);
|
border-top: 1px dotted rgba(255, 255, 255, 0.1);
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
color: rgba(255, 255, 255, 0.5);
|
color: var(--info-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-container a {
|
.info-container a {
|
||||||
@ -159,32 +219,17 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
.info-container a:hover {
|
.info-container a:hover {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.consent-button {
|
|
||||||
border-radius: 3px;
|
|
||||||
background: var(--button-bg);
|
|
||||||
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
|
|
||||||
padding: 10px;
|
|
||||||
line-height: 30px;
|
|
||||||
text-align: center;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-button:hover {
|
|
||||||
background: var(--button-hover-bg);
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.setAttribute('gotIt', 'true');
|
// Initially hide the consent banner until needed
|
||||||
this.setAttribute('show', 'false');
|
this.setAttribute('show', 'false');
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<div class="pageOverlay">
|
<div class="pageOverlay" @click=${this.pageOverlayClick}>
|
||||||
<div class="modalBox">
|
<div class="modalBox">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<consentsoftware-header></consentsoftware-header>
|
<consentsoftware-header></consentsoftware-header>
|
||||||
@ -196,52 +241,26 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
and choose which cookie level you are willing to accept.
|
and choose which cookie level you are willing to accept.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="button-container">
|
|
||||||
<div
|
|
||||||
class="consent-button"
|
|
||||||
@click=${(event: MouseEvent) => this.setLevel(event, ['functional'])}
|
|
||||||
>
|
|
||||||
Functional cookies
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="consent-button"
|
|
||||||
@click=${(event: MouseEvent) => this.setLevel(event, ['functional', 'analytics'])}
|
|
||||||
>
|
|
||||||
Analytics cookies
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="consent-button"
|
|
||||||
@click=${(event: MouseEvent) =>
|
|
||||||
this.setLevel(event, ['functional', 'analytics', 'marketing'])}
|
|
||||||
>
|
|
||||||
Marketing cookies
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="consent-button"
|
|
||||||
@click=${(event: MouseEvent) =>
|
|
||||||
this.setLevel(event, ['functional', 'analytics', 'marketing', 'all'])}
|
|
||||||
>
|
|
||||||
All cookies
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<consentsoftware-mainselection></consentsoftware-mainselection>
|
<consentsoftware-mainselection></consentsoftware-mainselection>
|
||||||
<div class="button-container">
|
<div class="button-container">
|
||||||
<div
|
<div
|
||||||
class="consent-button"
|
class="consent-button"
|
||||||
@click=${(event: MouseEvent) => this.setLevel(event, ['functional'])}
|
@click=${(event: MouseEvent) =>
|
||||||
|
this.handleConsentButtonClick(event, ['functional'])}
|
||||||
>
|
>
|
||||||
Deny
|
Deny
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="consent-button"
|
class="consent-button"
|
||||||
@click=${(event: MouseEvent) => this.setLevel(event, ['functional', 'analytics'])}
|
@click=${(event: MouseEvent) =>
|
||||||
|
this.handleConsentButtonClick(event, ['functional', 'analytics'])}
|
||||||
>
|
>
|
||||||
Accept selection
|
Accept selection
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="consent-button"
|
class="consent-button"
|
||||||
@click=${(event: MouseEvent) =>
|
@click=${(event: MouseEvent) =>
|
||||||
this.setLevel(event, ['functional', 'analytics', 'marketing'])}
|
this.handleConsentButtonClick(event, ['functional', 'analytics', 'marketing'])}
|
||||||
>
|
>
|
||||||
Accept all cookies
|
Accept all cookies
|
||||||
</div>
|
</div>
|
||||||
@ -257,43 +276,44 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the element is inserted into the DOM.
|
* Lifecycle method called when the element is connected to the DOM.
|
||||||
|
* It sets up the theme and displays the consent banner if no cookie levels are set.
|
||||||
*/
|
*/
|
||||||
public async connectedCallback() {
|
public async connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
this.updateTheme();
|
this.updateTheme(); // Initialize theme based on system preference
|
||||||
|
|
||||||
const cookieLevel = await this.csWebclientInstance.getCookieLevels();
|
const cookieLevel = await this.csWebclientInstance.getCookieLevels();
|
||||||
if (!cookieLevel) {
|
if (!cookieLevel) {
|
||||||
|
// Show consent banner if cookie levels haven't been set yet
|
||||||
this.setAttribute('show', 'true');
|
this.setAttribute('show', 'true');
|
||||||
this.setAttribute('gotIt', 'false');
|
|
||||||
requestAnimationFrame(async () => {
|
requestAnimationFrame(async () => {
|
||||||
await this.updated();
|
await this.updated();
|
||||||
const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
|
const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
|
||||||
if (pageOverlay) {
|
if (pageOverlay) {
|
||||||
pageOverlay.style.background = 'rgba(0, 0, 0, 0.1)';
|
// Apply dark overlay styling when modal appears
|
||||||
pageOverlay.style.backdropFilter = 'blur(2px)';
|
pageOverlay.style.background = 'rgba(0,0,0, 0.5)';
|
||||||
|
pageOverlay.style.backdropFilter = 'blur(20px)';
|
||||||
}
|
}
|
||||||
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
||||||
if (modalBox) {
|
if (modalBox) {
|
||||||
|
// Animate modal box appearance
|
||||||
modalBox.style.transform = `scale(1)`;
|
modalBox.style.transform = `scale(1)`;
|
||||||
modalBox.style.opacity = '1';
|
modalBox.style.opacity = '1';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// Hide banner if cookie levels are already set
|
||||||
this.setAttribute('show', 'false');
|
this.setAttribute('show', 'false');
|
||||||
this.setAttribute('gotIt', 'true');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public async firstUpdated() {
|
||||||
* Called after the first render of the component.
|
// Placeholder for any logic needed after first render
|
||||||
* We measure the actual height of the banner and update the CSS variable.
|
}
|
||||||
*/
|
|
||||||
public async firstUpdated() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called whenever the element is updated or re-rendered.
|
* Called after updates. Logs banner height and runs consent scripts if necessary.
|
||||||
*/
|
*/
|
||||||
public async updated() {
|
public async updated() {
|
||||||
console.log(`The height of the cookie banner is ${this.shadowRoot?.host?.clientHeight}px`);
|
console.log(`The height of the cookie banner is ${this.shadowRoot?.host?.clientHeight}px`);
|
||||||
@ -305,25 +325,61 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the user’s chosen cookie level(s) and hides the banner.
|
* Handles consent button clicks, sets cookie levels, and hides the banner.
|
||||||
|
* Uses theme variables for styling transitions.
|
||||||
*/
|
*/
|
||||||
private async setLevel(event: MouseEvent, levelsArg: csInterfaces.TCookieLevel[]) {
|
private async handleConsentButtonClick(
|
||||||
|
event: MouseEvent,
|
||||||
|
levelsArg: csInterfaces.TCookieLevel[]
|
||||||
|
) {
|
||||||
console.log(`Set level to ${levelsArg}`);
|
console.log(`Set level to ${levelsArg}`);
|
||||||
|
const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
|
||||||
|
if (pageOverlay) {
|
||||||
|
// Fade out overlay effect using inline styles for transition
|
||||||
|
pageOverlay.style.background = 'rgba(255,255,255, 0)';
|
||||||
|
pageOverlay.style.backdropFilter = 'blur(0px)';
|
||||||
|
}
|
||||||
|
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
||||||
|
if (modalBox) {
|
||||||
|
// Scale down and fade out modal box before hiding
|
||||||
|
modalBox.style.transform = `scale(0.95)`;
|
||||||
|
modalBox.style.opacity = '0';
|
||||||
|
}
|
||||||
|
// Save user consent preferences
|
||||||
await this.csWebclientInstance.setCookieLevels(levelsArg);
|
await this.csWebclientInstance.setCookieLevels(levelsArg);
|
||||||
this.setAttribute('gotIt', 'true');
|
|
||||||
await delayFor(300);
|
await delayFor(300);
|
||||||
this.setAttribute('show', 'false');
|
this.setAttribute('show', 'false'); // Hide the consent banner
|
||||||
// After user selection, re-check for any required scripts to run
|
this.updated(); // Trigger any post-consent actions
|
||||||
this.updated();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamically switches the theme between light/dark,
|
* Handles clicks on the page overlay. If clicked outside the modal,
|
||||||
* respecting `prefers-color-scheme` by default.
|
* triggers a shake animation as feedback.
|
||||||
|
*/
|
||||||
|
private async pageOverlayClick(e: MouseEvent) {
|
||||||
|
if (e.target === e.currentTarget) {
|
||||||
|
const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
|
||||||
|
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
||||||
|
if (pageOverlay && modalBox) {
|
||||||
|
pageOverlay.classList.add('shake');
|
||||||
|
modalBox.classList.add('shake');
|
||||||
|
await delayFor(2000);
|
||||||
|
pageOverlay.classList.remove('shake');
|
||||||
|
modalBox.classList.remove('shake');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dynamically switches the theme between light and dark.
|
||||||
|
* Listens for system theme changes to update the component's theme.
|
||||||
*/
|
*/
|
||||||
private updateTheme() {
|
private updateTheme() {
|
||||||
|
// Check the initial system preference for dark mode
|
||||||
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
this.theme = prefersDark ? 'dark' : 'light';
|
this.theme = prefersDark ? 'dark' : 'light';
|
||||||
|
|
||||||
|
// Listen for changes in the system color scheme preference
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
|
||||||
this.theme = e.matches ? 'dark' : 'light';
|
this.theme = e.matches ? 'dark' : 'light';
|
||||||
});
|
});
|
||||||
|
@ -24,6 +24,13 @@ export class ConsentsoftwareTabs extends LitElement {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Media query for mobile devices: stack buttons vertically */
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.tabs .tab {
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.selector {
|
.selector {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: calc(100% / 3);
|
width: calc(100% / 3);
|
||||||
@ -44,7 +51,7 @@ export class ConsentsoftwareTabs extends LitElement {
|
|||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<div class="tab" @click=${this.handleClick}>Consent</div>
|
<div class="tab" @click=${this.handleClick}>Consent</div>
|
||||||
<div class="tab" @click=${this.handleClick}>Details</div>
|
<div class="tab" @click=${this.handleClick}>Details</div>
|
||||||
<div class="tab" @click=${this.handleClick}>Cookie Policy + Legal Info</div>
|
<div class="tab" @click=${this.handleClick}>Cookie Policy</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="selector"></div>
|
<div class="selector"></div>
|
||||||
`;
|
`;
|
||||||
@ -61,4 +68,4 @@ export class ConsentsoftwareTabs extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,10 @@ import { delayFor } from '@push.rocks/smartdelay';
|
|||||||
@customElement('consentsoftware-toggle')
|
@customElement('consentsoftware-toggle')
|
||||||
export class ConsentsoftwareToggle extends LitElement {
|
export class ConsentsoftwareToggle extends LitElement {
|
||||||
@property({ type: Boolean })
|
@property({ type: Boolean })
|
||||||
public required = false;
|
public accessor required = false;
|
||||||
|
|
||||||
@property({ type: Boolean, reflect: true })
|
@property({ type: Boolean, reflect: true })
|
||||||
public selected = false;
|
public accessor selected = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We always track the knob’s left offset in `currentX`.
|
* We always track the knob’s left offset in `currentX`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user