@coreui/react-pro 4.14.0 → 4.15.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 +30 -16
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +30 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/conditional-portal/CConditionalPortal.tsx +31 -6
- package/src/components/date-range-picker/CDateRangePicker.tsx +1 -1
- 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/smart-table/CSmartTable.tsx +1 -1
- package/src/components/tooltip/CTooltip.tsx +46 -47
package/dist/index.js
CHANGED
|
@@ -5224,13 +5224,24 @@ CCarouselItem.propTypes = {
|
|
|
5224
5224
|
};
|
|
5225
5225
|
CCarouselItem.displayName = 'CCarouselItem';
|
|
5226
5226
|
|
|
5227
|
+
var getContainer = function (container) {
|
|
5228
|
+
if (container) {
|
|
5229
|
+
return typeof container === 'function' ? container() : container;
|
|
5230
|
+
}
|
|
5231
|
+
return document.body;
|
|
5232
|
+
};
|
|
5227
5233
|
var CConditionalPortal = function (_a) {
|
|
5228
|
-
var children = _a.children, portal = _a.portal;
|
|
5229
|
-
|
|
5234
|
+
var children = _a.children, container = _a.container, portal = _a.portal;
|
|
5235
|
+
var _b = React$1.useState(null), _container = _b[0], setContainer = _b[1];
|
|
5236
|
+
React$1.useEffect(function () {
|
|
5237
|
+
portal && setContainer(getContainer(container) || document.body);
|
|
5238
|
+
}, [container, portal]);
|
|
5239
|
+
return typeof window !== 'undefined' && portal && _container ? (ReactDOM.createPortal(children, _container)) : (React$1.createElement(React$1.Fragment, null, children));
|
|
5230
5240
|
};
|
|
5231
5241
|
CConditionalPortal.propTypes = {
|
|
5232
5242
|
children: PropTypes$1.node,
|
|
5233
|
-
|
|
5243
|
+
container: PropTypes$1.any,
|
|
5244
|
+
portal: PropTypes$1.bool,
|
|
5234
5245
|
};
|
|
5235
5246
|
CConditionalPortal.displayName = 'CConditionalPortal';
|
|
5236
5247
|
|
|
@@ -9497,7 +9508,7 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9497
9508
|
}, [startDate]);
|
|
9498
9509
|
React$1.useEffect(function () {
|
|
9499
9510
|
setEndDate(endDate ? new Date(endDate) : null);
|
|
9500
|
-
setCalendarDate(endDate ? new Date(endDate) : new Date());
|
|
9511
|
+
range && setCalendarDate(endDate ? new Date(endDate) : new Date());
|
|
9501
9512
|
}, [endDate]);
|
|
9502
9513
|
React$1.useEffect(function () {
|
|
9503
9514
|
maxDate && setMaxDate(new Date(maxDate));
|
|
@@ -9709,7 +9720,7 @@ var getPlacement = function (placement, direction, alignment, isRTL) {
|
|
|
9709
9720
|
var CDropdownContext = React$1.createContext({});
|
|
9710
9721
|
var CDropdown = React$1.forwardRef(function (_a, ref) {
|
|
9711
9722
|
var _b;
|
|
9712
|
-
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$1(_a, ["children", "alignment", "autoClose", "className", "dark", "direction", "offset", "onHide", "onShow", "placement", "popper", "portal", "variant", "component", "visible"]);
|
|
9723
|
+
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$1(_a, ["children", "alignment", "autoClose", "className", "container", "dark", "direction", "offset", "onHide", "onShow", "placement", "popper", "portal", "variant", "component", "visible"]);
|
|
9713
9724
|
var dropdownRef = React$1.useRef(null);
|
|
9714
9725
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9715
9726
|
var dropdownToggleRef = React$1.useRef(null);
|
|
@@ -9724,6 +9735,7 @@ var CDropdown = React$1.forwardRef(function (_a, ref) {
|
|
|
9724
9735
|
}
|
|
9725
9736
|
var contextValues = {
|
|
9726
9737
|
alignment: alignment,
|
|
9738
|
+
container: container,
|
|
9727
9739
|
dark: dark,
|
|
9728
9740
|
dropdownToggleRef: dropdownToggleRef,
|
|
9729
9741
|
dropdownMenuRef: dropdownMenuRef,
|
|
@@ -9878,9 +9890,9 @@ var alignmentClassNames = function (alignment) {
|
|
|
9878
9890
|
};
|
|
9879
9891
|
var CDropdownMenu = React$1.forwardRef(function (_a, ref) {
|
|
9880
9892
|
var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'ul' : _b, rest = __rest$1(_a, ["children", "className", "component"]);
|
|
9881
|
-
var _c = React$1.useContext(CDropdownContext), alignment = _c.alignment, dark = _c.dark, dropdownMenuRef = _c.dropdownMenuRef, popper = _c.popper, portal = _c.portal, visible = _c.visible;
|
|
9893
|
+
var _c = React$1.useContext(CDropdownContext), alignment = _c.alignment, container = _c.container, dark = _c.dark, dropdownMenuRef = _c.dropdownMenuRef, popper = _c.popper, portal = _c.portal, visible = _c.visible;
|
|
9882
9894
|
var forkedRef = useForkedRef(ref, dropdownMenuRef);
|
|
9883
|
-
return (React$1.createElement(CConditionalPortal, { portal: portal !== null && portal !== void 0 ? portal : false },
|
|
9895
|
+
return (React$1.createElement(CConditionalPortal, { container: container, portal: portal !== null && portal !== void 0 ? portal : false },
|
|
9884
9896
|
React$1.createElement(Component, __assign$1({ className: classNames$1('dropdown-menu', {
|
|
9885
9897
|
'dropdown-menu-dark': dark,
|
|
9886
9898
|
show: visible,
|
|
@@ -11670,7 +11682,7 @@ CProgress.propTypes = {
|
|
|
11670
11682
|
CProgress.displayName = 'CProgress';
|
|
11671
11683
|
|
|
11672
11684
|
var CPopover = React$1.forwardRef(function (_a, ref) {
|
|
11673
|
-
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$1(_a, ["children", "animation", "className", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "title", "trigger", "visible"]);
|
|
11685
|
+
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$1(_a, ["children", "animation", "className", "container", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "title", "trigger", "visible"]);
|
|
11674
11686
|
var popoverRef = React$1.useRef(null);
|
|
11675
11687
|
var togglerRef = React$1.useRef(null);
|
|
11676
11688
|
var forkedRef = useForkedRef(ref, popoverRef);
|
|
@@ -11728,8 +11740,8 @@ var CPopover = React$1.forwardRef(function (_a, ref) {
|
|
|
11728
11740
|
onMouseEnter: function () { return toggleVisible(true); },
|
|
11729
11741
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
11730
11742
|
}))),
|
|
11731
|
-
|
|
11732
|
-
|
|
11743
|
+
React$1.createElement(CConditionalPortal, { container: container, portal: true },
|
|
11744
|
+
React$1.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
11733
11745
|
enter: 0,
|
|
11734
11746
|
exit: popoverRef.current
|
|
11735
11747
|
? getTransitionDurationFromElement(popoverRef.current) + 50
|
|
@@ -11740,12 +11752,13 @@ var CPopover = React$1.forwardRef(function (_a, ref) {
|
|
|
11740
11752
|
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
11741
11753
|
React$1.createElement("div", { className: "popover-arrow" }),
|
|
11742
11754
|
React$1.createElement("div", { className: "popover-header" }, title),
|
|
11743
|
-
React$1.createElement("div", { className: "popover-body" }, content))); })
|
|
11755
|
+
React$1.createElement("div", { className: "popover-body" }, content))); }))));
|
|
11744
11756
|
});
|
|
11745
11757
|
CPopover.propTypes = {
|
|
11746
11758
|
animation: PropTypes$1.bool,
|
|
11747
11759
|
children: PropTypes$1.node,
|
|
11748
11760
|
className: PropTypes$1.string,
|
|
11761
|
+
container: PropTypes$1.any,
|
|
11749
11762
|
content: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.node]),
|
|
11750
11763
|
delay: PropTypes$1.oneOfType([
|
|
11751
11764
|
PropTypes$1.number,
|
|
@@ -13999,7 +14012,7 @@ var CSmartTable = React$1.forwardRef(function (_a, ref) {
|
|
|
13999
14012
|
{ sides: ['bottom'], query: 'tbody' },
|
|
14000
14013
|
] }, elementCover))),
|
|
14001
14014
|
(pagination || itemsPerPageSelect) && (React$1.createElement("div", { className: "row" },
|
|
14002
|
-
React$1.createElement("div", { className: "col" }, ((pagination && numberOfPages > 1) || paginationProps) && (React$1.createElement(CSmartPagination, __assign$1({ activePage: _activePage, onActivePageChange: function (page) {
|
|
14015
|
+
React$1.createElement("div", { className: "col" }, ((pagination && numberOfPages > 1) || (paginationProps && paginationProps.pages > 1)) && (React$1.createElement(CSmartPagination, __assign$1({ activePage: _activePage, onActivePageChange: function (page) {
|
|
14003
14016
|
pagination && typeof pagination === 'object' && pagination.external
|
|
14004
14017
|
? onActivePageChange && onActivePageChange(page)
|
|
14005
14018
|
: setActivePage(page);
|
|
@@ -14377,7 +14390,7 @@ CToaster.propTypes = {
|
|
|
14377
14390
|
CToaster.displayName = 'CToaster';
|
|
14378
14391
|
|
|
14379
14392
|
var CTooltip = React$1.forwardRef(function (_a, ref) {
|
|
14380
|
-
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$1(_a, ["children", "animation", "className", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "trigger", "visible"]);
|
|
14393
|
+
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$1(_a, ["children", "animation", "className", "container", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "trigger", "visible"]);
|
|
14381
14394
|
var tooltipRef = React$1.useRef(null);
|
|
14382
14395
|
var togglerRef = React$1.useRef(null);
|
|
14383
14396
|
var forkedRef = useForkedRef(ref, tooltipRef);
|
|
@@ -14435,8 +14448,8 @@ var CTooltip = React$1.forwardRef(function (_a, ref) {
|
|
|
14435
14448
|
onMouseEnter: function () { return toggleVisible(true); },
|
|
14436
14449
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
14437
14450
|
}))),
|
|
14438
|
-
|
|
14439
|
-
|
|
14451
|
+
React$1.createElement(CConditionalPortal, { container: container, portal: true },
|
|
14452
|
+
React$1.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: tooltipRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
14440
14453
|
enter: 0,
|
|
14441
14454
|
exit: tooltipRef.current
|
|
14442
14455
|
? getTransitionDurationFromElement(tooltipRef.current) + 50
|
|
@@ -14446,11 +14459,12 @@ var CTooltip = React$1.forwardRef(function (_a, ref) {
|
|
|
14446
14459
|
show: state === 'entered',
|
|
14447
14460
|
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
14448
14461
|
React$1.createElement("div", { className: "tooltip-arrow" }),
|
|
14449
|
-
React$1.createElement("div", { className: "tooltip-inner" }, content))); })
|
|
14462
|
+
React$1.createElement("div", { className: "tooltip-inner" }, content))); }))));
|
|
14450
14463
|
});
|
|
14451
14464
|
CTooltip.propTypes = {
|
|
14452
14465
|
animation: PropTypes$1.bool,
|
|
14453
14466
|
children: PropTypes$1.node,
|
|
14467
|
+
container: PropTypes$1.any,
|
|
14454
14468
|
content: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.node]),
|
|
14455
14469
|
delay: PropTypes$1.oneOfType([
|
|
14456
14470
|
PropTypes$1.number,
|