@coreui/react 4.9.0-beta.0 → 4.9.0-beta.2

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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/components/dropdown/CDropdown.d.ts +8 -1
  3. package/dist/components/dropdown/CDropdownMenu.d.ts +3 -4
  4. package/dist/components/dropdown copy/CDropdown.d.ts +89 -0
  5. package/dist/components/dropdown copy/CDropdownDivider.d.ts +8 -0
  6. package/dist/components/dropdown copy/CDropdownHeader.d.ts +12 -0
  7. package/dist/components/dropdown copy/CDropdownItem.d.ts +13 -0
  8. package/dist/components/dropdown copy/CDropdownItemPlain.d.ts +12 -0
  9. package/dist/components/dropdown copy/CDropdownMenu.d.ts +13 -0
  10. package/dist/components/dropdown copy/CDropdownToggle.d.ts +24 -0
  11. package/dist/components/dropdown copy/index.d.ts +8 -0
  12. package/dist/components/popover/CPopover.d.ts +22 -1
  13. package/dist/components/progress/CProgress.d.ts +6 -0
  14. package/dist/components/progress/CProgressStacked.d.ts +12 -0
  15. package/dist/components/progress/index.d.ts +2 -1
  16. package/dist/components/tooltip/CTooltip.d.ts +22 -1
  17. package/dist/hooks/index.d.ts +2 -1
  18. package/dist/hooks/useColorModes.d.ts +4 -2
  19. package/dist/hooks/usePopper.d.ts +8 -0
  20. package/dist/index.es.js +1527 -1915
  21. package/dist/index.es.js.map +1 -1
  22. package/dist/index.js +1312 -1716
  23. package/dist/index.js.map +1 -1
  24. package/dist/props.d.ts +1 -0
  25. package/dist/utils/getRTLPlacement.d.ts +3 -0
  26. package/dist/utils/index.d.ts +2 -1
  27. package/package.json +5 -5
  28. package/src/components/dropdown/CDropdown.tsx +130 -45
  29. package/src/components/dropdown/CDropdownMenu.tsx +41 -138
  30. package/src/components/dropdown/CDropdownToggle.tsx +6 -15
  31. package/src/components/dropdown/__tests__/__snapshots__/CDropdownMenu.spec.tsx.snap +0 -1
  32. package/src/components/popover/CPopover.tsx +76 -51
  33. package/src/components/popover/__tests__/__snapshots__/CPopover.spec.tsx.snap +0 -21
  34. package/src/components/progress/CProgress.tsx +43 -8
  35. package/src/components/progress/CProgressBar.tsx +5 -6
  36. package/src/components/progress/CProgressStacked.tsx +39 -0
  37. package/src/components/progress/index.ts +2 -1
  38. package/src/components/tooltip/CTooltip.tsx +77 -52
  39. package/src/hooks/index.ts +2 -1
  40. package/src/hooks/useColorModes.ts +23 -11
  41. package/src/hooks/usePopper.ts +31 -0
  42. package/src/props.ts +5 -0
  43. package/src/utils/getRTLPlacement.ts +18 -0
  44. package/src/utils/index.ts +2 -1
package/dist/index.js CHANGED
@@ -3,26 +3,6 @@
3
3
  var React = require('react');
4
4
  var ReactDOM = require('react-dom');
5
5
 
6
- function _interopNamespaceDefault(e) {
7
- var n = Object.create(null);
8
- if (e) {
9
- Object.keys(e).forEach(function (k) {
10
- if (k !== 'default') {
11
- var d = Object.getOwnPropertyDescriptor(e, k);
12
- Object.defineProperty(n, k, d.get ? d : {
13
- enumerable: true,
14
- get: function () { return e[k]; }
15
- });
16
- }
17
- });
18
- }
19
- n.default = e;
20
- return Object.freeze(n);
21
- }
22
-
23
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
24
- var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
25
-
26
6
  /******************************************************************************
27
7
  Copyright (c) Microsoft Corporation.
28
8
 
@@ -37,7 +17,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
37
17
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
38
18
  PERFORMANCE OF THIS SOFTWARE.
39
19
  ***************************************************************************** */
40
- /* global Reflect, Promise */
20
+ /* global Reflect, Promise, SuppressedError, Symbol */
41
21
 
42
22
 
43
23
  var __assign = function() {
@@ -71,7 +51,12 @@ function __spreadArray(to, from, pack) {
71
51
  }
72
52
  }
73
53
  return to.concat(ar || Array.prototype.slice.call(from));
74
- }
54
+ }
55
+
56
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
57
+ var e = new Error(message);
58
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
59
+ };
75
60
 
76
61
  function getDefaultExportFromCjs (x) {
77
62
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -2492,11 +2477,16 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, T
2492
2477
  }) : {};
2493
2478
  var CSSTransition$1 = CSSTransition;
2494
2479
 
2495
- var getStoredTheme = function (localStorageItemName) { return localStorage.getItem(localStorageItemName); };
2480
+ var getStoredTheme = function (localStorageItemName) {
2481
+ return typeof window !== 'undefined' && localStorage.getItem(localStorageItemName);
2482
+ };
2496
2483
  var setStoredTheme = function (localStorageItemName, colorMode) {
2497
2484
  return localStorage.setItem(localStorageItemName, colorMode);
2498
2485
  };
2499
2486
  var getPreferredColorScheme = function (localStorageItemName) {
2487
+ if (typeof window === 'undefined') {
2488
+ return 'light';
2489
+ }
2500
2490
  var storedTheme = getStoredTheme(localStorageItemName);
2501
2491
  if (storedTheme) {
2502
2492
  return storedTheme;
@@ -2515,20 +2505,23 @@ var useColorModes = function (localStorageItemName) {
2515
2505
  if (localStorageItemName === void 0) { localStorageItemName = 'coreui-react-color-scheme'; }
2516
2506
  var _a = React.useState(getPreferredColorScheme(localStorageItemName)), colorMode = _a[0], setColorMode = _a[1];
2517
2507
  React.useEffect(function () {
2518
- setStoredTheme(localStorageItemName, colorMode);
2519
- setTheme(colorMode);
2508
+ if (colorMode) {
2509
+ setStoredTheme(localStorageItemName, colorMode);
2510
+ setTheme(colorMode);
2511
+ }
2520
2512
  }, [colorMode]);
2521
2513
  React.useEffect(function () {
2522
2514
  window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function () {
2523
2515
  var storedTheme = getStoredTheme(localStorageItemName);
2524
- if (storedTheme !== 'light' && storedTheme !== 'dark') {
2516
+ if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode) {
2525
2517
  setTheme(colorMode);
2526
2518
  }
2527
2519
  });
2528
- }, []);
2520
+ });
2529
2521
  return {
2530
- getColorMode: function () { return colorMode; },
2531
- setColorMode: function (mode) { return setColorMode(mode); },
2522
+ colorMode: colorMode,
2523
+ isColorModeSet: function () { return Boolean(getStoredTheme(localStorageItemName)); },
2524
+ setColorMode: setColorMode,
2532
2525
  };
2533
2526
  };
2534
2527
 
@@ -2575,1115 +2568,270 @@ function isFunction(value) {
2575
2568
  return !!(value && {}.toString.call(value) == '[object Function]');
2576
2569
  }
2577
2570
 
2578
- var CCollapse = React.forwardRef(function (_a, ref) {
2579
- var children = _a.children, className = _a.className, horizontal = _a.horizontal, onHide = _a.onHide, onShow = _a.onShow, visible = _a.visible, rest = __rest(_a, ["children", "className", "horizontal", "onHide", "onShow", "visible"]);
2580
- var collapseRef = React.useRef(null);
2581
- var forkedRef = useForkedRef(ref, collapseRef);
2582
- var _b = React.useState(), height = _b[0], setHeight = _b[1];
2583
- var _c = React.useState(), width = _c[0], setWidth = _c[1];
2584
- var onEntering = function () {
2585
- onShow && onShow();
2586
- if (horizontal) {
2587
- collapseRef.current && setWidth(collapseRef.current.scrollWidth);
2588
- return;
2589
- }
2590
- collapseRef.current && setHeight(collapseRef.current.scrollHeight);
2591
- };
2592
- var onEntered = function () {
2593
- if (horizontal) {
2594
- setWidth(0);
2595
- return;
2596
- }
2597
- setHeight(0);
2598
- };
2599
- var onExit = function () {
2600
- if (horizontal) {
2601
- collapseRef.current && setWidth(collapseRef.current.scrollWidth);
2602
- return;
2603
- }
2604
- collapseRef.current && setHeight(collapseRef.current.scrollHeight);
2605
- };
2606
- var onExiting = function () {
2607
- onHide && onHide();
2608
- if (horizontal) {
2609
- setWidth(0);
2610
- return;
2611
- }
2612
- setHeight(0);
2613
- };
2614
- var onExited = function () {
2615
- if (horizontal) {
2616
- setWidth(0);
2617
- return;
2618
- }
2619
- setHeight(0);
2620
- };
2621
- return (React.createElement(CSSTransition$1, { in: visible, nodeRef: collapseRef, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited, timeout: 350 }, function (state) {
2622
- var currentHeight = height === 0 ? null : { height: height };
2623
- var currentWidth = width === 0 ? null : { width: width };
2624
- return (React.createElement("div", __assign({ className: classNames(className, {
2625
- 'collapse-horizontal': horizontal,
2626
- collapsing: state === 'entering' || state === 'exiting',
2627
- 'collapse show': state === 'entered',
2628
- collapse: state === 'exited',
2629
- }), style: __assign(__assign({}, currentHeight), currentWidth) }, rest, { ref: forkedRef }), children));
2630
- }));
2631
- });
2632
- CCollapse.propTypes = {
2633
- children: PropTypes.node,
2634
- className: PropTypes.string,
2635
- horizontal: PropTypes.bool,
2636
- onHide: PropTypes.func,
2637
- onShow: PropTypes.func,
2638
- visible: PropTypes.bool,
2639
- };
2640
- CCollapse.displayName = 'CCollapse';
2571
+ var top = 'top';
2572
+ var bottom = 'bottom';
2573
+ var right = 'right';
2574
+ var left = 'left';
2575
+ var auto = 'auto';
2576
+ var basePlacements = [top, bottom, right, left];
2577
+ var start = 'start';
2578
+ var end = 'end';
2579
+ var clippingParents = 'clippingParents';
2580
+ var viewport = 'viewport';
2581
+ var popper = 'popper';
2582
+ var reference = 'reference';
2583
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
2584
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
2585
+ }, []);
2586
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
2587
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
2588
+ }, []); // modifiers that need to read the DOM
2641
2589
 
2642
- var CAccordionBody = React.forwardRef(function (_a, ref) {
2643
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2644
- var visible = React.useContext(CAccordionItemContext).visible;
2645
- return (React.createElement(CCollapse, { className: "accordion-collapse", visible: visible },
2646
- React.createElement("div", __assign({ className: classNames('accordion-body', className) }, rest, { ref: ref }), children)));
2647
- });
2648
- CAccordionBody.propTypes = {
2649
- children: PropTypes.node,
2650
- className: PropTypes.string,
2651
- };
2652
- CAccordionBody.displayName = 'CAccordionBody';
2590
+ var beforeRead = 'beforeRead';
2591
+ var read = 'read';
2592
+ var afterRead = 'afterRead'; // pure-logic modifiers
2653
2593
 
2654
- var CAccordionButton = React.forwardRef(function (_a, ref) {
2655
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2656
- var _b = React.useContext(CAccordionItemContext), visible = _b.visible, setVisible = _b.setVisible;
2657
- return (React.createElement("button", __assign({ type: "button", className: classNames('accordion-button', { collapsed: !visible }, className), "aria-expanded": !visible, onClick: function () { return setVisible(!visible); } }, rest, { ref: ref }), children));
2658
- });
2659
- CAccordionButton.propTypes = {
2660
- children: PropTypes.node,
2661
- className: PropTypes.string,
2662
- };
2663
- CAccordionButton.displayName = 'CAccordionButton';
2594
+ var beforeMain = 'beforeMain';
2595
+ var main = 'main';
2596
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
2664
2597
 
2665
- var CAccordionHeader = React.forwardRef(function (_a, ref) {
2666
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2667
- return (React.createElement("div", __assign({ className: classNames('accordion-header', className) }, rest, { ref: ref }),
2668
- React.createElement(CAccordionButton, null, children)));
2669
- });
2670
- CAccordionHeader.propTypes = {
2671
- children: PropTypes.node,
2672
- className: PropTypes.string,
2673
- };
2674
- CAccordionHeader.displayName = 'CAccordionHeader';
2598
+ var beforeWrite = 'beforeWrite';
2599
+ var write = 'write';
2600
+ var afterWrite = 'afterWrite';
2601
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
2675
2602
 
2676
- var CCloseButton = React.forwardRef(function (_a, ref) {
2677
- var className = _a.className, disabled = _a.disabled, white = _a.white, rest = __rest(_a, ["className", "disabled", "white"]);
2678
- return (React.createElement("button", __assign({ type: "button", className: classNames('btn', 'btn-close', {
2679
- 'btn-close-white': white,
2680
- }, disabled, className), "aria-label": "Close", disabled: disabled }, rest, { ref: ref })));
2681
- });
2682
- CCloseButton.propTypes = {
2683
- className: PropTypes.string,
2684
- disabled: PropTypes.bool,
2685
- white: PropTypes.bool,
2686
- };
2687
- CCloseButton.displayName = 'CCloseButton';
2603
+ function getNodeName(element) {
2604
+ return element ? (element.nodeName || '').toLowerCase() : null;
2605
+ }
2688
2606
 
2689
- var colorPropType = PropTypes.oneOfType([
2690
- PropTypes.oneOf([
2691
- 'primary',
2692
- 'secondary',
2693
- 'success',
2694
- 'danger',
2695
- 'warning',
2696
- 'info',
2697
- 'dark',
2698
- 'light',
2699
- ]),
2700
- PropTypes.string,
2701
- ]);
2702
- var placementPropType = PropTypes.oneOf([
2703
- 'auto',
2704
- 'auto-start',
2705
- 'auto-end',
2706
- 'top-end',
2707
- 'top',
2708
- 'top-start',
2709
- 'bottom-end',
2710
- 'bottom',
2711
- 'bottom-start',
2712
- 'right-start',
2713
- 'right',
2714
- 'right-end',
2715
- 'left-start',
2716
- 'left',
2717
- 'left-end',
2718
- ]);
2719
- var shapePropType = PropTypes.oneOfType([
2720
- PropTypes.oneOf([
2721
- 'rounded',
2722
- 'rounded-top',
2723
- 'rounded-end',
2724
- 'rounded-bottom',
2725
- 'rounded-start',
2726
- 'rounded-circle',
2727
- 'rounded-pill',
2728
- 'rounded-0',
2729
- 'rounded-1',
2730
- 'rounded-2',
2731
- 'rounded-3',
2732
- ]),
2733
- PropTypes.string,
2734
- ]);
2735
- var textColorsPropType = PropTypes.oneOfType([
2736
- colorPropType,
2737
- PropTypes.oneOf(['white', 'muted']),
2738
- PropTypes.string,
2739
- ]);
2740
- var triggerPropType = PropTypes.oneOfType([
2741
- PropTypes.arrayOf(PropTypes.oneOf(['hover', 'focus', 'click']).isRequired),
2742
- PropTypes.oneOf(['hover', 'focus', 'click']),
2743
- ]);
2607
+ function getWindow(node) {
2608
+ if (node == null) {
2609
+ return window;
2610
+ }
2744
2611
 
2745
- var CAlert = React.forwardRef(function (_a, ref) {
2746
- var children = _a.children, className = _a.className, _b = _a.color, color = _b === void 0 ? 'primary' : _b, dismissible = _a.dismissible, variant = _a.variant, _c = _a.visible, visible = _c === void 0 ? true : _c, onClose = _a.onClose, rest = __rest(_a, ["children", "className", "color", "dismissible", "variant", "visible", "onClose"]);
2747
- var alertRef = React.useRef(null);
2748
- var forkedRef = useForkedRef(ref, alertRef);
2749
- var _d = React.useState(visible), _visible = _d[0], setVisible = _d[1];
2750
- React.useEffect(function () {
2751
- setVisible(visible);
2752
- }, [visible]);
2753
- return (React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: alertRef, onExit: onClose, timeout: 150, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('alert', variant === 'solid' ? "bg-".concat(color, " text-white") : "alert-".concat(color), {
2754
- 'alert-dismissible fade': dismissible,
2755
- show: state === 'entered',
2756
- }, className), role: "alert" }, rest, { ref: forkedRef }),
2757
- children,
2758
- dismissible && React.createElement(CCloseButton, { onClick: function () { return setVisible(false); } }))); }));
2759
- });
2760
- CAlert.propTypes = {
2761
- children: PropTypes.node,
2762
- className: PropTypes.string,
2763
- color: colorPropType.isRequired,
2764
- dismissible: PropTypes.bool,
2765
- onClose: PropTypes.func,
2766
- variant: PropTypes.string,
2767
- visible: PropTypes.bool,
2768
- };
2769
- CAlert.displayName = 'CAlert';
2612
+ if (node.toString() !== '[object Window]') {
2613
+ var ownerDocument = node.ownerDocument;
2614
+ return ownerDocument ? ownerDocument.defaultView || window : window;
2615
+ }
2770
2616
 
2771
- var CAlertHeading = React.forwardRef(function (_a, ref) {
2772
- var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'h4' : _b, rest = __rest(_a, ["children", "className", "component"]);
2773
- return (React.createElement(Component, __assign({ className: classNames('alert-heading', className) }, rest, { ref: ref }), children));
2774
- });
2775
- CAlertHeading.propTypes = {
2776
- children: PropTypes.node,
2777
- className: PropTypes.string,
2778
- component: PropTypes.elementType,
2779
- };
2780
- CAlertHeading.displayName = 'CAlertHeading';
2617
+ return node;
2618
+ }
2781
2619
 
2782
- var CLink = React.forwardRef(function (_a, ref) {
2783
- var children = _a.children, active = _a.active, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'a' : _b, disabled = _a.disabled, rest = __rest(_a, ["children", "active", "className", "component", "disabled"]);
2784
- return (React.createElement(Component
2785
- // TODO: remove duplicated classes ex. `active active` in `<CListGroupItem>`
2786
- , __assign({
2787
- // TODO: remove duplicated classes ex. `active active` in `<CListGroupItem>`
2788
- className: classNames(className, { active: active, disabled: disabled }) }, (active && { 'aria-current': 'page' }), (Component === 'a' && disabled && { 'aria-disabled': true, tabIndex: -1 }), ((Component === 'a' || Component === 'button') && {
2789
- onClick: function (event) {
2790
- event.preventDefault;
2791
- !disabled && rest.onClick && rest.onClick(event);
2792
- },
2793
- }), { disabled: disabled }, rest, { ref: ref }), children));
2794
- });
2795
- CLink.propTypes = {
2796
- active: PropTypes.bool,
2797
- children: PropTypes.node,
2798
- className: PropTypes.string,
2799
- component: PropTypes.elementType,
2800
- disabled: PropTypes.bool,
2801
- };
2802
- CLink.displayName = 'CLink';
2620
+ function isElement(node) {
2621
+ var OwnElement = getWindow(node).Element;
2622
+ return node instanceof OwnElement || node instanceof Element;
2623
+ }
2803
2624
 
