diff --git a/package-lock.json b/package-lock.json index c008ea2..2a2738b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ldc-web/cookie-notice", - "version": "5.0.4", + "version": "6.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@ldc-web/cookie-notice", - "version": "5.0.4", + "version": "6.1.0", "license": "MIT", "devDependencies": { "@babel/core": "^7.22.11", diff --git a/package.json b/package.json index c46fdec..98ad243 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ldc-web/cookie-notice", - "version": "6.0.3", + "version": "6.1.0", "description": "Web cookie notice for websites usage", "main": "./dist/umd/main.js", "module": "./dist/esm/ts/index.js", diff --git a/src/scss/themes/standard.scss b/src/scss/themes/standard.scss index 03b1da8..54da81f 100644 --- a/src/scss/themes/standard.scss +++ b/src/scss/themes/standard.scss @@ -161,8 +161,8 @@ $cn-w-modal-width: $cn-cookie-modal-width; &:focus { outline-color: color.adjust($color: $ck-secondary-color, $lightness: -10%); - outline-offset: 0.1rem; - outline-width: 0.2rem; + outline-offset: $cn-base-font-size * 0.1; + outline-width: $cn-base-font-size * 0.2; } &-icon { @@ -209,12 +209,12 @@ $cn-w-modal-width: $cn-cookie-modal-width; #cn-close-modal { @extend %nav-button; - width: 4rem; - height: 3rem; - border-bottom-left-radius: 0.5rem; + width: $cn-base-font-size * 4; + height: $cn-base-font-size * 3; + border-bottom-left-radius: $cn-base-font-size * 0.5; @media (min-width: $breakpoint-mobile) { - border-top-right-radius: 0.5rem; + border-top-right-radius: $cn-base-font-size * 0.5; } } } @@ -229,8 +229,8 @@ $cn-w-modal-width: $cn-cookie-modal-width; bottom: calc(#{$cn-cookie-button-position-bottom} + 60px); left: $cn-cookie-animation-left; width: $cn-w-modal-width; - max-height: #{math.max($cn-w-max-height-desktop - 12rem, 26rem)}; - border-radius: 0.5rem; + max-height: #{math.max($cn-w-max-height-desktop - ($cn-base-font-size * 12), ($cn-base-font-size * 26))}; + border-radius: $cn-base-font-size * 0.5; &.cn-modal-page { max-height: $cn-w-max-height-desktop; @@ -251,7 +251,7 @@ $cn-w-modal-width: $cn-cookie-modal-width; .cn-content { flex-basis: 100%; flex-grow: 1; - padding: 0.8rem; + padding: $cn-base-font-size * 0.8; overflow-y: auto; @media (min-width: $breakpoint-mobile) { @@ -270,7 +270,7 @@ $cn-w-modal-width: $cn-cookie-modal-width; &:focus, &:focus-visible { - border-width: .1rem; + border-width: $cn-base-font-size * 0.1; border-style: solid; border-color: $cn-w2-swth-focus-color; } @@ -279,9 +279,9 @@ $cn-w-modal-width: $cn-cookie-modal-width; display: none; } - input + span { + input+span { position: absolute; - border-radius: 2rem; + border-radius: $cn-base-font-size * 2; background: $cn-w2-swth-unchecked-color; inset: 0; @@ -300,7 +300,7 @@ $cn-w-modal-width: $cn-cookie-modal-width; } } - input:indeterminate + span { + input:indeterminate+span { background: $cn-w2-swth-indetermined-color; &::before { @@ -308,7 +308,7 @@ $cn-w-modal-width: $cn-cookie-modal-width; } } - input:checked + span { + input:checked+span { background: $cn-w2-swth-checked-color; &::before { @@ -476,8 +476,8 @@ $cn-w-modal-width: $cn-cookie-modal-width; @media (min-width: $breakpoint-mobile) { height: $cn-button-height; flex-wrap: initial; - border-bottom-left-radius: 0.5rem; - border-bottom-right-radius: 0.5rem; + border-bottom-left-radius: $cn-base-font-size * 0.5; + border-bottom-right-radius: $cn-base-font-size * 0.5; #cn-deny-banner { width: 33.33%; diff --git a/src/scss/variables.scss b/src/scss/variables.scss index 36a3a9b..ecbacc5 100644 --- a/src/scss/variables.scss +++ b/src/scss/variables.scss @@ -2,6 +2,7 @@ --cs-primary-color: var(); } +$cn-base-font-size: 1rem !default; $ck-primary-color: #707070 !default; $ck-secondary-color: #dc9c52 !default; $ck-background-color: #fff !default; @@ -19,48 +20,58 @@ $ck-btn-background-color: #fff !default; $cn-cookie-button-z-index: 1050 !default; // Cookie Button dimension -$cn-cookie-button-width: 2.4rem !default; -$cn-cookie-button-height: 2.4rem !default; -$cn-cookie-button-padding: 0.3rem !default; +$cn-cookie-button-width: $cn-base-font-size * 2.4 !default; +$cn-cookie-button-height: $cn-base-font-size * 2.4 !default; +$cn-cookie-button-padding: $cn-base-font-size * 0.3 !default; // Cookie Button dimension (above mobile) -$cn-cookie-button-width-h: 3rem !default; -$cn-cookie-button-height-h: 3rem !default; -$cn-cookie-button-padding-h: 0.5rem !default; +$cn-cookie-button-width-h: $cn-base-font-size * 3 !default; +$cn-cookie-button-height-h: $cn-base-font-size * 3 !default; +$cn-cookie-button-padding-h: $cn-base-font-size * 0.5 !default; // Cookie Button position -$cn-cookie-button-position-left: 0.5rem; /* Distance par rapport à la gauche de la fenêtre */ -$cn-cookie-button-position-right: auto; /* Distance par rapport à la droite de la fenêtre */ -$cn-cookie-button-position-bottom: 0.5rem; /* Distance par rapport au bas de la fenêtre */ -$cn-cookie-animation-left: 0; /* Position gauche de base des cookies */ -$cn-cookie-animation-right: auto; /* Position droite de base des cookies */ + +/* Distance par rapport à la gauche de la fenêtre */ +$cn-cookie-button-position-left: $cn-base-font-size * 0.5; + +/* Distance par rapport à la droite de la fenêtre */ +$cn-cookie-button-position-right: auto; + +/* Distance par rapport au bas de la fenêtre */ +$cn-cookie-button-position-bottom: 0.5rem; + +/* Position gauche de base des cookies */ +$cn-cookie-animation-left: 0; + +/* Position droite de base des cookies */ +$cn-cookie-animation-right: auto; // Cookie Button position hide btn vars $cn-cookie-button-position-right-h: auto; -$cn-cookie-button-position-bottom-h: #{$cn-cookie-button-position-bottom - 2rem}; -$cn-cookie-button-position-left-h: #{$cn-cookie-button-position-left - 2rem}; -$cn-cookie-button-transition-show: all 1s 6s; +$cn-cookie-button-position-bottom-h: #{calc($cn-cookie-button-position-bottom - ($cn-base-font-size * 2))}; +$cn-cookie-button-position-left-h: #{calc($cn-cookie-button-position-left - ($cn-base-font-size * 2))}; +$cn-cookie-button-transition-show: all 1s 6s, border-radius 0s, background-color 0s, box-shadow 0s, padding 0s; $cn-cookie-button-transition-hide: all 1s; // Buttons $cn-button-bg-color: #d6d6d6 !default; $cn-button-font-family: $ck-text-font !default; -$cn-button-font-size: 1rem !default; +$cn-button-font-size: $cn-base-font-size * 1 !default; $cn-button-line-height: 1 !default; -$cn-button-height: 3rem !default; +$cn-button-height: $cn-base-font-size * 3 !default; // Switch Buttons -$cn-switch-height: 2.4rem !default; -$cn-switch-width: 4.2rem !default; -$cn-switch-toggle-height: 1.8rem !default; -$cn-switch-toggle-width: 1.8rem !default; +$cn-switch-height: $cn-base-font-size * 2.4 !default; +$cn-switch-width: $cn-base-font-size * 4.2 !default; +$cn-switch-toggle-height: $cn-base-font-size * 1.8 !default; +$cn-switch-toggle-width: $cn-base-font-size * 1.8 !default; $cn-switch-toggle-color: #fff !default; $cn-switch-indetermined-color: #b7b7b7 !default; $cn-switch-unchecked-color: #b7b7b7 !default; $cn-switch-checked-color: $ck-secondary-color !default; -$cn-switch-focus-color: $cn-switch-checked-color!default; +$cn-switch-focus-color: $cn-switch-checked-color !default; // Dimensions modal $cn-cookie-modal-max-height-mobile: 100dvh !default; -$cn-cookie-modal-max-height-desktop: 38rem !default; -$cn-cookie-modal-width: 30rem !default; +$cn-cookie-modal-max-height-desktop: $cn-base-font-size * 38 !default; +$cn-cookie-modal-width: $cn-base-font-size * 30 !default;