@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.
Files changed (29) hide show
  1. package/dist/components/ds-theme-provider/ds-theme-provider.js +1 -1
  2. package/dist/components/ds-tooltip/ds-tooltip.d.ts +38 -23
  3. package/dist/components/ds-tooltip/ds-tooltip.js +195 -159
  4. package/dist/components/ds-tooltip/ds-tooltip.test.d.ts +8 -0
  5. package/dist/components/ds-tooltip/ds-tooltip.types.d.ts +5 -10
  6. package/dist/components/ds-tooltip/styles/common.styles.d.ts +0 -2
  7. package/dist/components/ds-tooltip/styles/common.styles.js +69 -102
  8. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +430 -0
  9. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +313 -0
  10. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +132 -0
  11. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
  12. package/dist/utils/StylesRegistry/StylesRegistry.js +1 -1
  13. package/dist/utils/cssWithTokens.js +1 -1
  14. package/dist/utils/htmlWithTokens.js +1 -1
  15. package/dist-react/components/ds-theme-provider/ds-theme-provider.js +1 -1
  16. package/dist-react/components/ds-tooltip/ds-tooltip.d.ts +38 -23
  17. package/dist-react/components/ds-tooltip/ds-tooltip.js +195 -159
  18. package/dist-react/components/ds-tooltip/ds-tooltip.test.d.ts +8 -0
  19. package/dist-react/components/ds-tooltip/ds-tooltip.types.d.ts +5 -10
  20. package/dist-react/components/ds-tooltip/styles/common.styles.d.ts +0 -2
  21. package/dist-react/components/ds-tooltip/styles/common.styles.js +69 -102
  22. package/dist-react/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +430 -0
  23. package/dist-react/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +313 -0
  24. 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
  25. package/dist-react/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
  26. package/dist-react/utils/StylesRegistry/StylesRegistry.js +1 -1
  27. package/dist-react/utils/cssWithTokens.js +1 -1
  28. package/dist-react/utils/htmlWithTokens.js +1 -1
  29. 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.14", r = `https://ds-assets.cupra.com${s}/styles/${this.theme}/theme.css`;
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
- zIndex: DsTooltipAttrs['z-index'];
16
- bodyWidth: DsTooltipAttrs['body-width'];
17
- protected tooltip: HTMLInputElement;
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
- connectedCallback(): void;
18
+ private anchorElements;
19
+ private headerElements;
20
+ private closeButtonElements;
21
+ private contentElements;
22
+ protected usingKeyboard: boolean;
20
23
  disconnectedCallback(): void;