2804
- var CAlertLink = React.forwardRef(function (_a, ref) {
2805
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2806
- return (React.createElement(CLink, __assign({ className: classNames('alert-link', className) }, rest, { ref: ref }), children));
2807
- });
2808
- CAlertLink.propTypes = {
2809
- children: PropTypes.node,
2810
- className: PropTypes.string,
2811
- };
2812
- CAlertLink.displayName = 'CAlertLink';
2625
+ function isHTMLElement(node) {
2626
+ var OwnElement = getWindow(node).HTMLElement;
2627
+ return node instanceof OwnElement || node instanceof HTMLElement;
2628
+ }
2813
2629
 
2814
- var CAvatar = React.forwardRef(function (_a, ref) {
2815
- var _b;
2816
- var children = _a.children, className = _a.className, color = _a.color, shape = _a.shape, size = _a.size, src = _a.src, status = _a.status, textColor = _a.textColor, rest = __rest(_a, ["children", "className", "color", "shape", "size", "src", "status", "textColor"]);
2817
- var statusClassName = status && classNames('avatar-status', "bg-".concat(status));
2818
- return (React.createElement("div", __assign({ className: classNames('avatar', (_b = {},
2819
- _b["bg-".concat(color)] = color,
2820
- _b["avatar-".concat(size)] = size,
2821
- _b["text-".concat(textColor)] = textColor,
2822
- _b), shape, className) }, rest, { ref: ref }),
2823
- src ? React.createElement("img", { src: src, className: "avatar-img" }) : children,
2824
- status && React.createElement("span", { className: statusClassName })));
2825
- });
2826
- CAvatar.propTypes = {
2827
- children: PropTypes.node,
2828
- className: PropTypes.string,
2829
- color: colorPropType,
2830
- shape: shapePropType,
2831
- size: PropTypes.string,
2832
- src: PropTypes.string,
2833
- status: PropTypes.string,
2834
- textColor: textColorsPropType,
2835
- };
2836
- CAvatar.displayName = 'CAvatar';
2630
+ function isShadowRoot(node) {
2631
+ // IE 11 has no ShadowRoot
2632
+ if (typeof ShadowRoot === 'undefined') {
2633
+ return false;
2634
+ }
2837
2635
 
2838
- var CBackdrop = React.forwardRef(function (_a, ref) {
2839
- var _b = _a.className, className = _b === void 0 ? 'modal-backdrop' : _b, visible = _a.visible, rest = __rest(_a, ["className", "visible"]);
2840
- var backdropRef = React.useRef(null);
2841
- var forkedRef = useForkedRef(ref, backdropRef);
2842
- return (React.createElement(Transition$1, { in: visible, mountOnEnter: true, nodeRef: backdropRef, timeout: 150, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames(className, 'fade', {
2843
- show: state === 'entered',
2844
- }) }, rest, { ref: forkedRef }))); }));
2845
- });
2846
- CBackdrop.propTypes = {
2847
- className: PropTypes.string,
2848
- visible: PropTypes.bool,
2849
- };
2850
- CBackdrop.displayName = 'CBackdrop';
2636
+ var OwnElement = getWindow(node).ShadowRoot;
2637
+ return node instanceof OwnElement || node instanceof ShadowRoot;
2638
+ }
2851
2639
 
2852
- var CBadge = React.forwardRef(function (_a, ref) {
2853
- var _b;
2854
- var children = _a.children, className = _a.className, color = _a.color, _c = _a.component, Component = _c === void 0 ? 'span' : _c, position = _a.position, shape = _a.shape, size = _a.size, textColor = _a.textColor, rest = __rest(_a, ["children", "className", "color", "component", "position", "shape", "size", "textColor"]);
2855
- return (React.createElement(Component, __assign({ className: classNames('badge', (_b = {},
2856
- _b["bg-".concat(color)] = color,
2857
- _b['position-absolute translate-middle'] = position,
2858
- _b['top-0'] = position === null || position === void 0 ? void 0 : position.includes('top'),
2859
- _b['top-100'] = position === null || position === void 0 ? void 0 : position.includes('bottom'),
2860
- _b['start-100'] = position === null || position === void 0 ? void 0 : position.includes('end'),
2861
- _b['start-0'] = position === null || position === void 0 ? void 0 : position.includes('start'),
2862
- _b["badge-".concat(size)] = size,
2863
- _b["text-".concat(textColor)] = textColor,
2864
- _b), shape, className) }, rest, { ref: ref }), children));
2865
- });
2866
- CBadge.propTypes = {
2867
- children: PropTypes.node,
2868
- className: PropTypes.string,
2869
- color: colorPropType,
2870
- component: PropTypes.string,
2871
- position: PropTypes.oneOf(['top-start', 'top-end', 'bottom-end', 'bottom-start']),
2872
- shape: shapePropType,
2873
- size: PropTypes.oneOf(['sm']),
2874
- textColor: textColorsPropType,
2875
- };
2876
- CBadge.displayName = 'CBadge';
2640
+ // and applies them to the HTMLElements such as popper and arrow
2877
2641
 
2878
- var CBreadcrumb = React.forwardRef(function (_a, ref) {
2879
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2880
- return (React.createElement("nav", { "aria-label": "breadcrumb" },
2881
- React.createElement("ol", __assign({ className: classNames('breadcrumb', className) }, rest, { ref: ref }), children)));
2882
- });
2883
- CBreadcrumb.propTypes = {
2884
- children: PropTypes.node,
2885
- className: PropTypes.string,
2886
- };
2887
- CBreadcrumb.displayName = 'CBreadcrumb';
2642
+ function applyStyles(_ref) {
2643
+ var state = _ref.state;
2644
+ Object.keys(state.elements).forEach(function (name) {
2645
+ var style = state.styles[name] || {};
2646
+ var attributes = state.attributes[name] || {};
2647
+ var element = state.elements[name]; // arrow is optional + virtual elements
2888
2648
 
2889
- var CBreadcrumbItem = React.forwardRef(function (_a, ref) {
2890
- var children = _a.children, active = _a.active, className = _a.className, href = _a.href, rest = __rest(_a, ["children", "active", "className", "href"]);
2891
- return (React.createElement("li", __assign({ className: classNames('breadcrumb-item', {
2892
- active: active,
2893
- }, className) }, (active && { 'aria-current': 'page' }), rest, { ref: ref }), href ? React.createElement(CLink, { href: href }, children) : children));
2894
- });
2895
- CBreadcrumbItem.propTypes = {
2896
- active: PropTypes.bool,
2897
- children: PropTypes.node,
2898
- className: PropTypes.string,
2899
- href: PropTypes.string,
2900
- };
2901
- CBreadcrumbItem.displayName = 'CBreadcrumbItem';
2649
+ if (!isHTMLElement(element) || !getNodeName(element)) {
2650
+ return;
2651
+ } // Flow doesn't support to extend this property, but it's the most
2652
+ // effective way to apply styles to an HTMLElement
2653
+ // $FlowFixMe[cannot-write]
2902
2654
 
2903
- var CButton = React.forwardRef(function (_a, ref) {
2904
- var _b;
2905
- var children = _a.children, className = _a.className, _c = _a.color, color = _c === void 0 ? 'primary' : _c, _d = _a.component, component = _d === void 0 ? 'button' : _d, shape = _a.shape, size = _a.size, _e = _a.type, type = _e === void 0 ? 'button' : _e, variant = _a.variant, rest = __rest(_a, ["children", "className", "color", "component", "shape", "size", "type", "variant"]);
2906
- return (React.createElement(CLink, __assign({ component: rest.href ? 'a' : component, type: type, className: classNames('btn', variant ? "btn-".concat(variant, "-").concat(color) : "btn-".concat(color), (_b = {}, _b["btn-".concat(size)] = size, _b), shape, className) }, rest, { ref: ref }), children));
2907
- });
2908
- CButton.propTypes = {
2909
- children: PropTypes.node,
2910
- className: PropTypes.string,
2911
- color: colorPropType,
2912
- component: PropTypes.elementType,
2913
- shape: PropTypes.string,
2914
- size: PropTypes.oneOf(['sm', 'lg']),
2915
- type: PropTypes.oneOf(['button', 'submit', 'reset']),
2916
- variant: PropTypes.oneOf(['outline', 'ghost']),
2917
- };
2918
- CButton.displayName = 'CButton';
2919
2655
 
2920
- var CButtonToolbar = React.forwardRef(function (_a, ref) {
2921
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2922
- return (React.createElement("div", __assign({ className: classNames('btn-toolbar', className) }, rest, { ref: ref }), children));
2923
- });
2924
- CButtonToolbar.propTypes = {
2925
- children: PropTypes.node,
2926
- className: PropTypes.string,
2927
- };
2928
- CButtonToolbar.displayName = 'CButtonToolbar';
2656
+ Object.assign(element.style, style);
2657
+ Object.keys(attributes).forEach(function (name) {
2658
+ var value = attributes[name];
2929
2659
 
2930
- var CButtonGroup = React.forwardRef(function (_a, ref) {
2931
- var _b;
2932
- var children = _a.children, className = _a.className, size = _a.size, vertical = _a.vertical, rest = __rest(_a, ["children", "className", "size", "vertical"]);
2933
- return (React.createElement("div", __assign({ className: classNames(vertical ? 'btn-group-vertical' : 'btn-group', (_b = {}, _b["btn-group-".concat(size)] = size, _b), className) }, rest, { ref: ref }), children));
2934
- });
2935
- CButtonGroup.propTypes = {
2936
- children: PropTypes.node,
2937
- className: PropTypes.string,
2938
- size: PropTypes.oneOf(['sm', 'lg']),
2939
- vertical: PropTypes.bool,
2940
- };
2941
- CButtonGroup.displayName = 'CButtonGroup';
2660
+ if (value === false) {
2661
+ element.removeAttribute(name);
2662
+ } else {
2663
+ element.setAttribute(name, value === true ? '' : value);
2664
+ }
2665
+ });
2666
+ });
2667
+ }
2942
2668
 
2943
- var CCallout = React.forwardRef(function (_a, ref) {
2944
- var _b;
2945
- var children = _a.children, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "className", "color"]);
2946
- return (React.createElement("div", __assign({ className: classNames('callout', (_b = {},
2947
- _b["callout-".concat(color)] = color,
2948
- _b), className) }, rest, { ref: ref }), children));
2949
- });
2950
- CCallout.propTypes = {
2951
- children: PropTypes.node,
2952
- className: PropTypes.string,
2953
- color: colorPropType,
2954
- };
2955
- CCallout.displayName = 'CCallout';
2669
+ function effect$2(_ref2) {
2670
+ var state = _ref2.state;
2671
+ var initialStyles = {
2672
+ popper: {
2673
+ position: state.options.strategy,
2674
+ left: '0',
2675
+ top: '0',
2676
+ margin: '0'
2677
+ },
2678
+ arrow: {
2679
+ position: 'absolute'
2680
+ },
2681
+ reference: {}
2682
+ };
2683
+ Object.assign(state.elements.popper.style, initialStyles.popper);
2684
+ state.styles = initialStyles;
2956
2685
 
2957
- var CCard = React.forwardRef(function (_a, ref) {
2958
- var _b;
2959
- var children = _a.children, className = _a.className, color = _a.color, textColor = _a.textColor, rest = __rest(_a, ["children", "className", "color", "textColor"]);
2960
- return (React.createElement("div", __assign({ className: classNames('card', (_b = {},
2961
- _b["bg-".concat(color)] = color,
2962
- _b["text-".concat(textColor)] = textColor,
2963
- _b), className) }, rest, { ref: ref }), children));
2964
- });
2965
- CCard.propTypes = {
2966
- children: PropTypes.node,
2967
- className: PropTypes.string,
2968
- color: colorPropType,
2969
- textColor: PropTypes.string,
2970
- };
2971
- CCard.displayName = 'CCard';
2686
+ if (state.elements.arrow) {
2687
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
2688
+ }
2972
2689
 
2973
- var CCardBody = React.forwardRef(function (_a, ref) {
2974
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2975
- return (React.createElement("div", __assign({ className: classNames('card-body', className) }, rest, { ref: ref }), children));
2976
- });
2977
- CCardBody.propTypes = {
2978
- children: PropTypes.node,
2979
- className: PropTypes.string,
2980
- };
2981
- CCardBody.displayName = 'CCardBody';
2690
+ return function () {
2691
+ Object.keys(state.elements).forEach(function (name) {
2692
+ var element = state.elements[name];
2693
+ var attributes = state.attributes[name] || {};
2694
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
2982
2695
 
2983
- var CCardFooter = React.forwardRef(function (_a, ref) {
2984
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2985
- return (React.createElement("div", __assign({ className: classNames('card-footer', className) }, rest, { ref: ref }), children));
2986
- });
2987
- CCardFooter.propTypes = {
2988
- children: PropTypes.node,
2989
- className: PropTypes.string,
2990
- };
2991
- CCardFooter.displayName = 'CCardFooter';
2696
+ var style = styleProperties.reduce(function (style, property) {
2697
+ style[property] = '';
2698
+ return style;
2699
+ }, {}); // arrow is optional + virtual elements
2992
2700
 
2993
- var CCardGroup = React.forwardRef(function (_a, ref) {
2994
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2995
- return (React.createElement("div", __assign({ className: classNames('card-group', className) }, rest, { ref: ref }), children));
2996
- });
2997
- CCardGroup.propTypes = {
2998
- children: PropTypes.node,
2999
- className: PropTypes.string,
3000
- };
3001
- CCardGroup.displayName = 'CCardGroup';
2701
+ if (!isHTMLElement(element) || !getNodeName(element)) {
2702
+ return;
2703
+ }
3002
2704
 
3003
- var CCardHeader = React.forwardRef(function (_a, ref) {
3004
- var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'div' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
3005
- return (React.createElement(Component, __assign({ className: classNames('card-header', className) }, rest, { ref: ref }), children));
3006
- });
3007
- CCardHeader.propTypes = {
3008
- children: PropTypes.node,
3009
- className: PropTypes.string,
3010
- component: PropTypes.elementType,
3011
- };
3012
- CCardHeader.displayName = 'CCardHeader';
2705
+ Object.assign(element.style, style);
2706
+ Object.keys(attributes).forEach(function (attribute) {
2707
+ element.removeAttribute(attribute);
2708
+ });
2709
+ });
2710
+ };
2711
+ } // eslint-disable-next-line import/no-unused-modules
3013
2712
 
3014
- var CCardImage = React.forwardRef(function (_a, ref) {
3015
- var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'img' : _b, orientation = _a.orientation, rest = __rest(_a, ["children", "className", "component", "orientation"]);
3016
- return (React.createElement(Component, __assign({ className: classNames(orientation ? "card-img-".concat(orientation) : 'card-img', className) }, rest, { ref: ref }), children));
3017
- });
3018
- CCardImage.propTypes = {
3019
- children: PropTypes.node,
3020
- className: PropTypes.string,
3021
- component: PropTypes.elementType,
3022
- orientation: PropTypes.oneOf(['top', 'bottom']),
3023
- };
3024
- CCardImage.displayName = 'CCardImage';
3025
2713
 
3026
- var CCardImageOverlay = React.forwardRef(function (_a, ref) {
3027
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
3028
- return (React.createElement("div", __assign({ className: classNames('card-img-overlay', className) }, rest, { ref: ref }), children));
3029
- });
3030
- CCardImageOverlay.propTypes = {
3031
- children: PropTypes.node,
3032
- className: PropTypes.string,
2714
+ var applyStyles$1 = {
2715
+ name: 'applyStyles',
2716
+ enabled: true,
2717
+ phase: 'write',
2718
+ fn: applyStyles,
2719
+ effect: effect$2,
2720
+ requires: ['computeStyles']
3033
2721
  };
3034
- CCardImageOverlay.displayName = 'CCardImageOverlay';
3035
2722
 
3036
- var CCardLink = React.forwardRef(function (_a, ref) {
3037
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
3038
- return (React.createElement(CLink, __assign({ className: classNames('card-link', className) }, rest, { ref: ref }), children));
3039
- });
3040
- CCardLink.propTypes = {
3041
- children: PropTypes.node,
3042
- className: PropTypes.string,
3043
- };
3044
- CCardLink.displayName = 'CCardLink';
2723
+ function getBasePlacement(placement) {
2724
+ return placement.split('-')[0];
2725
+ }
3045
2726
 
3046
- var CCardSubtitle = React.forwardRef(function (_a, ref) {
3047
- var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'h6' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
3048
- return (React.createElement(Component, __assign({ className: classNames('card-subtitle', className) }, rest, { ref: ref }), children));
3049
- });
3050
- CCardSubtitle.propTypes = {
3051
- children: PropTypes.node,
3052
- className: PropTypes.string,
3053
- component: PropTypes.elementType,
3054
- };
3055
- CCardSubtitle.displayName = 'CCardSubtitle';
2727
+ var max = Math.max;
2728
+ var min = Math.min;
2729
+ var round = Math.round;
3056
2730
 
3057
- var CCardText = React.forwardRef(function (_a, ref) {
3058
- var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'p' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
3059
- return (React.createElement(Component, __assign({ className: classNames('card-text', className) }, rest, { ref: ref }), children));
3060
- });
3061
- CCardText.propTypes = {
3062
- children: PropTypes.node,
3063
- className: PropTypes.string,
3064
- component: PropTypes.elementType,
3065
- };
3066
- CCardText.displayName = 'CCardText';
2731
+ function getUAString() {
2732
+ var uaData = navigator.userAgentData;
3067
2733
 
3068
- var CCardTitle = React.forwardRef(function (_a, ref) {
3069
- var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'h5' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
3070
- return (React.createElement(Component, __assign({ className: classNames('card-title', className) }, rest, { ref: ref }), children));
3071
- });
3072
- CCardTitle.propTypes = {
3073
- children: PropTypes.node,
3074
- className: PropTypes.string,
3075
- component: PropTypes.elementType,
3076
- };
3077
- CCardTitle.displayName = 'CCardTitle';
2734
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
2735
+ return uaData.brands.map(function (item) {
2736
+ return item.brand + "/" + item.version;
2737
+ }).join(' ');
2738
+ }
3078
2739
 
3079
- var isInViewport = function (element) {
3080
- var rect = element.getBoundingClientRect();
3081
- return (Math.floor(rect.top) >= 0 &&
3082
- Math.floor(rect.left) >= 0 &&
3083
- Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) &&
3084
- Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth));
3085
- };
2740
+ return navigator.userAgent;
2741
+ }
3086
2742
 
3087
- var isRTL = function (element) {
3088
- if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
3089
- return true;
3090
- }
3091
- if (element) {
3092
- return element.closest('[dir="rtl"]') !== null;
3093
- }
3094
- return false;
3095
- };
2743
+ function isLayoutViewport() {
2744
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
2745
+ }
3096
2746
 
