@vialiq/web-components 0.4.0 → 0.6.0
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/README.md +575 -2
- package/button/index.js +1 -0
- package/checkbox/index.d.ts +3 -0
- package/checkbox/index.d.ts.map +1 -0
- package/checkbox/index.js +1 -0
- package/checkbox/vi-checkbox.d.ts +68 -0
- package/checkbox/vi-checkbox.d.ts.map +1 -0
- package/checkbox/vi-checkbox.js +653 -0
- package/if-non-empty-DX8UGa-B.js +64 -0
- package/index.d.ts +5 -1
- package/index.js +2 -0
- package/input/index.js +1 -0
- package/input/vi-input.d.ts +4 -0
- package/input/vi-input.d.ts.map +1 -1
- package/input/vi-input.js +38 -67
- package/package.json +38 -2
- package/radio/index.d.ts +5 -0
- package/radio/index.d.ts.map +1 -0
- package/radio/index.js +2 -0
- package/radio/vi-radio-group.d.ts +72 -0
- package/radio/vi-radio-group.d.ts.map +1 -0
- package/radio/vi-radio-group.js +780 -0
- package/radio/vi-radio.d.ts +47 -0
- package/radio/vi-radio.d.ts.map +1 -0
- package/radio/vi-radio.js +538 -0
- package/tooltip/index.d.ts +3 -0
- package/tooltip/index.d.ts.map +1 -0
- package/tooltip/index.js +1 -0
- package/tooltip/vi-tooltip.d.ts +84 -0
- package/tooltip/vi-tooltip.d.ts.map +1 -0
- package/tooltip/vi-tooltip.js +908 -0
|
@@ -0,0 +1,908 @@
|
|
|
1
|
+
import { unsafeCSS, css, nothing, html } from 'lit';
|
|
2
|
+
import { customElement, property, state, query } from 'lit/decorators.js';
|
|
3
|
+
import { V as ViElement } from '../vi-element-C6GfDPs3.js';
|
|
4
|
+
import { autoUpdate, offset, flip, shift, arrow, computePosition } from '@floating-ui/dom';
|
|
5
|
+
|
|
6
|
+
const tooltipStyles = "@charset \"UTF-8\";@layer reset,components,utilities;.tooltip-panel{position:fixed;z-index:var(--vi-tooltip-z-index, 9999);pointer-events:none;opacity:0;transform:scale(.95);transition:opacity .15s ease-out,transform .15s ease-out;margin:0;border:none;background:transparent;padding:0;overflow:visible;font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif)}.tooltip-panel[popover]:popover-open{display:block;pointer-events:auto;opacity:1;transform:scale(1)}.tooltip-panel{transition-property:opacity,transform,display,overlay;transition-behavior:allow-discrete}@media(prefers-reduced-motion:reduce){.tooltip-panel{transition:none;transform:none}}.tooltip-content{background-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827));color:var(--vi-tooltip-color, var(--vi-text-inverse, #ffffff));font-size:var(--vi-tooltip-font-size, 12px);line-height:1.4;padding:var(--vi-tooltip-padding, 6px 10px);border-radius:var(--vi-tooltip-border-radius, 4px);box-shadow:var(--vi-tooltip-shadow, var(--vi-shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .1)));max-width:var(--vi-tooltip-max-width, 240px);word-wrap:break-word;white-space:normal;position:relative}.tooltip-arrow{position:absolute;width:0;height:0;border-style:solid;border-color:transparent;pointer-events:none}.tooltip-panel[placement^=top] .tooltip-arrow,.tooltip-panel[data-placement^=top] .tooltip-arrow{bottom:calc(-1 * var(--vi-tooltip-arrow-size, 6px));left:50%;transform:translate(-50%);border-width:var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px) 0;border-top-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827))}.tooltip-panel[placement^=bottom] .tooltip-arrow,.tooltip-panel[data-placement^=bottom] .tooltip-arrow{top:calc(-1 * var(--vi-tooltip-arrow-size, 6px));left:50%;transform:translate(-50%);border-width:0 var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px);border-bottom-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827))}.tooltip-panel[placement=left] .tooltip-arrow,.tooltip-panel[data-placement=left] .tooltip-arrow{right:calc(-1 * var(--vi-tooltip-arrow-size, 6px));top:50%;transform:translateY(-50%);border-width:var(--vi-tooltip-arrow-size, 6px) 0 var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px);border-left-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827))}.tooltip-panel[placement=right] .tooltip-arrow,.tooltip-panel[data-placement=right] .tooltip-arrow{left:calc(-1 * var(--vi-tooltip-arrow-size, 6px));top:50%;transform:translateY(-50%);border-width:var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px) 0;border-right-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827))}.tooltip-panel[placement$=-start] .tooltip-arrow,.tooltip-panel[data-placement$=-start] .tooltip-arrow{left:12px;transform:none}.tooltip-panel[placement$=-end] .tooltip-arrow,.tooltip-panel[data-placement$=-end] .tooltip-arrow{left:auto;right:12px;transform:none}:host{display:inline-block}";
|
|
7
|
+
|
|
8
|
+
function applyDecs2203RFactory() {
|
|
9
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
10
|
+
return function addInitializer(initializer) {
|
|
11
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
12
|
+
assertCallable(initializer, "An initializer");
|
|
13
|
+
initializers.push(initializer);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
17
|
+
var kindStr;
|
|
18
|
+
switch(kind){
|
|
19
|
+
case 1:
|
|
20
|
+
kindStr = "accessor";
|
|
21
|
+
break;
|
|
22
|
+
case 2:
|
|
23
|
+
kindStr = "method";
|
|
24
|
+
break;
|
|
25
|
+
case 3:
|
|
26
|
+
kindStr = "getter";
|
|
27
|
+
break;
|
|
28
|
+
case 4:
|
|
29
|
+
kindStr = "setter";
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
kindStr = "field";
|
|
33
|
+
}
|
|
34
|
+
var ctx = {
|
|
35
|
+
kind: kindStr,
|
|
36
|
+
name: isPrivate ? "#" + name : name,
|
|
37
|
+
static: isStatic,
|
|
38
|
+
private: isPrivate,
|
|
39
|
+
metadata: metadata
|
|
40
|
+
};
|
|
41
|
+
var decoratorFinishedRef = {
|
|
42
|
+
v: false
|
|
43
|
+
};
|
|
44
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
45
|
+
var get, set;
|
|
46
|
+
if (kind === 0) {
|
|
47
|
+
if (isPrivate) {
|
|
48
|
+
get = desc.get;
|
|
49
|
+
set = desc.set;
|
|
50
|
+
} else {
|
|
51
|
+
get = function() {
|
|
52
|
+
return this[name];
|
|
53
|
+
};
|
|
54
|
+
set = function(v) {
|
|
55
|
+
this[name] = v;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
} else if (kind === 2) {
|
|
59
|
+
get = function() {
|
|
60
|
+
return desc.value;
|
|
61
|
+
};
|
|
62
|
+
} else {
|
|
63
|
+
if (kind === 1 || kind === 3) {
|
|
64
|
+
get = function() {
|
|
65
|
+
return desc.get.call(this);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (kind === 1 || kind === 4) {
|
|
69
|
+
set = function(v) {
|
|
70
|
+
desc.set.call(this, v);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
ctx.access = get && set ? {
|
|
75
|
+
get: get,
|
|
76
|
+
set: set
|
|
77
|
+
} : get ? {
|
|
78
|
+
get: get
|
|
79
|
+
} : {
|
|
80
|
+
set: set
|
|
81
|
+
};
|
|
82
|
+
try {
|
|
83
|
+
return dec(value, ctx);
|
|
84
|
+
} finally{
|
|
85
|
+
decoratorFinishedRef.v = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
89
|
+
if (decoratorFinishedRef.v) {
|
|
90
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function assertCallable(fn, hint) {
|
|
94
|
+
if (typeof fn !== "function") {
|
|
95
|
+
throw new TypeError(hint + " must be a function");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function assertValidReturnValue(kind, value) {
|
|
99
|
+
var type = typeof value;
|
|
100
|
+
if (kind === 1) {
|
|
101
|
+
if (type !== "object" || value === null) {
|
|
102
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
103
|
+
}
|
|
104
|
+
if (value.get !== undefined) {
|
|
105
|
+
assertCallable(value.get, "accessor.get");
|
|
106
|
+
}
|
|
107
|
+
if (value.set !== undefined) {
|
|
108
|
+
assertCallable(value.set, "accessor.set");
|
|
109
|
+
}
|
|
110
|
+
if (value.init !== undefined) {
|
|
111
|
+
assertCallable(value.init, "accessor.init");
|
|
112
|
+
}
|
|
113
|
+
} else if (type !== "function") {
|
|
114
|
+
var hint;
|
|
115
|
+
if (kind === 0) {
|
|
116
|
+
hint = "field";
|
|
117
|
+
} else if (kind === 10) {
|
|
118
|
+
hint = "class";
|
|
119
|
+
} else {
|
|
120
|
+
hint = "method";
|
|
121
|
+
}
|
|
122
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
126
|
+
var decs = decInfo[0];
|
|
127
|
+
var desc, init, value;
|
|
128
|
+
if (isPrivate) {
|
|
129
|
+
if (kind === 0 || kind === 1) {
|
|
130
|
+
desc = {
|
|
131
|
+
get: decInfo[3],
|
|
132
|
+
set: decInfo[4]
|
|
133
|
+
};
|
|
134
|
+
} else if (kind === 3) {
|
|
135
|
+
desc = {
|
|
136
|
+
get: decInfo[3]
|
|
137
|
+
};
|
|
138
|
+
} else if (kind === 4) {
|
|
139
|
+
desc = {
|
|
140
|
+
set: decInfo[3]
|
|
141
|
+
};
|
|
142
|
+
} else {
|
|
143
|
+
desc = {
|
|
144
|
+
value: decInfo[3]
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
} else if (kind !== 0) {
|
|
148
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
149
|
+
}
|
|
150
|
+
if (kind === 1) {
|
|
151
|
+
value = {
|
|
152
|
+
get: desc.get,
|
|
153
|
+
set: desc.set
|
|
154
|
+
};
|
|
155
|
+
} else if (kind === 2) {
|
|
156
|
+
value = desc.value;
|
|
157
|
+
} else if (kind === 3) {
|
|
158
|
+
value = desc.get;
|
|
159
|
+
} else if (kind === 4) {
|
|
160
|
+
value = desc.set;
|
|
161
|
+
}
|
|
162
|
+
var newValue, get, set;
|
|
163
|
+
if (typeof decs === "function") {
|
|
164
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
165
|
+
if (newValue !== void 0) {
|
|
166
|
+
assertValidReturnValue(kind, newValue);
|
|
167
|
+
if (kind === 0) {
|
|
168
|
+
init = newValue;
|
|
169
|
+
} else if (kind === 1) {
|
|
170
|
+
init = newValue.init;
|
|
171
|
+
get = newValue.get || value.get;
|
|
172
|
+
set = newValue.set || value.set;
|
|
173
|
+
value = {
|
|
174
|
+
get: get,
|
|
175
|
+
set: set
|
|
176
|
+
};
|
|
177
|
+
} else {
|
|
178
|
+
value = newValue;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
for(var i = decs.length - 1; i >= 0; i--){
|
|
183
|
+
var dec = decs[i];
|
|
184
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
185
|
+
if (newValue !== void 0) {
|
|
186
|
+
assertValidReturnValue(kind, newValue);
|
|
187
|
+
var newInit;
|
|
188
|
+
if (kind === 0) {
|
|
189
|
+
newInit = newValue;
|
|
190
|
+
} else if (kind === 1) {
|
|
191
|
+
newInit = newValue.init;
|
|
192
|
+
get = newValue.get || value.get;
|
|
193
|
+
set = newValue.set || value.set;
|
|
194
|
+
value = {
|
|
195
|
+
get: get,
|
|
196
|
+
set: set
|
|
197
|
+
};
|
|
198
|
+
} else {
|
|
199
|
+
value = newValue;
|
|
200
|
+
}
|
|
201
|
+
if (newInit !== void 0) {
|
|
202
|
+
if (init === void 0) {
|
|
203
|
+
init = newInit;
|
|
204
|
+
} else if (typeof init === "function") {
|
|
205
|
+
init = [
|
|
206
|
+
init,
|
|
207
|
+
newInit
|
|
208
|
+
];
|
|
209
|
+
} else {
|
|
210
|
+
init.push(newInit);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (kind === 0 || kind === 1) {
|
|
217
|
+
if (init === void 0) {
|
|
218
|
+
init = function(instance, init) {
|
|
219
|
+
return init;
|
|
220
|
+
};
|
|
221
|
+
} else if (typeof init !== "function") {
|
|
222
|
+
var ownInitializers = init;
|
|
223
|
+
init = function(instance, init) {
|
|
224
|
+
var value = init;
|
|
225
|
+
for(var i = 0; i < ownInitializers.length; i++){
|
|
226
|
+
value = ownInitializers[i].call(instance, value);
|
|
227
|
+
}
|
|
228
|
+
return value;
|
|
229
|
+
};
|
|
230
|
+
} else {
|
|
231
|
+
var originalInitializer = init;
|
|
232
|
+
init = function(instance, init) {
|
|
233
|
+
return originalInitializer.call(instance, init);
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
ret.push(init);
|
|
237
|
+
}
|
|
238
|
+
if (kind !== 0) {
|
|
239
|
+
if (kind === 1) {
|
|
240
|
+
desc.get = value.get;
|
|
241
|
+
desc.set = value.set;
|
|
242
|
+
} else if (kind === 2) {
|
|
243
|
+
desc.value = value;
|
|
244
|
+
} else if (kind === 3) {
|
|
245
|
+
desc.get = value;
|
|
246
|
+
} else if (kind === 4) {
|
|
247
|
+
desc.set = value;
|
|
248
|
+
}
|
|
249
|
+
if (isPrivate) {
|
|
250
|
+
if (kind === 1) {
|
|
251
|
+
ret.push(function(instance, args) {
|
|
252
|
+
return value.get.call(instance, args);
|
|
253
|
+
});
|
|
254
|
+
ret.push(function(instance, args) {
|
|
255
|
+
return value.set.call(instance, args);
|
|
256
|
+
});
|
|
257
|
+
} else if (kind === 2) {
|
|
258
|
+
ret.push(value);
|
|
259
|
+
} else {
|
|
260
|
+
ret.push(function(instance, args) {
|
|
261
|
+
return value.call(instance, args);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
Object.defineProperty(base, name, desc);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function applyMemberDecs(Class, decInfos, metadata) {
|
|
270
|
+
var ret = [];
|
|
271
|
+
var protoInitializers;
|
|
272
|
+
var staticInitializers;
|
|
273
|
+
var existingProtoNonFields = new Map();
|
|
274
|
+
var existingStaticNonFields = new Map();
|
|
275
|
+
for(var i = 0; i < decInfos.length; i++){
|
|
276
|
+
var decInfo = decInfos[i];
|
|
277
|
+
if (!Array.isArray(decInfo)) continue;
|
|
278
|
+
var kind = decInfo[1];
|
|
279
|
+
var name = decInfo[2];
|
|
280
|
+
var isPrivate = decInfo.length > 3;
|
|
281
|
+
var isStatic = kind >= 5;
|
|
282
|
+
var base;
|
|
283
|
+
var initializers;
|
|
284
|
+
if (isStatic) {
|
|
285
|
+
base = Class;
|
|
286
|
+
kind = kind - 5;
|
|
287
|
+
staticInitializers = staticInitializers || [];
|
|
288
|
+
initializers = staticInitializers;
|
|
289
|
+
} else {
|
|
290
|
+
base = Class.prototype;
|
|
291
|
+
protoInitializers = protoInitializers || [];
|
|
292
|
+
initializers = protoInitializers;
|
|
293
|
+
}
|
|
294
|
+
if (kind !== 0 && !isPrivate) {
|
|
295
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
296
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
297
|
+
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
|
|
298
|
+
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
299
|
+
} else if (!existingKind && kind > 2) {
|
|
300
|
+
existingNonFields.set(name, kind);
|
|
301
|
+
} else {
|
|
302
|
+
existingNonFields.set(name, true);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
306
|
+
}
|
|
307
|
+
pushInitializers(ret, protoInitializers);
|
|
308
|
+
pushInitializers(ret, staticInitializers);
|
|
309
|
+
return ret;
|
|
310
|
+
}
|
|
311
|
+
function pushInitializers(ret, initializers) {
|
|
312
|
+
if (initializers) {
|
|
313
|
+
ret.push(function(instance) {
|
|
314
|
+
for(var i = 0; i < initializers.length; i++){
|
|
315
|
+
initializers[i].call(instance);
|
|
316
|
+
}
|
|
317
|
+
return instance;
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
322
|
+
if (classDecs.length > 0) {
|
|
323
|
+
var initializers = [];
|
|
324
|
+
var newClass = targetClass;
|
|
325
|
+
var name = targetClass.name;
|
|
326
|
+
for(var i = classDecs.length - 1; i >= 0; i--){
|
|
327
|
+
var decoratorFinishedRef = {
|
|
328
|
+
v: false
|
|
329
|
+
};
|
|
330
|
+
try {
|
|
331
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
332
|
+
kind: "class",
|
|
333
|
+
name: name,
|
|
334
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
335
|
+
metadata
|
|
336
|
+
});
|
|
337
|
+
} finally{
|
|
338
|
+
decoratorFinishedRef.v = true;
|
|
339
|
+
}
|
|
340
|
+
if (nextNewClass !== undefined) {
|
|
341
|
+
assertValidReturnValue(10, nextNewClass);
|
|
342
|
+
newClass = nextNewClass;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return [
|
|
346
|
+
defineMetadata(newClass, metadata),
|
|
347
|
+
function() {
|
|
348
|
+
for(var i = 0; i < initializers.length; i++){
|
|
349
|
+
initializers[i].call(newClass);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
];
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function defineMetadata(Class, metadata) {
|
|
356
|
+
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
357
|
+
configurable: true,
|
|
358
|
+
enumerable: true,
|
|
359
|
+
value: metadata
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
363
|
+
if (parentClass !== void 0) {
|
|
364
|
+
var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
365
|
+
}
|
|
366
|
+
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
367
|
+
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
368
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
369
|
+
return {
|
|
370
|
+
e: e,
|
|
371
|
+
get c () {
|
|
372
|
+
return applyClassDecs(targetClass, classDecs, metadata);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
378
|
+
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
379
|
+
}
|
|
380
|
+
function _identity(x) {
|
|
381
|
+
return x;
|
|
382
|
+
}
|
|
383
|
+
var _dec, _initClass, _ViElement, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _init_content, _init_placement, _init_trigger, _init_delay, _init_hideDelay, _init_maxWidth, _init_disabled, /**
|
|
384
|
+
* Custom options passed directly to Floating UI's computePosition.
|
|
385
|
+
* Note: the `popper-options` attribute only supports JSON-serializable values;
|
|
386
|
+
* middleware functions must be set via the `popperOptions` property.
|
|
387
|
+
*/ _init_popperOptions, _init__open, _init__isInteractive, _init__tooltipPanel, _init__defaultSlot, _init__contentSlot, _initProto;
|
|
388
|
+
let _ViTooltip;
|
|
389
|
+
_dec = customElement('vi-tooltip'), _dec1 = property({
|
|
390
|
+
type: String
|
|
391
|
+
}), _dec2 = property({
|
|
392
|
+
type: String,
|
|
393
|
+
reflect: true
|
|
394
|
+
}), _dec3 = property({
|
|
395
|
+
type: String
|
|
396
|
+
}), _dec4 = property({
|
|
397
|
+
type: Number
|
|
398
|
+
}), _dec5 = property({
|
|
399
|
+
type: Number,
|
|
400
|
+
attribute: 'hide-delay'
|
|
401
|
+
}), _dec6 = property({
|
|
402
|
+
type: Number,
|
|
403
|
+
attribute: 'max-width'
|
|
404
|
+
}), _dec7 = property({
|
|
405
|
+
type: Boolean,
|
|
406
|
+
reflect: true
|
|
407
|
+
}), _dec8 = property({
|
|
408
|
+
type: Object,
|
|
409
|
+
attribute: 'popper-options',
|
|
410
|
+
converter: {
|
|
411
|
+
fromAttribute: (value)=>{
|
|
412
|
+
if (value == null || value === '') return {};
|
|
413
|
+
try {
|
|
414
|
+
return JSON.parse(value);
|
|
415
|
+
} catch {
|
|
416
|
+
return {};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}), _dec9 = state(), _dec10 = state(), _dec11 = query('.tooltip-panel'), _dec12 = query('slot:not([name])'), _dec13 = query('slot[name="content"]');
|
|
421
|
+
new class extends _identity {
|
|
422
|
+
constructor(){
|
|
423
|
+
super(_ViTooltip), _initClass();
|
|
424
|
+
}
|
|
425
|
+
static{
|
|
426
|
+
class ViTooltip extends (_ViElement = ViElement) {
|
|
427
|
+
static{
|
|
428
|
+
({ e: [_init_content, _init_placement, _init_trigger, _init_delay, _init_hideDelay, _init_maxWidth, _init_disabled, _init_popperOptions, _init__open, _init__isInteractive, _init__tooltipPanel, _init__defaultSlot, _init__contentSlot, _initProto], c: [_ViTooltip, _initClass] } = _apply_decs_2203_r(this, [
|
|
429
|
+
[
|
|
430
|
+
_dec1,
|
|
431
|
+
1,
|
|
432
|
+
"content"
|
|
433
|
+
],
|
|
434
|
+
[
|
|
435
|
+
_dec2,
|
|
436
|
+
1,
|
|
437
|
+
"placement"
|
|
438
|
+
],
|
|
439
|
+
[
|
|
440
|
+
_dec3,
|
|
441
|
+
1,
|
|
442
|
+
"trigger"
|
|
443
|
+
],
|
|
444
|
+
[
|
|
445
|
+
_dec4,
|
|
446
|
+
1,
|
|
447
|
+
"delay"
|
|
448
|
+
],
|
|
449
|
+
[
|
|
450
|
+
_dec5,
|
|
451
|
+
1,
|
|
452
|
+
"hideDelay"
|
|
453
|
+
],
|
|
454
|
+
[
|
|
455
|
+
_dec6,
|
|
456
|
+
1,
|
|
457
|
+
"maxWidth"
|
|
458
|
+
],
|
|
459
|
+
[
|
|
460
|
+
_dec7,
|
|
461
|
+
1,
|
|
462
|
+
"disabled"
|
|
463
|
+
],
|
|
464
|
+
[
|
|
465
|
+
_dec8,
|
|
466
|
+
1,
|
|
467
|
+
"popperOptions"
|
|
468
|
+
],
|
|
469
|
+
[
|
|
470
|
+
_dec9,
|
|
471
|
+
1,
|
|
472
|
+
"_open"
|
|
473
|
+
],
|
|
474
|
+
[
|
|
475
|
+
_dec10,
|
|
476
|
+
1,
|
|
477
|
+
"_isInteractive"
|
|
478
|
+
],
|
|
479
|
+
[
|
|
480
|
+
_dec11,
|
|
481
|
+
1,
|
|
482
|
+
"_tooltipPanel"
|
|
483
|
+
],
|
|
484
|
+
[
|
|
485
|
+
_dec12,
|
|
486
|
+
1,
|
|
487
|
+
"_defaultSlot"
|
|
488
|
+
],
|
|
489
|
+
[
|
|
490
|
+
_dec13,
|
|
491
|
+
1,
|
|
492
|
+
"_contentSlot"
|
|
493
|
+
]
|
|
494
|
+
], [
|
|
495
|
+
_dec
|
|
496
|
+
], _ViElement));
|
|
497
|
+
}
|
|
498
|
+
static styles = css`${unsafeCSS(tooltipStyles)}`;
|
|
499
|
+
#___private_content_1 = (_initProto(this), _init_content(this, ''));
|
|
500
|
+
get content() {
|
|
501
|
+
return this.#___private_content_1;
|
|
502
|
+
}
|
|
503
|
+
set content(_v) {
|
|
504
|
+
this.#___private_content_1 = _v;
|
|
505
|
+
}
|
|
506
|
+
#___private_placement_2 = _init_placement(this, 'top');
|
|
507
|
+
get placement() {
|
|
508
|
+
return this.#___private_placement_2;
|
|
509
|
+
}
|
|
510
|
+
set placement(_v) {
|
|
511
|
+
this.#___private_placement_2 = _v;
|
|
512
|
+
}
|
|
513
|
+
#___private_trigger_3 = _init_trigger(this, 'hover focus');
|
|
514
|
+
get trigger() {
|
|
515
|
+
return this.#___private_trigger_3;
|
|
516
|
+
}
|
|
517
|
+
set trigger(_v) {
|
|
518
|
+
this.#___private_trigger_3 = _v;
|
|
519
|
+
}
|
|
520
|
+
#___private_delay_4 = _init_delay(this, 500);
|
|
521
|
+
get delay() {
|
|
522
|
+
return this.#___private_delay_4;
|
|
523
|
+
}
|
|
524
|
+
set delay(_v) {
|
|
525
|
+
this.#___private_delay_4 = _v;
|
|
526
|
+
}
|
|
527
|
+
#___private_hideDelay_5 = _init_hideDelay(this, 100);
|
|
528
|
+
get hideDelay() {
|
|
529
|
+
return this.#___private_hideDelay_5;
|
|
530
|
+
}
|
|
531
|
+
set hideDelay(_v) {
|
|
532
|
+
this.#___private_hideDelay_5 = _v;
|
|
533
|
+
}
|
|
534
|
+
#___private_maxWidth_6 = _init_maxWidth(this, 240);
|
|
535
|
+
get maxWidth() {
|
|
536
|
+
return this.#___private_maxWidth_6;
|
|
537
|
+
}
|
|
538
|
+
set maxWidth(_v) {
|
|
539
|
+
this.#___private_maxWidth_6 = _v;
|
|
540
|
+
}
|
|
541
|
+
#___private_disabled_7 = _init_disabled(this, false);
|
|
542
|
+
get disabled() {
|
|
543
|
+
return this.#___private_disabled_7;
|
|
544
|
+
}
|
|
545
|
+
set disabled(_v) {
|
|
546
|
+
this.#___private_disabled_7 = _v;
|
|
547
|
+
}
|
|
548
|
+
#___private_popperOptions_8 = _init_popperOptions(this, {});
|
|
549
|
+
get popperOptions() {
|
|
550
|
+
return this.#___private_popperOptions_8;
|
|
551
|
+
}
|
|
552
|
+
set popperOptions(_v) {
|
|
553
|
+
this.#___private_popperOptions_8 = _v;
|
|
554
|
+
}
|
|
555
|
+
#___private__open_9 = _init__open(this, false);
|
|
556
|
+
get _open() {
|
|
557
|
+
return this.#___private__open_9;
|
|
558
|
+
}
|
|
559
|
+
set _open(_v) {
|
|
560
|
+
this.#___private__open_9 = _v;
|
|
561
|
+
}
|
|
562
|
+
#___private__isInteractive_10 = _init__isInteractive(this, false);
|
|
563
|
+
get _isInteractive() {
|
|
564
|
+
return this.#___private__isInteractive_10;
|
|
565
|
+
}
|
|
566
|
+
set _isInteractive(_v) {
|
|
567
|
+
this.#___private__isInteractive_10 = _v;
|
|
568
|
+
}
|
|
569
|
+
#___private__tooltipPanel_11 = _init__tooltipPanel(this);
|
|
570
|
+
get _tooltipPanel() {
|
|
571
|
+
return this.#___private__tooltipPanel_11;
|
|
572
|
+
}
|
|
573
|
+
set _tooltipPanel(_v) {
|
|
574
|
+
this.#___private__tooltipPanel_11 = _v;
|
|
575
|
+
}
|
|
576
|
+
#___private__defaultSlot_12 = _init__defaultSlot(this);
|
|
577
|
+
get _defaultSlot() {
|
|
578
|
+
return this.#___private__defaultSlot_12;
|
|
579
|
+
}
|
|
580
|
+
set _defaultSlot(_v) {
|
|
581
|
+
this.#___private__defaultSlot_12 = _v;
|
|
582
|
+
}
|
|
583
|
+
#___private__contentSlot_13 = _init__contentSlot(this);
|
|
584
|
+
get _contentSlot() {
|
|
585
|
+
return this.#___private__contentSlot_13;
|
|
586
|
+
}
|
|
587
|
+
set _contentSlot(_v) {
|
|
588
|
+
this.#___private__contentSlot_13 = _v;
|
|
589
|
+
}
|
|
590
|
+
_showTimeout;
|
|
591
|
+
_hideTimeout;
|
|
592
|
+
_triggerElement = null;
|
|
593
|
+
_cleanupAutoUpdate;
|
|
594
|
+
_panelId = `vi-tooltip-panel-${Math.random().toString(36).substring(2, 9)}`;
|
|
595
|
+
constructor(){
|
|
596
|
+
super();
|
|
597
|
+
this._handleDocumentClick = this._handleDocumentClick.bind(this);
|
|
598
|
+
}
|
|
599
|
+
connectedCallback() {
|
|
600
|
+
super.connectedCallback();
|
|
601
|
+
}
|
|
602
|
+
disconnectedCallback() {
|
|
603
|
+
this._clearTimeouts();
|
|
604
|
+
document.removeEventListener('pointerdown', this._handleDocumentClick);
|
|
605
|
+
if (this._cleanupAutoUpdate) {
|
|
606
|
+
this._cleanupAutoUpdate();
|
|
607
|
+
this._cleanupAutoUpdate = undefined;
|
|
608
|
+
}
|
|
609
|
+
this._removeTriggerAria();
|
|
610
|
+
super.disconnectedCallback();
|
|
611
|
+
}
|
|
612
|
+
firstUpdated() {
|
|
613
|
+
this._updateTriggerElement();
|
|
614
|
+
}
|
|
615
|
+
updated(changed) {
|
|
616
|
+
super.updated(changed);
|
|
617
|
+
if (changed.has('disabled') && this.disabled && this._open) {
|
|
618
|
+
this._closeTooltip();
|
|
619
|
+
}
|
|
620
|
+
if (changed.has('maxWidth') && this._tooltipPanel) {
|
|
621
|
+
this._tooltipPanel.style.setProperty('--vi-tooltip-max-width', `${this.maxWidth}px`);
|
|
622
|
+
}
|
|
623
|
+
if ((changed.has('placement') || changed.has('popperOptions')) && this._open) {
|
|
624
|
+
this._positionTooltip();
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
/** Force show the tooltip */ show() {
|
|
628
|
+
if (this.disabled) return;
|
|
629
|
+
window.clearTimeout(this._hideTimeout);
|
|
630
|
+
if (this._open) return;
|
|
631
|
+
if (this.delay > 0) {
|
|
632
|
+
window.clearTimeout(this._showTimeout);
|
|
633
|
+
this._showTimeout = window.setTimeout(()=>{
|
|
634
|
+
this._openTooltip();
|
|
635
|
+
}, this.delay);
|
|
636
|
+
} else {
|
|
637
|
+
this._openTooltip();
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/** Force hide the tooltip */ hide(immediate = false) {
|
|
641
|
+
window.clearTimeout(this._showTimeout);
|
|
642
|
+
window.clearTimeout(this._hideTimeout);
|
|
643
|
+
if (!this._open) return;
|
|
644
|
+
if (this.hideDelay > 0 && !immediate) {
|
|
645
|
+
this._hideTimeout = window.setTimeout(()=>{
|
|
646
|
+
this._closeTooltip();
|
|
647
|
+
}, this.hideDelay);
|
|
648
|
+
} else {
|
|
649
|
+
this._closeTooltip();
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
_openTooltip() {
|
|
653
|
+
this._open = true;
|
|
654
|
+
const panel = this._tooltipPanel;
|
|
655
|
+
const trigger = this._triggerElement || this.shadowRoot?.querySelector('.trigger-wrapper');
|
|
656
|
+
if (panel && trigger) {
|
|
657
|
+
try {
|
|
658
|
+
if (!panel.matches(':popover-open')) {
|
|
659
|
+
panel.showPopover();
|
|
660
|
+
}
|
|
661
|
+
} catch {
|
|
662
|
+
panel.style.display = 'block';
|
|
663
|
+
}
|
|
664
|
+
this._positionTooltip();
|
|
665
|
+
// Start autoUpdate monitoring for bounds changes
|
|
666
|
+
this._cleanupAutoUpdate = autoUpdate(trigger, panel, ()=>{
|
|
667
|
+
this._positionTooltip();
|
|
668
|
+
});
|
|
669
|
+
if (this.trigger.includes('click')) {
|
|
670
|
+
document.addEventListener('pointerdown', this._handleDocumentClick);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
this.dispatchEvent(new CustomEvent('vialiq-show', {
|
|
674
|
+
bubbles: true,
|
|
675
|
+
composed: true
|
|
676
|
+
}));
|
|
677
|
+
}
|
|
678
|
+
_closeTooltip() {
|
|
679
|
+
this._open = false;
|
|
680
|
+
const panel = this._tooltipPanel;
|
|
681
|
+
if (panel) {
|
|
682
|
+
try {
|
|
683
|
+
if (panel.matches(':popover-open')) {
|
|
684
|
+
panel.hidePopover();
|
|
685
|
+
}
|
|
686
|
+
} catch {
|
|
687
|
+
panel.style.display = 'none';
|
|
688
|
+
}
|
|
689
|
+
if (this._cleanupAutoUpdate) {
|
|
690
|
+
this._cleanupAutoUpdate();
|
|
691
|
+
this._cleanupAutoUpdate = undefined;
|
|
692
|
+
}
|
|
693
|
+
document.removeEventListener('pointerdown', this._handleDocumentClick);
|
|
694
|
+
}
|
|
695
|
+
this.dispatchEvent(new CustomEvent('vialiq-hide', {
|
|
696
|
+
bubbles: true,
|
|
697
|
+
composed: true
|
|
698
|
+
}));
|
|
699
|
+
}
|
|
700
|
+
_clearTimeouts() {
|
|
701
|
+
window.clearTimeout(this._showTimeout);
|
|
702
|
+
window.clearTimeout(this._hideTimeout);
|
|
703
|
+
}
|
|
704
|
+
_handleSlotChange() {
|
|
705
|
+
this._removeTriggerAria();
|
|
706
|
+
this._updateTriggerElement();
|
|
707
|
+
}
|
|
708
|
+
_updateTriggerElement() {
|
|
709
|
+
if (!this._defaultSlot) return;
|
|
710
|
+
const assigned = this._defaultSlot.assignedElements({
|
|
711
|
+
flatten: true
|
|
712
|
+
});
|
|
713
|
+
const newTrigger = assigned[0] || null;
|
|
714
|
+
if (newTrigger !== this._triggerElement) {
|
|
715
|
+
this._triggerElement = newTrigger;
|
|
716
|
+
}
|
|
717
|
+
this._updateTriggerAria();
|
|
718
|
+
}
|
|
719
|
+
_hasInteractiveContent() {
|
|
720
|
+
if (!this._contentSlot) return false;
|
|
721
|
+
const assigned = this._contentSlot.assignedElements({
|
|
722
|
+
flatten: true
|
|
723
|
+
});
|
|
724
|
+
if (assigned.length === 0) return false;
|
|
725
|
+
const focusableSelectors = [
|
|
726
|
+
'a[href]',
|
|
727
|
+
'button:not([disabled])',
|
|
728
|
+
'input:not([disabled])',
|
|
729
|
+
'select:not([disabled])',
|
|
730
|
+
'textarea:not([disabled])',
|
|
731
|
+
'vi-button:not([disabled])',
|
|
732
|
+
'vi-link',
|
|
733
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
734
|
+
];
|
|
735
|
+
const hasFocusable = (el)=>{
|
|
736
|
+
if (focusableSelectors.some((selector)=>el.matches(selector))) return true;
|
|
737
|
+
return Array.from(el.children).some((child)=>hasFocusable(child));
|
|
738
|
+
};
|
|
739
|
+
return assigned.some((el)=>hasFocusable(el));
|
|
740
|
+
}
|
|
741
|
+
_updateTriggerAria() {
|
|
742
|
+
const trigger = this._triggerElement;
|
|
743
|
+
const isInteractive = this._hasInteractiveContent();
|
|
744
|
+
this._isInteractive = isInteractive;
|
|
745
|
+
if (!trigger) return;
|
|
746
|
+
if (isInteractive) {
|
|
747
|
+
trigger.setAttribute('aria-details', this._panelId);
|
|
748
|
+
trigger.removeAttribute('aria-describedby');
|
|
749
|
+
} else {
|
|
750
|
+
trigger.setAttribute('aria-describedby', this._panelId);
|
|
751
|
+
trigger.removeAttribute('aria-details');
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
_removeTriggerAria() {
|
|
755
|
+
const trigger = this._triggerElement;
|
|
756
|
+
if (trigger) {
|
|
757
|
+
trigger.removeAttribute('aria-describedby');
|
|
758
|
+
trigger.removeAttribute('aria-details');
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
// ----------------------------------------------------------------------------
|
|
762
|
+
// Pointer/Focus Events
|
|
763
|
+
// ----------------------------------------------------------------------------
|
|
764
|
+
_onPointerEnter = ()=>{
|
|
765
|
+
if (this.trigger.includes('hover')) {
|
|
766
|
+
this.show();
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
_onPointerLeave = ()=>{
|
|
770
|
+
if (this.trigger.includes('hover')) {
|
|
771
|
+
this.hide();
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
_onFocusIn = ()=>{
|
|
775
|
+
if (this.trigger.includes('focus')) {
|
|
776
|
+
this.show();
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
_onFocusOut = ()=>{
|
|
780
|
+
if (this.trigger.includes('focus')) {
|
|
781
|
+
this.hide();
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
_onClick = ()=>{
|
|
785
|
+
if (this.trigger.includes('click')) {
|
|
786
|
+
if (this._open) {
|
|
787
|
+
this.hide(true);
|
|
788
|
+
} else {
|
|
789
|
+
this.show();
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
_onKeyDown(event) {
|
|
794
|
+
if (event.key === 'Escape') {
|
|
795
|
+
event.stopPropagation();
|
|
796
|
+
this.hide(true);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
_handleDocumentClick(event) {
|
|
800
|
+
const target = event.target;
|
|
801
|
+
const panel = this._tooltipPanel;
|
|
802
|
+
if (this._open && panel && !panel.contains(target) && !this.contains(target)) {
|
|
803
|
+
this.hide(true);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
// ----------------------------------------------------------------------------
|
|
807
|
+
// Positioning Math using Floating UI
|
|
808
|
+
// ----------------------------------------------------------------------------
|
|
809
|
+
_positionTooltip() {
|
|
810
|
+
const panel = this._tooltipPanel;
|
|
811
|
+
if (!panel) return;
|
|
812
|
+
panel.style.setProperty('--vi-tooltip-max-width', `${this.maxWidth}px`);
|
|
813
|
+
const trigger = this._triggerElement || this.shadowRoot?.querySelector('.trigger-wrapper');
|
|
814
|
+
if (!trigger) return;
|
|
815
|
+
const arrowEl = panel.querySelector('.tooltip-arrow');
|
|
816
|
+
// Build default middleware list
|
|
817
|
+
const defaultMiddleware = [
|
|
818
|
+
offset(10),
|
|
819
|
+
flip(),
|
|
820
|
+
shift({
|
|
821
|
+
padding: 8
|
|
822
|
+
}),
|
|
823
|
+
arrowEl ? arrow({
|
|
824
|
+
element: arrowEl
|
|
825
|
+
}) : null
|
|
826
|
+
].filter(Boolean);
|
|
827
|
+
// Merge consumer popperOptions, allowing overrides for middleware, strategy, etc.
|
|
828
|
+
// (but keep `placement` controlled by the `placement` prop to avoid two sources of truth)
|
|
829
|
+
const { placement: _ignoredPlacement, ...popperOptions } = this.popperOptions ?? {};
|
|
830
|
+
const config = {
|
|
831
|
+
placement: this.placement,
|
|
832
|
+
strategy: popperOptions.strategy ?? 'absolute',
|
|
833
|
+
middleware: popperOptions.middleware ?? defaultMiddleware,
|
|
834
|
+
...popperOptions
|
|
835
|
+
};
|
|
836
|
+
computePosition(trigger, panel, config).then(({ x, y, placement, strategy, middlewareData })=>{
|
|
837
|
+
Object.assign(panel.style, {
|
|
838
|
+
position: strategy,
|
|
839
|
+
left: `${x}px`,
|
|
840
|
+
top: `${y}px`
|
|
841
|
+
});
|
|
842
|
+
// Update data-placement attribute to trigger arrow CSS styles
|
|
843
|
+
panel.setAttribute('data-placement', placement);
|
|
844
|
+
// Position the arrow if arrow middleware data exists
|
|
845
|
+
if (arrowEl && middlewareData.arrow) {
|
|
846
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
847
|
+
// Find which side the arrow is on depending on placement
|
|
848
|
+
const side = placement.split('-')[0];
|
|
849
|
+
const staticSide = {
|
|
850
|
+
top: 'bottom',
|
|
851
|
+
right: 'left',
|
|
852
|
+
bottom: 'top',
|
|
853
|
+
left: 'right'
|
|
854
|
+
}[side];
|
|
855
|
+
if (staticSide) {
|
|
856
|
+
Object.assign(arrowEl.style, {
|
|
857
|
+
left: arrowX != null ? `${arrowX}px` : '',
|
|
858
|
+
top: arrowY != null ? `${arrowY}px` : '',
|
|
859
|
+
right: '',
|
|
860
|
+
bottom: '',
|
|
861
|
+
[staticSide]: `${-arrowEl.offsetWidth / 2 || -6}px`
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
render() {
|
|
868
|
+
const { _panelId, content, placement, _onPointerEnter, _onPointerLeave, _onFocusIn, _onFocusOut, _onClick, _onKeyDown } = this;
|
|
869
|
+
return html`
|
|
870
|
+
<span
|
|
871
|
+
class="trigger-wrapper"
|
|
872
|
+
@pointerenter=${_onPointerEnter}
|
|
873
|
+
@pointerleave=${_onPointerLeave}
|
|
874
|
+
@focusin=${_onFocusIn}
|
|
875
|
+
@focusout=${_onFocusOut}
|
|
876
|
+
@click=${_onClick}
|
|
877
|
+
@keydown=${_onKeyDown}
|
|
878
|
+
>
|
|
879
|
+
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
880
|
+
</span>
|
|
881
|
+
|
|
882
|
+
<div
|
|
883
|
+
popover="manual"
|
|
884
|
+
id=${_panelId}
|
|
885
|
+
class="tooltip-panel"
|
|
886
|
+
part="tooltip"
|
|
887
|
+
role=${this._isInteractive ? 'dialog' : 'tooltip'}
|
|
888
|
+
aria-modal=${this._isInteractive ? 'false' : nothing}
|
|
889
|
+
aria-label=${this._isInteractive ? content || 'Tooltip' : nothing}
|
|
890
|
+
placement=${placement}
|
|
891
|
+
@pointerenter=${_onPointerEnter}
|
|
892
|
+
@pointerleave=${_onPointerLeave}
|
|
893
|
+
@focusin=${_onFocusIn}
|
|
894
|
+
@focusout=${_onFocusOut}
|
|
895
|
+
@keydown=${_onKeyDown}
|
|
896
|
+
>
|
|
897
|
+
<div class="tooltip-content" part="content">
|
|
898
|
+
<slot name="content" @slotchange=${this._updateTriggerAria}>${content}</slot>
|
|
899
|
+
<div class="tooltip-arrow" part="arrow"></div>
|
|
900
|
+
</div>
|
|
901
|
+
</div>
|
|
902
|
+
`;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}();
|
|
907
|
+
|
|
908
|
+
export { _ViTooltip as ViTooltip };
|