{"version":3,"file":"use-content-dom.mjs","names":[],"sources":["../../../../../../../packages/components/popper/src/composables/use-content-dom.ts"],"sourcesContent":["import { computed, ref, unref } from 'vue'\nimport { useNamespace, useZIndex } from '@element-plus/hooks'\nimport { isNumber } from '@element-plus/utils'\n\nimport type { CSSProperties, StyleValue } from 'vue'\nimport type { UsePopperReturn } from '@element-plus/hooks'\nimport type { UsePopperContentReturn } from './use-content'\nimport type { PopperContentProps } from '../content'\n\nexport const usePopperContentDOM = (\n  props: PopperContentProps,\n  {\n    attributes,\n    styles,\n    role,\n  }: Pick<UsePopperReturn, 'attributes' | 'styles'> &\n    Pick<UsePopperContentReturn, 'role'>\n) => {\n  const { nextZIndex } = useZIndex()\n  const ns = useNamespace('popper')\n\n  const contentAttrs = computed(() => unref(attributes).popper)\n  const contentZIndex = ref<number>(\n    isNumber(props.zIndex) ? props.zIndex : nextZIndex()\n  )\n  const contentClass = computed(() => [\n    ns.b(),\n    ns.is('pure', props.pure),\n    ns.is(props.effect!),\n    props.popperClass,\n  ])\n  const contentStyle = computed<StyleValue[]>(() => {\n    return [\n      { zIndex: unref(contentZIndex) } as CSSProperties,\n      unref(styles).popper as CSSProperties,\n      props.popperStyle || {},\n    ]\n  })\n  const ariaModal = computed<string | undefined>(() =>\n    role.value === 'dialog' ? 'false' : undefined\n  )\n  const arrowStyle = computed(\n    () => (unref(styles).arrow || {}) as CSSProperties\n  )\n\n  const updateZIndex = () => {\n    contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex()\n  }\n\n  return {\n    ariaModal,\n    arrowStyle,\n    contentAttrs,\n    contentClass,\n    contentStyle,\n    contentZIndex,\n\n    updateZIndex,\n  }\n}\n\nexport type UsePopperContentDOMReturn = ReturnType<typeof usePopperContentDOM>\n"],"mappings":";;;;;AASA,MAAa,uBACX,OACA,EACE,YACA,QACA,WAGC;CACH,MAAM,EAAE,eAAe,UAAU;CACjC,MAAM,KAAK,aAAa,QAAQ;CAEhC,MAAM,eAAe,eAAe,MAAM,UAAU,CAAC,CAAC,MAAM;CAC5D,MAAM,gBAAgB,IACpB,SAAS,MAAM,MAAM,IAAI,MAAM,SAAS,WAAW,CACrD;CACA,MAAM,eAAe,eAAe;EAClC,GAAG,EAAE;EACL,GAAG,GAAG,QAAQ,MAAM,IAAI;EACxB,GAAG,GAAG,MAAM,MAAO;EACnB,MAAM;CACR,CAAC;CACD,MAAM,eAAe,eAA6B;EAChD,OAAO;GACL,EAAE,QAAQ,MAAM,aAAa,EAAE;GAC/B,MAAM,MAAM,CAAC,CAAC;GACd,MAAM,eAAe,CAAC;EACxB;CACF,CAAC;CACD,MAAM,YAAY,eAChB,KAAK,UAAU,WAAW,UAAU,KAAA,CACtC;CACA,MAAM,aAAa,eACV,MAAM,MAAM,CAAC,CAAC,SAAS,CAAC,CACjC;CAEA,MAAM,qBAAqB;EACzB,cAAc,QAAQ,SAAS,MAAM,MAAM,IAAI,MAAM,SAAS,WAAW;CAC3E;CAEA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EAEA;CACF;AACF"}