mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-08 13:33:42 +08:00
00364fd645
Separate Galaxy authentication and local access policy from web presentation. Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
19 lines
960 B
JavaScript
19 lines
960 B
JavaScript
// Native modal behavior provides focus trapping, Escape, and focus restoration.
|
|
export const GxDialog = {
|
|
inheritAttrs: false,
|
|
props: { labelledby: { type: String, required: true }, describedby: String, alert: Boolean },
|
|
emits: ["close"],
|
|
mounted() { this.$refs.dialog.showModal() },
|
|
beforeUnmount() { this.$refs.dialog.close() },
|
|
methods: {
|
|
backdrop(event) {
|
|
if (event.target !== this.$refs.dialog) return
|
|
const rect = event.target.getBoundingClientRect()
|
|
if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) this.$emit("close")
|
|
},
|
|
},
|
|
template: `<Teleport to="body"><dialog ref="dialog" v-bind="$attrs" class="gx-card gx-settings__dialog gx-dialog"
|
|
:role="alert ? 'alertdialog' : 'dialog'" :aria-labelledby="labelledby" :aria-describedby="describedby"
|
|
@cancel.prevent="$emit('close')" @click="backdrop"><slot></slot></dialog></Teleport>`,
|
|
}
|