@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
62 lines (61 loc) • 1.68 kB
JavaScript
import { defineComponent as f, ref as a, onMounted as d, watch as m, onUnmounted as p } from "vue";
import { NeonPosition as c } from "../../../common/enums/NeonPosition.es.js";
import { NeonClosableUtils as v } from "../../../common/utils/NeonClosableUtils.es.js";
const B = f({
name: "NeonDrawer",
props: {
/**
* Set the drawer to visible.
*/
open: { type: Boolean, required: !0 },
/**
* Whether the user is allowed to dismiss the modal by clicking outside the modal or pressing escape.
*/
dismissible: { type: Boolean, default: !0 },
/**
* If true, remove the padding applied to the drawer.
*/
fullWidth: { type: Boolean, default: !1 },
/**
* The location of the drawer.
*/
position: { type: String, default: c.Left },
/**
* Display a semi-transparent overlay under the drawer, but over the rest of the page.
*/
overlay: { type: Boolean, default: !0 }
},
emits: [
/**
* Emitted when the drawer is closed.
* @type {void}
*/
"close"
],
setup(t, { emit: i }) {
const l = a(null), e = a(null), u = () => {
i("close");
}, r = () => {
t.open && u();
};
return d(() => {
t.dismissible && (e.value = l.value && new v(l.value, r) || null);
}), m(
() => t.open,
(o) => {
var n, s;
return o ? (n = e.value) == null ? void 0 : n.open() : (s = e.value) == null ? void 0 : s.close();
},
{ immediate: !0 }
), p(() => {
var o;
(o = e.value) == null || o.destroy();
}), {
drawer: l
};
}
});
export {
B as default
};
//# sourceMappingURL=NeonDrawer.es.js.map