@doist/reactist 24.1.0-beta → 24.1.2-beta
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/reactist.cjs.development.js +11 -56
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/menu/menu.js +11 -11
- package/es/menu/menu.js.map +1 -1
- package/es/tooltip/tooltip.js +2 -48
- package/es/tooltip/tooltip.js.map +1 -1
- package/lib/menu/menu.js +1 -1
- package/lib/menu/menu.js.map +1 -1
- package/lib/tooltip/tooltip.js +1 -1
- package/lib/tooltip/tooltip.js.map +1 -1
- package/package.json +1 -1
|
@@ -473,54 +473,9 @@ function Tooltip({
|
|
|
473
473
|
if (typeof child.ref === 'string') {
|
|
474
474
|
throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded');
|
|
475
475
|
}
|
|
476
|
-
/**
|
|
477
|
-
* Prevents the tooltip from automatically firing on focus all the time. This is to prevent
|
|
478
|
-
* tooltips from showing when the trigger element is focused back after a popover or dialog that
|
|
479
|
-
* it opened was closed. See link below for more details.
|
|
480
|
-
* @see https://github.com/ariakit/ariakit/discussions/749
|
|
481
|
-
*/
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
function handleFocus(event) {
|
|
485
|
-
var _child$props;
|
|
486
|
-
|
|
487
|
-
// If focus is not followed by a key up event, does it mean that it's not an intentional
|
|
488
|
-
// keyboard focus? Not sure but it seems to work.
|
|
489
|
-
// This may be resolved soon in an upcoming version of ariakit:
|
|
490
|
-
// https://github.com/ariakit/ariakit/issues/750
|
|
491
|
-
function handleKeyUp(event) {
|
|
492
|
-
const eventKey = event.key;
|
|
493
|
-
|
|
494
|
-
if (eventKey !== 'Escape' && eventKey !== 'Enter' && eventKey !== 'Space') {
|
|
495
|
-
tooltip.show();
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
event.currentTarget.addEventListener('keyup', handleKeyUp, {
|
|
500
|
-
once: true
|
|
501
|
-
});
|
|
502
|
-
event.preventDefault(); // Prevent tooltip.show from being called by TooltipReference
|
|
503
|
-
|
|
504
|
-
child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.onFocus == null ? void 0 : _child$props.onFocus(event);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function handleBlur(event) {
|
|
508
|
-
var _child$props2;
|
|
509
|
-
|
|
510
|
-
tooltip.hide();
|
|
511
|
-
child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.onBlur == null ? void 0 : _child$props2.onBlur(event);
|
|
512
|
-
}
|
|
513
476
|
|
|
514
477
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(react.TooltipAnchor, {
|
|
515
|
-
render:
|
|
516
|
-
// Let child props override anchor props so user can specify attributes like tabIndex
|
|
517
|
-
// Also, do not apply the child's props to TooltipAnchor as props like `as` can create problems
|
|
518
|
-
// by applying the replacement component/element twice
|
|
519
|
-
return /*#__PURE__*/React.cloneElement(child, _objectSpread2(_objectSpread2(_objectSpread2({}, child.props), anchorProps), {}, {
|
|
520
|
-
onFocus: handleFocus,
|
|
521
|
-
onBlur: handleBlur
|
|
522
|
-
}));
|
|
523
|
-
},
|
|
478
|
+
render: child,
|
|
524
479
|
store: tooltip,
|
|
525
480
|
ref: child.ref
|
|
526
481
|
}), isOpen && content ? /*#__PURE__*/React.createElement(Box, {
|
|
@@ -2647,15 +2602,12 @@ function Menu(_ref) {
|
|
|
2647
2602
|
const menuStore = react.useMenuStore(_objectSpread2({
|
|
2648
2603
|
focusLoop: true
|
|
2649
2604
|
}, props));
|
|
2650
|
-
const handleItemSelect = React.useCallback(function handleItemSelect(value) {
|
|
2651
|
-
onItemSelect == null ? void 0 : onItemSelect(value);
|
|
2652
|
-
}, [onItemSelect]);
|
|
2653
2605
|
const value = React.useMemo(() => ({
|
|
2654
2606
|
menuStore,
|
|
2655
|
-
handleItemSelect,
|
|
2607
|
+
handleItemSelect: onItemSelect,
|
|
2656
2608
|
getAnchorRect,
|
|
2657
2609
|
setAnchorRect
|
|
2658
|
-
}), [menuStore,
|
|
2610
|
+
}), [menuStore, onItemSelect, getAnchorRect, setAnchorRect]);
|
|
2659
2611
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
2660
2612
|
value: value
|
|
2661
2613
|
}, children);
|
|
@@ -2701,6 +2653,10 @@ const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMen
|
|
|
2701
2653
|
});
|
|
2702
2654
|
menuStore.show();
|
|
2703
2655
|
}, [setAnchorRect, menuStore]);
|
|
2656
|
+
const isOpen = menuStore.useState('open');
|
|
2657
|
+
React.useEffect(() => {
|
|
2658
|
+
if (!isOpen) setAnchorRect(null);
|
|
2659
|
+
}, [isOpen, setAnchorRect]);
|
|
2704
2660
|
return /*#__PURE__*/React.createElement(component, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2705
2661
|
onContextMenu: handleContextMenu,
|
|
2706
2662
|
ref
|
|
@@ -2762,7 +2718,7 @@ const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref)
|
|
|
2762
2718
|
onClick == null ? void 0 : onClick(event);
|
|
2763
2719
|
const onSelectResult = onSelect && !event.defaultPrevented ? onSelect() : undefined;
|
|
2764
2720
|
const shouldClose = onSelectResult !== false && hideOnSelect;
|
|
2765
|
-
handleItemSelect(value);
|
|
2721
|
+
handleItemSelect == null ? void 0 : handleItemSelect(value);
|
|
2766
2722
|
if (shouldClose) hide();
|
|
2767
2723
|
}, [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value]);
|
|
2768
2724
|
return /*#__PURE__*/React.createElement(react.MenuItem, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
@@ -2808,12 +2764,11 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
2808
2764
|
hide: parentMenuHide
|
|
2809
2765
|
} = menuStore;
|
|
2810
2766
|
const handleSubItemSelect = React.useCallback(function handleSubItemSelect(value) {
|
|
2811
|
-
|
|
2812
|
-
parentMenuItemSelect(value);
|
|
2767
|
+
onItemSelect == null ? void 0 : onItemSelect(value);
|
|
2768
|
+
parentMenuItemSelect == null ? void 0 : parentMenuItemSelect(value);
|
|
2813
2769
|
parentMenuHide();
|
|
2814
2770
|
}, [parentMenuHide, parentMenuItemSelect, onItemSelect]);
|
|
2815
|
-
const [button, list] = React.Children.toArray(children); // Ariakit needs to be able to pass props to the MenuButton
|
|
2816
|
-
// and combine it with the MenuItem component
|
|
2771
|
+
const [button, list] = React.Children.toArray(children); // Ariakit needs to be able to pass props to the MenuButton and combine it with the MenuItem component
|
|
2817
2772
|
|
|
2818
2773
|
const renderMenuButton = React.useCallback(function renderMenuButton(props) {
|
|
2819
2774
|
return /*#__PURE__*/React.cloneElement(button, props);
|