3097
- var CCarouselContext = React.createContext({});
3098
- var CCarousel = React.forwardRef(function (_a, ref) {
3099
- 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"]);
3100
- var carouselRef = React.useRef(null);
3101
- var forkedRef = useForkedRef(ref, carouselRef);
3102
- var data = React.useRef({}).current;
3103
- var _g = React.useState(activeIndex), active = _g[0], setActive = _g[1];
3104
- var _h = React.useState(false), animating = _h[0], setAnimating = _h[1];
3105
- var _j = React.useState(), customInterval = _j[0], setCustomInterval = _j[1];
3106
- var _k = React.useState('next'), direction = _k[0], setDirection = _k[1];
3107
- var _l = React.useState(0), itemsNumber = _l[0], setItemsNumber = _l[1];
3108
- var _m = React.useState(null), touchPosition = _m[0], setTouchPosition = _m[1];
3109
- var _o = React.useState(), visible = _o[0], setVisible = _o[1];
3110
- React.useEffect(function () {
3111
- setItemsNumber(React.Children.toArray(children).length);
3112
- });
3113
- React.useEffect(function () {
3114
- visible && cycle();
3115
- }, [visible]);
3116
- React.useEffect(function () {
3117
- !animating && cycle();
3118
- !animating && onSlid && onSlid(active, direction);
3119
- animating && onSlide && onSlide(active, direction);
3120
- }, [animating]);
3121
- React.useEffect(function () {
3122
- window.addEventListener('scroll', handleScroll);
3123
- return function () {
3124
- window.removeEventListener('scroll', handleScroll);
3125
- };
3126
- });
3127
- var cycle = function () {
3128
- _pause();
3129
- if (!wrap && active === itemsNumber - 1) {
3130
- return;
3131
- }
3132
- if (typeof interval === 'number') {
3133
- data.timeout = setTimeout(function () { return nextItemWhenVisible(); }, typeof customInterval === 'number' ? customInterval : interval);
3134
- }
3135
- };
3136
- var _pause = function () { return pause && data.timeout && clearTimeout(data.timeout); };
3137
- var nextItemWhenVisible = function () {
3138
- // Don't call next when the page isn't visible
3139
- // or the carousel or its parent isn't visible
3140
- if (!document.hidden && carouselRef.current && isInViewport(carouselRef.current)) {
3141
- if (animating) {
3142
- return;
3143
- }
3144
- handleControlClick('next');
3145
- }
3146
- };
3147
- var handleControlClick = function (direction) {
3148
- if (animating) {
3149
- return;
3150
- }
3151
- setDirection(direction);
3152
- if (direction === 'next') {
3153
- active === itemsNumber - 1 ? setActive(0) : setActive(active + 1);
3154
- }
3155
- else {
3156
- active === 0 ? setActive(itemsNumber - 1) : setActive(active - 1);
3157
- }
3158
- };
3159
- var handleIndicatorClick = function (index) {
3160
- if (active === index) {
3161
- return;
3162
- }
3163
- if (active < index) {
3164
- setDirection('next');
3165
- setActive(index);
3166
- return;
3167
- }
3168
- if (active > index) {
3169
- setDirection('prev');
3170
- setActive(index);
3171
- }
3172
- };
3173
- var handleScroll = function () {
3174
- if (!document.hidden && carouselRef.current && isInViewport(carouselRef.current)) {
3175
- setVisible(true);
3176
- }
3177
- else {
3178
- setVisible(false);
3179
- }
3180
- };
3181
- var handleTouchMove = function (e) {
3182
- var touchDown = touchPosition;
3183
- if (touchDown === null) {
3184
- return;
3185
- }
3186
- var currentTouch = e.touches[0].clientX;
3187
- var diff = touchDown - currentTouch;
3188
- if (diff > 5) {
3189
- handleControlClick('next');
3190
- }
3191
- if (diff < -5) {
3192
- handleControlClick('prev');
3193
- }
3194
- setTouchPosition(null);
3195
- };
3196
- var handleTouchStart = function (e) {
3197
- var touchDown = e.touches[0].clientX;
3198
- setTouchPosition(touchDown);
3199
- };
3200
- return (React.createElement("div", __assign({ className: classNames('carousel slide', {
3201
- 'carousel-dark': dark,
3202
- 'carousel-fade': transition === 'crossfade',
3203
- }, className), onMouseEnter: _pause, onMouseLeave: cycle }, (touch && { onTouchStart: handleTouchStart, onTouchMove: handleTouchMove }), rest, { ref: forkedRef }),
3204
- React.createElement(CCarouselContext.Provider, { value: {
3205
- setAnimating: setAnimating,
3206
- setCustomInterval: setCustomInterval,
3207
- } },
3208
- indicators && (React.createElement("ol", { className: "carousel-indicators" }, Array.from({ length: itemsNumber }, function (_, i) { return i; }).map(function (index) {
3209
- return (React.createElement("li", { key: "indicator".concat(index), onClick: function () {
3210
- !animating && handleIndicatorClick(index);
3211
- }, className: active === index ? 'active' : '', "data-coreui-target": "" }));
3212
- }))),
3213
- React.createElement("div", { className: "carousel-inner" }, React.Children.map(children, function (child, index) {
3214
- if (React.isValidElement(child)) {
3215
- return React.cloneElement(child, {
3216
- active: active === index ? true : false,
3217
- direction: direction,
3218
- key: index,
3219
- });
3220
- }
3221
- return;
3222
- })),
3223
- controls && (React.createElement(React.Fragment, null,
3224
- React.createElement("button", { className: "carousel-control-prev", onClick: function () { return handleControlClick('prev'); } },
3225
- React.createElement("span", { className: "carousel-control-prev-icon", "aria-label": "prev" })),
3226
- React.createElement("button", { className: "carousel-control-next", onClick: function () { return handleControlClick('next'); } },
3227
- React.createElement("span", { className: "carousel-control-next-icon", "aria-label": "next" })))))));
3228
- });
3229
- CCarousel.propTypes = {
3230
- activeIndex: PropTypes.number,
3231
- children: PropTypes.node,
3232
- className: PropTypes.string,
3233
- controls: PropTypes.bool,
3234
- dark: PropTypes.bool,
3235
- indicators: PropTypes.bool,
3236
- interval: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
3237
- onSlid: PropTypes.func,
3238
- onSlide: PropTypes.func,
3239
- pause: PropTypes.oneOf([false, 'hover']),
3240
- touch: PropTypes.bool,
3241
- transition: PropTypes.oneOf(['slide', 'crossfade']),
3242
- wrap: PropTypes.bool,
3243
- };
3244
- CCarousel.displayName = 'CCarousel';
3245
-
3246
- var CCarouselCaption = React.forwardRef(function (_a, ref) {
3247
- var className = _a.className, rest = __rest(_a, ["className"]);
3248
- return React.createElement("div", __assign({ className: classNames('carousel-caption', className) }, rest, { ref: ref }));
3249
- });
3250
- CCarouselCaption.propTypes = {
3251
- className: PropTypes.string,
3252
- };
3253
- CCarouselCaption.displayName = 'CCarouselCaption';
2747
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
2748
+ if (includeScale === void 0) {
2749
+ includeScale = false;
2750
+ }
3254
2751
 
3255
- var CCarouselItem = React.forwardRef(function (_a, ref) {
3256
- var children = _a.children, className = _a.className, active = _a.active, direction = _a.direction, _b = _a.interval, interval = _b === void 0 ? false : _b, rest = __rest(_a, ["children", "className", "active", "direction", "interval"]);
3257
- var _c = React.useContext(CCarouselContext), setAnimating = _c.setAnimating, setCustomInterval = _c.setCustomInterval;
3258
- var carouselItemRef = React.useRef(null);
3259
- var forkedRef = useForkedRef(ref, carouselItemRef);
3260
- var prevActive = React.useRef();
3261
- var _d = React.useState(), directionClassName = _d[0], setDirectionClassName = _d[1];
3262
- var _e = React.useState(), orderClassName = _e[0], setOrderClassName = _e[1];
3263
- var _f = React.useState(active && 'active'), activeClassName = _f[0], setActiveClassName = _f[1];
3264
- var _g = React.useState(0), count = _g[0], setCount = _g[1];
3265
- React.useEffect(function () {
3266
- if (active) {
3267
- setCustomInterval(interval);
3268
- if (count !== 0)
3269
- setOrderClassName("carousel-item-".concat(direction));
3270
- }
3271
- if (prevActive.current && !active) {
3272
- setActiveClassName('active');
3273
- }
3274
- if (active || prevActive.current) {
3275
- setTimeout(function () {
3276
- var _a;
3277
- if (count !== 0) {
3278
- // @ts-expect-error reflow is necessary to proper transition
3279
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3280
- (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight;
3281
- setDirectionClassName("carousel-item-".concat(direction === 'next' ? 'start' : 'end'));
3282
- }
3283
- }, 0);
3284
- }
3285
- prevActive.current = active;
3286
- if (count === 0)
3287
- setCount(count + 1);
3288
- }, [active]);
3289
- React.useEffect(function () {
3290
- var _a, _b;
3291
- (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('transitionstart', function () {
3292
- active && setAnimating(true);
3293
- });
3294
- (_b = carouselItemRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('transitionend', function () {
3295
- active && setAnimating(false);
3296
- setDirectionClassName('');
3297
- setOrderClassName('');
3298
- if (active) {
3299
- setActiveClassName('active');
3300
- }
3301
- if (!active) {
3302
- setActiveClassName('');
3303
- }
3304
- });
3305
- return function () {
3306
- var _a, _b;
3307
- (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('transitionstart', function () {
3308
- active && setAnimating(true);
3309
- });
3310
- (_b = carouselItemRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('transitionend', function () {
3311
- active && setAnimating(false);
3312
- setDirectionClassName('');
3313
- setOrderClassName('');
3314
- if (active) {
3315
- setActiveClassName('active');
3316
- }
3317
- if (!active) {
3318
- setActiveClassName('');
3319
- }
3320
- });
3321
- };
3322
- });
3323
- return (React.createElement("div", __assign({ className: classNames('carousel-item', activeClassName, directionClassName, orderClassName, className), ref: forkedRef }, rest), children));
3324
- });
3325
- CCarouselItem.propTypes = {
3326
- active: PropTypes.bool,
3327
- children: PropTypes.node,
3328
- className: PropTypes.string,
3329
- direction: PropTypes.string,
3330
- interval: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
3331
- };
3332
- CCarouselItem.displayName = 'CCarouselItem';
2752
+ if (isFixedStrategy === void 0) {
2753
+ isFixedStrategy = false;
2754
+ }
3333
2755
 
3334
- var CConditionalPortal = function (_a) {
3335
- var children = _a.children, portal = _a.portal;
3336
- return typeof window !== 'undefined' && portal ? (ReactDOM.createPortal(children, document.body)) : (React.createElement(React.Fragment, null, children));
3337
- };
3338
- CConditionalPortal.propTypes = {
3339
- children: PropTypes.node,
3340
- portal: PropTypes.bool.isRequired,
3341
- };
3342
- CConditionalPortal.displayName = 'CConditionalPortal';
2756
+ var clientRect = element.getBoundingClientRect();
2757
+ var scaleX = 1;
2758
+ var scaleY = 1;
3343
2759
 
3344
- var ManagerReferenceNodeContext = React__namespace.createContext();
3345
- var ManagerReferenceNodeSetterContext = React__namespace.createContext();
3346
- function Manager(_ref) {
3347
- var children = _ref.children;
2760
+ if (includeScale && isHTMLElement(element)) {
2761
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
2762
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
2763
+ }
3348
2764
 
3349
- var _React$useState = React__namespace.useState(null),
3350
- referenceNode = _React$useState[0],
3351
- setReferenceNode = _React$useState[1];
2765
+ var _ref = isElement(element) ? getWindow(element) : window,
2766
+ visualViewport = _ref.visualViewport;
3352
2767
 
3353
- var hasUnmounted = React__namespace.useRef(false);
3354
- React__namespace.useEffect(function () {
3355
- return function () {
3356
- hasUnmounted.current = true;
3357
- };
3358
- }, []);
3359
- var handleSetReferenceNode = React__namespace.useCallback(function (node) {
3360
- if (!hasUnmounted.current) {
3361
- setReferenceNode(node);
3362
- }
3363
- }, []);
3364
- return /*#__PURE__*/React__namespace.createElement(ManagerReferenceNodeContext.Provider, {
3365
- value: referenceNode
3366
- }, /*#__PURE__*/React__namespace.createElement(ManagerReferenceNodeSetterContext.Provider, {
3367
- value: handleSetReferenceNode
3368
- }, children));
2768
+ var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
2769
+ var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
2770
+ var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
2771
+ var width = clientRect.width / scaleX;
2772
+ var height = clientRect.height / scaleY;
2773
+ return {
2774
+ width: width,
2775
+ height: height,
2776
+ top: y,
2777
+ right: x + width,
2778
+ bottom: y + height,
2779
+ left: x,
2780
+ x: x,
2781
+ y: y
2782
+ };
3369
2783
  }
3370
2784
 
3371
- /**
3372
- * Takes an argument and if it's an array, returns the first item in the array,
3373
- * otherwise returns the argument. Used for Preact compatibility.
3374
- */
3375
- var unwrapArray = function unwrapArray(arg) {
3376
- return Array.isArray(arg) ? arg[0] : arg;
3377
- };
3378
- /**
3379
- * Takes a maybe-undefined function and arbitrary args and invokes the function
3380
- * only if it is defined.
3381
- */
3382
-
3383
- var safeInvoke = function safeInvoke(fn) {
3384
- if (typeof fn === 'function') {
3385
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3386
- args[_key - 1] = arguments[_key];
3387
- }
2785
+ // means it doesn't take into account transforms.
3388
2786
 
3389
- return fn.apply(void 0, args);
3390
- }
3391
- };
3392
- /**
3393
- * Sets a ref using either a ref callback or a ref object
3394
- */
2787
+ function getLayoutRect(element) {
2788
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
2789
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
3395
2790
 
3396
- var setRef = function setRef(ref, node) {
3397
- // if its a function call it
3398
- if (typeof ref === 'function') {
3399
- return safeInvoke(ref, node);
3400
- } // otherwise we should treat it as a ref object
3401
- else if (ref != null) {
3402
- ref.current = node;
3403
- }
3404
- };
3405
- /**
3406
- * Simple ponyfill for Object.fromEntries
3407
- */
2791
+ var width = element.offsetWidth;
2792
+ var height = element.offsetHeight;
3408
2793
 
3409
- var fromEntries = function fromEntries(entries) {
3410
- return entries.reduce(function (acc, _ref) {
3411
- var key = _ref[0],
3412
- value = _ref[1];
3413
- acc[key] = value;
3414
- return acc;
3415
- }, {});
3416
- };
3417
- /**
3418
- * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
3419
- */
2794
+ if (Math.abs(clientRect.width - width) <= 1) {
2795
+ width = clientRect.width;
2796
+ }
3420
2797
 
3421
- var useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? React__namespace.useLayoutEffect : React__namespace.useEffect;
2798
+ if (Math.abs(clientRect.height - height) <= 1) {
2799
+ height = clientRect.height;
2800
+ }
3422
2801
 
3423
- var top = 'top';
3424
- var bottom = 'bottom';
3425
- var right = 'right';
3426
- var left = 'left';
3427
- var auto = 'auto';
3428
- var basePlacements = [top, bottom, right, left];
3429
- var start = 'start';
3430
- var end = 'end';
3431
- var clippingParents = 'clippingParents';
3432
- var viewport = 'viewport';
3433
- var popper = 'popper';
3434
- var reference = 'reference';
3435
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
3436
- return acc.concat([placement + "-" + start, placement + "-" + end]);
3437
- }, []);
3438
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
3439
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
3440
- }, []); // modifiers that need to read the DOM
2802
+ return {
2803
+ x: element.offsetLeft,
2804
+ y: element.offsetTop,
2805
+ width: width,
2806
+ height: height
2807
+ };
2808
+ }
3441
2809
 
