This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import TooltipV2 from './src/tooltip.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElTooltipV2: SFCWithInstall<typeof TooltipV2>;
export * from './src/arrow';
export * from './src/content';
export * from './src/root';
export * from './src/tooltip';
export * from './src/trigger';
export * from './src/constants';
export default ElTooltipV2;

View File

@@ -0,0 +1,13 @@
import TooltipV2 from './src/tooltip2.mjs';
export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './src/arrow.mjs';
export { tooltipV2ContentProps } from './src/content.mjs';
export { tooltipV2RootProps } from './src/root.mjs';
export { tooltipV2Props } from './src/tooltip.mjs';
export { tooltipV2TriggerProps } from './src/trigger.mjs';
export { TOOLTIP_V2_OPEN, tooltipV2ContentKey, tooltipV2RootKey } from './src/constants.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElTooltipV2 = withInstall(TooltipV2);
export { ElTooltipV2, ElTooltipV2 as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/tooltip-v2/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport TooltipV2 from './src/tooltip.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElTooltipV2: SFCWithInstall<typeof TooltipV2> =\n withInstall(TooltipV2)\nexport * from './src/arrow'\nexport * from './src/content'\nexport * from './src/root'\nexport * from './src/tooltip'\nexport * from './src/trigger'\nexport * from './src/constants'\n\nexport default ElTooltipV2\n"],"names":[],"mappings":";;;;;;;;;AAEY,MAAC,WAAW,GAAG,WAAW,CAAC,SAAS;;;;"}

View File

@@ -0,0 +1,17 @@
import type { CSSProperties, ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type { TooltipV2Sides } from './common';
export declare const tooltipV2ArrowProps: {
readonly width: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
readonly height: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
readonly style: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => CSSProperties) | (() => CSSProperties | null) | ((new (...args: any[]) => CSSProperties) | (() => CSSProperties | null))[], unknown, unknown, null, boolean>;
};
export declare const tooltipV2ArrowSpecialProps: {
readonly side: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => TooltipV2Sides) | (() => TooltipV2Sides) | ((new (...args: any[]) => TooltipV2Sides) | (() => TooltipV2Sides))[], TooltipV2Sides, unknown>>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export type TooltipV2ArrowProps = ExtractPropTypes<typeof tooltipV2ArrowProps>;
export type TooltipV2ArrowPropsPublic = __ExtractPublicPropTypes<typeof tooltipV2ArrowProps>;

View File

@@ -0,0 +1,27 @@
import { tooltipV2Sides } from './common.mjs';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
const tooltipV2ArrowProps = buildProps({
width: {
type: Number,
default: 10
},
height: {
type: Number,
default: 10
},
style: {
type: definePropType(Object),
default: null
}
});
const tooltipV2ArrowSpecialProps = buildProps({
side: {
type: definePropType(String),
values: tooltipV2Sides,
required: true
}
});
export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps };
//# sourceMappingURL=arrow.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"arrow.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport { tooltipV2Sides } from './common'\n\nimport type {\n CSSProperties,\n ExtractPropTypes,\n __ExtractPublicPropTypes,\n} from 'vue'\nimport type { TooltipV2Sides } from './common'\n\nexport const tooltipV2ArrowProps = buildProps({\n width: {\n type: Number,\n default: 10,\n },\n height: {\n type: Number,\n default: 10,\n },\n style: {\n type: definePropType<CSSProperties | null>(Object),\n default: null,\n },\n} as const)\n\nexport const tooltipV2ArrowSpecialProps = buildProps({\n side: {\n type: definePropType<TooltipV2Sides>(String),\n values: tooltipV2Sides,\n required: true,\n },\n} as const)\n\nexport type TooltipV2ArrowProps = ExtractPropTypes<typeof tooltipV2ArrowProps>\nexport type TooltipV2ArrowPropsPublic = __ExtractPublicPropTypes<\n typeof tooltipV2ArrowProps\n>\n"],"names":[],"mappings":";;;AAEY,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,0BAA0B,GAAG,UAAU,CAAC;AACrD,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,CAAC;;;;"}

View File

@@ -0,0 +1,27 @@
import type { CSSProperties } from 'vue';
declare const _default: import("vue").DefineComponent<{
side: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("./common").TooltipV2Sides) | (() => import("./common").TooltipV2Sides) | ((new (...args: any[]) => import("./common").TooltipV2Sides) | (() => import("./common").TooltipV2Sides))[], import("./common").TooltipV2Sides, unknown>>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
width: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
height: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
style: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => CSSProperties) | (() => CSSProperties | null) | ((new (...args: any[]) => CSSProperties) | (() => CSSProperties | null))[], unknown, unknown, null, boolean>;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
side: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("./common").TooltipV2Sides) | (() => import("./common").TooltipV2Sides) | ((new (...args: any[]) => import("./common").TooltipV2Sides) | (() => import("./common").TooltipV2Sides))[], import("./common").TooltipV2Sides, unknown>>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
width: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
height: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
style: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => CSSProperties) | (() => CSSProperties | null) | ((new (...args: any[]) => CSSProperties) | (() => CSSProperties | null))[], unknown, unknown, null, boolean>;
}>>, {
style: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => CSSProperties) | (() => CSSProperties | null) | ((new (...args: any[]) => CSSProperties) | (() => CSSProperties | null))[], unknown, unknown>;
height: number;
width: number;
}>;
export default _default;

View File

