@cupra/ui-kit 1.0.0-canary.14 → 1.0.0-canary.16
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/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist/components/ds-tooltip/ds-tooltip.d.ts +38 -23
- package/dist/components/ds-tooltip/ds-tooltip.js +195 -159
- package/dist/components/ds-tooltip/ds-tooltip.test.d.ts +8 -0
- package/dist/components/ds-tooltip/ds-tooltip.types.d.ts +5 -10
- package/dist/components/ds-tooltip/styles/common.styles.d.ts +0 -2
- package/dist/components/ds-tooltip/styles/common.styles.js +69 -102
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +430 -0
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +313 -0
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +132 -0
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
- package/dist/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist/utils/cssWithTokens.js +1 -1
- package/dist/utils/htmlWithTokens.js +1 -1
- package/dist-react/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist-react/components/ds-tooltip/ds-tooltip.d.ts +38 -23
- package/dist-react/components/ds-tooltip/ds-tooltip.js +195 -159
- package/dist-react/components/ds-tooltip/ds-tooltip.test.d.ts +8 -0
- package/dist-react/components/ds-tooltip/ds-tooltip.types.d.ts +5 -10
- package/dist-react/components/ds-tooltip/styles/common.styles.d.ts +0 -2
- package/dist-react/components/ds-tooltip/styles/common.styles.js +69 -102
- package/dist-react/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +430 -0
- package/dist-react/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +313 -0
- package/dist-react/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +132 -0
- package/dist-react/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
- package/dist-react/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist-react/utils/cssWithTokens.js +1 -1
- package/dist-react/utils/htmlWithTokens.js +1 -1
- package/package.json +2 -1
|
@@ -53,7 +53,7 @@ let m = class extends $ {
|
|
|
53
53
|
}
|
|
54
54
|
loadThemeStyles() {
|
|
55
55
|
return this.loadStyles ? new Promise((t, o) => {
|
|
56
|
-
const s = "/1.0.0-canary.
|
|
56
|
+
const s = "/1.0.0-canary.16", r = `https://ds-assets.cupra.com${s}/styles/${this.theme}/theme.css`;
|
|
57
57
|
if (document.head.querySelector(`link[href="${r}"]`)) t();
|
|
58
58
|
else {
|
|
59
59
|
const e = `ui-kit-theme-${s}`, a = document.getElementById(e), n = document.createElement("link");
|
|
@@ -1,45 +1,60 @@
|
|
|
1
1
|
import { UiKitElement } from '../base/UiKitElement.ts';
|
|
2
|
+
import { type Placement } from '@floating-ui/dom';
|
|
2
3
|
import { nothing } from 'lit';
|
|
3
4
|
import type { DsTooltipAttrs } from './ds-tooltip.types';
|
|
4
5
|
declare const DsTooltip_base: (new (...args: any[]) => import("../../mixins/ViewportMixin").ViewportInterface) & typeof UiKitElement;
|
|
5
6
|
export declare class DsTooltip extends DsTooltip_base {
|
|
6
7
|
static styles: import("lit").CSSResult[];
|
|
7
8
|
mode: DsTooltipAttrs['mode'];
|
|
8
|
-
titleText: DsTooltipAttrs['title-text'];
|
|
9
|
-
bodyText: DsTooltipAttrs['body-text'];
|
|
10
|
-
position: DsTooltipAttrs['position'];
|
|
11
|
-
align: DsTooltipAttrs['align'];
|
|
12
|
-
cancelButtonText: DsTooltipAttrs['cancel-button-text'];
|
|
13
|
-
confirmButtonText: DsTooltipAttrs['confirm-button-text'];
|
|
14
9
|
show: DsTooltipAttrs['show'];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
disableHoverListener: DsTooltipAttrs['disable-hover-listener'];
|
|
11
|
+
disableFocusListener: DsTooltipAttrs['disable-focus-listener'];
|
|
12
|
+
disablePressListener: DsTooltipAttrs['disable-press-listener'];
|
|
13
|
+
protected tooltopPlacement: Placement;
|
|
14
|
+
private tooltipId;
|
|
15
|
+
protected container: HTMLInputElement;
|
|
16
|
+
protected anchorContainer: HTMLInputElement;
|
|
18
17
|
protected arrow: HTMLInputElement;
|
|
19
|
-
|
|
18
|
+
private anchorElements;
|
|
19
|
+
private headerElements;
|
|
20
|
+
private closeButtonElements;
|
|
21
|
+
private contentElements;
|
|
22
|
+
protected usingKeyboard: boolean;
|
|
20
23
|
disconnectedCallback(): void;
|
|
21
|
-
protected
|
|
24
|
+
protected updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
25
|
+
protected updatePosition(): void;
|
|
26
|
+
protected handleKeyDown: () => void;
|
|
27
|
+
protected handlePointerDown: () => void;
|
|
22
28
|
protected handleResize: (params?: any) => void | Function;
|
|
23
29
|
protected get arrowClasses(): {
|
|
24
30
|
[x: string]: boolean;
|
|
25
31
|
arrow: boolean;
|
|
26
32
|
'not-positionable': boolean;
|
|
27
33
|
};
|
|
28
|
-
protected get
|
|
29
|
-
[x: string]:
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
protected get containerClasses(): {
|
|
35
|
+
[x: string]: boolean;
|
|
36
|
+
container: boolean;
|
|
37
|
+
};
|
|
38
|
+
protected get headerClasses(): {
|
|
39
|
+
'header-container': boolean;
|
|
40
|
+
hidden: boolean;
|
|
41
|
+
};
|
|
42
|
+
protected get contentClasses(): {
|
|
43
|
+
'content-container': boolean;
|
|
44
|
+
'ds-scroll': boolean;
|
|
45
|
+
'ds-scroll--size-s': boolean;
|
|
46
|
+
hidden: boolean;
|
|
32
47
|
};
|
|
33
|
-
protected
|
|
48
|
+
protected handleClose: () => void;
|
|
49
|
+
protected get arrowTemplate(): import("lit").TemplateResult<1>;
|
|
34
50
|
protected get tooltipTemplate(): typeof nothing | import("lit").TemplateResult<1>;
|
|
35
|
-
private getTooltipWidth;
|
|
36
51
|
protected get styleTokens(): import("lit").HTMLTemplateResult;
|
|
52
|
+
protected handleAnchorPointerDown: (event: PointerEvent) => void;
|
|
53
|
+
protected handleAnchorMouseOver: () => void;
|
|
54
|
+
protected handleAnchorMouseOut: () => void;
|
|
55
|
+
protected handleAnchorFocusIn: () => void;
|
|
56
|
+
protected handleAnchorFocusOut: () => void;
|
|
57
|
+
protected handlePressOutside: (event: MouseEvent) => void;
|
|
37
58
|
render(): import("lit").TemplateResult<1>;
|
|
38
|
-
protected handleClickSlot(): void;
|
|
39
|
-
protected handleMouseOver(): void;
|
|
40
|
-
protected handleMouseOut(): void;
|
|
41
|
-
protected handleClickCancelButton(): void;
|
|
42
|
-
protected handleClickConfirmButton(): void;
|
|
43
|
-
protected handleClickOutside: (event: MouseEvent | TouchEvent) => void;
|
|
44
59
|
}
|
|
45
60
|
export {};
|
|
@@ -1,98 +1,152 @@
|
|
|
1
|
-
import { UiKitElement as
|
|
2
|
-
import { customUiKitElement as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { UiKitElement as y } from "../base/UiKitElement.js";
|
|
2
|
+
import { customUiKitElement as v } from "../../decorators/customUiKitElement.js";
|
|
3
|
+
import { computePosition as g, flip as $, shift as P, offset as L, arrow as E, size as C } from "../../node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
|
|
4
|
+
import { ViewportMixin as x } from "../../mixins/ViewportMixin.js";
|
|
5
|
+
import { booleanConverter as u } from "../../utils/booleanConverter.js";
|
|
6
|
+
import { debounce as O } from "../../utils/debounce.js";
|
|
7
|
+
import { htmlWithTokens as A } from "../../utils/htmlWithTokens.js";
|
|
7
8
|
import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
|
|
8
|
-
import {
|
|
9
|
+
import { html as m, nothing as d } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
9
10
|
import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
10
|
-
import { property as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
import { property as l } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
12
|
+
import { state as b } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
|
|
13
|
+
import { query as f } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.js";
|
|
14
|
+
import { queryAssignedElements as p } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js";
|
|
15
|
+
import { classMap as c } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
16
|
+
import { commonStyles as M } from "./styles/common.styles.js";
|
|
17
|
+
var D = Object.defineProperty, F = Object.getOwnPropertyDescriptor, r = (e, t, o, n) => {
|
|
18
|
+
for (var i = n > 1 ? void 0 : n ? F(t, o) : t, h = e.length - 1, a; h >= 0; h--)
|
|
19
|
+
(a = e[h]) && (i = (n ? a(t, o, i) : a(i)) || i);
|
|
20
|
+
return n && i && D(t, o, i), i;
|
|
18
21
|
};
|
|
19
|
-
let
|
|
22
|
+
let s = class extends x(y) {
|
|
20
23
|
constructor() {
|
|
21
|
-
super(...arguments), this.mode = "light", this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
super(...arguments), this.mode = "light", this.show = !1, this.disableHoverListener = !1, this.disableFocusListener = !1, this.disablePressListener = !1, this.tooltipId = `ds-tooltip-${Date.now()}-${Math.floor(Math.random() * 1e6)}`, this.usingKeyboard = !1, this.handleKeyDown = () => {
|
|
25
|
+
this.usingKeyboard = !0;
|
|
26
|
+
}, this.handlePointerDown = () => {
|
|
27
|
+
this.usingKeyboard = !1;
|
|
28
|
+
}, this.handleResize = O({ func: () => this.requestUpdate() }), this.handleClose = () => {
|
|
29
|
+
this.show = !1;
|
|
30
|
+
}, this.handleAnchorPointerDown = (e) => {
|
|
31
|
+
this.disablePressListener || e.button === 0 && (this.show = !this.show);
|
|
32
|
+
}, this.handleAnchorMouseOver = () => {
|
|
33
|
+
this.disableHoverListener || (this.show = !0);
|
|
34
|
+
}, this.handleAnchorMouseOut = () => {
|
|
35
|
+
this.disableHoverListener || setTimeout(() => {
|
|
36
|
+
var e, t, o, n, i;
|
|
37
|
+
!((t = (e = this.container) == null ? void 0 : e.matches) != null && t.call(e, ":hover")) && !((n = (o = this.arrow) == null ? void 0 : o.matches) != null && n.call(o, ":hover")) && !((i = this == null ? void 0 : this.matches) != null && i.call(this, ":hover")) && (this.show = !1);
|
|
38
|
+
}, 150);
|
|
39
|
+
}, this.handleAnchorFocusIn = () => {
|
|
40
|
+
this.usingKeyboard && (this.disableFocusListener || (this.show = !0));
|
|
41
|
+
}, this.handleAnchorFocusOut = () => {
|
|
42
|
+
this.usingKeyboard && (this.disableFocusListener || (this.show = !1));
|
|
43
|
+
}, this.handlePressOutside = (e) => {
|
|
44
|
+
var o;
|
|
45
|
+
if (this.disablePressListener || e.button !== 0) return;
|
|
46
|
+
const t = e.target;
|
|
47
|
+
t === this || this.contains(t) || (o = this.shadowRoot) != null && o.contains(t) || this.anchorElements[0] === t || this.anchorElements[0].contains(t) || (this.show = !1);
|
|
25
48
|
};
|
|
26
49
|
}
|
|
27
|
-
connectedCallback() {
|
|
28
|
-
super.connectedCallback(), window.addEventListener("resize", this.handleResize);
|
|
29
|
-
}
|
|
30
50
|
disconnectedCallback() {
|
|
31
|
-
super.disconnectedCallback(), window.removeEventListener("resize", this.handleResize);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
51
|
+
super.disconnectedCallback(), window.removeEventListener("resize", this.handleResize), document.removeEventListener("pointerdown", this.handlePressOutside), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("pointerdown", this.handlePointerDown);
|
|
52
|
+
}
|
|
53
|
+
updated(e) {
|
|
54
|
+
document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("pointerdown", this.handlePointerDown), this.updatePosition(), e.has("show") && (this.show ? (window.addEventListener("resize", this.handleResize), document.addEventListener("pointerdown", this.handlePressOutside)) : (window.removeEventListener("resize", this.handleResize), document.removeEventListener("pointerdown", this.handlePressOutside)));
|
|
55
|
+
}
|
|
56
|
+
updatePosition() {
|
|
57
|
+
requestAnimationFrame(() => {
|
|
58
|
+
var e;
|
|
59
|
+
!this.anchorContainer || !this.container || !this.show || !((e = this.anchorElements) != null && e[0]) || !(this.anchorContainer instanceof Element) || !(this.container instanceof Element) || !(this.arrow instanceof Element) || (g(this.anchorContainer, this.container, {
|
|
60
|
+
placement: "bottom-start",
|
|
61
|
+
middleware: [
|
|
62
|
+
$(),
|
|
63
|
+
P(),
|
|
64
|
+
L(8),
|
|
65
|
+
E({ element: this.arrow }),
|
|
66
|
+
C({
|
|
67
|
+
apply({ availableWidth: t, availableHeight: o, elements: n }) {
|
|
68
|
+
Object.assign(n.floating.style, {
|
|
69
|
+
maxWidth: `${Math.min(240, t - 8)}px`,
|
|
70
|
+
maxHeight: `${Math.max(0, o - 8)}px`
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
}).then((t) => {
|
|
76
|
+
const { x: o, y: n, middlewareData: i, placement: h } = t;
|
|
77
|
+
if (this.tooltopPlacement = h, Object.assign(this.container.style, {
|
|
78
|
+
left: `${o ?? 0}px`,
|
|
79
|
+
top: `${n ?? 0}px`
|
|
80
|
+
}), i.arrow) {
|
|
81
|
+
const { x: a, y: w } = i.arrow;
|
|
82
|
+
Object.assign(this.arrow.style, {
|
|
83
|
+
left: a != null ? `${a}px` : "",
|
|
84
|
+
top: w != null ? `${w}px` : ""
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}), this.requestUpdate());
|
|
88
|
+
});
|
|
35
89
|
}
|
|
36
90
|
get arrowClasses() {
|
|
37
|
-
var
|
|
91
|
+
var e;
|
|
38
92
|
return {
|
|
39
93
|
arrow: !0,
|
|
40
|
-
[this.position]: !0,
|
|
41
|
-
[this.align]: !0,
|
|
42
94
|
[this.mode]: !0,
|
|
43
|
-
"not-positionable": (this == null ? void 0 : this.offsetWidth) > ((
|
|
95
|
+
"not-positionable": (this == null ? void 0 : this.offsetWidth) > ((e = this.container) == null ? void 0 : e.offsetWidth)
|
|
44
96
|
};
|
|
45
97
|
}
|
|
46
|
-
get
|
|
98
|
+
get containerClasses() {
|
|
47
99
|
return {
|
|
48
|
-
|
|
49
|
-
[this.
|
|
50
|
-
[this.
|
|
51
|
-
[this.mode]: !0,
|
|
52
|
-
complex: this.cancelButtonText || this.confirmButtonText
|
|
100
|
+
container: !0,
|
|
101
|
+
[this.tooltopPlacement]: !!this.tooltopPlacement,
|
|
102
|
+
[this.mode]: !0
|
|
53
103
|
};
|
|
54
104
|
}
|
|
55
|
-
get
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class: "cancel-button",
|
|
62
|
-
"@click": this.handleClickCancelButton,
|
|
63
|
-
size: "small",
|
|
64
|
-
variant: "secondary",
|
|
65
|
-
mode: t,
|
|
66
|
-
children: this.cancelButtonText
|
|
67
|
-
}) : a}
|
|
68
|
-
${this.confirmButtonText ? this.componentFactory.createButton({
|
|
69
|
-
class: "confirm-button",
|
|
70
|
-
"@click": this.handleClickConfirmButton,
|
|
71
|
-
size: "small",
|
|
72
|
-
variant: "primary",
|
|
73
|
-
mode: t,
|
|
74
|
-
children: this.confirmButtonText
|
|
75
|
-
}) : a}
|
|
76
|
-
</div>
|
|
77
|
-
`;
|
|
105
|
+
get headerClasses() {
|
|
106
|
+
var e, t;
|
|
107
|
+
return {
|
|
108
|
+
"header-container": !0,
|
|
109
|
+
hidden: ((e = this.headerElements) == null ? void 0 : e.length) === 0 && ((t = this.closeButtonElements) == null ? void 0 : t.length) === 0
|
|
110
|
+
};
|
|
78
111
|
}
|
|
79
|
-
get
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
` : a;
|
|
112
|
+
get contentClasses() {
|
|
113
|
+
var e;
|
|
114
|
+
return {
|
|
115
|
+
"content-container": !0,
|
|
116
|
+
"ds-scroll": !0,
|
|
117
|
+
"ds-scroll--size-s": !0,
|
|
118
|
+
hidden: ((e = this.contentElements) == null ? void 0 : e.length) === 0
|
|
119
|
+
};
|
|
88
120
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
121
|
+
get arrowTemplate() {
|
|
122
|
+
return m`
|
|
123
|
+
<svg id="arrow" xmlns="http://www.w3.org/2000/svg" width="17" height="9" viewBox="0 0 17 9" fill="none" class=${c(this.arrowClasses)} @mouseout="${this.handleAnchorMouseOut}" aria-hidden="true" focusable="false">
|
|
124
|
+
<path d="M5.77946 4.38048L0.5 9L16 9L11.1427 4.46656C9.88663 3.29419 9.25858 2.708 8.48883 2.69565C7.71909 2.68329 7.07255 3.24902 5.77946 4.38048Z" fill="#26262C" class="ds-tooltip-arrow-background"/>
|
|
125
|
+
<path d="M0.5 8.5L5.89467 4.11683C7.1398 3.10516 7.76236 2.59933 8.49029 2.6109C9.21822 2.62246 9.8244 3.14782 11.0368 4.19853L16 8.5" stroke="#FAFAFA" stroke-opacity="0.3" stroke-linecap="round" class="ds-tooltip-arrow-border"/>
|
|
126
|
+
</svg>`;
|
|
127
|
+
}
|
|
128
|
+
get tooltipTemplate() {
|
|
129
|
+
return this.show && this.anchorElements.length > 0 ? m`
|
|
130
|
+
<div
|
|
131
|
+
id=${this.tooltipId}
|
|
132
|
+
part="container"
|
|
133
|
+
class=${c(this.containerClasses)}
|
|
134
|
+
@mouseout=${this.handleAnchorMouseOut}
|
|
135
|
+
role="tooltip"
|
|
136
|
+
>
|
|
137
|
+
<header part="header" class=${c(this.headerClasses)}>
|
|
138
|
+
<slot @slotchange=${this.updatePosition} name="header"></slot>
|
|
139
|
+
<slot @slotchange=${this.updatePosition} name="close-button" @click=${this.handleClose}></slot>
|
|
140
|
+
</header>
|
|
141
|
+
<div part="content" class=${c(this.contentClasses)}>
|
|
142
|
+
<slot @slotchange=${this.updatePosition} name="content"></slot>
|
|
143
|
+
</div>
|
|
144
|
+
<slot part="image" @slotchange=${this.updatePosition} name="image"></slot>
|
|
145
|
+
${this.arrowTemplate}
|
|
146
|
+
</div>` : d;
|
|
93
147
|
}
|
|
94
148
|
get styleTokens() {
|
|
95
|
-
return
|
|
149
|
+
return A`
|
|
96
150
|
<style>
|
|
97
151
|
:host {
|
|
98
152
|
color-scheme: ${this.mode};
|
|
@@ -101,98 +155,80 @@ let e = class extends y(m) {
|
|
|
101
155
|
`;
|
|
102
156
|
}
|
|
103
157
|
render() {
|
|
104
|
-
return
|
|
158
|
+
return m`
|
|
105
159
|
<style>
|
|
106
|
-
.
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
.tooltip,
|
|
110
|
-
.arrow {
|
|
111
|
-
z-index: ${this.zIndex};
|
|
112
|
-
}
|
|
113
|
-
.body {
|
|
114
|
-
max-width: ${this.bodyWidth};
|
|
160
|
+
.anchor {
|
|
161
|
+
cursor: ${this.disablePressListener ? "default" : "pointer"};
|
|
115
162
|
}
|
|
116
163
|
</style>
|
|
117
164
|
${this.styleTokens}
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
165
|
+
<div
|
|
166
|
+
id="button"
|
|
167
|
+
class="anchor"
|
|
168
|
+
tabindex="0"
|
|
169
|
+
role=${this.disablePressListener ? d : "button"}
|
|
170
|
+
aria-controls=${this.tooltipId}
|
|
171
|
+
aria-expanded=${this.disablePressListener ? d : String(this.show)}
|
|
172
|
+
aria-describedby=${this.show ? this.tooltipId : d}
|
|
173
|
+
aria-label="open tooltip"
|
|
174
|
+
@mouseover="${this.handleAnchorMouseOver}"
|
|
175
|
+
@mouseout="${this.handleAnchorMouseOut}"
|
|
176
|
+
@pointerdown="${this.handleAnchorPointerDown}"
|
|
177
|
+
@focusin=${this.handleAnchorFocusIn}
|
|
178
|
+
@focusout=${this.handleAnchorFocusOut}
|
|
179
|
+
>
|
|
180
|
+
<slot></slot>
|
|
181
|
+
</div>
|
|
124
182
|
${this.tooltipTemplate}
|
|
125
183
|
`;
|
|
126
184
|
}
|
|
127
|
-
handleClickSlot() {
|
|
128
|
-
["xs", "s", "m"].includes(this.viewport) && (this.show = !this.show);
|
|
129
|
-
}
|
|
130
|
-
handleMouseOver() {
|
|
131
|
-
["xs", "s", "m"].includes(this.viewport) || (this.show = !0);
|
|
132
|
-
}
|
|
133
|
-
handleMouseOut() {
|
|
134
|
-
["xs", "s", "m"].includes(this.viewport) || setTimeout(() => {
|
|
135
|
-
var t, n, r, i, o;
|
|
136
|
-
!((n = (t = this.tooltip) == null ? void 0 : t.matches) != null && n.call(t, ":hover")) && !((i = (r = this.arrow) == null ? void 0 : r.matches) != null && i.call(r, ":hover")) && !((o = this == null ? void 0 : this.matches) != null && o.call(this, ":hover")) && (this.show = !1);
|
|
137
|
-
}, 150);
|
|
138
|
-
}
|
|
139
|
-
handleClickCancelButton() {
|
|
140
|
-
this.dispatchEvent(
|
|
141
|
-
new CustomEvent("click-cancel-button", {
|
|
142
|
-
bubbles: !0,
|
|
143
|
-
composed: !0
|
|
144
|
-
})
|
|
145
|
-
), this.show = !1;
|
|
146
|
-
}
|
|
147
|
-
handleClickConfirmButton() {
|
|
148
|
-
this.dispatchEvent(
|
|
149
|
-
new CustomEvent("click-confirm-button", {
|
|
150
|
-
bubbles: !0,
|
|
151
|
-
composed: !0
|
|
152
|
-
})
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
185
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
],
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
],
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
],
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
],
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
],
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
],
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
],
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
],
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
],
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
],
|
|
187
|
-
|
|
188
|
-
p("
|
|
189
|
-
],
|
|
190
|
-
|
|
191
|
-
p("
|
|
192
|
-
],
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
],
|
|
186
|
+
s.styles = [M];
|
|
187
|
+
r([
|
|
188
|
+
l({ type: String, reflect: !0 })
|
|
189
|
+
], s.prototype, "mode", 2);
|
|
190
|
+
r([
|
|
191
|
+
l({ type: Boolean, reflect: !0, converter: u })
|
|
192
|
+
], s.prototype, "show", 2);
|
|
193
|
+
r([
|
|
194
|
+
l({ type: Boolean, reflect: !0, converter: u, attribute: "disable-hover-listener" })
|
|
195
|
+
], s.prototype, "disableHoverListener", 2);
|
|
196
|
+
r([
|
|
197
|
+
l({ type: Boolean, reflect: !0, converter: u, attribute: "disable-focus-listener" })
|
|
198
|
+
], s.prototype, "disableFocusListener", 2);
|
|
199
|
+
r([
|
|
200
|
+
l({ type: Boolean, reflect: !0, converter: u, attribute: "disable-press-listener" })
|
|
201
|
+
], s.prototype, "disablePressListener", 2);
|
|
202
|
+
r([
|
|
203
|
+
b()
|
|
204
|
+
], s.prototype, "tooltopPlacement", 2);
|
|
205
|
+
r([
|
|
206
|
+
b()
|
|
207
|
+
], s.prototype, "tooltipId", 2);
|
|
208
|
+
r([
|
|
209
|
+
f(".container")
|
|
210
|
+
], s.prototype, "container", 2);
|
|
211
|
+
r([
|
|
212
|
+
f("#button")
|
|
213
|
+
], s.prototype, "anchorContainer", 2);
|
|
214
|
+
r([
|
|
215
|
+
f("#arrow")
|
|
216
|
+
], s.prototype, "arrow", 2);
|
|
217
|
+
r([
|
|
218
|
+
p({ slot: "" })
|
|
219
|
+
], s.prototype, "anchorElements", 2);
|
|
220
|
+
r([
|
|
221
|
+
p({ slot: "header" })
|
|
222
|
+
], s.prototype, "headerElements", 2);
|
|
223
|
+
r([
|
|
224
|
+
p({ slot: "close-button" })
|
|
225
|
+
], s.prototype, "closeButtonElements", 2);
|
|
226
|
+
r([
|
|
227
|
+
p({ slot: "content" })
|
|
228
|
+
], s.prototype, "contentElements", 2);
|
|
229
|
+
s = r([
|
|
230
|
+
v("ds-tooltip")
|
|
231
|
+
], s);
|
|
196
232
|
export {
|
|
197
|
-
|
|
233
|
+
s as DsTooltip
|
|
198
234
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { CommonAttrs } from '../../types/types';
|
|
2
|
-
export
|
|
2
|
+
export type DsTooltipAttrs = CommonAttrs & {
|
|
3
3
|
mode?: 'dark' | 'light';
|
|
4
|
-
'title-text'?: string;
|
|
5
|
-
'body-text'?: string;
|
|
6
|
-
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
7
|
-
align?: 'start' | 'center' | 'end';
|
|
8
4
|
show?: boolean;
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
|
|
13
|
-
}
|
|
5
|
+
'disable-hover-listener'?: boolean;
|
|
6
|
+
'disable-focus-listener'?: boolean;
|
|
7
|
+
'disable-press-listener'?: boolean;
|
|
8
|
+
};
|