@justeattakeaway/pie-tooltip 0.5.1 → 0.6.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/README.md +1 -12
- package/custom-elements.json +0 -96
- package/dist/index.d.ts +1 -8
- package/dist/index.js +227 -317
- package/dist/react.d.ts +1 -8
- package/package.json +1 -1
- package/src/defs.ts +1 -1
- package/src/index.ts +2 -238
- package/src/tooltip.scss +6 -0
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ Ideally, you should install the component using the **`@justeattakeaway/pie-webc
|
|
|
48
48
|
|---|---|---|---|
|
|
49
49
|
| `trigger` | Any string | The `id` of the element the panel is anchored to. The trigger lives elsewhere in the DOM and is never slotted into the tooltip. | `undefined` |
|
|
50
50
|
| `isOpen` | `true`, `false` | When true, the panel is visible. The component never writes to this property. | `false` |
|
|
51
|
-
| `position` | `top`, `top-start`, `top-end`, `bottom`, `bottom-start`, `bottom-end`, `left`, `left-start`, `left-end`, `right`, `right-start`, `right-end` | The
|
|
51
|
+
| `position` | `top`, `top-start`, `top-end`, `bottom`, `bottom-start`, `bottom-end`, `left`, `left-start`, `left-end`, `right`, `right-start`, `right-end` | The side of the trigger the panel sits on, and its alignment along the cross axis. | `top` |
|
|
52
52
|
| `size` | `default`, `fit-to-content`, `fill-container` | How the panel sizes itself. `default` is a fixed 280px and wraps, `fit-to-content` is as wide as its content, and `fill-container` matches the inline size of the trigger's parent element. Not applied when `type` is `icon`. | `default` |
|
|
53
53
|
| `variant` | `default`, `inverse` | The colour treatment of the panel. `default` is the dark panel, `inverse` the light one. | `default` |
|
|
54
54
|
| `type` | `default`, `icon` | The presentation of the panel. `icon` is the compact treatment intended for icon triggers: it has no arrow and is always as wide as its content, so `size` and `--tooltip-width` have no effect on it. | `default` |
|
|
@@ -106,17 +106,6 @@ right right-start right-end
|
|
|
106
106
|
|
|
107
107
|
In right-to-left languages, everything on the inline axis mirrors. The alignments follow the reading direction, so `top-start` aligns against the right-hand edge, and `left` and `right` swap: a panel asked for on the left appears on the right. The `-start` and `-end` alignments of `left` and `right` are on the block axis, which has no direction to mirror, so only the side moves.
|
|
108
108
|
|
|
109
|
-
### Collision detection
|
|
110
|
-
|
|
111
|
-
`position` is a preference, not a guarantee. Before the panel is shown, and on every scroll, resize or direction change while it is open, the component measures the panel against the space available and repositions it if the preferred position would collide.
|
|
112
|
-
|
|
113
|
-
- It flips to the opposite side first: `top` to `bottom`, and so on.
|
|
114
|
-
- It then tries the remaining sides.
|
|
115
|
-
- Within a side, it shifts the alignment (for example `top-start` to `top-end`) so the panel stays fully in view.
|
|
116
|
-
- If no position fits entirely, it uses whichever position shows the most of the panel.
|
|
117
|
-
|
|
118
|
-
The available space is the viewport, narrowed by any ancestor that clips the panel. Collision detection is always on and cannot be disabled.
|
|
119
|
-
|
|
120
109
|
## Sizing
|
|
121
110
|
|
|
122
111
|
| `size` | Behaviour |
|
package/custom-elements.json
CHANGED
|
@@ -343,14 +343,6 @@
|
|
|
343
343
|
"privacy": "private",
|
|
344
344
|
"default": "true"
|
|
345
345
|
},
|
|
346
|
-
{
|
|
347
|
-
"kind": "field",
|
|
348
|
-
"name": "_resolvedPosition",
|
|
349
|
-
"type": {
|
|
350
|
-
"text": "TooltipProps['position'] | undefined"
|
|
351
|
-
},
|
|
352
|
-
"privacy": "private"
|
|
353
|
-
},
|
|
354
346
|
{
|
|
355
347
|
"kind": "field",
|
|
356
348
|
"name": "_clippedTriggerElement",
|
|
@@ -369,24 +361,6 @@
|
|
|
369
361
|
"privacy": "private",
|
|
370
362
|
"default": "[]"
|
|
371
363
|
},
|
|
372
|
-
{
|
|
373
|
-
"kind": "field",
|
|
374
|
-
"name": "_overlayClippers",
|
|
375
|
-
"type": {
|
|
376
|
-
"text": "Array<Element>"
|
|
377
|
-
},
|
|
378
|
-
"privacy": "private",
|
|
379
|
-
"default": "[]"
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
"kind": "field",
|
|
383
|
-
"name": "_collisionSignature",
|
|
384
|
-
"type": {
|
|
385
|
-
"text": "string | null"
|
|
386
|
-
},
|
|
387
|
-
"privacy": "private",
|
|
388
|
-
"default": "null"
|
|
389
|
-
},
|
|
390
364
|
{
|
|
391
365
|
"kind": "field",
|
|
392
366
|
"name": "_overlayModeDirty",
|
|
@@ -538,76 +512,6 @@
|
|
|
538
512
|
}
|
|
539
513
|
}
|
|
540
514
|
},
|
|
541
|
-
{
|
|
542
|
-
"kind": "method",
|
|
543
|
-
"name": "resolveCollision",
|
|
544
|
-
"privacy": "private",
|
|
545
|
-
"return": {
|
|
546
|
-
"type": {
|
|
547
|
-
"text": "void"
|
|
548
|
-
}
|
|
549
|
-
},
|
|
550
|
-
"parameters": [
|
|
551
|
-
{
|
|
552
|
-
"name": "anchorRect",
|
|
553
|
-
"type": {
|
|
554
|
-
"text": "DOMRect"
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
]
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
"kind": "method",
|
|
561
|
-
"name": "_setResolvedPosition",
|
|
562
|
-
"privacy": "private",
|
|
563
|
-
"return": {
|
|
564
|
-
"type": {
|
|
565
|
-
"text": "void"
|
|
566
|
-
}
|
|
567
|
-
},
|
|
568
|
-
"parameters": [
|
|
569
|
-
{
|
|
570
|
-
"name": "position",
|
|
571
|
-
"type": {
|
|
572
|
-
"text": "TooltipProps['position']"
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
]
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
"kind": "method",
|
|
579
|
-
"name": "_getCollisionBoundary",
|
|
580
|
-
"privacy": "private",
|
|
581
|
-
"return": {
|
|
582
|
-
"type": {
|
|
583
|
-
"text": "DOMRect | null"
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
"kind": "method",
|
|
589
|
-
"name": "_getCandidatePositions",
|
|
590
|
-
"privacy": "private",
|
|
591
|
-
"return": {
|
|
592
|
-
"type": {
|
|
593
|
-
"text": "Array<{ side: TooltipSide; alignment: TooltipAlignment }>"
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
"parameters": [
|
|
597
|
-
{
|
|
598
|
-
"name": "preferredSide",
|
|
599
|
-
"type": {
|
|
600
|
-
"text": "TooltipSide"
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
"name": "preferredAlignment",
|
|
605
|
-
"type": {
|
|
606
|
-
"text": "TooltipAlignment"
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
]
|
|
610
|
-
},
|
|
611
515
|
{
|
|
612
516
|
"kind": "method",
|
|
613
517
|
"name": "_refreshTriggerClippers",
|
package/dist/index.d.ts
CHANGED
|
@@ -52,11 +52,8 @@ export declare class PieTooltip extends PieElement implements TooltipProps {
|
|
|
52
52
|
private _hasActionContent;
|
|
53
53
|
private _isPositioned;
|
|
54
54
|
private _isAnchorVisible;
|
|
55
|
-
private _resolvedPosition;
|
|
56
55
|
private _clippedTriggerElement;
|
|
57
56
|
private _triggerClippers;
|
|
58
|
-
private _overlayClippers;
|
|
59
|
-
private _collisionSignature;
|
|
60
57
|
private _overlayModeDirty;
|
|
61
58
|
private _triggerTrackingController;
|
|
62
59
|
private _interactionController;
|
|
@@ -78,10 +75,6 @@ export declare class PieTooltip extends PieElement implements TooltipProps {
|
|
|
78
75
|
private resolveMode;
|
|
79
76
|
private resolveOverlayMode;
|
|
80
77
|
private projectOverTrigger;
|
|
81
|
-
private resolveCollision;
|
|
82
|
-
private _setResolvedPosition;
|
|
83
|
-
private _getCollisionBoundary;
|
|
84
|
-
private _getCandidatePositions;
|
|
85
78
|
private _refreshTriggerClippers;
|
|
86
79
|
private handleCloseButtonClick;
|
|
87
80
|
private _getTriggerElement;
|
|
@@ -107,7 +100,7 @@ export declare interface TooltipProps {
|
|
|
107
100
|
trigger?: string;
|
|
108
101
|
/** When true, the panel is visible. The component never writes to this property. */
|
|
109
102
|
isOpen?: boolean;
|
|
110
|
-
/** The
|
|
103
|
+
/** The side of the trigger the panel sits on, and its alignment along the cross axis. */
|
|
111
104
|
position?: typeof positions[number];
|
|
112
105
|
/** How the panel sizes itself. Not applied when `type` is `icon`. */
|
|
113
106
|
size?: typeof sizes[number];
|