@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
@@ -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;
@@ -2,10 +2,11 @@ import "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@li
2
2
  import "../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
3
3
  import "../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
4
4
  import { css as t } from "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";
5
- const e = t`
5
+ const i = t`
6
6
  :host {
7
7
  position: relative;
8
8
  display: inline-block;
9
+ width: fit-content;
9
10
  }
10
11
 
11
12
  .title {
@@ -21,143 +22,109 @@ const e = t`
21
22
  grid-template-columns: 1fr 1fr;
22
23
  justify-content: flex-end;
23
24
  }
24
- `, p = t`
25
- .tooltip {
26
- width: max-content;
27
- white-space: normal;
28
- box-sizing: border-box;
29
- position: absolute;
30
- }
31
25
 
32
- .tooltip.complex {
33
- padding: 12px;
26
+ ::slotted([slot='content']) {
27
+ text-align: left;
34
28
  }
35
29
 
36
- .tooltip.top {
37
- bottom: 100%;
38
- margin-bottom: 13px;
39
- }
30
+ .container {
31
+ white-space: normal;
32
+ box-sizing: border-box;
33
+ display: flex;
34
+ flex-direction: column;
35
+ justify-content: center;
36
+ align-items: flex-start;
37
+ gap: var(--ds-spacing-s-5, 8px);
38
+ align-self: stretch;
40
39
 
41
- .tooltip.bottom {
42
- top: 100%;
43
- margin-top: 13px;
44
- }
40
+ z-index: var(--ds-z-index-tooltip, 1300);
45
41
 
46
- .tooltip.left {
47
- right: 100%;
48
- margin-right: 13px;
42
+ position: absolute;
43
+ width: max-content;
49
44
  }
50
45
 
51
- .tooltip.right {
52
- left: 100%;
53
- margin-left: 13px;
46
+ ::slotted([slot='image']) {
47
+ width: 100%;
48
+ height: auto;
49
+ object-fit: contain;
54
50
  }
55
51
 
56
- .tooltip.top.center,
57
- .tooltip.bottom.center {
58
- left: 50%;
59
- transform: translateX(-50%);
52
+ .header-container {
53
+ display: flex;
54
+ width: 100%;
55
+ align-items: center;
56
+ justify-content: space-between;
60
57
  }
61
58
 
62
- .tooltip.left.center,
63
- .tooltip.right.center {
64
- top: 50%;
65
- transform: translateY(-50%);
59
+ .header-container.hidden,
60
+ .content-container.hidden {
61
+ display: none;
66
62
  }
67
63
 
68
- .tooltip.top.start,
69
- .tooltip.bottom.start {
70
- left: 0;
71
- transform: none;
64
+ .content-container {
65
+ overflow: auto;
72
66
  }
73
67
 
74
- .tooltip.left.start,
75
- .tooltip.right.start {
76
- top: 0;
77
- transform: none;
68
+ ::slotted([slot='header']) {
69
+ flex: 1 1 auto;
78
70
  }
79
71
 
80
- .tooltip.top.end,
81
- .tooltip.bottom.end {
82
- left: auto;
83
- right: 0;
84
- transform: none;
72
+ ::slotted([slot='close-button']) {
73
+ flex: 0 0 auto;
74
+ margin-left: auto;
85
75
  }
86
76
 
87
- .tooltip.left.end,
88
- .tooltip.right.end {
89
- top: auto;
90
- bottom: 0;
91
- transform: none;
92
- }
93
- `, a = t`
94
77
  .arrow {
95
- width: 0;
96
- height: 0;
97
- border-style: solid;
98
78
  position: absolute;
79
+ z-index: var(--ds-z-index-tooltip, 1300);
99
80
  }
100
81
 
101
- .arrow.top {
102
- border-width: 5px 6px 0 6px;
103
- bottom: calc(100% + 9px);
104
- }
105
-
106
- .arrow.bottom {
107
- border-width: 0 6px 5px 6px;
108
- top: calc(100% + 9px);
109
- }
110
-
111
- .arrow.left {
112
- border-width: 6px 0 6px 5px;
113
- right: calc(100% + 9px);
82
+ .ds-tooltip-arrow-background {
83
+ fill: var(--ds-tooltip-arrow-background-color);
114
84
  }
115
85
 
116
- .arrow.right {
117
- border-width: 6px 5px 6px 0;
118
- left: calc(100% + 9px);
86
+ .ds-tooltip-arrow-border {
87
+ stroke: var(--ds-tooltip-arrow-border-color);
119
88
  }
120
89
 
121
- .arrow.top,
122
- .arrow.bottom {
123
- left: 50%;
124
- transform: translateX(-50%);
90
+ .anchor {
91
+ line-height: 0;
92
+ outline: none;
93
+ width: fit-content;
125
94
  }
126
95
 
127
- .arrow.left,
128
- .arrow.right {
129
- top: 50%;
130
- transform: translateY(-50%);
131
- }
132
-
133
- .arrow.top.start.not-positionable,
134
- .arrow.bottom.start.not-positionable {
135
- left: 6px;
136
- transform: none;
96
+ .top .arrow,
97
+ .top-start .arrow,
98
+ .top-end .arrow {
99
+ bottom: 0;
100
+ margin-bottom: -9px;
101
+ transform: rotate(180deg);
137
102
  }
138
103
 
139
- .arrow.top.end.not-positionable,
140
- .arrow.bottom.end.not-positionable {
141
- left: auto;
142
- right: 6px;
143
- transform: none;
104
+ .bottom .arrow,
105
+ .bottom-start .arrow,
106
+ .bottom-end .arrow {
107
+ top: 0;
108
+ margin-top: -9px;
109
+ transform: rotate(0deg);
144
110
  }
145
111
 
146
- .arrow.left.start.not-positionable,
147
- .arrow.right.start.not-positionable {
148
- top: 6px;
149
- transform: none;
112
+ .left .arrow,
113
+ .left-start .arrow,
114
+ .left-end .arrow {
115
+ right: 0;
116
+ margin-right: -9px;
117
+ transform: rotate(90deg);
150
118
  }
151
119
 
152
- .arrow.left.end.not-positionable,
153
- .arrow.right.end.not-positionable {
154
- top: auto;
155
- bottom: 6px;
156
- transform: none;
120
+ .right .arrow,
121
+ .right-start .arrow,
122
+ .right-end .arrow {
123
+ left: 0;
124
+ margin-left: -9px;
125
+ transform: rotate(270deg);
157
126
  }
158
127
  `;
159
128
  export {
160
- a as arrowStyles,
161
- e as commonStyles,
162
- p as tooltipStyles
129
+ i as commonStyles
163
130
  };