@zoff-tech/zt-bottom-drawer
Version:
Bottom Drawer / Web Component
56 lines (51 loc) • 1.98 kB
JavaScript
import { r as registerInstance, d as createEvent, h, H as Host } from './index-8f8312e9.js';
import { GESTURE_CONTROLLER } from '@utils/gesture';
import { g as getIonMode } from './ionic-global-8c2131e9.js';
const backdropIosCss = ":host{left:0;right:0;top:0;bottom:0;display:block;position:absolute;transform:translateZ(0);contain:strict;cursor:pointer;opacity:0.01;touch-action:none;z-index:2}:host(.backdrop-hide){background:transparent}:host(.backdrop-no-tappable){cursor:auto}:host{background-color:var(--ion-backdrop-color, #000)}";
const backdropMdCss = ":host{left:0;right:0;top:0;bottom:0;display:block;position:absolute;transform:translateZ(0);contain:strict;cursor:pointer;opacity:0.01;touch-action:none;z-index:2}:host(.backdrop-hide){background:transparent}:host(.backdrop-no-tappable){cursor:auto}:host{background-color:var(--ion-backdrop-color, #000)}";
const Backdrop = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.ionBackdropTap = createEvent(this, "ionBackdropTap", 7);
this.blocker = GESTURE_CONTROLLER.createBlocker({
disableScroll: true,
});
this.visible = true;
this.tappable = true;
this.stopPropagation = true;
}
connectedCallback() {
if (this.stopPropagation) {
this.blocker.block();
}
}
disconnectedCallback() {
this.blocker.unblock();
}
onMouseDown(ev) {
this.emitTap(ev);
}
emitTap(ev) {
if (this.stopPropagation) {
ev.preventDefault();
ev.stopPropagation();
}
if (this.tappable) {
this.ionBackdropTap.emit();
}
}
render() {
const mode = getIonMode(this);
return (h(Host, { tabindex: "-1", "aria-hidden": "true", class: {
[mode]: true,
'backdrop-hide': !this.visible,
'backdrop-no-tappable': !this.tappable,
} }));
}
};
Backdrop.style = {
ios: backdropIosCss,
md: backdropMdCss
};
export { Backdrop as ion_backdrop };
//# sourceMappingURL=ion-backdrop.entry.js.map