first commit
This commit is contained in:
143
wp-content/plugins/elementor-addon/assets/css/main.css
Normal file
143
wp-content/plugins/elementor-addon/assets/css/main.css
Normal file
@@ -0,0 +1,143 @@
|
||||
.ea-popup-widget {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.ea-popup-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 20px;
|
||||
padding: 12px 24px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
background: #1f7a8c;
|
||||
color: #fff;
|
||||
font: inherit;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
|
||||
.ea-popup-button:hover,
|
||||
.ea-popup-button:focus {
|
||||
background: #195f6d;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ea-popup-button:focus-visible,
|
||||
.ea-popup-close:focus-visible {
|
||||
outline: 2px solid currentColor;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
.ea-popup-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 2147483647;
|
||||
width: 100vw;
|
||||
max-width: none;
|
||||
height: 100vh;
|
||||
max-height: none;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
border: 0;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.2s ease, visibility 0.2s ease;
|
||||
}
|
||||
|
||||
.ea-popup-modal:not([open]) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ea-popup-modal.is-open {
|
||||
display: flex;
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.ea-popup-modal::backdrop {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ea-popup-dialog {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
max-width: 720px;
|
||||
max-height: calc(100vh - 48px);
|
||||
overflow: auto;
|
||||
padding: 32px;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: #1a1a1a;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
|
||||
transform: translateY(12px);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.ea-popup-modal.is-open .ea-popup-dialog {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.ea-popup-close {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: #333;
|
||||
font-size: 28px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ea-popup-close:hover,
|
||||
.ea-popup-close:focus {
|
||||
background: rgba(0, 0, 0, 0.08);
|
||||
color: #111;
|
||||
}
|
||||
|
||||
.ea-popup-content {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.ea-popup-content > :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.ea-popup-content > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
body.ea-popup-lock {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.ea-popup-modal {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.ea-popup-dialog {
|
||||
max-height: calc(100vh - 32px);
|
||||
padding: 28px 22px;
|
||||
}
|
||||
}
|
||||
117
wp-content/plugins/elementor-addon/assets/js/main.js
Normal file
117
wp-content/plugins/elementor-addon/assets/js/main.js
Normal file
@@ -0,0 +1,117 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var activeModal = null;
|
||||
var activeButton = null;
|
||||
|
||||
function getFocusableElements(container) {
|
||||
return Array.prototype.slice.call(
|
||||
container.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')
|
||||
);
|
||||
}
|
||||
|
||||
function openPopup(button) {
|
||||
var widget = button.closest('.ea-popup-widget');
|
||||
var modal = widget ? widget.querySelector('[data-ea-popup-modal]') : null;
|
||||
|
||||
if (!modal) {
|
||||
return;
|
||||
}
|
||||
|
||||
activeModal = modal;
|
||||
activeButton = button;
|
||||
|
||||
if (typeof modal.showModal === 'function' && !modal.open) {
|
||||
modal.showModal();
|
||||
} else if (!modal.open) {
|
||||
modal.setAttribute('open', '');
|
||||
}
|
||||
|
||||
modal.classList.add('is-open');
|
||||
modal.setAttribute('aria-hidden', 'false');
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
document.body.classList.add('ea-popup-lock');
|
||||
|
||||
var focusable = getFocusableElements(modal);
|
||||
if (focusable.length) {
|
||||
focusable[0].focus();
|
||||
}
|
||||
}
|
||||
|
||||
function closePopup(modal) {
|
||||
if (!modal) {
|
||||
return;
|
||||
}
|
||||
|
||||
modal.classList.remove('is-open');
|
||||
modal.setAttribute('aria-hidden', 'true');
|
||||
|
||||
if (typeof modal.close === 'function' && modal.open) {
|
||||
modal.close();
|
||||
} else {
|
||||
modal.removeAttribute('open');
|
||||
}
|
||||
|
||||
if (activeButton) {
|
||||
activeButton.setAttribute('aria-expanded', 'false');
|
||||
activeButton.focus();
|
||||
}
|
||||
|
||||
document.body.classList.remove('ea-popup-lock');
|
||||
activeModal = null;
|
||||
activeButton = null;
|
||||
}
|
||||
|
||||
function trapFocus(event) {
|
||||
if (!activeModal || event.key !== 'Tab') {
|
||||
return;
|
||||
}
|
||||
|
||||
var focusable = getFocusableElements(activeModal);
|
||||
if (!focusable.length) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
var first = focusable[0];
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
if (event.shiftKey && document.activeElement === first) {
|
||||
event.preventDefault();
|
||||
last.focus();
|
||||
} else if (!event.shiftKey && document.activeElement === last) {
|
||||
event.preventDefault();
|
||||
first.focus();
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
var openButton = event.target.closest('.ea-popup-button');
|
||||
var closeButton = event.target.closest('[data-ea-popup-close]');
|
||||
|
||||
if (openButton) {
|
||||
event.preventDefault();
|
||||
openPopup(openButton);
|
||||
return;
|
||||
}
|
||||
|
||||
if (closeButton) {
|
||||
event.preventDefault();
|
||||
closePopup(closeButton.closest('[data-ea-popup-modal]'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target.matches('[data-ea-popup-modal]')) {
|
||||
closePopup(event.target);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Escape' && activeModal) {
|
||||
closePopup(activeModal);
|
||||
return;
|
||||
}
|
||||
|
||||
trapFocus(event);
|
||||
});
|
||||
})();
|
||||
163
wp-content/plugins/elementor-addon/assets/scss/main.scss
Normal file
163
wp-content/plugins/elementor-addon/assets/scss/main.scss
Normal file
@@ -0,0 +1,163 @@
|
||||
$popup-button-bg: #1f7a8c;
|
||||
$popup-button-bg-hover: #195f6d;
|
||||
$popup-button-color: #fff;
|
||||
$popup-overlay-bg: rgba(0, 0, 0, 0.55);
|
||||
$popup-box-bg: #fff;
|
||||
$popup-box-color: #1a1a1a;
|
||||
$popup-close-color: #333;
|
||||
$popup-close-color-hover: #111;
|
||||
$popup-transition: 0.2s ease;
|
||||
$popup-z-index: 2147483647;
|
||||
|
||||
.ea-popup-widget {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.ea-popup-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 44px;
|
||||
padding: 12px 24px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
background: $popup-button-bg;
|
||||
color: $popup-button-color;
|
||||
font: inherit;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background-color $popup-transition,
|
||||
border-color $popup-transition,
|
||||
color $popup-transition,
|
||||
box-shadow $popup-transition,
|
||||
transform $popup-transition;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: $popup-button-bg-hover;
|
||||
color: $popup-button-color;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid currentColor;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.ea-popup-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: $popup-z-index;
|
||||
width: 100vw;
|
||||
max-width: none;
|
||||
height: 100vh;
|
||||
max-height: none;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
border: 0;
|
||||
background: $popup-overlay-bg;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
transition: opacity $popup-transition, visibility $popup-transition;
|
||||
|
||||
&:not([open]) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.is-open {
|
||||
display: flex;
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
pointer-events: auto;
|
||||
|
||||
.ea-popup-dialog {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
&::backdrop {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.ea-popup-dialog {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
max-width: 720px;
|
||||
max-height: calc(100vh - 48px);
|
||||
overflow: auto;
|
||||
padding: 32px;
|
||||
border-radius: 8px;
|
||||
background: $popup-box-bg;
|
||||
color: $popup-box-color;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
|
||||
transform: translateY(12px);
|
||||
transition: transform $popup-transition;
|
||||
}
|
||||
|
||||
.ea-popup-close {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: $popup-close-color;
|
||||
font-size: 28px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: rgba(0, 0, 0, 0.08);
|
||||
color: $popup-close-color-hover;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid currentColor;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.ea-popup-content {
|
||||
padding-right: 20px;
|
||||
|
||||
> :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
> :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
body.ea-popup-lock {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.ea-popup-modal {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.ea-popup-dialog {
|
||||
max-height: calc(100vh - 32px);
|
||||
padding: 28px 22px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user