@lofid/web 1.1.0 → 1.1.1
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/custom-elements.json +3 -3
- package/dist/index.d.ts +18 -1
- package/dist/index.js +155 -29
- package/dist/index.js.map +1 -1
- package/dist/styles/motion.css +1 -1
- package/dist/styles/typography.css +1 -1
- package/dist/styles/typography.json +1 -1
- package/dist/styles/vars.css +16 -16
- package/package.json +2 -2
- package/readmes/lof-avatar/README.md +2 -1
- package/readmes/lof-button/README.md +2 -2
- package/readmes/lof-chip/README.md +142 -142
- package/readmes/lof-pagination/README.md +141 -141
- package/readmes/lof-select/README.md +2 -2
- package/readmes/lof-stat/README.md +1 -1
- package/readmes/lof-textfield/README.md +2 -2
package/custom-elements.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"readme": "README.md",
|
|
4
4
|
"package": {
|
|
5
5
|
"name": "@lofid/web",
|
|
6
|
-
"version": "1.1.
|
|
6
|
+
"version": "1.1.1"
|
|
7
7
|
},
|
|
8
8
|
"modules": [
|
|
9
9
|
{
|
|
@@ -9619,7 +9619,7 @@
|
|
|
9619
9619
|
{
|
|
9620
9620
|
"kind": "field",
|
|
9621
9621
|
"name": "trend",
|
|
9622
|
-
"description": "
|
|
9622
|
+
"description": "Whether the change is good (up: green), bad (down: red) or neutral. Default: from the sign of `change`. It sets the colour only: the arrow always follows the change itself, so a refund rate that falls can be green with a down arrow (`change=\"−0.4 pts\" trend=\"up\"`).",
|
|
9623
9623
|
"type": {
|
|
9624
9624
|
"text": "StatTrend"
|
|
9625
9625
|
},
|
|
@@ -9678,7 +9678,7 @@
|
|
|
9678
9678
|
"type": {
|
|
9679
9679
|
"text": "StatTrend"
|
|
9680
9680
|
},
|
|
9681
|
-
"description": "
|
|
9681
|
+
"description": "Whether the change is good (up: green), bad (down: red) or neutral. Default: from the sign of `change`. It sets the colour only: the arrow always follows the change itself, so a refund rate that falls can be green with a down arrow (`change=\"−0.4 pts\" trend=\"up\"`)."
|
|
9682
9682
|
},
|
|
9683
9683
|
{
|
|
9684
9684
|
"name": "change-label",
|
package/dist/index.d.ts
CHANGED
|
@@ -2468,7 +2468,11 @@ declare class LofStat extends LofElement {
|
|
|
2468
2468
|
label: string;
|
|
2469
2469
|
/** Trend text ("+2.7%"); renders the trend chip. */
|
|
2470
2470
|
change: string;
|
|
2471
|
-
/**
|
|
2471
|
+
/**
|
|
2472
|
+
* Whether the change is good (up: green), bad (down: red) or neutral. Default: from the sign of `change`.
|
|
2473
|
+
* It sets the colour only: the arrow always follows the change itself, so a refund rate that falls
|
|
2474
|
+
* can be green with a down arrow (`change="−0.4 pts" trend="up"`).
|
|
2475
|
+
*/
|
|
2472
2476
|
trend?: StatTrend;
|
|
2473
2477
|
/** Spoken direction words, e.g. "up 2.7% from last month". Default: "increase" / "decrease". */
|
|
2474
2478
|
changeLabel: string;
|
|
@@ -2476,6 +2480,9 @@ declare class LofStat extends LofElement {
|
|
|
2476
2480
|
appearance: StatAppearance;
|
|
2477
2481
|
private hasIcon;
|
|
2478
2482
|
private hasFooter;
|
|
2483
|
+
/** Which way the number moved, read from `change`: its sign, or the words lower / higher. */
|
|
2484
|
+
private get movement();
|
|
2485
|
+
/** Good / bad colour: `trend` when set, otherwise the movement. */
|
|
2479
2486
|
private get direction();
|
|
2480
2487
|
render(): lit_html.TemplateResult<1>;
|
|
2481
2488
|
}
|
|
@@ -2517,6 +2524,14 @@ declare class LofStepper extends LofElement {
|
|
|
2517
2524
|
private activate;
|
|
2518
2525
|
private onKeydown;
|
|
2519
2526
|
private indicatorContent;
|
|
2527
|
+
private resizeObserver?;
|
|
2528
|
+
connectedCallback(): void;
|
|
2529
|
+
disconnectedCallback(): void;
|
|
2530
|
+
protected updated(): void;
|
|
2531
|
+
/** Horizontal rows that overflow even with short connectors drop to compact titles. */
|
|
2532
|
+
private fit;
|
|
2533
|
+
/** The step whose title stays visible in compact rows. */
|
|
2534
|
+
private get current();
|
|
2520
2535
|
render(): lit_html.TemplateResult<1>;
|
|
2521
2536
|
}
|
|
2522
2537
|
declare global {
|
|
@@ -2903,6 +2918,8 @@ declare class LofTooltip extends LofElement {
|
|
|
2903
2918
|
*/
|
|
2904
2919
|
private onDocKeydown;
|
|
2905
2920
|
private onEnter;
|
|
2921
|
+
/** Shifts a bubble that would cross the viewport edge back inside it (8px margin). */
|
|
2922
|
+
private keepInView;
|
|
2906
2923
|
private onLeave;
|
|
2907
2924
|
private reset;
|
|
2908
2925
|
/** The text reaches screen readers as the focused control's description. */
|
package/dist/index.js
CHANGED
|
@@ -1027,8 +1027,11 @@ LofTextfield.styles = [
|
|
|
1027
1027
|
letter-spacing: var(--lof-body-field-label-letter-spacing);
|
|
1028
1028
|
}
|
|
1029
1029
|
.required-mark { color: var(--lof-text-danger); }
|
|
1030
|
-
/* no label above (none / floating):
|
|
1031
|
-
|
|
1030
|
+
/* no label above (none / floating): nothing is held by default, so a search
|
|
1031
|
+
field lines up with the buttons beside it. A form row that mixes labelled and
|
|
1032
|
+
unlabelled fields opts in with --lof-field-label-reserve (label line-height
|
|
1033
|
+
+ 4px). The -4px margin cancels the .field gap, so 0 really is 0. */
|
|
1034
|
+
.reserve { height: var(--lof-field-label-reserve, 0px); margin-bottom: -4px; }
|
|
1032
1035
|
|
|
1033
1036
|
/* control box */
|
|
1034
1037
|
.control {
|
|
@@ -2499,7 +2502,7 @@ ${row.supporting}` : nothing5;
|
|
|
2499
2502
|
exportparts="label, control, input, helper, right-icon"
|
|
2500
2503
|
right-icon-aria-label="Clear"
|
|
2501
2504
|
variant=${this.variant}
|
|
2502
|
-
|
|
2505
|
+
.fullWidth=${this.fullWidth}
|
|
2503
2506
|
.label=${this.label}
|
|
2504
2507
|
.placeholder=${this.placeholder}
|
|
2505
2508
|
.value=${this.text}
|
|
@@ -2917,6 +2920,10 @@ LofAvatar.styles = css8`
|
|
|
2917
2920
|
text-transform: uppercase;
|
|
2918
2921
|
user-select: none;
|
|
2919
2922
|
}
|
|
2923
|
+
/* initials move off an edge something covers (an avatar group's overlap) */
|
|
2924
|
+
[part="label"] {
|
|
2925
|
+
margin-inline-end: var(--lof-avatar-label-inset-end, 0px);
|
|
2926
|
+
}
|
|
2920
2927
|
:host([variant="subtle"]) .avatar {
|
|
2921
2928
|
background-color: var(--lof-avatar-bg-subtle, var(--lof-bg-muted, var(--lof-bg-neutral-elevated-1)));
|
|
2922
2929
|
color: var(--lof-avatar-color-subtle, var(--lof-text-label));
|
|
@@ -3108,13 +3115,23 @@ LofAvatarGroup.styles = css9`
|
|
|
3108
3115
|
display: inline-flex;
|
|
3109
3116
|
vertical-align: middle;
|
|
3110
3117
|
--_overlap: 8px;
|
|
3118
|
+
--_d: 32px;
|
|
3111
3119
|
}
|
|
3112
3120
|
:host([hidden]) {
|
|
3113
3121
|
display: none;
|
|
3114
3122
|
}
|
|
3115
|
-
:host([size="large"]) { --_overlap: 10px; }
|
|
3116
|
-
:host([size="small"]) { --_overlap: 6px; }
|
|
3117
|
-
:host([size="extra-small"]) { --_overlap: 4px; }
|
|
3123
|
+
:host([size="large"]) { --_overlap: 10px; --_d: 40px; }
|
|
3124
|
+
:host([size="small"]) { --_overlap: 6px; --_d: 24px; }
|
|
3125
|
+
:host([size="extra-small"]) { --_overlap: 4px; --_d: 20px; }
|
|
3126
|
+
/* the next avatar covers the right edge: initials step down and centre in what stays visible
|
|
3127
|
+
(page styles on the avatar still win over ::slotted) */
|
|
3128
|
+
::slotted(lof-avatar[type="text"]) {
|
|
3129
|
+
--lof-avatar-font-size: max(10px, calc(var(--_d) * 0.38));
|
|
3130
|
+
--lof-avatar-label-inset-end: var(--lof-avatar-group-overlap, var(--_overlap));
|
|
3131
|
+
}
|
|
3132
|
+
::slotted(lof-avatar[type="text"]:last-child) {
|
|
3133
|
+
--lof-avatar-label-inset-end: 0px;
|
|
3134
|
+
}
|
|
3118
3135
|
.base {
|
|
3119
3136
|
display: inline-flex;
|
|
3120
3137
|
align-items: center;
|
|
@@ -8926,7 +8943,7 @@ var LofMenubar = class extends LofElement {
|
|
|
8926
8943
|
size="medium"
|
|
8927
8944
|
density="compact"
|
|
8928
8945
|
alignment="leading"
|
|
8929
|
-
|
|
8946
|
+
selected-value=${el.getAttribute("value") ?? ""}
|
|
8930
8947
|
.options=${options}
|
|
8931
8948
|
@lof-change=${(ev) => this.pickRadio(el, ev.detail.value)}
|
|
8932
8949
|
></lof-radio>`);
|
|
@@ -10293,7 +10310,8 @@ LofSelect.styles = [
|
|
|
10293
10310
|
font-weight: var(--lof-body-field-label-font-weight);
|
|
10294
10311
|
letter-spacing: var(--lof-body-field-label-letter-spacing);
|
|
10295
10312
|
}
|
|
10296
|
-
|
|
10313
|
+
/* no label above: nothing held unless a form row opts in (see lof-textfield) */
|
|
10314
|
+
.reserve { height: var(--lof-field-label-reserve, 0px); }
|
|
10297
10315
|
|
|
10298
10316
|
.trigger {
|
|
10299
10317
|
all: unset;
|
|
@@ -16309,16 +16327,21 @@ var LofStat = class extends LofElement {
|
|
|
16309
16327
|
this.hasIcon = false;
|
|
16310
16328
|
this.hasFooter = false;
|
|
16311
16329
|
}
|
|
16312
|
-
|
|
16313
|
-
|
|
16330
|
+
/** Which way the number moved, read from `change`: its sign, or the words lower / higher. */
|
|
16331
|
+
get movement() {
|
|
16314
16332
|
const t = this.change.trim();
|
|
16315
|
-
if (t.startsWith("-") || t.startsWith("\u2212")) return "down";
|
|
16316
|
-
if (t.startsWith("+")) return "up";
|
|
16333
|
+
if (t.startsWith("-") || t.startsWith("\u2212") || /\b(lower|down|less|fewer|decrease)\b/i.test(t)) return "down";
|
|
16334
|
+
if (t.startsWith("+") || /\b(higher|up|more|increase)\b/i.test(t)) return "up";
|
|
16317
16335
|
return "neutral";
|
|
16318
16336
|
}
|
|
16337
|
+
/** Good / bad colour: `trend` when set, otherwise the movement. */
|
|
16338
|
+
get direction() {
|
|
16339
|
+
return this.trend ?? this.movement;
|
|
16340
|
+
}
|
|
16319
16341
|
render() {
|
|
16320
16342
|
const dir = this.direction;
|
|
16321
|
-
const
|
|
16343
|
+
const move = this.movement === "neutral" ? dir : this.movement;
|
|
16344
|
+
const spoken = this.changeLabel || (move === "up" ? "increase" : move === "down" ? "decrease" : "change");
|
|
16322
16345
|
return html47`<div part="base" class="stat">
|
|
16323
16346
|
<div part="icon" class="icon" ?hidden=${!this.hasIcon}>
|
|
16324
16347
|
<slot name="icon" @slotchange=${(e) => this.hasIcon = e.target.assignedElements().length > 0}></slot>
|
|
@@ -16327,7 +16350,7 @@ var LofStat = class extends LofElement {
|
|
|
16327
16350
|
<div class="row">
|
|
16328
16351
|
<p part="value" class="value">${this.value}<slot name="value"></slot></p>
|
|
16329
16352
|
${this.change ? html47`<span part="trend" class="trend ${dir}"
|
|
16330
|
-
>${
|
|
16353
|
+
>${move === "neutral" ? nothing37 : html47`<svg viewBox="0 0 10 10" fill="none" aria-hidden="true"><path d=${move === "up" ? "M5 8.5V1.5M2 4.5l3-3 3 3" : "M5 1.5v7M2 5.5l3 3 3-3"} stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" /></svg>`}<span class="sr-only">${spoken}: </span>${this.change}</span
|
|
16331
16354
|
>` : nothing37}
|
|
16332
16355
|
</div>
|
|
16333
16356
|
${this.label ? html47`<p part="label" class="label">${this.label}</p>` : nothing37}
|
|
@@ -16519,14 +16542,50 @@ var LofStepper = class extends LofElement {
|
|
|
16519
16542
|
return step.status === "done" ? check : html48`<span>${i + 1}</span>`;
|
|
16520
16543
|
}
|
|
16521
16544
|
}
|
|
16545
|
+
connectedCallback() {
|
|
16546
|
+
super.connectedCallback();
|
|
16547
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
16548
|
+
this.resizeObserver = new ResizeObserver(() => this.fit());
|
|
16549
|
+
this.resizeObserver.observe(this);
|
|
16550
|
+
}
|
|
16551
|
+
}
|
|
16552
|
+
disconnectedCallback() {
|
|
16553
|
+
this.resizeObserver?.disconnect();
|
|
16554
|
+
this.resizeObserver = void 0;
|
|
16555
|
+
super.disconnectedCallback();
|
|
16556
|
+
}
|
|
16557
|
+
updated() {
|
|
16558
|
+
this.fit();
|
|
16559
|
+
}
|
|
16560
|
+
/** Horizontal rows that overflow even with short connectors drop to compact titles. */
|
|
16561
|
+
fit() {
|
|
16562
|
+
const row = this.renderRoot.querySelector(".lof-stepper");
|
|
16563
|
+
if (!row) return;
|
|
16564
|
+
if (row.classList.contains("vertical")) {
|
|
16565
|
+
row.classList.remove("compact");
|
|
16566
|
+
return;
|
|
16567
|
+
}
|
|
16568
|
+
if (row.clientWidth === 0) return;
|
|
16569
|
+
row.classList.remove("compact");
|
|
16570
|
+
row.classList.toggle("compact", row.scrollWidth > row.clientWidth + 1);
|
|
16571
|
+
}
|
|
16572
|
+
/** The step whose title stays visible in compact rows. */
|
|
16573
|
+
get current() {
|
|
16574
|
+
const steps = this.list;
|
|
16575
|
+
const p = steps.findIndex((s) => s.status === "progress");
|
|
16576
|
+
if (p >= 0) return p;
|
|
16577
|
+
for (let i = steps.length - 1; i >= 0; i--) if (steps[i].status === "done") return i;
|
|
16578
|
+
return 0;
|
|
16579
|
+
}
|
|
16522
16580
|
render() {
|
|
16523
16581
|
const steps = this.list;
|
|
16524
16582
|
const n = steps.length;
|
|
16525
16583
|
const layout = this.layout;
|
|
16526
16584
|
const vertical = this.orientation === "vertical";
|
|
16585
|
+
const current = this.current;
|
|
16527
16586
|
const cls = ["lof-stepper", vertical ? "vertical" : "horizontal", layout, this.labelPlacement === "top" ? "label-top" : ""].filter(Boolean).join(" ");
|
|
16528
16587
|
return html48`
|
|
16529
|
-
<div class=${cls} role="group" aria-label="Progress steps">
|
|
16588
|
+
<div class=${cls} style="--_rest:${Math.max(0, n - 1)}" role="group" aria-label="Progress steps">
|
|
16530
16589
|
${steps.map((step, i) => {
|
|
16531
16590
|
const last = i === n - 1;
|
|
16532
16591
|
const disabled = step.status === "disabled";
|
|
@@ -16536,9 +16595,9 @@ var LofStepper = class extends LofElement {
|
|
|
16536
16595
|
const text = html48`<div part="label" class="step-label">${step.title}</div>
|
|
16537
16596
|
${step.subtitle ? html48`<div part="subtitle" class="step-subtitle">${step.subtitle}</div>` : nothing38}`;
|
|
16538
16597
|
const label = `${step.title}, step ${i + 1} of ${n}${step.status === "done" ? ", completed" : ""}`;
|
|
16539
|
-
const inner = vertical
|
|
16540
|
-
|
|
16541
|
-
class="lof-step ${step.status}"
|
|
16598
|
+
const inner = !vertical ? html48`${indicator}${text}` : layout === "text-right" ? html48`<div class="indicator-wrapper">${indicator}${conn}</div>${text}` : html48`${indicator}${text}${conn}`;
|
|
16599
|
+
const stepEl = html48`<div
|
|
16600
|
+
class="lof-step ${step.status} ${i === current ? "current" : ""}"
|
|
16542
16601
|
role="button"
|
|
16543
16602
|
tabindex=${disabled ? "-1" : "0"}
|
|
16544
16603
|
aria-label=${label}
|
|
@@ -16549,6 +16608,7 @@ var LofStepper = class extends LofElement {
|
|
|
16549
16608
|
>
|
|
16550
16609
|
${inner}
|
|
16551
16610
|
</div>`;
|
|
16611
|
+
return vertical ? stepEl : html48`${stepEl}${conn}`;
|
|
16552
16612
|
})}
|
|
16553
16613
|
</div>
|
|
16554
16614
|
`;
|
|
@@ -16569,12 +16629,21 @@ LofStepper.styles = [
|
|
|
16569
16629
|
display: flex;
|
|
16570
16630
|
color: var(--lof-text-default);
|
|
16571
16631
|
--_len: var(--lof-stepper-connector-length, 96px);
|
|
16632
|
+
--_mark: var(--_ind);
|
|
16572
16633
|
}
|
|
16634
|
+
:host([type="dot"]) .lof-stepper {
|
|
16635
|
+
--_mark: 10px;
|
|
16636
|
+
}
|
|
16637
|
+
/* horizontal: connectors sit between the steps and give up length first, so the
|
|
16638
|
+
row fits its container; when even short connectors don't fit, .compact keeps
|
|
16639
|
+
only the current step's title (the others stay in each step's aria-label) */
|
|
16573
16640
|
.lof-stepper.horizontal {
|
|
16574
16641
|
flex-direction: row;
|
|
16575
16642
|
align-items: flex-start;
|
|
16576
16643
|
justify-content: center;
|
|
16577
|
-
|
|
16644
|
+
justify-content: safe center;
|
|
16645
|
+
gap: 12px;
|
|
16646
|
+
min-inline-size: 0;
|
|
16578
16647
|
}
|
|
16579
16648
|
.lof-stepper.vertical {
|
|
16580
16649
|
flex-direction: column;
|
|
@@ -16605,7 +16674,26 @@ LofStepper.styles = [
|
|
|
16605
16674
|
cursor: not-allowed;
|
|
16606
16675
|
}
|
|
16607
16676
|
.horizontal .lof-step {
|
|
16608
|
-
flex:
|
|
16677
|
+
flex: none;
|
|
16678
|
+
}
|
|
16679
|
+
.compact .lof-step:not(.current) .step-label,
|
|
16680
|
+
.compact .lof-step:not(.current) .step-subtitle {
|
|
16681
|
+
display: none;
|
|
16682
|
+
}
|
|
16683
|
+
/* the current title may still be too long for a very narrow row: it gets what
|
|
16684
|
+
is left after the other indicators, 16px connectors and the 12px gaps
|
|
16685
|
+
(--_rest is the number of other steps) */
|
|
16686
|
+
.compact .lof-step.current {
|
|
16687
|
+
flex: none;
|
|
16688
|
+
max-inline-size: max(var(--_mark), calc(100% - var(--_rest, 0) * (var(--_mark) + 40px)));
|
|
16689
|
+
}
|
|
16690
|
+
.compact .lof-step.current .step-label,
|
|
16691
|
+
.compact .lof-step.current .step-subtitle {
|
|
16692
|
+
min-inline-size: 0;
|
|
16693
|
+
max-inline-size: 100%;
|
|
16694
|
+
overflow: hidden;
|
|
16695
|
+
text-overflow: ellipsis;
|
|
16696
|
+
white-space: nowrap;
|
|
16609
16697
|
}
|
|
16610
16698
|
.text-below .lof-step {
|
|
16611
16699
|
flex-direction: column;
|
|
@@ -16666,8 +16754,8 @@ LofStepper.styles = [
|
|
|
16666
16754
|
color: var(--lof-accent-foreground);
|
|
16667
16755
|
}
|
|
16668
16756
|
:host([type="dot"]) .indicator {
|
|
16669
|
-
width:
|
|
16670
|
-
height:
|
|
16757
|
+
width: var(--_mark);
|
|
16758
|
+
height: var(--_mark);
|
|
16671
16759
|
}
|
|
16672
16760
|
:host([type="dot"]) .progress .indicator { box-shadow: 0 0 0 3px var(--lof-focus-halo, transparent); }
|
|
16673
16761
|
/* upcoming / unavailable steps recede in colour, not opacity, so they stay legible */
|
|
@@ -16726,14 +16814,19 @@ LofStepper.styles = [
|
|
|
16726
16814
|
.vertical .connector.dashed.strong {
|
|
16727
16815
|
background: repeating-linear-gradient(to bottom, var(--lof-accent) 0, var(--lof-accent) 2px, transparent 2px, transparent 4px);
|
|
16728
16816
|
}
|
|
16729
|
-
/* horizontal:
|
|
16817
|
+
/* horizontal: a flex item between two steps, at half the row's height; it is
|
|
16818
|
+
--_len long when there is room and shrinks to 16px before the row overflows */
|
|
16730
16819
|
.horizontal .connector {
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
16820
|
+
position: relative;
|
|
16821
|
+
flex: 0 1 var(--_len);
|
|
16822
|
+
min-inline-size: 16px;
|
|
16734
16823
|
height: 2px;
|
|
16735
|
-
|
|
16736
|
-
|
|
16824
|
+
align-self: center;
|
|
16825
|
+
}
|
|
16826
|
+
/* compact rows are mostly bare indicators: line up with their centres */
|
|
16827
|
+
.horizontal.compact .connector {
|
|
16828
|
+
align-self: flex-start;
|
|
16829
|
+
margin-top: calc(var(--_mark) / 2 - 1px);
|
|
16737
16830
|
}
|
|
16738
16831
|
/* vertical, label beside: from under the indicator */
|
|
16739
16832
|
.vertical.text-right .connector {
|
|
@@ -19120,6 +19213,7 @@ var LofTooltip = class extends LofElement {
|
|
|
19120
19213
|
};
|
|
19121
19214
|
this.onEnter = () => {
|
|
19122
19215
|
this.hovered = true;
|
|
19216
|
+
this.keepInView();
|
|
19123
19217
|
};
|
|
19124
19218
|
this.onLeave = () => {
|
|
19125
19219
|
this.hovered = false;
|
|
@@ -19130,6 +19224,7 @@ var LofTooltip = class extends LofElement {
|
|
|
19130
19224
|
};
|
|
19131
19225
|
/** The text reaches screen readers as the focused control's description. */
|
|
19132
19226
|
this.onFocusIn = () => {
|
|
19227
|
+
this.keepInView();
|
|
19133
19228
|
let a = document.activeElement;
|
|
19134
19229
|
while (a?.shadowRoot?.activeElement) a = a.shadowRoot.activeElement;
|
|
19135
19230
|
if (a && a !== this) this.describe(a);
|
|
@@ -19151,6 +19246,22 @@ var LofTooltip = class extends LofElement {
|
|
|
19151
19246
|
this.removeEventListener("focusin", this.onFocusIn);
|
|
19152
19247
|
this.removeEventListener("focusout", this.reset);
|
|
19153
19248
|
}
|
|
19249
|
+
/** Shifts a bubble that would cross the viewport edge back inside it (8px margin). */
|
|
19250
|
+
keepInView() {
|
|
19251
|
+
const b = this.renderRoot.querySelector(".tooltip-bubble");
|
|
19252
|
+
if (!b || this.position === "left" || this.position === "right") return;
|
|
19253
|
+
b.style.removeProperty("--_nudge");
|
|
19254
|
+
requestAnimationFrame(() => {
|
|
19255
|
+
const r = b.getBoundingClientRect();
|
|
19256
|
+
if (!r.width) return;
|
|
19257
|
+
const pad3 = 8;
|
|
19258
|
+
const vw = document.documentElement.clientWidth;
|
|
19259
|
+
let n = 0;
|
|
19260
|
+
if (r.right > vw - pad3) n = vw - pad3 - r.right;
|
|
19261
|
+
if (r.left + n < pad3) n = pad3 - r.left;
|
|
19262
|
+
if (n) b.style.setProperty("--_nudge", `${Math.round(n)}px`);
|
|
19263
|
+
});
|
|
19264
|
+
}
|
|
19154
19265
|
describe(el) {
|
|
19155
19266
|
this.described.add(el);
|
|
19156
19267
|
if (this.text) el.setAttribute("aria-description", this.text);
|
|
@@ -19213,11 +19324,16 @@ LofTooltip.styles = css53`
|
|
|
19213
19324
|
white-space: nowrap;
|
|
19214
19325
|
filter: drop-shadow(0 4px 12px rgba(11, 11, 11, 0.14));
|
|
19215
19326
|
pointer-events: none;
|
|
19327
|
+
/* hidden bubbles take no space: one at the edge of a phone screen would otherwise
|
|
19328
|
+
widen the page. display animates as a discrete step so the fade-out still plays. */
|
|
19329
|
+
display: none;
|
|
19216
19330
|
opacity: 0;
|
|
19331
|
+
/* moves the bubble back inside the viewport (set from JS); the tail moves the other way */
|
|
19332
|
+
margin-inline-start: var(--_nudge, 0px);
|
|
19217
19333
|
/* translate takes space-separated lengths (a comma makes the declaration invalid) */
|
|
19218
19334
|
--_shift: 0px 4px;
|
|
19219
19335
|
translate: var(--_shift);
|
|
19220
|
-
transition: opacity 120ms ease, translate 160ms cubic-bezier(0.2, 0, 0, 1);
|
|
19336
|
+
transition: opacity 120ms ease, translate 160ms cubic-bezier(0.2, 0, 0, 1), display 160ms allow-discrete;
|
|
19221
19337
|
}
|
|
19222
19338
|
.below { --_shift: 0px -4px; }
|
|
19223
19339
|
.left { --_shift: 4px 0px; }
|
|
@@ -19236,9 +19352,19 @@ LofTooltip.styles = css53`
|
|
|
19236
19352
|
/* hover waits a beat so passing pointers don't flash tips; focus is immediate */
|
|
19237
19353
|
:host(:hover) .tooltip-bubble:not(.dismissed),
|
|
19238
19354
|
:host(:focus-within) .tooltip-bubble:not(.dismissed) {
|
|
19355
|
+
display: block;
|
|
19239
19356
|
opacity: 1;
|
|
19240
19357
|
translate: 0 0;
|
|
19241
19358
|
}
|
|
19359
|
+
@starting-style {
|
|
19360
|
+
:host(:hover) .tooltip-bubble:not(.dismissed),
|
|
19361
|
+
:host(:focus-within) .tooltip-bubble:not(.dismissed) {
|
|
19362
|
+
opacity: 0;
|
|
19363
|
+
translate: var(--_shift);
|
|
19364
|
+
}
|
|
19365
|
+
}
|
|
19366
|
+
.above .tooltip-tail,
|
|
19367
|
+
.below .tooltip-tail { margin-inline-start: calc(-1 * var(--_nudge, 0px)); }
|
|
19242
19368
|
:host(:hover) .tooltip-bubble:not(.dismissed) { transition-delay: 200ms; }
|
|
19243
19369
|
:host(:focus-within) .tooltip-bubble:not(.dismissed) { transition-delay: 0ms; }
|
|
19244
19370
|
|