@muraldevkit/ui-toolkit 4.67.0-dev-OdGN.1 → 4.67.0-dev-Vc0V.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/dist/components/tooltip/MrlTooltip/MrlTooltip.d.ts +7 -1
- package/dist/components/tooltip/MrlTooltipContent/MrlTooltipContent.d.ts +3 -9
- package/dist/components/tooltip/anchorPositioningPolyfill.d.ts +19 -0
- package/dist/index.js +1 -1
- package/dist/styles/MrlTooltipContent/global.scss +128 -99
- package/dist/styles.css +1 -1
- package/package.json +12 -19
- package/dist/components/tooltip/useTooltipPosition/constants.d.ts +0 -9
- package/dist/components/tooltip/useTooltipPosition/index.d.ts +0 -14
- package/dist/components/tooltip/useTooltipPosition/utilities.d.ts +0 -19
|
@@ -45,7 +45,13 @@ interface MrlTooltipProps {
|
|
|
45
45
|
/**
|
|
46
46
|
* MrlTooltip Component
|
|
47
47
|
*
|
|
48
|
-
*
|
|
48
|
+
* Placement is handled entirely by CSS Anchor Positioning: the trigger exposes an
|
|
49
|
+
* `anchor-name` and the portaled tooltip (`.mrl-tooltip-positioner`) attaches to it via
|
|
50
|
+
* `position-anchor`/`position-area`, flipping near viewport edges via `position-try-fallbacks`.
|
|
51
|
+
* Older browsers are covered by the `@oddbird/css-anchor-positioning` polyfill (see
|
|
52
|
+
* `polyfill.ts`). This component owns only show/hide, hover, keyboard and accessibility.
|
|
53
|
+
*
|
|
54
|
+
* This component is not displayed when the primary pointing device can’t hover. Examples include touchscreens and screens that use a basic drawing stylus.
|
|
49
55
|
* Pointing devices that can hover, but for which doing so is inconvenient and not part of the normal way they are used, also match this criteria. For example, a touchscreen where a long press is treated as hovering.
|
|
50
56
|
* @param {MrlTooltipProps} props - The props of the component
|
|
51
57
|
* @returns {HTMLElement} a configured Tooltip component
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AttrsObject } from '../../../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { MrlTooltipVariant } from '../constants';
|
|
4
4
|
import './MrlTooltipContent.global.scss';
|
|
5
5
|
interface MrlTooltipContentProps {
|
|
6
|
-
/**
|
|
7
|
-
* The arrow position of the tooltip in relation to its trigger's content.
|
|
8
|
-
* Note, if the content is shorter than the width of the trigger, always use
|
|
9
|
-
* "center" to ensure the arrow does not become misaligned.
|
|
10
|
-
*/
|
|
11
|
-
anchor: MrlTooltipAnchor;
|
|
12
6
|
/**
|
|
13
7
|
* Attributes that are applied to the component during the initial render.
|
|
14
8
|
*
|
|
@@ -22,8 +16,6 @@ interface MrlTooltipContentProps {
|
|
|
22
16
|
kind: MrlTooltipVariant;
|
|
23
17
|
/** The id of the tooltip used for aria-describedby in the parent component */
|
|
24
18
|
id?: string;
|
|
25
|
-
/** The placement of the tooltip in relation to its trigger */
|
|
26
|
-
position: MrlTooltipPosition;
|
|
27
19
|
/** The tooltip content to display */
|
|
28
20
|
text: string;
|
|
29
21
|
/** A class to be applied ot the tooltip content */
|
|
@@ -35,6 +27,8 @@ interface MrlTooltipContentProps {
|
|
|
35
27
|
* MrlTooltipContent Component
|
|
36
28
|
*
|
|
37
29
|
* The tooltip content is the text that is displayed when the user hovers over the trigger.
|
|
30
|
+
* Placement (position/anchor) is owned by the `.mrl-tooltip-positioner` ancestor via CSS
|
|
31
|
+
* anchor positioning, so this component only renders the visual box + hover bridge.
|
|
38
32
|
* IMPORTANT: This component is not intended to be used directly, it should always be a child of MrlTooltip.
|
|
39
33
|
* @param {MrlTooltipContentProps} props - the props of the tooltip content
|
|
40
34
|
* @returns {HTMLElement} a configured Tooltip Content component
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS Anchor Positioning polyfill loader.
|
|
3
|
+
*
|
|
4
|
+
* The tooltip positions itself with native CSS Anchor Positioning. On browsers
|
|
5
|
+
* that lack native support we lazy-load the Oddbird polyfill and run a
|
|
6
|
+
* positioning pass. The dynamic import keeps the polyfill out of the bundle for
|
|
7
|
+
* browsers that support anchor positioning natively.
|
|
8
|
+
*
|
|
9
|
+
* The polyfill implements Level 1 only, so it does not flip the arrow — matching
|
|
10
|
+
* the progressive-enhancement decision for native browsers as well.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Ensure anchored tooltips are positioned on browsers without native support.
|
|
14
|
+
* No-op where anchor positioning is supported. Safe to call on every tooltip
|
|
15
|
+
* open — the polyfill module is fetched once, then re-run to position the
|
|
16
|
+
* newly-shown tooltip. Failures are swallowed so a polyfill hiccup never breaks
|
|
17
|
+
* the trigger.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ensureAnchorPositioningPolyfill: () => Promise<void>;
|