@coreui/react 4.11.0 → 4.11.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/README.md +1 -1
- package/dist/index.es.js +39 -26
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +39 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/modal/CModal.tsx +1 -4
- package/src/components/popover/CPopover.tsx +24 -13
- package/src/components/tooltip/CTooltip.tsx +24 -12
package/dist/index.js
CHANGED
|
@@ -6109,8 +6109,7 @@ var CModal = React.forwardRef(function (_a, ref) {
|
|
|
6109
6109
|
};
|
|
6110
6110
|
}, [_visible]);
|
|
6111
6111
|
var handleClickOutside = function (event) {
|
|
6112
|
-
if (
|
|
6113
|
-
!modalContentRef.current.contains(event.target)) {
|
|
6112
|
+
if (modalRef.current && modalRef.current == event.target) {
|
|
6114
6113
|
handleDismiss();
|
|
6115
6114
|
}
|
|
6116
6115
|
};
|
|
@@ -6676,10 +6675,11 @@ CProgress.propTypes = {
|
|
|
6676
6675
|
CProgress.displayName = 'CProgress';
|
|
6677
6676
|
|
|
6678
6677
|
var CPopover = React.forwardRef(function (_a, ref) {
|
|
6679
|
-
var children = _a.children, _b = _a.animation, animation = _b === void 0 ? true : _b, className = _a.className, container = _a.container, content = _a.content, _c = _a.delay, delay = _c === void 0 ? 0 : _c, _d = _a.fallbackPlacements, fallbackPlacements = _d === void 0 ? ['top', 'right', 'bottom', 'left'] : _d, _e = _a.offset, offset = _e === void 0 ? [0, 8] : _e, onHide = _a.onHide
|
|
6678
|
+
var children = _a.children, _b = _a.animation, animation = _b === void 0 ? true : _b, className = _a.className, container = _a.container, content = _a.content, _c = _a.delay, delay = _c === void 0 ? 0 : _c, _d = _a.fallbackPlacements, fallbackPlacements = _d === void 0 ? ['top', 'right', 'bottom', 'left'] : _d, _e = _a.offset, offset = _e === void 0 ? [0, 8] : _e, onHide = _a.onHide; _a.onShow; var _f = _a.placement, placement = _f === void 0 ? 'top' : _f, title = _a.title, _g = _a.trigger, trigger = _g === void 0 ? 'click' : _g, visible = _a.visible, rest = __rest(_a, ["children", "animation", "className", "container", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "title", "trigger", "visible"]);
|
|
6680
6679
|
var popoverRef = React.useRef(null);
|
|
6681
6680
|
var togglerRef = React.useRef(null);
|
|
6682
6681
|
var forkedRef = useForkedRef(ref, popoverRef);
|
|
6682
|
+
var uID = React.useRef("popover".concat(Math.floor(Math.random() * 1000000)));
|
|
6683
6683
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
6684
6684
|
var _j = React.useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
6685
6685
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -6709,14 +6709,6 @@ var CPopover = React.forwardRef(function (_a, ref) {
|
|
|
6709
6709
|
React.useEffect(function () {
|
|
6710
6710
|
setVisible(visible);
|
|
6711
6711
|
}, [visible]);
|
|
6712
|
-
React.useEffect(function () {
|
|
6713
|
-
if (_visible && togglerRef.current && popoverRef.current) {
|
|
6714
|
-
initPopper(togglerRef.current, popoverRef.current, popperConfig);
|
|
6715
|
-
}
|
|
6716
|
-
return function () {
|
|
6717
|
-
destroyPopper();
|
|
6718
|
-
};
|
|
6719
|
-
}, [_visible]);
|
|
6720
6712
|
var toggleVisible = function (visible) {
|
|
6721
6713
|
if (visible) {
|
|
6722
6714
|
setTimeout(function () { return setVisible(true); }, _delay.show);
|
|
@@ -6725,7 +6717,9 @@ var CPopover = React.forwardRef(function (_a, ref) {
|
|
|
6725
6717
|
setTimeout(function () { return setVisible(false); }, _delay.hide);
|
|
6726
6718
|
};
|
|
6727
6719
|
return (React.createElement(React.Fragment, null,
|
|
6728
|
-
React.cloneElement(children, __assign(__assign(__assign({
|
|
6720
|
+
React.cloneElement(children, __assign(__assign(__assign(__assign(__assign({}, (_visible && {
|
|
6721
|
+
'aria-describedby': uID.current,
|
|
6722
|
+
})), { ref: togglerRef }), ((trigger === 'click' || trigger.includes('click')) && {
|
|
6729
6723
|
onClick: function () { return toggleVisible(!_visible); },
|
|
6730
6724
|
})), ((trigger === 'focus' || trigger.includes('focus')) && {
|
|
6731
6725
|
onFocus: function () { return toggleVisible(true); },
|
|
@@ -6735,7 +6729,17 @@ var CPopover = React.forwardRef(function (_a, ref) {
|
|
|
6735
6729
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
6736
6730
|
}))),
|
|
6737
6731
|
React.createElement(CConditionalPortal, { container: container, portal: true },
|
|
6738
|
-
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter:
|
|
6732
|
+
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: function () {
|
|
6733
|
+
if (togglerRef.current && popoverRef.current) {
|
|
6734
|
+
initPopper(togglerRef.current, popoverRef.current, popperConfig);
|
|
6735
|
+
}
|
|
6736
|
+
}, onEntering: function () {
|
|
6737
|
+
if (togglerRef.current && popoverRef.current) {
|
|
6738
|
+
popoverRef.current.style.display = 'initial';
|
|
6739
|
+
}
|
|
6740
|
+
}, onExit: onHide, onExited: function () {
|
|
6741
|
+
destroyPopper();
|
|
6742
|
+
}, timeout: {
|
|
6739
6743
|
enter: 0,
|
|
6740
6744
|
exit: popoverRef.current
|
|
6741
6745
|
? getTransitionDurationFromElement(popoverRef.current) + 50
|
|
@@ -6743,7 +6747,9 @@ var CPopover = React.forwardRef(function (_a, ref) {
|
|
|
6743
6747
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', 'bs-popover-auto', {
|
|
6744
6748
|
fade: animation,
|
|
6745
6749
|
show: state === 'entered',
|
|
6746
|
-
}, className), ref: forkedRef, role: "tooltip"
|
|
6750
|
+
}, className), id: uID.current, ref: forkedRef, role: "tooltip", style: {
|
|
6751
|
+
display: 'none',
|
|
6752
|
+
} }, rest),
|
|
6747
6753
|
React.createElement("div", { className: "popover-arrow" }),
|
|
6748
6754
|
React.createElement("div", { className: "popover-header" }, title),
|
|
6749
6755
|
React.createElement("div", { className: "popover-body" }, content))); }))));
|
|
@@ -7293,10 +7299,11 @@ CToaster.propTypes = {
|
|
|
7293
7299
|
CToaster.displayName = 'CToaster';
|
|
7294
7300
|
|
|
7295
7301
|
var CTooltip = React.forwardRef(function (_a, ref) {
|
|
7296
|
-
var children = _a.children, _b = _a.animation, animation = _b === void 0 ? true : _b, className = _a.className, container = _a.container, content = _a.content, _c = _a.delay, delay = _c === void 0 ? 0 : _c, _d = _a.fallbackPlacements, fallbackPlacements = _d === void 0 ? ['top', 'right', 'bottom', 'left'] : _d, _e = _a.offset, offset = _e === void 0 ? [0, 6] : _e, onHide = _a.onHide
|
|
7302
|
+
var children = _a.children, _b = _a.animation, animation = _b === void 0 ? true : _b, className = _a.className, container = _a.container, content = _a.content, _c = _a.delay, delay = _c === void 0 ? 0 : _c, _d = _a.fallbackPlacements, fallbackPlacements = _d === void 0 ? ['top', 'right', 'bottom', 'left'] : _d, _e = _a.offset, offset = _e === void 0 ? [0, 6] : _e, onHide = _a.onHide; _a.onShow; var _f = _a.placement, placement = _f === void 0 ? 'top' : _f, _g = _a.trigger, trigger = _g === void 0 ? ['hover', 'focus'] : _g, visible = _a.visible, rest = __rest(_a, ["children", "animation", "className", "container", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "trigger", "visible"]);
|
|
7297
7303
|
var tooltipRef = React.useRef(null);
|
|
7298
7304
|
var togglerRef = React.useRef(null);
|
|
7299
7305
|
var forkedRef = useForkedRef(ref, tooltipRef);
|
|
7306
|
+
var uID = React.useRef("tooltip".concat(Math.floor(Math.random() * 1000000)));
|
|
7300
7307
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
7301
7308
|
var _j = React.useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
7302
7309
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -7326,14 +7333,6 @@ var CTooltip = React.forwardRef(function (_a, ref) {
|
|
|
7326
7333
|
React.useEffect(function () {
|
|
7327
7334
|
setVisible(visible);
|
|
7328
7335
|
}, [visible]);
|
|
7329
|
-
React.useEffect(function () {
|
|
7330
|
-
if (_visible && togglerRef.current && tooltipRef.current) {
|
|
7331
|
-
initPopper(togglerRef.current, tooltipRef.current, popperConfig);
|
|
7332
|
-
}
|
|
7333
|
-
return function () {
|
|
7334
|
-
destroyPopper();
|
|
7335
|
-
};
|
|
7336
|
-
}, [_visible]);
|
|
7337
7336
|
var toggleVisible = function (visible) {
|
|
7338
7337
|
if (visible) {
|
|
7339
7338
|
setTimeout(function () { return setVisible(true); }, _delay.show);
|
|
@@ -7342,7 +7341,9 @@ var CTooltip = React.forwardRef(function (_a, ref) {
|
|
|
7342
7341
|
setTimeout(function () { return setVisible(false); }, _delay.hide);
|
|
7343
7342
|
};
|
|
7344
7343
|
return (React.createElement(React.Fragment, null,
|
|
7345
|
-
React.cloneElement(children, __assign(__assign(__assign({
|
|
7344
|
+
React.cloneElement(children, __assign(__assign(__assign(__assign(__assign({}, (_visible && {
|
|
7345
|
+
'aria-describedby': uID.current,
|
|
7346
|
+
})), { ref: togglerRef }), ((trigger === 'click' || trigger.includes('click')) && {
|
|
7346
7347
|
onClick: function () { return toggleVisible(!_visible); },
|
|
7347
7348
|
})), ((trigger === 'focus' || trigger.includes('focus')) && {
|
|
7348
7349
|
onFocus: function () { return toggleVisible(true); },
|
|
@@ -7352,7 +7353,17 @@ var CTooltip = React.forwardRef(function (_a, ref) {
|
|
|
7352
7353
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
7353
7354
|
}))),
|
|
7354
7355
|
React.createElement(CConditionalPortal, { container: container, portal: true },
|
|
7355
|
-
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: tooltipRef, onEnter:
|
|
7356
|
+
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: tooltipRef, onEnter: function () {
|
|
7357
|
+
if (togglerRef.current && tooltipRef.current) {
|
|
7358
|
+
initPopper(togglerRef.current, tooltipRef.current, popperConfig);
|
|
7359
|
+
}
|
|
7360
|
+
}, onEntering: function () {
|
|
7361
|
+
if (togglerRef.current && tooltipRef.current) {
|
|
7362
|
+
tooltipRef.current.style.display = 'initial';
|
|
7363
|
+
}
|
|
7364
|
+
}, onExit: onHide, onExited: function () {
|
|
7365
|
+
destroyPopper();
|
|
7366
|
+
}, timeout: {
|
|
7356
7367
|
enter: 0,
|
|
7357
7368
|
exit: tooltipRef.current
|
|
7358
7369
|
? getTransitionDurationFromElement(tooltipRef.current) + 50
|
|
@@ -7360,7 +7371,9 @@ var CTooltip = React.forwardRef(function (_a, ref) {
|
|
|
7360
7371
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', 'bs-tooltip-auto', {
|
|
7361
7372
|
fade: animation,
|
|
7362
7373
|
show: state === 'entered',
|
|
7363
|
-
}, className), ref: forkedRef, role: "tooltip"
|
|
7374
|
+
}, className), id: uID.current, ref: forkedRef, role: "tooltip", style: {
|
|
7375
|
+
display: 'none',
|
|
7376
|
+
} }, rest),
|
|
7364
7377
|
React.createElement("div", { className: "tooltip-arrow" }),
|
|
7365
7378
|
React.createElement("div", { className: "tooltip-inner" }, content))); }))));
|
|
7366
7379
|
});
|