@coreui/react 4.10.0 → 4.11.0
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/conditional-portal/CConditionalPortal.d.ts +7 -1
- package/dist/components/dropdown/CDropdown.d.ts +6 -0
- package/dist/components/popover/CPopover.d.ts +8 -2
- package/dist/components/tooltip/CTooltip copy.d.ts +60 -0
- package/dist/components/tooltip/CTooltip.d.ts +8 -2
- package/dist/index.es.js +42 -22
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +42 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/conditional-portal/CConditionalPortal.tsx +31 -6
- package/src/components/dropdown/CDropdown.tsx +8 -0
- package/src/components/dropdown/CDropdownMenu.tsx +2 -2
- package/src/components/popover/CPopover.tsx +104 -88
- package/src/components/tooltip/CTooltip.tsx +103 -87
package/dist/index.js
CHANGED
|
@@ -5160,13 +5160,24 @@ CCarouselItem.propTypes = {
|
|
|
5160
5160
|
};
|
|
5161
5161
|
CCarouselItem.displayName = 'CCarouselItem';
|
|
5162
5162
|
|
|
5163
|
+
var getContainer = function (container) {
|
|
5164
|
+
if (container) {
|
|
5165
|
+
return typeof container === 'function' ? container() : container;
|
|
5166
|
+
}
|
|
5167
|
+
return document.body;
|
|
5168
|
+
};
|
|
5163
5169
|
var CConditionalPortal = function (_a) {
|
|
5164
|
-
var children = _a.children, portal = _a.portal;
|
|
5165
|
-
|
|
5170
|
+
var children = _a.children, container = _a.container, portal = _a.portal;
|
|
5171
|
+
var _b = React.useState(null), _container = _b[0], setContainer = _b[1];
|
|
5172
|
+
React.useEffect(function () {
|
|
5173
|
+
portal && setContainer(getContainer(container) || document.body);
|
|
5174
|
+
}, [container, portal]);
|
|
5175
|
+
return typeof window !== 'undefined' && portal && _container ? (ReactDOM.createPortal(children, _container)) : (React.createElement(React.Fragment, null, children));
|
|
5166
5176
|
};
|
|
5167
5177
|
CConditionalPortal.propTypes = {
|
|
5168
5178
|
children: PropTypes.node,
|
|
5169
|
-
|
|
5179
|
+
container: PropTypes.any,
|
|
5180
|
+
portal: PropTypes.bool,
|
|
5170
5181
|
};
|
|
5171
5182
|
CConditionalPortal.displayName = 'CConditionalPortal';
|
|
5172
5183
|
|
|
@@ -5192,7 +5203,7 @@ var getPlacement = function (placement, direction, alignment, isRTL) {
|
|
|
5192
5203
|
var CDropdownContext = React.createContext({});
|
|
5193
5204
|
var CDropdown = React.forwardRef(function (_a, ref) {
|
|
5194
5205
|
var _b;
|
|
5195
|
-
var children = _a.children, alignment = _a.alignment, _c = _a.autoClose, autoClose = _c === void 0 ? true : _c, className = _a.className, dark = _a.dark, direction = _a.direction, _d = _a.offset, offset = _d === void 0 ? [0, 2] : _d, onHide = _a.onHide, onShow = _a.onShow, _e = _a.placement, placement = _e === void 0 ? 'bottom-start' : _e, _f = _a.popper, popper = _f === void 0 ? true : _f, _g = _a.portal, portal = _g === void 0 ? false : _g, _h = _a.variant, variant = _h === void 0 ? 'btn-group' : _h, _j = _a.component, component = _j === void 0 ? 'div' : _j, _k = _a.visible, visible = _k === void 0 ? false : _k, rest = __rest(_a, ["children", "alignment", "autoClose", "className", "dark", "direction", "offset", "onHide", "onShow", "placement", "popper", "portal", "variant", "component", "visible"]);
|
|
5206
|
+
var children = _a.children, alignment = _a.alignment, _c = _a.autoClose, autoClose = _c === void 0 ? true : _c, className = _a.className, container = _a.container, dark = _a.dark, direction = _a.direction, _d = _a.offset, offset = _d === void 0 ? [0, 2] : _d, onHide = _a.onHide, onShow = _a.onShow, _e = _a.placement, placement = _e === void 0 ? 'bottom-start' : _e, _f = _a.popper, popper = _f === void 0 ? true : _f, _g = _a.portal, portal = _g === void 0 ? false : _g, _h = _a.variant, variant = _h === void 0 ? 'btn-group' : _h, _j = _a.component, component = _j === void 0 ? 'div' : _j, _k = _a.visible, visible = _k === void 0 ? false : _k, rest = __rest(_a, ["children", "alignment", "autoClose", "className", "container", "dark", "direction", "offset", "onHide", "onShow", "placement", "popper", "portal", "variant", "component", "visible"]);
|
|
5196
5207
|
var dropdownRef = React.useRef(null);
|
|
5197
5208
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5198
5209
|
var dropdownToggleRef = React.useRef(null);
|
|
@@ -5207,6 +5218,7 @@ var CDropdown = React.forwardRef(function (_a, ref) {
|
|
|
5207
5218
|
}
|
|
5208
5219
|
var contextValues = {
|
|
5209
5220
|
alignment: alignment,
|
|
5221
|
+
container: container,
|
|
5210
5222
|
dark: dark,
|
|
5211
5223
|
dropdownToggleRef: dropdownToggleRef,
|
|
5212
5224
|
dropdownMenuRef: dropdownMenuRef,
|
|
@@ -5361,9 +5373,9 @@ var alignmentClassNames = function (alignment) {
|
|
|
5361
5373
|
};
|
|
5362
5374
|
var CDropdownMenu = React.forwardRef(function (_a, ref) {
|
|
5363
5375
|
var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'ul' : _b, rest = __rest(_a, ["children", "className", "component"]);
|
|
5364
|
-
var _c = React.useContext(CDropdownContext), alignment = _c.alignment, dark = _c.dark, dropdownMenuRef = _c.dropdownMenuRef, popper = _c.popper, portal = _c.portal, visible = _c.visible;
|
|
5376
|
+
var _c = React.useContext(CDropdownContext), alignment = _c.alignment, container = _c.container, dark = _c.dark, dropdownMenuRef = _c.dropdownMenuRef, popper = _c.popper, portal = _c.portal, visible = _c.visible;
|
|
5365
5377
|
var forkedRef = useForkedRef(ref, dropdownMenuRef);
|
|
5366
|
-
return (React.createElement(CConditionalPortal, { portal: portal !== null && portal !== void 0 ? portal : false },
|
|
5378
|
+
return (React.createElement(CConditionalPortal, { container: container, portal: portal !== null && portal !== void 0 ? portal : false },
|
|
5367
5379
|
React.createElement(Component, __assign({ className: classNames('dropdown-menu', {
|
|
5368
5380
|
'dropdown-menu-dark': dark,
|
|
5369
5381
|
show: visible,
|
|
@@ -6663,10 +6675,11 @@ CProgress.propTypes = {
|
|
|
6663
6675
|
};
|
|
6664
6676
|
CProgress.displayName = 'CProgress';
|
|
6665
6677
|
|
|
6666
|
-
var CPopover = function (_a) {
|
|
6667
|
-
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"]);
|
|
6678
|
+
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, 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", "container", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "title", "trigger", "visible"]);
|
|
6668
6680
|
var popoverRef = React.useRef(null);
|
|
6669
6681
|
var togglerRef = React.useRef(null);
|
|
6682
|
+
var forkedRef = useForkedRef(ref, popoverRef);
|
|
6670
6683
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
6671
6684
|
var _j = React.useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
6672
6685
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -6721,22 +6734,25 @@ var CPopover = function (_a) {
|
|
|
6721
6734
|
onMouseEnter: function () { return toggleVisible(true); },
|
|
6722
6735
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
6723
6736
|
}))),
|
|
6724
|
-
|
|
6725
|
-
|
|
6737
|
+
React.createElement(CConditionalPortal, { container: container, portal: true },
|
|
6738
|
+
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
6726
6739
|
enter: 0,
|
|
6727
|
-
exit: popoverRef.current
|
|
6740
|
+
exit: popoverRef.current
|
|
6741
|
+
? getTransitionDurationFromElement(popoverRef.current) + 50
|
|
6742
|
+
: 200,
|
|
6728
6743
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', 'bs-popover-auto', {
|
|
6729
6744
|
fade: animation,
|
|
6730
6745
|
show: state === 'entered',
|
|
6731
|
-
}, className), ref:
|
|
6746
|
+
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
6732
6747
|
React.createElement("div", { className: "popover-arrow" }),
|
|
6733
6748
|
React.createElement("div", { className: "popover-header" }, title),
|
|
6734
|
-
React.createElement("div", { className: "popover-body" }, content))); })
|
|
6735
|
-
};
|
|
6749
|
+
React.createElement("div", { className: "popover-body" }, content))); }))));
|
|
6750
|
+
});
|
|
6736
6751
|
CPopover.propTypes = {
|
|
6737
6752
|
animation: PropTypes.bool,
|
|
6738
6753
|
children: PropTypes.node,
|
|
6739
6754
|
className: PropTypes.string,
|
|
6755
|
+
container: PropTypes.any,
|
|
6740
6756
|
content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
6741
6757
|
delay: PropTypes.oneOfType([
|
|
6742
6758
|
PropTypes.number,
|
|
@@ -7276,10 +7292,11 @@ CToaster.propTypes = {
|
|
|
7276
7292
|
};
|
|
7277
7293
|
CToaster.displayName = 'CToaster';
|
|
7278
7294
|
|
|
7279
|
-
var CTooltip = function (_a) {
|
|
7280
|
-
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"]);
|
|
7295
|
+
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, 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", "container", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "trigger", "visible"]);
|
|
7281
7297
|
var tooltipRef = React.useRef(null);
|
|
7282
7298
|
var togglerRef = React.useRef(null);
|
|
7299
|
+
var forkedRef = useForkedRef(ref, tooltipRef);
|
|
7283
7300
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
7284
7301
|
var _j = React.useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
7285
7302
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -7334,20 +7351,23 @@ var CTooltip = function (_a) {
|
|
|
7334
7351
|
onMouseEnter: function () { return toggleVisible(true); },
|
|
7335
7352
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
7336
7353
|
}))),
|
|
7337
|
-
|
|
7338
|
-
|
|
7354
|
+
React.createElement(CConditionalPortal, { container: container, portal: true },
|
|
7355
|
+
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: tooltipRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
7339
7356
|
enter: 0,
|
|
7340
|
-
exit: tooltipRef.current
|
|
7357
|
+
exit: tooltipRef.current
|
|
7358
|
+
? getTransitionDurationFromElement(tooltipRef.current) + 50
|
|
7359
|
+
: 200,
|
|
7341
7360
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', 'bs-tooltip-auto', {
|
|
7342
7361
|
fade: animation,
|
|
7343
7362
|
show: state === 'entered',
|
|
7344
|
-
}, className), ref:
|
|
7363
|
+
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
7345
7364
|
React.createElement("div", { className: "tooltip-arrow" }),
|
|
7346
|
-
React.createElement("div", { className: "tooltip-inner" }, content))); })
|
|
7347
|
-
};
|
|
7365
|
+
React.createElement("div", { className: "tooltip-inner" }, content))); }))));
|
|
7366
|
+
});
|
|
7348
7367
|
CTooltip.propTypes = {
|
|
7349
7368
|
animation: PropTypes.bool,
|
|
7350
7369
|
children: PropTypes.node,
|
|
7370
|
+
container: PropTypes.any,
|
|
7351
7371
|
content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
7352
7372
|
delay: PropTypes.oneOfType([
|
|
7353
7373
|
PropTypes.number,
|