@lumx/react 4.3.2-alpha.40 → 4.3.2-alpha.42

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 CHANGED
@@ -1552,7 +1552,7 @@ declare const GenericBlockGapSize: Pick<{
1552
1552
  readonly medium: "medium";
1553
1553
  readonly big: "big";
1554
1554
  readonly huge: "huge";
1555
- }, "tiny" | "regular" | "medium" | "big" | "huge">;
1555
+ }, "medium" | "tiny" | "regular" | "big" | "huge">;
1556
1556
  type GenericBlockGapSize = ValueOf$1<typeof GenericBlockGapSize>;
1557
1557
 
1558
1558
  interface GenericBlockProps extends FlexBoxProps {
@@ -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
@@ -11447,7 +11447,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
11447
11447
  as: linkAs || (linkProps?.href ? 'a' : 'button'),
11448
11448
  ...linkProps,
11449
11449
  className: element$d('link'),
11450
- onClick,
11450
+ handleClick: onClick,
11451
11451
  ...ariaProps,
11452
11452
  children: /*#__PURE__*/jsxs(Fragment, {
11453
11453
  children: [icon && /*#__PURE__*/jsx(Icon, {
@@ -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)
@@ -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 (isOpen || popperElement) update?.();
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(Portal, {
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
15146
  'is-initializing': !styles.popper?.transform
15125
- }), isHidden && classNames.visuallyHidden()),
15147
+ }), !popover && isHidden && classNames.visuallyHidden()),
15126
15148
  style: {
15127
15149
  ...(isHidden ? undefined : styles.popper),
15128
- zIndex
15150
+ ...(!popover && {
15151
+ zIndex
15152
+ })
15129
15153
  },
15130
15154
  ...attributes.popper,
15131
15155
  children: [/*#__PURE__*/jsx("div", {