@coreui/react 5.0.0-alpha.0 → 5.0.0-alpha.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/close-button/CCloseButton.d.ts +6 -0
- package/dist/components/modal/CModal.d.ts +6 -0
- package/dist/components/nav/CNav.d.ts +1 -1
- package/dist/components/navbar/CNavbar.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +4 -0
- package/dist/index.es.js +136 -62
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +136 -62
- 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 +2 -2
- package/src/components/carousel/CCarousel.tsx +9 -5
- package/src/components/close-button/CCloseButton.tsx +9 -1
- package/src/components/dropdown/CDropdownMenu.tsx +1 -1
- package/src/components/modal/CModal.tsx +25 -9
- package/src/components/nav/CNav.tsx +2 -2
- package/src/components/nav/CNavGroup.tsx +9 -2
- package/src/components/navbar/CNavbar.tsx +2 -2
- package/src/components/offcanvas/COffcanvas.tsx +8 -1
- package/src/components/popover/CPopover.tsx +2 -2
- package/src/components/sidebar/CSidebar.tsx +1 -1
- package/src/components/tooltip/CTooltip.tsx +2 -2
- 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/dist/index.js
CHANGED
|
@@ -4359,14 +4359,103 @@ var createPopper = /*#__PURE__*/popperGenerator({
|
|
|
4359
4359
|
defaultModifiers: defaultModifiers
|
|
4360
4360
|
}); // eslint-disable-next-line import/no-unused-modules
|
|
4361
4361
|
|
|
4362
|
+
var getTransitionDurationFromElement = function (element) {
|
|
4363
|
+
if (!element) {
|
|
4364
|
+
return 0;
|
|
4365
|
+
}
|
|
4366
|
+
// Get transition-duration of the element
|
|
4367
|
+
var _a = window.getComputedStyle(element), transitionDuration = _a.transitionDuration, transitionDelay = _a.transitionDelay;
|
|
4368
|
+
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
|
4369
|
+
var floatTransitionDelay = Number.parseFloat(transitionDelay);
|
|
4370
|
+
// Return 0 if element or transition duration is not found
|
|
4371
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
4372
|
+
return 0;
|
|
4373
|
+
}
|
|
4374
|
+
// If multiple durations are defined, take the first
|
|
4375
|
+
transitionDuration = transitionDuration.split(',')[0];
|
|
4376
|
+
transitionDelay = transitionDelay.split(',')[0];
|
|
4377
|
+
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * 1000;
|
|
4378
|
+
};
|
|
4379
|
+
|
|
4380
|
+
var execute = function (callback) {
|
|
4381
|
+
if (typeof callback === 'function') {
|
|
4382
|
+
callback();
|
|
4383
|
+
}
|
|
4384
|
+
};
|
|
4385
|
+
var triggerTransitionEnd = function (element) {
|
|
4386
|
+
element.dispatchEvent(new Event('transitionend'));
|
|
4387
|
+
};
|
|
4388
|
+
var executeAfterTransition = function (callback, transitionElement, waitForTransition) {
|
|
4389
|
+
if (waitForTransition === void 0) { waitForTransition = true; }
|
|
4390
|
+
if (!waitForTransition) {
|
|
4391
|
+
execute(callback);
|
|
4392
|
+
return;
|
|
4393
|
+
}
|
|
4394
|
+
var durationPadding = 5;
|
|
4395
|
+
var emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
|
4396
|
+
var called = false;
|
|
4397
|
+
var handler = function (_a) {
|
|
4398
|
+
var target = _a.target;
|
|
4399
|
+
if (target !== transitionElement) {
|
|
4400
|
+
return;
|
|
4401
|
+
}
|
|
4402
|
+
called = true;
|
|
4403
|
+
transitionElement.removeEventListener('transitionend', handler);
|
|
4404
|
+
execute(callback);
|
|
4405
|
+
};
|
|
4406
|
+
transitionElement.addEventListener('transitionend', handler);
|
|
4407
|
+
setTimeout(function () {
|
|
4408
|
+
if (!called) {
|
|
4409
|
+
triggerTransitionEnd(transitionElement);
|
|
4410
|
+
}
|
|
4411
|
+
}, emulatedDuration);
|
|
4412
|
+
};
|
|
4413
|
+
|
|
4414
|
+
var isRTL = function (element) {
|
|
4415
|
+
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
|
|
4416
|
+
return true;
|
|
4417
|
+
}
|
|
4418
|
+
if (element) {
|
|
4419
|
+
return element.closest('[dir="rtl"]') !== null;
|
|
4420
|
+
}
|
|
4421
|
+
return false;
|
|
4422
|
+
};
|
|
4423
|
+
|
|
4424
|
+
var getRTLPlacement = function (placement, element) {
|
|
4425
|
+
switch (placement) {
|
|
4426
|
+
case 'right': {
|
|
4427
|
+
return isRTL(element) ? 'left' : 'right';
|
|
4428
|
+
}
|
|
4429
|
+
case 'left': {
|
|
4430
|
+
return isRTL(element) ? 'right' : 'left';
|
|
4431
|
+
}
|
|
4432
|
+
default: {
|
|
4433
|
+
return placement;
|
|
4434
|
+
}
|
|
4435
|
+
}
|
|
4436
|
+
};
|
|
4437
|
+
|
|
4438
|
+
var isInViewport = function (element) {
|
|
4439
|
+
var rect = element.getBoundingClientRect();
|
|
4440
|
+
return (Math.floor(rect.top) >= 0 &&
|
|
4441
|
+
Math.floor(rect.left) >= 0 &&
|
|
4442
|
+
Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
4443
|
+
Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth));
|
|
4444
|
+
};
|
|
4445
|
+
|
|
4362
4446
|
var usePopper = function () {
|
|
4363
4447
|
var _popper = React.useRef();
|
|
4448
|
+
var el = React.useRef();
|
|
4364
4449
|
var initPopper = function (reference, popper, options) {
|
|
4365
4450
|
_popper.current = createPopper(reference, popper, options);
|
|
4451
|
+
el.current = popper;
|
|
4366
4452
|
};
|
|
4367
4453
|
var destroyPopper = function () {
|
|
4368
|
-
|
|
4369
|
-
|
|
4454
|
+
var popperInstance = _popper.current;
|
|
4455
|
+
if (popperInstance && el.current) {
|
|
4456
|
+
executeAfterTransition(function () {
|
|
4457
|
+
popperInstance.destroy();
|
|
4458
|
+
}, el.current);
|
|
4370
4459
|
}
|
|
4371
4460
|
_popper.current = undefined;
|
|
4372
4461
|
};
|
|
@@ -4476,13 +4565,14 @@ CAccordionHeader.propTypes = {
|
|
|
4476
4565
|
CAccordionHeader.displayName = 'CAccordionHeader';
|
|
4477
4566
|
|
|
4478
4567
|
var CCloseButton = React.forwardRef(function (_a, ref) {
|
|
4479
|
-
var className = _a.className, disabled = _a.disabled, white = _a.white, rest = __rest(_a, ["className", "disabled", "white"]);
|
|
4568
|
+
var className = _a.className, dark = _a.dark, disabled = _a.disabled, white = _a.white, rest = __rest(_a, ["className", "dark", "disabled", "white"]);
|
|
4480
4569
|
return (React.createElement("button", __assign({ type: "button", className: classNames('btn', 'btn-close', {
|
|
4481
4570
|
'btn-close-white': white,
|
|
4482
|
-
}, disabled, className), "aria-label": "Close", disabled: disabled }, rest, { ref: ref })));
|
|
4571
|
+
}, disabled, className), "aria-label": "Close", disabled: disabled }, (dark && { 'data-coreui-theme': 'dark' }), rest, { ref: ref })));
|
|
4483
4572
|
});
|
|
4484
4573
|
CCloseButton.propTypes = {
|
|
4485
4574
|
className: PropTypes.string,
|
|
4575
|
+
dark: PropTypes.bool,
|
|
4486
4576
|
disabled: PropTypes.bool,
|
|
4487
4577
|
white: PropTypes.bool,
|
|
4488
4578
|
};
|
|
@@ -4882,38 +4972,6 @@ CCardTitle.propTypes = {
|
|
|
4882
4972
|
};
|
|
4883
4973
|
CCardTitle.displayName = 'CCardTitle';
|
|
4884
4974
|
|
|
4885
|
-
var isRTL = function (element) {
|
|
4886
|
-
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
|
|
4887
|
-
return true;
|
|
4888
|
-
}
|
|
4889
|
-
if (element) {
|
|
4890
|
-
return element.closest('[dir="rtl"]') !== null;
|
|
4891
|
-
}
|
|
4892
|
-
return false;
|
|
4893
|
-
};
|
|
4894
|
-
|
|
4895
|
-
var getRTLPlacement = function (placement, element) {
|
|
4896
|
-
switch (placement) {
|
|
4897
|
-
case 'right': {
|
|
4898
|
-
return isRTL(element) ? 'left' : 'right';
|
|
4899
|
-
}
|
|
4900
|
-
case 'left': {
|
|
4901
|
-
return isRTL(element) ? 'right' : 'left';
|
|
4902
|
-
}
|
|
4903
|
-
default: {
|
|
4904
|
-
return placement;
|
|
4905
|
-
}
|
|
4906
|
-
}
|
|
4907
|
-
};
|
|
4908
|
-
|
|
4909
|
-
var isInViewport = function (element) {
|
|
4910
|
-
var rect = element.getBoundingClientRect();
|
|
4911
|
-
return (Math.floor(rect.top) >= 0 &&
|
|
4912
|
-
Math.floor(rect.left) >= 0 &&
|
|
4913
|
-
Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
4914
|
-
Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth));
|
|
4915
|
-
};
|
|
4916
|
-
|
|
4917
4975
|
var CCarouselContext = React.createContext({});
|
|
4918
4976
|
var CCarousel = React.forwardRef(function (_a, ref) {
|
|
4919
4977
|
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"]);
|
|
@@ -5018,17 +5076,18 @@ var CCarousel = React.forwardRef(function (_a, ref) {
|
|
|
5018
5076
|
setTouchPosition(touchDown);
|
|
5019
5077
|
};
|
|
5020
5078
|
return (React.createElement("div", __assign({ className: classNames('carousel slide', {
|
|
5021
|
-
'carousel-dark': dark,
|
|
5022
5079
|
'carousel-fade': transition === 'crossfade',
|
|
5023
|
-
}, className), onMouseEnter: _pause, onMouseLeave: cycle }, (touch && { onTouchStart: handleTouchStart, onTouchMove: handleTouchMove }), rest, { ref: forkedRef }),
|
|
5080
|
+
}, className) }, (dark && { 'data-coreui-theme': 'dark' }), { onMouseEnter: _pause, onMouseLeave: cycle }, (touch && { onTouchStart: handleTouchStart, onTouchMove: handleTouchMove }), rest, { ref: forkedRef }),
|
|
5024
5081
|
React.createElement(CCarouselContext.Provider, { value: {
|
|
5025
5082
|
setAnimating: setAnimating,
|
|
5026
5083
|
setCustomInterval: setCustomInterval,
|
|
5027
5084
|
} },
|
|
5028
|
-
indicators && (React.createElement("
|
|
5029
|
-
return (React.createElement("
|
|
5085
|
+
indicators && (React.createElement("div", { className: "carousel-indicators" }, Array.from({ length: itemsNumber }, function (_, i) { return i; }).map(function (index) {
|
|
5086
|
+
return (React.createElement("button", __assign({ key: "indicator".concat(index), onClick: function () {
|
|
5030
5087
|
!animating && handleIndicatorClick(index);
|
|
5031
|
-
}, className:
|
|
5088
|
+
}, className: classNames({
|
|
5089
|
+
active: active === index
|
|
5090
|
+
}), "data-coreui-target": "" }, (active === index && { 'aria-current': true }), { "aria-label": "Slide ".concat(index + 1) })));
|
|
5032
5091
|
}))),
|
|
5033
5092
|
React.createElement("div", { className: "carousel-inner" }, React.Children.map(children, function (child, index) {
|
|
5034
5093
|
if (React.isValidElement(child)) {
|
|
@@ -5356,9 +5415,8 @@ var CDropdownMenu = React.forwardRef(function (_a, ref) {
|
|
|
5356
5415
|
var forkedRef = useForkedRef(ref, dropdownMenuRef);
|
|
5357
5416
|
return (React.createElement(CConditionalPortal, { portal: portal !== null && portal !== void 0 ? portal : false },
|
|
5358
5417
|
React.createElement(Component, __assign({ className: classNames('dropdown-menu', {
|
|
5359
|
-
'dropdown-menu-dark': dark,
|
|
5360
5418
|
show: visible,
|
|
5361
|
-
}, alignment && alignmentClassNames(alignment), className), ref: forkedRef, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), rest), Component === 'ul'
|
|
5419
|
+
}, alignment && alignmentClassNames(alignment), className), ref: forkedRef, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), (dark && { 'data-coreui-theme': 'dark' }), rest), Component === 'ul'
|
|
5362
5420
|
? React.Children.map(children, function (child, index) {
|
|
5363
5421
|
if (React.isValidElement(child)) {
|
|
5364
5422
|
return React.createElement("li", { key: index }, React.cloneElement(child));
|
|
@@ -6019,12 +6077,13 @@ CModalDialog.displayName = 'CModalDialog';
|
|
|
6019
6077
|
|
|
6020
6078
|
var CModalContext = React.createContext({});
|
|
6021
6079
|
var CModal = React.forwardRef(function (_a, ref) {
|
|
6022
|
-
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,
|
|
6080
|
+
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"]);
|
|
6081
|
+
var activeElementRef = React.useRef(null);
|
|
6023
6082
|
var modalRef = React.useRef(null);
|
|
6024
6083
|
var modalContentRef = React.useRef(null);
|
|
6025
6084
|
var forkedRef = useForkedRef(ref, modalRef);
|
|
6026
|
-
var
|
|
6027
|
-
var
|
|
6085
|
+
var _j = React.useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
6086
|
+
var _k = React.useState(false), staticBackdrop = _k[0], setStaticBackdrop = _k[1];
|
|
6028
6087
|
var contextValues = {
|
|
6029
6088
|
visible: _visible,
|
|
6030
6089
|
setVisible: setVisible,
|
|
@@ -6033,10 +6092,17 @@ var CModal = React.forwardRef(function (_a, ref) {
|
|
|
6033
6092
|
setVisible(visible);
|
|
6034
6093
|
}, [visible]);
|
|
6035
6094
|
React.useEffect(function () {
|
|
6036
|
-
|
|
6037
|
-
|
|
6095
|
+
var _a;
|
|
6096
|
+
if (_visible) {
|
|
6097
|
+
activeElementRef.current = document.activeElement;
|
|
6098
|
+
document.addEventListener('mouseup', handleClickOutside);
|
|
6099
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
6100
|
+
}
|
|
6101
|
+
else {
|
|
6102
|
+
(_a = activeElementRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
6103
|
+
}
|
|
6038
6104
|
return function () {
|
|
6039
|
-
document.removeEventListener('
|
|
6105
|
+
document.removeEventListener('mouseup', handleClickOutside);
|
|
6040
6106
|
document.removeEventListener('keydown', handleKeyDown);
|
|
6041
6107
|
};
|
|
6042
6108
|
}, [_visible]);
|
|
@@ -6061,7 +6127,7 @@ var CModal = React.forwardRef(function (_a, ref) {
|
|
|
6061
6127
|
}
|
|
6062
6128
|
setTimeout(function () {
|
|
6063
6129
|
var _a;
|
|
6064
|
-
(_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
6130
|
+
focus && ((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
6065
6131
|
}, transition ? duration : 0);
|
|
6066
6132
|
}
|
|
6067
6133
|
else {
|
|
@@ -6093,13 +6159,15 @@ var CModal = React.forwardRef(function (_a, ref) {
|
|
|
6093
6159
|
return (React.createElement(React.Fragment, null,
|
|
6094
6160
|
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 },
|
|
6095
6161
|
React.createElement(CModalContext.Provider, { value: contextValues },
|
|
6096
|
-
React.createElement("div", { className: classNames('modal', {
|
|
6162
|
+
React.createElement("div", __assign({ className: classNames('modal', {
|
|
6097
6163
|
'modal-static': staticBackdrop,
|
|
6098
6164
|
fade: transition,
|
|
6099
6165
|
show: state === 'entered',
|
|
6100
|
-
}, className), tabIndex: -1
|
|
6166
|
+
}, className), tabIndex: -1 }, (_visible
|
|
6167
|
+
? { 'aria-modal': true, role: 'dialog' }
|
|
6168
|
+
: { 'aria-hidden': 'true' }), { style: __assign({}, (state !== 'exited' && { display: 'block' })) }, rest, { ref: forkedRef }),
|
|
6101
6169
|
React.createElement(CModalDialog, { alignment: alignment, fullscreen: fullscreen, scrollable: scrollable, size: size },
|
|
6102
|
-
React.createElement(CModalContent,
|
|
6170
|
+
React.createElement(CModalContent, { ref: modalContentRef }, children)))))); }),
|
|
6103
6171
|
backdrop && (React.createElement(CConditionalPortal, { portal: portal },
|
|
6104
6172
|
React.createElement(CBackdrop, { visible: _visible })))));
|
|
6105
6173
|
});
|
|
@@ -6109,6 +6177,7 @@ CModal.propTypes = {
|
|
|
6109
6177
|
children: PropTypes.node,
|
|
6110
6178
|
className: PropTypes.string,
|
|
6111
6179
|
duration: PropTypes.number,
|
|
6180
|
+
focus: PropTypes.bool,
|
|
6112
6181
|
fullscreen: PropTypes.oneOfType([
|
|
6113
6182
|
PropTypes.bool,
|
|
6114
6183
|
PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
|
|
@@ -6184,7 +6253,7 @@ CNav.propTypes = {
|
|
|
6184
6253
|
className: PropTypes.string,
|
|
6185
6254
|
component: PropTypes.elementType,
|
|
6186
6255
|
layout: PropTypes.oneOf(['fill', 'justified']),
|
|
6187
|
-
variant: PropTypes.oneOf(['tabs', '
|
|
6256
|
+
variant: PropTypes.oneOf(['pills', 'tabs', 'underline']),
|
|
6188
6257
|
};
|
|
6189
6258
|
CNav.displayName = 'CNav';
|
|
6190
6259
|
|
|
@@ -6223,14 +6292,19 @@ CSidebarNav.propTypes = {
|
|
|
6223
6292
|
};
|
|
6224
6293
|
CSidebarNav.displayName = 'CSidebarNav';
|
|
6225
6294
|
|
|
6295
|
+
var isInVisibleGroup = function (el1, el2) {
|
|
6296
|
+
var array1 = el1.toString().split('.');
|
|
6297
|
+
var array2 = el2.toString().split('.');
|
|
6298
|
+
return array2.every(function (item, index) { return item === array1[index]; });
|
|
6299
|
+
};
|
|
6226
6300
|
var CNavGroup = React.forwardRef(function (_a, ref) {
|
|
6227
6301
|
var children = _a.children, className = _a.className, compact = _a.compact, idx = _a.idx, toggler = _a.toggler, visible = _a.visible, rest = __rest(_a, ["children", "className", "compact", "idx", "toggler", "visible"]);
|
|
6228
6302
|
var _b = React.useState(), height = _b[0], setHeight = _b[1];
|
|
6229
6303
|
var navItemsRef = React.useRef(null);
|
|
6230
6304
|
var _c = React.useContext(CNavContext), visibleGroup = _c.visibleGroup, setVisibleGroup = _c.setVisibleGroup;
|
|
6231
|
-
var _d = React.useState(Boolean(visible || (idx && visibleGroup && visibleGroup
|
|
6305
|
+
var _d = React.useState(Boolean(visible || (idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)))), _visible = _d[0], setVisible = _d[1];
|
|
6232
6306
|
React.useEffect(function () {
|
|
6233
|
-
setVisible(Boolean(idx && visibleGroup && visibleGroup
|
|
6307
|
+
setVisible(Boolean(idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)));
|
|
6234
6308
|
}, [visibleGroup]);
|
|
6235
6309
|
var handleTogglerOnCLick = function (event) {
|
|
6236
6310
|
event.preventDefault();
|
|
@@ -6333,9 +6407,8 @@ var CNavbar = React.forwardRef(function (_a, ref) {
|
|
|
6333
6407
|
var children = _a.children, className = _a.className, color = _a.color, colorScheme = _a.colorScheme, _c = _a.component, Component = _c === void 0 ? 'nav' : _c, container = _a.container, expand = _a.expand, placement = _a.placement, rest = __rest(_a, ["children", "className", "color", "colorScheme", "component", "container", "expand", "placement"]);
|
|
6334
6408
|
return (React.createElement(Component, __assign({ className: classNames('navbar', (_b = {},
|
|
6335
6409
|
_b["bg-".concat(color)] = color,
|
|
6336
|
-
_b["navbar-".concat(colorScheme)] = colorScheme,
|
|
6337
6410
|
_b[typeof expand === 'boolean' ? 'navbar-expand' : "navbar-expand-".concat(expand)] = expand,
|
|
6338
|
-
_b), placement, className) }, rest, { ref: ref }), container ? (React.createElement("div", { className: typeof container === 'string' ? "container-".concat(container) : 'container' }, children)) : (React.createElement(React.Fragment, null, children))));
|
|
6411
|
+
_b), placement, className) }, (colorScheme && { 'data-coreui-theme': colorScheme }), rest, { ref: ref }), container ? (React.createElement("div", { className: typeof container === 'string' ? "container-".concat(container) : 'container' }, children)) : (React.createElement(React.Fragment, null, children))));
|
|
6339
6412
|
});
|
|
6340
6413
|
CNavbar.propTypes = {
|
|
6341
6414
|
children: PropTypes.node,
|
|
@@ -6406,7 +6479,7 @@ CNavbarToggler.propTypes = {
|
|
|
6406
6479
|
CNavbarToggler.displayName = 'CNavbarToggler';
|
|
6407
6480
|
|
|
6408
6481
|
var COffcanvas = React.forwardRef(function (_a, ref) {
|
|
6409
|
-
var children = _a.children, _b = _a.backdrop, backdrop = _b === void 0 ? true : _b, className = _a.className, _c = _a.keyboard, keyboard = _c === void 0 ? true : _c, onHide = _a.onHide, onShow = _a.onShow, placement = _a.placement, _d = _a.portal, portal = _d === void 0 ? false : _d, _e = _a.responsive, responsive = _e === void 0 ? true : _e, _f = _a.scroll, scroll = _f === void 0 ? false : _f, _g = _a.visible, visible = _g === void 0 ? false : _g, rest = __rest(_a, ["children", "backdrop", "className", "keyboard", "onHide", "onShow", "placement", "portal", "responsive", "scroll", "visible"]);
|
|
6482
|
+
var children = _a.children, _b = _a.backdrop, backdrop = _b === void 0 ? true : _b, className = _a.className, dark = _a.dark, _c = _a.keyboard, keyboard = _c === void 0 ? true : _c, onHide = _a.onHide, onShow = _a.onShow, placement = _a.placement, _d = _a.portal, portal = _d === void 0 ? false : _d, _e = _a.responsive, responsive = _e === void 0 ? true : _e, _f = _a.scroll, scroll = _f === void 0 ? false : _f, _g = _a.visible, visible = _g === void 0 ? false : _g, rest = __rest(_a, ["children", "backdrop", "className", "dark", "keyboard", "onHide", "onShow", "placement", "portal", "responsive", "scroll", "visible"]);
|
|
6410
6483
|
var _h = React.useState(visible), _visible = _h[0], setVisible = _h[1];
|
|
6411
6484
|
var offcanvasRef = React.useRef(null);
|
|
6412
6485
|
var forkedRef = useForkedRef(ref, offcanvasRef);
|
|
@@ -6447,7 +6520,7 @@ var COffcanvas = React.forwardRef(function (_a, ref) {
|
|
|
6447
6520
|
_a.showing = state === 'entering',
|
|
6448
6521
|
_a.show = state === 'entered',
|
|
6449
6522
|
_a['show hiding'] = state === 'exiting',
|
|
6450
|
-
_a), className), role: "dialog", tabIndex: -1, onKeyDown: handleKeyDown }, rest, { ref: forkedRef }), children)));
|
|
6523
|
+
_a), className), role: "dialog", tabIndex: -1, onKeyDown: handleKeyDown }, (dark && { 'data-coreui-theme': 'dark' }), rest, { ref: forkedRef }), children)));
|
|
6451
6524
|
}),
|
|
6452
6525
|
backdrop && (React.createElement(CConditionalPortal, { portal: portal },
|
|
6453
6526
|
React.createElement(CBackdrop, { className: "offcanvas-backdrop", onClick: handleBackdropDismiss, visible: _visible })))));
|
|
@@ -6456,6 +6529,7 @@ COffcanvas.propTypes = {
|
|
|
6456
6529
|
backdrop: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['static'])]),
|
|
6457
6530
|
children: PropTypes.node,
|
|
6458
6531
|
className: PropTypes.string,
|
|
6532
|
+
dark: PropTypes.bool,
|
|
6459
6533
|
keyboard: PropTypes.bool,
|
|
6460
6534
|
onHide: PropTypes.func,
|
|
6461
6535
|
onShow: PropTypes.func,
|
|
@@ -6699,7 +6773,7 @@ var CPopover = function (_a) {
|
|
|
6699
6773
|
typeof window !== 'undefined' &&
|
|
6700
6774
|
ReactDOM.createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
6701
6775
|
enter: 0,
|
|
6702
|
-
exit: 200,
|
|
6776
|
+
exit: popoverRef.current ? getTransitionDurationFromElement(popoverRef.current) + 50 : 200,
|
|
6703
6777
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', 'bs-popover-auto', {
|
|
6704
6778
|
fade: animation,
|
|
6705
6779
|
show: state === 'entered',
|
|
@@ -7312,7 +7386,7 @@ var CTooltip = function (_a) {
|
|
|
7312
7386
|
typeof window !== 'undefined' &&
|
|
7313
7387
|
ReactDOM.createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, onEnter: onShow, onExit: onHide, timeout: {
|
|
7314
7388
|
enter: 0,
|
|
7315
|
-
exit: 200,
|
|
7389
|
+
exit: tooltipRef.current ? getTransitionDurationFromElement(tooltipRef.current) + 50 : 200,
|
|
7316
7390
|
}, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', 'bs-tooltip-auto', {
|
|
7317
7391
|
fade: animation,
|
|
7318
7392
|
show: state === 'entered',
|