@@ -0,0 +1,43 @@
import { defineComponent, inject, computed, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass } from 'vue';
import { tooltipV2RootKey, tooltipV2ContentKey } from './constants.mjs';
import { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './arrow.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
const __default__ = defineComponent({
name: "ElTooltipV2Arrow"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: {
...tooltipV2ArrowProps,
...tooltipV2ArrowSpecialProps
},
setup(__props) {
const props = __props;
const { ns } = inject(tooltipV2RootKey);
const { arrowRef } = inject(tooltipV2ContentKey);
const arrowStyle = computed(() => {
const { style, width, height } = props;
const namespace = ns.namespace.value;
return {
[`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
[`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
[`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
[`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
...style || {}
};
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("span", {
ref_key: "arrowRef",
ref: arrowRef,
style: normalizeStyle(unref(arrowStyle)),
class: normalizeClass(unref(ns).e("arrow"))
}, null, 6);
};
}
});
var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "arrow.vue"]]);
export { TooltipV2Arrow as default };
//# sourceMappingURL=arrow2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"arrow2.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.vue"],"sourcesContent":["<template>\n <span ref=\"arrowRef\" :style=\"arrowStyle\" :class=\"ns.e('arrow')\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject } from 'vue'\nimport { tooltipV2ContentKey, tooltipV2RootKey } from './constants'\nimport { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './arrow'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElTooltipV2Arrow',\n})\n\nconst props = defineProps({\n ...tooltipV2ArrowProps,\n ...tooltipV2ArrowSpecialProps,\n})\n\nconst { ns } = inject(tooltipV2RootKey)!\nconst { arrowRef } = inject(tooltipV2ContentKey)!\n\nconst arrowStyle = computed<CSSProperties>(() => {\n const { style, width, height } = props\n const namespace = ns.namespace.value\n\n return {\n [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,\n [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,\n [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,\n [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,\n ...(style || {}),\n }\n})\n</script>\n"],"names":[],"mappings":";;;;;mCAWc,CAAA;AAAA,EACZ,IAAM,EAAA,kBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;AAOA,IAAA,MAAM,EAAE,EAAA,EAAO,GAAA,MAAA,CAAO,gBAAgB,CAAA,CAAA;AACtC,IAAA,MAAM,EAAE,QAAA,EAAa,GAAA,MAAA,CAAO,mBAAmB,CAAA,CAAA;AAE/C,IAAM,MAAA,UAAA,GAAa,SAAwB,MAAM;AAC/C,MAAA,MAAM,EAAE,KAAA,EAAO,KAAO,EAAA,MAAA,EAAW,GAAA,KAAA,CAAA;AACjC,MAAM,MAAA,SAAA,GAAY,GAAG,SAAU,CAAA,KAAA,CAAA;AAE/B,MAAO,OAAA;AAAA,QACL,CAAC,CAAK,EAAA,EAAA,SAAS,CAAyB,uBAAA,CAAA,GAAG,GAAG,KAAK,CAAA,EAAA,CAAA;AAAA,QACnD,CAAC,CAAK,EAAA,EAAA,SAAS,CAA0B,wBAAA,CAAA,GAAG,GAAG,MAAM,CAAA,EAAA,CAAA;AAAA,QACrD,CAAC,CAAK,EAAA,EAAA,SAAS,gCAAgC,GAAG,CAAA,EAAG,QAAQ,CAAC,CAAA,EAAA,CAAA;AAAA,QAC9D,CAAC,CAAK,EAAA,EAAA,SAAS,CAA+B,6BAAA,CAAA,GAAG,QAAQ,CAAI,GAAA,CAAA;AAAA,QAC7D,GAAI,SAAS,EAAC;AAAA,OAChB,CAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,28 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
/**
* TODO: make this under constants or tokens
*/
export declare const tooltipV2CommonProps: {
readonly nowrap: BooleanConstructor;
};
export type TooltipV2CommonProps = ExtractPropTypes<typeof tooltipV2CommonProps>;
export type TooltipV2CommonPropsPublic = __ExtractPublicPropTypes<typeof tooltipV2CommonProps>;
export declare enum TooltipV2Sides {
top = "top",
bottom = "bottom",
left = "left",
right = "right"
}
export declare const tooltipV2Sides: TooltipV2Sides[];
export declare const tooltipV2OppositeSide: {
readonly top: TooltipV2Sides.bottom;
readonly bottom: TooltipV2Sides.top;
readonly left: TooltipV2Sides.right;
readonly right: TooltipV2Sides.left;
};
export declare const tooltipV2ArrowBorders: {
readonly top: readonly [TooltipV2Sides.left, TooltipV2Sides.top];
readonly bottom: readonly [TooltipV2Sides.bottom, TooltipV2Sides.right];
readonly left: readonly [TooltipV2Sides.bottom, TooltipV2Sides.left];
readonly right: readonly [TooltipV2Sides.top, TooltipV2Sides.right];
};

View File

@@ -0,0 +1,28 @@
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
const tooltipV2CommonProps = buildProps({
nowrap: Boolean
});
var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
TooltipV2Sides2["top"] = "top";
TooltipV2Sides2["bottom"] = "bottom";
TooltipV2Sides2["left"] = "left";
TooltipV2Sides2["right"] = "right";
return TooltipV2Sides2;
})(TooltipV2Sides || {});
const tooltipV2Sides = Object.values(TooltipV2Sides);
const tooltipV2OppositeSide = {
["top" /* top */]: "bottom" /* bottom */,
["bottom" /* bottom */]: "top" /* top */,
["left" /* left */]: "right" /* right */,
["right" /* right */]: "left" /* left */
};
const tooltipV2ArrowBorders = {
["top" /* top */]: ["left" /* left */, "top" /* top */],
["bottom" /* bottom */]: ["bottom" /* bottom */, "right" /* right */],
["left" /* left */]: ["bottom" /* bottom */, "left" /* left */],
["right" /* right */]: ["top" /* top */, "right" /* right */]
};
export { TooltipV2Sides, tooltipV2ArrowBorders, tooltipV2CommonProps, tooltipV2OppositeSide, tooltipV2Sides };
//# sourceMappingURL=common.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"common.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/common.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\n\n/**\n * TODO: make this under constants or tokens\n */\nexport const tooltipV2CommonProps = buildProps({\n nowrap: Boolean,\n} as const)\n\nexport type TooltipV2CommonProps = ExtractPropTypes<typeof tooltipV2CommonProps>\nexport type TooltipV2CommonPropsPublic = __ExtractPublicPropTypes<\n typeof tooltipV2CommonProps\n>\n\nexport enum TooltipV2Sides {\n top = 'top',\n bottom = 'bottom',\n left = 'left',\n right = 'right',\n}\n\nexport const tooltipV2Sides = Object.values(TooltipV2Sides)\n\nexport const tooltipV2OppositeSide = {\n [TooltipV2Sides.top]: TooltipV2Sides.bottom,\n [TooltipV2Sides.bottom]: TooltipV2Sides.top,\n [TooltipV2Sides.left]: TooltipV2Sides.right,\n [TooltipV2Sides.right]: TooltipV2Sides.left,\n} as const\n\nexport const tooltipV2ArrowBorders = {\n [TooltipV2Sides.top]: [TooltipV2Sides.left, TooltipV2Sides.top],\n [TooltipV2Sides.bottom]: [TooltipV2Sides.bottom, TooltipV2Sides.right],\n [TooltipV2Sides.left]: [TooltipV2Sides.bottom, TooltipV2Sides.left],\n [TooltipV2Sides.right]: [TooltipV2Sides.top, TooltipV2Sides.right],\n} as const\n"],"names":[],"mappings":";;AACY,MAAC,oBAAoB,GAAG,UAAU,CAAC;AAC/C,EAAE,MAAM,EAAE,OAAO;AACjB,CAAC,EAAE;AACO,IAAC,cAAc,mBAAmB,CAAC,CAAC,eAAe,KAAK;AAClE,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;AACjC,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACvC,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AACnC,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACrC,EAAE,OAAO,eAAe,CAAC;AACzB,CAAC,EAAE,cAAc,IAAI,EAAE,EAAE;AACb,MAAC,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE;AAChD,MAAC,qBAAqB,GAAG;AACrC,EAAE,CAAC,KAAK,aAAa,QAAQ;AAC7B,EAAE,CAAC,QAAQ,gBAAgB,KAAK;AAChC,EAAE,CAAC,MAAM,cAAc,OAAO;AAC9B,EAAE,CAAC,OAAO,eAAe,MAAM;AAC/B,EAAE;AACU,MAAC,qBAAqB,GAAG;AACrC,EAAE,CAAC,KAAK,aAAa,CAAC,MAAM,aAAa,KAAK,WAAW;AACzD,EAAE,CAAC,QAAQ,gBAAgB,CAAC,QAAQ,eAAe,OAAO,aAAa;AACvE,EAAE,CAAC,MAAM,cAAc,CAAC,QAAQ,eAAe,MAAM,YAAY;AACjE,EAAE,CAAC,OAAO,eAAe,CAAC,KAAK,YAAY,OAAO,aAAa;AAC/D;;;;"}

View File

@@ -0,0 +1,16 @@
import type { InjectionKey, Ref } from 'vue';
import type { UseNamespaceReturn } from 'element-plus/es/hooks';
export type TooltipV2Context = {
onClose: () => void;
onDelayOpen: () => void;
onOpen: () => void;
contentId: Ref<string>;
triggerRef: Ref<HTMLElement | null>;
ns: UseNamespaceReturn;
};
export type TooltipV2ContentContext = {
arrowRef: Ref<HTMLElement | null>;
};
export declare const tooltipV2RootKey: InjectionKey<TooltipV2Context>;
export declare const tooltipV2ContentKey: InjectionKey<TooltipV2ContentContext>;
export declare const TOOLTIP_V2_OPEN = "tooltip_v2.open";

View File

@@ -0,0 +1,6 @@
const tooltipV2RootKey = Symbol("tooltipV2");
const tooltipV2ContentKey = Symbol("tooltipV2Content");
const TOOLTIP_V2_OPEN = "tooltip_v2.open";
export { TOOLTIP_V2_OPEN, tooltipV2ContentKey, tooltipV2RootKey };
//# sourceMappingURL=constants.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/constants.ts"],"sourcesContent":["import type { InjectionKey, Ref } from 'vue'\nimport type { UseNamespaceReturn } from '@element-plus/hooks'\n\nexport type TooltipV2Context = {\n onClose: () => void\n onDelayOpen: () => void\n onOpen: () => void\n contentId: Ref<string>\n triggerRef: Ref<HTMLElement | null>\n ns: UseNamespaceReturn\n}\n\nexport type TooltipV2ContentContext = {\n arrowRef: Ref<HTMLElement | null>\n}\n\nexport const tooltipV2RootKey: InjectionKey<TooltipV2Context> =\n Symbol('tooltipV2')\n\nexport const tooltipV2ContentKey: InjectionKey<TooltipV2ContentContext> =\n Symbol('tooltipV2Content')\n\nexport const TOOLTIP_V2_OPEN = 'tooltip_v2.open'\n"],"names":[],"mappings":"AAAY,MAAC,gBAAgB,GAAG,MAAM,CAAC,WAAW,EAAE;AACxC,MAAC,mBAAmB,GAAG,MAAM,CAAC,kBAAkB,EAAE;AAClD,MAAC,eAAe,GAAG;;;;"}

View File

@@ -0,0 +1,16 @@
import type { PopperEffect } from 'element-plus/es/components/popper';
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type { Placement, Strategy, VirtualElement } from '@floating-ui/dom';
export declare const tooltipV2ContentProps: {
readonly ariaLabel: StringConstructor;
readonly arrowPadding: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number) | (() => number) | ((new (...args: any[]) => number) | (() => number))[], unknown, unknown, 5, boolean>;
readonly effect: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string) | (() => PopperEffect) | ((new (...args: any[]) => string) | (() => PopperEffect))[], unknown, unknown, "light", boolean>;
readonly contentClass: StringConstructor;
readonly placement: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | ((new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement))[], "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end", unknown, "bottom", boolean>;
readonly reference: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => HTMLElement | VirtualElement) | (() => HTMLElement | VirtualElement | null) | ((new (...args: any[]) => HTMLElement | VirtualElement) | (() => HTMLElement | VirtualElement | null))[], unknown, unknown, null, boolean>;
readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 8, boolean>;
readonly strategy: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fixed" | "absolute") | (() => Strategy) | ((new (...args: any[]) => "fixed" | "absolute") | (() => Strategy))[], "fixed" | "absolute", unknown, "absolute", boolean>;
readonly showArrow: BooleanConstructor;
};
export type TooltipV2ContentProps = ExtractPropTypes<typeof tooltipV2ContentProps>;
export type TooltipV2ContentPropsPublic = __ExtractPublicPropTypes<typeof tooltipV2ContentProps>;

View File