3442
- var beforeRead = 'beforeRead';
3443
- var read = 'read';
3444
- var afterRead = 'afterRead'; // pure-logic modifiers
2810
+ function contains(parent, child) {
2811
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
3445
2812
 
3446
- var beforeMain = 'beforeMain';
3447
- var main = 'main';
3448
- var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
2813
+ if (parent.contains(child)) {
2814
+ return true;
2815
+ } // then fallback to custom implementation with Shadow DOM support
2816
+ else if (rootNode && isShadowRoot(rootNode)) {
2817
+ var next = child;
3449
2818
 
3450
- var beforeWrite = 'beforeWrite';
3451
- var write = 'write';
3452
- var afterWrite = 'afterWrite';
3453
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
2819
+ do {
2820
+ if (next && parent.isSameNode(next)) {
2821
+ return true;
2822
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
3454
2823
 
3455
- function getNodeName(element) {
3456
- return element ? (element.nodeName || '').toLowerCase() : null;
3457
- }
3458
2824
 
3459
- function getWindow(node) {
3460
- if (node == null) {
3461
- return window;
3462
- }
2825
+ next = next.parentNode || next.host;
2826
+ } while (next);
2827
+ } // Give up, the result is false
3463
2828
 
3464
- if (node.toString() !== '[object Window]') {
3465
- var ownerDocument = node.ownerDocument;
3466
- return ownerDocument ? ownerDocument.defaultView || window : window;
3467
- }
3468
2829
 
3469
- return node;
2830
+ return false;
3470
2831
  }
3471
2832
 
3472
- function isElement(node) {
3473
- var OwnElement = getWindow(node).Element;
3474
- return node instanceof OwnElement || node instanceof Element;
3475
- }
3476
-
3477
- function isHTMLElement(node) {
3478
- var OwnElement = getWindow(node).HTMLElement;
3479
- return node instanceof OwnElement || node instanceof HTMLElement;
3480
- }
3481
-
3482
- function isShadowRoot(node) {
3483
- // IE 11 has no ShadowRoot
3484
- if (typeof ShadowRoot === 'undefined') {
3485
- return false;
3486
- }
3487
-
3488
- var OwnElement = getWindow(node).ShadowRoot;
3489
- return node instanceof OwnElement || node instanceof ShadowRoot;
3490
- }
3491
-
3492
- // and applies them to the HTMLElements such as popper and arrow
3493
-
3494
- function applyStyles(_ref) {
3495
- var state = _ref.state;
3496
- Object.keys(state.elements).forEach(function (name) {
3497
- var style = state.styles[name] || {};
3498
- var attributes = state.attributes[name] || {};
3499
- var element = state.elements[name]; // arrow is optional + virtual elements
3500
-
3501
- if (!isHTMLElement(element) || !getNodeName(element)) {
3502
- return;
3503
- } // Flow doesn't support to extend this property, but it's the most
3504
- // effective way to apply styles to an HTMLElement
3505
- // $FlowFixMe[cannot-write]
3506
-
3507
-
3508
- Object.assign(element.style, style);
3509
- Object.keys(attributes).forEach(function (name) {
3510
- var value = attributes[name];
3511
-
3512
- if (value === false) {
3513
- element.removeAttribute(name);
3514
- } else {
3515
- element.setAttribute(name, value === true ? '' : value);
3516
- }
3517
- });
3518
- });
3519
- }
3520
-
3521
- function effect$2(_ref2) {
3522
- var state = _ref2.state;
3523
- var initialStyles = {
3524
- popper: {
3525
- position: state.options.strategy,
3526
- left: '0',
3527
- top: '0',
3528
- margin: '0'
3529
- },
3530
- arrow: {
3531
- position: 'absolute'
3532
- },
3533
- reference: {}
3534
- };
3535
- Object.assign(state.elements.popper.style, initialStyles.popper);
3536
- state.styles = initialStyles;
3537
-
3538
- if (state.elements.arrow) {
3539
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
3540
- }
3541
-
3542
- return function () {
3543
- Object.keys(state.elements).forEach(function (name) {
3544
- var element = state.elements[name];
3545
- var attributes = state.attributes[name] || {};
3546
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
3547
-
3548
- var style = styleProperties.reduce(function (style, property) {
3549
- style[property] = '';
3550
- return style;
3551
- }, {}); // arrow is optional + virtual elements
3552
-
3553
- if (!isHTMLElement(element) || !getNodeName(element)) {
3554
- return;
3555
- }
3556
-
3557
- Object.assign(element.style, style);
3558
- Object.keys(attributes).forEach(function (attribute) {
3559
- element.removeAttribute(attribute);
3560
- });
3561
- });
3562
- };
3563
- } // eslint-disable-next-line import/no-unused-modules
3564
-
3565
-
3566
- var applyStyles$1 = {
3567
- name: 'applyStyles',
3568
- enabled: true,
3569
- phase: 'write',
3570
- fn: applyStyles,
3571
- effect: effect$2,
3572
- requires: ['computeStyles']
3573
- };
3574
-
3575
- function getBasePlacement(placement) {
3576
- return placement.split('-')[0];
3577
- }
3578
-
3579
- var max = Math.max;
3580
- var min = Math.min;
3581
- var round = Math.round;
3582
-
3583
- function getUAString() {
3584
- var uaData = navigator.userAgentData;
3585
-
3586
- if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
3587
- return uaData.brands.map(function (item) {
3588
- return item.brand + "/" + item.version;
3589
- }).join(' ');
3590
- }
3591
-
3592
- return navigator.userAgent;
3593
- }
3594
-
3595
- function isLayoutViewport() {
3596
- return !/^((?!chrome|android).)*safari/i.test(getUAString());
3597
- }
3598
-
3599
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
3600
- if (includeScale === void 0) {
3601
- includeScale = false;
3602
- }
3603
-
3604
- if (isFixedStrategy === void 0) {
3605
- isFixedStrategy = false;
3606
- }
3607
-
3608
- var clientRect = element.getBoundingClientRect();
3609
- var scaleX = 1;
3610
- var scaleY = 1;
3611
-
3612
- if (includeScale && isHTMLElement(element)) {
3613
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
3614
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
3615
- }
3616
-
3617
- var _ref = isElement(element) ? getWindow(element) : window,
3618
- visualViewport = _ref.visualViewport;
3619
-
3620
- var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
3621
- var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
3622
- var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
3623
- var width = clientRect.width / scaleX;
3624
- var height = clientRect.height / scaleY;
3625
- return {
3626
- width: width,
3627
- height: height,
3628
- top: y,
3629
- right: x + width,
3630
- bottom: y + height,
3631
- left: x,
3632
- x: x,
3633
- y: y
3634
- };
3635
- }
3636
-
3637
- // means it doesn't take into account transforms.
3638
-
3639
- function getLayoutRect(element) {
3640
- var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
3641
- // Fixes https://github.com/popperjs/popper-core/issues/1223
3642
-
3643
- var width = element.offsetWidth;
3644
- var height = element.offsetHeight;
3645
-
3646
- if (Math.abs(clientRect.width - width) <= 1) {
3647
- width = clientRect.width;
3648
- }
3649
-
3650
- if (Math.abs(clientRect.height - height) <= 1) {
3651
- height = clientRect.height;
3652
- }
3653
-
3654
- return {
3655
- x: element.offsetLeft,
3656
- y: element.offsetTop,
3657
- width: width,
3658
- height: height
3659
- };
3660
- }
3661
-
3662
- function contains(parent, child) {
3663
- var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
3664
-
3665
- if (parent.contains(child)) {
3666
- return true;
3667
- } // then fallback to custom implementation with Shadow DOM support
3668
- else if (rootNode && isShadowRoot(rootNode)) {
3669
- var next = child;
3670
-
3671
- do {
3672
- if (next && parent.isSameNode(next)) {
3673
- return true;
3674
- } // $FlowFixMe[prop-missing]: need a better way to handle this...
3675
-
3676
-
3677
- next = next.parentNode || next.host;
3678
- } while (next);
3679
- } // Give up, the result is false
3680
-
3681
-
3682
- return false;
3683
- }
3684
-
3685
- function getComputedStyle$1(element) {
3686
- return getWindow(element).getComputedStyle(element);
2833
+ function getComputedStyle$1(element) {
2834
+ return getWindow(element).getComputedStyle(element);
3687
2835
  }
3688
2836
 
3689
2837
  function isTableElement(element) {
@@ -5129,498 +4277,920 @@ function popperGenerator(generatorOptions) {
5129
4277
  continue;
5130
4278
  }
5131
4279
 
5132
- var _state$orderedModifie = state.orderedModifiers[index],
5133
- fn = _state$orderedModifie.fn,
5134
- _state$orderedModifie2 = _state$orderedModifie.options,
5135
- _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
5136
- name = _state$orderedModifie.name;
4280
+ var _state$orderedModifie = state.orderedModifiers[index],
4281
+ fn = _state$orderedModifie.fn,
4282
+ _state$orderedModifie2 = _state$orderedModifie.options,
4283
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
4284
+ name = _state$orderedModifie.name;
4285
+
4286
+ if (typeof fn === 'function') {
4287
+ state = fn({
4288
+ state: state,
4289
+ options: _options,
4290
+ name: name,
4291
+ instance: instance
4292
+ }) || state;
4293
+ }
4294
+ }
4295
+ },
4296
+ // Async and optimistically optimized update – it will not be executed if
4297
+ // not necessary (debounced to run at most once-per-tick)
4298
+ update: debounce(function () {
4299
+ return new Promise(function (resolve) {
4300
+ instance.forceUpdate();
4301
+ resolve(state);
4302
+ });
4303
+ }),
4304
+ destroy: function destroy() {
4305
+ cleanupModifierEffects();
4306
+ isDestroyed = true;
4307
+ }
4308
+ };
4309
+
4310
+ if (!areValidElements(reference, popper)) {
4311
+ return instance;
4312
+ }
4313
+
4314
+ instance.setOptions(options).then(function (state) {
4315
+ if (!isDestroyed && options.onFirstUpdate) {
4316
+ options.onFirstUpdate(state);
4317
+ }
4318
+ }); // Modifiers have the ability to execute arbitrary code before the first
4319
+ // update cycle runs. They will be executed in the same order as the update
4320
+ // cycle. This is useful when a modifier adds some persistent data that
4321
+ // other modifiers need to use, but the modifier is run after the dependent
4322
+ // one.
4323
+
4324
+ function runModifierEffects() {
4325
+ state.orderedModifiers.forEach(function (_ref) {
4326
+ var name = _ref.name,
4327
+ _ref$options = _ref.options,
4328
+ options = _ref$options === void 0 ? {} : _ref$options,
4329
+ effect = _ref.effect;
4330
+
4331
+ if (typeof effect === 'function') {
4332
+ var cleanupFn = effect({
4333
+ state: state,
4334
+ name: name,
4335
+ instance: instance,
4336
+ options: options
4337
+ });
4338
+
4339
+ var noopFn = function noopFn() {};
4340
+
4341
+ effectCleanupFns.push(cleanupFn || noopFn);
4342
+ }
4343
+ });
4344
+ }
4345
+
4346
+ function cleanupModifierEffects() {
4347
+ effectCleanupFns.forEach(function (fn) {
4348
+ return fn();
4349
+ });
4350
+ effectCleanupFns = [];
4351
+ }
4352
+
4353
+ return instance;
4354
+ };
4355
+ }
4356
+
4357
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
4358
+ var createPopper = /*#__PURE__*/popperGenerator({
4359
+ defaultModifiers: defaultModifiers
4360
+ }); // eslint-disable-next-line import/no-unused-modules
4361
+
4362
+ var usePopper = function () {
4363
+ var _popper = React.useRef();
4364
+ var initPopper = function (reference, popper, options) {
4365
+ _popper.current = createPopper(reference, popper, options);
4366
+ };
4367
+ var destroyPopper = function () {
4368
+ if (_popper.current) {
4369
+ _popper.current.destroy();
4370
+ }
4371
+ _popper.current = undefined;
4372
+ };
4373
+ return {
4374
+ popper: _popper.current,
4375
+ initPopper: initPopper,
4376
+ destroyPopper: destroyPopper,
4377
+ };
4378
+ };
4379
+
4380
+ var CCollapse = React.forwardRef(function (_a, ref) {
4381
+ var children = _a.children, className = _a.className, horizontal = _a.horizontal, onHide = _a.onHide, onShow = _a.onShow, visible = _a.visible, rest = __rest(_a, ["children", "className", "horizontal", "onHide", "onShow", "visible"]);
4382
+ var collapseRef = React.useRef(null);
4383
+ var forkedRef = useForkedRef(ref, collapseRef);
4384
+ var _b = React.useState(), height = _b[0], setHeight = _b[1];
4385
+ var _c = React.useState(), width = _c[0], setWidth = _c[1];
4386
+ var onEntering = function () {
4387
+ onShow && onShow();
4388
+ if (horizontal) {
4389
+ collapseRef.current && setWidth(collapseRef.current.scrollWidth);
4390
+ return;
4391
+ }
4392
+ collapseRef.current && setHeight(collapseRef.current.scrollHeight);
4393
+ };
4394
+ var onEntered = function () {
4395
+ if (horizontal) {
4396
+ setWidth(0);
4397
+ return;
4398
+ }
4399
+ setHeight(0);
4400
+ };
4401
+ var onExit = function () {
4402
+ if (horizontal) {
4403
+ collapseRef.current && setWidth(collapseRef.current.scrollWidth);
4404
+ return;
4405
+ }
4406
+ collapseRef.current && setHeight(collapseRef.current.scrollHeight);
4407
+ };
4408
+ var onExiting = function () {
4409
+ onHide && onHide();
4410
+ if (horizontal) {
4411
+ setWidth(0);
4412
+ return;
4413
+ }
4414
+ setHeight(0);
4415
+ };
4416
+ var onExited = function () {
4417
+ if (horizontal) {
4418
+ setWidth(0);
4419
+ return;
4420
+ }
4421
+ setHeight(0);
4422
+ };
4423
+ return (React.createElement(CSSTransition$1, { in: visible, nodeRef: collapseRef, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited, timeout: 350 }, function (state) {
4424
+ var currentHeight = height === 0 ? null : { height: height };
4425
+ var currentWidth = width === 0 ? null : { width: width };
4426
+ return (React.createElement("div", __assign({ className: classNames(className, {
4427
+ 'collapse-horizontal': horizontal,
4428
+ collapsing: state === 'entering' || state === 'exiting',
4429
+ 'collapse show': state === 'entered',
4430
+ collapse: state === 'exited',
4431
+ }), style: __assign(__assign({}, currentHeight), currentWidth) }, rest, { ref: forkedRef }), children));
4432
+ }));
4433
+ });
4434
+ CCollapse.propTypes = {
4435
+ children: PropTypes.node,
4436
+ className: PropTypes.string,
4437
+ horizontal: PropTypes.bool,
4438
+ onHide: PropTypes.func,
4439
+ onShow: PropTypes.func,
4440
+ visible: PropTypes.bool,
4441
+ };
4442
+ CCollapse.displayName = 'CCollapse';
4443
+
4444
+ var CAccordionBody = React.forwardRef(function (_a, ref) {
4445
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4446
+ var visible = React.useContext(CAccordionItemContext).visible;
4447
+ return (React.createElement(CCollapse, { className: "accordion-collapse", visible: visible },
4448
+ React.createElement("div", __assign({ className: classNames('accordion-body', className) }, rest, { ref: ref }), children)));
4449
+ });
4450
+ CAccordionBody.propTypes = {
4451
+ children: PropTypes.node,
4452
+ className: PropTypes.string,
4453
+ };
4454
+ CAccordionBody.displayName = 'CAccordionBody';
4455
+
4456
+ var CAccordionButton = React.forwardRef(function (_a, ref) {
4457
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4458
+ var _b = React.useContext(CAccordionItemContext), visible = _b.visible, setVisible = _b.setVisible;
4459
+ return (React.createElement("button", __assign({ type: "button", className: classNames('accordion-button', { collapsed: !visible }, className), "aria-expanded": !visible, onClick: function () { return setVisible(!visible); } }, rest, { ref: ref }), children));
4460
+ });
4461
+ CAccordionButton.propTypes = {
4462
+ children: PropTypes.node,
4463
+ className: PropTypes.string,
4464
+ };
4465
+ CAccordionButton.displayName = 'CAccordionButton';
4466
+
4467
+ var CAccordionHeader = React.forwardRef(function (_a, ref) {
4468
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4469
+ return (React.createElement("div", __assign({ className: classNames('accordion-header', className) }, rest, { ref: ref }),
4470
+ React.createElement(CAccordionButton, null, children)));
4471
+ });
4472
+ CAccordionHeader.propTypes = {
4473
+ children: PropTypes.node,
4474
+ className: PropTypes.string,
4475
+ };
4476
+ CAccordionHeader.displayName = 'CAccordionHeader';
4477
+
4478
+ var CCloseButton = React.forwardRef(function (_a, ref) {
4479
+ var className = _a.className, disabled = _a.disabled, white = _a.white, rest = __rest(_a, ["className", "disabled", "white"]);
4480
+ return (React.createElement("button", __assign({ type: "button", className: classNames('btn', 'btn-close', {
4481
+ 'btn-close-white': white,
4482
+ }, disabled, className), "aria-label": "Close", disabled: disabled }, rest, { ref: ref })));
4483
+ });
4484
+ CCloseButton.propTypes = {
4485
+ className: PropTypes.string,
4486
+ disabled: PropTypes.bool,
4487
+ white: PropTypes.bool,
4488
+ };
4489
+ CCloseButton.displayName = 'CCloseButton';
4490
+
4491
+ var colorPropType = PropTypes.oneOfType([
4492
+ PropTypes.oneOf([
4493
+ 'primary',
4494
+ 'secondary',
4495
+ 'success',
4496
+ 'danger',
4497
+ 'warning',
4498
+ 'info',
4499
+ 'dark',
4500
+ 'light',
4501
+ ]),
4502
+ PropTypes.string,
4503
+ ]);
4504
+ var fallbackPlacementsPropType = PropTypes.oneOfType([
4505
+ PropTypes.arrayOf(PropTypes.oneOf(['top', 'bottom', 'right', 'left']).isRequired),
4506
+ PropTypes.oneOf(['top', 'bottom', 'right', 'left']),
4507
+ ]);
4508
+ var placementPropType = PropTypes.oneOf([
4509
+ 'auto',
4510
+ 'auto-start',
4511
+ 'auto-end',
4512
+ 'top-end',
4513
+ 'top',
4514
+ 'top-start',
4515
+ 'bottom-end',
4516
+ 'bottom',
4517
+ 'bottom-start',
4518
+ 'right-start',
4519
+ 'right',
4520
+ 'right-end',
4521
+ 'left-start',
4522
+ 'left',
4523
+ 'left-end',
4524
+ ]);
4525
+ var shapePropType = PropTypes.oneOfType([
4526
+ PropTypes.oneOf([
4527
+ 'rounded',
4528
+ 'rounded-top',
4529
+ 'rounded-end',
4530
+ 'rounded-bottom',
4531
+ 'rounded-start',
4532
+ 'rounded-circle',
4533
+ 'rounded-pill',
4534
+ 'rounded-0',
4535
+ 'rounded-1',
4536
+ 'rounded-2',
4537
+ 'rounded-3',
4538
+ ]),
4539
+ PropTypes.string,
4540
+ ]);
4541
+ var textColorsPropType = PropTypes.oneOfType([
4542
+ colorPropType,
4543
+ PropTypes.oneOf(['white', 'muted']),
4544
+ PropTypes.string,
4545
+ ]);
4546
+ var triggerPropType = PropTypes.oneOfType([
4547
+ PropTypes.arrayOf(PropTypes.oneOf(['hover', 'focus', 'click']).isRequired),
4548
+ PropTypes.oneOf(['hover', 'focus', 'click']),
4549
+ ]);
4550
+
4551
+ var CAlert = React.forwardRef(function (_a, ref) {
4552
+ var children = _a.children, className = _a.className, _b = _a.color, color = _b === void 0 ? 'primary' : _b, dismissible = _a.dismissible, variant = _a.variant, _c = _a.visible, visible = _c === void 0 ? true : _c, onClose = _a.onClose, rest = __rest(_a, ["children", "className", "color", "dismissible", "variant", "visible", "onClose"]);
4553
+ var alertRef = React.useRef(null);
4554
+ var forkedRef = useForkedRef(ref, alertRef);
4555
+ var _d = React.useState(visible), _visible = _d[0], setVisible = _d[1];
4556
+ React.useEffect(function () {
4557
+ setVisible(visible);
4558
+ }, [visible]);
4559
+ return (React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: alertRef, onExit: onClose, timeout: 150, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('alert', variant === 'solid' ? "bg-".concat(color, " text-white") : "alert-".concat(color), {
4560
+ 'alert-dismissible fade': dismissible,
4561
+ show: state === 'entered',
4562
+ }, className), role: "alert" }, rest, { ref: forkedRef }),
4563
+ children,
4564
+ dismissible && React.createElement(CCloseButton, { onClick: function () { return setVisible(false); } }))); }));
4565
+ });
4566
+ CAlert.propTypes = {
4567
+ children: PropTypes.node,
4568
+ className: PropTypes.string,
4569
+ color: colorPropType.isRequired,
4570
+ dismissible: PropTypes.bool,
4571
+ onClose: PropTypes.func,
4572
+ variant: PropTypes.string,
4573
+ visible: PropTypes.bool,
4574
+ };
4575
+ CAlert.displayName = 'CAlert';
4576
+
4577
+ var CAlertHeading = React.forwardRef(function (_a, ref) {
4578
+ var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'h4' : _b, rest = __rest(_a, ["children", "className", "component"]);
4579
+ return (React.createElement(Component, __assign({ className: classNames('alert-heading', className) }, rest, { ref: ref }), children));
4580
+ });
4581
+ CAlertHeading.propTypes = {
4582
+ children: PropTypes.node,
4583
+ className: PropTypes.string,
4584
+ component: PropTypes.elementType,
4585
+ };
4586
+ CAlertHeading.displayName = 'CAlertHeading';
4587
+
4588
+ var CLink = React.forwardRef(function (_a, ref) {
4589
+ var children = _a.children, active = _a.active, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'a' : _b, disabled = _a.disabled, rest = __rest(_a, ["children", "active", "className", "component", "disabled"]);
4590
+ return (React.createElement(Component
4591
+ // TODO: remove duplicated classes ex. `active active` in `<CListGroupItem>`
4592
+ , __assign({
4593
+ // TODO: remove duplicated classes ex. `active active` in `<CListGroupItem>`
4594
+ className: classNames(className, { active: active, disabled: disabled }) }, (active && { 'aria-current': 'page' }), (Component === 'a' && disabled && { 'aria-disabled': true, tabIndex: -1 }), ((Component === 'a' || Component === 'button') && {
4595
+ onClick: function (event) {
4596
+ event.preventDefault;
4597
+ !disabled && rest.onClick && rest.onClick(event);
4598
+ },
4599
+ }), { disabled: disabled }, rest, { ref: ref }), children));
4600
+ });
4601
+ CLink.propTypes = {
4602
+ active: PropTypes.bool,
4603
+ children: PropTypes.node,
4604
+ className: PropTypes.string,
4605
+ component: PropTypes.elementType,
4606
+ disabled: PropTypes.bool,
4607
+ };
4608
+ CLink.displayName = 'CLink';
4609
+
4610
+ var CAlertLink = React.forwardRef(function (_a, ref) {
4611
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4612
+ return (React.createElement(CLink, __assign({ className: classNames('alert-link', className) }, rest, { ref: ref }), children));
4613
+ });
4614
+ CAlertLink.propTypes = {
4615
+ children: PropTypes.node,
4616
+ className: PropTypes.string,
4617
+ };
4618
+ CAlertLink.displayName = 'CAlertLink';
4619
+
4620
+ var CAvatar = React.forwardRef(function (_a, ref) {
4621
+ var _b;
4622
+ var children = _a.children, className = _a.className, color = _a.color, shape = _a.shape, size = _a.size, src = _a.src, status = _a.status, textColor = _a.textColor, rest = __rest(_a, ["children", "className", "color", "shape", "size", "src", "status", "textColor"]);
4623
+ var statusClassName = status && classNames('avatar-status', "bg-".concat(status));
4624
+ return (React.createElement("div", __assign({ className: classNames('avatar', (_b = {},
4625
+ _b["bg-".concat(color)] = color,
4626
+ _b["avatar-".concat(size)] = size,
4627
+ _b["text-".concat(textColor)] = textColor,
4628
+ _b), shape, className) }, rest, { ref: ref }),
4629
+ src ? React.createElement("img", { src: src, className: "avatar-img" }) : children,
4630
+ status && React.createElement("span", { className: statusClassName })));
4631
+ });
4632
+ CAvatar.propTypes = {
4633
+ children: PropTypes.node,
4634
+ className: PropTypes.string,
4635
+ color: colorPropType,
4636
+ shape: shapePropType,
4637
+ size: PropTypes.string,
4638
+ src: PropTypes.string,
4639
+ status: PropTypes.string,
4640
+ textColor: textColorsPropType,
4641
+ };
4642
+ CAvatar.displayName = 'CAvatar';
4643
+
4644
+ var CBackdrop = React.forwardRef(function (_a, ref) {
4645
+ var _b = _a.className, className = _b === void 0 ? 'modal-backdrop' : _b, visible = _a.visible, rest = __rest(_a, ["className", "visible"]);
4646
+ var backdropRef = React.useRef(null);
4647
+ var forkedRef = useForkedRef(ref, backdropRef);
4648
+ return (React.createElement(Transition$1, { in: visible, mountOnEnter: true, nodeRef: backdropRef, timeout: 150, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames(className, 'fade', {
4649
+ show: state === 'entered',
4650
+ }) }, rest, { ref: forkedRef }))); }));
4651
+ });
4652
+ CBackdrop.propTypes = {
4653
+ className: PropTypes.string,
4654
+ visible: PropTypes.bool,
4655
+ };
4656
+ CBackdrop.displayName = 'CBackdrop';
4657
+
4658
+ var CBadge = React.forwardRef(function (_a, ref) {
4659
+ var _b;
4660
+ var children = _a.children, className = _a.className, color = _a.color, _c = _a.component, Component = _c === void 0 ? 'span' : _c, position = _a.position, shape = _a.shape, size = _a.size, textColor = _a.textColor, rest = __rest(_a, ["children", "className", "color", "component", "position", "shape", "size", "textColor"]);
4661
+ return (React.createElement(Component, __assign({ className: classNames('badge', (_b = {},
4662
+ _b["bg-".concat(color)] = color,
4663
+ _b['position-absolute translate-middle'] = position,
4664
+ _b['top-0'] = position === null || position === void 0 ? void 0 : position.includes('top'),
4665
+ _b['top-100'] = position === null || position === void 0 ? void 0 : position.includes('bottom'),
4666
+ _b['start-100'] = position === null || position === void 0 ? void 0 : position.includes('end'),
4667
+ _b['start-0'] = position === null || position === void 0 ? void 0 : position.includes('start'),
4668
+ _b["badge-".concat(size)] = size,
4669
+ _b["text-".concat(textColor)] = textColor,
4670
+ _b), shape, className) }, rest, { ref: ref }), children));
4671
+ });
4672
+ CBadge.propTypes = {
4673
+ children: PropTypes.node,
4674
+ className: PropTypes.string,
4675
+ color: colorPropType,
4676
+ component: PropTypes.string,
4677
+ position: PropTypes.oneOf(['top-start', 'top-end', 'bottom-end', 'bottom-start']),
4678
+ shape: shapePropType,
4679
+ size: PropTypes.oneOf(['sm']),
4680
+ textColor: textColorsPropType,
4681
+ };
4682
+ CBadge.displayName = 'CBadge';
5137
4683
 
