various-ui
Version:
This is a test version of the Vue 3 component library
78 lines (75 loc) • 2.79 kB
JavaScript
import { defineComponent, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createVNode, Transition, toHandlers, withCtx, mergeProps, createElementVNode, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
import '../../../utils/index.mjs';
import { UiTooltipFunctionPropsOption, UiTooltipFunctionEmits } from './index.mjs';
import { useComposable } from './src/composable.mjs';
import { remove } from '../../../utils/src/node/index.mjs';
const _hoisted_1 = { class: "ui-tooltip-content" };
const __default__ = defineComponent({ name: "UiTooltipFunction" });
var _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: UiTooltipFunctionPropsOption,
emits: UiTooltipFunctionEmits,
setup(__props, { expose: __expose, emit: __emit }) {
const emits = __emit;
const define = __props;
const { ons, refs, nodes, methods, computeds } = useComposable(define, emits);
const { active, visible } = refs;
const { tooltip } = nodes;
const { show, hidden } = methods;
const { style } = computeds;
onBeforeUnmount(() => {
tooltip.value && remove(document.body, tooltip.value);
});
;
__expose({ show, hidden });
return (_ctx, _cache) => {
return openBlock(), createElementBlock(
"div",
{
class: normalizeClass(["ui-tooltip-container", { "ui-active": unref(active) }])
},
[
renderSlot(_ctx.$slots, "default"),
createVNode(
Transition,
toHandlers(unref(ons).animation),
{
default: withCtx(() => [
unref(visible) ? (openBlock(), createElementBlock(
"div",
mergeProps({ key: 0 }, toHandlers(unref(ons).content, true), {
class: ["ui-tooltip", _ctx.classExtraName],
ref_key: "tooltip",
ref: tooltip,
style: unref(style)
}),
[
createElementVNode("div", _hoisted_1, [
renderSlot(_ctx.$slots, "content", {}, () => [
createTextVNode(
toDisplayString(_ctx.content),
1
/* TEXT */
)
])
])
],
16
/* FULL_PROPS */
)) : createCommentVNode("v-if", true)
]),
_: 3
/* FORWARDED */
},
16
/* FULL_PROPS */
)
],
2
/* CLASS */
);
};
}
});
export { _sfc_main as default };
//# sourceMappingURL=index.vue2.mjs.map