@@ -0,0 +1,52 @@
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
const tooltipV2Strategies = ["absolute", "fixed"];
const tooltipV2Placements = [
"top-start",
"top-end",
"top",
"bottom-start",
"bottom-end",
"bottom",
"left-start",
"left-end",
"left",
"right-start",
"right-end",
"right"
];
const tooltipV2ContentProps = buildProps({
arrowPadding: {
type: definePropType(Number),
default: 5
},
effect: {
type: definePropType(String),
default: "light"
},
contentClass: String,
placement: {
type: definePropType(String),
values: tooltipV2Placements,
default: "bottom"
},
reference: {
type: definePropType(Object),
default: null
},
offset: {
type: Number,
default: 8
},
strategy: {
type: definePropType(String),
values: tooltipV2Strategies,
default: "absolute"
},
showArrow: Boolean,
...useAriaProps(["ariaLabel"])
});
export { tooltipV2ContentProps };
//# sourceMappingURL=content.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"content.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/content.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\n\nimport type { PopperEffect } from '@element-plus/components/popper'\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type { Placement, Strategy, VirtualElement } from '@floating-ui/dom'\n\nconst tooltipV2Strategies = ['absolute', 'fixed'] as const\n\nconst tooltipV2Placements = [\n 'top-start',\n 'top-end',\n 'top',\n 'bottom-start',\n 'bottom-end',\n 'bottom',\n 'left-start',\n 'left-end',\n 'left',\n 'right-start',\n 'right-end',\n 'right',\n] as const\n\nexport const tooltipV2ContentProps = buildProps({\n arrowPadding: {\n type: definePropType<number>(Number),\n default: 5,\n },\n effect: {\n type: definePropType<PopperEffect>(String),\n default: 'light',\n },\n contentClass: String,\n /**\n * Placement of tooltip content relative to reference element (when absent it refers to trigger)\n */\n placement: {\n type: definePropType<Placement>(String),\n values: tooltipV2Placements,\n default: 'bottom',\n },\n /**\n * Reference element for tooltip content to set its position\n */\n reference: {\n type: definePropType<HTMLElement | VirtualElement | null>(Object),\n default: null,\n },\n offset: {\n type: Number,\n default: 8,\n },\n strategy: {\n type: definePropType<Strategy>(String),\n values: tooltipV2Strategies,\n default: 'absolute',\n },\n showArrow: Boolean,\n ...useAriaProps(['ariaLabel']),\n} as const)\n\nexport type TooltipV2ContentProps = ExtractPropTypes<\n typeof tooltipV2ContentProps\n>\n\nexport type TooltipV2ContentPropsPublic = __ExtractPublicPropTypes<\n typeof tooltipV2ContentProps\n>\n"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAClD,MAAM,mBAAmB,GAAG;AAC5B,EAAE,WAAW;AACb,EAAE,SAAS;AACX,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,YAAY;AACd,EAAE,QAAQ;AACV,EAAE,YAAY;AACd,EAAE,UAAU;AACZ,EAAE,MAAM;AACR,EAAE,aAAa;AACf,EAAE,WAAW;AACb,EAAE,OAAO;AACT,CAAC,CAAC;AACU,MAAC,qBAAqB,GAAG,UAAU,CAAC;AAChD,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,YAAY,EAAE,MAAM;AACtB,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,mBAAmB;AAC/B,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,mBAAmB;AAC/B,IAAI,OAAO,EAAE,UAAU;AACvB,GAAG;AACH,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,GAAG,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC;;;;"}

View File

@@ -0,0 +1,52 @@
import type { TooltipV2Sides } from './common';
import type { CSSProperties } from 'vue';
declare function __VLS_template(): {
default?(_: {
contentStyle: CSSProperties;
contentClass: string & (string | undefined)[];
}): any;
default?(_: {}): any;
arrow?(_: {
side: TooltipV2Sides;
style: CSSProperties;
}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
nowrap: BooleanConstructor;
ariaLabel: StringConstructor;
arrowPadding: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number) | (() => number) | ((new (...args: any[]) => number) | (() => number))[], unknown, unknown, 5, boolean>;
effect: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown, "light", boolean>;
contentClass: StringConstructor;
placement: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/dom").Placement) | ((new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/dom").Placement))[], "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end", unknown, "bottom", boolean>;
reference: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null) | ((new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null))[], unknown, unknown, null, boolean>;
offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 8, boolean>;
strategy: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/dom").Strategy) | ((new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/dom").Strategy))[], "fixed" | "absolute", unknown, "absolute", boolean>;
showArrow: BooleanConstructor;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
nowrap: BooleanConstructor;
ariaLabel: StringConstructor;
arrowPadding: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number) | (() => number) | ((new (...args: any[]) => number) | (() => number))[], unknown, unknown, 5, boolean>;
effect: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown, "light", boolean>;
contentClass: StringConstructor;
placement: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/dom").Placement) | ((new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/dom").Placement))[], "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end", unknown, "bottom", boolean>;
reference: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null) | ((new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null))[], unknown, unknown, null, boolean>;
offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 8, boolean>;
strategy: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/dom").Strategy) | ((new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/dom").Strategy))[], "fixed" | "absolute", unknown, "absolute", boolean>;
showArrow: BooleanConstructor;
}>>, {
offset: number;
nowrap: boolean;
placement: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/dom").Placement) | ((new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/dom").Placement))[], "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end", unknown>;
strategy: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/dom").Strategy) | ((new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/dom").Strategy))[], "fixed" | "absolute", unknown>;
reference: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null) | ((new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null))[], unknown, unknown>;
effect: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown>;
showArrow: boolean;
arrowPadding: number;
}>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};

View File

