ion-backdrop.entry.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*!
  2. * (C) Ionic http://ionicframework.com - MIT License
  3. */
  4. import { r as registerInstance, c as createEvent, h, e as Host } from './index-527b9e34.js';
  5. import { b as getIonMode } from './ionic-global-b26f573e.js';
  6. import './index-cfd9c1f2.js';
  7. const backdropIosCss = ":host{left:0;right:0;top:0;bottom:0;display:block;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);contain:strict;cursor:pointer;opacity:0.01;-ms-touch-action:none;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)}";
  8. const IonBackdropIosStyle0 = backdropIosCss;
  9. const backdropMdCss = ":host{left:0;right:0;top:0;bottom:0;display:block;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);contain:strict;cursor:pointer;opacity:0.01;-ms-touch-action:none;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)}";
  10. const IonBackdropMdStyle0 = backdropMdCss;
  11. const Backdrop = class {
  12. constructor(hostRef) {
  13. registerInstance(this, hostRef);
  14. this.ionBackdropTap = createEvent(this, "ionBackdropTap", 7);
  15. this.visible = true;
  16. this.tappable = true;
  17. this.stopPropagation = true;
  18. }
  19. onMouseDown(ev) {
  20. this.emitTap(ev);
  21. }
  22. emitTap(ev) {
  23. if (this.stopPropagation) {
  24. ev.preventDefault();
  25. ev.stopPropagation();
  26. }
  27. if (this.tappable) {
  28. this.ionBackdropTap.emit();
  29. }
  30. }
  31. render() {
  32. const mode = getIonMode(this);
  33. return (h(Host, { key: '7abaf2c310aa399607451b14063265e8a5846938', "aria-hidden": "true", class: {
  34. [mode]: true,
  35. 'backdrop-hide': !this.visible,
  36. 'backdrop-no-tappable': !this.tappable,
  37. } }));
  38. }
  39. };
  40. Backdrop.style = {
  41. ios: IonBackdropIosStyle0,
  42. md: IonBackdropMdStyle0
  43. };
  44. export { Backdrop as ion_backdrop };