Sha256: d7cf42dac24bb33f1ff4ffc7f7371fead63d71eb191d37a1bc18ab28a0dee5a5
Contents?: true
Size: 806 Bytes
Versions: 2
Compression:
Stored size: 806 Bytes
Contents
import {controllerFactory} from '@utils/createController' import {disableBodyScroll, enableBodyScroll} from 'body-scroll-lock' export default class DialogController extends controllerFactory()({ targets: {dialog: HTMLDialogElement}, }) { close() { this.dialogTarget.close() // reset any child forms for (const form of this.dialogTarget.querySelectorAll('form') ?? []) { form.reset() } enableBodyScroll(this.dialogTarget) } disconnect() { this.close() } open() { this.dialogTarget.showModal() disableBodyScroll(this.dialogTarget, {reserveScrollBarGap: true}) } triggerClick() { if (this.dialogTarget.open) this.close() else this.open() } windowClick(e: MouseEvent) { if (e.target === this.dialogTarget) { this.close() } } }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ariadne_view_components-0.0.76 | app/components/ariadne/ui/dialog/component.ts |
ariadne_view_components-0.0.75 | app/components/ariadne/ui/dialog/component.ts |