@coreui/react 4.10.0 → 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/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 +15 -9
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/popover/CPopover.tsx +126 -117
- package/src/components/tooltip/CTooltip.tsx +131 -114
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.10.
|
|
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`
|
|
@@ -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
|
@@ -6661,10 +6661,11 @@ CProgress.propTypes = {
|
|
|
6661
6661
|
};
|
|
6662
6662
|
CProgress.displayName = 'CProgress';
|
|
6663
6663
|
|
|
6664
|
-
var CPopover = function (_a) {
|
|
6664
|
+
var CPopover = forwardRef(function (_a, ref) {
|
|
6665
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"]);
|
|
6666
6666
|
var popoverRef = useRef(null);
|
|
6667
6667
|
var togglerRef = useRef(null);
|
|
6668
|
+
var forkedRef = useForkedRef(ref, popoverRef);
|
|
6668
6669
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
6669
6670
|
var _j = useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
6670
6671
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -6722,15 +6723,17 @@ var CPopover = function (_a) {
|
|
|
6722
6723
|
typeof window !== 'undefined' &&
|
|
6723
6724
|
createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
6724
6725
|
enter: 0,
|
|
6725
|
-
exit: popoverRef.current
|
|
6726
|
+
exit: popoverRef.current
|
|
6727
|
+
? getTransitionDurationFromElement(popoverRef.current) + 50
|
|
6728
|
+
: 200,
|
|
6726
6729
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', 'bs-popover-auto', {
|
|
6727
6730
|
fade: animation,
|
|
6728
6731
|
show: state === 'entered',
|
|
6729
|
-
}, className), ref:
|
|
6732
|
+
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
6730
6733
|
React.createElement("div", { className: "popover-arrow" }),
|
|
6731
6734
|
React.createElement("div", { className: "popover-header" }, title),
|
|
6732
6735
|
React.createElement("div", { className: "popover-body" }, content))); }), document.body)));
|
|
6733
|
-
};
|
|
6736
|
+
});
|
|
6734
6737
|
CPopover.propTypes = {
|
|
6735
6738
|
animation: PropTypes.bool,
|
|
6736
6739
|
children: PropTypes.node,
|
|
@@ -7274,10 +7277,11 @@ CToaster.propTypes = {
|
|
|
7274
7277
|
};
|
|
7275
7278
|
CToaster.displayName = 'CToaster';
|
|
7276
7279
|
|
|
7277
|
-
var CTooltip = function (_a) {
|
|
7280
|
+
var CTooltip = forwardRef(function (_a, ref) {
|
|
7278
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"]);
|
|
7279
7282
|
var tooltipRef = useRef(null);
|
|
7280
7283
|
var togglerRef = useRef(null);
|
|
7284
|
+
var forkedRef = useForkedRef(ref, tooltipRef);
|
|
7281
7285
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
7282
7286
|
var _j = useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
7283
7287
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -7333,16 +7337,18 @@ var CTooltip = function (_a) {
|
|
|
7333
7337
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
7334
7338
|
}))),
|
|
7335
7339
|
typeof window !== 'undefined' &&
|
|
7336
|
-
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: {
|
|
7337
7341
|
enter: 0,
|
|
7338
|
-
exit: tooltipRef.current
|
|
7342
|
+
exit: tooltipRef.current
|
|
7343
|
+
? getTransitionDurationFromElement(tooltipRef.current) + 50
|
|
7344
|
+
: 200,
|
|
7339
7345
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', 'bs-tooltip-auto', {
|
|
7340
7346
|
fade: animation,
|
|
7341
7347
|
show: state === 'entered',
|
|
7342
|
-
}, className), ref:
|
|
7348
|
+
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
7343
7349
|
React.createElement("div", { className: "tooltip-arrow" }),
|
|
7344
7350
|
React.createElement("div", { className: "tooltip-inner" }, content))); }), document.body)));
|
|
7345
|
-
};
|
|
7351
|
+
});
|
|
7346
7352
|
CTooltip.propTypes = {
|
|
7347
7353
|
animation: PropTypes.bool,
|
|
7348
7354
|
children: PropTypes.node,
|