@coreui/react 4.9.2 → 4.10.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/components/modal/CModal.d.ts +6 -0
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/tooltip/CTooltip copy.d.ts +60 -0
- package/dist/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/index.es.js +122 -50
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +122 -50
- package/dist/index.js.map +1 -1
- package/dist/utils/executeAfterTransition.d.ts +2 -0
- package/dist/utils/getTransitionDurationFromElement.d.ts +2 -0
- package/dist/utils/index.d.ts +3 -1
- package/package.json +1 -1
- package/src/components/modal/CModal.tsx +20 -6
- package/src/components/offcanvas/COffcanvas.tsx +1 -1
- package/src/components/popover/CPopover.tsx +127 -118
- package/src/components/sidebar/CSidebar.tsx +1 -1
- package/src/components/tooltip/CTooltip.tsx +132 -115
- package/src/hooks/usePopper.ts +10 -2
- package/src/utils/executeAfterTransition.ts +46 -0
- package/src/utils/getTransitionDurationFromElement.ts +24 -0
- package/src/utils/index.ts +9 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
Several quick start options are available:
|
|
48
48
|
|
|
49
|
-
- [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.
|
|
49
|
+
- [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.10.1.zip)
|
|
50
50
|
- Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
|
|
51
51
|
- Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
|
|
52
52
|
- Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
|
|
@@ -16,6 +16,12 @@ export interface CModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
16
16
|
* @ignore
|
|
17
17
|
*/
|
|
18
18
|
duration?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Puts the focus on the modal when shown.
|
|
21
|
+
*
|
|
22
|
+
* @since v4.10.0
|
|
23
|
+
*/
|
|
24
|
+
focus?: boolean;
|
|
19
25
|
/**
|
|
20
26
|
* Set modal to covers the entire user viewport.
|
|
21
27
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { Placements, Triggers } from '../../types';
|
|
3
3
|
export interface CPopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'content'> {
|
|
4
4
|
/**
|
|
@@ -61,4 +61,4 @@ export interface CPopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'tit
|
|
|
61
61
|
*/
|
|
62
62
|
visible?: boolean;
|
|
63
63
|
}
|
|
64
|
-
export declare const CPopover:
|
|
64
|
+
export declare const CPopover: React.ForwardRefExoticComponent<CPopoverProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { Placements, Triggers } from '../../types';
|
|
3
|
+
export interface CTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
4
|
+
/**
|
|
5
|
+
* Apply a CSS fade transition to the tooltip.
|
|
6
|
+
*
|
|
7
|
+
* @since 4.9.0
|
|
8
|
+
*/
|
|
9
|
+
animation?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* A string of all className you want applied to the component.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Content node for your component.
|
|
16
|
+
*/
|
|
17
|
+
content: ReactNode | string;
|
|
18
|
+
/**
|
|
19
|
+
* The delay for displaying and hiding the tooltip (in milliseconds). When a numerical value is provided, the delay applies to both the hide and show actions. The object structure for specifying the delay is as follows: delay: `{ 'show': 500, 'hide': 100 }`.
|
|
20
|
+
*
|
|
21
|
+
* @since 4.9.0
|
|
22
|
+
*/
|
|
23
|
+
delay?: number | {
|
|
24
|
+
show: number;
|
|
25
|
+
hide: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Specify the desired order of fallback placements by providing a list of placements as an array. The placements should be prioritized based on preference.
|
|
29
|
+
*
|
|
30
|
+
* @since 4.9.0
|
|
31
|
+
*/
|
|
32
|
+
fallbackPlacements?: Placements | Placements[];
|
|
33
|
+
/**
|
|
34
|
+
* Offset of the tooltip relative to its target.
|
|
35
|
+
*/
|
|
36
|
+
offset?: [number, number];
|
|
37
|
+
/**
|
|
38
|
+
* Callback fired when the component requests to be hidden.
|
|
39
|
+
*/
|
|
40
|
+
onHide?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Callback fired when the component requests to be shown.
|
|
43
|
+
*/
|
|
44
|
+
onShow?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.
|
|
47
|
+
*
|
|
48
|
+
* @type 'hover' | 'focus' | 'click'
|
|
49
|
+
*/
|
|
50
|
+
trigger?: Triggers | Triggers[];
|
|
51
|
+
/**
|
|
52
|
+
* Describes the placement of your component after Popper.js has applied all the modifiers that may have flipped or altered the originally provided placement property.
|
|
53
|
+
*/
|
|
54
|
+
placement?: 'auto' | 'top' | 'right' | 'bottom' | 'left';
|
|
55
|
+
/**
|
|
56
|
+
* Toggle the visibility of tooltip component.
|
|
57
|
+
*/
|
|
58
|
+
visible?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export declare const CTooltip: FC<CTooltipProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { Placements, Triggers } from '../../types';
|
|
3
3
|
export interface CTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
4
4
|
/**
|
|
@@ -57,4 +57,4 @@ export interface CTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'con
|
|
|
57
57
|
*/
|
|
58
58
|
visible?: boolean;
|
|
59
59
|
}
|
|
60
|
-
export declare const CTooltip:
|
|
60
|
+
export declare const CTooltip: React.ForwardRefExoticComponent<CTooltipProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/index.es.js
CHANGED
|
@@ -4309,14 +4309,103 @@ var createPopper = /*#__PURE__*/popperGenerator({
|
|
|
4309
4309
|
defaultModifiers: defaultModifiers
|
|
4310
4310
|
}); // eslint-disable-next-line import/no-unused-modules
|
|
4311
4311
|
|
|
4312
|
+
var getTransitionDurationFromElement = function (element) {
|
|
4313
|
+
if (!element) {
|
|
4314
|
+
return 0;
|
|
4315
|
+
}
|
|
4316
|
+
// Get transition-duration of the element
|
|
4317
|
+
var _a = window.getComputedStyle(element), transitionDuration = _a.transitionDuration, transitionDelay = _a.transitionDelay;
|
|
4318
|
+
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
|
4319
|
+
var floatTransitionDelay = Number.parseFloat(transitionDelay);
|
|
4320
|
+
// Return 0 if element or transition duration is not found
|
|
4321
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
4322
|
+
return 0;
|
|
4323
|
+
}
|
|
4324
|
+
// If multiple durations are defined, take the first
|
|
4325
|
+
transitionDuration = transitionDuration.split(',')[0];
|
|
4326
|
+
transitionDelay = transitionDelay.split(',')[0];
|
|
4327
|
+
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * 1000;
|
|
4328
|
+
};
|
|
4329
|
+
|
|
4330
|
+
var execute = function (callback) {
|
|
4331
|
+
if (typeof callback === 'function') {
|
|
4332
|
+
callback();
|
|
4333
|
+
}
|
|
4334
|
+
};
|
|
4335
|
+
var triggerTransitionEnd = function (element) {
|
|
4336
|
+
element.dispatchEvent(new Event('transitionend'));
|
|
4337
|
+
};
|
|
4338
|
+
var executeAfterTransition = function (callback, transitionElement, waitForTransition) {
|
|
4339
|
+
if (waitForTransition === void 0) { waitForTransition = true; }
|
|
4340
|
+
if (!waitForTransition) {
|
|
4341
|
+
execute(callback);
|
|
4342
|
+
return;
|
|
4343
|
+
}
|
|
4344
|
+
var durationPadding = 5;
|
|
4345
|
+
var emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
|
4346
|
+
var called = false;
|
|
4347
|
+
var handler = function (_a) {
|
|
4348
|
+
var target = _a.target;
|
|
4349
|
+
if (target !== transitionElement) {
|
|
4350
|
+
return;
|
|
4351
|
+
}
|
|
4352
|
+
called = true;
|
|
4353
|
+
transitionElement.removeEventListener('transitionend', handler);
|
|
4354
|
+
execute(callback);
|
|
4355
|
+
};
|
|
4356
|
+
transitionElement.addEventListener('transitionend', handler);
|
|
4357
|
+
setTimeout(function () {
|
|
4358
|
+
if (!called) {
|
|
4359
|
+
triggerTransitionEnd(transitionElement);
|
|
4360
|
+
}
|
|
4361
|
+
}, emulatedDuration);
|
|
4362
|
+
};
|
|
4363
|
+
|
|
4364
|
+
var isRTL = function (element) {
|
|
4365
|
+
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
|
|
4366
|
+
return true;
|
|
4367
|
+
}
|
|
4368
|
+
if (element) {
|
|
4369
|
+
return element.closest('[dir="rtl"]') !== null;
|
|
4370
|
+
}
|
|
4371
|
+
return false;
|
|
4372
|
+
};
|
|
4373
|
+
|
|
4374
|
+
var getRTLPlacement = function (placement, element) {
|
|
4375
|
+
switch (placement) {
|
|
4376
|
+
case 'right': {
|
|
4377
|
+
return isRTL(element) ? 'left' : 'right';
|
|
4378
|
+
}
|
|
4379
|
+
case 'left': {
|
|
4380
|
+
return isRTL(element) ? 'right' : 'left';
|
|
4381
|
+
}
|
|
4382
|
+
default: {
|
|
4383
|
+
return placement;
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
};
|
|
4387
|
+
|
|
4388
|
+
var isInViewport = function (element) {
|
|
4389
|
+
var rect = element.getBoundingClientRect();
|
|
4390
|
+
return (Math.floor(rect.top) >= 0 &&
|
|
4391
|
+
Math.floor(rect.left) >= 0 &&
|
|
4392
|
+
Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
4393
|
+
Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth));
|
|
4394
|
+
};
|
|
4395
|
+
|
|
4312
4396
|
var usePopper = function () {
|
|
4313
4397
|
var _popper = useRef();
|
|
4398
|
+
var el = useRef();
|
|
4314
4399
|
var initPopper = function (reference, popper, options) {
|
|
4315
4400
|
_popper.current = createPopper(reference, popper, options);
|
|
4401
|
+
el.current = popper;
|
|
4316
4402
|
};
|
|
4317
4403
|
var destroyPopper = function () {
|
|
4318
|
-
|
|
4319
|
-
|
|
4404
|
+
var popperInstance = _popper.current;
|
|
4405
|
+
if (popperInstance && el.current) {
|
|
4406
|
+
executeAfterTransition(function () {
|
|
4407
|
+
popperInstance.destroy();
|
|
4408
|
+
}, el.current);
|
|
4320
4409
|
}
|
|
4321
4410
|
_popper.current = undefined;
|
|
4322
4411
|
};
|
|
@@ -4832,38 +4921,6 @@ CCardTitle.propTypes = {
|
|
|
4832
4921
|
};
|
|
4833
4922
|
CCardTitle.displayName = 'CCardTitle';
|
|
4834
4923
|
|
|
4835
|
-
var isRTL = function (element) {
|
|
4836
|
-
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
|
|
4837
|
-
return true;
|
|
4838
|
-
}
|
|
4839
|
-
if (element) {
|
|
4840
|
-
return element.closest('[dir="rtl"]') !== null;
|
|
4841
|
-
}
|
|
4842
|
-
return false;
|
|
4843
|
-
};
|
|
4844
|
-
|
|
4845
|
-
var getRTLPlacement = function (placement, element) {
|
|
4846
|
-
switch (placement) {
|
|
4847
|
-
case 'right': {
|
|
4848
|
-
return isRTL(element) ? 'left' : 'right';
|
|
4849
|
-
}
|
|
4850
|
-
case 'left': {
|
|
4851
|
-
return isRTL(element) ? 'right' : 'left';
|
|
4852
|
-
}
|
|
4853
|
-
default: {
|
|
4854
|
-
return placement;
|
|
4855
|
-
}
|
|
4856
|
-
}
|
|
4857
|
-
};
|
|
4858
|
-
|
|
4859
|
-
var isInViewport = function (element) {
|
|
4860
|
-
var rect = element.getBoundingClientRect();
|
|
4861
|
-
return (Math.floor(rect.top) >= 0 &&
|
|
4862
|
-
Math.floor(rect.left) >= 0 &&
|
|
4863
|
-
Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
4864
|
-
Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth));
|
|
4865
|
-
};
|
|
4866
|
-
|
|
4867
4924
|
var CCarouselContext = createContext({});
|
|
4868
4925
|
var CCarousel = forwardRef(function (_a, ref) {
|
|
4869
4926
|
var children = _a.children, _b = _a.activeIndex, activeIndex = _b === void 0 ? 0 : _b, className = _a.className, controls = _a.controls, dark = _a.dark, indicators = _a.indicators, _c = _a.interval, interval = _c === void 0 ? 5000 : _c, onSlid = _a.onSlid, onSlide = _a.onSlide, _d = _a.pause, pause = _d === void 0 ? 'hover' : _d, _e = _a.touch, touch = _e === void 0 ? true : _e, transition = _a.transition, _f = _a.wrap, wrap = _f === void 0 ? true : _f, rest = __rest(_a, ["children", "activeIndex", "className", "controls", "dark", "indicators", "interval", "onSlid", "onSlide", "pause", "touch", "transition", "wrap"]);
|
|
@@ -5969,12 +6026,13 @@ CModalDialog.displayName = 'CModalDialog';
|
|
|
5969
6026
|
|
|
5970
6027
|
var CModalContext = createContext({});
|
|
5971
6028
|
var CModal = forwardRef(function (_a, ref) {
|
|
5972
|
-
var children = _a.children, alignment = _a.alignment, _b = _a.backdrop, backdrop = _b === void 0 ? true : _b, className = _a.className, _c = _a.duration, duration = _c === void 0 ? 150 : _c, fullscreen = _a.fullscreen,
|
|
6029
|
+
var children = _a.children, alignment = _a.alignment, _b = _a.backdrop, backdrop = _b === void 0 ? true : _b, className = _a.className, _c = _a.duration, duration = _c === void 0 ? 150 : _c, _d = _a.focus, focus = _d === void 0 ? true : _d, fullscreen = _a.fullscreen, _e = _a.keyboard, keyboard = _e === void 0 ? true : _e, onClose = _a.onClose, onClosePrevented = _a.onClosePrevented, onShow = _a.onShow, _f = _a.portal, portal = _f === void 0 ? true : _f, scrollable = _a.scrollable, size = _a.size, _g = _a.transition, transition = _g === void 0 ? true : _g, _h = _a.unmountOnClose, unmountOnClose = _h === void 0 ? true : _h, visible = _a.visible, rest = __rest(_a, ["children", "alignment", "backdrop", "className", "duration", "focus", "fullscreen", "keyboard", "onClose", "onClosePrevented", "onShow", "portal", "scrollable", "size", "transition", "unmountOnClose", "visible"]);
|
|
6030
|
+
var activeElementRef = useRef(null);
|
|
5973
6031
|
var modalRef = useRef(null);
|
|
5974
6032
|
var modalContentRef = useRef(null);
|
|
5975
6033
|
var forkedRef = useForkedRef(ref, modalRef);
|
|
5976
|
-
var
|
|
5977
|
-
var
|
|
6034
|
+
var _j = useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
6035
|
+
var _k = useState(false), staticBackdrop = _k[0], setStaticBackdrop = _k[1];
|
|
5978
6036
|
var contextValues = {
|
|
5979
6037
|
visible: _visible,
|
|
5980
6038
|
setVisible: setVisible,
|
|
@@ -5983,10 +6041,15 @@ var CModal = forwardRef(function (_a, ref) {
|
|
|
5983
6041
|
setVisible(visible);
|
|
5984
6042
|
}, [visible]);
|
|
5985
6043
|
useEffect(function () {
|
|
6044
|
+
var _a;
|
|
5986
6045
|
if (_visible) {
|
|
6046
|
+
activeElementRef.current = document.activeElement;
|
|
5987
6047
|
document.addEventListener('mouseup', handleClickOutside);
|
|
5988
6048
|
document.addEventListener('keydown', handleKeyDown);
|
|
5989
6049
|
}
|
|
6050
|
+
else {
|
|
6051
|
+
(_a = activeElementRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
6052
|
+
}
|
|
5990
6053
|
return function () {
|
|
5991
6054
|
document.removeEventListener('mouseup', handleClickOutside);
|
|
5992
6055
|
document.removeEventListener('keydown', handleKeyDown);
|
|
@@ -6013,7 +6076,7 @@ var CModal = forwardRef(function (_a, ref) {
|
|
|
6013
6076
|
}
|
|
6014
6077
|
setTimeout(function () {
|
|
6015
6078
|
var _a;
|
|
6016
|
-
(_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
6079
|
+
focus && ((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
6017
6080
|
}, transition ? duration : 0);
|
|
6018
6081
|
}
|
|
6019
6082
|
else {
|
|
@@ -6045,13 +6108,15 @@ var CModal = forwardRef(function (_a, ref) {
|
|
|
6045
6108
|
return (React.createElement(React.Fragment, null,
|
|
6046
6109
|
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: modalRef, onEnter: onShow, onExit: onClose, unmountOnExit: unmountOnClose, timeout: transition ? duration : 0 }, function (state) { return (React.createElement(CConditionalPortal, { portal: portal },
|
|
6047
6110
|
React.createElement(CModalContext.Provider, { value: contextValues },
|
|
6048
|
-
React.createElement("div", { className: classNames('modal', {
|
|
6111
|
+
React.createElement("div", __assign({ className: classNames('modal', {
|
|
6049
6112
|
'modal-static': staticBackdrop,
|
|
6050
6113
|
fade: transition,
|
|
6051
6114
|
show: state === 'entered',
|
|
6052
|
-
}, className), tabIndex: -1
|
|
6115
|
+
}, className), tabIndex: -1 }, (_visible
|
|
6116
|
+
? { 'aria-modal': true, role: 'dialog' }
|
|
6117
|
+
: { 'aria-hidden': 'true' }), { style: __assign({}, (state !== 'exited' && { display: 'block' })) }, rest, { ref: forkedRef }),
|
|
6053
6118
|
React.createElement(CModalDialog, { alignment: alignment, fullscreen: fullscreen, scrollable: scrollable, size: size },
|
|
6054
|
-
React.createElement(CModalContent,
|
|
6119
|
+
React.createElement(CModalContent, { ref: modalContentRef }, children)))))); }),
|
|
6055
6120
|
backdrop && (React.createElement(CConditionalPortal, { portal: portal },
|
|
6056
6121
|
React.createElement(CBackdrop, { visible: _visible })))));
|
|
6057
6122
|
});
|
|
@@ -6061,6 +6126,7 @@ CModal.propTypes = {
|
|
|
6061
6126
|
children: PropTypes.node,
|
|
6062
6127
|
className: PropTypes.string,
|
|
6063
6128
|
duration: PropTypes.number,
|
|
6129
|
+
focus: PropTypes.bool,
|
|
6064
6130
|
fullscreen: PropTypes.oneOfType([
|
|
6065
6131
|
PropTypes.bool,
|
|
6066
6132
|
PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
|
|
@@ -6595,10 +6661,11 @@ CProgress.propTypes = {
|
|
|
6595
6661
|
};
|
|
6596
6662
|
CProgress.displayName = 'CProgress';
|
|
6597
6663
|
|
|
6598
|
-
var CPopover = function (_a) {
|
|
6664
|
+
var CPopover = forwardRef(function (_a, ref) {
|
|
6599
6665
|
var children = _a.children, _b = _a.animation, animation = _b === void 0 ? true : _b, className = _a.className, 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, onShow = _a.onShow, _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", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "title", "trigger", "visible"]);
|
|
6600
6666
|
var popoverRef = useRef(null);
|
|
6601
6667
|
var togglerRef = useRef(null);
|
|
6668
|
+
var forkedRef = useForkedRef(ref, popoverRef);
|
|
6602
6669
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
6603
6670
|
var _j = useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
6604
6671
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -6656,15 +6723,17 @@ var CPopover = function (_a) {
|
|
|
6656
6723
|
typeof window !== 'undefined' &&
|
|
6657
6724
|
createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
6658
6725
|
enter: 0,
|
|
6659
|
-
exit:
|
|
6726
|
+
exit: popoverRef.current
|
|
6727
|
+
? getTransitionDurationFromElement(popoverRef.current) + 50
|
|
6728
|
+
: 200,
|
|
6660
6729
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', 'bs-popover-auto', {
|
|
6661
6730
|
fade: animation,
|
|
6662
6731
|
show: state === 'entered',
|
|
6663
|
-
}, className), ref:
|
|
6732
|
+
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
6664
6733
|
React.createElement("div", { className: "popover-arrow" }),
|
|
6665
6734
|
React.createElement("div", { className: "popover-header" }, title),
|
|
6666
6735
|
React.createElement("div", { className: "popover-body" }, content))); }), document.body)));
|
|
6667
|
-
};
|
|
6736
|
+
});
|
|
6668
6737
|
CPopover.propTypes = {
|
|
6669
6738
|
animation: PropTypes.bool,
|
|
6670
6739
|
children: PropTypes.node,
|
|
@@ -7208,10 +7277,11 @@ CToaster.propTypes = {
|
|
|
7208
7277
|
};
|
|
7209
7278
|
CToaster.displayName = 'CToaster';
|
|
7210
7279
|
|
|
7211
|
-
var CTooltip = function (_a) {
|
|
7280
|
+
var CTooltip = forwardRef(function (_a, ref) {
|
|
7212
7281
|
var children = _a.children, _b = _a.animation, animation = _b === void 0 ? true : _b, className = _a.className, 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, onShow = _a.onShow, _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", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "trigger", "visible"]);
|
|
7213
7282
|
var tooltipRef = useRef(null);
|
|
7214
7283
|
var togglerRef = useRef(null);
|
|
7284
|
+
var forkedRef = useForkedRef(ref, tooltipRef);
|
|
7215
7285
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
7216
7286
|
var _j = useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
7217
7287
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -7267,16 +7337,18 @@ var CTooltip = function (_a) {
|
|
|
7267
7337
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
7268
7338
|
}))),
|
|
7269
7339
|
typeof window !== 'undefined' &&
|
|
7270
|
-
createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, onEnter: onShow, onExit: onHide, timeout: {
|
|
7340
|
+
createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: tooltipRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
7271
7341
|
enter: 0,
|
|
7272
|
-
exit:
|
|
7342
|
+
exit: tooltipRef.current
|
|
7343
|
+
? getTransitionDurationFromElement(tooltipRef.current) + 50
|
|
7344
|
+
: 200,
|
|
7273
7345
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', 'bs-tooltip-auto', {
|
|
7274
7346
|
fade: animation,
|
|
7275
7347
|
show: state === 'entered',
|
|
7276
|
-
}, className), ref:
|
|
7348
|
+
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
7277
7349
|
React.createElement("div", { className: "tooltip-arrow" }),
|
|
7278
7350
|
React.createElement("div", { className: "tooltip-inner" }, content))); }), document.body)));
|
|
7279
|
-
};
|
|
7351
|
+
});
|
|
7280
7352
|
CTooltip.propTypes = {
|
|
7281
7353
|
animation: PropTypes.bool,
|
|
7282
7354
|
children: PropTypes.node,
|