5138
- if (typeof fn === 'function') {
5139
- state = fn({
5140
- state: state,
5141
- options: _options,
5142
- name: name,
5143
- instance: instance
5144
- }) || state;
5145
- }
5146
- }
5147
- },
5148
- // Async and optimistically optimized update – it will not be executed if
5149
- // not necessary (debounced to run at most once-per-tick)
5150
- update: debounce(function () {
5151
- return new Promise(function (resolve) {
5152
- instance.forceUpdate();
5153
- resolve(state);
5154
- });
5155
- }),
5156
- destroy: function destroy() {
5157
- cleanupModifierEffects();
5158
- isDestroyed = true;
5159
- }
5160
- };
4684
+ var CBreadcrumb = React.forwardRef(function (_a, ref) {
4685
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4686
+ return (React.createElement("nav", { "aria-label": "breadcrumb" },
4687
+ React.createElement("ol", __assign({ className: classNames('breadcrumb', className) }, rest, { ref: ref }), children)));
4688
+ });
4689
+ CBreadcrumb.propTypes = {
4690
+ children: PropTypes.node,
4691
+ className: PropTypes.string,
4692
+ };
4693
+ CBreadcrumb.displayName = 'CBreadcrumb';
5161
4694
 
5162
- if (!areValidElements(reference, popper)) {
5163
- return instance;
5164
- }
4695
+ var CBreadcrumbItem = React.forwardRef(function (_a, ref) {
4696
+ var children = _a.children, active = _a.active, className = _a.className, href = _a.href, rest = __rest(_a, ["children", "active", "className", "href"]);
4697
+ return (React.createElement("li", __assign({ className: classNames('breadcrumb-item', {
4698
+ active: active,
4699
+ }, className) }, (active && { 'aria-current': 'page' }), rest, { ref: ref }), href ? React.createElement(CLink, { href: href }, children) : children));
4700
+ });
4701
+ CBreadcrumbItem.propTypes = {
4702
+ active: PropTypes.bool,
4703
+ children: PropTypes.node,
4704
+ className: PropTypes.string,
4705
+ href: PropTypes.string,
4706
+ };
4707
+ CBreadcrumbItem.displayName = 'CBreadcrumbItem';
5165
4708
 
5166
- instance.setOptions(options).then(function (state) {
5167
- if (!isDestroyed && options.onFirstUpdate) {
5168
- options.onFirstUpdate(state);
5169
- }
5170
- }); // Modifiers have the ability to execute arbitrary code before the first
5171
- // update cycle runs. They will be executed in the same order as the update
5172
- // cycle. This is useful when a modifier adds some persistent data that
5173
- // other modifiers need to use, but the modifier is run after the dependent
5174
- // one.
4709
+ var CButton = React.forwardRef(function (_a, ref) {
4710
+ var _b;
4711
+ var children = _a.children, className = _a.className, _c = _a.color, color = _c === void 0 ? 'primary' : _c, _d = _a.component, component = _d === void 0 ? 'button' : _d, shape = _a.shape, size = _a.size, _e = _a.type, type = _e === void 0 ? 'button' : _e, variant = _a.variant, rest = __rest(_a, ["children", "className", "color", "component", "shape", "size", "type", "variant"]);
4712
+ return (React.createElement(CLink, __assign({ component: rest.href ? 'a' : component, type: type, className: classNames('btn', variant ? "btn-".concat(variant, "-").concat(color) : "btn-".concat(color), (_b = {}, _b["btn-".concat(size)] = size, _b), shape, className) }, rest, { ref: ref }), children));
4713
+ });
4714
+ CButton.propTypes = {
4715
+ children: PropTypes.node,
4716
+ className: PropTypes.string,
4717
+ color: colorPropType,
4718
+ component: PropTypes.elementType,
4719
+ shape: PropTypes.string,
4720
+ size: PropTypes.oneOf(['sm', 'lg']),
4721
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
4722
+ variant: PropTypes.oneOf(['outline', 'ghost']),
4723
+ };
4724
+ CButton.displayName = 'CButton';
5175
4725
 
5176
- function runModifierEffects() {
5177
- state.orderedModifiers.forEach(function (_ref) {
5178
- var name = _ref.name,
5179
- _ref$options = _ref.options,
5180
- options = _ref$options === void 0 ? {} : _ref$options,
5181
- effect = _ref.effect;
4726
+ var CButtonToolbar = React.forwardRef(function (_a, ref) {
4727
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4728
+ return (React.createElement("div", __assign({ className: classNames('btn-toolbar', className) }, rest, { ref: ref }), children));
4729
+ });
4730
+ CButtonToolbar.propTypes = {
4731
+ children: PropTypes.node,
4732
+ className: PropTypes.string,
4733
+ };
4734
+ CButtonToolbar.displayName = 'CButtonToolbar';
5182
4735
 
5183
- if (typeof effect === 'function') {
5184
- var cleanupFn = effect({
5185
- state: state,
5186
- name: name,
5187
- instance: instance,
5188
- options: options
5189
- });
4736
+ var CButtonGroup = React.forwardRef(function (_a, ref) {
4737
+ var _b;
4738
+ var children = _a.children, className = _a.className, size = _a.size, vertical = _a.vertical, rest = __rest(_a, ["children", "className", "size", "vertical"]);
4739
+ return (React.createElement("div", __assign({ className: classNames(vertical ? 'btn-group-vertical' : 'btn-group', (_b = {}, _b["btn-group-".concat(size)] = size, _b), className) }, rest, { ref: ref }), children));
4740
+ });
4741
+ CButtonGroup.propTypes = {
4742
+ children: PropTypes.node,
4743
+ className: PropTypes.string,
4744
+ size: PropTypes.oneOf(['sm', 'lg']),
4745
+ vertical: PropTypes.bool,
4746
+ };
4747
+ CButtonGroup.displayName = 'CButtonGroup';
5190
4748
 
5191
- var noopFn = function noopFn() {};
4749
+ var CCallout = React.forwardRef(function (_a, ref) {
4750
+ var _b;
4751
+ var children = _a.children, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "className", "color"]);
4752
+ return (React.createElement("div", __assign({ className: classNames('callout', (_b = {},
4753
+ _b["callout-".concat(color)] = color,
4754
+ _b), className) }, rest, { ref: ref }), children));
4755
+ });
4756
+ CCallout.propTypes = {
4757
+ children: PropTypes.node,
4758
+ className: PropTypes.string,
4759
+ color: colorPropType,
4760
+ };
4761
+ CCallout.displayName = 'CCallout';
5192
4762
 
5193
- effectCleanupFns.push(cleanupFn || noopFn);
5194
- }
5195
- });
5196
- }
4763
+ var CCard = React.forwardRef(function (_a, ref) {
4764
+ var _b;
4765
+ var children = _a.children, className = _a.className, color = _a.color, textColor = _a.textColor, rest = __rest(_a, ["children", "className", "color", "textColor"]);
4766
+ return (React.createElement("div", __assign({ className: classNames('card', (_b = {},
4767
+ _b["bg-".concat(color)] = color,
4768
+ _b["text-".concat(textColor)] = textColor,
4769
+ _b), className) }, rest, { ref: ref }), children));
4770
+ });
4771
+ CCard.propTypes = {
4772
+ children: PropTypes.node,
4773
+ className: PropTypes.string,
4774
+ color: colorPropType,
4775
+ textColor: PropTypes.string,
4776
+ };
4777
+ CCard.displayName = 'CCard';
5197
4778
 
5198
- function cleanupModifierEffects() {
5199
- effectCleanupFns.forEach(function (fn) {
5200
- return fn();
5201
- });
5202
- effectCleanupFns = [];
5203
- }
4779
+ var CCardBody = React.forwardRef(function (_a, ref) {
4780
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4781
+ return (React.createElement("div", __assign({ className: classNames('card-body', className) }, rest, { ref: ref }), children));
4782
+ });
4783
+ CCardBody.propTypes = {
4784
+ children: PropTypes.node,
4785
+ className: PropTypes.string,
4786
+ };
4787
+ CCardBody.displayName = 'CCardBody';
5204
4788
 
5205
- return instance;
5206
- };
5207
- }
4789
+ var CCardFooter = React.forwardRef(function (_a, ref) {
4790
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4791
+ return (React.createElement("div", __assign({ className: classNames('card-footer', className) }, rest, { ref: ref }), children));
4792
+ });
4793
+ CCardFooter.propTypes = {
4794
+ children: PropTypes.node,
4795
+ className: PropTypes.string,
4796
+ };
4797
+ CCardFooter.displayName = 'CCardFooter';
5208
4798
 
5209
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
5210
- var createPopper = /*#__PURE__*/popperGenerator({
5211
- defaultModifiers: defaultModifiers
5212
- }); // eslint-disable-next-line import/no-unused-modules
4799
+ var CCardGroup = React.forwardRef(function (_a, ref) {
4800
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4801
+ return (React.createElement("div", __assign({ className: classNames('card-group', className) }, rest, { ref: ref }), children));
4802
+ });
4803
+ CCardGroup.propTypes = {
4804
+ children: PropTypes.node,
4805
+ className: PropTypes.string,
4806
+ };
4807
+ CCardGroup.displayName = 'CCardGroup';
5213
4808
 
