@voidable/ui 0.5.2 → 0.5.4
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/base.d.ts +5 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +9 -0
- package/dist/chunks/decorate-DKuCkHK4.js +9 -0
- package/dist/components/accordion.d.ts +25 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +73 -0
- package/dist/components/action-input.d.ts +28 -0
- package/dist/components/action-input.d.ts.map +1 -0
- package/dist/components/action-input.js +117 -0
- package/dist/components/alert.d.ts +20 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +40 -0
- package/dist/components/avatar.d.ts +18 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +36 -0
- package/dist/components/badge.d.ts +14 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +24 -0
- package/dist/components/banner.d.ts +20 -0
- package/dist/components/banner.d.ts.map +1 -0
- package/dist/components/banner.js +40 -0
- package/dist/components/breadcrumbs.d.ts +16 -0
- package/dist/components/breadcrumbs.d.ts.map +1 -0
- package/dist/components/breadcrumbs.js +33 -0
- package/dist/components/button.d.ts +25 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +56 -0
- package/dist/components/calendar.d.ts +75 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +417 -0
- package/dist/components/card.d.ts +18 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +32 -0
- package/dist/components/carousel.d.ts +41 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +145 -0
- package/dist/components/checkbox-group.d.ts +20 -0
- package/dist/components/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox-group.js +48 -0
- package/dist/components/checkbox.d.ts +25 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +69 -0
- package/dist/components/collapsible.d.ts +21 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +61 -0
- package/dist/components/color-picker.d.ts +47 -0
- package/dist/components/color-picker.d.ts.map +1 -0
- package/dist/components/color-picker.js +217 -0
- package/dist/components/combobox.d.ts +30 -0
- package/dist/components/combobox.d.ts.map +1 -0
- package/dist/components/combobox.js +89 -0
- package/dist/components/compose-input.d.ts +19 -0
- package/dist/components/compose-input.d.ts.map +1 -0
- package/dist/components/compose-input.js +71 -0
- package/dist/components/dialog.d.ts +26 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +64 -0
- package/dist/components/divider.d.ts +16 -0
- package/dist/components/divider.d.ts.map +1 -0
- package/dist/components/divider.js +28 -0
- package/dist/components/drawer.d.ts +26 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +62 -0
- package/dist/components/dropdown-menu.d.ts +29 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +72 -0
- package/dist/components/editable.d.ts +27 -0
- package/dist/components/editable.d.ts.map +1 -0
- package/dist/components/editable.js +82 -0
- package/dist/components/error-fallback.d.ts +18 -0
- package/dist/components/error-fallback.d.ts.map +1 -0
- package/dist/components/error-fallback.js +35 -0
- package/dist/components/field.d.ts +19 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +42 -0
- package/dist/components/file-upload.d.ts +26 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +99 -0
- package/dist/components/hamburger.d.ts +18 -0
- package/dist/components/hamburger.d.ts.map +1 -0
- package/dist/components/hamburger.js +45 -0
- package/dist/components/hover-card.d.ts +31 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +80 -0
- package/dist/components/indicator.d.ts +20 -0
- package/dist/components/indicator.d.ts.map +1 -0
- package/dist/components/indicator.js +39 -0
- package/dist/components/input.d.ts +23 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +73 -0
- package/dist/components/list.d.ts +22 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/list.js +45 -0
- package/dist/components/menu.d.ts +50 -0
- package/dist/components/menu.d.ts.map +1 -0
- package/dist/components/menu.js +162 -0
- package/dist/components/multiselect.d.ts +35 -0
- package/dist/components/multiselect.d.ts.map +1 -0
- package/dist/components/multiselect.js +118 -0
- package/dist/components/nav-bar.d.ts +18 -0
- package/dist/components/nav-bar.d.ts.map +1 -0
- package/dist/components/nav-bar.js +35 -0
- package/dist/components/nav-menu.d.ts +42 -0
- package/dist/components/nav-menu.d.ts.map +1 -0
- package/dist/components/nav-menu.js +122 -0
- package/dist/components/number-input.d.ts +41 -0
- package/dist/components/number-input.d.ts.map +1 -0
- package/dist/components/number-input.js +143 -0
- package/dist/components/pagination.d.ts +17 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +62 -0
- package/dist/components/panel.d.ts +18 -0
- package/dist/components/panel.d.ts.map +1 -0
- package/dist/components/panel.js +31 -0
- package/dist/components/pin-input.d.ts +33 -0
- package/dist/components/pin-input.d.ts.map +1 -0
- package/dist/components/pin-input.js +132 -0
- package/dist/components/popover.d.ts +24 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +52 -0
- package/dist/components/progress.d.ts +18 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +38 -0
- package/dist/components/radio-group.d.ts +24 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +56 -0
- package/dist/components/radio.d.ts +24 -0
- package/dist/components/radio.d.ts.map +1 -0
- package/dist/components/radio.js +68 -0
- package/dist/components/scroll-area.d.ts +17 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +30 -0
- package/dist/components/segmented-control.d.ts +27 -0
- package/dist/components/segmented-control.d.ts.map +1 -0
- package/dist/components/segmented-control.js +70 -0
- package/dist/components/select.d.ts +23 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +64 -0
- package/dist/components/sidebar.d.ts +18 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +40 -0
- package/dist/components/skeleton.d.ts +12 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +18 -0
- package/dist/components/slider.d.ts +24 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +68 -0
- package/dist/components/spinner.d.ts +15 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +28 -0
- package/dist/components/stat.d.ts +18 -0
- package/dist/components/stat.d.ts.map +1 -0
- package/dist/components/stat.js +41 -0
- package/dist/components/status-dot.d.ts +14 -0
- package/dist/components/status-dot.d.ts.map +1 -0
- package/dist/components/status-dot.js +28 -0
- package/dist/components/stepper.d.ts +14 -0
- package/dist/components/stepper.d.ts.map +1 -0
- package/dist/components/stepper.js +45 -0
- package/dist/components/switch.d.ts +20 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +45 -0
- package/dist/components/table.d.ts +14 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +24 -0
- package/dist/components/tabs.d.ts +28 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +76 -0
- package/dist/components/tag.d.ts +20 -0
- package/dist/components/tag.d.ts.map +1 -0
- package/dist/components/tag.js +41 -0
- package/dist/components/tags-input.d.ts +34 -0
- package/dist/components/tags-input.d.ts.map +1 -0
- package/dist/components/tags-input.js +109 -0
- package/dist/components/textarea.d.ts +24 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +77 -0
- package/dist/components/toast.d.ts +36 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +55 -0
- package/dist/components/toggle-group.d.ts +24 -0
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +80 -0
- package/dist/components/toggle.d.ts +15 -0
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +44 -0
- package/dist/components/tooltip.d.ts +26 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +45 -0
- package/dist/index.d.ts +64 -1157
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -4078
- package/package.json +20 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { VoidElement as e } from "../base.js";
|
|
2
|
+
import { t } from "../chunks/decorate-DKuCkHK4.js";
|
|
3
|
+
import { property as n } from "lit/decorators.js";
|
|
4
|
+
//#region src/components/toggle-group.ts
|
|
5
|
+
var r = class extends e {
|
|
6
|
+
constructor(...e) {
|
|
7
|
+
super(...e), this.value = "", this.multiple = !1, this.disabled = !1, this.size = "md", this.color = "default", this.orientation = "horizontal", this._handleChildChange = (e) => {
|
|
8
|
+
let t = e.target.closest("void-toggle");
|
|
9
|
+
if (!t || t.closest("void-toggle-group") !== this) return;
|
|
10
|
+
e.stopImmediatePropagation();
|
|
11
|
+
let n = t.getAttribute("value") || "";
|
|
12
|
+
if (n) if (this.multiple) {
|
|
13
|
+
let e = this._selectedValues(), t = e.indexOf(n);
|
|
14
|
+
t >= 0 ? e.splice(t, 1) : e.push(n), this.value = e.join(","), this._syncToggles(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
15
|
+
bubbles: !0,
|
|
16
|
+
composed: !0,
|
|
17
|
+
detail: { value: e }
|
|
18
|
+
}));
|
|
19
|
+
} else {
|
|
20
|
+
let e = this.value === n ? "" : n;
|
|
21
|
+
this.value = e, this._syncToggles(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
22
|
+
bubbles: !0,
|
|
23
|
+
composed: !0,
|
|
24
|
+
detail: { value: e }
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
}, this._handleKeydown = (e) => {
|
|
28
|
+
let t = this._toggles().filter((e) => !e.disabled);
|
|
29
|
+
if (!t.length) return;
|
|
30
|
+
let n = this.orientation === "horizontal", r = n ? "ArrowRight" : "ArrowDown", i = n ? "ArrowLeft" : "ArrowUp";
|
|
31
|
+
if (e.key !== r && e.key !== i) return;
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
let a = t.indexOf(e.target), o;
|
|
34
|
+
o = e.key === r ? a < 0 ? 0 : (a + 1) % t.length : a < 0 ? t.length - 1 : (a - 1 + t.length) % t.length, t[o].focus();
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
super.connectedCallback(), this.setAttribute("role", "group"), this.addEventListener("void-change", this._handleChildChange), this.addEventListener("keydown", this._handleKeydown), this._syncToggles();
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
super.disconnectedCallback(), this.removeEventListener("void-change", this._handleChildChange), this.removeEventListener("keydown", this._handleKeydown);
|
|
42
|
+
}
|
|
43
|
+
updated(e) {
|
|
44
|
+
(e.has("value") || e.has("disabled") || e.has("size") || e.has("color")) && this._syncToggles();
|
|
45
|
+
}
|
|
46
|
+
_toggles() {
|
|
47
|
+
return Array.from(this.querySelectorAll("void-toggle"));
|
|
48
|
+
}
|
|
49
|
+
_selectedValues() {
|
|
50
|
+
return this.value ? this.value.split(",").map((e) => e.trim()).filter(Boolean) : [];
|
|
51
|
+
}
|
|
52
|
+
_syncToggles() {
|
|
53
|
+
let e = this._selectedValues();
|
|
54
|
+
for (let t of this._toggles()) {
|
|
55
|
+
let n = t.getAttribute("value") || "";
|
|
56
|
+
t.pressed = e.includes(n), this.disabled && (t.disabled = !0), t.size = this.size, this.color !== "default" && (t.color = this.color);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
t([n({
|
|
61
|
+
type: String,
|
|
62
|
+
reflect: !0
|
|
63
|
+
})], r.prototype, "value", void 0), t([n({
|
|
64
|
+
type: Boolean,
|
|
65
|
+
reflect: !0
|
|
66
|
+
})], r.prototype, "multiple", void 0), t([n({
|
|
67
|
+
type: Boolean,
|
|
68
|
+
reflect: !0
|
|
69
|
+
})], r.prototype, "disabled", void 0), t([n({
|
|
70
|
+
type: String,
|
|
71
|
+
reflect: !0
|
|
72
|
+
})], r.prototype, "size", void 0), t([n({
|
|
73
|
+
type: String,
|
|
74
|
+
reflect: !0
|
|
75
|
+
})], r.prototype, "color", void 0), t([n({
|
|
76
|
+
type: String,
|
|
77
|
+
reflect: !0
|
|
78
|
+
})], r.prototype, "orientation", void 0), customElements.get("void-toggle-group") || customElements.define("void-toggle-group", r);
|
|
79
|
+
//#endregion
|
|
80
|
+
export { r as VoidToggleGroup };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VoidElement } from '../base.js';
|
|
2
|
+
/** Pressable toggle button for toolbar actions and editor formatting controls with binary active/inactive state. */
|
|
3
|
+
export declare class VoidToggle extends VoidElement {
|
|
4
|
+
pressed: boolean;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
color: 'default' | 'error' | 'warning' | 'success' | 'info' | 'notice';
|
|
7
|
+
size: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
8
|
+
variant: 'outline' | 'filled';
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
updated(changed: Map<string, unknown>): void;
|
|
12
|
+
private _handleClick;
|
|
13
|
+
private _handleKeydown;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/components/toggle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,oHAAoH;AACpH,qBAAa,UAAW,SAAQ,WAAW;IACG,OAAO,UAAS;IAChB,QAAQ,UAAS;IAClB,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAa;IACnF,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAQ;IAC/C,OAAO,EAAE,SAAS,GAAG,QAAQ,CAAa;IAErF,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAM5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAQ5C,OAAO,CAAC,YAAY,CAIlB;IAEF,OAAO,CAAC,cAAc,CAKpB;CACH"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { VoidElement as e } from "../base.js";
|
|
2
|
+
import { t } from "../chunks/decorate-DKuCkHK4.js";
|
|
3
|
+
import { property as n } from "lit/decorators.js";
|
|
4
|
+
//#region src/components/toggle.ts
|
|
5
|
+
var r = class extends e {
|
|
6
|
+
constructor(...e) {
|
|
7
|
+
super(...e), this.pressed = !1, this.disabled = !1, this.color = "default", this.size = "md", this.variant = "outline", this._handleClick = () => {
|
|
8
|
+
this.disabled || (this.pressed = !this.pressed, this.dispatchEvent(new CustomEvent("void-change", {
|
|
9
|
+
bubbles: !0,
|
|
10
|
+
composed: !0,
|
|
11
|
+
detail: { pressed: this.pressed }
|
|
12
|
+
})));
|
|
13
|
+
}, this._handleKeydown = (e) => {
|
|
14
|
+
(e.key === " " || e.key === "Enter") && !this.disabled && (e.preventDefault(), this._handleClick());
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback(), this.setAttribute("role", "button"), this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.setAttribute("aria-pressed", String(this.pressed)), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
|
|
19
|
+
}
|
|
20
|
+
disconnectedCallback() {
|
|
21
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
|
|
22
|
+
}
|
|
23
|
+
updated(e) {
|
|
24
|
+
e.has("pressed") && this.setAttribute("aria-pressed", String(this.pressed)), e.has("disabled") && (this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0"));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
t([n({
|
|
28
|
+
type: Boolean,
|
|
29
|
+
reflect: !0
|
|
30
|
+
})], r.prototype, "pressed", void 0), t([n({
|
|
31
|
+
type: Boolean,
|
|
32
|
+
reflect: !0
|
|
33
|
+
})], r.prototype, "disabled", void 0), t([n({
|
|
34
|
+
type: String,
|
|
35
|
+
reflect: !0
|
|
36
|
+
})], r.prototype, "color", void 0), t([n({
|
|
37
|
+
type: String,
|
|
38
|
+
reflect: !0
|
|
39
|
+
})], r.prototype, "size", void 0), t([n({
|
|
40
|
+
type: String,
|
|
41
|
+
reflect: !0
|
|
42
|
+
})], r.prototype, "variant", void 0), customElements.get("void-toggle") || customElements.define("void-toggle", r);
|
|
43
|
+
//#endregion
|
|
44
|
+
export { r as VoidToggle };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { VoidElement } from '../base.js';
|
|
2
|
+
/** Hover hint for icon buttons and truncated text that need a label without cluttering the visible interface. */
|
|
3
|
+
export declare class VoidTooltip extends VoidElement {
|
|
4
|
+
text: string;
|
|
5
|
+
position: 'top' | 'bottom' | 'left' | 'right';
|
|
6
|
+
delay: number;
|
|
7
|
+
private _visible;
|
|
8
|
+
private _timerId;
|
|
9
|
+
private _tooltipId;
|
|
10
|
+
private _userContent;
|
|
11
|
+
private _didSetup;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
protected updated(): void;
|
|
15
|
+
private _onMouseEnter;
|
|
16
|
+
private _onMouseLeave;
|
|
17
|
+
private _onFocusIn;
|
|
18
|
+
private _onFocusOut;
|
|
19
|
+
render(): import('lit').TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'void-tooltip': VoidTooltip;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,iHAAiH;AACjH,qBAAa,WAAY,SAAQ,WAAW;IACd,IAAI,SAAM;IACK,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAS;IACrE,KAAK,SAAO;IAE/B,OAAO,CAAC,QAAQ,CAAS;IAElC,OAAO,CAAC,QAAQ,CAA4C;IAC5D,OAAO,CAAC,UAAU,CAAyD;IAC3E,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,SAAS,CAAS;IAE1B,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;cAST,OAAO,IAAI,IAAI;IA2BlC,OAAO,CAAC,aAAa,CAMnB;IAEF,OAAO,CAAC,aAAa,CAInB;IAEF,OAAO,CAAC,UAAU,CAIhB;IAEF,OAAO,CAAC,WAAW,CAIjB;IAEF,MAAM;CAGP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { VoidElement as e } from "../base.js";
|
|
2
|
+
import { t } from "../chunks/decorate-DKuCkHK4.js";
|
|
3
|
+
import { html as n } from "lit";
|
|
4
|
+
import { property as r, state as i } from "lit/decorators.js";
|
|
5
|
+
//#region src/components/tooltip.ts
|
|
6
|
+
var a = class extends e {
|
|
7
|
+
constructor(...e) {
|
|
8
|
+
super(...e), this.text = "", this.position = "top", this.delay = 200, this._visible = !1, this._tooltipId = "void-tooltip-" + Math.random().toString(36).slice(2), this._userContent = [], this._didSetup = !1, this._onMouseEnter = () => {
|
|
9
|
+
clearTimeout(this._timerId), this._timerId = setTimeout(() => {
|
|
10
|
+
this._visible = !0, this.requestUpdate();
|
|
11
|
+
}, this.delay);
|
|
12
|
+
}, this._onMouseLeave = () => {
|
|
13
|
+
clearTimeout(this._timerId), this._visible = !1, this.requestUpdate();
|
|
14
|
+
}, this._onFocusIn = () => {
|
|
15
|
+
clearTimeout(this._timerId), this._visible = !0, this.requestUpdate();
|
|
16
|
+
}, this._onFocusOut = () => {
|
|
17
|
+
clearTimeout(this._timerId), this._visible = !1, this.requestUpdate();
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
this._userContent = Array.from(this.childNodes), super.connectedCallback(), this.addEventListener("mouseenter", this._onMouseEnter), this.addEventListener("mouseleave", this._onMouseLeave), this.addEventListener("focusin", this._onFocusIn), this.addEventListener("focusout", this._onFocusOut);
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
super.disconnectedCallback(), clearTimeout(this._timerId), this.removeEventListener("mouseenter", this._onMouseEnter), this.removeEventListener("mouseleave", this._onMouseLeave), this.removeEventListener("focusin", this._onFocusIn), this.removeEventListener("focusout", this._onFocusOut);
|
|
25
|
+
}
|
|
26
|
+
updated() {
|
|
27
|
+
if (!this._didSetup) {
|
|
28
|
+
this._didSetup = !0;
|
|
29
|
+
let e = this.querySelector(".void-tooltip-bubble");
|
|
30
|
+
if (e) for (let t of this._userContent) this.insertBefore(t, e);
|
|
31
|
+
}
|
|
32
|
+
this._visible ? this.setAttribute("visible", "") : this.removeAttribute("visible");
|
|
33
|
+
let e = this.children[0];
|
|
34
|
+
e && (this._visible ? e.setAttribute("aria-describedby", this._tooltipId) : e.removeAttribute("aria-describedby"));
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
return n`<span id="${this._tooltipId}" class="void-tooltip-bubble" role="tooltip" aria-label=${this.text}>${this.text}</span>`;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
t([r({ type: String })], a.prototype, "text", void 0), t([r({
|
|
41
|
+
type: String,
|
|
42
|
+
reflect: !0
|
|
43
|
+
})], a.prototype, "position", void 0), t([r({ type: Number })], a.prototype, "delay", void 0), t([i()], a.prototype, "_visible", void 0), customElements.get("void-tooltip") || customElements.define("void-tooltip", a);
|
|
44
|
+
//#endregion
|
|
45
|
+
export { a as VoidTooltip };
|