scb-wc-test 0.1.81 → 0.1.83
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/all.js +2 -0
- package/index.d.ts +1 -0
- package/index.js +25 -23
- package/mvc/components/all.js +1 -0
- package/mvc/components/scb-chip/scb-chip.js +2 -7
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +38 -27
- package/mvc/components/scb-textfield/scb-textfield.js +1 -1
- package/mvc/components/scb-toc/scb-toc-item.js +39 -24
- package/mvc/components/scb-toc/scb-toc.js +11 -4
- package/mvc/components/scb-tooltip/scb-tooltip.js +166 -185
- package/mvc/components/scb-viz/scb-viz.js +297 -0
- package/package.json +6 -2
- package/scb-chip/scb-chip.js +4 -9
- package/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +1 -0
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +81 -58
- package/scb-textfield/scb-textfield.d.ts +7 -2
- package/scb-textfield/scb-textfield.js +2 -2
- package/scb-toc/scb-toc-item.d.ts +5 -0
- package/scb-toc/scb-toc-item.js +63 -43
- package/scb-toc/scb-toc.d.ts +1 -0
- package/scb-toc/scb-toc.js +25 -12
- package/scb-tooltip/scb-tooltip.d.ts +32 -19
- package/scb-tooltip/scb-tooltip.js +396 -267
- package/scb-viz/scb-viz.d.ts +24 -0
- package/scb-viz/scb-viz.js +408 -0
- package/scb-wc-test.bundle.js +924 -619
|
@@ -1,328 +1,457 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as I, LitElement as N, html as T, nothing as V } from "lit";
|
|
2
|
+
import { property as c, customElement as j } from "lit/decorators.js";
|
|
3
3
|
import "../scb-button/scb-button.js";
|
|
4
4
|
import "@material/web/icon/icon.js";
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
(
|
|
8
|
-
return
|
|
5
|
+
var q = Object.defineProperty, X = Object.getOwnPropertyDescriptor, p = (t, e, s, r) => {
|
|
6
|
+
for (var i = r > 1 ? void 0 : r ? X(e, s) : e, g = t.length - 1, f; g >= 0; g--)
|
|
7
|
+
(f = t[g]) && (i = (r ? f(e, s, i) : f(i)) || i);
|
|
8
|
+
return r && i && q(e, s, i), i;
|
|
9
9
|
};
|
|
10
|
-
let
|
|
10
|
+
let Y = 0, l = class extends N {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(...arguments), this.variant = "plain", this.arrow = null, this.supportingtext = "", this.label = "", this.trigger = "hover", this.position = "top", this.open = !1, this.delay = 1, this.offset = 0, this._hoverActive = !1, this._clickActive = !1, this._hideTimeout = null, this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
super(...arguments), this.variant = "plain", this.arrow = null, this.supportingtext = "", this.label = "", this.trigger = "hover", this.position = "top", this.open = !1, this.delay = 1, this.offset = 0, this._hoverActive = !1, this._clickActive = !1, this._hideTimeout = null, this._triggerEl = null, this._originalPosition = "top", this._tooltipId = `scb-tooltip-${++Y}`, this._onTriggerMouseEnter = () => {
|
|
13
|
+
this._hoverActive = !0, this.open = !0;
|
|
14
|
+
}, this._onTriggerMouseLeave = () => {
|
|
15
|
+
this._hoverActive = !1, this._clickActive || (this.open = !1);
|
|
16
|
+
}, this._onTriggerFocus = () => {
|
|
17
|
+
this._hoverActive = !0, this.open = !0;
|
|
18
|
+
}, this._onTriggerBlur = () => {
|
|
19
|
+
this._hoverActive = !1, this._clickActive || (this.open = !1);
|
|
20
|
+
}, this._onTriggerClick = () => {
|
|
21
|
+
this._clickActive = !this._clickActive, this._clickActive ? this.open = !0 : this._hoverActive || (this.open = !1);
|
|
16
22
|
};
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return this.variant === "rich" ? h`
|
|
23
|
-
<div class="scb-tooltip hidden" role="tooltip" aria-label=${this.label || this.supportingtext}>
|
|
24
|
-
<div class="scb-tooltip-text-container">
|
|
25
|
-
<label class="scb-tooltip-label">${this.label}</label>
|
|
26
|
-
<span class="scb-tooltip-supporting-text">${this.supportingtext}</span>
|
|
27
|
-
</div>
|
|
28
|
-
<div class="scb-tooltip-button-container">
|
|
29
|
-
<slot name="scb-tooltip-button"></slot>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
<slot> </slot>
|
|
33
|
-
` : h`
|
|
34
|
-
<div class="scb-tooltip hidden">
|
|
35
|
-
<div class="scb-tooltip-container">
|
|
36
|
-
<span class="scb-tooltip-supporting-text">${this.supportingtext}</span>
|
|
37
|
-
</div>
|
|
38
|
-
${t}
|
|
39
|
-
</div>
|
|
40
|
-
<slot> </slot>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
24
|
+
/*
|
|
25
|
+
firstUpdated körs när komponenten är mountad och har renderat första gången.
|
|
26
|
+
Här sätter vi upp delay-css, hittar anchor och visar tooltip om open redan är true.
|
|
27
|
+
*/
|
|
43
28
|
firstUpdated() {
|
|
44
|
-
|
|
29
|
+
if (this._originalPosition = this.position, this._updateDelayCss(), this._updateTriggerElement(), this.open) {
|
|
30
|
+
const t = this._getTooltipElement();
|
|
31
|
+
t && this._showTooltip(t);
|
|
32
|
+
}
|
|
45
33
|
}
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
/*
|
|
35
|
+
updated reagerar på ändrade properties.
|
|
36
|
+
- trigger: vi måste koppla om event listener på anchor
|
|
37
|
+
- delay: uppdatera CSS-variabeln
|
|
38
|
+
- open: visa eller göm tooltipen programatiskt
|
|
39
|
+
*/
|
|
40
|
+
updated(t) {
|
|
41
|
+
if (t.has("trigger") && this._updateTriggerElement(), t.has("delay") && this._updateDelayCss(), t.has("open")) {
|
|
42
|
+
const e = this._getTooltipElement();
|
|
43
|
+
if (!e)
|
|
44
|
+
return;
|
|
45
|
+
this.open ? this._showTooltip(e) : this._hideTooltip(e);
|
|
46
|
+
}
|
|
48
47
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
/*
|
|
49
|
+
När komponenten tas bort från DOM städar vi upp event listeners och eventuella timeouts.
|
|
50
|
+
*/
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
super.disconnectedCallback(), this._detachTriggerListeners(), this._hideTimeout !== null && (window.clearTimeout(this._hideTimeout), this._hideTimeout = null);
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
/*
|
|
55
|
+
Hämtar själva tooltip-elementet inifrån shadow DOM.
|
|
56
|
+
Används av show/hide-metoderna.
|
|
57
|
+
*/
|
|
58
|
+
_getTooltipElement() {
|
|
59
|
+
return this.renderRoot.querySelector(".scb-tooltip");
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
/*
|
|
62
|
+
Synkar property delay mot CSS-variabeln som styr transition length.
|
|
63
|
+
*/
|
|
64
|
+
_updateDelayCss() {
|
|
65
|
+
const t = Number.isFinite(this.delay) ? this.delay : 1;
|
|
66
|
+
this.style.setProperty("--delay", `${t}s`);
|
|
58
67
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
/*
|
|
69
|
+
Hittar anchor element:
|
|
70
|
+
- först: ett element med attributet scb-tooltip-button som inte ligger i en named slot
|
|
71
|
+
- annars: första barn-elementet i light DOM
|
|
72
|
+
*/
|
|
73
|
+
_findTriggerElement() {
|
|
74
|
+
const t = this.querySelector(
|
|
75
|
+
"[scb-tooltip-button]:not([slot])"
|
|
76
|
+
);
|
|
77
|
+
return t || (Array.from(this.children).find(
|
|
78
|
+
(s) => s.nodeType === Node.ELEMENT_NODE
|
|
79
|
+
) ?? null);
|
|
67
80
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
/*
|
|
82
|
+
Kopplar event listener till aktuellt anchor element baserat på trigger.
|
|
83
|
+
Tar alltid bort gamla listeners innan nya läggs på.
|
|
84
|
+
*/
|
|
85
|
+
_updateTriggerElement() {
|
|
86
|
+
const t = this._triggerEl;
|
|
87
|
+
t && (this._detachTriggerListeners(), t.removeAttribute("aria-describedby"));
|
|
88
|
+
const e = this._findTriggerElement();
|
|
89
|
+
this._triggerEl = e, e && (e.setAttribute("aria-describedby", this._tooltipId), (this.trigger === "click" || this.trigger === "hover-click") && e.addEventListener("click", this._onTriggerClick), (this.trigger === "hover" || this.trigger === "hover-click") && (e.addEventListener("mouseenter", this._onTriggerMouseEnter), e.addEventListener("mouseleave", this._onTriggerMouseLeave), e.addEventListener("focus", this._onTriggerFocus), e.addEventListener("blur", this._onTriggerBlur)));
|
|
71
90
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
91
|
+
/*
|
|
92
|
+
Tar bort alla listeners från nuvarande anchor elment.
|
|
93
|
+
Både när trigger ändras och när komponenten detachas.
|
|
94
|
+
*/
|
|
95
|
+
_detachTriggerListeners() {
|
|
96
|
+
const t = this._triggerEl;
|
|
97
|
+
t && (t.removeEventListener("click", this._onTriggerClick), t.removeEventListener("mouseenter", this._onTriggerMouseEnter), t.removeEventListener("mouseleave", this._onTriggerMouseLeave), t.removeEventListener("focus", this._onTriggerFocus), t.removeEventListener("blur", this._onTriggerBlur));
|
|
75
98
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
99
|
+
/*
|
|
100
|
+
Visar tooltipen:
|
|
101
|
+
- stoppar eventuell pågående hide-timeout
|
|
102
|
+
- återställer positionen till ursprungsposition
|
|
103
|
+
- gör tooltipen synlig och sätter open-attribut
|
|
104
|
+
- positionerar tooltipen mot anchor i nästa animation frame
|
|
105
|
+
*/
|
|
106
|
+
_showTooltip(t) {
|
|
107
|
+
this._hideTimeout !== null && (window.clearTimeout(this._hideTimeout), this._hideTimeout = null);
|
|
108
|
+
const e = this._triggerEl;
|
|
109
|
+
this._resetPosition(), t.classList.remove("hidden"), t.setAttribute("aria-hidden", "false"), requestAnimationFrame(() => {
|
|
110
|
+
e && this._positionTooltip(t, e), t.setAttribute("open", "");
|
|
111
|
+
});
|
|
79
112
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
113
|
+
/*
|
|
114
|
+
Gömmer tooltipen och schemalägger eventuell fördröjd hiding via CSS-klassen hidden.
|
|
115
|
+
*/
|
|
116
|
+
_hideTooltip(t) {
|
|
117
|
+
t.removeAttribute("open"), t.setAttribute("aria-hidden", "true"), this._scheduleHidden(t);
|
|
118
|
+
}
|
|
119
|
+
/*
|
|
120
|
+
Hanterar fördröjd hide av tooltip:
|
|
121
|
+
- delay <= 0: göm direkt
|
|
122
|
+
- annars: vänta delay sekunder och lägg på klassen hidden
|
|
123
|
+
*/
|
|
124
|
+
_scheduleHidden(t) {
|
|
125
|
+
const e = (Number.isFinite(this.delay) ? this.delay : 1) * 1e3;
|
|
126
|
+
if (e <= 0) {
|
|
127
|
+
t.classList.add("hidden");
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
83
130
|
this._hideTimeout = window.setTimeout(() => {
|
|
84
131
|
t.classList.add("hidden"), this._hideTimeout = null;
|
|
85
|
-
},
|
|
132
|
+
}, e);
|
|
86
133
|
}
|
|
87
|
-
|
|
88
|
-
|
|
134
|
+
/*
|
|
135
|
+
Återställer positionen till ursprungspositionen innan ny layoutberäkning.
|
|
136
|
+
Används varje gång tooltipen ska visas.
|
|
137
|
+
*/
|
|
138
|
+
_resetPosition() {
|
|
139
|
+
this.position = this._originalPosition;
|
|
89
140
|
}
|
|
90
|
-
|
|
91
|
-
|
|
141
|
+
/*
|
|
142
|
+
Beräknar den faktiska positionen för tooltipen i viewporten:
|
|
143
|
+
- utgår från önskad position
|
|
144
|
+
- testar alternativ om den inte får plats
|
|
145
|
+
- Klampar in resultatet mot viewportens kanter
|
|
146
|
+
- uppdaterar host-attributet position när vi byter sida
|
|
147
|
+
*/
|
|
148
|
+
_positionTooltip(t, e) {
|
|
149
|
+
const s = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = this.getBoundingClientRect(), u = (this.offset ?? 0) + 8, v = 8, y = v, _ = window.innerHeight - v, w = v, x = window.innerWidth - v, M = (o) => o >= y && o + r.height <= _, P = (o) => o >= w && o + r.width <= x, E = (o, n, a, d) => {
|
|
150
|
+
let h = 0;
|
|
151
|
+
o < a && (h += a - o);
|
|
152
|
+
const b = o + n;
|
|
153
|
+
return b > d && (h += b - d), h;
|
|
154
|
+
}, $ = (o) => {
|
|
155
|
+
let n = 0, a = 0;
|
|
156
|
+
switch (o) {
|
|
157
|
+
case "top":
|
|
158
|
+
n = s.top - i.top - r.height - u, a = s.left - i.left + (s.width - r.width) / 2;
|
|
159
|
+
break;
|
|
160
|
+
case "bottom":
|
|
161
|
+
n = s.bottom - i.top + u, a = s.left - i.left + (s.width - r.width) / 2;
|
|
162
|
+
break;
|
|
163
|
+
case "left":
|
|
164
|
+
a = s.left - i.left - r.width - u, n = s.top - i.top + (s.height - r.height) / 2;
|
|
165
|
+
break;
|
|
166
|
+
case "right":
|
|
167
|
+
a = s.right - i.left + u, n = s.top - i.top + (s.height - r.height) / 2;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
const d = n + i.top, h = a + i.left, b = E(
|
|
171
|
+
d,
|
|
172
|
+
r.height,
|
|
173
|
+
y,
|
|
174
|
+
_
|
|
175
|
+
), F = E(
|
|
176
|
+
h,
|
|
177
|
+
r.width,
|
|
178
|
+
w,
|
|
179
|
+
x
|
|
180
|
+
);
|
|
181
|
+
return {
|
|
182
|
+
pos: o,
|
|
183
|
+
top: n,
|
|
184
|
+
left: a,
|
|
185
|
+
fitsV: M(d),
|
|
186
|
+
fitsH: P(h),
|
|
187
|
+
totalOverflow: b + F
|
|
188
|
+
};
|
|
189
|
+
}, L = this.position === "top" || this.position === "bottom", k = this.position, O = this._getOppositePosition(k), A = [k, O, L ? "left" : "top", L ? "right" : "bottom"].map($);
|
|
190
|
+
let m = A.find((o) => o.fitsV && o.fitsH) ?? A.reduce(
|
|
191
|
+
(o, n) => n.totalOverflow < o.totalOverflow ? n : o
|
|
192
|
+
);
|
|
193
|
+
const C = (o, n, a) => Math.min(Math.max(o, n), a), S = y - i.top, B = _ - r.height - i.top, D = w - i.left, z = x - r.width - i.left, H = C(m.top, S, B), R = C(m.left, D, z);
|
|
194
|
+
t.style.top = `${H}px`, t.style.left = `${R}px`, this.position !== m.pos && (this.position = m.pos);
|
|
195
|
+
}
|
|
196
|
+
/*
|
|
197
|
+
Hjälpfunktion som ger motsatt position för en given riktning.
|
|
198
|
+
*/
|
|
199
|
+
_getOppositePosition(t) {
|
|
200
|
+
switch (t) {
|
|
201
|
+
case "top":
|
|
202
|
+
return "bottom";
|
|
203
|
+
case "bottom":
|
|
204
|
+
return "top";
|
|
205
|
+
case "left":
|
|
206
|
+
return "right";
|
|
207
|
+
case "right":
|
|
208
|
+
return "left";
|
|
209
|
+
}
|
|
92
210
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
211
|
+
/*
|
|
212
|
+
När innehållet i standardslotten ändras försöker vi hitta anchor element igen
|
|
213
|
+
och kopplar om event listeners om det behövs.
|
|
214
|
+
*/
|
|
215
|
+
_onDefaultSlotChange() {
|
|
216
|
+
this._updateTriggerElement();
|
|
217
|
+
}
|
|
218
|
+
/*
|
|
219
|
+
Render-funktion:
|
|
220
|
+
- bygger tooltip-strukturen för plain eller richvarianten
|
|
221
|
+
- arrowTemplate styr om pilen ska renderas
|
|
222
|
+
- slotten används både som anchor (defaultslot) och för knappar inuti rich-tooltipen
|
|
223
|
+
*/
|
|
224
|
+
render() {
|
|
225
|
+
const t = this.arrow ? T`<svg
|
|
226
|
+
class="scb-tooltip-arrow"
|
|
227
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
228
|
+
width="13"
|
|
229
|
+
height="6"
|
|
230
|
+
viewBox="0 0 13 6"
|
|
231
|
+
fill="none"
|
|
232
|
+
>
|
|
233
|
+
<path
|
|
234
|
+
d="M6.5 6L0.5 0H12.5L6.5 6Z"
|
|
235
|
+
fill="var(--md-sys-color-inverse-surface, #0F0865)"
|
|
236
|
+
/>
|
|
237
|
+
</svg>` : V, e = this.label || this.supportingtext;
|
|
238
|
+
return this.variant === "rich" ? T`
|
|
239
|
+
<div
|
|
240
|
+
id=${this._tooltipId}
|
|
241
|
+
class="scb-tooltip hidden"
|
|
242
|
+
role="tooltip"
|
|
243
|
+
aria-label=${e}
|
|
244
|
+
aria-hidden="true"
|
|
245
|
+
>
|
|
246
|
+
<div class="scb-tooltip-text-container">
|
|
247
|
+
<label class="scb-tooltip-label">${this.label}</label>
|
|
248
|
+
<span class="scb-tooltip-supporting-text">
|
|
249
|
+
${this.supportingtext}
|
|
250
|
+
</span>
|
|
251
|
+
</div>
|
|
252
|
+
<div class="scb-tooltip-button-container">
|
|
253
|
+
<slot name="scb-tooltip-button"></slot>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
<slot @slotchange=${this._onDefaultSlotChange}></slot>
|
|
257
|
+
` : T`
|
|
258
|
+
<div
|
|
259
|
+
id=${this._tooltipId}
|
|
260
|
+
class="scb-tooltip hidden"
|
|
261
|
+
role="tooltip"
|
|
262
|
+
aria-label=${e}
|
|
263
|
+
aria-hidden="true"
|
|
264
|
+
>
|
|
265
|
+
<div class="scb-tooltip-container">
|
|
266
|
+
<span class="scb-tooltip-supporting-text">
|
|
267
|
+
${this.supportingtext}
|
|
268
|
+
</span>
|
|
269
|
+
</div>
|
|
270
|
+
${t}
|
|
271
|
+
</div>
|
|
272
|
+
<slot @slotchange=${this._onDefaultSlotChange}></slot>
|
|
273
|
+
`;
|
|
98
274
|
}
|
|
99
275
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
276
|
+
l.styles = I`
|
|
277
|
+
:host {
|
|
278
|
+
position: relative;
|
|
279
|
+
display: inline-block;
|
|
280
|
+
--delay: 1s;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.scb-tooltip {
|
|
284
|
+
position: absolute;
|
|
285
|
+
min-width: 120px;
|
|
286
|
+
max-width: 300px;
|
|
287
|
+
opacity: 0;
|
|
288
|
+
visibility: hidden;
|
|
289
|
+
z-index: 10;
|
|
290
|
+
transition:
|
|
291
|
+
opacity var(--delay) ease-in-out,
|
|
292
|
+
visibility var(--delay) ease-in-out;
|
|
293
|
+
}
|
|
108
294
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
295
|
+
.scb-tooltip[open] {
|
|
296
|
+
opacity: 1;
|
|
297
|
+
visibility: visible;
|
|
298
|
+
}
|
|
113
299
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
position-anchor: var(--anchorname);
|
|
118
|
-
position-area: var(--position);
|
|
119
|
-
min-width: 120px;
|
|
120
|
-
max-width: 300px;
|
|
121
|
-
transition: opacity var(--delay) ease-in-out;
|
|
122
|
-
z-index: 10;
|
|
123
|
-
opacity:0;
|
|
300
|
+
.hidden {
|
|
301
|
+
visibility: hidden;
|
|
302
|
+
}
|
|
124
303
|
|
|
125
304
|
.scb-tooltip-supporting-text {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
305
|
+
font-family: var(--brand-font, Inter);
|
|
306
|
+
font-size: var(--md-sys-typescale-body-small-size);
|
|
307
|
+
font-style: normal;
|
|
308
|
+
line-height: var(--md-sys-typescale-body-small-line-height);
|
|
309
|
+
letter-spacing: var(--md-sys-typescale-body-small-tracking);
|
|
132
310
|
}
|
|
133
311
|
|
|
134
|
-
|
|
135
|
-
|
|
312
|
+
::slotted([scb-tooltip-button]) {
|
|
313
|
+
display: inline-flex;
|
|
136
314
|
}
|
|
137
|
-
}
|
|
138
315
|
|
|
139
|
-
|
|
140
|
-
anchor-name: var(--anchorname);
|
|
141
|
-
display: inline-flex;
|
|
142
|
-
}
|
|
316
|
+
/* Plain variant */
|
|
143
317
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
transition: opacity var(--delay) ease-in-out;
|
|
148
|
-
opacity:0;
|
|
149
|
-
z-index: 10;
|
|
318
|
+
:host([variant='plain']) .scb-tooltip {
|
|
319
|
+
max-width: 184px;
|
|
320
|
+
}
|
|
150
321
|
|
|
151
|
-
.scb-tooltip-container {
|
|
322
|
+
:host([variant='plain']) .scb-tooltip-container {
|
|
152
323
|
display: inline-flex;
|
|
153
324
|
flex-direction: column;
|
|
154
325
|
justify-content: center;
|
|
155
326
|
align-items: center;
|
|
156
327
|
background: var(--md-sys-color-inverse-surface);
|
|
157
|
-
border-radius: var(--md-sys-shape-corner-extra-small);
|
|
158
|
-
min-height: 14px;
|
|
159
|
-
width: 100%;
|
|
160
|
-
|
|
161
|
-
.scb-tooltip-supporting-text {
|
|
162
|
-
padding: var(--spacing-2) var(--spacing-3);
|
|
163
|
-
color: var(--md-sys-color-inverse-on-surface);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
.scb-tooltip-arrow {
|
|
167
|
-
width: 12px;
|
|
168
|
-
height: 6px;
|
|
169
|
-
position: absolute;
|
|
170
|
-
left: 50%;
|
|
171
|
-
bottom: -5px;
|
|
172
|
-
transform: translateX(-50%) rotate(0deg);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/* Rich variant styles */
|
|
177
|
-
:host([variant="rich"]) {
|
|
178
|
-
align-items: flex-start;
|
|
179
|
-
gap: var(--spacing-2);
|
|
180
|
-
|
|
181
|
-
.scb-tooltip {
|
|
182
|
-
background: var(--md-sys-color-surface-container, #EBF8FF);
|
|
183
|
-
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.20), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 4px 5px 0 rgba(0, 0, 0, 0.14);
|
|
184
|
-
display: inline-flex;
|
|
185
|
-
padding-bottom: var(--spacing-3);
|
|
186
|
-
flex-direction: column;
|
|
187
|
-
align-items: flex-start;
|
|
188
|
-
gap: var(--spacing-3);
|
|
189
|
-
border-radius: var(--md-sys-shape-corner-medium);
|
|
190
|
-
min-width: 200px;
|
|
191
|
-
max-width: 300px;
|
|
192
|
-
opacity: 0;
|
|
193
|
-
z-index: 10;
|
|
194
|
-
transition: opacity var(--delay) ease-in-out;
|
|
195
|
-
|
|
196
|
-
.scb-tooltip-text-container {
|
|
197
|
-
display: flex;
|
|
198
|
-
min-width: 220px;
|
|
199
|
-
padding: var(--spacing-4) var(--spacing-5) var(--spacing-2) var(--spacing-5);
|
|
200
|
-
align-items: flex-start;
|
|
201
|
-
gap: var(--spacing-2);
|
|
202
|
-
flex-direction: column;
|
|
203
|
-
|
|
204
|
-
.scb-tooltip-supporting-text {
|
|
205
|
-
color: var(--md-sys-color-on-surface-variant, rgba(11, 5, 68, 0.75));
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.scb-tooltip-label {
|
|
209
|
-
font-family: var(--brand-font, Inter);
|
|
210
|
-
font-size: var(--md-sys-typescale-title-small-size);
|
|
211
|
-
font-style: normal;
|
|
212
|
-
font-weight: var(--weight-semibold);
|
|
213
|
-
line-height: var(--md-sys-typescale-title-small-Line-Height);
|
|
214
|
-
letter-spacing: var(--md-sys-typescale-title-small-Tracking);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.scb-tooltip-button-container {
|
|
220
|
-
display: flex;
|
|
221
|
-
padding: 0 var(--spacing-3);
|
|
222
|
-
align-items: center;
|
|
223
|
-
gap: var(--spacing-3);
|
|
224
|
-
align-self: stretch;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/* Postion styles */
|
|
229
|
-
:host([position="left"]) .scb-tooltip {
|
|
230
|
-
right: calc(anchor( left) + var(--offset));
|
|
231
|
-
align-self: center;
|
|
232
|
-
}
|
|
233
|
-
:host([position="right"]) .scb-tooltip {
|
|
234
|
-
left: calc(anchor(right) + var(--offset));
|
|
235
|
-
align-self: center;
|
|
236
|
-
}
|
|
328
|
+
border-radius: var(--md-sys-shape-corner-extra-small);
|
|
329
|
+
min-height: 14px;
|
|
330
|
+
width: 100%;
|
|
331
|
+
}
|
|
237
332
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
333
|
+
:host([variant='plain']) .scb-tooltip-supporting-text {
|
|
334
|
+
padding: var(--spacing-2) var(--spacing-3);
|
|
335
|
+
color: var(--md-sys-color-inverse-on-surface);
|
|
336
|
+
}
|
|
242
337
|
|
|
243
|
-
/* Plain tooltip arrow postions */
|
|
244
|
-
:host([position="top"][arrow]) .scb-tooltip {§
|
|
245
338
|
.scb-tooltip-arrow {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
339
|
+
width: 12px;
|
|
340
|
+
height: 6px;
|
|
341
|
+
position: absolute;
|
|
249
342
|
}
|
|
250
|
-
}
|
|
251
343
|
|
|
252
|
-
|
|
253
|
-
|
|
344
|
+
:host([position='top']) .scb-tooltip-arrow {
|
|
345
|
+
left: 50%;
|
|
346
|
+
bottom: -6px;
|
|
347
|
+
transform: translateX(-50%) rotate(0deg);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
:host([position='right']) .scb-tooltip-arrow {
|
|
254
351
|
left: -9px;
|
|
255
352
|
top: 50%;
|
|
256
353
|
transform: translateY(-50%) rotate(90deg);
|
|
257
354
|
}
|
|
258
|
-
}
|
|
259
355
|
|
|
260
|
-
:host([position=
|
|
261
|
-
.scb-tooltip-arrow {
|
|
356
|
+
:host([position='bottom']) .scb-tooltip-arrow {
|
|
262
357
|
left: 50%;
|
|
263
358
|
top: -6px;
|
|
264
359
|
transform: translateX(-50%) rotate(180deg);
|
|
265
360
|
}
|
|
266
|
-
}
|
|
267
361
|
|
|
268
|
-
:host([
|
|
269
|
-
.scb-tooltip-arrow{
|
|
362
|
+
:host([position='left']) .scb-tooltip-arrow {
|
|
270
363
|
left: 100%;
|
|
271
364
|
top: 50%;
|
|
272
365
|
transform: translateY(-50%) translateX(-3px) rotate(270deg);
|
|
273
|
-
|
|
274
|
-
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
:host([variant='plain'][arrow='false']) .scb-tooltip-arrow {
|
|
369
|
+
display: none;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/* Rich variant */
|
|
373
|
+
|
|
374
|
+
:host([variant='rich']) {
|
|
375
|
+
align-items: flex-start;
|
|
376
|
+
gap: var(--spacing-2);
|
|
377
|
+
}
|
|
275
378
|
|
|
276
|
-
:host([variant=
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
379
|
+
:host([variant='rich']) .scb-tooltip {
|
|
380
|
+
background: var(--md-sys-color-surface-container, #ebf8ff);
|
|
381
|
+
box-shadow:
|
|
382
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.2),
|
|
383
|
+
0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
384
|
+
0 4px 5px 0 rgba(0, 0, 0, 0.14);
|
|
385
|
+
display: inline-flex;
|
|
386
|
+
padding-bottom: var(--spacing-3);
|
|
387
|
+
flex-direction: column;
|
|
388
|
+
align-items: flex-start;
|
|
389
|
+
gap: var(--spacing-3);
|
|
390
|
+
border-radius: var(--md-sys-shape-corner-medium);
|
|
391
|
+
min-width: 200px;
|
|
392
|
+
max-width: 300px;
|
|
393
|
+
}
|
|
281
394
|
|
|
282
|
-
|
|
283
|
-
:
|
|
284
|
-
:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
395
|
+
:host([variant='rich']) .scb-tooltip-text-container {
|
|
396
|
+
display: flex;
|
|
397
|
+
min-width: 220px;
|
|
398
|
+
padding: var(--spacing-4) var(--spacing-5) var(--spacing-2) var(--spacing-5);
|
|
399
|
+
align-items: flex-start;
|
|
400
|
+
gap: var(--spacing-2);
|
|
401
|
+
flex-direction: column;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
:host([variant='rich']) .scb-tooltip-label {
|
|
405
|
+
font-family: var(--brand-font, Inter);
|
|
406
|
+
font-size: var(--md-sys-typescale-title-small-size);
|
|
407
|
+
font-style: normal;
|
|
408
|
+
font-weight: var(--weight-semibold);
|
|
409
|
+
line-height: var(--md-sys-typescale-title-small-Line-Height);
|
|
410
|
+
letter-spacing: var(--md-sys-typescale-title-small-Tracking);
|
|
411
|
+
}
|
|
288
412
|
|
|
289
|
-
:host([variant=
|
|
290
|
-
:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
413
|
+
:host([variant='rich']) .scb-tooltip-supporting-text {
|
|
414
|
+
color: var(--md-sys-color-on-surface-variant, rgba(11, 5, 68, 0.75));
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
:host([variant='rich']) .scb-tooltip-button-container {
|
|
418
|
+
display: flex;
|
|
419
|
+
padding: 0 var(--spacing-3);
|
|
420
|
+
align-items: center;
|
|
421
|
+
gap: var(--spacing-3);
|
|
422
|
+
align-self: stretch;
|
|
423
|
+
}
|
|
424
|
+
`;
|
|
425
|
+
p([
|
|
426
|
+
c({ type: String, reflect: !0 })
|
|
427
|
+
], l.prototype, "variant", 2);
|
|
428
|
+
p([
|
|
429
|
+
c({ type: Boolean, reflect: !0 })
|
|
430
|
+
], l.prototype, "arrow", 2);
|
|
431
|
+
p([
|
|
432
|
+
c({ type: String, attribute: "supporting-text" })
|
|
433
|
+
], l.prototype, "supportingtext", 2);
|
|
434
|
+
p([
|
|
435
|
+
c({ type: String })
|
|
436
|
+
], l.prototype, "label", 2);
|
|
437
|
+
p([
|
|
438
|
+
c({ type: String, reflect: !0 })
|
|
439
|
+
], l.prototype, "trigger", 2);
|
|
440
|
+
p([
|
|
441
|
+
c({ type: String, reflect: !0 })
|
|
442
|
+
], l.prototype, "position", 2);
|
|
443
|
+
p([
|
|
444
|
+
c({ type: Boolean, reflect: !0 })
|
|
445
|
+
], l.prototype, "open", 2);
|
|
446
|
+
p([
|
|
447
|
+
c({ type: Number, reflect: !0 })
|
|
448
|
+
], l.prototype, "delay", 2);
|
|
449
|
+
p([
|
|
450
|
+
c({ type: Number, reflect: !0 })
|
|
451
|
+
], l.prototype, "offset", 2);
|
|
452
|
+
l = p([
|
|
453
|
+
j("scb-tooltip")
|
|
454
|
+
], l);
|
|
326
455
|
export {
|
|
327
|
-
|
|
456
|
+
l as ScbTooltip
|
|
328
457
|
};
|