@coreui/react 4.10.1 → 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 +6 -0
- package/dist/components/tooltip/CTooltip.d.ts +6 -0
- package/dist/index.es.js +28 -14
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +28 -14
- 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 +47 -40
- package/src/components/tooltip/CTooltip.tsx +46 -47
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,
|
|
@@ -6664,7 +6676,7 @@ CProgress.propTypes = {
|
|
|
6664
6676
|
CProgress.displayName = 'CProgress';
|
|
6665
6677
|
|
|
6666
6678
|
var CPopover = React.forwardRef(function (_a, ref) {
|
|
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"]);
|
|
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);
|
|
6670
6682
|
var forkedRef = useForkedRef(ref, popoverRef);
|
|
@@ -6722,8 +6734,8 @@ var CPopover = React.forwardRef(function (_a, ref) {
|
|
|
6722
6734
|
onMouseEnter: function () { return toggleVisible(true); },
|
|
6723
6735
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
6724
6736
|
}))),
|
|
6725
|
-
|
|
6726
|
-
|
|
6737
|
+
React.createElement(CConditionalPortal, { container: container, portal: true },
|
|
6738
|
+
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
6727
6739
|
enter: 0,
|
|
6728
6740
|
exit: popoverRef.current
|
|
6729
6741
|
? getTransitionDurationFromElement(popoverRef.current) + 50
|
|
@@ -6734,12 +6746,13 @@ var CPopover = React.forwardRef(function (_a, ref) {
|
|
|
6734
6746
|
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
6735
6747
|
React.createElement("div", { className: "popover-arrow" }),
|
|
6736
6748
|
React.createElement("div", { className: "popover-header" }, title),
|
|
6737
|
-
React.createElement("div", { className: "popover-body" }, content))); })
|
|
6749
|
+
React.createElement("div", { className: "popover-body" }, content))); }))));
|
|
6738
6750
|
});
|
|
6739
6751
|
CPopover.propTypes = {
|
|
6740
6752
|
animation: PropTypes.bool,
|
|
6741
6753
|
children: PropTypes.node,
|
|
6742
6754
|
className: PropTypes.string,
|
|
6755
|
+
container: PropTypes.any,
|
|
6743
6756
|
content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
6744
6757
|
delay: PropTypes.oneOfType([
|
|
6745
6758
|
PropTypes.number,
|
|
@@ -7280,7 +7293,7 @@ CToaster.propTypes = {
|
|
|
7280
7293
|
CToaster.displayName = 'CToaster';
|
|
7281
7294
|
|
|
7282
7295
|
var CTooltip = React.forwardRef(function (_a, ref) {
|
|
7283
|
-
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"]);
|
|
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"]);
|
|
7284
7297
|
var tooltipRef = React.useRef(null);
|
|
7285
7298
|
var togglerRef = React.useRef(null);
|
|
7286
7299
|
var forkedRef = useForkedRef(ref, tooltipRef);
|
|
@@ -7338,8 +7351,8 @@ var CTooltip = React.forwardRef(function (_a, ref) {
|
|
|
7338
7351
|
onMouseEnter: function () { return toggleVisible(true); },
|
|
7339
7352
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
7340
7353
|
}))),
|
|
7341
|
-
|
|
7342
|
-
|
|
7354
|
+
React.createElement(CConditionalPortal, { container: container, portal: true },
|
|
7355
|
+
React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: tooltipRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
7343
7356
|
enter: 0,
|
|
7344
7357
|
exit: tooltipRef.current
|
|
7345
7358
|
? getTransitionDurationFromElement(tooltipRef.current) + 50
|
|
@@ -7349,11 +7362,12 @@ var CTooltip = React.forwardRef(function (_a, ref) {
|
|
|
7349
7362
|
show: state === 'entered',
|
|
7350
7363
|
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
7351
7364
|
React.createElement("div", { className: "tooltip-arrow" }),
|
|
7352
|
-
React.createElement("div", { className: "tooltip-inner" }, content))); })
|
|
7365
|
+
React.createElement("div", { className: "tooltip-inner" }, content))); }))));
|
|
7353
7366
|
});
|
|
7354
7367
|
CTooltip.propTypes = {
|
|
7355
7368
|
animation: PropTypes.bool,
|
|
7356
7369
|
children: PropTypes.node,
|
|
7370
|
+
container: PropTypes.any,
|
|
7357
7371
|
content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
7358
7372
|
delay: PropTypes.oneOfType([
|
|
7359
7373
|
PropTypes.number,
|