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