element-plus
Version:
A Component Library for Vue 3
46 lines (43 loc) • 1.26 kB
JavaScript
import { computed, unref, ref } from 'vue';
import '../../../../hooks/index.mjs';
import { useZIndex } from '../../../../hooks/use-z-index/index.mjs';
import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
const usePopperContentDOM = (props, {
attributes,
styles,
role
}) => {
const { nextZIndex } = useZIndex();
const ns = useNamespace("popper");
const contentAttrs = computed(() => unref(attributes).popper);
const contentZIndex = ref(props.zIndex || nextZIndex());
const contentClass = computed(() => [
ns.b(),
ns.is("pure", props.pure),
ns.is(props.effect),
props.popperClass
]);
const contentStyle = computed(() => {
return [
{ zIndex: unref(contentZIndex) },
props.popperStyle || {},
unref(styles).popper
];
});
const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
const arrowStyle = computed(() => unref(styles).arrow || {});
const updateZIndex = () => {
contentZIndex.value = props.zIndex || nextZIndex();
};
return {
ariaModal,
arrowStyle,
contentAttrs,
contentClass,
contentStyle,
contentZIndex,
updateZIndex
};
};
export { usePopperContentDOM };
//# sourceMappingURL=use-content-dom.mjs.map