5214
- /* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
4809
+ var CCardHeader = React.forwardRef(function (_a, ref) {
4810
+ var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'div' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
4811
+ return (React.createElement(Component, __assign({ className: classNames('card-header', className) }, rest, { ref: ref }), children));
4812
+ });
4813
+ CCardHeader.propTypes = {
4814
+ children: PropTypes.node,
4815
+ className: PropTypes.string,
4816
+ component: PropTypes.elementType,
4817
+ };
4818
+ CCardHeader.displayName = 'CCardHeader';
5215
4819
 
5216
- var hasElementType = typeof Element !== 'undefined';
5217
- var hasMap = typeof Map === 'function';
5218
- var hasSet = typeof Set === 'function';
5219
- var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;
4820
+ var CCardImage = React.forwardRef(function (_a, ref) {
4821
+ var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'img' : _b, orientation = _a.orientation, rest = __rest(_a, ["children", "className", "component", "orientation"]);
4822
+ return (React.createElement(Component, __assign({ className: classNames(orientation ? "card-img-".concat(orientation) : 'card-img', className) }, rest, { ref: ref }), children));
4823
+ });
4824
+ CCardImage.propTypes = {
4825
+ children: PropTypes.node,
4826
+ className: PropTypes.string,
4827
+ component: PropTypes.elementType,
4828
+ orientation: PropTypes.oneOf(['top', 'bottom']),
4829
+ };
4830
+ CCardImage.displayName = 'CCardImage';
5220
4831
 
5221
- // Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
4832
+ var CCardImageOverlay = React.forwardRef(function (_a, ref) {
4833
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4834
+ return (React.createElement("div", __assign({ className: classNames('card-img-overlay', className) }, rest, { ref: ref }), children));
4835
+ });
4836
+ CCardImageOverlay.propTypes = {
4837
+ children: PropTypes.node,
4838
+ className: PropTypes.string,
4839
+ };
4840
+ CCardImageOverlay.displayName = 'CCardImageOverlay';
5222
4841
 
5223
- function equal(a, b) {
5224
- // START: fast-deep-equal es6/index.js 3.1.3
5225
- if (a === b) return true;
4842
+ var CCardLink = React.forwardRef(function (_a, ref) {
4843
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
4844
+ return (React.createElement(CLink, __assign({ className: classNames('card-link', className) }, rest, { ref: ref }), children));
4845
+ });
4846
+ CCardLink.propTypes = {
4847
+ children: PropTypes.node,
4848
+ className: PropTypes.string,
4849
+ };
4850
+ CCardLink.displayName = 'CCardLink';
5226
4851
 
5227
- if (a && b && typeof a == 'object' && typeof b == 'object') {
5228
- if (a.constructor !== b.constructor) return false;
4852
+ var CCardSubtitle = React.forwardRef(function (_a, ref) {
4853
+ var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'h6' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
4854
+ return (React.createElement(Component, __assign({ className: classNames('card-subtitle', className) }, rest, { ref: ref }), children));
4855
+ });
4856
+ CCardSubtitle.propTypes = {
4857
+ children: PropTypes.node,
4858
+ className: PropTypes.string,
4859
+ component: PropTypes.elementType,
4860
+ };
4861
+ CCardSubtitle.displayName = 'CCardSubtitle';
5229
4862
 
5230
- var length, i, keys;
5231
- if (Array.isArray(a)) {
5232
- length = a.length;
5233
- if (length != b.length) return false;
5234
- for (i = length; i-- !== 0;)
5235
- if (!equal(a[i], b[i])) return false;
5236
- return true;
5237
- }
4863
+ var CCardText = React.forwardRef(function (_a, ref) {
4864
+ var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'p' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
4865
+ return (React.createElement(Component, __assign({ className: classNames('card-text', className) }, rest, { ref: ref }), children));
4866
+ });
4867
+ CCardText.propTypes = {
4868
+ children: PropTypes.node,
4869
+ className: PropTypes.string,
4870
+ component: PropTypes.elementType,
4871
+ };
4872
+ CCardText.displayName = 'CCardText';
5238
4873
 
5239
- // START: Modifications:
5240
- // 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
5241
- // to co-exist with es5.
5242
- // 2. Replace `for of` with es5 compliant iteration using `for`.
5243
- // Basically, take:
5244
- //
5245
- // ```js
5246
- // for (i of a.entries())
5247
- // if (!b.has(i[0])) return false;
5248
- // ```
5249
- //
5250
- // ... and convert to:
5251
- //
5252
- // ```js
5253
- // it = a.entries();
5254
- // while (!(i = it.next()).done)
5255
- // if (!b.has(i.value[0])) return false;
5256
- // ```
5257
- //
5258
- // **Note**: `i` access switches to `i.value`.
5259
- var it;
5260
- if (hasMap && (a instanceof Map) && (b instanceof Map)) {
5261
- if (a.size !== b.size) return false;
5262
- it = a.entries();
5263
- while (!(i = it.next()).done)
5264
- if (!b.has(i.value[0])) return false;
5265
- it = a.entries();
5266
- while (!(i = it.next()).done)
5267
- if (!equal(i.value[1], b.get(i.value[0]))) return false;
5268
- return true;
5269
- }
4874
+ var CCardTitle = React.forwardRef(function (_a, ref) {
4875
+ var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'h5' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
4876
+ return (React.createElement(Component, __assign({ className: classNames('card-title', className) }, rest, { ref: ref }), children));
4877
+ });
4878
+ CCardTitle.propTypes = {
4879
+ children: PropTypes.node,
4880
+ className: PropTypes.string,
4881
+ component: PropTypes.elementType,
4882
+ };
4883
+ CCardTitle.displayName = 'CCardTitle';
5270
4884
 
5271
- if (hasSet && (a instanceof Set) && (b instanceof Set)) {
5272
- if (a.size !== b.size) return false;
5273
- it = a.entries();
5274
- while (!(i = it.next()).done)
5275
- if (!b.has(i.value[0])) return false;
5276
- return true;
5277
- }
5278
- // END: Modifications
5279
-
5280
- if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
5281
- length = a.length;
5282
- if (length != b.length) return false;
5283
- for (i = length; i-- !== 0;)
5284
- if (a[i] !== b[i]) return false;
5285
- return true;
4885
+ var getRTLPlacement = function (placement, element) {
4886
+ switch (placement) {
4887
+ case 'right': {
4888
+ return isRTL(element) ? 'left' : 'right';
4889
+ }
4890
+ case 'left': {
4891
+ return isRTL(element) ? 'right' : 'left';
4892
+ }
4893
+ default: {
4894
+ return placement;
4895
+ }
5286
4896
  }
4897
+ };
5287
4898
 
5288
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
5289
- // START: Modifications:
5290
- // Apply guards for `Object.create(null)` handling. See:
5291
- // - https://github.com/FormidableLabs/react-fast-compare/issues/64
5292
- // - https://github.com/epoberezkin/fast-deep-equal/issues/49
5293
- if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === 'function' && typeof b.valueOf === 'function') return a.valueOf() === b.valueOf();
5294
- if (a.toString !== Object.prototype.toString && typeof a.toString === 'function' && typeof b.toString === 'function') return a.toString() === b.toString();
5295
- // END: Modifications
5296
-
5297
- keys = Object.keys(a);
5298
- length = keys.length;
5299
- if (length !== Object.keys(b).length) return false;
5300
-
5301
- for (i = length; i-- !== 0;)
5302
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
5303
- // END: fast-deep-equal
5304
-
5305
- // START: react-fast-compare
5306
- // custom handling for DOM elements
5307
- if (hasElementType && a instanceof Element) return false;
5308
-
5309
- // custom handling for React/Preact
5310
- for (i = length; i-- !== 0;) {
5311
- if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
5312
- // React-specific: avoid traversing React elements' _owner
5313
- // Preact-specific: avoid traversing Preact elements' __v and __o
5314
- // __v = $_original / $_vnode
5315
- // __o = $_owner
5316
- // These properties contain circular references and are not needed when
5317
- // comparing the actual elements (and not their owners)
5318
- // .$$typeof and ._store on just reasonable markers of elements
5319
-
5320
- continue;
5321
- }
4899
+ var isInViewport = function (element) {
4900
+ var rect = element.getBoundingClientRect();
4901
+ return (Math.floor(rect.top) >= 0 &&
4902
+ Math.floor(rect.left) >= 0 &&
4903
+ Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) &&
4904
+ Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth));
4905
+ };
5322
4906
 
5323
- // all other properties should be traversed as usual
5324
- if (!equal(a[keys[i]], b[keys[i]])) return false;
4907
+ var isRTL = function (element) {
4908
+ if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
4909
+ return true;
5325
4910
  }
5326
- // END: react-fast-compare
5327
-
5328
- // START: fast-deep-equal
5329
- return true;
5330
- }
5331
-
5332
- return a !== a && b !== b;
5333
- }
5334
- // end fast-deep-equal
5335
-
5336
- var reactFastCompare = function isEqual(a, b) {
5337
- try {
5338
- return equal(a, b);
5339
- } catch (error) {
5340
- if (((error.message || '').match(/stack|recursion/i))) {
5341
- // warn on circular references, don't crash
5342
- // browsers give this different errors name and messages:
5343
- // chrome/safari: "RangeError", "Maximum call stack size exceeded"
5344
- // firefox: "InternalError", too much recursion"
5345
- // edge: "Error", "Out of stack space"
5346
- console.warn('react-fast-compare cannot handle circular refs');
5347
- return false;
4911
+ if (element) {
4912
+ return element.closest('[dir="rtl"]') !== null;
5348
4913
  }
5349
- // some other error. we should definitely know about these
5350
- throw error;
5351
- }
4914
+ return false;
5352
4915
  };
5353
4916
 
5354
- var isEqual = /*@__PURE__*/getDefaultExportFromCjs(reactFastCompare);
5355
-
5356
- var EMPTY_MODIFIERS$1 = [];
5357
- var usePopper = function usePopper(referenceElement, popperElement, options) {
5358
- if (options === void 0) {
5359
- options = {};
5360
- }
5361
-
5362
- var prevOptions = React__namespace.useRef(null);
5363
- var optionsWithDefaults = {
5364
- onFirstUpdate: options.onFirstUpdate,
5365
- placement: options.placement || 'bottom',
5366
- strategy: options.strategy || 'absolute',
5367
- modifiers: options.modifiers || EMPTY_MODIFIERS$1
5368
- };
4917
+ var CCarouselContext = React.createContext({});
4918
+ var CCarousel = React.forwardRef(function (_a, ref) {
4919
+ 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"]);
4920
+ var carouselRef = React.useRef(null);
4921
+ var forkedRef = useForkedRef(ref, carouselRef);
4922
+ var data = React.useRef({}).current;
4923
+ var _g = React.useState(activeIndex), active = _g[0], setActive = _g[1];
4924
+ var _h = React.useState(false), animating = _h[0], setAnimating = _h[1];
4925
+ var _j = React.useState(), customInterval = _j[0], setCustomInterval = _j[1];
4926
+ var _k = React.useState('next'), direction = _k[0], setDirection = _k[1];
4927
+ var _l = React.useState(0), itemsNumber = _l[0], setItemsNumber = _l[1];
4928
+ var _m = React.useState(null), touchPosition = _m[0], setTouchPosition = _m[1];
4929
+ var _o = React.useState(), visible = _o[0], setVisible = _o[1];
4930
+ React.useEffect(function () {
4931
+ setItemsNumber(React.Children.toArray(children).length);
4932
+ });
4933
+ React.useEffect(function () {
4934
+ visible && cycle();
4935
+ }, [visible]);
4936
+ React.useEffect(function () {
4937
+ !animating && cycle();
4938
+ !animating && onSlid && onSlid(active, direction);
4939
+ animating && onSlide && onSlide(active, direction);
4940
+ }, [animating]);
4941
+ React.useEffect(function () {
4942
+ window.addEventListener('scroll', handleScroll);
4943
+ return function () {
4944
+ window.removeEventListener('scroll', handleScroll);
4945
+ };
4946
+ });
4947
+ var cycle = function () {
4948
+ _pause();
4949
+ if (!wrap && active === itemsNumber - 1) {
4950
+ return;
4951
+ }
4952
+ if (typeof interval === 'number') {
4953
+ data.timeout = setTimeout(function () { return nextItemWhenVisible(); }, typeof customInterval === 'number' ? customInterval : interval);
4954
+ }
4955
+ };
4956
+ var _pause = function () { return pause && data.timeout && clearTimeout(data.timeout); };
4957
+ var nextItemWhenVisible = function () {
4958
+ // Don't call next when the page isn't visible
4959
+ // or the carousel or its parent isn't visible
4960
+ if (!document.hidden && carouselRef.current && isInViewport(carouselRef.current)) {
4961
+ if (animating) {
4962
+ return;
4963
+ }
4964
+ handleControlClick('next');
4965
+ }
4966
+ };
4967
+ var handleControlClick = function (direction) {
4968
+ if (animating) {
4969
+ return;
4970
+ }
4971
+ setDirection(direction);
4972
+ if (direction === 'next') {
4973
+ active === itemsNumber - 1 ? setActive(0) : setActive(active + 1);
4974
+ }
4975
+ else {
4976
+ active === 0 ? setActive(itemsNumber - 1) : setActive(active - 1);
4977
+ }
4978
+ };
4979
+ var handleIndicatorClick = function (index) {
4980
+ if (active === index) {
4981
+ return;
4982
+ }
4983
+ if (active < index) {
4984
+ setDirection('next');
4985
+ setActive(index);
4986
+ return;
4987
+ }
4988
+ if (active > index) {
4989
+ setDirection('prev');
4990
+ setActive(index);
4991
+ }
4992
+ };
4993
+ var handleScroll = function () {
4994
+ if (!document.hidden && carouselRef.current && isInViewport(carouselRef.current)) {
4995
+ setVisible(true);
4996
+ }
4997
+ else {
4998
+ setVisible(false);
4999
+ }
5000
+ };
5001
+ var handleTouchMove = function (e) {
5002
+ var touchDown = touchPosition;
5003
+ if (touchDown === null) {
5004
+ return;
5005
+ }
5006
+ var currentTouch = e.touches[0].clientX;
5007
+ var diff = touchDown - currentTouch;
5008
+ if (diff > 5) {
5009
+ handleControlClick('next');
5010
+ }
5011
+ if (diff < -5) {
5012
+ handleControlClick('prev');
5013
+ }
5014
+ setTouchPosition(null);
5015
+ };
5016
+ var handleTouchStart = function (e) {
5017
+ var touchDown = e.touches[0].clientX;
5018
+ setTouchPosition(touchDown);
5019
+ };
5020
+ return (React.createElement("div", __assign({ className: classNames('carousel slide', {
5021
+ 'carousel-dark': dark,
5022
+ 'carousel-fade': transition === 'crossfade',
5023
+ }, className), onMouseEnter: _pause, onMouseLeave: cycle }, (touch && { onTouchStart: handleTouchStart, onTouchMove: handleTouchMove }), rest, { ref: forkedRef }),
5024
+ React.createElement(CCarouselContext.Provider, { value: {
5025
+ setAnimating: setAnimating,
5026
+ setCustomInterval: setCustomInterval,
5027
+ } },
5028
+ indicators && (React.createElement("ol", { className: "carousel-indicators" }, Array.from({ length: itemsNumber }, function (_, i) { return i; }).map(function (index) {
5029
+ return (React.createElement("li", { key: "indicator".concat(index), onClick: function () {
5030
+ !animating && handleIndicatorClick(index);
5031
+ }, className: active === index ? 'active' : '', "data-coreui-target": "" }));
5032
+ }))),
5033
+ React.createElement("div", { className: "carousel-inner" }, React.Children.map(children, function (child, index) {
5034
+ if (React.isValidElement(child)) {
5035
+ return React.cloneElement(child, {
5036
+ active: active === index ? true : false,
5037
+ direction: direction,
5038
+ key: index,
5039
+ });
5040
+ }
5041
+ return;
5042
+ })),
5043
+ controls && (React.createElement(React.Fragment, null,
5044
+ React.createElement("button", { className: "carousel-control-prev", onClick: function () { return handleControlClick('prev'); } },
5045
+ React.createElement("span", { className: "carousel-control-prev-icon", "aria-label": "prev" })),
5046
+ React.createElement("button", { className: "carousel-control-next", onClick: function () { return handleControlClick('next'); } },
5047
+ React.createElement("span", { className: "carousel-control-next-icon", "aria-label": "next" })))))));
5048
+ });
5049
+ CCarousel.propTypes = {
5050
+ activeIndex: PropTypes.number,
5051
+ children: PropTypes.node,
5052
+ className: PropTypes.string,
5053
+ controls: PropTypes.bool,
5054
+ dark: PropTypes.bool,
5055
+ indicators: PropTypes.bool,
5056
+ interval: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
5057
+ onSlid: PropTypes.func,
5058
+ onSlide: PropTypes.func,
5059
+ pause: PropTypes.oneOf([false, 'hover']),
5060
+ touch: PropTypes.bool,
5061
+ transition: PropTypes.oneOf(['slide', 'crossfade']),
5062
+ wrap: PropTypes.bool,
5063
+ };
5064
+ CCarousel.displayName = 'CCarousel';
5369
5065
 
5370
- var _React$useState = React__namespace.useState({
5371
- styles: {
5372
- popper: {
5373
- position: optionsWithDefaults.strategy,
5374
- left: '0',
5375
- top: '0'
5376
- },
5377
- arrow: {
5378
- position: 'absolute'
5379
- }
5380
- },
5381
- attributes: {}
5382
- }),
5383
- state = _React$useState[0],
5384
- setState = _React$useState[1];
5066
+ var CCarouselCaption = React.forwardRef(function (_a, ref) {
5067
+ var className = _a.className, rest = __rest(_a, ["className"]);
5068
+ return React.createElement("div", __assign({ className: classNames('carousel-caption', className) }, rest, { ref: ref }));
5069
+ });
5070
+ CCarouselCaption.propTypes = {
5071
+ className: PropTypes.string,
5072
+ };
5073
+ CCarouselCaption.displayName = 'CCarouselCaption';
5385
5074
 
5386
- var updateStateModifier = React__namespace.useMemo(function () {
5387
- return {
5388
- name: 'updateState',
5389
- enabled: true,
5390
- phase: 'write',
5391
- fn: function fn(_ref) {
5392
- var state = _ref.state;
5393
- var elements = Object.keys(state.elements);
5394
- ReactDOM__namespace.flushSync(function () {
5395
- setState({
5396
- styles: fromEntries(elements.map(function (element) {
5397
- return [element, state.styles[element] || {}];
5398
- })),
5399
- attributes: fromEntries(elements.map(function (element) {
5400
- return [element, state.attributes[element]];
5401
- }))
5402
- });
5075
+ var CCarouselItem = React.forwardRef(function (_a, ref) {
5076
+ var children = _a.children, className = _a.className, active = _a.active, direction = _a.direction, _b = _a.interval, interval = _b === void 0 ? false : _b, rest = __rest(_a, ["children", "className", "active", "direction", "interval"]);
5077
+ var _c = React.useContext(CCarouselContext), setAnimating = _c.setAnimating, setCustomInterval = _c.setCustomInterval;
5078
+ var carouselItemRef = React.useRef(null);
5079
+ var forkedRef = useForkedRef(ref, carouselItemRef);
5080
+ var prevActive = React.useRef();
5081
+ var _d = React.useState(), directionClassName = _d[0], setDirectionClassName = _d[1];
5082
+ var _e = React.useState(), orderClassName = _e[0], setOrderClassName = _e[1];
5083
+ var _f = React.useState(active && 'active'), activeClassName = _f[0], setActiveClassName = _f[1];
5084
+ var _g = React.useState(0), count = _g[0], setCount = _g[1];
5085
+ React.useEffect(function () {
5086
+ if (active) {
5087
+ setCustomInterval(interval);
5088
+ if (count !== 0)
5089
+ setOrderClassName("carousel-item-".concat(direction));
5090
+ }
5091
+ if (prevActive.current && !active) {
5092
+ setActiveClassName('active');
5093
+ }
5094
+ if (active || prevActive.current) {
5095
+ setTimeout(function () {
5096
+ var _a;
5097
+ if (count !== 0) {
5098
+ // @ts-expect-error reflow is necessary to proper transition
5099
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
5100
+ (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight;
5101
+ setDirectionClassName("carousel-item-".concat(direction === 'next' ? 'start' : 'end'));
5102
+ }
5103
+ }, 0);
5104
+ }
5105
+ prevActive.current = active;
5106
+ if (count === 0)
5107
+ setCount(count + 1);
5108
+ }, [active]);
5109
+ React.useEffect(function () {
5110
+ var _a, _b;
5111
+ (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('transitionstart', function () {
5112
+ active && setAnimating(true);
5403
5113
  });
5404
- },
5405
- requires: ['computeStyles']
5406
- };
5407
- }, []);
5408
- var popperOptions = React__namespace.useMemo(function () {
5409
- var newOptions = {
5410
- onFirstUpdate: optionsWithDefaults.onFirstUpdate,
5411
- placement: optionsWithDefaults.placement,
5412
- strategy: optionsWithDefaults.strategy,
5413
- modifiers: [].concat(optionsWithDefaults.modifiers, [updateStateModifier, {
5414
- name: 'applyStyles',
5415
- enabled: false
5416
- }])
5417
- };
5418
-
5419
- if (isEqual(prevOptions.current, newOptions)) {
5420
- return prevOptions.current || newOptions;
5421
- } else {
5422
- prevOptions.current = newOptions;
5423
- return newOptions;
5424
- }
5425
- }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
5426
- var popperInstanceRef = React__namespace.useRef();
5427
- useIsomorphicLayoutEffect(function () {
5428
- if (popperInstanceRef.current) {
5429
- popperInstanceRef.current.setOptions(popperOptions);
5430
- }
5431
- }, [popperOptions]);
5432
- useIsomorphicLayoutEffect(function () {
5433
- if (referenceElement == null || popperElement == null) {
5434
- return;
5435
- }
5436
-
5437
- var createPopper$1 = options.createPopper || createPopper;
5438
- var popperInstance = createPopper$1(referenceElement, popperElement, popperOptions);
5439
- popperInstanceRef.current = popperInstance;
5440
- return function () {
5441
- popperInstance.destroy();
5442
- popperInstanceRef.current = null;
5443
- };
5444
- }, [referenceElement, popperElement, options.createPopper]);
5445
- return {
5446
- state: popperInstanceRef.current ? popperInstanceRef.current.state : null,
5447
- styles: state.styles,
5448
- attributes: state.attributes,
5449
- update: popperInstanceRef.current ? popperInstanceRef.current.update : null,
5450
- forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null
5451
- };
5114
+ (_b = carouselItemRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('transitionend', function () {
5115
+ active && setAnimating(false);
5116
+ setDirectionClassName('');
5117
+ setOrderClassName('');
5118
+ if (active) {
5119
+ setActiveClassName('active');
5120
+ }
5121
+ if (!active) {
5122
+ setActiveClassName('');
5123
+ }
5124
+ });
5125
+ return function () {
5126
+ var _a, _b;
5127
+ (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('transitionstart', function () {
5128
+ active && setAnimating(true);
5129
+ });
5130
+ (_b = carouselItemRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('transitionend', function () {
5131
+ active && setAnimating(false);
5132
+ setDirectionClassName('');
5133
+ setOrderClassName('');
5134
+ if (active) {
5135
+ setActiveClassName('active');
5136
+ }
5137
+ if (!active) {
5138
+ setActiveClassName('');
5139
+ }
5140
+ });
5141
+ };
5142
+ });
5143
+ return (React.createElement("div", __assign({ className: classNames('carousel-item', activeClassName, directionClassName, orderClassName, className), ref: forkedRef }, rest), children));
5144
+ });
5145
+ CCarouselItem.propTypes = {
5146
+ active: PropTypes.bool,
5147
+ children: PropTypes.node,
5148
+ className: PropTypes.string,
5149
+ direction: PropTypes.string,
5150
+ interval: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
5452
5151
  };
5152
+ CCarouselItem.displayName = 'CCarouselItem';
5453
5153
 
5454
- var NOOP = function NOOP() {
5455
- return void 0;
5154
+ var CConditionalPortal = function (_a) {
5155
+ var children = _a.children, portal = _a.portal;
5156
+ return typeof window !== 'undefined' && portal ? (ReactDOM.createPortal(children, document.body)) : (React.createElement(React.Fragment, null, children));
5456
5157
  };
5457
-
5458
- var NOOP_PROMISE = function NOOP_PROMISE() {
5459
- return Promise.resolve(null);
5158
+ CConditionalPortal.propTypes = {
5159
+ children: PropTypes.node,
5160
+ portal: PropTypes.bool.isRequired,
5460
5161
  };
5162
+ CConditionalPortal.displayName = 'CConditionalPortal';
5461
5163
 
5462
- var EMPTY_MODIFIERS = [];
5463
- function Popper(_ref) {
5464
- var _ref$placement = _ref.placement,
5465
- placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
5466
- _ref$strategy = _ref.strategy,
5467
- strategy = _ref$strategy === void 0 ? 'absolute' : _ref$strategy,
5468
- _ref$modifiers = _ref.modifiers,
5469
- modifiers = _ref$modifiers === void 0 ? EMPTY_MODIFIERS : _ref$modifiers,
5470
- referenceElement = _ref.referenceElement,
5471
- onFirstUpdate = _ref.onFirstUpdate,
5472
- innerRef = _ref.innerRef,
5473
- children = _ref.children;
5474
- var referenceNode = React__namespace.useContext(ManagerReferenceNodeContext);
5475
-
5476
- var _React$useState = React__namespace.useState(null),
5477
- popperElement = _React$useState[0],
5478
- setPopperElement = _React$useState[1];
5479
-
5480
- var _React$useState2 = React__namespace.useState(null),
5481
- arrowElement = _React$useState2[0],
5482
- setArrowElement = _React$useState2[1];
5483
-
5484
- React__namespace.useEffect(function () {
5485
- setRef(innerRef, popperElement);
5486
- }, [innerRef, popperElement]);
5487
- var options = React__namespace.useMemo(function () {
5488
- return {
5489
- placement: placement,
5490
- strategy: strategy,
5491
- onFirstUpdate: onFirstUpdate,
5492
- modifiers: [].concat(modifiers, [{
5493
- name: 'arrow',
5494
- enabled: arrowElement != null,
5495
- options: {
5496
- element: arrowElement
5497
- }
5498
- }])
5499
- };
5500
- }, [placement, strategy, onFirstUpdate, modifiers, arrowElement]);
5501
-
5502
- var _usePopper = usePopper(referenceElement || referenceNode, popperElement, options),
5503
- state = _usePopper.state,
5504
- styles = _usePopper.styles,
5505
- forceUpdate = _usePopper.forceUpdate,
5506
- update = _usePopper.update;
5507
-
5508
- var childrenProps = React__namespace.useMemo(function () {
5509
- return {
5510
- ref: setPopperElement,
5511
- style: styles.popper,
5512
- placement: state ? state.placement : placement,
5513
- hasPopperEscaped: state && state.modifiersData.hide ? state.modifiersData.hide.hasPopperEscaped : null,
5514
- isReferenceHidden: state && state.modifiersData.hide ? state.modifiersData.hide.isReferenceHidden : null,
5515
- arrowProps: {
5516
- style: styles.arrow,
5517
- ref: setArrowElement
5518
- },
5519
- forceUpdate: forceUpdate || NOOP,
5520
- update: update || NOOP_PROMISE
5521
- };
5522
- }, [setPopperElement, setArrowElement, placement, state, styles, update, forceUpdate]);
5523
- return unwrapArray(children)(childrenProps);
5524
- }
5525
-
5526
- /**
5527
- * Copyright (c) 2014-present, Facebook, Inc.
5528
- *
5529
- * This source code is licensed under the MIT license found in the
5530
- * LICENSE file in the root directory of this source tree.
5531
- */
5532
-
5533
- /**
5534
- * Similar to invariant but only logs a warning if the condition is not met.
5535
- * This can be used to log issues in development environments in critical
5536
- * paths. Removing the logging code for production environments will keep the
5537
- * same logic and follow the same code paths.
5538
- */
5539
-
5540
- var __DEV__ = process.env.NODE_ENV !== 'production';
5541
-
5542
- var warning = function() {};
5543
-
5544
- if (__DEV__) {
5545
- var printWarning = function printWarning(format, args) {
5546
- var len = arguments.length;
5547
- args = new Array(len > 1 ? len - 1 : 0);
5548
- for (var key = 1; key < len; key++) {
5549
- args[key - 1] = arguments[key];
5164
+ var getPlacement = function (placement, direction, alignment, isRTL) {
5165
+ var _placement = placement;
5166
+ if (direction === 'dropup') {
5167
+ _placement = isRTL ? 'top-end' : 'top-start';
5550
5168
  }
5551
- var argIndex = 0;
5552
- var message = 'Warning: ' +
5553
- format.replace(/%s/g, function() {
5554
- return args[argIndex++];
5555
- });
5556
- if (typeof console !== 'undefined') {
5557
- console.error(message);
5169
+ if (direction === 'dropup-center') {
5170
+ _placement = 'top';
5558
5171
  }
5559
- try {
5560
- // --- Welcome to debugging React ---
5561
- // This error was thrown as a convenience so that you can use this stack
5562
- // to find the callsite that caused this warning to fire.
5563
- throw new Error(message);
5564
- } catch (x) {}
5565
- };
5566
-
5567
- warning = function(condition, format, args) {
5568
- var len = arguments.length;
5569
- args = new Array(len > 2 ? len - 2 : 0);
5570
- for (var key = 2; key < len; key++) {
5571
- args[key - 2] = arguments[key];
5172
+ if (direction === 'dropend') {
5173
+ _placement = isRTL ? 'left-start' : 'right-start';
5572
5174
  }
5573
- if (format === undefined) {
5574
- throw new Error(
5575
- '`warning(condition, format, ...args)` requires a warning ' +
5576
- 'message argument'
5577
- );
5175
+ if (direction === 'dropstart') {
5176
+ _placement = isRTL ? 'right-start' : 'left-start';
5578
5177
  }
5579
- if (!condition) {
5580
- printWarning.apply(null, [format].concat(args));
5178
+ if (alignment === 'end') {
5179
+ _placement = isRTL ? 'bottom-start' : 'bottom-end';
5581
5180
  }
5582
- };
5583
- }
5584
-
5585
- var warning_1 = warning;
5586
-
5587
- var warning$1 = /*@__PURE__*/getDefaultExportFromCjs(warning_1);
5588
-
5589
- function Reference(_ref) {
5590
- var children = _ref.children,
5591
- innerRef = _ref.innerRef;
5592
- var setReferenceNode = React__namespace.useContext(ManagerReferenceNodeSetterContext);
5593
- var refHandler = React__namespace.useCallback(function (node) {
5594
- setRef(innerRef, node);
5595
- safeInvoke(setReferenceNode, node);
5596
- }, [innerRef, setReferenceNode]); // ran on unmount
5597
- // eslint-disable-next-line react-hooks/exhaustive-deps
5598
-
5599
- React__namespace.useEffect(function () {
5600
- return function () {
5601
- return setRef(innerRef, null);
5602
- };
5603
- }, []);
5604
- React__namespace.useEffect(function () {
5605
- warning$1(Boolean(setReferenceNode), '`Reference` should not be used outside of a `Manager` component.');
5606
- }, [setReferenceNode]);
5607
- return unwrapArray(children)({
5608
- ref: refHandler
5609
- });
5610
- }
5611
-
5612
- var PopperManagerWrapper = function (_a) {
5613
- var children = _a.children, popper = _a.popper;
5614
- return popper ? React.createElement(Manager, null, children) : React.createElement(React.Fragment, null, children);
5181
+ return _placement;
5615
5182
  };
5616
5183
  var CDropdownContext = React.createContext({});
5617
5184
  var CDropdown = React.forwardRef(function (_a, ref) {
5618
5185
  var _b;
5619
- 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, onHide = _a.onHide, onShow = _a.onShow, _d = _a.placement, placement = _d === void 0 ? 'bottom-start' : _d, _e = _a.popper, popper = _e === void 0 ? true : _e, _f = _a.portal, portal = _f === void 0 ? false : _f, _g = _a.variant, variant = _g === void 0 ? 'btn-group' : _g, _h = _a.component, component = _h === void 0 ? 'div' : _h, _j = _a.visible, visible = _j === void 0 ? false : _j, rest = __rest(_a, ["children", "alignment", "autoClose", "className", "dark", "direction", "onHide", "onShow", "placement", "popper", "portal", "variant", "component", "visible"]);
5186
+ 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"]);
5620
5187
  var dropdownRef = React.useRef(null);
5188
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5621
5189
  var dropdownToggleRef = React.useRef(null);
5190
+ var dropdownMenuRef = React.useRef(null);
5622
5191
  var forkedRef = useForkedRef(ref, dropdownRef);
5623
- var _k = React.useState(visible), _visible = _k[0], setVisible = _k[1];
5192
+ var _l = React.useState(visible), _visible = _l[0], setVisible = _l[1];
5193
+ var _m = usePopper(), initPopper = _m.initPopper, destroyPopper = _m.destroyPopper;
5624
5194
  var Component = variant === 'nav-item' ? 'li' : component;
5625
5195
  // Disable popper if responsive aligment is set.
5626
5196
  if (typeof alignment === 'object') {
@@ -5628,44 +5198,83 @@ var CDropdown = React.forwardRef(function (_a, ref) {
5628
5198
  }
5629
5199
  var contextValues = {
5630
5200
  alignment: alignment,
5631
- autoClose: autoClose,
5632
5201
  dark: dark,
5633
- direction: direction,
5634
5202
  dropdownToggleRef: dropdownToggleRef,
5635
- placement: placement,
5203
+ dropdownMenuRef: dropdownMenuRef,
5636
5204
  popper: popper,
5637
5205
  portal: portal,
5638
5206
  variant: variant,
5639
5207
  visible: _visible,
5640
5208
  setVisible: setVisible,
5641
5209
  };
5210
+ var popperConfig = {
5211
+ modifiers: [
5212
+ {
5213
+ name: 'offset',
5214
+ options: {
5215
+ offset: offset,
5216
+ },
5217
+ },
5218
+ ],
5219
+ placement: getPlacement(placement, direction, alignment, isRTL(dropdownMenuRef.current)),
5220
+ };
5642
5221
  React.useEffect(function () {
5643
5222
  setVisible(visible);
5644
5223
  }, [visible]);
5645
5224
  React.useEffect(function () {
5646
- _visible && onShow && onShow();
5647
- !_visible && onHide && onHide();
5225
+ if (_visible && dropdownToggleRef.current && dropdownMenuRef.current) {
5226
+ popper && initPopper(dropdownToggleRef.current, dropdownMenuRef.current, popperConfig);
5227
+ window.addEventListener('mouseup', handleMouseUp);
5228
+ window.addEventListener('keyup', handleKeyup);
5229
+ onShow && onShow();
5230
+ }
5231
+ return function () {
5232
+ popper && destroyPopper();
5233
+ window.removeEventListener('mouseup', handleMouseUp);
5234
+ window.removeEventListener('keyup', handleKeyup);
5235
+ onHide && onHide();
5236
+ };
5648
5237
  }, [_visible]);
5649
- return (React.createElement(CDropdownContext.Provider, { value: contextValues },
5650
- React.createElement(PopperManagerWrapper, { popper: popper }, variant === 'input-group' ? (React.createElement(React.Fragment, null, children)) : (React.createElement(Component, __assign({ className: classNames(variant === 'nav-item' ? 'nav-item dropdown' : variant, (_b = {
5651
- 'dropdown-center': direction === 'center',
5652
- 'dropup dropup-center': direction === 'dropup-center'
5653
- },
5654
- _b["".concat(direction)] = direction && direction !== 'center' && direction !== 'dropup-center',
5655
- _b.show = _visible,
5656
- _b), className) }, rest, { ref: forkedRef }), children)))));
5238
+ var handleKeyup = function (event) {
5239
+ if (autoClose === false) {
5240
+ return;
5241
+ }
5242
+ if (event.key === 'Escape') {
5243
+ setVisible(false);
5244
+ }
5245
+ };
5246
+ var handleMouseUp = function (event) {
5247
+ if (!dropdownToggleRef.current || !dropdownMenuRef.current) {
5248
+ return;
5249
+ }
5250
+ if (dropdownToggleRef.current.contains(event.target)) {
5251
+ return;
5252
+ }
5253
+ if (autoClose === true ||
5254
+ (autoClose === 'inside' && dropdownMenuRef.current.contains(event.target)) ||
5255
+ (autoClose === 'outside' && !dropdownMenuRef.current.contains(event.target))) {
5256
+ setTimeout(function () { return setVisible(false); }, 1);
5257
+ return;
5258
+ }
5259
+ };
5260
+ return (React.createElement(CDropdownContext.Provider, { value: contextValues }, variant === 'input-group' ? (React.createElement(React.Fragment, null, children)) : (React.createElement(Component, __assign({ className: classNames(variant === 'nav-item' ? 'nav-item dropdown' : variant, (_b = {
5261
+ 'dropdown-center': direction === 'center',
5262
+ 'dropup dropup-center': direction === 'dropup-center'
5263
+ },
5264
+ _b["".concat(direction)] = direction && direction !== 'center' && direction !== 'dropup-center',
5265
+ _b.show = _visible,
5266
+ _b), className) }, rest, { ref: forkedRef }), children))));
5657
5267
  });
5658
5268
  var alignmentDirection = PropTypes.oneOf(['start', 'end']);
5659
5269
  CDropdown.propTypes = {
5660
- // @ts-expect-error TODO: we have to find a solution
5661
5270
  alignment: PropTypes.oneOfType([
5662
5271
  alignmentDirection,
5663
- PropTypes.shape({ xs: alignmentDirection }),
5664
- PropTypes.shape({ sm: alignmentDirection }),
5665
- PropTypes.shape({ md: alignmentDirection }),
5666
- PropTypes.shape({ lg: alignmentDirection }),
5667
- PropTypes.shape({ xl: alignmentDirection }),
5668
- PropTypes.shape({ xxl: alignmentDirection }),
5272
+ PropTypes.shape({ xs: alignmentDirection.isRequired }),
5273
+ PropTypes.shape({ sm: alignmentDirection.isRequired }),
5274
+ PropTypes.shape({ md: alignmentDirection.isRequired }),
5275
+ PropTypes.shape({ lg: alignmentDirection.isRequired }),
5276
+ PropTypes.shape({ xl: alignmentDirection.isRequired }),
5277
+ PropTypes.shape({ xxl: alignmentDirection.isRequired }),
5669
5278
  ]),
5670
5279
  autoClose: PropTypes.oneOfType([
5671
5280
  PropTypes.bool,
@@ -5676,6 +5285,7 @@ CDropdown.propTypes = {
5676
5285
  component: PropTypes.elementType,
5677
5286
  dark: PropTypes.bool,
5678
5287
  direction: PropTypes.oneOf(['center', 'dropup', 'dropup-center', 'dropend', 'dropstart']),
5288
+ offset: PropTypes.any,
5679
5289
  onHide: PropTypes.func,
5680
5290
  onShow: PropTypes.func,
5681
5291
  placement: placementPropType,
@@ -5740,74 +5350,23 @@ var alignmentClassNames = function (alignment) {
5740
5350
  }
5741
5351
  return classNames;
5742
5352
  };
5743
- var CDropdownMenu = function (_a) {
5353
+ var CDropdownMenu = React.forwardRef(function (_a, ref) {
5744
5354
  var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'ul' : _b, rest = __rest(_a, ["children", "className", "component"]);
5745
- var _c = React.useContext(CDropdownContext), alignment = _c.alignment, autoClose = _c.autoClose, dark = _c.dark, direction = _c.direction, dropdownToggleRef = _c.dropdownToggleRef, placement = _c.placement, popper = _c.popper, portal = _c.portal, visible = _c.visible, setVisible = _c.setVisible;
5746
- var dropdownMenuRef = React.useRef(null);
5747
- React.useEffect(function () {
5748
- visible && window.addEventListener('mouseup', handleMouseUp);
5749
- visible && window.addEventListener('keyup', handleKeyup);
5750
- return function () {
5751
- window.removeEventListener('mouseup', handleMouseUp);
5752
- window.removeEventListener('keyup', handleKeyup);
5753
- };
5754
- }, [visible]);
5755
- var handleKeyup = function (event) {
5756
- if (autoClose === false) {
5757
- return;
5758
- }
5759
- if (event.key === 'Escape') {
5760
- setVisible(false);
5761
- }
5762
- };
5763
- var handleMouseUp = function (event) {
5764
- var _a, _b;
5765
- if (dropdownToggleRef && dropdownToggleRef.current.contains(event.target)) {
5766
- return;
5767
- }
5768
- if (autoClose === true ||
5769
- (autoClose === 'inside' && ((_a = dropdownMenuRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) ||
5770
- (autoClose === 'outside' && !((_b = dropdownMenuRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)))) {
5771
- setTimeout(function () { return setVisible(false); }, 1);
5772
- return;
5773
- }
5774
- };
5775
- var _placement = placement;
5776
- if (direction === 'center') {
5777
- _placement = 'bottom';
5778
- }
5779
- if (direction === 'dropup') {
5780
- _placement = isRTL(dropdownMenuRef.current) ? 'top-end' : 'top-start';
5781
- }
5782
- if (direction === 'dropup-center') {
5783
- _placement = 'top';
5784
- }
5785
- if (direction === 'dropend') {
5786
- _placement = isRTL(dropdownMenuRef.current) ? 'left-start' : 'right-start';
5787
- }
5788
- if (direction === 'dropstart') {
5789
- _placement = isRTL(dropdownMenuRef.current) ? 'right-start' : 'left-start';
5790
- }
5791
- if (alignment === 'end') {
5792
- _placement = isRTL(dropdownMenuRef.current) ? 'bottom-start' : 'bottom-end';
5793
- }
5794
- var dropdownMenuComponent = function (style, ref) { return (React.createElement(CConditionalPortal, { portal: portal !== null && portal !== void 0 ? portal : false },
5355
+ var _c = React.useContext(CDropdownContext), alignment = _c.alignment, dark = _c.dark, dropdownMenuRef = _c.dropdownMenuRef, popper = _c.popper, portal = _c.portal, visible = _c.visible;
5356
+ var forkedRef = useForkedRef(ref, dropdownMenuRef);
5357
+ return (React.createElement(CConditionalPortal, { portal: portal !== null && portal !== void 0 ? portal : false },
5795
5358
  React.createElement(Component, __assign({ className: classNames('dropdown-menu', {
5796
5359
  'dropdown-menu-dark': dark,
5797
5360
  show: visible,
5798
- }, alignment && alignmentClassNames(alignment), className), ref: ref, style: style, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), rest), Component === 'ul'
5361
+ }, alignment && alignmentClassNames(alignment), className), ref: forkedRef, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), rest), Component === 'ul'
5799
5362
  ? React.Children.map(children, function (child, index) {
5800
5363
  if (React.isValidElement(child)) {
5801
5364
  return React.createElement("li", { key: index }, React.cloneElement(child));
5802
5365
  }
5803
5366
  return;
5804
5367
  })
5805
- : children))); };
5806
- return popper && visible ? (React.createElement(Popper, { innerRef: dropdownMenuRef, placement: _placement }, function (_a) {
5807
- var ref = _a.ref, style = _a.style;
5808
- return dropdownMenuComponent(style, ref);
5809
- })) : (dropdownMenuComponent());
5810
- };
5368
+ : children)));
5369
+ });
5811
5370
  CDropdownMenu.propTypes = {
5812
5371
  children: PropTypes.node,
5813
5372
  className: PropTypes.string,
@@ -5817,7 +5376,7 @@ CDropdownMenu.displayName = 'CDropdownMenu';
5817
5376
 
5818
5377
  var CDropdownToggle = function (_a) {
5819
5378
  var children = _a.children, _b = _a.caret, caret = _b === void 0 ? true : _b, custom = _a.custom, className = _a.className, split = _a.split, _c = _a.trigger, trigger = _c === void 0 ? 'click' : _c, rest = __rest(_a, ["children", "caret", "custom", "className", "split", "trigger"]);
5820
- var _d = React.useContext(CDropdownContext), dropdownToggleRef = _d.dropdownToggleRef, popper = _d.popper, variant = _d.variant, visible = _d.visible, setVisible = _d.setVisible;
5379
+ var _d = React.useContext(CDropdownContext), dropdownToggleRef = _d.dropdownToggleRef, variant = _d.variant, visible = _d.visible, setVisible = _d.setVisible;
5821
5380
  var triggers = __assign(__assign({}, ((trigger === 'click' || trigger.includes('click')) && {
5822
5381
  onClick: function (event) {
5823
5382
  event.preventDefault();
@@ -5833,22 +5392,18 @@ var CDropdownToggle = function (_a) {
5833
5392
  'nav-link': variant === 'nav-item',
5834
5393
  }, className), 'aria-expanded': visible }, (!rest.disabled && __assign({}, triggers)));
5835
5394
  // We use any because Toggler can be `a` as well as `button`.
5836
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5837
- var Toggler = function (ref) {
5395
+ var Toggler = function () {
5838
5396
  if (custom && React.isValidElement(children)) {
5839
- return (React.createElement(React.Fragment, null, React.cloneElement(children, __assign(__assign({ 'aria-expanded': visible }, (!rest.disabled && __assign({}, triggers))), { ref: useForkedRef(ref, dropdownToggleRef) }))));
5397
+ return (React.createElement(React.Fragment, null, React.cloneElement(children, __assign(__assign({ 'aria-expanded': visible }, (!rest.disabled && __assign({}, triggers))), { ref: dropdownToggleRef }))));
5840
5398
  }
5841
5399
  if (variant === 'nav-item') {
5842
- return (React.createElement("a", __assign({ href: "#" }, togglerProps, { ref: useForkedRef(ref, dropdownToggleRef) }), children));
5400
+ return (React.createElement("a", __assign({ href: "#" }, togglerProps, { ref: dropdownToggleRef }), children));
5843
5401
  }
5844
- return (React.createElement(CButton, __assign({ type: "button" }, togglerProps, { tabIndex: 0 }, rest, { ref: useForkedRef(ref, dropdownToggleRef) }),
5402
+ return (React.createElement(CButton, __assign({ type: "button" }, togglerProps, { tabIndex: 0 }, rest, { ref: dropdownToggleRef }),
5845
5403
  children,
5846
5404
  split && React.createElement("span", { className: "visually-hidden" }, "Toggle Dropdown")));
5847
5405
  };
5848
- return popper ? React.createElement(Reference, null, function (_a) {
5849
- var ref = _a.ref;
5850
- return Toggler(ref);
5851
- }) : Toggler(dropdownToggleRef);
5406
+ return React.createElement(Toggler, null);
5852
5407
  };
5853
5408
  CDropdownToggle.propTypes = {
5854
5409
  caret: PropTypes.bool,
@@ -7017,14 +6572,29 @@ CPlaceholder.propTypes = {
7017
6572
  };
7018
6573
  CPlaceholder.displayName = 'CPlaceholder';
7019
6574
 
6575
+ var CProgressStackedContext = React.createContext({});
6576
+ var CProgressStacked = React.forwardRef(function (_a, ref) {
6577
+ var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
6578
+ return (React.createElement("div", __assign({ className: classNames('progress-stacked', className), ref: ref }, rest),
6579
+ React.createElement(CProgressStackedContext.Provider, { value: {
6580
+ stacked: true,
6581
+ } }, children)));
6582
+ });
6583
+ CProgressStacked.propTypes = {
6584
+ children: PropTypes.node,
6585
+ className: PropTypes.string,
6586
+ };
6587
+ CProgressStacked.displayName = 'CProgressStacked';
6588
+
7020
6589
  var CProgressBar = React.forwardRef(function (_a, ref) {
7021
6590
  var _b;
7022
6591
  var children = _a.children, animated = _a.animated, className = _a.className, color = _a.color, _c = _a.value, value = _c === void 0 ? 0 : _c, variant = _a.variant, rest = __rest(_a, ["children", "animated", "className", "color", "value", "variant"]);
6592
+ var stacked = React.useContext(CProgressStackedContext).stacked;
7023
6593
  return (React.createElement("div", __assign({ className: classNames('progress-bar', (_b = {},
7024
6594
  _b["bg-".concat(color)] = color,
7025
6595
  _b["progress-bar-".concat(variant)] = variant,
7026
6596
  _b['progress-bar-animated'] = animated,
7027
- _b), className), role: "progressbar", style: { width: "".concat(value, "%") }, "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": 100 }, rest, { ref: ref }), children));
6597
+ _b), className) }, (!stacked && { style: { width: "".concat(value, "%") } }), rest, { ref: ref }), children));
7028
6598
  });
7029
6599
  CProgressBar.propTypes = {
7030
6600
  animated: PropTypes.bool,
@@ -7036,102 +6606,121 @@ CProgressBar.propTypes = {
7036
6606
  };
7037
6607
  CProgressBar.displayName = 'CProgressBar';
7038
6608
 
7039
- // TODO: update markup and add '.progress-stacked' in v5
7040
6609
  var CProgress = React.forwardRef(function (_a, ref) {
7041
- var children = _a.children, className = _a.className, height = _a.height, thin = _a.thin, _b = _a.value, value = _b === void 0 ? 0 : _b, white = _a.white, rest = __rest(_a, ["children", "className", "height", "thin", "value", "white"]);
7042
- return (React.createElement("div", { className: classNames('progress', {
6610
+ var children = _a.children, className = _a.className, height = _a.height, progressBarClassName = _a.progressBarClassName, thin = _a.thin, value = _a.value, white = _a.white, rest = __rest(_a, ["children", "className", "height", "progressBarClassName", "thin", "value", "white"]);
6611
+ var stacked = React.useContext(CProgressStackedContext).stacked;
6612
+ return (React.createElement("div", __assign({ className: classNames('progress', {
7043
6613
  'progress-thin': thin,
7044
6614
  'progress-white': white,
7045
- }, className), style: height ? { height: "".concat(height, "px") } : {}, ref: ref }, value ? (React.createElement(CProgressBar, __assign({ value: value }, rest), children)) : (children)));
6615
+ }, className) }, (value !== undefined && {
6616
+ role: 'progressbar',
6617
+ 'aria-valuenow': value,
6618
+ 'aria-valuemin': 0,
6619
+ 'aria-valuemax': 100,
6620
+ }), { style: __assign(__assign({}, (height ? { height: "".concat(height, "px") } : {})), (stacked ? { width: "".concat(value, "%") } : {})), ref: ref }), React.Children.toArray(children).some(
6621
+ // @ts-expect-error displayName is set in the CProgressBar component
6622
+ function (child) { return child.type && child.type.displayName === 'CProgressBar'; }) ? (React.Children.map(children, function (child) {
6623
+ // @ts-expect-error displayName is set in the CProgressBar component
6624
+ if (React.isValidElement(child) && child.type.displayName === 'CProgressBar') {
6625
+ return React.cloneElement(child, __assign(__assign({}, (value && { value: value })), rest));
6626
+ }
6627
+ return;
6628
+ })) : (React.createElement(CProgressBar, __assign({}, (progressBarClassName && { className: progressBarClassName }), { value: value }, rest), children))));
7046
6629
  });
7047
6630
  CProgress.propTypes = {
7048
6631
  children: PropTypes.node,
7049
6632
  className: PropTypes.string,
7050
6633
  height: PropTypes.number,
6634
+ progressBarClassName: PropTypes.string,
7051
6635
  thin: PropTypes.bool,
7052
6636
  value: PropTypes.number,
7053
6637
  white: PropTypes.bool,
7054
6638
  };
7055
6639
  CProgress.displayName = 'CProgress';
7056
6640
 
7057
- var getPlacement$1 = function (placement, element) {
7058
- switch (placement) {
7059
- case 'right': {
7060
- return isRTL(element) ? 'left' : 'right';
7061
- }
7062
- case 'left': {
7063
- return isRTL(element) ? 'right' : 'left';
7064
- }
7065
- default: {
7066
- return placement;
7067
- }
7068
- }
7069
- };
7070
6641
  var CPopover = function (_a) {
7071
- var children = _a.children, className = _a.className, content = _a.content, _b = _a.offset, offset = _b === void 0 ? [0, 8] : _b, onHide = _a.onHide, onShow = _a.onShow, _c = _a.placement, placement = _c === void 0 ? 'top' : _c, title = _a.title, _d = _a.trigger, trigger = _d === void 0 ? 'click' : _d, visible = _a.visible, rest = __rest(_a, ["children", "className", "content", "offset", "onHide", "onShow", "placement", "title", "trigger", "visible"]);
6642
+ 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"]);
7072
6643
  var popoverRef = React.useRef(null);
7073
6644
  var togglerRef = React.useRef(null);
7074
- var popper = React.useRef();
7075
- var _e = React.useState(visible), _visible = _e[0], setVisible = _e[1];
6645
+ var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
6646
+ var _j = React.useState(visible), _visible = _j[0], setVisible = _j[1];
6647
+ var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
6648
+ var popperConfig = {
6649
+ modifiers: [
6650
+ {
6651
+ name: 'arrow',
6652
+ options: {
6653
+ element: '.popover-arrow',
6654
+ },
6655
+ },
6656
+ {
6657
+ name: 'flip',
6658
+ options: {
6659
+ fallbackPlacements: fallbackPlacements,
6660
+ },
6661
+ },
6662
+ {
6663
+ name: 'offset',
6664
+ options: {
6665
+ offset: offset,
6666
+ },
6667
+ },
6668
+ ],
6669
+ placement: getRTLPlacement(placement, togglerRef.current),
6670
+ };
7076
6671
  React.useEffect(function () {
7077
6672
  setVisible(visible);
7078
6673
  }, [visible]);
7079
6674
  React.useEffect(function () {
7080
- if (_visible) {
7081
- initPopper();
6675
+ if (_visible && togglerRef.current && popoverRef.current) {
6676
+ initPopper(togglerRef.current, popoverRef.current, popperConfig);
7082
6677
  }
7083
6678
  return function () {
7084
6679
  destroyPopper();
7085
6680
  };
7086
6681
  }, [_visible]);
7087
- var initPopper = function () {
7088
- if (togglerRef.current && popoverRef.current) {
7089
- popper.current = createPopper(togglerRef.current, popoverRef.current, {
7090
- modifiers: [
7091
- {
7092
- name: 'offset',
7093
- options: {
7094
- offset: offset,
7095
- },
7096
- },
7097
- ],
7098
- placement: getPlacement$1(placement, togglerRef.current),
7099
- });
7100
- }
7101
- };
7102
- var destroyPopper = function () {
7103
- if (popper.current) {
7104
- popper.current.destroy();
6682
+ var toggleVisible = function (visible) {
6683
+ if (visible) {
6684
+ setTimeout(function () { return setVisible(true); }, _delay.show);
6685
+ return;
7105
6686
  }
7106
- popper.current = undefined;
6687
+ setTimeout(function () { return setVisible(false); }, _delay.hide);
7107
6688
  };
7108
6689
  return (React.createElement(React.Fragment, null,
7109
6690
  React.cloneElement(children, __assign(__assign(__assign({ ref: togglerRef }, ((trigger === 'click' || trigger.includes('click')) && {
7110
- onClick: function () { return setVisible(!_visible); },
6691
+ onClick: function () { return toggleVisible(!_visible); },
7111
6692
  })), ((trigger === 'focus' || trigger.includes('focus')) && {
7112
- onFocus: function () { return setVisible(true); },
7113
- onBlur: function () { return setVisible(false); },
6693
+ onFocus: function () { return toggleVisible(true); },
6694
+ onBlur: function () { return toggleVisible(false); },
7114
6695
  })), ((trigger === 'hover' || trigger.includes('hover')) && {
7115
- onMouseEnter: function () { return setVisible(true); },
7116
- onMouseLeave: function () { return setVisible(false); },
6696
+ onMouseEnter: function () { return toggleVisible(true); },
6697
+ onMouseLeave: function () { return toggleVisible(false); },
7117
6698
  }))),
7118
6699
  typeof window !== 'undefined' &&
7119
6700
  ReactDOM.createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
7120
6701
  enter: 0,
7121
6702
  exit: 200,
7122
- }, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', "bs-popover-".concat(getPlacement$1(placement, togglerRef.current)
7123
- .replace('left', 'start')
7124
- .replace('right', 'end')), 'fade', {
6703
+ }, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', 'bs-popover-auto', {
6704
+ fade: animation,
7125
6705
  show: state === 'entered',
7126
6706
  }, className), ref: popoverRef, role: "tooltip" }, rest),
7127
- React.createElement("div", { "data-popper-arrow": true, className: "popover-arrow" }),
6707
+ React.createElement("div", { className: "popover-arrow" }),
7128
6708
  React.createElement("div", { className: "popover-header" }, title),
7129
6709
  React.createElement("div", { className: "popover-body" }, content))); }), document.body)));
7130
6710
  };
7131
6711
  CPopover.propTypes = {
6712
+ animation: PropTypes.bool,
7132
6713
  children: PropTypes.node,
7133
6714
  className: PropTypes.string,
7134
6715
  content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
6716
+ delay: PropTypes.oneOfType([
6717
+ PropTypes.number,
6718
+ PropTypes.shape({
6719
+ show: PropTypes.number.isRequired,
6720
+ hide: PropTypes.number.isRequired,
6721
+ }),
6722
+ ]),
6723
+ fallbackPlacements: fallbackPlacementsPropType,
7135
6724
  offset: PropTypes.any,
7136
6725
  onHide: PropTypes.func,
7137
6726
  onShow: PropTypes.func,
@@ -7662,82 +7251,87 @@ CToaster.propTypes = {
7662
7251
  };
7663
7252
  CToaster.displayName = 'CToaster';
7664
7253
 
7665
- var getPlacement = function (placement, element) {
7666
- switch (placement) {
7667
- case 'right': {
7668
- return isRTL(element) ? 'left' : 'right';
7669
- }
7670
- case 'left': {
7671
- return isRTL(element) ? 'right' : 'left';
7672
- }
7673
- default: {
7674
- return placement;
7675
- }
7676
- }
7677
- };
7678
7254
  var CTooltip = function (_a) {
7679
- var children = _a.children, className = _a.className, content = _a.content, _b = _a.offset, offset = _b === void 0 ? [0, 6] : _b, onHide = _a.onHide, onShow = _a.onShow, _c = _a.placement, placement = _c === void 0 ? 'top' : _c, _d = _a.trigger, trigger = _d === void 0 ? 'hover' : _d, visible = _a.visible, rest = __rest(_a, ["children", "className", "content", "offset", "onHide", "onShow", "placement", "trigger", "visible"]);
7255
+ 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"]);
7680
7256
  var tooltipRef = React.useRef(null);
7681
7257
  var togglerRef = React.useRef(null);
7682
- var popper = React.useRef();
7683
- var _e = React.useState(visible), _visible = _e[0], setVisible = _e[1];
7258
+ var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
7259
+ var _j = React.useState(visible), _visible = _j[0], setVisible = _j[1];
7260
+ var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
7261
+ var popperConfig = {
7262
+ modifiers: [
7263
+ {
7264
+ name: 'arrow',
7265
+ options: {
7266
+ element: '.tooltip-arrow',
7267
+ },
7268
+ },
7269
+ {
7270
+ name: 'flip',
7271
+ options: {
7272
+ fallbackPlacements: fallbackPlacements,
7273
+ },
7274
+ },
7275
+ {
7276
+ name: 'offset',
7277
+ options: {
7278
+ offset: offset,
7279
+ },
7280
+ },
7281
+ ],
7282
+ placement: getRTLPlacement(placement, togglerRef.current),
7283
+ };
7684
7284
  React.useEffect(function () {
7685
7285
  setVisible(visible);
7686
7286
  }, [visible]);
7687
7287
  React.useEffect(function () {
7688
- if (_visible) {
7689
- initPopper();
7288
+ if (_visible && togglerRef.current && tooltipRef.current) {
7289
+ initPopper(togglerRef.current, tooltipRef.current, popperConfig);
7690
7290
  }
7691
7291
  return function () {
7692
7292
  destroyPopper();
7693
7293
  };
7694
7294
  }, [_visible]);
7695
- var initPopper = function () {
7696
- if (togglerRef.current && tooltipRef.current) {
7697
- popper.current = createPopper(togglerRef.current, tooltipRef.current, {
7698
- modifiers: [
7699
- {
7700
- name: 'offset',
7701
- options: {
7702
- offset: offset,
7703
- },
7704
- },
7705
- ],
7706
- placement: getPlacement(placement, togglerRef.current),
7707
- });
7708
- }
7709
- };
7710
- var destroyPopper = function () {
7711
- if (popper.current) {
7712
- popper.current.destroy();
7295
+ var toggleVisible = function (visible) {
7296
+ if (visible) {
7297
+ setTimeout(function () { return setVisible(true); }, _delay.show);
7298
+ return;
7713
7299
  }
7714
- popper.current = undefined;
7300
+ setTimeout(function () { return setVisible(false); }, _delay.hide);
7715
7301
  };
7716
7302
  return (React.createElement(React.Fragment, null,
7717
7303
  React.cloneElement(children, __assign(__assign(__assign({ ref: togglerRef }, ((trigger === 'click' || trigger.includes('click')) && {
7718
- onClick: function () { return setVisible(!_visible); },
7304
+ onClick: function () { return toggleVisible(!_visible); },
7719
7305
  })), ((trigger === 'focus' || trigger.includes('focus')) && {
7720
- onFocus: function () { return setVisible(true); },
7721
- onBlur: function () { return setVisible(false); },
7306
+ onFocus: function () { return toggleVisible(true); },
7307
+ onBlur: function () { return toggleVisible(false); },
7722
7308
  })), ((trigger === 'hover' || trigger.includes('hover')) && {
7723
- onMouseEnter: function () { return setVisible(true); },
7724
- onMouseLeave: function () { return setVisible(false); },
7309
+ onMouseEnter: function () { return toggleVisible(true); },
7310
+ onMouseLeave: function () { return toggleVisible(false); },
7725
7311
  }))),
7726
7312
  typeof window !== 'undefined' &&
7727
7313
  ReactDOM.createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, onEnter: onShow, onExit: onHide, timeout: {
7728
7314
  enter: 0,
7729
7315
  exit: 200,
7730
- }, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', "bs-tooltip-".concat(getPlacement(placement, togglerRef.current)
7731
- .replace('left', 'start')
7732
- .replace('right', 'end')), 'fade', {
7316
+ }, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', 'bs-tooltip-auto', {
7317
+ fade: animation,
7733
7318
  show: state === 'entered',
7734
7319
  }, className), ref: tooltipRef, role: "tooltip" }, rest),
7735
- React.createElement("div", { "data-popper-arrow": true, className: "tooltip-arrow" }),
7320
+ React.createElement("div", { className: "tooltip-arrow" }),
7736
7321
  React.createElement("div", { className: "tooltip-inner" }, content))); }), document.body)));
7737
7322
  };
7738
7323
  CTooltip.propTypes = {
7324
+ animation: PropTypes.bool,
7739
7325
  children: PropTypes.node,
7740
7326
  content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
7327
+ delay: PropTypes.oneOfType([
7328
+ PropTypes.number,
7329
+ PropTypes.shape({
7330
+ show: PropTypes.number.isRequired,
7331
+ hide: PropTypes.number.isRequired,
7332
+ }),
7333
+ ]),
7334
+ fallbackPlacements: fallbackPlacementsPropType,
7741
7335
  offset: PropTypes.any,
7742
7336
  onHide: PropTypes.func,
7743
7337
  onShow: PropTypes.func,
@@ -7970,6 +7564,7 @@ exports.CPlaceholder = CPlaceholder;
7970
7564
  exports.CPopover = CPopover;
7971
7565
  exports.CProgress = CProgress;
7972
7566
  exports.CProgressBar = CProgressBar;
7567
+ exports.CProgressStacked = CProgressStacked;
7973
7568
  exports.CRow = CRow;
7974
7569
  exports.CSidebar = CSidebar;
7975
7570
  exports.CSidebarBrand = CSidebarBrand;
@@ -8002,4 +7597,5 @@ exports.CWidgetStatsE = CWidgetStatsE;
8002
7597
  exports.CWidgetStatsF = CWidgetStatsF;
8003
7598
  exports.useColorModes = useColorModes;
8004
7599
  exports.useForkedRef = useForkedRef;
7600
+ exports.usePopper = usePopper;
8005
7601
  //# sourceMappingURL=index.js.map