@bridge-ui/vue 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Adapters/I18n/index.d.ts +1 -0
- package/dist/Adapters/I18n/index.js +2 -0
- package/dist/Adapters/I18n/useI18nAdapter.d.ts +12 -0
- package/dist/Adapters/I18n/useI18nAdapter.js +13 -0
- package/dist/Adapters/Icon/iconSource.types.d.ts +11 -0
- package/dist/Adapters/Icon/index.d.ts +2 -0
- package/dist/Adapters/Icon/index.js +2 -0
- package/dist/Adapters/Icon/useIconAdapter.d.ts +11 -0
- package/dist/Adapters/Icon/useIconAdapter.js +13 -0
- package/dist/Adapters/index.d.ts +3 -0
- package/dist/Adapters/index.js +3 -0
- package/dist/Components/Alert/Alert.vue_vue_type_script_setup_true_lang.js +1 -5
- package/dist/Components/Alert/alert.types.d.ts +2 -2
- package/dist/Components/Alert/alertDefaultIcons.d.ts +2 -2
- package/dist/Components/Alert/alertDefaultIcons.js +9 -10
- package/dist/Components/Alert/composables/useAlert.d.ts +2 -2
- package/dist/Components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/Avatar/avatar.types.d.ts +2 -2
- package/dist/Components/Avatar/composables/useAvatar.d.ts +1 -1
- package/dist/Components/Avatar/composables/useAvatar.js +43 -44
- package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +24 -25
- package/dist/Components/Button/button.types.d.ts +4 -4
- package/dist/Components/Button/composables/useButton.d.ts +1 -1
- package/dist/Components/Checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +25 -25
- package/dist/Components/Checkbox/composables/useCheckbox.d.ts +3 -3
- package/dist/Components/Chip/Chip.vue_vue_type_script_setup_true_lang.js +8 -9
- package/dist/Components/FormControl/composables/useFormControl.d.ts +1 -1
- package/dist/Components/FormField/composables/useFormField.d.ts +4 -4
- package/dist/Components/FormField/composables/useFormField.js +98 -99
- package/dist/Components/FormField/formField.types.d.ts +5 -5
- package/dist/Components/Icon/Icon.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/Components/Icon/composables/useIcon.d.ts +2 -0
- package/dist/Components/Icon/composables/useIcon.js +20 -18
- package/dist/Components/Icon/icon.types.d.ts +3 -3
- package/dist/Components/Label/composables/useLabel.d.ts +1 -1
- package/dist/Components/Link/Link.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Link/link.types.d.ts +3 -3
- package/dist/Components/ListItem/composables/useListItem.d.ts +2 -2
- package/dist/Components/ListItem/composables/useListItem.js +75 -76
- package/dist/Components/ListItem/listItem.types.d.ts +2 -2
- package/dist/Components/Listbox/Listbox.vue.d.ts +0 -2
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +73 -72
- package/dist/Components/NumberField/NumberField.vue_vue_type_script_setup_true_lang.js +40 -40
- package/dist/Components/NumberField/composables/useNumberField.d.ts +6 -6
- package/dist/Components/PasswordField/PasswordField.vue_vue_type_script_setup_true_lang.js +24 -24
- package/dist/Components/PasswordField/composables/usePasswordField.d.ts +6 -6
- package/dist/Components/Radio/composables/useRadio.d.ts +3 -3
- package/dist/Components/Select/Select.vue.d.ts +0 -1
- package/dist/Components/Select/Select.vue_vue_type_script_setup_true_lang.js +62 -61
- package/dist/Components/Select/composables/useSelect.d.ts +8 -8
- package/dist/Components/Select/composables/useSelect.js +214 -214
- package/dist/Components/Snackbar/Snackbar.vue_vue_type_script_setup_true_lang.js +81 -75
- package/dist/Components/Snackbar/composables/useSnackbar.d.ts +4 -4
- package/dist/Components/Snackbar/snackbar.types.d.ts +3 -3
- package/dist/Components/Snackbar/snackbarDefaultIcons.d.ts +3 -3
- package/dist/Components/Snackbar/snackbarDefaultIcons.js +9 -10
- package/dist/Components/Switch/composables/useSwitch.d.ts +3 -3
- package/dist/Components/Tab/Tab.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Tab/tab.types.d.ts +3 -3
- package/dist/Components/TabItem/TabItem.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/TabItem/tabItem.types.d.ts +3 -3
- package/dist/Components/Tabs/composables/useTabs.d.ts +468 -4
- package/dist/Components/Tabs/tabsInjectionKey.d.ts +5 -5
- package/dist/Components/TextField/composables/useTextField.d.ts +6 -6
- package/dist/Components/Textarea/composables/useTextarea.d.ts +6 -6
- package/dist/Components/Tooltip/Tooltip.js +5 -0
- package/dist/Components/Tooltip/Tooltip.vue.d.ts +35 -0
- package/dist/Components/Tooltip/Tooltip.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/Components/Tooltip/composables/useTooltip.d.ts +50 -0
- package/dist/Components/Tooltip/composables/useTooltip.js +208 -0
- package/dist/Components/Tooltip/index.d.ts +4 -0
- package/dist/Components/Tooltip/index.js +3 -0
- package/dist/Components/Tooltip/tooltip.types.d.ts +166 -0
- package/dist/Provider/createBridgeUIApi.js +2 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +80 -76
- package/dist/theme.css +12 -12
- package/package.json +20 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TooltipOwnProps, TooltipSlots } from './tooltip.types';
|
|
2
|
+
type __VLS_Slots = TooltipSlots;
|
|
3
|
+
type __VLS_Props = TooltipOwnProps;
|
|
4
|
+
type __VLS_ModelProps = {
|
|
5
|
+
modelValue?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (value: boolean) => any;
|
|
10
|
+
"show-change": (show: boolean) => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
13
|
+
"onShow-change"?: ((show: boolean) => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
color: import('@bridge-ui/core').MergeProps<import('@bridge-ui/core').TooltipColor, import('./tooltip.types').TooltipColorOverrides>;
|
|
16
|
+
offset: number;
|
|
17
|
+
size: import('@bridge-ui/core').MergeProps<import('@bridge-ui/core').TooltipSize, import('./tooltip.types').TooltipSizeOverrides>;
|
|
18
|
+
rounded: import('@bridge-ui/core').MergeProps<import('@bridge-ui/core').TooltipRounded, import('./tooltip.types').TooltipRoundedOverrides>;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
anchorEl: null | HTMLElement;
|
|
21
|
+
placement: import('@floating-ui/utils').Placement;
|
|
22
|
+
strategy: import('@bridge-ui/core').PositionStrategy;
|
|
23
|
+
teleportTo: false | string;
|
|
24
|
+
arrow: boolean;
|
|
25
|
+
closeDelay: number;
|
|
26
|
+
openDelay: number;
|
|
27
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { hasNamedSlot as e, resolveNamedSlot as t, resolveSlotOrProp as n } from "../../Utils/slotOrProp.js";
|
|
2
|
+
import { useTooltip as r } from "./composables/useTooltip.js";
|
|
3
|
+
import { Fragment as i, Teleport as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, normalizeProps as m, openBlock as h, resolveDynamicComponent as g, unref as _, useModel as v, useSlots as y } from "vue";
|
|
4
|
+
//#region src/Components/Tooltip/Tooltip.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var b = /* @__PURE__ */ d({
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "Tooltip",
|
|
8
|
+
props: /* @__PURE__ */ f({
|
|
9
|
+
anchorEl: { default: null },
|
|
10
|
+
arrow: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: !0
|
|
13
|
+
},
|
|
14
|
+
classes: {},
|
|
15
|
+
closeDelay: { default: 0 },
|
|
16
|
+
color: { default: "dark" },
|
|
17
|
+
content: {},
|
|
18
|
+
customProps: {},
|
|
19
|
+
disabled: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !1
|
|
22
|
+
},
|
|
23
|
+
offset: { default: 8 },
|
|
24
|
+
onShowChange: {},
|
|
25
|
+
openDelay: { default: 200 },
|
|
26
|
+
placement: { default: "top" },
|
|
27
|
+
rounded: { default: "md" },
|
|
28
|
+
size: { default: "md" },
|
|
29
|
+
strategy: { default: "fixed" },
|
|
30
|
+
teleportTo: {
|
|
31
|
+
type: [Boolean, String],
|
|
32
|
+
default: "body"
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
modelValue: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !1
|
|
38
|
+
},
|
|
39
|
+
modelModifiers: {}
|
|
40
|
+
}),
|
|
41
|
+
emits: /* @__PURE__ */ f(["show-change"], ["update:modelValue"]),
|
|
42
|
+
setup(d, { emit: f }) {
|
|
43
|
+
let b = y(), x = f, S = d, { merged: C, mounted: w, rootBind: T, arrowBind: E, triggerBind: D, contentBind: O, setArrowRef: k, setTriggerRef: A, setContentRef: j } = r(S, {
|
|
44
|
+
offset: 8,
|
|
45
|
+
size: "md",
|
|
46
|
+
arrow: !0,
|
|
47
|
+
color: "dark",
|
|
48
|
+
rounded: "md",
|
|
49
|
+
closeDelay: 0,
|
|
50
|
+
openDelay: 200,
|
|
51
|
+
placement: "top",
|
|
52
|
+
strategy: "fixed",
|
|
53
|
+
teleportTo: "body"
|
|
54
|
+
}, {
|
|
55
|
+
show: v(d, "modelValue"),
|
|
56
|
+
onShowChange: (e) => {
|
|
57
|
+
S.onShowChange?.(e), x("show-change", e);
|
|
58
|
+
}
|
|
59
|
+
}), M = o(() => e(b, "trigger")), N = o(() => n(b, "default", C.value.content)), P = o(() => C.value.teleportTo === !1), F = o(() => C.value.teleportTo === !1 ? "body" : C.value.teleportTo);
|
|
60
|
+
return (e, n) => (h(), l(i, null, [M.value ? (h(), l("div", m(p({ key: 0 }, _(T))), [u("div", p({ ref: _(A) }, _(D)), [(h(), s(g(_(t)(_(b), "trigger"))))], 16)], 16)) : c("", !0), (h(), s(a, {
|
|
61
|
+
to: F.value,
|
|
62
|
+
disabled: P.value
|
|
63
|
+
}, [_(w) ? (h(), l("div", p({
|
|
64
|
+
key: 0,
|
|
65
|
+
ref: _(j)
|
|
66
|
+
}, _(O)), [(h(), s(g(N.value))), _(E) ? (h(), l("div", p({
|
|
67
|
+
key: 0,
|
|
68
|
+
ref: _(k)
|
|
69
|
+
}, _(E)), null, 16)) : c("", !0)], 16)) : c("", !0)], 8, ["to", "disabled"]))], 64));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
//#endregion
|
|
73
|
+
export { b as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ComponentPublicInstance, Ref } from 'vue';
|
|
2
|
+
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core';
|
|
3
|
+
import { TooltipOwnProps, TooltipProps } from '../tooltip.types';
|
|
4
|
+
type TooltipLibDefaults = LibDefaultsShape<TooltipOwnProps, "size" | "arrow" | "color" | "offset" | "rounded" | "strategy" | "openDelay" | "placement" | "closeDelay" | "teleportTo">;
|
|
5
|
+
type TooltipMerged = MergeLibDefaults<TooltipOwnProps, TooltipLibDefaults>;
|
|
6
|
+
export type TooltipOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Called when `show` should change (controlled state).
|
|
9
|
+
*/
|
|
10
|
+
onShowChange?: (show: boolean) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the tooltip is visible (`defineModel()` / `v-model`).
|
|
13
|
+
*
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
show?: Ref<boolean>;
|
|
17
|
+
};
|
|
18
|
+
export declare function useTooltip(props: TooltipOwnProps, libDefaults: TooltipLibDefaults, options?: TooltipOptions): {
|
|
19
|
+
show: import('vue').ComputedRef<boolean>;
|
|
20
|
+
merged: import('vue').ComputedRef<TooltipMerged>;
|
|
21
|
+
mounted: Ref<boolean, boolean>;
|
|
22
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<TooltipProps, "color" | "offset" | "size" | "classes" | "customProps" | "rounded" | "disabled" | "placement" | "strategy" | "teleportTo" | "content" | "arrow" | "closeDelay" | "openDelay">, "anchorEl" | "onShowChange">>>;
|
|
23
|
+
tooltipId: string;
|
|
24
|
+
arrowBind: import('vue').ComputedRef<({
|
|
25
|
+
"aria-hidden": boolean;
|
|
26
|
+
class: string;
|
|
27
|
+
} & object & Record<"class", string>) | null>;
|
|
28
|
+
isPortaled: import('vue').ComputedRef<boolean>;
|
|
29
|
+
triggerBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
30
|
+
onBlur: () => void;
|
|
31
|
+
onFocus: () => void;
|
|
32
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
33
|
+
onPointerenter: () => void;
|
|
34
|
+
onPointerleave: () => void;
|
|
35
|
+
"aria-describedby": string | undefined;
|
|
36
|
+
class: string;
|
|
37
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
38
|
+
contentBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<{
|
|
39
|
+
id: string;
|
|
40
|
+
role: string;
|
|
41
|
+
style: {
|
|
42
|
+
zIndex: number;
|
|
43
|
+
};
|
|
44
|
+
class: string;
|
|
45
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
46
|
+
setArrowRef: (element: null | Element | ComponentPublicInstance) => void;
|
|
47
|
+
setTriggerRef: (element: null | Element | ComponentPublicInstance) => void;
|
|
48
|
+
setContentRef: (element: null | Element | ComponentPublicInstance) => void;
|
|
49
|
+
};
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { mergePartBind as e, resolveVnodeRefElement as t, useBridgeUIComponent as ee, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { computed as r, nextTick as i, onBeforeUnmount as a, ref as o, toValue as s, useAttrs as c, useId as l, watch as u } from "vue";
|
|
3
|
+
import { get as d, omit as te } from "es-toolkit/compat";
|
|
4
|
+
import { LAYER_STACK_BASE_Z_INDEX as f, acquireLayerStackOrder as p, cn as m, createPositionable as ne, mergeBridgeUILayeredClasses as h, pushLayerStack as g, splitComponentProps as _ } from "@bridge-ui/core";
|
|
5
|
+
import { colorProps as v, roundedProps as y, sizeProps as re } from "@bridge-ui/core/Tokens/Tooltip";
|
|
6
|
+
//#region src/Components/Tooltip/composables/useTooltip.ts
|
|
7
|
+
var b = [
|
|
8
|
+
"size",
|
|
9
|
+
"arrow",
|
|
10
|
+
"color",
|
|
11
|
+
"offset",
|
|
12
|
+
"classes",
|
|
13
|
+
"content",
|
|
14
|
+
"rounded",
|
|
15
|
+
"disabled",
|
|
16
|
+
"strategy",
|
|
17
|
+
"openDelay",
|
|
18
|
+
"placement",
|
|
19
|
+
"closeDelay",
|
|
20
|
+
"teleportTo",
|
|
21
|
+
"customProps"
|
|
22
|
+
];
|
|
23
|
+
function x(x, ie, S = {}) {
|
|
24
|
+
let C = c(), w = l(), T = o(!1), E = o(""), D = o(null), O = o(null), k = o(null), A = null, j = !1, M = null, N = null, P = null, F = null, I = o(f), L = r(() => s(S.show ?? !1));
|
|
25
|
+
function R(e) {
|
|
26
|
+
S.show && (S.show.value = e), S.onShowChange?.(e);
|
|
27
|
+
}
|
|
28
|
+
let z = r(() => _({
|
|
29
|
+
bridgeKeys: b,
|
|
30
|
+
props: {
|
|
31
|
+
...C,
|
|
32
|
+
...x
|
|
33
|
+
}
|
|
34
|
+
})), { merged: B, entry: V } = ee({
|
|
35
|
+
libDefaults: ie,
|
|
36
|
+
componentName: "Tooltip",
|
|
37
|
+
props: () => z.value.componentProps
|
|
38
|
+
}), H = r(() => B.value.customProps), U = n({
|
|
39
|
+
entry: V,
|
|
40
|
+
props: () => z.value.componentProps
|
|
41
|
+
}), W = r(() => B.value.teleportTo !== !1), G = r(() => d(h(v, V.value?.tokens?.color), B.value.color)), K = r(() => d(h(re, V.value?.tokens?.size), B.value.size)), q = r(() => d(h(y, V.value?.tokens?.rounded), B.value.rounded)), J = r(() => te(z.value.inheritedAttrs, ["anchorEl", "onShowChange"]));
|
|
42
|
+
function Y() {
|
|
43
|
+
P !== null && (clearTimeout(P), P = null), F !== null && (clearTimeout(F), F = null);
|
|
44
|
+
}
|
|
45
|
+
function ae() {
|
|
46
|
+
return x.anchorEl ?? k.value;
|
|
47
|
+
}
|
|
48
|
+
function X() {
|
|
49
|
+
if (B.value.disabled) return;
|
|
50
|
+
Y();
|
|
51
|
+
let e = B.value.openDelay;
|
|
52
|
+
if (e <= 0) {
|
|
53
|
+
R(!0);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
P = setTimeout(() => {
|
|
57
|
+
P = null, R(!0);
|
|
58
|
+
}, e);
|
|
59
|
+
}
|
|
60
|
+
function Z() {
|
|
61
|
+
Y();
|
|
62
|
+
let e = B.value.closeDelay;
|
|
63
|
+
if (e <= 0) {
|
|
64
|
+
R(!1);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
F = setTimeout(() => {
|
|
68
|
+
F = null, R(!1);
|
|
69
|
+
}, e);
|
|
70
|
+
}
|
|
71
|
+
function oe() {
|
|
72
|
+
X();
|
|
73
|
+
}
|
|
74
|
+
function se() {
|
|
75
|
+
Z();
|
|
76
|
+
}
|
|
77
|
+
function ce() {
|
|
78
|
+
X();
|
|
79
|
+
}
|
|
80
|
+
function le() {
|
|
81
|
+
Z();
|
|
82
|
+
}
|
|
83
|
+
function ue(e) {
|
|
84
|
+
e.key !== "Escape" || !L.value || (e.preventDefault(), Y(), R(!1));
|
|
85
|
+
}
|
|
86
|
+
function Q() {
|
|
87
|
+
j = !1, N?.destroy(), N = null;
|
|
88
|
+
}
|
|
89
|
+
function de() {
|
|
90
|
+
Q();
|
|
91
|
+
let e = ae(), t = O.value;
|
|
92
|
+
!L.value || !e || !t || (N = ne({
|
|
93
|
+
floating: t,
|
|
94
|
+
reference: e,
|
|
95
|
+
shiftCrossAxis: !1,
|
|
96
|
+
offset: B.value.offset,
|
|
97
|
+
strategy: B.value.strategy,
|
|
98
|
+
placement: B.value.placement,
|
|
99
|
+
arrow: B.value.arrow ? () => D.value : void 0,
|
|
100
|
+
onReferenceHidden: () => {
|
|
101
|
+
!j || !L.value || (Y(), R(!1));
|
|
102
|
+
}
|
|
103
|
+
}), N.start(), i(() => {
|
|
104
|
+
j = !0;
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
function $() {
|
|
108
|
+
M?.release(), M = null, E.value = "", I.value = f;
|
|
109
|
+
}
|
|
110
|
+
function fe() {
|
|
111
|
+
if ($(), !L.value) {
|
|
112
|
+
A = null;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
A === null && (A = p());
|
|
116
|
+
function e() {
|
|
117
|
+
L.value && (Y(), R(!1));
|
|
118
|
+
}
|
|
119
|
+
M = g({
|
|
120
|
+
order: A,
|
|
121
|
+
lockScroll: !1,
|
|
122
|
+
onEscape: e
|
|
123
|
+
}), E.value = M.id, I.value = M.zIndex;
|
|
124
|
+
}
|
|
125
|
+
function pe(e) {
|
|
126
|
+
k.value = t(e);
|
|
127
|
+
}
|
|
128
|
+
function me(e) {
|
|
129
|
+
O.value = t(e);
|
|
130
|
+
}
|
|
131
|
+
function he(e) {
|
|
132
|
+
D.value = t(e);
|
|
133
|
+
}
|
|
134
|
+
u(L, (e) => {
|
|
135
|
+
if (e) {
|
|
136
|
+
T.value = !0;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
T.value = !1;
|
|
140
|
+
}, { immediate: !0 }), u([
|
|
141
|
+
L,
|
|
142
|
+
T,
|
|
143
|
+
() => x.anchorEl,
|
|
144
|
+
() => B.value.arrow,
|
|
145
|
+
() => B.value.offset,
|
|
146
|
+
() => B.value.strategy,
|
|
147
|
+
() => B.value.placement
|
|
148
|
+
], async () => {
|
|
149
|
+
if (!L.value || !T.value) {
|
|
150
|
+
Q();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
await i(), de();
|
|
154
|
+
}, { flush: "post" }), u(L, () => {
|
|
155
|
+
fe();
|
|
156
|
+
}, { immediate: !0 }), a(() => {
|
|
157
|
+
Y(), Q(), $();
|
|
158
|
+
});
|
|
159
|
+
let ge = r(() => e(H.value?.root, J.value, m({
|
|
160
|
+
"relative inline-flex": !0,
|
|
161
|
+
[d(U.value, "root") ?? ""]: !0
|
|
162
|
+
}))), _e = r(() => e(H.value?.trigger, {}, {
|
|
163
|
+
onBlur: le,
|
|
164
|
+
onFocus: ce,
|
|
165
|
+
onKeydown: ue,
|
|
166
|
+
onPointerenter: oe,
|
|
167
|
+
onPointerleave: se,
|
|
168
|
+
"aria-describedby": L.value ? w : void 0,
|
|
169
|
+
class: m({
|
|
170
|
+
"inline-flex w-fit max-w-full outline-hidden": !0,
|
|
171
|
+
[d(U.value, "trigger") ?? ""]: !0
|
|
172
|
+
})
|
|
173
|
+
})), ve = r(() => e(H.value?.content, {}, {
|
|
174
|
+
id: w,
|
|
175
|
+
role: "tooltip",
|
|
176
|
+
style: { zIndex: I.value },
|
|
177
|
+
class: m({
|
|
178
|
+
"pointer-events-none absolute w-max max-w-xs font-medium shadow-md": !0,
|
|
179
|
+
[G.value?.content ?? ""]: !0,
|
|
180
|
+
[K.value?.content ?? ""]: !0,
|
|
181
|
+
[q.value ?? ""]: !0,
|
|
182
|
+
[d(U.value, "content") ?? ""]: !0
|
|
183
|
+
})
|
|
184
|
+
}));
|
|
185
|
+
return {
|
|
186
|
+
show: L,
|
|
187
|
+
merged: B,
|
|
188
|
+
mounted: T,
|
|
189
|
+
rootBind: ge,
|
|
190
|
+
tooltipId: w,
|
|
191
|
+
arrowBind: r(() => B.value.arrow ? e(H.value?.arrow, {}, {
|
|
192
|
+
"aria-hidden": !0,
|
|
193
|
+
class: m({
|
|
194
|
+
"pointer-events-none absolute size-2 rotate-45": !0,
|
|
195
|
+
[G.value?.arrow ?? ""]: !0,
|
|
196
|
+
[d(U.value, "arrow") ?? ""]: !0
|
|
197
|
+
})
|
|
198
|
+
}) : null),
|
|
199
|
+
isPortaled: W,
|
|
200
|
+
triggerBind: _e,
|
|
201
|
+
contentBind: ve,
|
|
202
|
+
setArrowRef: he,
|
|
203
|
+
setTriggerRef: pe,
|
|
204
|
+
setContentRef: me
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { x as useTooltip };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useTooltip } from './composables/useTooltip';
|
|
2
|
+
export type { TooltipOptions } from './composables/useTooltip';
|
|
3
|
+
export type { TooltipClasses, TooltipColorOverrides, TooltipCustomProps, TooltipEmits, TooltipOwnProps, TooltipProps, TooltipRoundedOverrides, TooltipSizeOverrides, TooltipSlots, } from './tooltip.types';
|
|
4
|
+
export { default as Tooltip } from './Tooltip.vue';
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { MergeHtmlProps, MergeProps, PositionPlacement, PositionStrategy, TooltipColor, TooltipRounded, TooltipSize } from '@bridge-ui/core';
|
|
3
|
+
export interface TooltipSizeOverrides {}
|
|
4
|
+
export interface TooltipColorOverrides {}
|
|
5
|
+
export interface TooltipRoundedOverrides {}
|
|
6
|
+
export interface TooltipClasses {
|
|
7
|
+
/**
|
|
8
|
+
* The classes to apply to the arrow.
|
|
9
|
+
*/
|
|
10
|
+
arrow?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The classes to apply to the content.
|
|
13
|
+
*/
|
|
14
|
+
content?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The classes to apply to the root.
|
|
17
|
+
*/
|
|
18
|
+
root?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The classes to apply to the trigger.
|
|
21
|
+
*/
|
|
22
|
+
trigger?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface TooltipCustomProps {
|
|
25
|
+
/**
|
|
26
|
+
* Props forwarded to the arrow element.
|
|
27
|
+
*/
|
|
28
|
+
arrow?: HTMLAttributes;
|
|
29
|
+
/**
|
|
30
|
+
* Props forwarded to the floating tooltip panel.
|
|
31
|
+
*/
|
|
32
|
+
content?: HTMLAttributes;
|
|
33
|
+
/**
|
|
34
|
+
* Props forwarded to the root wrapper (contains the trigger).
|
|
35
|
+
*/
|
|
36
|
+
root?: HTMLAttributes;
|
|
37
|
+
/**
|
|
38
|
+
* Props forwarded to the trigger wrapper.
|
|
39
|
+
*/
|
|
40
|
+
trigger?: HTMLAttributes;
|
|
41
|
+
}
|
|
42
|
+
export interface TooltipEmits {
|
|
43
|
+
/**
|
|
44
|
+
* Emitted when `show` should change (controlled state without `v-model`).
|
|
45
|
+
*/
|
|
46
|
+
"show-change": [show: boolean];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Anchored tooltip. Visibility uses `v-model` (omit for uncontrolled hover/focus
|
|
50
|
+
* when using the `trigger` slot). Anchor with `anchorEl` or put the opener in
|
|
51
|
+
* the `trigger` slot. Use `content` for plain text, or the default slot for
|
|
52
|
+
* custom panel body (default slot wins when both are set).
|
|
53
|
+
*/
|
|
54
|
+
export interface TooltipOwnProps {
|
|
55
|
+
/**
|
|
56
|
+
* Element that anchors the tooltip panel. When set, it is used
|
|
57
|
+
* for positioning instead of the `trigger` slot wrapper.
|
|
58
|
+
* Prefer this when the opener lives outside the `Tooltip` or is controlled manually.
|
|
59
|
+
* Not merged into Bridge defaults (DOM nodes must not be deep-merged).
|
|
60
|
+
*
|
|
61
|
+
* @default undefined
|
|
62
|
+
*/
|
|
63
|
+
anchorEl?: null | HTMLElement;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the tooltip shows an arrow pointing at the trigger.
|
|
66
|
+
*
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
arrow?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The classes to apply to the tooltip.
|
|
72
|
+
*
|
|
73
|
+
* @default undefined
|
|
74
|
+
*/
|
|
75
|
+
classes?: TooltipClasses;
|
|
76
|
+
/**
|
|
77
|
+
* Delay in ms before closing after pointer leave / blur.
|
|
78
|
+
*
|
|
79
|
+
* @default 0
|
|
80
|
+
*/
|
|
81
|
+
closeDelay?: number;
|
|
82
|
+
/**
|
|
83
|
+
* The color of the tooltip.
|
|
84
|
+
*
|
|
85
|
+
* @default "dark"
|
|
86
|
+
*/
|
|
87
|
+
color?: MergeProps<TooltipColor, TooltipColorOverrides>;
|
|
88
|
+
/**
|
|
89
|
+
* Plain text for the tooltip panel. Prefer the default slot for custom markup.
|
|
90
|
+
*
|
|
91
|
+
* @default undefined
|
|
92
|
+
*/
|
|
93
|
+
content?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Extra props for internal parts (`root`, `trigger`, `content`, `arrow`).
|
|
96
|
+
* Root HTML attributes stay on the component top level.
|
|
97
|
+
*
|
|
98
|
+
* @default undefined
|
|
99
|
+
*/
|
|
100
|
+
customProps?: TooltipCustomProps;
|
|
101
|
+
/**
|
|
102
|
+
* When true, the tooltip does not open on hover or focus.
|
|
103
|
+
*
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
disabled?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Gap between the trigger and the tooltip panel (px).
|
|
109
|
+
*
|
|
110
|
+
* @default 8
|
|
111
|
+
*/
|
|
112
|
+
offset?: number;
|
|
113
|
+
/**
|
|
114
|
+
* Called when `show` should change (controlled state without `v-model`).
|
|
115
|
+
*
|
|
116
|
+
* @default undefined
|
|
117
|
+
*/
|
|
118
|
+
onShowChange?: (show: boolean) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Delay in ms before opening after pointer enter / focus.
|
|
121
|
+
*
|
|
122
|
+
* @default 200
|
|
123
|
+
*/
|
|
124
|
+
openDelay?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Preferred placement of the tooltip relative to the anchor (Floating UI).
|
|
127
|
+
*
|
|
128
|
+
* @default "top"
|
|
129
|
+
*/
|
|
130
|
+
placement?: PositionPlacement;
|
|
131
|
+
/**
|
|
132
|
+
* The roundedness of the tooltip panel.
|
|
133
|
+
*
|
|
134
|
+
* @default "md"
|
|
135
|
+
*/
|
|
136
|
+
rounded?: MergeProps<TooltipRounded, TooltipRoundedOverrides>;
|
|
137
|
+
/**
|
|
138
|
+
* The size of the tooltip.
|
|
139
|
+
*
|
|
140
|
+
* @default "md"
|
|
141
|
+
*/
|
|
142
|
+
size?: MergeProps<TooltipSize, TooltipSizeOverrides>;
|
|
143
|
+
/**
|
|
144
|
+
* CSS position strategy for the floating panel.
|
|
145
|
+
*
|
|
146
|
+
* @default "fixed"
|
|
147
|
+
*/
|
|
148
|
+
strategy?: PositionStrategy;
|
|
149
|
+
/**
|
|
150
|
+
* Where to portal the tooltip panel. Pass `false` to render in place.
|
|
151
|
+
*
|
|
152
|
+
* @default "body"
|
|
153
|
+
*/
|
|
154
|
+
teleportTo?: false | string;
|
|
155
|
+
}
|
|
156
|
+
export interface TooltipSlots {
|
|
157
|
+
/**
|
|
158
|
+
* Custom panel body. Wins over the `content` prop when both are set.
|
|
159
|
+
*/
|
|
160
|
+
default?: Slot<undefined>;
|
|
161
|
+
/**
|
|
162
|
+
* The trigger element that opens the tooltip.
|
|
163
|
+
*/
|
|
164
|
+
trigger?: Slot<undefined>;
|
|
165
|
+
}
|
|
166
|
+
export type TooltipProps = MergeHtmlProps<TooltipOwnProps, HTMLAttributes>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { setI18nAdapterForTests, useI18nAdapter } from './Adapters/I18n';
|
|
2
|
+
export { setIconAdapterForTests, useIconAdapter } from './Adapters/Icon';
|
|
3
|
+
export type { IconElement, IconSource, SemanticIconName, } from './Adapters/Icon';
|
|
1
4
|
export { Alert, useAlert } from './Components/Alert';
|
|
2
5
|
export type { AlertClasses, AlertColorOverrides, AlertPaddingOverrides, AlertProps, AlertRoundedOverrides, AlertShadowOverrides, AlertSlots, AlertVariantOverrides, } from './Components/Alert';
|
|
3
6
|
export { Avatar } from './Components/Avatar';
|
|
@@ -70,8 +73,11 @@ export { Textarea, useTextarea } from './Components/Textarea';
|
|
|
70
73
|
export type { TextareaClasses, TextareaCustomProps, TextareaOwnProps, TextareaProps, TextareaSlots, } from './Components/Textarea';
|
|
71
74
|
export { TextField, useTextField } from './Components/TextField';
|
|
72
75
|
export type { TextFieldClasses, TextFieldCustomProps, TextFieldOwnProps, TextFieldProps, TextFieldSlots, } from './Components/TextField';
|
|
76
|
+
export { Tooltip, useTooltip } from './Components/Tooltip';
|
|
77
|
+
export type { TooltipClasses, TooltipColorOverrides, TooltipCustomProps, TooltipEmits, TooltipOptions, TooltipOwnProps, TooltipProps, TooltipRoundedOverrides, TooltipSizeOverrides, TooltipSlots, } from './Components/Tooltip';
|
|
73
78
|
export { BridgeUIProvider, createBridgeUI, useBridgeUI } from './Provider';
|
|
74
79
|
export type { BridgeUIContextApi } from './Provider';
|
|
75
80
|
export { useBreakpoint, useBridgeUIComponent, useBridgeUIMergedRegistryClasses, } from './Utils';
|
|
76
81
|
export type { UseBreakpointOptions } from './Utils';
|
|
77
|
-
export { BRIDGE_UI_DEFAULT_GLOBAL, cn, mergeBridgeUIComponents, mergeBridgeUIGlobal, resolveBridgeUIOptions, } from '@bridge-ui/core';
|
|
82
|
+
export { BRIDGE_UI_DEFAULT_GLOBAL, SEMANTIC_ICON_NAMES, cn, createI18nAdapter, createIconAdapter, mergeBridgeUIComponents, mergeBridgeUIGlobal, resolveBridgeUIOptions, resolveMessage, } from '@bridge-ui/core';
|
|
83
|
+
export type { I18nAdapter, IconAdapter, SemanticIconNameOverrides, } from '@bridge-ui/core';
|