ManualPaymentMethods-e5dcf410.js
3 years ago
ManualPaymentMethods-e5dcf410.js.map
3 years ago
_commonjsHelpers-537d719a.js
4 years ago
_commonjsHelpers-537d719a.js.map
3 years ago
add-query-args-17c551b6.js
4 years ago
add-query-args-17c551b6.js.map
3 years ago
address-42b5c61b.js
3 years ago
address-42b5c61b.js.map
3 years ago
animation-registry-58bec802.js
3 years ago
animation-registry-58bec802.js.map
3 years ago
consumer-51f6d265.js
3 years ago
consumer-51f6d265.js.map
3 years ago
countries-0ec7ecdc.js
4 years ago
countries-0ec7ecdc.js.map
3 years ago
fetch-b673a242.js
3 years ago
fetch-b673a242.js.map
3 years ago
form-data-69000afe.js
3 years ago
form-data-69000afe.js.map
3 years ago
functions-77ef3f22.js
4 years ago
functions-77ef3f22.js.map
3 years ago
get-query-arg-53bf21e2.js
4 years ago
get-query-arg-53bf21e2.js.map
3 years ago
getters-52a52d79.js
3 years ago
getters-52a52d79.js.map
3 years ago
getters-6f3470fb.js
3 years ago
getters-6f3470fb.js.map
3 years ago
getters-c8a04b97.js
3 years ago
getters-c8a04b97.js.map
3 years ago
getters-f0455d23.js
3 years ago
getters-f0455d23.js.map
3 years ago
global-6f39d5d2.js
3 years ago
global-6f39d5d2.js.map
3 years ago
index-261b56ec.js
3 years ago
index-261b56ec.js.map
3 years ago
index-2643f18b.js
3 years ago
index-2643f18b.js.map
3 years ago
index-ac77ca60.js
3 years ago
index-ac77ca60.js.map
3 years ago
index-b901844d.js
3 years ago
index-b901844d.js.map
3 years ago
index-cf22257b.js
3 years ago
index-cf22257b.js.map
3 years ago
index.cjs.js
3 years ago
index.cjs.js.map
3 years ago
lazy-bc8baeab.js
4 years ago
lazy-bc8baeab.js.map
3 years ago
library-289cf13f.js
4 years ago
library-289cf13f.js.map
3 years ago
loader.cjs.js
3 years ago
loader.cjs.js.map
3 years ago
media-a7872d6d.js
3 years ago
media-a7872d6d.js.map
3 years ago
mutations-a3ec6490.js
3 years ago
mutations-a3ec6490.js.map
3 years ago
mutations-b8d54585.js
3 years ago
mutations-b8d54585.js.map
3 years ago
page-align-bf197eb4.js
3 years ago
page-align-bf197eb4.js.map
3 years ago
price-d3e21aa4.js
3 years ago
price-d3e21aa4.js.map
3 years ago
pure-5be33f24.js
4 years ago
pure-5be33f24.js.map
3 years ago
sc-address_3.cjs.entry.js
3 years ago
sc-address_3.cjs.entry.js.map
3 years ago
sc-alert.cjs.entry.js
3 years ago
sc-alert.cjs.entry.js.map
3 years ago
sc-avatar.cjs.entry.js
3 years ago
sc-avatar.cjs.entry.js.map
3 years ago
sc-badge-notice.cjs.entry.js
3 years ago
sc-badge-notice.cjs.entry.js.map
3 years ago
sc-block-ui.cjs.entry.js
3 years ago
sc-block-ui.cjs.entry.js.map
3 years ago
sc-breadcrumb.cjs.entry.js
3 years ago
sc-breadcrumb.cjs.entry.js.map
3 years ago
sc-breadcrumbs.cjs.entry.js
3 years ago
sc-breadcrumbs.cjs.entry.js.map
3 years ago
sc-button-group.cjs.entry.js
3 years ago
sc-button-group.cjs.entry.js.map
3 years ago
sc-button_2.cjs.entry.js
3 years ago
sc-button_2.cjs.entry.js.map
3 years ago
sc-cancel-dialog_2.cjs.entry.js
3 years ago
sc-cancel-dialog_2.cjs.entry.js.map
3 years ago
sc-cancel-discount_4.cjs.entry.js
3 years ago
sc-cancel-discount_4.cjs.entry.js.map
3 years ago
sc-card_2.cjs.entry.js
3 years ago
sc-card_2.cjs.entry.js.map
3 years ago
sc-cart-button.cjs.entry.js
3 years ago
sc-cart-button.cjs.entry.js.map
3 years ago
sc-cart-form-submit.cjs.entry.js
3 years ago
sc-cart-form-submit.cjs.entry.js.map
3 years ago
sc-cart-form.cjs.entry.js
3 years ago
sc-cart-form.cjs.entry.js.map
3 years ago
sc-cart-header.cjs.entry.js
3 years ago
sc-cart-header.cjs.entry.js.map
3 years ago
sc-cart-icon.cjs.entry.js
3 years ago
sc-cart-icon.cjs.entry.js.map
3 years ago
sc-cart-loader.cjs.entry.js
3 years ago
sc-cart-loader.cjs.entry.js.map
3 years ago
sc-cart-session-provider_3.cjs.entry.js
3 years ago
sc-cart-session-provider_3.cjs.entry.js.map
3 years ago
sc-cart-submit.cjs.entry.js
3 years ago
sc-cart-submit.cjs.entry.js.map
3 years ago
sc-cart.cjs.entry.js
3 years ago
sc-cart.cjs.entry.js.map
3 years ago
sc-cc-logo_2.cjs.entry.js
3 years ago
sc-cc-logo_2.cjs.entry.js.map
3 years ago
sc-charges-list.cjs.entry.js
3 years ago
sc-charges-list.cjs.entry.js.map
3 years ago
sc-checkbox.cjs.entry.js
3 years ago
sc-checkbox.cjs.entry.js.map
3 years ago
sc-checkout-form-errors.cjs.entry.js
3 years ago
sc-checkout-form-errors.cjs.entry.js.map
3 years ago
sc-checkout-mollie-payment.cjs.entry.js
3 years ago
sc-checkout-mollie-payment.cjs.entry.js.map
3 years ago
sc-checkout-unsaved-changes-warning_7.cjs.entry.js
3 years ago
sc-checkout-unsaved-changes-warning_7.cjs.entry.js.map
3 years ago
sc-checkout.cjs.entry.js
3 years ago
sc-checkout.cjs.entry.js.map
3 years ago
sc-choice-container.cjs.entry.js
3 years ago
sc-choice-container.cjs.entry.js.map
3 years ago
sc-choice.cjs.entry.js
3 years ago
sc-choice.cjs.entry.js.map
3 years ago
sc-choices.cjs.entry.js
3 years ago
sc-choices.cjs.entry.js.map
3 years ago
sc-column_2.cjs.entry.js
3 years ago
sc-column_2.cjs.entry.js.map
3 years ago
sc-compact-address_6.cjs.entry.js
3 years ago
sc-compact-address_6.cjs.entry.js.map
3 years ago
sc-conditional-form.cjs.entry.js
3 years ago
sc-conditional-form.cjs.entry.js.map
3 years ago
sc-consumer.cjs.entry.js
3 years ago
sc-consumer.cjs.entry.js.map
3 years ago
sc-coupon-form.cjs.entry.js
3 years ago
sc-coupon-form.cjs.entry.js.map
3 years ago
sc-custom-order-price-input.cjs.entry.js
3 years ago
sc-custom-order-price-input.cjs.entry.js.map
3 years ago
sc-customer-details.cjs.entry.js
3 years ago
sc-customer-details.cjs.entry.js.map
3 years ago
sc-customer-edit.cjs.entry.js
3 years ago
sc-customer-edit.cjs.entry.js.map
3 years ago
sc-customer-email.cjs.entry.js
3 years ago
sc-customer-email.cjs.entry.js.map
3 years ago
sc-customer-firstname.cjs.entry.js
3 years ago
sc-customer-firstname.cjs.entry.js.map
3 years ago
sc-customer-lastname.cjs.entry.js
3 years ago
sc-customer-lastname.cjs.entry.js.map
3 years ago
sc-customer-name.cjs.entry.js
3 years ago
sc-customer-name.cjs.entry.js.map
3 years ago
sc-customer-phone.cjs.entry.js
3 years ago
sc-customer-phone.cjs.entry.js.map
3 years ago
sc-dashboard-customer-details.cjs.entry.js
3 years ago
sc-dashboard-customer-details.cjs.entry.js.map
3 years ago
sc-dashboard-downloads-list.cjs.entry.js
3 years ago
sc-dashboard-downloads-list.cjs.entry.js.map
3 years ago
sc-dialog.cjs.entry.js
3 years ago
sc-dialog.cjs.entry.js.map
3 years ago
sc-divider.cjs.entry.js
3 years ago
sc-divider.cjs.entry.js.map
3 years ago
sc-donation-choices.cjs.entry.js
3 years ago
sc-donation-choices.cjs.entry.js.map
3 years ago
sc-downloads-list.cjs.entry.js
3 years ago
sc-downloads-list.cjs.entry.js.map
3 years ago
sc-dropdown_4.cjs.entry.js
3 years ago
sc-dropdown_4.cjs.entry.js.map
3 years ago
sc-empty.cjs.entry.js
3 years ago
sc-empty.cjs.entry.js.map
3 years ago
sc-express-payment.cjs.entry.js
3 years ago
sc-express-payment.cjs.entry.js.map
3 years ago
sc-flex.cjs.entry.js
3 years ago
sc-flex.cjs.entry.js.map
3 years ago
sc-form-control_2.cjs.entry.js
3 years ago
sc-form-control_2.cjs.entry.js.map
3 years ago
sc-form-row.cjs.entry.js
3 years ago
sc-form-row.cjs.entry.js.map
3 years ago
sc-form.cjs.entry.js
3 years ago
sc-form.cjs.entry.js.map
3 years ago
sc-format-bytes.cjs.entry.js
3 years ago
sc-format-bytes.cjs.entry.js.map
3 years ago
sc-format-date.cjs.entry.js
3 years ago
sc-format-date.cjs.entry.js.map
3 years ago
sc-format-interval.cjs.entry.js
3 years ago
sc-format-interval.cjs.entry.js.map
3 years ago
sc-format-number.cjs.entry.js
3 years ago
sc-format-number.cjs.entry.js.map
3 years ago
sc-heading_2.cjs.entry.js
3 years ago
sc-heading_2.cjs.entry.js.map
3 years ago
sc-icon.cjs.entry.js
3 years ago
sc-icon.cjs.entry.js.map
3 years ago
sc-image-slider.cjs.entry.js
3 years ago
sc-image-slider.cjs.entry.js.map
3 years ago
sc-invoices-list.cjs.entry.js
3 years ago
sc-invoices-list.cjs.entry.js.map
3 years ago
sc-licenses-list.cjs.entry.js
3 years ago
sc-licenses-list.cjs.entry.js.map
3 years ago
sc-line-item-bump.cjs.entry.js
3 years ago
sc-line-item-bump.cjs.entry.js.map
3 years ago
sc-line-item-total.cjs.entry.js
3 years ago
sc-line-item-total.cjs.entry.js.map
3 years ago
sc-line-item.cjs.entry.js
3 years ago
sc-line-item.cjs.entry.js.map
3 years ago
sc-line-items-provider.cjs.entry.js
3 years ago
sc-line-items-provider.cjs.entry.js.map
3 years ago
sc-line-items.cjs.entry.js
3 years ago
sc-line-items.cjs.entry.js.map
3 years ago
sc-login-form.cjs.entry.js
3 years ago
sc-login-form.cjs.entry.js.map
3 years ago
sc-menu-divider.cjs.entry.js
3 years ago
sc-menu-divider.cjs.entry.js.map
3 years ago
sc-mollie-add-method.cjs.entry.js
3 years ago
sc-mollie-add-method.cjs.entry.js.map
3 years ago
sc-order-confirmation-customer.cjs.entry.js
3 years ago
sc-order-confirmation-customer.cjs.entry.js.map
3 years ago
sc-order-confirmation-details.cjs.entry.js
3 years ago
sc-order-confirmation-details.cjs.entry.js.map
3 years ago
sc-order-confirmation-line-items_2.cjs.entry.js
3 years ago
sc-order-confirmation-line-items_2.cjs.entry.js.map
3 years ago
sc-order-confirmation.cjs.entry.js
3 years ago
sc-order-confirmation.cjs.entry.js.map
3 years ago
sc-order-coupon-form.cjs.entry.js
3 years ago
sc-order-coupon-form.cjs.entry.js.map
3 years ago
sc-order-detail.cjs.entry.js
3 years ago
sc-order-detail.cjs.entry.js.map
3 years ago
sc-order-manual-instructions.cjs.entry.js
3 years ago
sc-order-manual-instructions.cjs.entry.js.map
3 years ago
sc-order-password.cjs.entry.js
3 years ago
sc-order-password.cjs.entry.js.map
3 years ago
sc-order-status-badge.cjs.entry.js
3 years ago
sc-order-status-badge.cjs.entry.js.map
3 years ago
sc-order-submit.cjs.entry.js
3 years ago
sc-order-submit.cjs.entry.js.map
3 years ago
sc-order-summary.cjs.entry.js
3 years ago
sc-order-summary.cjs.entry.js.map
3 years ago
sc-order.cjs.entry.js
3 years ago
sc-order.cjs.entry.js.map
3 years ago
sc-orders-list.cjs.entry.js
3 years ago
sc-orders-list.cjs.entry.js.map
3 years ago
sc-pagination.cjs.entry.js
3 years ago
sc-pagination.cjs.entry.js.map
3 years ago
sc-password-nag.cjs.entry.js
3 years ago
sc-password-nag.cjs.entry.js.map
3 years ago
sc-payment-method-choice_2.cjs.entry.js
3 years ago
sc-payment-method-choice_2.cjs.entry.js.map
3 years ago
sc-payment-methods-list.cjs.entry.js
3 years ago
sc-payment-methods-list.cjs.entry.js.map
3 years ago
sc-payment.cjs.entry.js
3 years ago
sc-payment.cjs.entry.js.map
3 years ago
sc-paypal-add-method.cjs.entry.js
3 years ago
sc-paypal-add-method.cjs.entry.js.map
3 years ago
sc-paypal-buttons_2.cjs.entry.js
3 years ago
sc-paypal-buttons_2.cjs.entry.js.map
3 years ago
sc-phone-input.cjs.entry.js
3 years ago
sc-phone-input.cjs.entry.js.map
3 years ago
sc-premium-tag.cjs.entry.js
3 years ago
sc-premium-tag.cjs.entry.js.map
3 years ago
sc-price-choice-container.cjs.entry.js
3 years ago
sc-price-choice-container.cjs.entry.js.map
3 years ago
sc-price-choice.cjs.entry.js
3 years ago
sc-price-choice.cjs.entry.js.map
3 years ago
sc-price-choices.cjs.entry.js
3 years ago
sc-price-choices.cjs.entry.js.map
3 years ago
sc-price-input.cjs.entry.js
3 years ago
sc-price-input.cjs.entry.js.map
3 years ago
sc-price-range.cjs.entry.js
3 years ago
sc-price-range.cjs.entry.js.map
3 years ago
sc-product-buy-button.cjs.entry.js
3 years ago
sc-product-buy-button.cjs.entry.js.map
3 years ago
sc-product-item-image_3.cjs.entry.js
3 years ago
sc-product-item-image_3.cjs.entry.js.map
3 years ago
sc-product-item-list.cjs.entry.js
3 years ago
sc-product-item-list.cjs.entry.js.map
3 years ago
sc-product-item.cjs.entry.js
3 years ago
sc-product-item.cjs.entry.js.map
3 years ago
sc-product-line-item_2.cjs.entry.js
3 years ago
sc-product-line-item_2.cjs.entry.js.map
3 years ago
sc-product-price-choices.cjs.entry.js
3 years ago
sc-product-price-choices.cjs.entry.js.map
3 years ago
sc-product-price-modal.cjs.entry.js
3 years ago
sc-product-price-modal.cjs.entry.js.map
3 years ago
sc-product-price.cjs.entry.js
3 years ago
sc-product-price.cjs.entry.js.map
3 years ago
sc-product-quantity.cjs.entry.js
3 years ago
sc-product-quantity.cjs.entry.js.map
3 years ago
sc-product-selected-price.cjs.entry.js
3 years ago
sc-product-selected-price.cjs.entry.js.map
3 years ago
sc-product-text.cjs.entry.js
3 years ago
sc-product-text.cjs.entry.js.map
3 years ago
sc-prose.cjs.entry.js
3 years ago
sc-prose.cjs.entry.js.map
3 years ago
sc-provider.cjs.entry.js
3 years ago
sc-provider.cjs.entry.js.map
3 years ago
sc-purchase-downloads-list_2.cjs.entry.js
3 years ago
sc-purchase-downloads-list_2.cjs.entry.js.map
3 years ago
sc-radio-group.cjs.entry.js
3 years ago
sc-radio-group.cjs.entry.js.map
3 years ago
sc-radio.cjs.entry.js
3 years ago
sc-radio.cjs.entry.js.map
3 years ago
sc-rich-text.cjs.entry.js
3 years ago
sc-rich-text.cjs.entry.js.map
3 years ago
sc-skeleton.cjs.entry.js
3 years ago
sc-skeleton.cjs.entry.js.map
3 years ago
sc-stacked-list_2.cjs.entry.js
3 years ago
sc-stacked-list_2.cjs.entry.js.map
3 years ago
sc-stripe-add-method.cjs.entry.js
3 years ago
sc-stripe-add-method.cjs.entry.js.map
3 years ago
sc-stripe-element.cjs.entry.js
3 years ago
sc-stripe-element.cjs.entry.js.map
3 years ago
sc-stripe-payment-element.cjs.entry.js
3 years ago
sc-stripe-payment-element.cjs.entry.js.map
3 years ago
sc-stripe-payment-request.cjs.entry.js
3 years ago
sc-stripe-payment-request.cjs.entry.js.map
3 years ago
sc-subscription-ad-hoc-confirm.cjs.entry.js
3 years ago
sc-subscription-ad-hoc-confirm.cjs.entry.js.map
3 years ago
sc-subscription-details_2.cjs.entry.js
3 years ago
sc-subscription-details_2.cjs.entry.js.map
3 years ago
sc-subscription-payment-method.cjs.entry.js
3 years ago
sc-subscription-payment-method.cjs.entry.js.map
3 years ago
sc-subscription-payment.cjs.entry.js
3 years ago
sc-subscription-payment.cjs.entry.js.map
3 years ago
sc-subscription-switch.cjs.entry.js
3 years ago
sc-subscription-switch.cjs.entry.js.map
3 years ago
sc-subscription.cjs.entry.js
3 years ago
sc-subscription.cjs.entry.js.map
3 years ago
sc-subscriptions-list.cjs.entry.js
3 years ago
sc-subscriptions-list.cjs.entry.js.map
3 years ago
sc-switch.cjs.entry.js
3 years ago
sc-switch.cjs.entry.js.map
3 years ago
sc-tab-group.cjs.entry.js
3 years ago
sc-tab-group.cjs.entry.js.map
3 years ago
sc-tab-panel.cjs.entry.js
3 years ago
sc-tab-panel.cjs.entry.js.map
3 years ago
sc-tab.cjs.entry.js
3 years ago
sc-tab.cjs.entry.js.map
3 years ago
sc-table-head.cjs.entry.js
3 years ago
sc-table-head.cjs.entry.js.map
3 years ago
sc-table_3.cjs.entry.js
3 years ago
sc-table_3.cjs.entry.js.map
3 years ago
sc-tag.cjs.entry.js
3 years ago
sc-tag.cjs.entry.js.map
3 years ago
sc-text.cjs.entry.js
3 years ago
sc-text.cjs.entry.js.map
3 years ago
sc-toggle.cjs.entry.js
3 years ago
sc-toggle.cjs.entry.js.map
3 years ago
sc-toggles.cjs.entry.js
3 years ago
sc-toggles.cjs.entry.js.map
3 years ago
sc-tooltip.cjs.entry.js
3 years ago
sc-tooltip.cjs.entry.js.map
3 years ago
sc-total.cjs.entry.js
3 years ago
sc-total.cjs.entry.js.map
3 years ago
sc-upcoming-invoice.cjs.entry.js
3 years ago
sc-upcoming-invoice.cjs.entry.js.map
3 years ago
sc-upgrade-required.cjs.entry.js
3 years ago
sc-upgrade-required.cjs.entry.js.map
3 years ago
sc-wordpress-password-edit.cjs.entry.js
3 years ago
sc-wordpress-password-edit.cjs.entry.js.map
3 years ago
sc-wordpress-user-edit.cjs.entry.js
3 years ago
sc-wordpress-user-edit.cjs.entry.js.map
3 years ago
sc-wordpress-user.cjs.entry.js
3 years ago
sc-wordpress-user.cjs.entry.js.map
3 years ago
store-79bafee3.js
3 years ago
store-79bafee3.js.map
3 years ago
store-a92c3e74.js
3 years ago
store-a92c3e74.js.map
3 years ago
surecart.cjs.js
3 years ago
surecart.cjs.js.map
3 years ago
tax-39abdb3c.js
3 years ago
tax-39abdb3c.js.map
3 years ago
ui-c6cc5556.js
3 years ago
ui-c6cc5556.js.map
3 years ago
universe-874f42bb.js
3 years ago
universe-874f42bb.js.map
3 years ago
util-872b1a55.js
3 years ago
util-872b1a55.js.map
3 years ago
utils-806dad60.js
3 years ago
utils-806dad60.js.map
3 years ago
watchers-42477f79.js
3 years ago
watchers-42477f79.js.map
3 years ago
watchers-437b71fb.js
3 years ago
watchers-437b71fb.js.map
3 years ago
watchers-503cdd2a.js
3 years ago
watchers-503cdd2a.js.map
3 years ago
watchers-bce289f5.js
3 years ago
watchers-bce289f5.js.map
3 years ago
sc-dialog.cjs.entry.js
188 lines
| 1 | 'use strict'; |
| 2 | |
| 3 | Object.defineProperty(exports, '__esModule', { value: true }); |
| 4 | |
| 5 | const index = require('./index-ac77ca60.js'); |
| 6 | const animationRegistry = require('./animation-registry-58bec802.js'); |
| 7 | |
| 8 | const locks = new Set(); |
| 9 | // |
| 10 | // Prevents body scrolling. Keeps track of which elements requested a lock so multiple levels of locking are possible |
| 11 | // without premature unlocking. |
| 12 | // |
| 13 | function lockBodyScrolling(lockingEl) { |
| 14 | locks.add(lockingEl); |
| 15 | document.body.classList.add('sc-scroll-lock'); |
| 16 | } |
| 17 | // |
| 18 | // Unlocks body scrolling. Scrolling will only be unlocked once all elements that requested a lock call this method. |
| 19 | // |
| 20 | function unlockBodyScrolling(lockingEl) { |
| 21 | locks.delete(lockingEl); |
| 22 | if (locks.size === 0) { |
| 23 | document.body.classList.remove('sc-scroll-lock'); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | const scDialogCss = ":host{--width:31rem;--header-spacing:var(--sc-spacing-large);--body-spacing:var(--sc-spacing-large);--footer-spacing:var(--sc-spacing-large);display:contents}[hidden]{display:none !important}.dialog{display:flex;align-items:center;justify-content:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--sc-z-index-dialog);box-sizing:border-box;text-align:left}.dialog__panel{display:flex;flex-direction:column;z-index:2;width:var(--width);max-width:100vw;max-height:100vh;background-color:var(--sc-panel-background-color);border-radius:var(--sc-border-radius-medium);box-shadow:var(--sc-shadow-x-large);position:relative}.dialog__panel:focus{outline:none}@media screen and (max-width: 420px){.dialog__panel{max-height:80vh}}.dialog--open .dialog__panel{display:flex;opacity:1;transform:none}.dialog__header{flex:0 0 auto;display:flex;border-bottom:1px solid var(--sc-color-gray-300)}.dialog__title{flex:1 1 auto;font:inherit;font-size:var(--sc-font-size-large);line-height:var(--sc-line-height-dense);padding:var(--header-spacing);margin:0}.dialog__close{flex:0 0 auto;display:flex;align-items:center;font-size:var(--sc-font-size-x-large);padding:0 calc(var(--header-spacing) / 2);z-index:2}.dialog__body{flex:1 1 auto;padding:var(--body-spacing);overflow:var(--dialog-body-overflow, auto);-webkit-overflow-scrolling:touch}.dialog__footer{flex:0 0 auto;text-align:right;padding:var(--footer-spacing)}.dialog__footer ::slotted(sl-button:not(:first-of-type)){margin-left:var(--sc-spacing-x-small)}.dialog:not(.dialog--has-footer) .dialog__footer{display:none}.dialog__overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--sc-overlay-background-color)}"; |
| 28 | |
| 29 | const ScDialog = class { |
| 30 | constructor(hostRef) { |
| 31 | index.registerInstance(this, hostRef); |
| 32 | this.scRequestClose = index.createEvent(this, "scRequestClose", 7); |
| 33 | this.scShow = index.createEvent(this, "scShow", 7); |
| 34 | this.scAfterShow = index.createEvent(this, "scAfterShow", 7); |
| 35 | this.scHide = index.createEvent(this, "scHide", 7); |
| 36 | this.scAfterHide = index.createEvent(this, "scAfterHide", 7); |
| 37 | this.scInitialFocus = index.createEvent(this, "scInitialFocus", 7); |
| 38 | this.open = false; |
| 39 | this.label = ''; |
| 40 | this.noHeader = false; |
| 41 | this.hasFooter = false; |
| 42 | } |
| 43 | /** Shows the dialog. */ |
| 44 | async show() { |
| 45 | if (this.open) { |
| 46 | return undefined; |
| 47 | } |
| 48 | this.open = true; |
| 49 | } |
| 50 | /** Hides the dialog */ |
| 51 | async hide() { |
| 52 | if (!this.open) { |
| 53 | return undefined; |
| 54 | } |
| 55 | this.open = false; |
| 56 | } |
| 57 | requestClose(source) { |
| 58 | const slRequestClose = this.scRequestClose.emit(source); |
| 59 | if (slRequestClose.defaultPrevented) { |
| 60 | const animation = animationRegistry.getAnimation(this.el, 'dialog.denyClose'); |
| 61 | animationRegistry.animateTo(this.panel, animation.keyframes, animation.options); |
| 62 | return; |
| 63 | } |
| 64 | this.hide(); |
| 65 | } |
| 66 | handleKeyDown(event) { |
| 67 | if (event.key === 'Escape') { |
| 68 | event.stopPropagation(); |
| 69 | this.requestClose('keyboard'); |
| 70 | } |
| 71 | } |
| 72 | async handleOpenChange() { |
| 73 | if (this.open) { |
| 74 | // Show |
| 75 | this.scShow.emit(); |
| 76 | lockBodyScrolling(this.el); |
| 77 | // When the dialog is shown, Safari will attempt to set focus on whatever element has autofocus. This can cause |
| 78 | // the dialogs's animation to jitter (if it starts offscreen), so we'll temporarily remove the attribute, call |
| 79 | // `focus({ preventScroll: true })` ourselves, and add the attribute back afterwards. |
| 80 | // |
| 81 | // Related: https://github.com/shoelace-style/shoelace/issues/693 |
| 82 | // |
| 83 | const autoFocusTarget = this.el.querySelector('[autofocus]'); |
| 84 | if (autoFocusTarget) { |
| 85 | autoFocusTarget.removeAttribute('autofocus'); |
| 86 | } |
| 87 | await Promise.all([animationRegistry.stopAnimations(this.dialog), animationRegistry.stopAnimations(this.overlay)]); |
| 88 | this.dialog.hidden = false; |
| 89 | // Set initial focus |
| 90 | requestAnimationFrame(() => { |
| 91 | const slInitialFocus = this.scInitialFocus.emit(); |
| 92 | if (!slInitialFocus.defaultPrevented) { |
| 93 | // Set focus to the autofocus target and restore the attribute |
| 94 | if (autoFocusTarget) { |
| 95 | autoFocusTarget.focus({ preventScroll: true }); |
| 96 | } |
| 97 | else { |
| 98 | this.panel.focus({ preventScroll: true }); |
| 99 | } |
| 100 | } |
| 101 | // Restore the autofocus attribute |
| 102 | if (autoFocusTarget) { |
| 103 | autoFocusTarget.setAttribute('autofocus', ''); |
| 104 | } |
| 105 | }); |
| 106 | const panelAnimation = animationRegistry.getAnimation(this.el, 'dialog.show'); |
| 107 | const overlayAnimation = animationRegistry.getAnimation(this.el, 'dialog.overlay.show'); |
| 108 | await Promise.all([animationRegistry.animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options), animationRegistry.animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)]); |
| 109 | this.scAfterShow.emit(); |
| 110 | } |
| 111 | else { |
| 112 | // Hide |
| 113 | this.scHide.emit(); |
| 114 | await Promise.all([animationRegistry.stopAnimations(this.dialog), animationRegistry.stopAnimations(this.overlay)]); |
| 115 | const panelAnimation = animationRegistry.getAnimation(this.el, 'dialog.hide'); |
| 116 | const overlayAnimation = animationRegistry.getAnimation(this.el, 'dialog.overlay.hide'); |
| 117 | await Promise.all([animationRegistry.animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options), animationRegistry.animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)]); |
| 118 | this.dialog.hidden = true; |
| 119 | unlockBodyScrolling(this.el); |
| 120 | // Restore focus to the original trigger |
| 121 | const trigger = this.originalTrigger; |
| 122 | if (typeof (trigger === null || trigger === void 0 ? void 0 : trigger.focus) === 'function') { |
| 123 | setTimeout(() => trigger.focus()); |
| 124 | } |
| 125 | this.scAfterHide.emit(); |
| 126 | } |
| 127 | } |
| 128 | componentDidLoad() { |
| 129 | this.hasFooter = !!this.el.querySelector('[slot="footer"]'); |
| 130 | this.dialog.hidden = !this.open; |
| 131 | if (this.open) { |
| 132 | lockBodyScrolling(this.el); |
| 133 | } |
| 134 | } |
| 135 | disconnectedCallback() { |
| 136 | unlockBodyScrolling(this.el); |
| 137 | } |
| 138 | render() { |
| 139 | return (index.h("div", { part: "base", ref: el => (this.dialog = el), class: { |
| 140 | 'dialog': true, |
| 141 | 'dialog--open': this.open, |
| 142 | 'dialog--has-footer': this.hasFooter, |
| 143 | }, onKeyDown: e => this.handleKeyDown(e) }, index.h("div", { part: "overlay", class: "dialog__overlay", onClick: e => { |
| 144 | e.preventDefault(); |
| 145 | e.stopImmediatePropagation(); |
| 146 | this.requestClose('overlay'); |
| 147 | }, ref: el => (this.overlay = el), tabindex: "-1" }), index.h("div", { part: "panel", class: "dialog__panel", role: "dialog", "aria-modal": "true", "aria-hidden": this.open ? 'false' : 'true', "aria-label": this.noHeader || this.label, "aria-labelledby": !this.noHeader || 'title', ref: el => (this.panel = el), tabindex: "0" }, !this.noHeader && (index.h("header", { part: "header", class: "dialog__header" }, index.h("h2", { part: "title", class: "dialog__title", id: "title" }, index.h("slot", { name: "label" }, " ", this.label.length > 0 ? this.label : String.fromCharCode(65279), " ")), index.h("sc-button", { class: "dialog__close", type: "text", circle: true, part: "close-button", exportparts: "base:close-button__base", onClick: e => { |
| 148 | e.preventDefault(); |
| 149 | e.stopImmediatePropagation(); |
| 150 | this.requestClose('close-button'); |
| 151 | } }, index.h("sc-icon", { name: "x", label: wp.i18n.__('Close', 'surecart') })))), index.h("div", { part: "body", class: "dialog__body" }, index.h("slot", null)), index.h("footer", { part: "footer", class: "dialog__footer" }, index.h("slot", { name: "footer" }))))); |
| 152 | } |
| 153 | get el() { return index.getElement(this); } |
| 154 | static get watchers() { return { |
| 155 | "open": ["handleOpenChange"] |
| 156 | }; } |
| 157 | }; |
| 158 | animationRegistry.setDefaultAnimation('dialog.show', { |
| 159 | keyframes: [ |
| 160 | { opacity: 0, transform: 'scale(0.8)' }, |
| 161 | { opacity: 1, transform: 'scale(1)' }, |
| 162 | ], |
| 163 | options: { duration: 150, easing: 'ease' }, |
| 164 | }); |
| 165 | animationRegistry.setDefaultAnimation('dialog.hide', { |
| 166 | keyframes: [ |
| 167 | { opacity: 1, transform: 'scale(1)' }, |
| 168 | { opacity: 0, transform: 'scale(0.8)' }, |
| 169 | ], |
| 170 | options: { duration: 150, easing: 'ease' }, |
| 171 | }); |
| 172 | animationRegistry.setDefaultAnimation('dialog.denyClose', { |
| 173 | keyframes: [{ transform: 'scale(1)' }, { transform: 'scale(1.02)' }, { transform: 'scale(1)' }], |
| 174 | options: { duration: 150 }, |
| 175 | }); |
| 176 | animationRegistry.setDefaultAnimation('dialog.overlay.show', { |
| 177 | keyframes: [{ opacity: 0 }, { opacity: 1 }], |
| 178 | options: { duration: 150 }, |
| 179 | }); |
| 180 | animationRegistry.setDefaultAnimation('dialog.overlay.hide', { |
| 181 | keyframes: [{ opacity: 1 }, { opacity: 0 }], |
| 182 | options: { duration: 150 }, |
| 183 | }); |
| 184 | ScDialog.style = scDialogCss; |
| 185 | |
| 186 | exports.sc_dialog = ScDialog; |
| 187 | |
| 188 | //# sourceMappingURL=sc-dialog.cjs.entry.js.map |