@@ -0,0 +1,114 @@
import { defineComponent, inject, ref, computed, unref, watch, onMounted, provide, openBlock, createElementBlock, normalizeStyle, normalizeClass, renderSlot, createVNode, withCtx, Fragment, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
import { offset } from '@floating-ui/dom';
import ElVisuallyHidden from '../../visual-hidden/src/visual-hidden2.mjs';
import { tooltipV2RootKey, tooltipV2ContentKey } from './constants.mjs';
import { tooltipV2ContentProps } from './content.mjs';
import { tooltipV2CommonProps } from './common.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useFloating, arrowMiddleware } from '../../../hooks/use-floating/index.mjs';
import { useZIndex } from '../../../hooks/use-z-index/index.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
const __default__ = defineComponent({
name: "ElTooltipV2Content"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
setup(__props) {
const props = __props;
const { triggerRef, contentId } = inject(tooltipV2RootKey);
const placement = ref(props.placement);
const strategy = ref(props.strategy);
const arrowRef = ref(null);
const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating({
placement,
strategy,
middleware: computed(() => {
const middleware = [offset(props.offset)];
if (props.showArrow) {
middleware.push(arrowMiddleware({
arrowRef
}));
}
return middleware;
})
});
const zIndex = useZIndex().nextZIndex();
const ns = useNamespace("tooltip-v2");
const side = computed(() => {
return placement.value.split("-")[0];
});
const contentStyle = computed(() => {
return {
position: unref(strategy),
top: `${unref(y) || 0}px`,
left: `${unref(x) || 0}px`,
zIndex
};
});
const arrowStyle = computed(() => {
if (!props.showArrow)
return {};
const { arrow } = unref(middlewareData);
return {
[`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
[`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
};
});
const contentClass = computed(() => [
ns.e("content"),
ns.is("dark", props.effect === "dark"),
ns.is(unref(strategy)),
props.contentClass
]);
watch(arrowRef, () => update());
watch(() => props.placement, (val) => placement.value = val);
onMounted(() => {
watch(() => props.reference || triggerRef.value, (el) => {
referenceRef.value = el || void 0;
}, {
immediate: true
});
});
provide(tooltipV2ContentKey, { arrowRef });
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "contentRef",
ref: contentRef,
style: normalizeStyle(unref(contentStyle)),
"data-tooltip-v2-root": ""
}, [
!_ctx.nowrap ? (openBlock(), createElementBlock("div", {
key: 0,
"data-side": unref(side),
class: normalizeClass(unref(contentClass))
}, [
renderSlot(_ctx.$slots, "default", {
contentStyle: unref(contentStyle),
contentClass: unref(contentClass)
}),
createVNode(unref(ElVisuallyHidden), {
id: unref(contentId),
role: "tooltip"
}, {
default: withCtx(() => [
_ctx.ariaLabel ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
], 64)) : renderSlot(_ctx.$slots, "default", { key: 1 })
]),
_: 3
}, 8, ["id"]),
renderSlot(_ctx.$slots, "arrow", {
style: normalizeStyle(unref(arrowStyle)),
side: unref(side)
})
], 10, ["data-side"])) : createCommentVNode("v-if", true)
], 4);
};
}
});
var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "content.vue"]]);
export { TooltipV2Content as default };
//# sourceMappingURL=content2.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,33 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
export type RefSetter = (el: HTMLElement | null) => void;
export declare const forwardRefProps: {
readonly setRef: {
readonly type: import("vue").PropType<RefSetter>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onlyChild: BooleanConstructor;
};
export type ForwardRefProps = ExtractPropTypes<typeof forwardRefProps>;
export type ForwardRefPropsPublic = __ExtractPublicPropTypes<typeof forwardRefProps>;
declare const _default: import("vue").DefineComponent<{
readonly setRef: {
readonly type: import("vue").PropType<RefSetter>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onlyChild: BooleanConstructor;
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
readonly setRef: {
readonly type: import("vue").PropType<RefSetter>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onlyChild: BooleanConstructor;
}>>, {
readonly onlyChild: boolean;
}>;
export default _default;

View File

@@ -0,0 +1,38 @@
import { defineComponent, ref, createVNode, Fragment } from 'vue';
import { ensureOnlyChild } from '../../../utils/vue/vnode.mjs';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { composeRefs } from '../../../utils/vue/refs.mjs';
const forwardRefProps = buildProps({
setRef: {
type: definePropType(Function),
required: true
},
onlyChild: Boolean
});
var ForwardRef = defineComponent({
props: forwardRefProps,
setup(props, {
slots
}) {
const fragmentRef = ref();
const setRef = composeRefs(fragmentRef, (el) => {
if (el) {
props.setRef(el.nextElementSibling);
} else {
props.setRef(null);
}
});
return () => {
var _a;
const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
return createVNode(Fragment, {
"ref": setRef
}, [child]);
};
}
});
export { ForwardRef as default, forwardRefProps };
//# sourceMappingURL=forward-ref.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"forward-ref.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/forward-ref.tsx"],"sourcesContent":["import { Fragment, defineComponent, ref } from 'vue'\nimport {\n buildProps,\n composeRefs,\n definePropType,\n ensureOnlyChild,\n} from '@element-plus/utils'\n\nimport type {\n ExtractPropTypes,\n VNodeArrayChildren,\n __ExtractPublicPropTypes,\n} from 'vue'\n\nexport type RefSetter = (el: HTMLElement | null) => void\n\nexport const forwardRefProps = buildProps({\n setRef: { type: definePropType<RefSetter>(Function), required: true },\n onlyChild: Boolean,\n} as const)\n\nexport type ForwardRefProps = ExtractPropTypes<typeof forwardRefProps>\nexport type ForwardRefPropsPublic = __ExtractPublicPropTypes<\n typeof forwardRefProps\n>\n\n// TODO: consider make this component a reusable component without the only child feature.\nexport default defineComponent({\n props: forwardRefProps,\n setup(props, { slots }) {\n const fragmentRef = ref()\n const setRef = composeRefs(fragmentRef, (el) => {\n // vue fragments is represented as a text element.\n // The first element sibling should be the first element children of fragment.\n // This is how we get the element.\n if (el) {\n props.setRef(\n (el as HTMLElement).nextElementSibling as HTMLElement | null\n )\n } else {\n props.setRef(null)\n }\n })\n return () => {\n const [firstChild] = slots.default?.() || []\n const child = props.onlyChild\n ? ensureOnlyChild(firstChild.children as VNodeArrayChildren)\n : firstChild.children\n // Dunno why the ref for jsx complains about the typing issue which was not\n // in template\n return <Fragment ref={setRef as any}>{child}</Fragment>\n }\n },\n})\n"],"names":["forwardRefProps","buildProps","setRef","type","definePropType","Function","required","onlyChild","Boolean","props","slots","fragmentRef","composeRefs","el","_createVNode","_Fragment"],"mappings":";;;;;AAgBaA,MAAAA,eAAe,GAAGC,UAAU,CAAC;AACxCC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,IAAI,EAAEC,cAAc,CAAYC,QAAZ,CAAtB;AAA6CC,IAAAA,QAAQ,EAAE,IAAA;GADvB;AAExCC,EAAAA,SAAS,EAAEC,OAAAA;AAF6B,CAAD,EAAlC;AAUP,iBAAA,eAAA,CAAA;AACA,EAAA,KAAA,EAAA;AACEC,EAAAA,KAAK,MADwB,EAAA;;GAExB,EAAA;AAAUC,IAAAA,MAAAA,WAAAA,GAAAA,GAAAA,EAAAA,CAAAA;AAAF,IAAW,MAAA,MAAA,GAAA,WAAA,CAAA,WAAA,EAAA,CAAA,EAAA,KAAA;MAChBC,IAAAA,EAAAA,EAAAA;AACN,QAAA,YAAeC,CAAAA,EAAAA,CAAAA,kBAAW,CAAA,CAAeC;AACvC,OAAA,MAAA;AACA,QAAA,KAAA,CAAA,MAAA,CAAA,IAAA,CAAA,CAAA;AACA,OAAA;AACA,KAAA,CAAA,CAAA;AACEJ,IAAAA,OAAAA,MAAMP;AAGP,MAAA,IAAM,EAAA,CAAA;YACA,CAAA,UAAL,CAAA,GAAA,CAAA,CAAA,EAAA,GAAA,KAAA,CAAA,OAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,KAAA,EAAA,CAAA;AACD,MAAA,MAAA,KAAA,GAAA,KAAA,CAAA,SAAA,GAAA,eAAA,CAAA,UAAA,CAAA,QAAA,CAAA,GAAA,UAAA,CAAA,QAAA,CAAA;AACF,MAXD,OAAAY,WAAA,CAAAC,QAAA,EAAA;AAYA,QAAA,KAAa,EAAA,MAAA;AACX,OAAA,EAAA,CAAA,KAAM,CAAA,CAAA,CAAA;AACN,KAAA,CAAA;AAIA,GAAA;;;;;"}

View File

@@ -0,0 +1,22 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
type StateUpdater = (state: boolean) => void;
export declare const tooltipV2RootProps: {
readonly delayDuration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly defaultOpen: BooleanConstructor;
readonly open: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly onOpenChange: {
readonly type: import("vue").PropType<StateUpdater>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly 'onUpdate:open': {
readonly type: import("vue").PropType<StateUpdater>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export type TooltipV2RootProps = ExtractPropTypes<typeof tooltipV2RootProps>;
export type TooltipV2RootPropsPublic = __ExtractPublicPropTypes<typeof tooltipV2RootProps>;
export {};

View File

@@ -0,0 +1,22 @@
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
const tooltipV2RootProps = buildProps({
delayDuration: {
type: Number,
default: 300
},
defaultOpen: Boolean,
open: {
type: Boolean,
default: void 0
},
onOpenChange: {
type: definePropType(Function)
},
"onUpdate:open": {
type: definePropType(Function)
}
});
export { tooltipV2RootProps };
//# sourceMappingURL=root.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"root.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/root.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\n\ntype StateUpdater = (state: boolean) => void\n\nexport const tooltipV2RootProps = buildProps({\n delayDuration: {\n type: Number,\n default: 300,\n },\n defaultOpen: Boolean,\n open: {\n type: Boolean,\n default: undefined,\n },\n onOpenChange: {\n type: definePropType<StateUpdater>(Function),\n },\n 'onUpdate:open': {\n type: definePropType<StateUpdater>(Function),\n },\n} as const)\n\nexport type TooltipV2RootProps = ExtractPropTypes<typeof tooltipV2RootProps>\nexport type TooltipV2RootPropsPublic = __ExtractPublicPropTypes<\n typeof tooltipV2RootProps\n>\n"],"names":[],"mappings":";;AACY,MAAC,kBAAkB,GAAG,UAAU,CAAC;AAC7C,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,WAAW,EAAE,OAAO;AACtB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,CAAC;;;;"}

View File

@@ -0,0 +1,58 @@
declare function __VLS_template(): {
default?(_: {
open: boolean;
}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly delayDuration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly defaultOpen: BooleanConstructor;
readonly open: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly onOpenChange: {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly 'onUpdate:open': {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}, {
/**
* @description open tooltip programmatically
*/
onOpen: () => void;
/**
* @description close tooltip programmatically
*/
onClose: () => void;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly delayDuration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly defaultOpen: BooleanConstructor;
readonly open: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly onOpenChange: {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly 'onUpdate:open': {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}>>, {
readonly open: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly delayDuration: number;
readonly defaultOpen: boolean;
}>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};

View File

@@ -0,0 +1,84 @@
import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount, provide, renderSlot, unref } from 'vue';
import { useTimeoutFn } from '@vueuse/core';
import { TOOLTIP_V2_OPEN, tooltipV2RootKey } from './constants.mjs';
import { tooltipV2RootProps } from './root.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { isPropAbsent, isNumber } from '../../../utils/types.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { useId } from '../../../hooks/use-id/index.mjs';
const __default__ = defineComponent({
name: "ElTooltipV2Root"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: tooltipV2RootProps,
setup(__props, { expose }) {
const props = __props;
const _open = ref(props.defaultOpen);
const triggerRef = ref(null);
const open = computed({
get: () => isPropAbsent(props.open) ? _open.value : props.open,
set: (open2) => {
var _a;
_open.value = open2;
(_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
}
});
const isOpenDelayed = computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
open.value = true;
}, computed(() => props.delayDuration), {
immediate: false
});
const ns = useNamespace("tooltip-v2");
const contentId = useId();
const onNormalOpen = () => {
clearTimer();
open.value = true;
};
const onDelayOpen = () => {
unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
};
const onOpen = onNormalOpen;
const onClose = () => {
clearTimer();
open.value = false;
};
const onChange = (open2) => {
var _a;
if (open2) {
document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
onOpen();
}
(_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
};
watch(open, onChange);
onMounted(() => {
document.addEventListener(TOOLTIP_V2_OPEN, onClose);
});
onBeforeUnmount(() => {
clearTimer();
document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
});
provide(tooltipV2RootKey, {
contentId,
triggerRef,
ns,
onClose,
onDelayOpen,
onOpen
});
expose({
onOpen,
onClose
});
return (_ctx, _cache) => {
return renderSlot(_ctx.$slots, "default", { open: unref(open) });
};
}
});
var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "root.vue"]]);
export { TooltipV2Root as default };
//# sourceMappingURL=root2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"root2.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/root.vue"],"sourcesContent":["<template>\n <slot :open=\"open\" />\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n unref,\n watch,\n} from 'vue'\nimport { useTimeoutFn } from '@vueuse/core'\nimport { useId, useNamespace } from '@element-plus/hooks'\nimport { isNumber, isPropAbsent } from '@element-plus/utils'\nimport { TOOLTIP_V2_OPEN, tooltipV2RootKey } from './constants'\nimport { tooltipV2RootProps } from './root'\n\ndefineOptions({\n name: 'ElTooltipV2Root',\n})\n\nconst props = defineProps(tooltipV2RootProps)\n\n/**\n * internal open state, when no model value was provided, use this as indicator instead\n */\nconst _open = ref(props.defaultOpen)\nconst triggerRef = ref<HTMLElement | null>(null)\n\nconst open = computed<boolean>({\n get: () => (isPropAbsent(props.open) ? _open.value : props.open),\n set: (open) => {\n _open.value = open\n props['onUpdate:open']?.(open)\n },\n})\n\nconst isOpenDelayed = computed(\n () => isNumber(props.delayDuration) && props.delayDuration > 0\n)\n\nconst { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(\n () => {\n open.value = true\n },\n computed(() => props.delayDuration),\n {\n immediate: false,\n }\n)\n\nconst ns = useNamespace('tooltip-v2')\n\nconst contentId = useId()\n\nconst onNormalOpen = () => {\n clearTimer()\n open.value = true\n}\n\nconst onDelayOpen = () => {\n unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen()\n}\n\nconst onOpen = onNormalOpen\n\nconst onClose = () => {\n clearTimer()\n open.value = false\n}\n\nconst onChange = (open: boolean) => {\n if (open) {\n document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN))\n onOpen()\n }\n\n props.onOpenChange?.(open)\n}\n\nwatch(open, onChange)\n\nonMounted(() => {\n // Keeps only 1 tooltip open at a time\n document.addEventListener(TOOLTIP_V2_OPEN, onClose)\n})\n\nonBeforeUnmount(() => {\n clearTimer()\n document.removeEventListener(TOOLTIP_V2_OPEN, onClose)\n})\n\nprovide(tooltipV2RootKey, {\n contentId,\n triggerRef,\n ns,\n\n onClose,\n onDelayOpen,\n onOpen,\n})\n\ndefineExpose({\n /**\n * @description open tooltip programmatically\n */\n onOpen,\n\n /**\n * @description close tooltip programmatically\n */\n onClose,\n})\n</script>\n"],"names":["open","_renderSlot","_unref"],"mappings":";;;;;;;;;mCAoBc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAOA,IAAM,MAAA,KAAA,GAAQ,GAAI,CAAA,KAAA,CAAM,WAAW,CAAA,CAAA;AACnC,IAAM,MAAA,UAAA,GAAa,IAAwB,IAAI,CAAA,CAAA;AAE/C,IAAA,MAAM,OAAO,QAAkB,CAAA;AAAA,MAC7B,GAAA,EAAK,MAAO,YAAa,CAAA,KAAA,CAAM,IAAI,CAAI,GAAA,KAAA,CAAM,QAAQ,KAAM,CAAA,IAAA;AAAA,MAC3D,GAAA,EAAK,CAACA,KAAS,KAAA;AACb,QAAA,IAAA,EAAM,CAAQA;AACd,QAAM,KAAA,CAAA,KAAA,GAAA,KAAA,CAAA;AAAuB,QAC/B,CAAA,EAAA,GAAA,KAAA,CAAA,eAAA,CAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AAAA,OACD;AAED,KAAA,CAAA,CAAA;AAAsB,IAAA,mBACL,GAAA,QAAmB,CAAA,MAAA,cAA2B,CAAA,aAAA,CAAA,IAAA,KAAA,CAAA,aAAA,GAAA,CAAA,CAAA,CAAA;AAAA,IAC/D,MAAA,EAAA,KAAA,EAAA,aAAA,EAAA,IAAA,EAAA,UAAA,EAAA,GAAA,YAAA,CAAA,MAAA;AAEA,MAAA,IAAM,CAAE,KAAA,GAAO,IAAe,CAAA;AAAqB,KAAA,EAC3C,QAAA,CAAA,MAAA,KAAA,CAAA,aAAA,CAAA,EAAA;AACJ,MAAA,SAAa,EAAA,KAAA;AAAA,KACf,CAAA,CAAA;AAAA,IACA,MAAA,EAAA,GAAS,YAAY,CAAa,YAAA,CAAA,CAAA;AAAA,IAClC,MAAA,SAAA,GAAA,KAAA,EAAA,CAAA;AAAA,IAAA,MACa,YAAA,GAAA,MAAA;AAAA,MACb,UAAA,EAAA,CAAA;AAAA,MACF,IAAA,CAAA,KAAA,GAAA,IAAA,CAAA;AAEA,KAAM,CAAA;AAEN,IAAA,MAAM,cAAkB,MAAA;AAExB,MAAA,mBAAqB,CAAM,GAAA,aAAA,EAAA,GAAA,YAAA,EAAA,CAAA;AACzB,KAAW,CAAA;AACX,IAAA,MAAA,MAAa,GAAA,YAAA,CAAA;AAAA,IACf,MAAA,OAAA,GAAA,MAAA;AAEA,MAAA;AACE,MAAA,IAAA,CAAA,KAAmB,GAAA,KAAA,CAAA;AAAmC,KACxD,CAAA;AAEA,IAAA,MAAM,QAAS,GAAA,CAAA,KAAA,KAAA;AAEf,MAAA,IAAM;AACJ,MAAW,IAAA,KAAA,EAAA;AACX,QAAA,QAAa,CAAA,aAAA,CAAA,IAAA,WAAA,CAAA,eAAA,CAAA,CAAA,CAAA;AAAA,QACf,MAAA,EAAA,CAAA;AAEA,OAAM;AACJ,MAAA,CAAA,EAAA,GAAU,KAAA,CAAA,YAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACR,KAAA,CAAA;AACA,IAAO,KAAA,CAAA,IAAA,EAAA,QAAA,CAAA,CAAA;AAAA,IACT,SAAA,CAAA,MAAA;AAEA,MAAA,yBAAyB,CAAA,eAAA,EAAA,OAAA,CAAA,CAAA;AAAA,KAC3B,CAAA,CAAA;AAEA,IAAA,eAAoB,CAAA,MAAA;AAEpB,MAAA,UAAgB,EAAA,CAAA;AAEd,MAAS,QAAA,CAAA,mCAAyC,EAAA,OAAA,CAAA,CAAA;AAAA,KACnD,CAAA,CAAA;AAED,IAAA,OAAA,CAAA,gBAAsB,EAAA;AACpB,MAAW,SAAA;AACX,MAAS,UAAA;AAA4C,MACtD,EAAA;AAED,MAAA,OAA0B;AAAA,MACxB,WAAA;AAAA,MACA,MAAA;AAAA,KACA,CAAA,CAAA;AAAA,IAEA,MAAA,CAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAa,OAAA,CAAA,IAAA,EAAA,MAAA,KAAA;AAAA,MAAA,OAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,IAAA,EAAAC,KAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAAA,GAAA;AAAA,CAIX,CAAA,CAAA;AAAA,oBAAA,gBAAA,WAAA,CAAA,SAAA,EAAA,CAAA,CAAA,QAAA,EAAA,UAAA,CAAA,CAAA,CAAA;;;;"}

View File

@@ -0,0 +1,73 @@
import type { ExtractPropTypes, TransitionProps, __ExtractPublicPropTypes } from 'vue';
export declare const tooltipV2Props: {
readonly alwaysOn: BooleanConstructor;
readonly fullTransition: BooleanConstructor;
readonly transitionProps: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => TransitionProps) | (() => TransitionProps | null) | ((new (...args: any[]) => TransitionProps) | (() => TransitionProps | null))[], unknown, unknown, null, boolean>;
readonly teleported: BooleanConstructor;
readonly to: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | ((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement))[], unknown, unknown, "body", boolean>;
readonly ariaLabel: StringConstructor;
readonly arrowPadding: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number) | (() => number) | ((new (...args: any[]) => number) | (() => number))[], unknown, unknown, 5, boolean>;
readonly effect: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown, "light", boolean>;
readonly contentClass: StringConstructor;
readonly placement: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/core").Placement) | ((new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/core").Placement))[], "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end", unknown, "bottom", boolean>;
readonly reference: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null) | ((new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null))[], unknown, unknown, null, boolean>;
readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 8, boolean>;
readonly strategy: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/core").Strategy) | ((new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/core").Strategy))[], "fixed" | "absolute", unknown, "absolute", boolean>;
readonly showArrow: BooleanConstructor;
readonly onBlur: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onClick: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onFocus: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseDown: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseEnter: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseLeave: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly width: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
readonly height: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
readonly style: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("vue").CSSProperties) | (() => import("vue").CSSProperties | null) | ((new (...args: any[]) => import("vue").CSSProperties) | (() => import("vue").CSSProperties | null))[], unknown, unknown, null, boolean>;
readonly delayDuration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly defaultOpen: BooleanConstructor;
readonly open: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly onOpenChange: {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly 'onUpdate:open': {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export type TooltipV2Props = ExtractPropTypes<typeof tooltipV2Props>;
export type TooltipV2PropsPublic = __ExtractPublicPropTypes<typeof tooltipV2Props>;

View File

@@ -0,0 +1,26 @@
import { tooltipV2RootProps } from './root.mjs';
import { tooltipV2TriggerProps } from './trigger.mjs';
import { tooltipV2ArrowProps } from './arrow.mjs';
import { tooltipV2ContentProps } from './content.mjs';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
const tooltipV2Props = buildProps({
...tooltipV2RootProps,
...tooltipV2ArrowProps,
...tooltipV2TriggerProps,
...tooltipV2ContentProps,
alwaysOn: Boolean,
fullTransition: Boolean,
transitionProps: {
type: definePropType(Object),
default: null
},
teleported: Boolean,
to: {
type: definePropType([String, Object]),
default: "body"
}
});
export { tooltipV2Props };
//# sourceMappingURL=tooltip.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tooltip.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/tooltip.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport { tooltipV2RootProps } from './root'\nimport { tooltipV2TriggerProps } from './trigger'\nimport { tooltipV2ArrowProps } from './arrow'\nimport { tooltipV2ContentProps } from './content'\n\nimport type {\n ExtractPropTypes,\n TransitionProps,\n __ExtractPublicPropTypes,\n} from 'vue'\n\nexport const tooltipV2Props = buildProps({\n ...tooltipV2RootProps,\n ...tooltipV2ArrowProps,\n ...tooltipV2TriggerProps,\n ...tooltipV2ContentProps,\n alwaysOn: Boolean,\n fullTransition: Boolean,\n transitionProps: {\n type: definePropType<TransitionProps | null>(Object),\n default: null,\n },\n teleported: Boolean,\n to: {\n type: definePropType<string | HTMLElement>([String, Object]),\n default: 'body',\n },\n} as const)\n\nexport type TooltipV2Props = ExtractPropTypes<typeof tooltipV2Props>\nexport type TooltipV2PropsPublic = __ExtractPublicPropTypes<\n typeof tooltipV2Props\n>\n"],"names":[],"mappings":";;;;;;AAKY,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,GAAG,kBAAkB;AACvB,EAAE,GAAG,mBAAmB;AACxB,EAAE,GAAG,qBAAqB;AAC1B,EAAE,GAAG,qBAAqB;AAC1B,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,cAAc,EAAE,OAAO;AACzB,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,UAAU,EAAE,OAAO;AACrB,EAAE,EAAE,EAAE;AACN,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,CAAC;;;;"}

View File

@@ -0,0 +1,170 @@
declare function __VLS_template(): {
trigger?(_: {}): any;
default?(_: {}): any;
default?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly alwaysOn: BooleanConstructor;
readonly fullTransition: BooleanConstructor;
readonly transitionProps: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("vue").TransitionProps) | (() => import("vue").TransitionProps | null) | ((new (...args: any[]) => import("vue").TransitionProps) | (() => import("vue").TransitionProps | null))[], unknown, unknown, null, boolean>;
readonly teleported: BooleanConstructor;
readonly to: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | ((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement))[], unknown, unknown, "body", boolean>;
readonly ariaLabel: StringConstructor;
readonly arrowPadding: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number) | (() => number) | ((new (...args: any[]) => number) | (() => number))[], unknown, unknown, 5, boolean>;
readonly effect: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown, "light", boolean>;
readonly contentClass: StringConstructor;
readonly placement: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/core").Placement) | ((new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/core").Placement))[], "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end", unknown, "bottom", boolean>;
readonly reference: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null) | ((new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null))[], unknown, unknown, null, boolean>;
readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 8, boolean>;
readonly strategy: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/core").Strategy) | ((new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/core").Strategy))[], "fixed" | "absolute", unknown, "absolute", boolean>;
readonly showArrow: BooleanConstructor;
readonly onBlur: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onClick: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onFocus: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseDown: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseEnter: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseLeave: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly width: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
readonly height: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
readonly style: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("vue").CSSProperties) | (() => import("vue").CSSProperties | null) | ((new (...args: any[]) => import("vue").CSSProperties) | (() => import("vue").CSSProperties | null))[], unknown, unknown, null, boolean>;
readonly delayDuration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly defaultOpen: BooleanConstructor;
readonly open: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly onOpenChange: {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly 'onUpdate:open': {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly alwaysOn: BooleanConstructor;
readonly fullTransition: BooleanConstructor;
readonly transitionProps: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("vue").TransitionProps) | (() => import("vue").TransitionProps | null) | ((new (...args: any[]) => import("vue").TransitionProps) | (() => import("vue").TransitionProps | null))[], unknown, unknown, null, boolean>;
readonly teleported: BooleanConstructor;
readonly to: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | ((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement))[], unknown, unknown, "body", boolean>;
readonly ariaLabel: StringConstructor;
readonly arrowPadding: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => number) | (() => number) | ((new (...args: any[]) => number) | (() => number))[], unknown, unknown, 5, boolean>;
readonly effect: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown, "light", boolean>;
readonly contentClass: StringConstructor;
readonly placement: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/core").Placement) | ((new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/core").Placement))[], "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end", unknown, "bottom", boolean>;
readonly reference: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null) | ((new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null))[], unknown, unknown, null, boolean>;
readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 8, boolean>;
readonly strategy: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/core").Strategy) | ((new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/core").Strategy))[], "fixed" | "absolute", unknown, "absolute", boolean>;
readonly showArrow: BooleanConstructor;
readonly onBlur: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onClick: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onFocus: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseDown: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseEnter: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseLeave: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly width: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
readonly height: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 10, boolean>;
readonly style: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("vue").CSSProperties) | (() => import("vue").CSSProperties | null) | ((new (...args: any[]) => import("vue").CSSProperties) | (() => import("vue").CSSProperties | null))[], unknown, unknown, null, boolean>;
readonly delayDuration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly defaultOpen: BooleanConstructor;
readonly open: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly onOpenChange: {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly 'onUpdate:open': {
readonly type: import("vue").PropType<(state: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
}>>, {
readonly style: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("vue").CSSProperties) | (() => import("vue").CSSProperties | null) | ((new (...args: any[]) => import("vue").CSSProperties) | (() => import("vue").CSSProperties | null))[], unknown, unknown>;
readonly height: number;
readonly width: number;
readonly offset: number;
readonly open: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly to: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | ((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement))[], unknown, unknown>;
readonly placement: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/core").Placement) | ((new (...args: any[]) => "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("@floating-ui/core").Placement))[], "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end", unknown>;
readonly strategy: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/core").Strategy) | ((new (...args: any[]) => "fixed" | "absolute") | (() => import("@floating-ui/core").Strategy))[], "fixed" | "absolute", unknown>;
readonly reference: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null) | ((new (...args: any[]) => HTMLElement | import("@floating-ui/dom").VirtualElement) | (() => HTMLElement | import("@floating-ui/dom").VirtualElement | null))[], unknown, unknown>;
readonly effect: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown>;
readonly teleported: boolean;
readonly showArrow: boolean;
readonly alwaysOn: boolean;
readonly arrowPadding: number;
readonly delayDuration: number;
readonly defaultOpen: boolean;
readonly transitionProps: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("vue").TransitionProps) | (() => import("vue").TransitionProps | null) | ((new (...args: any[]) => import("vue").TransitionProps) | (() => import("vue").TransitionProps | null))[], unknown, unknown>;
readonly fullTransition: boolean;
}>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};

