@lumx/react 4.3.2-alpha.43 → 4.3.2-alpha.45
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 +6 -7
- package/index.js +17 -32
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -725,6 +725,8 @@ declare const DEFAULT_PROPS: Partial<ButtonProps$1>;
|
|
|
725
725
|
interface ButtonProps extends GenericProps$1, ReactToJSX<ButtonProps$1> {
|
|
726
726
|
/** callback for clicking on the button */
|
|
727
727
|
onClick?: (event?: React.MouseEvent) => void;
|
|
728
|
+
/** callback for pressing a key on the button */
|
|
729
|
+
onKeyPress?: (event?: React.KeyboardEvent) => void;
|
|
728
730
|
}
|
|
729
731
|
/**
|
|
730
732
|
* Button component.
|
|
@@ -733,7 +735,7 @@ interface ButtonProps extends GenericProps$1, ReactToJSX<ButtonProps$1> {
|
|
|
733
735
|
* @param ref Component ref.
|
|
734
736
|
* @return React element.
|
|
735
737
|
*/
|
|
736
|
-
declare const Button: Comp<ButtonProps,
|
|
738
|
+
declare const Button: Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>;
|
|
737
739
|
|
|
738
740
|
interface IconButtonProps$1 extends BaseButtonProps {
|
|
739
741
|
/**
|
|
@@ -765,6 +767,8 @@ interface IconButtonProps extends GenericProps$1, ReactToJSX<IconButtonProps$1,
|
|
|
765
767
|
hideTooltip?: boolean;
|
|
766
768
|
/** callback for clicking on the button */
|
|
767
769
|
onClick?: (event?: React.MouseEvent) => void;
|
|
770
|
+
/** callback for pressing a key on the button */
|
|
771
|
+
onKeyPress?: (event?: React.KeyboardEvent) => void;
|
|
768
772
|
}
|
|
769
773
|
/**
|
|
770
774
|
* IconButton component.
|
|
@@ -2242,7 +2246,7 @@ interface LinkProps extends GenericProps$1, ReactToJSX<LinkProps$1, 'label'> {
|
|
|
2242
2246
|
* @param ref Component ref.
|
|
2243
2247
|
* @return React element.
|
|
2244
2248
|
*/
|
|
2245
|
-
declare const Link: Comp<LinkProps,
|
|
2249
|
+
declare const Link: Comp<LinkProps, HTMLButtonElement | HTMLAnchorElement>;
|
|
2246
2250
|
|
|
2247
2251
|
/**
|
|
2248
2252
|
* Defines the props of the component.
|
|
@@ -3772,11 +3776,6 @@ interface TooltipProps extends GenericProps$1, HasCloseMode {
|
|
|
3772
3776
|
placement?: TooltipPlacement;
|
|
3773
3777
|
/** Choose how the tooltip text should link to the anchor */
|
|
3774
3778
|
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;
|
|
3780
3779
|
}
|
|
3781
3780
|
/**
|
|
3782
3781
|
* Tooltip component.
|
package/index.js
CHANGED
|
@@ -1259,6 +1259,7 @@ const Button = forwardRef((props, ref) => {
|
|
|
1259
1259
|
} = useDisableStateProps(props);
|
|
1260
1260
|
const {
|
|
1261
1261
|
onClick,
|
|
1262
|
+
onKeyPress,
|
|
1262
1263
|
...restOfOtherProps
|
|
1263
1264
|
} = otherProps;
|
|
1264
1265
|
const {
|
|
@@ -1273,6 +1274,7 @@ const Button = forwardRef((props, ref) => {
|
|
|
1273
1274
|
...restOfOtherProps,
|
|
1274
1275
|
'aria-disabled': isAnyDisabled,
|
|
1275
1276
|
handleClick: onClick,
|
|
1277
|
+
handleKeyPress: onKeyPress,
|
|
1276
1278
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
1277
1279
|
children: [leftIcon && !isEmpty(leftIcon) &&
|
|
1278
1280
|
/*#__PURE__*/
|
|
@@ -1472,6 +1474,7 @@ const IconButton = forwardRef((props, ref) => {
|
|
|
1472
1474
|
} = useDisableStateProps(forwardedProps);
|
|
1473
1475
|
const {
|
|
1474
1476
|
onClick,
|
|
1477
|
+
onKeyPress,
|
|
1475
1478
|
...restOfOtherProps
|
|
1476
1479
|
} = otherProps;
|
|
1477
1480
|
return /*#__PURE__*/jsx(Tooltip, {
|
|
@@ -1483,6 +1486,7 @@ const IconButton = forwardRef((props, ref) => {
|
|
|
1483
1486
|
...disabledStateProps,
|
|
1484
1487
|
...restOfOtherProps,
|
|
1485
1488
|
handleClick: onClick,
|
|
1489
|
+
handleKeyPress: onKeyPress,
|
|
1486
1490
|
'aria-disabled': isAnyDisabled,
|
|
1487
1491
|
label
|
|
1488
1492
|
})
|
|
@@ -9450,6 +9454,7 @@ const NavigationSection = forwardRef((props, ref) => {
|
|
|
9450
9454
|
setIsOpen(!isOpen);
|
|
9451
9455
|
event.stopPropagation();
|
|
9452
9456
|
},
|
|
9457
|
+
handleKeyPress: forwardedProps.onKeyPress,
|
|
9453
9458
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
9454
9459
|
children: [icon ? /*#__PURE__*/jsx(Icon, {
|
|
9455
9460
|
className: itemElement('icon'),
|
|
@@ -9521,6 +9526,7 @@ const NavigationItem = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
9521
9526
|
isCurrentPage,
|
|
9522
9527
|
as: Element = 'a',
|
|
9523
9528
|
onClick,
|
|
9529
|
+
onKeyPress,
|
|
9524
9530
|
...forwardedProps
|
|
9525
9531
|
} = props;
|
|
9526
9532
|
const theme = useTheme();
|
|
@@ -9544,6 +9550,7 @@ const NavigationItem = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
9544
9550
|
'aria-current': isCurrentPage ? 'page' : undefined,
|
|
9545
9551
|
...forwardedProps,
|
|
9546
9552
|
handleClick: onClick,
|
|
9553
|
+
handleKeyPress: onKeyPress,
|
|
9547
9554
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
9548
9555
|
children: [icon ? /*#__PURE__*/jsx(Icon, {
|
|
9549
9556
|
className: element$p('icon'),
|
|
@@ -11425,6 +11432,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
11425
11432
|
...linkProps,
|
|
11426
11433
|
className: element$d('link'),
|
|
11427
11434
|
handleClick: onClick,
|
|
11435
|
+
handleKeyPress: linkProps?.onKeyPress,
|
|
11428
11436
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
11429
11437
|
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
11430
11438
|
className: element$d('icon'),
|
|
@@ -11448,6 +11456,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
11448
11456
|
...linkProps,
|
|
11449
11457
|
className: element$d('link'),
|
|
11450
11458
|
handleClick: onClick,
|
|
11459
|
+
handleKeyPress: linkProps?.onKeyPress,
|
|
11451
11460
|
...ariaProps,
|
|
11452
11461
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
11453
11462
|
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
@@ -14834,11 +14843,6 @@ Toolbar.defaultProps = DEFAULT_PROPS$3;
|
|
|
14834
14843
|
*/
|
|
14835
14844
|
const TOOLTIP_ZINDEX = POPOVER_ZINDEX + 1;
|
|
14836
14845
|
|
|
14837
|
-
/** Check if browser supports the HTML Popover API */
|
|
14838
|
-
function isPopoverSupported() {
|
|
14839
|
-
return WINDOW != null && 'popover' in HTMLElement.prototype;
|
|
14840
|
-
}
|
|
14841
|
-
|
|
14842
14846
|
/**
|
|
14843
14847
|
* Add ref and ARIA attribute(s) in tooltip children or wrapped children.
|
|
14844
14848
|
* Button, IconButton, Icon and React HTML elements don't need to be wrapped but any other kind of children (array, fragment, custom components)
|
|
@@ -15065,7 +15069,7 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
15065
15069
|
delay,
|
|
15066
15070
|
placement = DEFAULT_PROPS$2.placement,
|
|
15067
15071
|
forceOpen,
|
|
15068
|
-
closeMode =
|
|
15072
|
+
closeMode = DEFAULT_PROPS$2.closeMode,
|
|
15069
15073
|
ariaLinkMode = DEFAULT_PROPS$2.ariaLinkMode,
|
|
15070
15074
|
zIndex = DEFAULT_PROPS$2.zIndex,
|
|
15071
15075
|
...forwardedProps
|
|
@@ -15109,47 +15113,28 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
15109
15113
|
ariaLinkMode: ariaLinkMode
|
|
15110
15114
|
});
|
|
15111
15115
|
|
|
15112
|
-
// Update
|
|
15116
|
+
// Update on open
|
|
15113
15117
|
React__default.useEffect(() => {
|
|
15114
|
-
if (
|
|
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?.();
|
|
15118
|
+
if (isOpen || popperElement) update?.();
|
|
15123
15119
|
}, [isOpen, update, popperElement]);
|
|
15124
15120
|
const labelLines = label ? label.split('\n') : [];
|
|
15125
15121
|
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
|
-
}
|
|
15134
15122
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
15135
15123
|
children: [/*#__PURE__*/jsx(TooltipContextProvider, {
|
|
15136
15124
|
children: wrappedChildren
|
|
15137
|
-
}), isMounted && /*#__PURE__*/jsx(
|
|
15125
|
+
}), isMounted && /*#__PURE__*/jsx(Portal, {
|
|
15138
15126
|
children: /*#__PURE__*/jsxs("div", {
|
|
15139
15127
|
ref: tooltipRef,
|
|
15140
15128
|
...forwardedProps,
|
|
15141
|
-
role: "tooltip",
|
|
15142
|
-
popover: popover,
|
|
15143
15129
|
id: id,
|
|
15130
|
+
role: "tooltip",
|
|
15144
15131
|
className: classNames.join(className, block$2({
|
|
15145
15132
|
[`position-${position}`]: Boolean(position),
|
|
15146
|
-
'is-initializing': !
|
|
15147
|
-
}),
|
|
15133
|
+
'is-initializing': !styles.popper?.transform
|
|
15134
|
+
}), isHidden && classNames.visuallyHidden()),
|
|
15148
15135
|
style: {
|
|
15149
15136
|
...(isHidden ? undefined : styles.popper),
|
|
15150
|
-
|
|
15151
|
-
zIndex
|
|
15152
|
-
})
|
|
15137
|
+
zIndex
|
|
15153
15138
|
},
|
|
15154
15139
|
...attributes.popper,
|
|
15155
15140
|
children: [/*#__PURE__*/jsx("div", {
|