21
- protected willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
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 tooltipClasses(): {
29
- [x: string]: string | boolean;
30
- tooltip: boolean;
31
- complex: string;
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 get buttonsTemplate(): typeof nothing | import("lit").TemplateResult<1>;
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 m } from "../base/UiKitElement.js";
2
- import { customUiKitElement as f } from "../../decorators/customUiKitElement.js";
3
- import { ViewportMixin as y } from "../../mixins/ViewportMixin.js";
4
- import { booleanConverter as b } from "../../utils/booleanConverter.js";
5
- import { debounce as v } from "../../utils/debounce.js";
6
- import { htmlWithTokens as x } from "../../utils/htmlWithTokens.js";
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 { nothing as a, html as c } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
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 h } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
11
- import { query as p } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.js";
12
- import { classMap as u } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
13
- import { commonStyles as g, tooltipStyles as w, arrowStyles as T } from "./styles/common.styles.js";
14
- var C = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, s = (t, n, r, i) => {
15
- for (var o = i > 1 ? void 0 : i ? $(n, r) : n, l = t.length - 1, d; l >= 0; l--)
16
- (d = t[l]) && (o = (i ? d(n, r, o) : d(o)) || o);
17
- return i && o && C(n, r, o), o;
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 e = class extends y(m) {
22
+ let s = class extends x(y) {
20
23
  constructor() {
21
- super(...arguments), this.mode = "light", this.titleText = "", this.bodyText = "", this.position = "bottom", this.align = "center", this.show = !1, this.zIndex = 2e3, this.bodyWidth = "unset", this.handleResize = v({ func: () => this.requestUpdate() }), this.handleClickOutside = (t) => {
22
- var r;
23
- const n = t.target;
24
- n !== this && !this.contains(n) && !((r = this.shadowRoot) != null && r.contains(n)) && (this.show = !1);
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
- willUpdate(t) {
34
- t.has("show") && (this.show ? document.addEventListener("click", this.handleClickOutside) : document.removeEventListener("click", this.handleClickOutside));
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 t;
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) > ((t = this.tooltip) == null ? void 0 : t.offsetWidth)
95
+ "not-positionable": (this == null ? void 0 : this.offsetWidth) > ((e = this.container) == null ? void 0 : e.offsetWidth)
44
96
  };
45
97
  }
46
- get tooltipClasses() {
98
+ get containerClasses() {
47
99
  return {
48
- tooltip: !0,
49
- [this.position]: !0,
50
- [this.align]: !0,
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 buttonsTemplate() {
56
- if (!this.cancelButtonText && !this.confirmButtonText) return a;
57
- const t = this.mode === "light" ? "dark" : "light";
58
- return c`
59
- <div class="buttons-container">
60
- ${this.cancelButtonText ? this.componentFactory.createButton({
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 tooltipTemplate() {
80
- return this.show ? c`
81
- <div class=${u(this.arrowClasses)} @mouseout="${this.handleMouseOut}"></div>
82
- <div class=${u(this.tooltipClasses)} @mouseout=${this.handleMouseOut}>
83
- ${this.titleText ? c`<div class="title">${this.titleText}</div>` : a}
84
- ${this.bodyText ? c`<div class="body">${this.bodyText}</div>` : a}
85
- ${this.buttonsTemplate}
86
- </div>
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
- getTooltipWidth() {
90
- const i = this.offsetLeft + this.scrollLeft + this.clientLeft, o = document.body.clientWidth - i - this.clientWidth;
91
- let l;
92
- return this.position === "left" ? l = i - 13 : this.position === "right" ? l = o - 13 : this.align === "center" ? l = (i < o ? i : o) * 2 + this.clientWidth : this.align === "start" ? l = document.body.clientWidth - i : this.align === "end" && (l = i + this.clientWidth), `${l - 16 - 32}px`;
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 x`
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 c`
158
+ return m`
105
159
  <style>
106
- .tooltip {
107
- max-width: ${this.getTooltipWidth()};
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
- <slot
119
- @mouseover="${this.handleMouseOver}"
120
- @mouseout="${this.handleMouseOut}"
121
- @click=${this.handleClickSlot}
122
- ></slot>
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
- e.styles = [g, w, T];
157
- s([
158
- h({ type: String, reflect: !0 })
159
- ], e.prototype, "mode", 2);
160
- s([
161
- h({ type: String, attribute: "title-text" })
162
- ], e.prototype, "titleText", 2);
163
- s([
164
- h({ type: String, attribute: "body-text" })
165
- ], e.prototype, "bodyText", 2);
166
- s([
167
- h({ type: String })
168
- ], e.prototype, "position", 2);
169
- s([
170
- h({ type: String })
171
- ], e.prototype, "align", 2);
172
- s([
173
- h({ type: String, attribute: "cancel-button-text" })
174
- ], e.prototype, "cancelButtonText", 2);
175
- s([
176
- h({ type: String, attribute: "confirm-button-text" })
177
- ], e.prototype, "confirmButtonText", 2);
178
- s([
179
- h({ type: Boolean, reflect: !0, converter: b })
180
- ], e.prototype, "show", 2);
181
- s([
182
- h({ type: Number, attribute: "z-index" })
183
- ], e.prototype, "zIndex", 2);
184
- s([
185
- h({ type: String, attribute: "body-width" })
186
- ], e.prototype, "bodyWidth", 2);
187
- s([
188
- p(".tooltip")
189
- ], e.prototype, "tooltip", 2);
190
- s([
191
- p(".arrow")
192
- ], e.prototype, "arrow", 2);
193
- e = s([
194
- f("ds-tooltip")
195
- ], e);
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
- e as DsTooltip
233
+ s as DsTooltip
198
234
  };
@@ -0,0 +1,8 @@
1
+ import '../ds-theme-provider/ds-theme-provider.ts';
2
+ import './ds-tooltip.ts';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'ds-tooltip': import('./ds-tooltip').DsTooltip;
6
+ 'ds-theme-provider': HTMLElement;
7
+ }
8
+ }
@@ -1,13 +1,8 @@
1
1
  import type { CommonAttrs } from '../../types/types';
2
- export interface DsTooltipAttrs extends CommonAttrs {
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
- 'body-width'?: string;
10
- 'cancel-button-text'?: string;
11
- 'confirm-button-text'?: string;
12
- 'z-index'?: number;
13
- }
5
+ 'disable-hover-listener'?: boolean;
6
+ 'disable-focus-listener'?: boolean;
7
+ 'disable-press-listener'?: boolean;
8
+ };
@@ -1,3 +1 @@
1
1
  export declare const commonStyles: import("lit").CSSResult;
2
- export declare const tooltipStyles: import("lit").CSSResult;
3
- export declare const arrowStyles: import("lit").CSSResult;