View File

@@ -0,0 +1,84 @@
import { defineComponent, toRefs, reactive, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, createVNode, mergeProps, renderSlot, unref, Transition, createCommentVNode, createElementBlock, Fragment } from 'vue';
import { pick } from 'lodash-unified';
import { ElTeleport } from '../../teleport/index.mjs';
import { tooltipV2ArrowProps } from './arrow.mjs';
import { tooltipV2ContentProps } from './content.mjs';
import { tooltipV2RootProps } from './root.mjs';
import { tooltipV2Props } from './tooltip.mjs';
import { tooltipV2TriggerProps } from './trigger.mjs';
import TooltipV2Root from './root2.mjs';
import TooltipV2Arrow from './arrow2.mjs';
import TooltipV2Content from './content2.mjs';
import TooltipV2Trigger from './trigger2.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
const __default__ = defineComponent({
name: "ElTooltipV2"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: tooltipV2Props,
setup(__props) {
const props = __props;
const refedProps = toRefs(props);
const arrowProps = reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
const contentProps = reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
const rootProps = reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
const triggerProps = reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
return (_ctx, _cache) => {
return openBlock(), createBlock(TooltipV2Root, normalizeProps(guardReactiveProps(rootProps)), {
default: withCtx(({ open }) => [
createVNode(TooltipV2Trigger, mergeProps(triggerProps, { nowrap: "" }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "trigger")
]),
_: 3
}, 16),
createVNode(unref(ElTeleport), {
to: _ctx.to,
disabled: !_ctx.teleported
}, {
default: withCtx(() => [
_ctx.fullTransition ? (openBlock(), createBlock(Transition, normalizeProps(mergeProps({ key: 0 }, _ctx.transitionProps)), {
default: withCtx(() => [
_ctx.alwaysOn || open ? (openBlock(), createBlock(TooltipV2Content, normalizeProps(mergeProps({ key: 0 }, contentProps)), {
arrow: withCtx(({ style, side }) => [
_ctx.showArrow ? (openBlock(), createBlock(TooltipV2Arrow, mergeProps({ key: 0 }, arrowProps, {
style,
side
}), null, 16, ["style", "side"])) : createCommentVNode("v-if", true)
]),
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16)) : createCommentVNode("v-if", true)
]),
_: 2
}, 1040)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
_ctx.alwaysOn || open ? (openBlock(), createBlock(TooltipV2Content, normalizeProps(mergeProps({ key: 0 }, contentProps)), {
arrow: withCtx(({ style, side }) => [
_ctx.showArrow ? (openBlock(), createBlock(TooltipV2Arrow, mergeProps({ key: 0 }, arrowProps, {
style,
side
}), null, 16, ["style", "side"])) : createCommentVNode("v-if", true)
]),
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16)) : createCommentVNode("v-if", true)
], 64))
]),
_: 2
}, 1032, ["to", "disabled"])
]),
_: 3
}, 16);
};
}
});
var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "tooltip.vue"]]);
export { TooltipV2 as default };
//# sourceMappingURL=tooltip2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tooltip2.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/tooltip.vue"],"sourcesContent":["<template>\n <tooltip-v2-root v-bind=\"rootProps\">\n <template #default=\"{ open }\">\n <tooltip-v2-trigger v-bind=\"triggerProps\" nowrap>\n <slot name=\"trigger\" />\n </tooltip-v2-trigger>\n <el-teleport :to=\"to\" :disabled=\"!teleported\">\n <template v-if=\"fullTransition\">\n <transition v-bind=\"transitionProps\">\n <tooltip-v2-content v-if=\"alwaysOn || open\" v-bind=\"contentProps\">\n <slot />\n <template #arrow=\"{ style, side }\">\n <tooltip-v2-arrow\n v-if=\"showArrow\"\n v-bind=\"arrowProps\"\n :style=\"style\"\n :side=\"side\"\n />\n </template>\n </tooltip-v2-content>\n </transition>\n </template>\n <template v-else>\n <tooltip-v2-content v-if=\"alwaysOn || open\" v-bind=\"contentProps\">\n <slot />\n <template #arrow=\"{ style, side }\">\n <tooltip-v2-arrow\n v-if=\"showArrow\"\n v-bind=\"arrowProps\"\n :style=\"style\"\n :side=\"side\"\n />\n </template>\n </tooltip-v2-content>\n </template>\n </el-teleport>\n </template>\n </tooltip-v2-root>\n</template>\n\n<script setup lang=\"ts\">\nimport { reactive, toRefs } from 'vue'\nimport { pick } from 'lodash-unified'\nimport ElTeleport from '@element-plus/components/teleport'\nimport { tooltipV2ArrowProps } from './arrow'\nimport { tooltipV2ContentProps } from './content'\nimport { tooltipV2RootProps } from './root'\nimport { tooltipV2Props } from './tooltip'\nimport { tooltipV2TriggerProps } from './trigger'\nimport TooltipV2Root from './root.vue'\nimport TooltipV2Arrow from './arrow.vue'\nimport TooltipV2Content from './content.vue'\nimport TooltipV2Trigger from './trigger.vue'\n\ndefineOptions({\n name: 'ElTooltipV2',\n})\n\nconst props = defineProps(tooltipV2Props)\n\nconst refedProps = toRefs(props)\n\nconst arrowProps = reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)))\n\nconst contentProps = reactive(\n pick(refedProps, Object.keys(tooltipV2ContentProps))\n)\n\nconst rootProps = reactive(pick(refedProps, Object.keys(tooltipV2RootProps)))\n\nconst triggerProps = reactive(\n pick(refedProps, Object.keys(tooltipV2TriggerProps))\n)\n</script>\n"],"names":["_openBlock","_createBlock","_normalizeProps","_guardReactiveProps","_withCtx","_createVNode","_mergeProps"],"mappings":";;;;;;;;;;;;;;mCAsDc,CAAA;AAAA,EACZ,IAAM,EAAA,aAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAIA,IAAM,MAAA,UAAA,GAAa,OAAO,KAAK,CAAA,CAAA;AAE/B,IAAM,MAAA,UAAA,GAAa,SAAS,IAAK,CAAA,UAAA,EAAY,OAAO,IAAK,CAAA,mBAAmB,CAAC,CAAC,CAAA,CAAA;AAE9E,IAAA,MAAM,YAAe,GAAA,QAAA,CAAA,IAAA,CAAA,UAAA,EAAA,MAAA,CAAA,IAAA,CAAA,qBAAA,CAAA,CAAA,CAAA,CAAA;AAAA,IAAA,MACd,SAAA,GAAA,QAAmB,CAAA,IAAK,wBAAsB,CAAA,kBAAA,CAAA,CAAA,CAAA,CAAA;AAAA,IACrD,MAAA,YAAA,GAAA,QAAA,CAAA,IAAA,CAAA,UAAA,EAAA,MAAA,CAAA,IAAA,CAAA,qBAAA,CAAA,CAAA,CAAA,CAAA;AAEA,IAAM,OAAA,CAAA,IAAA,EAAA;AAEN,MAAA,OAAqBA,SAAA,EAAA,EAAAC,WAAA,CAAA,aAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,SAAA,CAAA,CAAA,EAAA;AAAA,QACd,OAAA,EAAAC,OAAmB,CAAA,CAAA,EAAA,IAAA,EAAK;AAAsB,UACrDC,WAAA,CAAA,gBAAA,EAAAC,UAAA,CAAA,YAAA,EAAA,EAAA,MAAA,EAAA,EAAA,EAAA,CAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,41 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
export declare const tooltipV2TriggerProps: {
readonly onBlur: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onClick: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onFocus: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseDown: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseEnter: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly onMouseLeave: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export type TooltipV2TriggerProps = ExtractPropTypes<typeof tooltipV2TriggerProps>;
export type TooltipV2TriggerPropsPublic = __ExtractPublicPropTypes<typeof tooltipV2TriggerProps>;

View File

@@ -0,0 +1,16 @@
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
const EventHandler = {
type: definePropType(Function)
};
const tooltipV2TriggerProps = buildProps({
onBlur: EventHandler,
onClick: EventHandler,
onFocus: EventHandler,
onMouseDown: EventHandler,
onMouseEnter: EventHandler,
onMouseLeave: EventHandler
});
export { tooltipV2TriggerProps };
//# sourceMappingURL=trigger.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"trigger.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/trigger.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\n\nconst EventHandler = {\n type: definePropType<(e: Event) => boolean | void>(Function),\n} as const\n\nexport const tooltipV2TriggerProps = buildProps({\n onBlur: EventHandler,\n onClick: EventHandler,\n onFocus: EventHandler,\n onMouseDown: EventHandler,\n onMouseEnter: EventHandler,\n onMouseLeave: EventHandler,\n} as const)\n\nexport type TooltipV2TriggerProps = ExtractPropTypes<\n typeof tooltipV2TriggerProps\n>\n\nexport type TooltipV2TriggerPropsPublic = __ExtractPublicPropTypes<\n typeof tooltipV2TriggerProps\n>\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAChC,CAAC,CAAC;AACU,MAAC,qBAAqB,GAAG,UAAU,CAAC;AAChD,EAAE,MAAM,EAAE,YAAY;AACtB,EAAE,OAAO,EAAE,YAAY;AACvB,EAAE,OAAO,EAAE,YAAY;AACvB,EAAE,WAAW,EAAE,YAAY;AAC3B,EAAE,YAAY,EAAE,YAAY;AAC5B,EAAE,YAAY,EAAE,YAAY;AAC5B,CAAC;;;;"}

View File

@@ -0,0 +1,90 @@
declare function __VLS_template(): {
default?(_: {}): any;
default?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
onBlur: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onClick: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onFocus: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onMouseDown: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onMouseEnter: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onMouseLeave: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
nowrap: BooleanConstructor;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
onBlur: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onClick: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onFocus: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onMouseDown: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onMouseEnter: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
onMouseLeave: {
readonly type: import("vue").PropType<(e: Event) => boolean | void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
nowrap: BooleanConstructor;
}>>, {
nowrap: boolean;
}>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};

View File

@@ -0,0 +1,93 @@
import { defineComponent, inject, watch, onBeforeUnmount, openBlock, createBlock, unref, withCtx, renderSlot, createElementBlock, mergeProps } from 'vue';
import { tooltipV2RootKey } from './constants.mjs';
import ForwardRef from './forward-ref.mjs';
import { tooltipV2TriggerProps } from './trigger.mjs';
import { tooltipV2CommonProps } from './common.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { composeEventHandlers } from '../../../utils/dom/event.mjs';
const __default__ = defineComponent({
name: "ElTooltipV2Trigger"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: {
...tooltipV2CommonProps,
...tooltipV2TriggerProps
},
setup(__props) {
const props = __props;
const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = inject(tooltipV2RootKey);
let isMousedown = false;
const setTriggerRef = (el) => {
triggerRef.value = el;
};
const onMouseup = () => {
isMousedown = false;
};
const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
const onMousedown = composeEventHandlers(props.onMouseDown, () => {
onClose();
isMousedown = true;
document.addEventListener("mouseup", onMouseup, { once: true });
});
const onFocus = composeEventHandlers(props.onFocus, () => {
if (!isMousedown)
onOpen();
});
const onBlur = composeEventHandlers(props.onBlur, onClose);
const onClick = composeEventHandlers(props.onClick, (e) => {
if (e.detail === 0)
onClose();
});
const events = {
blur: onBlur,
click: onClick,
focus: onFocus,
mousedown: onMousedown,
mouseenter: onMouseenter,
mouseleave: onMouseleave
};
const setEvents = (el, events2, type) => {
if (el) {
Object.entries(events2).forEach(([name, handler]) => {
el[type](name, handler);
});
}
};
watch(triggerRef, (triggerEl, previousTriggerEl) => {
setEvents(triggerEl, events, "addEventListener");
setEvents(previousTriggerEl, events, "removeEventListener");
if (triggerEl) {
triggerEl.setAttribute("aria-describedby", contentId.value);
}
});
onBeforeUnmount(() => {
setEvents(triggerRef.value, events, "removeEventListener");
document.removeEventListener("mouseup", onMouseup);
});
return (_ctx, _cache) => {
return _ctx.nowrap ? (openBlock(), createBlock(unref(ForwardRef), {
key: 0,
"set-ref": setTriggerRef,
"only-child": ""
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
})) : (openBlock(), createElementBlock("button", mergeProps({
key: 1,
ref_key: "triggerRef",
ref: triggerRef
}, _ctx.$attrs), [
renderSlot(_ctx.$slots, "default")
], 16));
};
}
});
var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "trigger.vue"]]);
export { TooltipV2Trigger as default };
//# sourceMappingURL=trigger2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"trigger2.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/trigger.vue"],"sourcesContent":["<template>\n <forward-ref v-if=\"nowrap\" :set-ref=\"setTriggerRef\" only-child>\n <slot />\n </forward-ref>\n <button v-else ref=\"triggerRef\" v-bind=\"$attrs\">\n <slot />\n </button>\n</template>\n\n<script setup lang=\"ts\">\nimport { inject, onBeforeUnmount, watch } from 'vue'\nimport { composeEventHandlers } from '@element-plus/utils'\nimport { tooltipV2RootKey } from './constants'\nimport ForwardRef from './forward-ref'\nimport { tooltipV2TriggerProps } from './trigger'\nimport { tooltipV2CommonProps } from './common'\n\ndefineOptions({\n name: 'ElTooltipV2Trigger',\n})\n\nconst props = defineProps({\n ...tooltipV2CommonProps,\n ...tooltipV2TriggerProps,\n})\n\n/**\n * onOpen opens the tooltip instantly, onTrigger acts a lil bit differently,\n * it will check if delayDuration is set to greater than 0 and based on that result,\n * if true, it opens the tooltip after delayDuration, otherwise it opens it instantly.\n */\nconst { onClose, onOpen, onDelayOpen, triggerRef, contentId } =\n inject(tooltipV2RootKey)!\n\nlet isMousedown = false\n\nconst setTriggerRef = (el: HTMLElement | null) => {\n triggerRef.value = el\n}\n\nconst onMouseup = () => {\n isMousedown = false\n}\n\nconst onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen)\n\nconst onMouseleave = composeEventHandlers(props.onMouseLeave, onClose)\n\nconst onMousedown = composeEventHandlers(props.onMouseDown, () => {\n onClose()\n isMousedown = true\n document.addEventListener('mouseup', onMouseup, { once: true })\n})\n\nconst onFocus = composeEventHandlers(props.onFocus, () => {\n if (!isMousedown) onOpen()\n})\n\nconst onBlur = composeEventHandlers(props.onBlur, onClose)\n\nconst onClick = composeEventHandlers(props.onClick, (e) => {\n if ((e as MouseEvent).detail === 0) onClose()\n})\n\nconst events = {\n blur: onBlur,\n click: onClick,\n focus: onFocus,\n mousedown: onMousedown,\n mouseenter: onMouseenter,\n mouseleave: onMouseleave,\n}\n\nconst setEvents = <T extends (e: Event) => void>(\n el: HTMLElement | null | undefined,\n events: Record<string, T>,\n type: 'addEventListener' | 'removeEventListener'\n) => {\n if (el) {\n Object.entries(events).forEach(([name, handler]) => {\n el[type](name, handler)\n })\n }\n}\n\nwatch(triggerRef, (triggerEl, previousTriggerEl) => {\n setEvents(triggerEl, events, 'addEventListener')\n setEvents(previousTriggerEl, events, 'removeEventListener')\n\n if (triggerEl) {\n triggerEl.setAttribute('aria-describedby', contentId.value)\n }\n})\n\nonBeforeUnmount(() => {\n setEvents(triggerRef.value, events, 'removeEventListener')\n document.removeEventListener('mouseup', onMouseup)\n})\n</script>\n"],"names":["events"],"mappings":";;;;;;;;mCAiBc,CAAA;AAAA,EACZ,IAAM,EAAA,oBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;AAYA,IAAM,MAAA,EAAE,SAAS,MAAQ,EAAA,WAAA,EAAa,YAAY,SAAU,EAAA,GAC1D,OAAO,gBAAgB,CAAA,CAAA;AAEzB,IAAA,IAAI,WAAc,GAAA,KAAA,CAAA;AAElB,IAAM,MAAA,aAAA,GAAgB,CAAC,EAA2B,KAAA;AAChD,MAAA,UAAA,CAAW,KAAQ,GAAA,EAAA,CAAA;AAAA,KACrB,CAAA;AAEA,IAAA,MAAM,YAAY,MAAM;AACtB,MAAc,WAAA,GAAA,KAAA,CAAA;AAAA,KAChB,CAAA;AAEA,IAAA,MAAM,YAAe,GAAA,oBAAA,CAAqB,KAAM,CAAA,YAAA,EAAc,WAAW,CAAA,CAAA;AAEzE,IAAA,MAAM,YAAe,GAAA,oBAAA,CAAqB,KAAM,CAAA,YAAA,EAAc,OAAO,CAAA,CAAA;AAErE,IAAA,MAAM,WAAc,GAAA,oBAAA,CAAqB,KAAM,CAAA,WAAA,EAAa,MAAM;AAChE,MAAQ,OAAA,EAAA,CAAA;AACR,MAAc,WAAA,GAAA,IAAA,CAAA;AACd,MAAA,QAAA,CAAS,iBAAiB,SAAW,EAAA,SAAA,EAAW,EAAE,IAAA,EAAM,MAAM,CAAA,CAAA;AAAA,KAC/D,CAAA,CAAA;AAED,IAAA,MAAM,OAAU,GAAA,oBAAA,CAAqB,KAAM,CAAA,OAAA,EAAS,MAAM;AACxD,MAAI,IAAA,CAAC;AAAoB,QAC1B,MAAA,EAAA,CAAA;AAED,KAAA,CAAA,CAAA;AAEA,IAAA,MAAM,MAAU,GAAA,oBAAA,CAAA,KAA2B,CAAA,MAAA,EAAA,OAAgB,CAAA,CAAA;AACzD,IAAK,MAAA,OAA4B,GAAA,oBAAW,CAAA,KAAA,CAAA,OAAA,EAAA,CAAA,CAAA,KAAA;AAAA,MAC7C,IAAA,CAAA,CAAA,MAAA,KAAA,CAAA;AAED,QAAA,OAAe,EAAA,CAAA;AAAA,KAAA,CACb,CAAM;AAAA,IAAA,MACC,MAAA,GAAA;AAAA,MACP,IAAO,EAAA,MAAA;AAAA,MACP,KAAW,EAAA,OAAA;AAAA,MACX,KAAY,EAAA,OAAA;AAAA,MACZ,SAAY,EAAA,WAAA;AAAA,MACd,UAAA,EAAA,YAAA;AAEA,MAAA,UAAkB,EAAA,YAEhBA;AAGA,KAAA,CAAA;AACE,IAAO,MAAA,SAAA,GAAA,CAAQA,WAAQ,EAAA,IAAQ,KAAE;AAC/B,MAAG,IAAA,EAAA,EAAA;AAAmB,QACxB,MAAC,CAAA,OAAA,CAAA,OAAA,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,IAAA,EAAA,OAAA,CAAA,KAAA;AAAA,UACH,EAAA,CAAA,IAAA,CAAA,CAAA,IAAA,EAAA,OAAA,CAAA,CAAA;AAAA,SACF,CAAA,CAAA;AAEA,OAAM;AACJ,KAAU,CAAA;AACV,IAAU,KAAA,CAAA,UAAA,EAAA,CAAA,SAAA,EAAA,iBAAgD,KAAA;AAE1D,MAAA,SAAe,CAAA,SAAA,EAAA,MAAA,EAAA,kBAAA,CAAA,CAAA;AACb,MAAU,SAAA,CAAA,iBAAiC,EAAA,MAAA,EAAA,qBAAe,CAAA,CAAA;AAAA,MAC5D,IAAA,SAAA,EAAA;AAAA,QACD,SAAA,CAAA,YAAA,CAAA,kBAAA,EAAA,SAAA,CAAA,KAAA,CAAA,CAAA;AAED,OAAA;AACE,KAAU,CAAA,CAAA;AACV,IAAS,eAAA,CAAA,MAAA;AAAwC,MAClD,SAAA,CAAA,UAAA,CAAA,KAAA,EAAA,MAAA,EAAA,qBAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}