@eagami/ui 5.24.0 → 5.25.0
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/fesm2022/eagami-ui.mjs +136 -32
- package/fesm2022/eagami-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/src/styles/_tooltip.scss +27 -3
- package/types/eagami-ui.d.ts +25 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagami/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.25.0",
|
|
4
4
|
"description": "Lightweight, accessible, themeable Angular UI component library and icon set built on CSS custom properties",
|
|
5
5
|
"author": "Michal Wiraszka <michal@eagami.com>",
|
|
6
6
|
"license": "MIT",
|
package/src/styles/_tooltip.scss
CHANGED
|
@@ -9,9 +9,20 @@
|
|
|
9
9
|
// returns. Also keeps the box unambiguous once the bubble is promoted into
|
|
10
10
|
// the top layer, where the containing block is the viewport either way.
|
|
11
11
|
position: fixed;
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
12
|
+
// A bubble clamped to the viewport has nowhere left to overflow to, so what
|
|
13
|
+
// the cap cuts off scrolls inside it. Both axes: template content can hold
|
|
14
|
+
// rows (avatars, icon rows) too unbreakable to wrap
|
|
15
|
+
overflow: auto;
|
|
16
|
+
// The consumer's `maxWidth` arrives as `--ea-tooltip-max-width` so the viewport
|
|
17
|
+
// cap can win here instead of losing a specificity fight with an inline style.
|
|
18
|
+
// The directive reads the margin token too, so keep it a px length
|
|
19
|
+
max-width: min(
|
|
20
|
+
var(--ea-tooltip-max-width, 100vw),
|
|
21
|
+
calc(100vw - 2 * var(--ea-tooltip-viewport-margin, 8px))
|
|
22
|
+
);
|
|
23
|
+
// dvh, so retracting mobile browser chrome cannot leave the bubble taller than
|
|
24
|
+
// what the user can actually see
|
|
25
|
+
max-height: calc(100dvh - 2 * var(--ea-tooltip-viewport-margin, 8px));
|
|
15
26
|
padding: var(--space-1-5) var(--space-2-5);
|
|
16
27
|
font-family: var(--font-family-sans);
|
|
17
28
|
font-size: var(--font-size-xs);
|
|
@@ -29,6 +40,17 @@
|
|
|
29
40
|
animation: ea-tooltip-fade-in var(--duration-fast) var(--ease-out);
|
|
30
41
|
@include ea.elevated-surface-border;
|
|
31
42
|
|
|
43
|
+
// An explicit `maxWidth` is a width to wrap at, not only a width to stop at
|
|
44
|
+
&--wrapping {
|
|
45
|
+
white-space: normal;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// A bubble the cap cut content off from is the one kind worth reaching with a
|
|
49
|
+
// pointer, since it has a scrollbar; the rest stay click-through
|
|
50
|
+
&--scrollable {
|
|
51
|
+
pointer-events: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
32
54
|
@media (hover: none) {
|
|
33
55
|
display: none;
|
|
34
56
|
}
|
|
@@ -37,6 +59,8 @@
|
|
|
37
59
|
// so only the UA's popover geometry needs undoing once it is promoted.
|
|
38
60
|
&[popover] {
|
|
39
61
|
@include ea.top-layer-reset;
|
|
62
|
+
// the reset clears the UA popover's overflow, which the clamp still needs
|
|
63
|
+
overflow: auto;
|
|
40
64
|
}
|
|
41
65
|
}
|
|
42
66
|
|
package/types/eagami-ui.d.ts
CHANGED
|
@@ -3571,6 +3571,13 @@ type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
|
3571
3571
|
* descendant of the host as well as the host itself. A host listener paired
|
|
3572
3572
|
* with `eaTooltip` has to use `focusin` for the same reason: `focus` does not
|
|
3573
3573
|
* bubble, so it never fires when the focus lands on a child.
|
|
3574
|
+
*
|
|
3575
|
+
* Bubbles never grow past the viewport: they clamp to it, minus
|
|
3576
|
+
* `--ea-tooltip-viewport-margin` on each side, and scroll whatever the clamp
|
|
3577
|
+
* cuts off. A clamped bubble takes pointer events so that scrollbar is
|
|
3578
|
+
* reachable, which also means it waits `dismissDelay` before hiding rather than
|
|
3579
|
+
* going the moment the pointer leaves the trigger. Bubbles that fit stay
|
|
3580
|
+
* display-only.
|
|
3574
3581
|
*/
|
|
3575
3582
|
declare class TooltipDirective implements OnDestroy {
|
|
3576
3583
|
private readonly el;
|
|
@@ -3578,14 +3585,26 @@ declare class TooltipDirective implements OnDestroy {
|
|
|
3578
3585
|
private readonly viewContainer;
|
|
3579
3586
|
readonly eaTooltip: _angular_core.InputSignal<string | TemplateRef<unknown>>;
|
|
3580
3587
|
readonly tooltipPosition: _angular_core.InputSignal<TooltipPosition>;
|
|
3581
|
-
/**
|
|
3588
|
+
/**
|
|
3589
|
+
* Max width in px; the text wraps at this width. Clamped to a 50px floor, and
|
|
3590
|
+
* to the viewport, which no value can push the bubble past.
|
|
3591
|
+
*/
|
|
3582
3592
|
readonly maxWidth: _angular_core.InputSignal<number | undefined>;
|
|
3593
|
+
/**
|
|
3594
|
+
* Grace period in ms before a bubble the viewport clamp made scrollable hides
|
|
3595
|
+
* after the pointer leaves, long enough to cross the gap onto the bubble and
|
|
3596
|
+
* reach its scrollbar. Bubbles that fit hide immediately.
|
|
3597
|
+
*/
|
|
3598
|
+
readonly dismissDelay: _angular_core.InputSignal<number>;
|
|
3583
3599
|
private tooltipEl;
|
|
3584
3600
|
private templateView;
|
|
3601
|
+
private scrollable;
|
|
3602
|
+
private hideTimer;
|
|
3585
3603
|
private readonly tooltipId;
|
|
3586
3604
|
private readonly hoverMql;
|
|
3587
3605
|
private readonly showHandler;
|
|
3588
3606
|
private readonly hideHandler;
|
|
3607
|
+
private readonly bubbleEnterHandler;
|
|
3589
3608
|
private readonly supportsFocusVisible;
|
|
3590
3609
|
private readonly focusHandler;
|
|
3591
3610
|
private readonly keydownHandler;
|
|
@@ -3599,14 +3618,18 @@ declare class TooltipDirective implements OnDestroy {
|
|
|
3599
3618
|
private syncPointerListeners;
|
|
3600
3619
|
private show;
|
|
3601
3620
|
private shrinkToContent;
|
|
3621
|
+
private requestHide;
|
|
3622
|
+
private cancelPendingHide;
|
|
3602
3623
|
private hide;
|
|
3603
3624
|
private attachRepositionListeners;
|
|
3604
3625
|
private detachRepositionListeners;
|
|
3605
3626
|
private appendDescribedBy;
|
|
3606
3627
|
private removeDescribedBy;
|
|
3607
3628
|
private positionTooltip;
|
|
3629
|
+
private viewportMargin;
|
|
3630
|
+
private syncScrollable;
|
|
3608
3631
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TooltipDirective, never>;
|
|
3609
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TooltipDirective, "[eaTooltip]", never, { "eaTooltip": { "alias": "eaTooltip"; "required": true; "isSignal": true; }; "tooltipPosition": { "alias": "tooltipPosition"; "required": false; "isSignal": true; }; "maxWidth": { "alias": "maxWidth"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3632
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TooltipDirective, "[eaTooltip]", never, { "eaTooltip": { "alias": "eaTooltip"; "required": true; "isSignal": true; }; "tooltipPosition": { "alias": "tooltipPosition"; "required": false; "isSignal": true; }; "maxWidth": { "alias": "maxWidth"; "required": false; "isSignal": true; }; "dismissDelay": { "alias": "dismissDelay"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3610
3633
|
}
|
|
3611
3634
|
|
|
3612
3635
|
/** Semantic colour scheme of a tag. */
|