@lumx/react 4.3.2-alpha.41 → 4.3.2-alpha.43
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/index.d.ts +8 -3
- package/index.js +32 -8
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -733,7 +733,7 @@ interface ButtonProps extends GenericProps$1, ReactToJSX<ButtonProps$1> {
|
|
|
733
733
|
* @param ref Component ref.
|
|
734
734
|
* @return React element.
|
|
735
735
|
*/
|
|
736
|
-
declare const Button: Comp<ButtonProps,
|
|
736
|
+
declare const Button: Comp<ButtonProps, HTMLAnchorElement | HTMLButtonElement>;
|
|
737
737
|
|
|
738
738
|
interface IconButtonProps$1 extends BaseButtonProps {
|
|
739
739
|
/**
|
|
@@ -1552,7 +1552,7 @@ declare const GenericBlockGapSize: Pick<{
|
|
|
1552
1552
|
readonly medium: "medium";
|
|
1553
1553
|
readonly big: "big";
|
|
1554
1554
|
readonly huge: "huge";
|
|
1555
|
-
}, "
|
|
1555
|
+
}, "tiny" | "regular" | "medium" | "big" | "huge">;
|
|
1556
1556
|
type GenericBlockGapSize = ValueOf$1<typeof GenericBlockGapSize>;
|
|
1557
1557
|
|
|
1558
1558
|
interface GenericBlockProps extends FlexBoxProps {
|
|
@@ -2242,7 +2242,7 @@ interface LinkProps extends GenericProps$1, ReactToJSX<LinkProps$1, 'label'> {
|
|
|
2242
2242
|
* @param ref Component ref.
|
|
2243
2243
|
* @return React element.
|
|
2244
2244
|
*/
|
|
2245
|
-
declare const Link: Comp<LinkProps,
|
|
2245
|
+
declare const Link: Comp<LinkProps, HTMLAnchorElement | HTMLButtonElement>;
|
|
2246
2246
|
|
|
2247
2247
|
/**
|
|
2248
2248
|
* Defines the props of the component.
|
|
@@ -3772,6 +3772,11 @@ interface TooltipProps extends GenericProps$1, HasCloseMode {
|
|
|
3772
3772
|
placement?: TooltipPlacement;
|
|
3773
3773
|
/** Choose how the tooltip text should link to the anchor */
|
|
3774
3774
|
ariaLinkMode?: (typeof ARIA_LINK_MODES)[number];
|
|
3775
|
+
/**
|
|
3776
|
+
* z-index positioning
|
|
3777
|
+
* @deprecated Never really needed. Ignored on browsers supporting the HTML popover API
|
|
3778
|
+
*/
|
|
3779
|
+
zIndex?: number;
|
|
3775
3780
|
}
|
|
3776
3781
|
/**
|
|
3777
3782
|
* Tooltip component.
|
package/index.js
CHANGED
|
@@ -14834,6 +14834,11 @@ Toolbar.defaultProps = DEFAULT_PROPS$3;
|
|
|
14834
14834
|
*/
|
|
14835
14835
|
const TOOLTIP_ZINDEX = POPOVER_ZINDEX + 1;
|
|
14836
14836
|
|
|
14837
|
+
/** Check if browser supports the HTML Popover API */
|
|
14838
|
+
function isPopoverSupported() {
|
|
14839
|
+
return WINDOW != null && 'popover' in HTMLElement.prototype;
|
|
14840
|
+
}
|
|
14841
|
+
|
|
14837
14842
|
/**
|
|
14838
14843
|
* Add ref and ARIA attribute(s) in tooltip children or wrapped children.
|
|
14839
14844
|
* Button, IconButton, Icon and React HTML elements don't need to be wrapped but any other kind of children (array, fragment, custom components)
|
|
@@ -15060,7 +15065,7 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
15060
15065
|
delay,
|
|
15061
15066
|
placement = DEFAULT_PROPS$2.placement,
|
|
15062
15067
|
forceOpen,
|
|
15063
|
-
closeMode =
|
|
15068
|
+
closeMode = isPopoverSupported() ? 'hide' : 'unmount',
|
|
15064
15069
|
ariaLinkMode = DEFAULT_PROPS$2.ariaLinkMode,
|
|
15065
15070
|
zIndex = DEFAULT_PROPS$2.zIndex,
|
|
15066
15071
|
...forwardedProps
|
|
@@ -15104,28 +15109,47 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
15104
15109
|
ariaLinkMode: ariaLinkMode
|
|
15105
15110
|
});
|
|
15106
15111
|
|
|
15107
|
-
// Update on open
|
|
15112
|
+
// Update popover visibility on open/close.
|
|
15108
15113
|
React__default.useEffect(() => {
|
|
15109
|
-
if (
|
|
15114
|
+
if (!popperElement) return;
|
|
15115
|
+
if (popperElement.popover) {
|
|
15116
|
+
try {
|
|
15117
|
+
if (isOpen) popperElement.showPopover();else popperElement.hidePopover();
|
|
15118
|
+
} catch {
|
|
15119
|
+
/* already open/closed */
|
|
15120
|
+
}
|
|
15121
|
+
}
|
|
15122
|
+
if (isOpen) update?.();
|
|
15110
15123
|
}, [isOpen, update, popperElement]);
|
|
15111
15124
|
const labelLines = label ? label.split('\n') : [];
|
|
15112
15125
|
const tooltipRef = useMergeRefs(ref, setPopperElement, onPopperMount);
|
|
15126
|
+
let popover;
|
|
15127
|
+
let Wrapper = Portal;
|
|
15128
|
+
if (isPopoverSupported()) {
|
|
15129
|
+
// Use native HTML popover API
|
|
15130
|
+
popover = forceOpen ? 'manual' : 'hint';
|
|
15131
|
+
// No need for Portal (originally used to escape potential parent hidden/cliped overflow)
|
|
15132
|
+
Wrapper = React__default.Fragment;
|
|
15133
|
+
}
|
|
15113
15134
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
15114
15135
|
children: [/*#__PURE__*/jsx(TooltipContextProvider, {
|
|
15115
15136
|
children: wrappedChildren
|
|
15116
|
-
}), isMounted && /*#__PURE__*/jsx(
|
|
15137
|
+
}), isMounted && /*#__PURE__*/jsx(Wrapper, {
|
|
15117
15138
|
children: /*#__PURE__*/jsxs("div", {
|
|
15118
15139
|
ref: tooltipRef,
|
|
15119
15140
|
...forwardedProps,
|
|
15120
|
-
id: id,
|
|
15121
15141
|
role: "tooltip",
|
|
15142
|
+
popover: popover,
|
|
15143
|
+
id: id,
|
|
15122
15144
|
className: classNames.join(className, block$2({
|
|
15123
15145
|
[`position-${position}`]: Boolean(position),
|
|
15124
|
-
'is-initializing': !styles.popper?.transform
|
|
15125
|
-
}), isHidden && classNames.visuallyHidden()),
|
|
15146
|
+
'is-initializing': !popover && !styles.popper?.transform
|
|
15147
|
+
}), !popover && isHidden && classNames.visuallyHidden()),
|
|
15126
15148
|
style: {
|
|
15127
15149
|
...(isHidden ? undefined : styles.popper),
|
|
15128
|
-
|
|
15150
|
+
...(!popover && {
|
|
15151
|
+
zIndex
|
|
15152
|
+
})
|
|
15129
15153
|
},
|
|
15130
15154
|
...attributes.popper,
|
|
15131
15155
|
children: [/*#__PURE__*/jsx("div", {
|