41983be9228261797fd2f49220f06c66101cc4fa6f8e9f96a87d12ed694989830efba5831d9629fb6db6c2816add55d3f7802006a43052ad034c96a58c5aec 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { computed, unref, ref } from 'vue';
  2. import { useZIndex } from '../../../../hooks/use-z-index/index.mjs';
  3. import { useNamespace } from '../../../../hooks/use-namespace/index.mjs';
  4. import { isNumber } from '../../../../utils/types.mjs';
  5. const usePopperContentDOM = (props, {
  6. attributes,
  7. styles,
  8. role
  9. }) => {
  10. const { nextZIndex } = useZIndex();
  11. const ns = useNamespace("popper");
  12. const contentAttrs = computed(() => unref(attributes).popper);
  13. const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  14. const contentClass = computed(() => [
  15. ns.b(),
  16. ns.is("pure", props.pure),
  17. ns.is(props.effect),
  18. props.popperClass
  19. ]);
  20. const contentStyle = computed(() => {
  21. return [
  22. { zIndex: unref(contentZIndex) },
  23. unref(styles).popper,
  24. props.popperStyle || {}
  25. ];
  26. });
  27. const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
  28. const arrowStyle = computed(() => unref(styles).arrow || {});
  29. const updateZIndex = () => {
  30. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  31. };
  32. return {
  33. ariaModal,
  34. arrowStyle,
  35. contentAttrs,
  36. contentClass,
  37. contentStyle,
  38. contentZIndex,
  39. updateZIndex
  40. };
  41. };
  42. export { usePopperContentDOM };
  43. //# sourceMappingURL=use-content-dom.mjs.map