@coreui/react 4.9.0-beta.1 → 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 +3 -2
  19. package/dist/hooks/usePopper.d.ts +8 -0
  20. package/dist/index.es.js +1526 -1915
  21. package/dist/index.es.js.map +1 -1
  22. package/dist/index.js +1311 -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 +21 -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,21 +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; },
2522
+ colorMode: colorMode,
2531
2523
  isColorModeSet: function () { return Boolean(getStoredTheme(localStorageItemName)); },
2532
- setColorMode: function (mode) { return setColorMode(mode); },
2524
+ setColorMode: setColorMode,
2533
2525
  };
2534
2526
  };
2535
2527
 
@@ -2576,1115 +2568,270 @@ function isFunction(value) {
2576
2568
  return !!(value && {}.toString.call(value) == '[object Function]');
2577
2569
  }
2578
2570
 
2579
- var CCollapse = React.forwardRef(function (_a, ref) {
2580
- 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"]);
2581
- var collapseRef = React.useRef(null);
2582
- var forkedRef = useForkedRef(ref, collapseRef);
2583
- var _b = React.useState(), height = _b[0], setHeight = _b[1];
2584
- var _c = React.useState(), width = _c[0], setWidth = _c[1];
2585
- var onEntering = function () {
2586
- onShow && onShow();
2587
- if (horizontal) {
2588
- collapseRef.current && setWidth(collapseRef.current.scrollWidth);
2589
- return;
2590
- }
2591
- collapseRef.current && setHeight(collapseRef.current.scrollHeight);
2592
- };
2593
- var onEntered = function () {
2594
- if (horizontal) {
2595
- setWidth(0);
2596
- return;
2597
- }
2598
- setHeight(0);
2599
- };
2600
- var onExit = function () {
2601
- if (horizontal) {
2602
- collapseRef.current && setWidth(collapseRef.current.scrollWidth);
2603
- return;
2604
- }
2605
- collapseRef.current && setHeight(collapseRef.current.scrollHeight);
2606
- };
2607
- var onExiting = function () {
2608
- onHide && onHide();
2609
- if (horizontal) {
2610
- setWidth(0);
2611
- return;
2612
- }
2613
- setHeight(0);
2614
- };
2615
- var onExited = function () {
2616
- if (horizontal) {
2617
- setWidth(0);
2618
- return;
2619
- }
2620
- setHeight(0);
2621
- };
2622
- return (React.createElement(CSSTransition$1, { in: visible, nodeRef: collapseRef, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited, timeout: 350 }, function (state) {
2623
- var currentHeight = height === 0 ? null : { height: height };
2624
- var currentWidth = width === 0 ? null : { width: width };
2625
- return (React.createElement("div", __assign({ className: classNames(className, {
2626
- 'collapse-horizontal': horizontal,
2627
- collapsing: state === 'entering' || state === 'exiting',
2628
- 'collapse show': state === 'entered',
2629
- collapse: state === 'exited',
2630
- }), style: __assign(__assign({}, currentHeight), currentWidth) }, rest, { ref: forkedRef }), children));
2631
- }));
2632
- });
2633
- CCollapse.propTypes = {
2634
- children: PropTypes.node,
2635
- className: PropTypes.string,
2636
- horizontal: PropTypes.bool,
2637
- onHide: PropTypes.func,
2638
- onShow: PropTypes.func,
2639
- visible: PropTypes.bool,
2640
- };
2641
- 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
2642
2589
 
2643
- var CAccordionBody = React.forwardRef(function (_a, ref) {
2644
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2645
- var visible = React.useContext(CAccordionItemContext).visible;
2646
- return (React.createElement(CCollapse, { className: "accordion-collapse", visible: visible },
2647
- React.createElement("div", __assign({ className: classNames('accordion-body', className) }, rest, { ref: ref }), children)));
2648
- });
2649
- CAccordionBody.propTypes = {
2650
- children: PropTypes.node,
2651
- className: PropTypes.string,
2652
- };
2653
- CAccordionBody.displayName = 'CAccordionBody';
2590
+ var beforeRead = 'beforeRead';
2591
+ var read = 'read';
2592
+ var afterRead = 'afterRead'; // pure-logic modifiers
2654
2593
 
2655
- var CAccordionButton = React.forwardRef(function (_a, ref) {
2656
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2657
- var _b = React.useContext(CAccordionItemContext), visible = _b.visible, setVisible = _b.setVisible;
2658
- 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));
2659
- });
2660
- CAccordionButton.propTypes = {
2661
- children: PropTypes.node,
2662
- className: PropTypes.string,
2663
- };
2664
- 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)
2665
2597
 
2666
- var CAccordionHeader = React.forwardRef(function (_a, ref) {
2667
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2668
- return (React.createElement("div", __assign({ className: classNames('accordion-header', className) }, rest, { ref: ref }),
2669
- React.createElement(CAccordionButton, null, children)));
2670
- });
2671
- CAccordionHeader.propTypes = {
2672
- children: PropTypes.node,
2673
- className: PropTypes.string,
2674
- };
2675
- 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];
2676
2602
 
2677
- var CCloseButton = React.forwardRef(function (_a, ref) {
2678
- var className = _a.className, disabled = _a.disabled, white = _a.white, rest = __rest(_a, ["className", "disabled", "white"]);
2679
- return (React.createElement("button", __assign({ type: "button", className: classNames('btn', 'btn-close', {
2680
- 'btn-close-white': white,
2681
- }, disabled, className), "aria-label": "Close", disabled: disabled }, rest, { ref: ref })));
2682
- });
2683
- CCloseButton.propTypes = {
2684
- className: PropTypes.string,
2685
- disabled: PropTypes.bool,
2686
- white: PropTypes.bool,
2687
- };
2688
- CCloseButton.displayName = 'CCloseButton';
2603
+ function getNodeName(element) {
2604
+ return element ? (element.nodeName || '').toLowerCase() : null;
2605
+ }
2689
2606
 
2690
- var colorPropType = PropTypes.oneOfType([
2691
- PropTypes.oneOf([
2692
- 'primary',
2693
- 'secondary',
2694
- 'success',
2695
- 'danger',
2696
- 'warning',
2697
- 'info',
2698
- 'dark',
2699
- 'light',
2700
- ]),
2701
- PropTypes.string,
2702
- ]);
2703
- var placementPropType = PropTypes.oneOf([
2704
- 'auto',
2705
- 'auto-start',
2706
- 'auto-end',
2707
- 'top-end',
2708
- 'top',
2709
- 'top-start',
2710
- 'bottom-end',
2711
- 'bottom',
2712
- 'bottom-start',
2713
- 'right-start',
2714
- 'right',
2715
- 'right-end',
2716
- 'left-start',
2717
- 'left',
2718
- 'left-end',
2719
- ]);
2720
- var shapePropType = PropTypes.oneOfType([
2721
- PropTypes.oneOf([
2722
- 'rounded',
2723
- 'rounded-top',
2724
- 'rounded-end',
2725
- 'rounded-bottom',
2726
- 'rounded-start',
2727
- 'rounded-circle',
2728
- 'rounded-pill',
2729
- 'rounded-0',
2730
- 'rounded-1',
2731
- 'rounded-2',
2732
- 'rounded-3',
2733
- ]),
2734
- PropTypes.string,
2735
- ]);
2736
- var textColorsPropType = PropTypes.oneOfType([
2737
- colorPropType,
2738
- PropTypes.oneOf(['white', 'muted']),
2739
- PropTypes.string,
2740
- ]);
2741
- var triggerPropType = PropTypes.oneOfType([
2742
- PropTypes.arrayOf(PropTypes.oneOf(['hover', 'focus', 'click']).isRequired),
2743
- PropTypes.oneOf(['hover', 'focus', 'click']),
2744
- ]);
2607
+ function getWindow(node) {
2608
+ if (node == null) {
2609
+ return window;
2610
+ }
2745
2611
 
2746
- var CAlert = React.forwardRef(function (_a, ref) {
2747
- 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"]);
2748
- var alertRef = React.useRef(null);
2749
- var forkedRef = useForkedRef(ref, alertRef);
2750
- var _d = React.useState(visible), _visible = _d[0], setVisible = _d[1];
2751
- React.useEffect(function () {
2752
- setVisible(visible);
2753
- }, [visible]);
2754
- 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), {
2755
- 'alert-dismissible fade': dismissible,
2756
- show: state === 'entered',
2757
- }, className), role: "alert" }, rest, { ref: forkedRef }),
2758
- children,
2759
- dismissible && React.createElement(CCloseButton, { onClick: function () { return setVisible(false); } }))); }));
2760
- });
2761
- CAlert.propTypes = {
2762
- children: PropTypes.node,
2763
- className: PropTypes.string,
2764
- color: colorPropType.isRequired,
2765
- dismissible: PropTypes.bool,
2766
- onClose: PropTypes.func,
2767
- variant: PropTypes.string,
2768
- visible: PropTypes.bool,
2769
- };
2770
- CAlert.displayName = 'CAlert';
2612
+ if (node.toString() !== '[object Window]') {
2613
+ var ownerDocument = node.ownerDocument;
2614
+ return ownerDocument ? ownerDocument.defaultView || window : window;
2615
+ }
2771
2616
 
2772
- var CAlertHeading = React.forwardRef(function (_a, ref) {
2773
- var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'h4' : _b, rest = __rest(_a, ["children", "className", "component"]);
2774
- return (React.createElement(Component, __assign({ className: classNames('alert-heading', className) }, rest, { ref: ref }), children));
2775
- });
2776
- CAlertHeading.propTypes = {
2777
- children: PropTypes.node,
2778
- className: PropTypes.string,
2779
- component: PropTypes.elementType,
2780
- };
2781
- CAlertHeading.displayName = 'CAlertHeading';
2617
+ return node;
2618
+ }
2782
2619
 
2783
- var CLink = React.forwardRef(function (_a, ref) {
2784
- 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"]);
2785
- return (React.createElement(Component
2786
- // TODO: remove duplicated classes ex. `active active` in `<CListGroupItem>`
2787
- , __assign({
2788
- // TODO: remove duplicated classes ex. `active active` in `<CListGroupItem>`
2789
- className: classNames(className, { active: active, disabled: disabled }) }, (active && { 'aria-current': 'page' }), (Component === 'a' && disabled && { 'aria-disabled': true, tabIndex: -1 }), ((Component === 'a' || Component === 'button') && {
2790
- onClick: function (event) {
2791
- event.preventDefault;
2792
- !disabled && rest.onClick && rest.onClick(event);
2793
- },
2794
- }), { disabled: disabled }, rest, { ref: ref }), children));
2795
- });
2796
- CLink.propTypes = {
2797
- active: PropTypes.bool,
2798
- children: PropTypes.node,
2799
- className: PropTypes.string,
2800
- component: PropTypes.elementType,
2801
- disabled: PropTypes.bool,
2802
- };
2803
- CLink.displayName = 'CLink';
2620
+ function isElement(node) {
2621
+ var OwnElement = getWindow(node).Element;
2622
+ return node instanceof OwnElement || node instanceof Element;
2623
+ }
2804
2624
 
2805
- var CAlertLink = React.forwardRef(function (_a, ref) {
2806
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2807
- return (React.createElement(CLink, __assign({ className: classNames('alert-link', className) }, rest, { ref: ref }), children));
2808
- });
2809
- CAlertLink.propTypes = {
2810
- children: PropTypes.node,
2811
- className: PropTypes.string,
2812
- };
2813
- CAlertLink.displayName = 'CAlertLink';
2625
+ function isHTMLElement(node) {
2626
+ var OwnElement = getWindow(node).HTMLElement;
2627
+ return node instanceof OwnElement || node instanceof HTMLElement;
2628
+ }
2814
2629
 
2815
- var CAvatar = React.forwardRef(function (_a, ref) {
2816
- var _b;
2817
- 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"]);
2818
- var statusClassName = status && classNames('avatar-status', "bg-".concat(status));
2819
- return (React.createElement("div", __assign({ className: classNames('avatar', (_b = {},
2820
- _b["bg-".concat(color)] = color,
2821
- _b["avatar-".concat(size)] = size,
2822
- _b["text-".concat(textColor)] = textColor,
2823
- _b), shape, className) }, rest, { ref: ref }),
2824
- src ? React.createElement("img", { src: src, className: "avatar-img" }) : children,
2825
- status && React.createElement("span", { className: statusClassName })));
2826
- });
2827
- CAvatar.propTypes = {
2828
- children: PropTypes.node,
2829
- className: PropTypes.string,
2830
- color: colorPropType,
2831
- shape: shapePropType,
2832
- size: PropTypes.string,
2833
- src: PropTypes.string,
2834
- status: PropTypes.string,
2835
- textColor: textColorsPropType,
2836
- };
2837
- CAvatar.displayName = 'CAvatar';
2630
+ function isShadowRoot(node) {
2631
+ // IE 11 has no ShadowRoot
2632
+ if (typeof ShadowRoot === 'undefined') {
2633
+ return false;
2634
+ }
2838
2635
 
2839
- var CBackdrop = React.forwardRef(function (_a, ref) {
2840
- var _b = _a.className, className = _b === void 0 ? 'modal-backdrop' : _b, visible = _a.visible, rest = __rest(_a, ["className", "visible"]);
2841
- var backdropRef = React.useRef(null);
2842
- var forkedRef = useForkedRef(ref, backdropRef);
2843
- 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', {
2844
- show: state === 'entered',
2845
- }) }, rest, { ref: forkedRef }))); }));
2846
- });
2847
- CBackdrop.propTypes = {
2848
- className: PropTypes.string,
2849
- visible: PropTypes.bool,
2850
- };
2851
- CBackdrop.displayName = 'CBackdrop';
2636
+ var OwnElement = getWindow(node).ShadowRoot;
2637
+ return node instanceof OwnElement || node instanceof ShadowRoot;
2638
+ }
2852
2639
 
2853
- var CBadge = React.forwardRef(function (_a, ref) {
2854
- var _b;
2855
- 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"]);
2856
- return (React.createElement(Component, __assign({ className: classNames('badge', (_b = {},
2857
- _b["bg-".concat(color)] = color,
2858
- _b['position-absolute translate-middle'] = position,
2859
- _b['top-0'] = position === null || position === void 0 ? void 0 : position.includes('top'),
2860
- _b['top-100'] = position === null || position === void 0 ? void 0 : position.includes('bottom'),
2861
- _b['start-100'] = position === null || position === void 0 ? void 0 : position.includes('end'),
2862
- _b['start-0'] = position === null || position === void 0 ? void 0 : position.includes('start'),
2863
- _b["badge-".concat(size)] = size,
2864
- _b["text-".concat(textColor)] = textColor,
2865
- _b), shape, className) }, rest, { ref: ref }), children));
2866
- });
2867
- CBadge.propTypes = {
2868
- children: PropTypes.node,
2869
- className: PropTypes.string,
2870
- color: colorPropType,
2871
- component: PropTypes.string,
2872
- position: PropTypes.oneOf(['top-start', 'top-end', 'bottom-end', 'bottom-start']),
2873
- shape: shapePropType,
2874
- size: PropTypes.oneOf(['sm']),
2875
- textColor: textColorsPropType,
2876
- };
2877
- CBadge.displayName = 'CBadge';
2640
+ // and applies them to the HTMLElements such as popper and arrow
2878
2641
 
2879
- var CBreadcrumb = React.forwardRef(function (_a, ref) {
2880
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2881
- return (React.createElement("nav", { "aria-label": "breadcrumb" },
2882
- React.createElement("ol", __assign({ className: classNames('breadcrumb', className) }, rest, { ref: ref }), children)));
2883
- });
2884
- CBreadcrumb.propTypes = {
2885
- children: PropTypes.node,
2886
- className: PropTypes.string,
2887
- };
2888
- 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
2889
2648
 
2890
- var CBreadcrumbItem = React.forwardRef(function (_a, ref) {
2891
- var children = _a.children, active = _a.active, className = _a.className, href = _a.href, rest = __rest(_a, ["children", "active", "className", "href"]);
2892
- return (React.createElement("li", __assign({ className: classNames('breadcrumb-item', {
2893
- active: active,
2894
- }, className) }, (active && { 'aria-current': 'page' }), rest, { ref: ref }), href ? React.createElement(CLink, { href: href }, children) : children));
2895
- });
2896
- CBreadcrumbItem.propTypes = {
2897
- active: PropTypes.bool,
2898
- children: PropTypes.node,
2899
- className: PropTypes.string,
2900
- href: PropTypes.string,
2901
- };
2902
- 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]
2903
2654
 
2904
- var CButton = React.forwardRef(function (_a, ref) {
2905
- var _b;
2906
- 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"]);
2907
- 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));
2908
- });
2909
- CButton.propTypes = {
2910
- children: PropTypes.node,
2911
- className: PropTypes.string,
2912
- color: colorPropType,
2913
- component: PropTypes.elementType,
2914
- shape: PropTypes.string,
2915
- size: PropTypes.oneOf(['sm', 'lg']),
2916
- type: PropTypes.oneOf(['button', 'submit', 'reset']),
2917
- variant: PropTypes.oneOf(['outline', 'ghost']),
2918
- };
2919
- CButton.displayName = 'CButton';
2920
2655
 
2921
- var CButtonToolbar = React.forwardRef(function (_a, ref) {
2922
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2923
- return (React.createElement("div", __assign({ className: classNames('btn-toolbar', className) }, rest, { ref: ref }), children));
2924
- });
2925
- CButtonToolbar.propTypes = {
2926
- children: PropTypes.node,
2927
- className: PropTypes.string,
2928
- };
2929
- CButtonToolbar.displayName = 'CButtonToolbar';
2656
+ Object.assign(element.style, style);
2657
+ Object.keys(attributes).forEach(function (name) {
2658
+ var value = attributes[name];
2930
2659
 
2931
- var CButtonGroup = React.forwardRef(function (_a, ref) {
2932
- var _b;
2933
- var children = _a.children, className = _a.className, size = _a.size, vertical = _a.vertical, rest = __rest(_a, ["children", "className", "size", "vertical"]);
2934
- 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));
2935
- });
2936
- CButtonGroup.propTypes = {
2937
- children: PropTypes.node,
2938
- className: PropTypes.string,
2939
- size: PropTypes.oneOf(['sm', 'lg']),
2940
- vertical: PropTypes.bool,
2941
- };
2942
- CButtonGroup.displayName = 'CButtonGroup';
2660
+ if (value === false) {
2661
+ element.removeAttribute(name);
2662
+ } else {
2663
+ element.setAttribute(name, value === true ? '' : value);
2664
+ }
2665
+ });
2666
+ });
2667
+ }
2943
2668
 
2944
- var CCallout = React.forwardRef(function (_a, ref) {
2945
- var _b;
2946
- var children = _a.children, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "className", "color"]);
2947
- return (React.createElement("div", __assign({ className: classNames('callout', (_b = {},
2948
- _b["callout-".concat(color)] = color,
2949
- _b), className) }, rest, { ref: ref }), children));
2950
- });
2951
- CCallout.propTypes = {
2952
- children: PropTypes.node,
2953
- className: PropTypes.string,
2954
- color: colorPropType,
2955
- };
2956
- 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;
2957
2685
 
2958
- var CCard = React.forwardRef(function (_a, ref) {
2959
- var _b;
2960
- var children = _a.children, className = _a.className, color = _a.color, textColor = _a.textColor, rest = __rest(_a, ["children", "className", "color", "textColor"]);
2961
- return (React.createElement("div", __assign({ className: classNames('card', (_b = {},
2962
- _b["bg-".concat(color)] = color,
2963
- _b["text-".concat(textColor)] = textColor,
2964
- _b), className) }, rest, { ref: ref }), children));
2965
- });
2966
- CCard.propTypes = {
2967
- children: PropTypes.node,
2968
- className: PropTypes.string,
2969
- color: colorPropType,
2970
- textColor: PropTypes.string,
2971
- };
2972
- CCard.displayName = 'CCard';
2686
+ if (state.elements.arrow) {
2687
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
2688
+ }
2973
2689
 
2974
- var CCardBody = React.forwardRef(function (_a, ref) {
2975
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2976
- return (React.createElement("div", __assign({ className: classNames('card-body', className) }, rest, { ref: ref }), children));
2977
- });
2978
- CCardBody.propTypes = {
2979
- children: PropTypes.node,
2980
- className: PropTypes.string,
2981
- };
2982
- 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
2983
2695
 
2984
- var CCardFooter = React.forwardRef(function (_a, ref) {
2985
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2986
- return (React.createElement("div", __assign({ className: classNames('card-footer', className) }, rest, { ref: ref }), children));
2987
- });
2988
- CCardFooter.propTypes = {
2989
- children: PropTypes.node,
2990
- className: PropTypes.string,
2991
- };
2992
- CCardFooter.displayName = 'CCardFooter';
2696
+ var style = styleProperties.reduce(function (style, property) {
2697
+ style[property] = '';
2698
+ return style;
2699
+ }, {}); // arrow is optional + virtual elements
2993
2700
 
2994
- var CCardGroup = React.forwardRef(function (_a, ref) {
2995
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
2996
- return (React.createElement("div", __assign({ className: classNames('card-group', className) }, rest, { ref: ref }), children));
2997
- });
2998
- CCardGroup.propTypes = {
2999
- children: PropTypes.node,
3000
- className: PropTypes.string,
3001
- };
3002
- CCardGroup.displayName = 'CCardGroup';
2701
+ if (!isHTMLElement(element) || !getNodeName(element)) {
2702
+ return;
2703
+ }
3003
2704
 
3004
- var CCardHeader = React.forwardRef(function (_a, ref) {
3005
- var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'div' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
3006
- return (React.createElement(Component, __assign({ className: classNames('card-header', className) }, rest, { ref: ref }), children));
3007
- });
3008
- CCardHeader.propTypes = {
3009
- children: PropTypes.node,
3010
- className: PropTypes.string,
3011
- component: PropTypes.elementType,
3012
- };
3013
- 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
3014
2712
 
3015
- var CCardImage = React.forwardRef(function (_a, ref) {
3016
- 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"]);
3017
- return (React.createElement(Component, __assign({ className: classNames(orientation ? "card-img-".concat(orientation) : 'card-img', className) }, rest, { ref: ref }), children));
3018
- });
3019
- CCardImage.propTypes = {
3020
- children: PropTypes.node,
3021
- className: PropTypes.string,
3022
- component: PropTypes.elementType,
3023
- orientation: PropTypes.oneOf(['top', 'bottom']),
3024
- };
3025
- CCardImage.displayName = 'CCardImage';
3026
2713
 
3027
- var CCardImageOverlay = React.forwardRef(function (_a, ref) {
3028
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
3029
- return (React.createElement("div", __assign({ className: classNames('card-img-overlay', className) }, rest, { ref: ref }), children));
3030
- });
3031
- CCardImageOverlay.propTypes = {
3032
- children: PropTypes.node,
3033
- 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']
3034
2721
  };
3035
- CCardImageOverlay.displayName = 'CCardImageOverlay';
3036
2722
 
3037
- var CCardLink = React.forwardRef(function (_a, ref) {
3038
- var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
3039
- return (React.createElement(CLink, __assign({ className: classNames('card-link', className) }, rest, { ref: ref }), children));
3040
- });
3041
- CCardLink.propTypes = {
3042
- children: PropTypes.node,
3043
- className: PropTypes.string,
3044
- };
3045
- CCardLink.displayName = 'CCardLink';
2723
+ function getBasePlacement(placement) {
2724
+ return placement.split('-')[0];
2725
+ }
3046
2726
 
3047
- var CCardSubtitle = React.forwardRef(function (_a, ref) {
3048
- var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'h6' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
3049
- return (React.createElement(Component, __assign({ className: classNames('card-subtitle', className) }, rest, { ref: ref }), children));
3050
- });
3051
- CCardSubtitle.propTypes = {
3052
- children: PropTypes.node,
3053
- className: PropTypes.string,
3054
- component: PropTypes.elementType,
3055
- };
3056
- CCardSubtitle.displayName = 'CCardSubtitle';
2727
+ var max = Math.max;
2728
+ var min = Math.min;
2729
+ var round = Math.round;
3057
2730
 
3058
- var CCardText = React.forwardRef(function (_a, ref) {
3059
- var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'p' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
3060
- return (React.createElement(Component, __assign({ className: classNames('card-text', className) }, rest, { ref: ref }), children));
3061
- });
3062
- CCardText.propTypes = {
3063
- children: PropTypes.node,
3064
- className: PropTypes.string,
3065
- component: PropTypes.elementType,
3066
- };
3067
- CCardText.displayName = 'CCardText';
2731
+ function getUAString() {
2732
+ var uaData = navigator.userAgentData;
3068
2733
 
3069
- var CCardTitle = React.forwardRef(function (_a, ref) {
3070
- var children = _a.children, _b = _a.component, Component = _b === void 0 ? 'h5' : _b, className = _a.className, rest = __rest(_a, ["children", "component", "className"]);
3071
- return (React.createElement(Component, __assign({ className: classNames('card-title', className) }, rest, { ref: ref }), children));
3072
- });
3073
- CCardTitle.propTypes = {
3074
- children: PropTypes.node,
3075
- className: PropTypes.string,
3076
- component: PropTypes.elementType,
3077
- };
3078
- 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
+ }
3079
2739
 
3080
- var isInViewport = function (element) {
3081
- var rect = element.getBoundingClientRect();
3082
- return (Math.floor(rect.top) >= 0 &&
3083
- Math.floor(rect.left) >= 0 &&
3084
- Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) &&
3085
- Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth));
3086
- };
2740
+ return navigator.userAgent;
2741
+ }
3087
2742
 
3088
- var isRTL = function (element) {
3089
- if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
3090
- return true;
3091
- }
3092
- if (element) {
3093
- return element.closest('[dir="rtl"]') !== null;
3094
- }
3095
- return false;
3096
- };
2743
+ function isLayoutViewport() {
2744
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
2745
+ }
3097
2746
 
3098
- var CCarouselContext = React.createContext({});
3099
- var CCarousel = React.forwardRef(function (_a, ref) {
3100
- 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"]);
3101
- var carouselRef = React.useRef(null);
3102
- var forkedRef = useForkedRef(ref, carouselRef);
3103
- var data = React.useRef({}).current;
3104
- var _g = React.useState(activeIndex), active = _g[0], setActive = _g[1];
3105
- var _h = React.useState(false), animating = _h[0], setAnimating = _h[1];
3106
- var _j = React.useState(), customInterval = _j[0], setCustomInterval = _j[1];
3107
- var _k = React.useState('next'), direction = _k[0], setDirection = _k[1];
3108
- var _l = React.useState(0), itemsNumber = _l[0], setItemsNumber = _l[1];
3109
- var _m = React.useState(null), touchPosition = _m[0], setTouchPosition = _m[1];
3110
- var _o = React.useState(), visible = _o[0], setVisible = _o[1];
3111
- React.useEffect(function () {
3112
- setItemsNumber(React.Children.toArray(children).length);
3113
- });
3114
- React.useEffect(function () {
3115
- visible && cycle();
3116
- }, [visible]);
3117
- React.useEffect(function () {
3118
- !animating && cycle();
3119
- !animating && onSlid && onSlid(active, direction);
3120
- animating && onSlide && onSlide(active, direction);
3121
- }, [animating]);
3122
- React.useEffect(function () {
3123
- window.addEventListener('scroll', handleScroll);
3124
- return function () {
3125
- window.removeEventListener('scroll', handleScroll);
3126
- };
3127
- });
3128
- var cycle = function () {
3129
- _pause();
3130
- if (!wrap && active === itemsNumber - 1) {
3131
- return;
3132
- }
3133
- if (typeof interval === 'number') {
3134
- data.timeout = setTimeout(function () { return nextItemWhenVisible(); }, typeof customInterval === 'number' ? customInterval : interval);
3135
- }
3136
- };
3137
- var _pause = function () { return pause && data.timeout && clearTimeout(data.timeout); };
3138
- var nextItemWhenVisible = function () {
3139
- // Don't call next when the page isn't visible
3140
- // or the carousel or its parent isn't visible
3141
- if (!document.hidden && carouselRef.current && isInViewport(carouselRef.current)) {
3142
- if (animating) {
3143
- return;
3144
- }
3145
- handleControlClick('next');
3146
- }
3147
- };
3148
- var handleControlClick = function (direction) {
3149
- if (animating) {
3150
- return;
3151
- }
3152
- setDirection(direction);
3153
- if (direction === 'next') {
3154
- active === itemsNumber - 1 ? setActive(0) : setActive(active + 1);
3155
- }
3156
- else {
3157
- active === 0 ? setActive(itemsNumber - 1) : setActive(active - 1);
3158
- }
3159
- };
3160
- var handleIndicatorClick = function (index) {
3161
- if (active === index) {
3162
- return;
3163
- }
3164
- if (active < index) {
3165
- setDirection('next');
3166
- setActive(index);
3167
- return;
3168
- }
3169
- if (active > index) {
3170
- setDirection('prev');
3171
- setActive(index);
3172
- }
3173
- };
3174
- var handleScroll = function () {
3175
- if (!document.hidden && carouselRef.current && isInViewport(carouselRef.current)) {
3176
- setVisible(true);
3177
- }
3178
- else {
3179
- setVisible(false);
3180
- }
3181
- };
3182
- var handleTouchMove = function (e) {
3183
- var touchDown = touchPosition;
3184
- if (touchDown === null) {
3185
- return;
3186
- }
3187
- var currentTouch = e.touches[0].clientX;
3188
- var diff = touchDown - currentTouch;
3189
- if (diff > 5) {
3190
- handleControlClick('next');
3191
- }
3192
- if (diff < -5) {
3193
- handleControlClick('prev');
3194
- }
3195
- setTouchPosition(null);
3196
- };
3197
- var handleTouchStart = function (e) {
3198
- var touchDown = e.touches[0].clientX;
3199
- setTouchPosition(touchDown);
3200
- };
3201
- return (React.createElement("div", __assign({ className: classNames('carousel slide', {
3202
- 'carousel-dark': dark,
3203
- 'carousel-fade': transition === 'crossfade',
3204
- }, className), onMouseEnter: _pause, onMouseLeave: cycle }, (touch && { onTouchStart: handleTouchStart, onTouchMove: handleTouchMove }), rest, { ref: forkedRef }),
3205
- React.createElement(CCarouselContext.Provider, { value: {
3206
- setAnimating: setAnimating,
3207
- setCustomInterval: setCustomInterval,
3208
- } },
3209
- indicators && (React.createElement("ol", { className: "carousel-indicators" }, Array.from({ length: itemsNumber }, function (_, i) { return i; }).map(function (index) {
3210
- return (React.createElement("li", { key: "indicator".concat(index), onClick: function () {
3211
- !animating && handleIndicatorClick(index);
3212
- }, className: active === index ? 'active' : '', "data-coreui-target": "" }));
3213
- }))),
3214
- React.createElement("div", { className: "carousel-inner" }, React.Children.map(children, function (child, index) {
3215
- if (React.isValidElement(child)) {
3216
- return React.cloneElement(child, {
3217
- active: active === index ? true : false,
3218
- direction: direction,
3219
- key: index,
3220
- });
3221
- }
3222
- return;
3223
- })),
3224
- controls && (React.createElement(React.Fragment, null,
3225
- React.createElement("button", { className: "carousel-control-prev", onClick: function () { return handleControlClick('prev'); } },
3226
- React.createElement("span", { className: "carousel-control-prev-icon", "aria-label": "prev" })),
3227
- React.createElement("button", { className: "carousel-control-next", onClick: function () { return handleControlClick('next'); } },
3228
- React.createElement("span", { className: "carousel-control-next-icon", "aria-label": "next" })))))));
3229
- });
3230
- CCarousel.propTypes = {
3231
- activeIndex: PropTypes.number,
3232
- children: PropTypes.node,
3233
- className: PropTypes.string,
3234
- controls: PropTypes.bool,
3235
- dark: PropTypes.bool,
3236
- indicators: PropTypes.bool,
3237
- interval: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
3238
- onSlid: PropTypes.func,
3239
- onSlide: PropTypes.func,
3240
- pause: PropTypes.oneOf([false, 'hover']),
3241
- touch: PropTypes.bool,
3242
- transition: PropTypes.oneOf(['slide', 'crossfade']),
3243
- wrap: PropTypes.bool,
3244
- };
3245
- CCarousel.displayName = 'CCarousel';
3246
-
3247
- var CCarouselCaption = React.forwardRef(function (_a, ref) {
3248
- var className = _a.className, rest = __rest(_a, ["className"]);
3249
- return React.createElement("div", __assign({ className: classNames('carousel-caption', className) }, rest, { ref: ref }));
3250
- });
3251
- CCarouselCaption.propTypes = {
3252
- className: PropTypes.string,
3253
- };
3254
- CCarouselCaption.displayName = 'CCarouselCaption';
2747
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
2748
+ if (includeScale === void 0) {
2749
+ includeScale = false;
2750
+ }
3255
2751
 
3256
- var CCarouselItem = React.forwardRef(function (_a, ref) {
3257
- 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"]);
3258
- var _c = React.useContext(CCarouselContext), setAnimating = _c.setAnimating, setCustomInterval = _c.setCustomInterval;
3259
- var carouselItemRef = React.useRef(null);
3260
- var forkedRef = useForkedRef(ref, carouselItemRef);
3261
- var prevActive = React.useRef();
3262
- var _d = React.useState(), directionClassName = _d[0], setDirectionClassName = _d[1];
3263
- var _e = React.useState(), orderClassName = _e[0], setOrderClassName = _e[1];
3264
- var _f = React.useState(active && 'active'), activeClassName = _f[0], setActiveClassName = _f[1];
3265
- var _g = React.useState(0), count = _g[0], setCount = _g[1];
3266
- React.useEffect(function () {
3267
- if (active) {
3268
- setCustomInterval(interval);
3269
- if (count !== 0)
3270
- setOrderClassName("carousel-item-".concat(direction));
3271
- }
3272
- if (prevActive.current && !active) {
3273
- setActiveClassName('active');
3274
- }
3275
- if (active || prevActive.current) {
3276
- setTimeout(function () {
3277
- var _a;
3278
- if (count !== 0) {
3279
- // @ts-expect-error reflow is necessary to proper transition
3280
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3281
- (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight;
3282
- setDirectionClassName("carousel-item-".concat(direction === 'next' ? 'start' : 'end'));
3283
- }
3284
- }, 0);
3285
- }
3286
- prevActive.current = active;
3287
- if (count === 0)
3288
- setCount(count + 1);
3289
- }, [active]);
3290
- React.useEffect(function () {
3291
- var _a, _b;
3292
- (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('transitionstart', function () {
3293
- active && setAnimating(true);
3294
- });
3295
- (_b = carouselItemRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('transitionend', function () {
3296
- active && setAnimating(false);
3297
- setDirectionClassName('');
3298
- setOrderClassName('');
3299
- if (active) {
3300
- setActiveClassName('active');
3301
- }
3302
- if (!active) {
3303
- setActiveClassName('');
3304
- }
3305
- });
3306
- return function () {
3307
- var _a, _b;
3308
- (_a = carouselItemRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('transitionstart', function () {
3309
- active && setAnimating(true);
3310
- });
3311
- (_b = carouselItemRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('transitionend', function () {
3312
- active && setAnimating(false);
3313
- setDirectionClassName('');
3314
- setOrderClassName('');
3315
- if (active) {
3316
- setActiveClassName('active');
3317
- }
3318
- if (!active) {
3319
- setActiveClassName('');
3320
- }
3321
- });
3322
- };
3323
- });
3324
- return (React.createElement("div", __assign({ className: classNames('carousel-item', activeClassName, directionClassName, orderClassName, className), ref: forkedRef }, rest), children));
3325
- });
3326
- CCarouselItem.propTypes = {
3327
- active: PropTypes.bool,
3328
- children: PropTypes.node,
3329
- className: PropTypes.string,
3330
- direction: PropTypes.string,
3331
- interval: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
3332
- };
3333
- CCarouselItem.displayName = 'CCarouselItem';
2752
+ if (isFixedStrategy === void 0) {
2753
+ isFixedStrategy = false;
2754
+ }
3334
2755
 
3335
- var CConditionalPortal = function (_a) {
3336
- var children = _a.children, portal = _a.portal;
3337
- return typeof window !== 'undefined' && portal ? (ReactDOM.createPortal(children, document.body)) : (React.createElement(React.Fragment, null, children));
3338
- };
3339
- CConditionalPortal.propTypes = {
3340
- children: PropTypes.node,
3341
- portal: PropTypes.bool.isRequired,
3342
- };
3343
- CConditionalPortal.displayName = 'CConditionalPortal';
2756
+ var clientRect = element.getBoundingClientRect();
2757
+ var scaleX = 1;
2758
+ var scaleY = 1;
3344
2759
 
3345
- var ManagerReferenceNodeContext = React__namespace.createContext();
3346
- var ManagerReferenceNodeSetterContext = React__namespace.createContext();
3347
- function Manager(_ref) {
3348
- 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
+ }
3349
2764
 
3350
- var _React$useState = React__namespace.useState(null),
3351
- referenceNode = _React$useState[0],
3352
- setReferenceNode = _React$useState[1];
2765
+ var _ref = isElement(element) ? getWindow(element) : window,
2766
+ visualViewport = _ref.visualViewport;
3353
2767
 
3354
- var hasUnmounted = React__namespace.useRef(false);
3355
- React__namespace.useEffect(function () {
3356
- return function () {
3357
- hasUnmounted.current = true;
3358
- };
3359
- }, []);
3360
- var handleSetReferenceNode = React__namespace.useCallback(function (node) {
3361
- if (!hasUnmounted.current) {
3362
- setReferenceNode(node);
3363
- }
3364
- }, []);
3365
- return /*#__PURE__*/React__namespace.createElement(ManagerReferenceNodeContext.Provider, {
3366
- value: referenceNode
3367
- }, /*#__PURE__*/React__namespace.createElement(ManagerReferenceNodeSetterContext.Provider, {
3368
- value: handleSetReferenceNode
3369
- }, 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
+ };
3370
2783
  }
3371
2784
 
3372
- /**
3373
- * Takes an argument and if it's an array, returns the first item in the array,
3374
- * otherwise returns the argument. Used for Preact compatibility.
3375
- */
3376
- var unwrapArray = function unwrapArray(arg) {
3377
- return Array.isArray(arg) ? arg[0] : arg;
3378
- };
3379
- /**
3380
- * Takes a maybe-undefined function and arbitrary args and invokes the function
3381
- * only if it is defined.
3382
- */
3383
-
3384
- var safeInvoke = function safeInvoke(fn) {
3385
- if (typeof fn === 'function') {
3386
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3387
- args[_key - 1] = arguments[_key];
3388
- }
2785
+ // means it doesn't take into account transforms.
3389
2786
 
3390
- return fn.apply(void 0, args);
3391
- }
3392
- };
3393
- /**
3394
- * Sets a ref using either a ref callback or a ref object
3395
- */
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
3396
2790
 
3397
- var setRef = function setRef(ref, node) {
3398
- // if its a function call it
3399
- if (typeof ref === 'function') {
3400
- return safeInvoke(ref, node);
3401
- } // otherwise we should treat it as a ref object
3402
- else if (ref != null) {
3403
- ref.current = node;
3404
- }
3405
- };
3406
- /**
3407
- * Simple ponyfill for Object.fromEntries
3408
- */
2791
+ var width = element.offsetWidth;
2792
+ var height = element.offsetHeight;
3409
2793
 
3410
- var fromEntries = function fromEntries(entries) {
3411
- return entries.reduce(function (acc, _ref) {
3412
- var key = _ref[0],
3413
- value = _ref[1];
3414
- acc[key] = value;
3415
- return acc;
3416
- }, {});
3417
- };
3418
- /**
3419
- * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
3420
- */
2794
+ if (Math.abs(clientRect.width - width) <= 1) {
2795
+ width = clientRect.width;
2796
+ }
3421
2797
 
3422
- 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
+ }
3423
2801
 
3424
- var top = 'top';
3425
- var bottom = 'bottom';
3426
- var right = 'right';
3427
- var left = 'left';
3428
- var auto = 'auto';
3429
- var basePlacements = [top, bottom, right, left];
3430
- var start = 'start';
3431
- var end = 'end';
3432
- var clippingParents = 'clippingParents';
3433
- var viewport = 'viewport';
3434
- var popper = 'popper';
3435
- var reference = 'reference';
3436
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
3437
- return acc.concat([placement + "-" + start, placement + "-" + end]);
3438
- }, []);
3439
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
3440
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
3441
- }, []); // 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
+ }
3442
2809
 
3443
- var beforeRead = 'beforeRead';
3444
- var read = 'read';
3445
- var afterRead = 'afterRead'; // pure-logic modifiers
2810
+ function contains(parent, child) {
2811
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
3446
2812
 
3447
- var beforeMain = 'beforeMain';
3448
- var main = 'main';
3449
- 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;
3450
2818
 
3451
- var beforeWrite = 'beforeWrite';
3452
- var write = 'write';
3453
- var afterWrite = 'afterWrite';
3454
- 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...
3455
2823
 
3456
- function getNodeName(element) {
3457
- return element ? (element.nodeName || '').toLowerCase() : null;
3458
- }
3459
2824
 
3460
- function getWindow(node) {
3461
- if (node == null) {
3462
- return window;
3463
- }
2825
+ next = next.parentNode || next.host;
2826
+ } while (next);
2827
+ } // Give up, the result is false
3464
2828
 
3465
- if (node.toString() !== '[object Window]') {
3466
- var ownerDocument = node.ownerDocument;
3467
- return ownerDocument ? ownerDocument.defaultView || window : window;
3468
- }
3469
2829
 
3470
- return node;
2830
+ return false;
3471
2831
  }
3472
2832
 
3473
- function isElement(node) {
3474
- var OwnElement = getWindow(node).Element;
3475
- return node instanceof OwnElement || node instanceof Element;
3476
- }
3477
-
3478
- function isHTMLElement(node) {
3479
- var OwnElement = getWindow(node).HTMLElement;
3480
- return node instanceof OwnElement || node instanceof HTMLElement;
3481
- }
3482
-
3483
- function isShadowRoot(node) {
3484
- // IE 11 has no ShadowRoot
3485
- if (typeof ShadowRoot === 'undefined') {
3486
- return false;
3487
- }
3488
-
3489
- var OwnElement = getWindow(node).ShadowRoot;
3490
- return node instanceof OwnElement || node instanceof ShadowRoot;
3491
- }
3492
-
3493
- // and applies them to the HTMLElements such as popper and arrow
3494
-
3495
- function applyStyles(_ref) {
3496
- var state = _ref.state;
3497
- Object.keys(state.elements).forEach(function (name) {
3498
- var style = state.styles[name] || {};
3499
- var attributes = state.attributes[name] || {};
3500
- var element = state.elements[name]; // arrow is optional + virtual elements
3501
-
3502
- if (!isHTMLElement(element) || !getNodeName(element)) {
3503
- return;
3504
- } // Flow doesn't support to extend this property, but it's the most
3505
- // effective way to apply styles to an HTMLElement
3506
- // $FlowFixMe[cannot-write]
3507
-
3508
-
3509
- Object.assign(element.style, style);
3510
- Object.keys(attributes).forEach(function (name) {
3511
- var value = attributes[name];
3512
-
3513
- if (value === false) {
3514
- element.removeAttribute(name);
3515
- } else {
3516
- element.setAttribute(name, value === true ? '' : value);
3517
- }
3518
- });
3519
- });
3520
- }
3521
-
3522
- function effect$2(_ref2) {
3523
- var state = _ref2.state;
3524
- var initialStyles = {
3525
- popper: {
3526
- position: state.options.strategy,
3527
- left: '0',
3528
- top: '0',
3529
- margin: '0'
3530
- },
3531
- arrow: {
3532
- position: 'absolute'
3533
- },
3534
- reference: {}
3535
- };
3536
- Object.assign(state.elements.popper.style, initialStyles.popper);
3537
- state.styles = initialStyles;
3538
-
3539
- if (state.elements.arrow) {
3540
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
3541
- }
3542
-
3543
- return function () {
3544
- Object.keys(state.elements).forEach(function (name) {
3545
- var element = state.elements[name];
3546
- var attributes = state.attributes[name] || {};
3547
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
3548
-
3549
- var style = styleProperties.reduce(function (style, property) {
3550
- style[property] = '';
3551
- return style;
3552
- }, {}); // arrow is optional + virtual elements
3553
-
3554
- if (!isHTMLElement(element) || !getNodeName(element)) {
3555
- return;
3556
- }
3557
-
3558
- Object.assign(element.style, style);
3559
- Object.keys(attributes).forEach(function (attribute) {
3560
- element.removeAttribute(attribute);
3561
- });
3562
- });
3563
- };
3564
- } // eslint-disable-next-line import/no-unused-modules
3565
-
3566
-
3567
- var applyStyles$1 = {
3568
- name: 'applyStyles',
3569
- enabled: true,
3570
- phase: 'write',
3571
- fn: applyStyles,
3572
- effect: effect$2,
3573
- requires: ['computeStyles']
3574
- };
3575
-
3576
- function getBasePlacement(placement) {
3577
- return placement.split('-')[0];
3578
- }
3579
-
3580
- var max = Math.max;
3581
- var min = Math.min;
3582
- var round = Math.round;
3583
-
3584
- function getUAString() {
3585
- var uaData = navigator.userAgentData;
3586
-
3587
- if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
3588
- return uaData.brands.map(function (item) {
3589
- return item.brand + "/" + item.version;
3590
- }).join(' ');
3591
- }
3592
-
3593
- return navigator.userAgent;
3594
- }
3595
-
3596
- function isLayoutViewport() {
3597
- return !/^((?!chrome|android).)*safari/i.test(getUAString());
3598
- }
3599
-
3600
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
3601
- if (includeScale === void 0) {
3602
- includeScale = false;
3603
- }
3604
-
3605
- if (isFixedStrategy === void 0) {
3606
- isFixedStrategy = false;
3607
- }
3608
-
3609
- var clientRect = element.getBoundingClientRect();
3610
- var scaleX = 1;
3611
- var scaleY = 1;
3612
-
3613
- if (includeScale && isHTMLElement(element)) {
3614
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
3615
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
3616
- }
3617
-
3618
- var _ref = isElement(element) ? getWindow(element) : window,
3619
- visualViewport = _ref.visualViewport;
3620
-
3621
- var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
3622
- var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
3623
- var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
3624
- var width = clientRect.width / scaleX;
3625
- var height = clientRect.height / scaleY;
3626
- return {
3627
- width: width,
3628
- height: height,
3629
- top: y,
3630
- right: x + width,
3631
- bottom: y + height,
3632
- left: x,
3633
- x: x,
3634
- y: y
3635
- };
3636
- }
3637
-
3638
- // means it doesn't take into account transforms.
3639
-
3640
- function getLayoutRect(element) {
3641
- var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
3642
- // Fixes https://github.com/popperjs/popper-core/issues/1223
3643
-
3644
- var width = element.offsetWidth;
3645
- var height = element.offsetHeight;
3646
-
3647
- if (Math.abs(clientRect.width - width) <= 1) {
3648
- width = clientRect.width;
3649
- }
3650
-
3651
- if (Math.abs(clientRect.height - height) <= 1) {
3652
- height = clientRect.height;
3653
- }
3654
-
3655
- return {
3656
- x: element.offsetLeft,
3657
- y: element.offsetTop,
3658
- width: width,
3659
- height: height
3660
- };
3661
- }
3662
-
3663
- function contains(parent, child) {
3664
- var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
3665
-
3666
- if (parent.contains(child)) {
3667
- return true;
3668
- } // then fallback to custom implementation with Shadow DOM support
3669
- else if (rootNode && isShadowRoot(rootNode)) {
3670
- var next = child;
3671
-
3672
- do {
3673
- if (next && parent.isSameNode(next)) {
3674
- return true;
3675
- } // $FlowFixMe[prop-missing]: need a better way to handle this...
3676
-
3677
-
3678
- next = next.parentNode || next.host;
3679
- } while (next);
3680
- } // Give up, the result is false
3681
-
3682
-
3683
- return false;
3684
- }
3685
-
3686
- function getComputedStyle$1(element) {
3687
- return getWindow(element).getComputedStyle(element);
2833
+ function getComputedStyle$1(element) {
2834
+ return getWindow(element).getComputedStyle(element);
3688
2835
  }
3689
2836
 
3690
2837
  function isTableElement(element) {
@@ -5130,498 +4277,920 @@ function popperGenerator(generatorOptions) {
5130
4277
  continue;
5131
4278
  }
5132
4279
 
5133
- var _state$orderedModifie = state.orderedModifiers[index],
5134
- fn = _state$orderedModifie.fn,
5135
- _state$orderedModifie2 = _state$orderedModifie.options,
5136
- _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
5137
- 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';
5138
4683
 
5139
- if (typeof fn === 'function') {
5140
- state = fn({
5141
- state: state,
5142
- options: _options,
5143
- name: name,
5144
- instance: instance
5145
- }) || state;
5146
- }
5147
- }
5148
- },
5149
- // Async and optimistically optimized update – it will not be executed if
5150
- // not necessary (debounced to run at most once-per-tick)
5151
- update: debounce(function () {
5152
- return new Promise(function (resolve) {
5153
- instance.forceUpdate();
5154
- resolve(state);
5155
- });
5156
- }),
5157
- destroy: function destroy() {
5158
- cleanupModifierEffects();
5159
- isDestroyed = true;
5160
- }
5161
- };
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';
5162
4694
 
5163
- if (!areValidElements(reference, popper)) {
5164
- return instance;
5165
- }
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';
5166
4708
 
5167
- instance.setOptions(options).then(function (state) {
5168
- if (!isDestroyed && options.onFirstUpdate) {
5169
- options.onFirstUpdate(state);
5170
- }
5171
- }); // Modifiers have the ability to execute arbitrary code before the first
5172
- // update cycle runs. They will be executed in the same order as the update
5173
- // cycle. This is useful when a modifier adds some persistent data that
5174
- // other modifiers need to use, but the modifier is run after the dependent
5175
- // 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';
5176
4725
 
5177
- function runModifierEffects() {
5178
- state.orderedModifiers.forEach(function (_ref) {
5179
- var name = _ref.name,
5180
- _ref$options = _ref.options,
5181
- options = _ref$options === void 0 ? {} : _ref$options,
5182
- 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';
5183
4735
 
5184
- if (typeof effect === 'function') {
5185
- var cleanupFn = effect({
5186
- state: state,
5187
- name: name,
5188
- instance: instance,
5189
- options: options
5190
- });
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';
5191
4748
 
5192
- 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';
5193
4762
 
5194
- effectCleanupFns.push(cleanupFn || noopFn);
5195
- }
5196
- });
5197
- }
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';
5198
4778
 
5199
- function cleanupModifierEffects() {
5200
- effectCleanupFns.forEach(function (fn) {
5201
- return fn();
5202
- });
5203
- effectCleanupFns = [];
5204
- }
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';
5205
4788
 
5206
- return instance;
5207
- };
5208
- }
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';
5209
4798
 
5210
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
5211
- var createPopper = /*#__PURE__*/popperGenerator({
5212
- defaultModifiers: defaultModifiers
5213
- }); // 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';
5214
4808
 
5215
- /* 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';
5216
4819
 
5217
- var hasElementType = typeof Element !== 'undefined';
5218
- var hasMap = typeof Map === 'function';
5219
- var hasSet = typeof Set === 'function';
5220
- 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';
5221
4831
 
5222
- // 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';
5223
4841
 
5224
- function equal(a, b) {
5225
- // START: fast-deep-equal es6/index.js 3.1.3
5226
- 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';
5227
4851
 
5228
- if (a && b && typeof a == 'object' && typeof b == 'object') {
5229
- 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';
5230
4862
 
5231
- var length, i, keys;
5232
- if (Array.isArray(a)) {
5233
- length = a.length;
5234
- if (length != b.length) return false;
5235
- for (i = length; i-- !== 0;)
5236
- if (!equal(a[i], b[i])) return false;
5237
- return true;
5238
- }
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';
5239
4873
 
5240
- // START: Modifications:
5241
- // 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
5242
- // to co-exist with es5.
5243
- // 2. Replace `for of` with es5 compliant iteration using `for`.
5244
- // Basically, take:
5245
- //
5246
- // ```js
5247
- // for (i of a.entries())
5248
- // if (!b.has(i[0])) return false;
5249
- // ```
5250
- //
5251
- // ... and convert to:
5252
- //
5253
- // ```js
5254
- // it = a.entries();
5255
- // while (!(i = it.next()).done)
5256
- // if (!b.has(i.value[0])) return false;
5257
- // ```
5258
- //
5259
- // **Note**: `i` access switches to `i.value`.
5260
- var it;
5261
- if (hasMap && (a instanceof Map) && (b instanceof Map)) {
5262
- if (a.size !== b.size) return false;
5263
- it = a.entries();
5264
- while (!(i = it.next()).done)
5265
- if (!b.has(i.value[0])) return false;
5266
- it = a.entries();
5267
- while (!(i = it.next()).done)
5268
- if (!equal(i.value[1], b.get(i.value[0]))) return false;
5269
- return true;
5270
- }
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';
5271
4884
 
5272
- if (hasSet && (a instanceof Set) && (b instanceof Set)) {
5273
- if (a.size !== b.size) return false;
5274
- it = a.entries();
5275
- while (!(i = it.next()).done)
5276
- if (!b.has(i.value[0])) return false;
5277
- return true;
5278
- }
5279
- // END: Modifications
5280
-
5281
- if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
5282
- length = a.length;
5283
- if (length != b.length) return false;
5284
- for (i = length; i-- !== 0;)
5285
- if (a[i] !== b[i]) return false;
5286
- 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
+ }
5287
4896
  }
4897
+ };
5288
4898
 
5289
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
5290
- // START: Modifications:
5291
- // Apply guards for `Object.create(null)` handling. See:
5292
- // - https://github.com/FormidableLabs/react-fast-compare/issues/64
5293
- // - https://github.com/epoberezkin/fast-deep-equal/issues/49
5294
- if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === 'function' && typeof b.valueOf === 'function') return a.valueOf() === b.valueOf();
5295
- if (a.toString !== Object.prototype.toString && typeof a.toString === 'function' && typeof b.toString === 'function') return a.toString() === b.toString();
5296
- // END: Modifications
5297
-
5298
- keys = Object.keys(a);
5299
- length = keys.length;
5300
- if (length !== Object.keys(b).length) return false;
5301
-
5302
- for (i = length; i-- !== 0;)
5303
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
5304
- // END: fast-deep-equal
5305
-
5306
- // START: react-fast-compare
5307
- // custom handling for DOM elements
5308
- if (hasElementType && a instanceof Element) return false;
5309
-
5310
- // custom handling for React/Preact
5311
- for (i = length; i-- !== 0;) {
5312
- if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
5313
- // React-specific: avoid traversing React elements' _owner
5314
- // Preact-specific: avoid traversing Preact elements' __v and __o
5315
- // __v = $_original / $_vnode
5316
- // __o = $_owner
5317
- // These properties contain circular references and are not needed when
5318
- // comparing the actual elements (and not their owners)
5319
- // .$$typeof and ._store on just reasonable markers of elements
5320
-
5321
- continue;
5322
- }
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
+ };
5323
4906
 
5324
- // all other properties should be traversed as usual
5325
- 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;
5326
4910
  }
5327
- // END: react-fast-compare
5328
-
5329
- // START: fast-deep-equal
5330
- return true;
5331
- }
5332
-
5333
- return a !== a && b !== b;
5334
- }
5335
- // end fast-deep-equal
5336
-
5337
- var reactFastCompare = function isEqual(a, b) {
5338
- try {
5339
- return equal(a, b);
5340
- } catch (error) {
5341
- if (((error.message || '').match(/stack|recursion/i))) {
5342
- // warn on circular references, don't crash
5343
- // browsers give this different errors name and messages:
5344
- // chrome/safari: "RangeError", "Maximum call stack size exceeded"
5345
- // firefox: "InternalError", too much recursion"
5346
- // edge: "Error", "Out of stack space"
5347
- console.warn('react-fast-compare cannot handle circular refs');
5348
- return false;
4911
+ if (element) {
4912
+ return element.closest('[dir="rtl"]') !== null;
5349
4913
  }
5350
- // some other error. we should definitely know about these
5351
- throw error;
5352
- }
4914
+ return false;
5353
4915
  };
5354
4916
 
5355
- var isEqual = /*@__PURE__*/getDefaultExportFromCjs(reactFastCompare);
5356
-
5357
- var EMPTY_MODIFIERS$1 = [];
5358
- var usePopper = function usePopper(referenceElement, popperElement, options) {
5359
- if (options === void 0) {
5360
- options = {};
5361
- }
5362
-
5363
- var prevOptions = React__namespace.useRef(null);
5364
- var optionsWithDefaults = {
5365
- onFirstUpdate: options.onFirstUpdate,
5366
- placement: options.placement || 'bottom',
5367
- strategy: options.strategy || 'absolute',
5368
- modifiers: options.modifiers || EMPTY_MODIFIERS$1
5369
- };
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';
5370
5065
 
5371
- var _React$useState = React__namespace.useState({
5372
- styles: {
5373
- popper: {
5374
- position: optionsWithDefaults.strategy,
5375
- left: '0',
5376
- top: '0'
5377
- },
5378
- arrow: {
5379
- position: 'absolute'
5380
- }
5381
- },
5382
- attributes: {}
5383
- }),
5384
- state = _React$useState[0],
5385
- 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';
5386
5074
 
5387
- var updateStateModifier = React__namespace.useMemo(function () {
5388
- return {
5389
- name: 'updateState',
5390
- enabled: true,
5391
- phase: 'write',
5392
- fn: function fn(_ref) {
5393
- var state = _ref.state;
5394
- var elements = Object.keys(state.elements);
5395
- ReactDOM__namespace.flushSync(function () {
5396
- setState({
5397
- styles: fromEntries(elements.map(function (element) {
5398
- return [element, state.styles[element] || {}];
5399
- })),
5400
- attributes: fromEntries(elements.map(function (element) {
5401
- return [element, state.attributes[element]];
5402
- }))
5403
- });
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);
5404
5113
  });
5405
- },
5406
- requires: ['computeStyles']
5407
- };
5408
- }, []);
5409
- var popperOptions = React__namespace.useMemo(function () {
5410
- var newOptions = {
5411
- onFirstUpdate: optionsWithDefaults.onFirstUpdate,
5412
- placement: optionsWithDefaults.placement,
5413
- strategy: optionsWithDefaults.strategy,
5414
- modifiers: [].concat(optionsWithDefaults.modifiers, [updateStateModifier, {
5415
- name: 'applyStyles',
5416
- enabled: false
5417
- }])
5418
- };
5419
-
5420
- if (isEqual(prevOptions.current, newOptions)) {
5421
- return prevOptions.current || newOptions;
5422
- } else {
5423
- prevOptions.current = newOptions;
5424
- return newOptions;
5425
- }
5426
- }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
5427
- var popperInstanceRef = React__namespace.useRef();
5428
- useIsomorphicLayoutEffect(function () {
5429
- if (popperInstanceRef.current) {
5430
- popperInstanceRef.current.setOptions(popperOptions);
5431
- }
5432
- }, [popperOptions]);
5433
- useIsomorphicLayoutEffect(function () {
5434
- if (referenceElement == null || popperElement == null) {
5435
- return;
5436
- }
5437
-
5438
- var createPopper$1 = options.createPopper || createPopper;
5439
- var popperInstance = createPopper$1(referenceElement, popperElement, popperOptions);
5440
- popperInstanceRef.current = popperInstance;
5441
- return function () {
5442
- popperInstance.destroy();
5443
- popperInstanceRef.current = null;
5444
- };
5445
- }, [referenceElement, popperElement, options.createPopper]);
5446
- return {
5447
- state: popperInstanceRef.current ? popperInstanceRef.current.state : null,
5448
- styles: state.styles,
5449
- attributes: state.attributes,
5450
- update: popperInstanceRef.current ? popperInstanceRef.current.update : null,
5451
- forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null
5452
- };
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]),
5453
5151
  };
5152
+ CCarouselItem.displayName = 'CCarouselItem';
5454
5153
 
5455
- var NOOP = function NOOP() {
5456
- 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));
5457
5157
  };
5458
-
5459
- var NOOP_PROMISE = function NOOP_PROMISE() {
5460
- return Promise.resolve(null);
5158
+ CConditionalPortal.propTypes = {
5159
+ children: PropTypes.node,
5160
+ portal: PropTypes.bool.isRequired,
5461
5161
  };
5162
+ CConditionalPortal.displayName = 'CConditionalPortal';
5462
5163
 
5463
- var EMPTY_MODIFIERS = [];
5464
- function Popper(_ref) {
5465
- var _ref$placement = _ref.placement,
5466
- placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
5467
- _ref$strategy = _ref.strategy,
5468
- strategy = _ref$strategy === void 0 ? 'absolute' : _ref$strategy,
5469
- _ref$modifiers = _ref.modifiers,
5470
- modifiers = _ref$modifiers === void 0 ? EMPTY_MODIFIERS : _ref$modifiers,
5471
- referenceElement = _ref.referenceElement,
5472
- onFirstUpdate = _ref.onFirstUpdate,
5473
- innerRef = _ref.innerRef,
5474
- children = _ref.children;
5475
- var referenceNode = React__namespace.useContext(ManagerReferenceNodeContext);
5476
-
5477
- var _React$useState = React__namespace.useState(null),
5478
- popperElement = _React$useState[0],
5479
- setPopperElement = _React$useState[1];
5480
-
5481
- var _React$useState2 = React__namespace.useState(null),
5482
- arrowElement = _React$useState2[0],
5483
- setArrowElement = _React$useState2[1];
5484
-
5485
- React__namespace.useEffect(function () {
5486
- setRef(innerRef, popperElement);
5487
- }, [innerRef, popperElement]);
5488
- var options = React__namespace.useMemo(function () {
5489
- return {
5490
- placement: placement,
5491
- strategy: strategy,
5492
- onFirstUpdate: onFirstUpdate,
5493
- modifiers: [].concat(modifiers, [{
5494
- name: 'arrow',
5495
- enabled: arrowElement != null,
5496
- options: {
5497
- element: arrowElement
5498
- }
5499
- }])
5500
- };
5501
- }, [placement, strategy, onFirstUpdate, modifiers, arrowElement]);
5502
-
5503
- var _usePopper = usePopper(referenceElement || referenceNode, popperElement, options),
5504
- state = _usePopper.state,
5505
- styles = _usePopper.styles,
5506
- forceUpdate = _usePopper.forceUpdate,
5507
- update = _usePopper.update;
5508
-
5509
- var childrenProps = React__namespace.useMemo(function () {
5510
- return {
5511
- ref: setPopperElement,
5512
- style: styles.popper,
5513
- placement: state ? state.placement : placement,
5514
- hasPopperEscaped: state && state.modifiersData.hide ? state.modifiersData.hide.hasPopperEscaped : null,
5515
- isReferenceHidden: state && state.modifiersData.hide ? state.modifiersData.hide.isReferenceHidden : null,
5516
- arrowProps: {
5517
- style: styles.arrow,
5518
- ref: setArrowElement
5519
- },
5520
- forceUpdate: forceUpdate || NOOP,
5521
- update: update || NOOP_PROMISE
5522
- };
5523
- }, [setPopperElement, setArrowElement, placement, state, styles, update, forceUpdate]);
5524
- return unwrapArray(children)(childrenProps);
5525
- }
5526
-
5527
- /**
5528
- * Copyright (c) 2014-present, Facebook, Inc.
5529
- *
5530
- * This source code is licensed under the MIT license found in the
5531
- * LICENSE file in the root directory of this source tree.
5532
- */
5533
-
5534
- /**
5535
- * Similar to invariant but only logs a warning if the condition is not met.
5536
- * This can be used to log issues in development environments in critical
5537
- * paths. Removing the logging code for production environments will keep the
5538
- * same logic and follow the same code paths.
5539
- */
5540
-
5541
- var __DEV__ = process.env.NODE_ENV !== 'production';
5542
-
5543
- var warning = function() {};
5544
-
5545
- if (__DEV__) {
5546
- var printWarning = function printWarning(format, args) {
5547
- var len = arguments.length;
5548
- args = new Array(len > 1 ? len - 1 : 0);
5549
- for (var key = 1; key < len; key++) {
5550
- 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';
5551
5168
  }
5552
- var argIndex = 0;
5553
- var message = 'Warning: ' +
5554
- format.replace(/%s/g, function() {
5555
- return args[argIndex++];
5556
- });
5557
- if (typeof console !== 'undefined') {
5558
- console.error(message);
5169
+ if (direction === 'dropup-center') {
5170
+ _placement = 'top';
5559
5171
  }
5560
- try {
5561
- // --- Welcome to debugging React ---
5562
- // This error was thrown as a convenience so that you can use this stack
5563
- // to find the callsite that caused this warning to fire.
5564
- throw new Error(message);
5565
- } catch (x) {}
5566
- };
5567
-
5568
- warning = function(condition, format, args) {
5569
- var len = arguments.length;
5570
- args = new Array(len > 2 ? len - 2 : 0);
5571
- for (var key = 2; key < len; key++) {
5572
- args[key - 2] = arguments[key];
5172
+ if (direction === 'dropend') {
5173
+ _placement = isRTL ? 'left-start' : 'right-start';
5573
5174
  }
5574
- if (format === undefined) {
5575
- throw new Error(
5576
- '`warning(condition, format, ...args)` requires a warning ' +
5577
- 'message argument'
5578
- );
5175
+ if (direction === 'dropstart') {
5176
+ _placement = isRTL ? 'right-start' : 'left-start';
5579
5177
  }
5580
- if (!condition) {
5581
- printWarning.apply(null, [format].concat(args));
5178
+ if (alignment === 'end') {
5179
+ _placement = isRTL ? 'bottom-start' : 'bottom-end';
5582
5180
  }
5583
- };
5584
- }
5585
-
5586
- var warning_1 = warning;
5587
-
5588
- var warning$1 = /*@__PURE__*/getDefaultExportFromCjs(warning_1);
5589
-
5590
- function Reference(_ref) {
5591
- var children = _ref.children,
5592
- innerRef = _ref.innerRef;
5593
- var setReferenceNode = React__namespace.useContext(ManagerReferenceNodeSetterContext);
5594
- var refHandler = React__namespace.useCallback(function (node) {
5595
- setRef(innerRef, node);
5596
- safeInvoke(setReferenceNode, node);
5597
- }, [innerRef, setReferenceNode]); // ran on unmount
5598
- // eslint-disable-next-line react-hooks/exhaustive-deps
5599
-
5600
- React__namespace.useEffect(function () {
5601
- return function () {
5602
- return setRef(innerRef, null);
5603
- };
5604
- }, []);
5605
- React__namespace.useEffect(function () {
5606
- warning$1(Boolean(setReferenceNode), '`Reference` should not be used outside of a `Manager` component.');
5607
- }, [setReferenceNode]);
5608
- return unwrapArray(children)({
5609
- ref: refHandler
5610
- });
5611
- }
5612
-
5613
- var PopperManagerWrapper = function (_a) {
5614
- var children = _a.children, popper = _a.popper;
5615
- return popper ? React.createElement(Manager, null, children) : React.createElement(React.Fragment, null, children);
5181
+ return _placement;
5616
5182
  };
5617
5183
  var CDropdownContext = React.createContext({});
5618
5184
  var CDropdown = React.forwardRef(function (_a, ref) {
5619
5185
  var _b;
5620
- 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"]);
5621
5187
  var dropdownRef = React.useRef(null);
5188
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5622
5189
  var dropdownToggleRef = React.useRef(null);
5190
+ var dropdownMenuRef = React.useRef(null);
5623
5191
  var forkedRef = useForkedRef(ref, dropdownRef);
5624
- 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;
5625
5194
  var Component = variant === 'nav-item' ? 'li' : component;
5626
5195
  // Disable popper if responsive aligment is set.
5627
5196
  if (typeof alignment === 'object') {
@@ -5629,44 +5198,83 @@ var CDropdown = React.forwardRef(function (_a, ref) {
5629
5198
  }
5630
5199
  var contextValues = {
5631
5200
  alignment: alignment,
5632
- autoClose: autoClose,
5633
5201
  dark: dark,
5634
- direction: direction,
5635
5202
  dropdownToggleRef: dropdownToggleRef,
5636
- placement: placement,
5203
+ dropdownMenuRef: dropdownMenuRef,
5637
5204
  popper: popper,
5638
5205
  portal: portal,
5639
5206
  variant: variant,
5640
5207
  visible: _visible,
5641
5208
  setVisible: setVisible,
5642
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
+ };
5643
5221
  React.useEffect(function () {
5644
5222
  setVisible(visible);
5645
5223
  }, [visible]);
5646
5224
  React.useEffect(function () {
5647
- _visible && onShow && onShow();
5648
- !_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
+ };
5649
5237
  }, [_visible]);
5650
- return (React.createElement(CDropdownContext.Provider, { value: contextValues },
5651
- 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 = {
5652
- 'dropdown-center': direction === 'center',
5653
- 'dropup dropup-center': direction === 'dropup-center'
5654
- },
5655
- _b["".concat(direction)] = direction && direction !== 'center' && direction !== 'dropup-center',
5656
- _b.show = _visible,
5657
- _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))));
5658
5267
  });
5659
5268
  var alignmentDirection = PropTypes.oneOf(['start', 'end']);
5660
5269
  CDropdown.propTypes = {
5661
- // @ts-expect-error TODO: we have to find a solution
5662
5270
  alignment: PropTypes.oneOfType([
5663
5271
  alignmentDirection,
5664
- PropTypes.shape({ xs: alignmentDirection }),
5665
- PropTypes.shape({ sm: alignmentDirection }),
5666
- PropTypes.shape({ md: alignmentDirection }),
5667
- PropTypes.shape({ lg: alignmentDirection }),
5668
- PropTypes.shape({ xl: alignmentDirection }),
5669
- 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 }),
5670
5278
  ]),
5671
5279
  autoClose: PropTypes.oneOfType([
5672
5280
  PropTypes.bool,
@@ -5677,6 +5285,7 @@ CDropdown.propTypes = {
5677
5285
  component: PropTypes.elementType,
5678
5286
  dark: PropTypes.bool,
5679
5287
  direction: PropTypes.oneOf(['center', 'dropup', 'dropup-center', 'dropend', 'dropstart']),
5288
+ offset: PropTypes.any,
5680
5289
  onHide: PropTypes.func,
5681
5290
  onShow: PropTypes.func,
5682
5291
  placement: placementPropType,
@@ -5741,74 +5350,23 @@ var alignmentClassNames = function (alignment) {
5741
5350
  }
5742
5351
  return classNames;
5743
5352
  };
5744
- var CDropdownMenu = function (_a) {
5353
+ var CDropdownMenu = React.forwardRef(function (_a, ref) {
5745
5354
  var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'ul' : _b, rest = __rest(_a, ["children", "className", "component"]);
5746
- 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;
5747
- var dropdownMenuRef = React.useRef(null);
5748
- React.useEffect(function () {
5749
- visible && window.addEventListener('mouseup', handleMouseUp);
5750
- visible && window.addEventListener('keyup', handleKeyup);
5751
- return function () {
5752
- window.removeEventListener('mouseup', handleMouseUp);
5753
- window.removeEventListener('keyup', handleKeyup);
5754
- };
5755
- }, [visible]);
5756
- var handleKeyup = function (event) {
5757
- if (autoClose === false) {
5758
- return;
5759
- }
5760
- if (event.key === 'Escape') {
5761
- setVisible(false);
5762
- }
5763
- };
5764
- var handleMouseUp = function (event) {
5765
- var _a, _b;
5766
- if (dropdownToggleRef && dropdownToggleRef.current.contains(event.target)) {
5767
- return;
5768
- }
5769
- if (autoClose === true ||
5770
- (autoClose === 'inside' && ((_a = dropdownMenuRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) ||
5771
- (autoClose === 'outside' && !((_b = dropdownMenuRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)))) {
5772
- setTimeout(function () { return setVisible(false); }, 1);
5773
- return;
5774
- }
5775
- };
5776
- var _placement = placement;
5777
- if (direction === 'center') {
5778
- _placement = 'bottom';
5779
- }
5780
- if (direction === 'dropup') {
5781
- _placement = isRTL(dropdownMenuRef.current) ? 'top-end' : 'top-start';
5782
- }
5783
- if (direction === 'dropup-center') {
5784
- _placement = 'top';
5785
- }
5786
- if (direction === 'dropend') {
5787
- _placement = isRTL(dropdownMenuRef.current) ? 'left-start' : 'right-start';
5788
- }
5789
- if (direction === 'dropstart') {
5790
- _placement = isRTL(dropdownMenuRef.current) ? 'right-start' : 'left-start';
5791
- }
5792
- if (alignment === 'end') {
5793
- _placement = isRTL(dropdownMenuRef.current) ? 'bottom-start' : 'bottom-end';
5794
- }
5795
- 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 },
5796
5358
  React.createElement(Component, __assign({ className: classNames('dropdown-menu', {
5797
5359
  'dropdown-menu-dark': dark,
5798
5360
  show: visible,
5799
- }, 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'
5800
5362
  ? React.Children.map(children, function (child, index) {
5801
5363
  if (React.isValidElement(child)) {
5802
5364
  return React.createElement("li", { key: index }, React.cloneElement(child));
5803
5365
  }
5804
5366
  return;
5805
5367
  })
5806
- : children))); };
5807
- return popper && visible ? (React.createElement(Popper, { innerRef: dropdownMenuRef, placement: _placement }, function (_a) {
5808
- var ref = _a.ref, style = _a.style;
5809
- return dropdownMenuComponent(style, ref);
5810
- })) : (dropdownMenuComponent());
5811
- };
5368
+ : children)));
5369
+ });
5812
5370
  CDropdownMenu.propTypes = {
5813
5371
  children: PropTypes.node,
5814
5372
  className: PropTypes.string,
@@ -5818,7 +5376,7 @@ CDropdownMenu.displayName = 'CDropdownMenu';
5818
5376
 
5819
5377
  var CDropdownToggle = function (_a) {
5820
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"]);
5821
- 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;
5822
5380
  var triggers = __assign(__assign({}, ((trigger === 'click' || trigger.includes('click')) && {
5823
5381
  onClick: function (event) {
5824
5382
  event.preventDefault();
@@ -5834,22 +5392,18 @@ var CDropdownToggle = function (_a) {
5834
5392
  'nav-link': variant === 'nav-item',
5835
5393
  }, className), 'aria-expanded': visible }, (!rest.disabled && __assign({}, triggers)));
5836
5394
  // We use any because Toggler can be `a` as well as `button`.
5837
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5838
- var Toggler = function (ref) {
5395
+ var Toggler = function () {
5839
5396
  if (custom && React.isValidElement(children)) {
5840
- 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 }))));
5841
5398
  }
5842
5399
  if (variant === 'nav-item') {
5843
- return (React.createElement("a", __assign({ href: "#" }, togglerProps, { ref: useForkedRef(ref, dropdownToggleRef) }), children));
5400
+ return (React.createElement("a", __assign({ href: "#" }, togglerProps, { ref: dropdownToggleRef }), children));
5844
5401
  }
5845
- 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 }),
5846
5403
  children,
5847
5404
  split && React.createElement("span", { className: "visually-hidden" }, "Toggle Dropdown")));
5848
5405
  };
5849
- return popper ? React.createElement(Reference, null, function (_a) {
5850
- var ref = _a.ref;
5851
- return Toggler(ref);
5852
- }) : Toggler(dropdownToggleRef);
5406
+ return React.createElement(Toggler, null);
5853
5407
  };
5854
5408
  CDropdownToggle.propTypes = {
5855
5409
  caret: PropTypes.bool,
@@ -7018,14 +6572,29 @@ CPlaceholder.propTypes = {
7018
6572
  };
7019
6573
  CPlaceholder.displayName = 'CPlaceholder';
7020
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
+
7021
6589
  var CProgressBar = React.forwardRef(function (_a, ref) {
7022
6590
  var _b;
7023
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;
7024
6593
  return (React.createElement("div", __assign({ className: classNames('progress-bar', (_b = {},
7025
6594
  _b["bg-".concat(color)] = color,
7026
6595
  _b["progress-bar-".concat(variant)] = variant,
7027
6596
  _b['progress-bar-animated'] = animated,
7028
- _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));
7029
6598
  });
7030
6599
  CProgressBar.propTypes = {
7031
6600
  animated: PropTypes.bool,
@@ -7037,102 +6606,121 @@ CProgressBar.propTypes = {
7037
6606
  };
7038
6607
  CProgressBar.displayName = 'CProgressBar';
7039
6608
 
7040
- // TODO: update markup and add '.progress-stacked' in v5
7041
6609
  var CProgress = React.forwardRef(function (_a, ref) {
7042
- 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"]);
7043
- 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', {
7044
6613
  'progress-thin': thin,
7045
6614
  'progress-white': white,
7046
- }, 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))));
7047
6629
  });
7048
6630
  CProgress.propTypes = {
7049
6631
  children: PropTypes.node,
7050
6632
  className: PropTypes.string,
7051
6633
  height: PropTypes.number,
6634
+ progressBarClassName: PropTypes.string,
7052
6635
  thin: PropTypes.bool,
7053
6636
  value: PropTypes.number,
7054
6637
  white: PropTypes.bool,
7055
6638
  };
7056
6639
  CProgress.displayName = 'CProgress';
7057
6640
 
7058
- var getPlacement$1 = function (placement, element) {
7059
- switch (placement) {
7060
- case 'right': {
7061
- return isRTL(element) ? 'left' : 'right';
7062
- }
7063
- case 'left': {
7064
- return isRTL(element) ? 'right' : 'left';
7065
- }
7066
- default: {
7067
- return placement;
7068
- }
7069
- }
7070
- };
7071
6641
  var CPopover = function (_a) {
7072
- 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"]);
7073
6643
  var popoverRef = React.useRef(null);
7074
6644
  var togglerRef = React.useRef(null);
7075
- var popper = React.useRef();
7076
- 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
+ };
7077
6671
  React.useEffect(function () {
7078
6672
  setVisible(visible);
7079
6673
  }, [visible]);
7080
6674
  React.useEffect(function () {
7081
- if (_visible) {
7082
- initPopper();
6675
+ if (_visible && togglerRef.current && popoverRef.current) {
6676
+ initPopper(togglerRef.current, popoverRef.current, popperConfig);
7083
6677
  }
7084
6678
  return function () {
7085
6679
  destroyPopper();
7086
6680
  };
7087
6681
  }, [_visible]);
7088
- var initPopper = function () {
7089
- if (togglerRef.current && popoverRef.current) {
7090
- popper.current = createPopper(togglerRef.current, popoverRef.current, {
7091
- modifiers: [
7092
- {
7093
- name: 'offset',
7094
- options: {
7095
- offset: offset,
7096
- },
7097
- },
7098
- ],
7099
- placement: getPlacement$1(placement, togglerRef.current),
7100
- });
7101
- }
7102
- };
7103
- var destroyPopper = function () {
7104
- if (popper.current) {
7105
- popper.current.destroy();
6682
+ var toggleVisible = function (visible) {
6683
+ if (visible) {
6684
+ setTimeout(function () { return setVisible(true); }, _delay.show);
6685
+ return;
7106
6686
  }
7107
- popper.current = undefined;
6687
+ setTimeout(function () { return setVisible(false); }, _delay.hide);
7108
6688
  };
7109
6689
  return (React.createElement(React.Fragment, null,
7110
6690
  React.cloneElement(children, __assign(__assign(__assign({ ref: togglerRef }, ((trigger === 'click' || trigger.includes('click')) && {
7111
- onClick: function () { return setVisible(!_visible); },
6691
+ onClick: function () { return toggleVisible(!_visible); },
7112
6692
  })), ((trigger === 'focus' || trigger.includes('focus')) && {
7113
- onFocus: function () { return setVisible(true); },
7114
- onBlur: function () { return setVisible(false); },
6693
+ onFocus: function () { return toggleVisible(true); },
6694
+ onBlur: function () { return toggleVisible(false); },
7115
6695
  })), ((trigger === 'hover' || trigger.includes('hover')) && {
7116
- onMouseEnter: function () { return setVisible(true); },
7117
- onMouseLeave: function () { return setVisible(false); },
6696
+ onMouseEnter: function () { return toggleVisible(true); },
6697
+ onMouseLeave: function () { return toggleVisible(false); },
7118
6698
  }))),
7119
6699
  typeof window !== 'undefined' &&
7120
6700
  ReactDOM.createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
7121
6701
  enter: 0,
7122
6702
  exit: 200,
7123
- }, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', "bs-popover-".concat(getPlacement$1(placement, togglerRef.current)
7124
- .replace('left', 'start')
7125
- .replace('right', 'end')), 'fade', {
6703
+ }, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('popover', 'bs-popover-auto', {
6704
+ fade: animation,
7126
6705
  show: state === 'entered',
7127
6706
  }, className), ref: popoverRef, role: "tooltip" }, rest),
7128
- React.createElement("div", { "data-popper-arrow": true, className: "popover-arrow" }),
6707
+ React.createElement("div", { className: "popover-arrow" }),
7129
6708
  React.createElement("div", { className: "popover-header" }, title),
7130
6709
  React.createElement("div", { className: "popover-body" }, content))); }), document.body)));
7131
6710
  };
7132
6711
  CPopover.propTypes = {
6712
+ animation: PropTypes.bool,
7133
6713
  children: PropTypes.node,
7134
6714
  className: PropTypes.string,
7135
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,
7136
6724
  offset: PropTypes.any,
7137
6725
  onHide: PropTypes.func,
7138
6726
  onShow: PropTypes.func,
@@ -7663,82 +7251,87 @@ CToaster.propTypes = {
7663
7251
  };
7664
7252
  CToaster.displayName = 'CToaster';
7665
7253
 
7666
- var getPlacement = function (placement, element) {
7667
- switch (placement) {
7668
- case 'right': {
7669
- return isRTL(element) ? 'left' : 'right';
7670
- }
7671
- case 'left': {
7672
- return isRTL(element) ? 'right' : 'left';
7673
- }
7674
- default: {
7675
- return placement;
7676
- }
7677
- }
7678
- };
7679
7254
  var CTooltip = function (_a) {
7680
- 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"]);
7681
7256
  var tooltipRef = React.useRef(null);
7682
7257
  var togglerRef = React.useRef(null);
7683
- var popper = React.useRef();
7684
- 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
+ };
7685
7284
  React.useEffect(function () {
7686
7285
  setVisible(visible);
7687
7286
  }, [visible]);
7688
7287
  React.useEffect(function () {
7689
- if (_visible) {
7690
- initPopper();
7288
+ if (_visible && togglerRef.current && tooltipRef.current) {
7289
+ initPopper(togglerRef.current, tooltipRef.current, popperConfig);
7691
7290
  }
7692
7291
  return function () {
7693
7292
  destroyPopper();
7694
7293
  };
7695
7294
  }, [_visible]);
7696
- var initPopper = function () {
7697
- if (togglerRef.current && tooltipRef.current) {
7698
- popper.current = createPopper(togglerRef.current, tooltipRef.current, {
7699
- modifiers: [
7700
- {
7701
- name: 'offset',
7702
- options: {
7703
- offset: offset,
7704
- },
7705
- },
7706
- ],
7707
- placement: getPlacement(placement, togglerRef.current),
7708
- });
7709
- }
7710
- };
7711
- var destroyPopper = function () {
7712
- if (popper.current) {
7713
- popper.current.destroy();
7295
+ var toggleVisible = function (visible) {
7296
+ if (visible) {
7297
+ setTimeout(function () { return setVisible(true); }, _delay.show);
7298
+ return;
7714
7299
  }
7715
- popper.current = undefined;
7300
+ setTimeout(function () { return setVisible(false); }, _delay.hide);
7716
7301
  };
7717
7302
  return (React.createElement(React.Fragment, null,
7718
7303
  React.cloneElement(children, __assign(__assign(__assign({ ref: togglerRef }, ((trigger === 'click' || trigger.includes('click')) && {
7719
- onClick: function () { return setVisible(!_visible); },
7304
+ onClick: function () { return toggleVisible(!_visible); },
7720
7305
  })), ((trigger === 'focus' || trigger.includes('focus')) && {
7721
- onFocus: function () { return setVisible(true); },
7722
- onBlur: function () { return setVisible(false); },
7306
+ onFocus: function () { return toggleVisible(true); },
7307
+ onBlur: function () { return toggleVisible(false); },
7723
7308
  })), ((trigger === 'hover' || trigger.includes('hover')) && {
7724
- onMouseEnter: function () { return setVisible(true); },
7725
- onMouseLeave: function () { return setVisible(false); },
7309
+ onMouseEnter: function () { return toggleVisible(true); },
7310
+ onMouseLeave: function () { return toggleVisible(false); },
7726
7311
  }))),
7727
7312
  typeof window !== 'undefined' &&
7728
7313
  ReactDOM.createPortal(React.createElement(Transition$1, { in: _visible, mountOnEnter: true, onEnter: onShow, onExit: onHide, timeout: {
7729
7314
  enter: 0,
7730
7315
  exit: 200,
7731
- }, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', "bs-tooltip-".concat(getPlacement(placement, togglerRef.current)
7732
- .replace('left', 'start')
7733
- .replace('right', 'end')), 'fade', {
7316
+ }, unmountOnExit: true }, function (state) { return (React.createElement("div", __assign({ className: classNames('tooltip', 'bs-tooltip-auto', {
7317
+ fade: animation,
7734
7318
  show: state === 'entered',
7735
7319
  }, className), ref: tooltipRef, role: "tooltip" }, rest),
7736
- React.createElement("div", { "data-popper-arrow": true, className: "tooltip-arrow" }),
7320
+ React.createElement("div", { className: "tooltip-arrow" }),
7737
7321
  React.createElement("div", { className: "tooltip-inner" }, content))); }), document.body)));
7738
7322
  };
7739
7323
  CTooltip.propTypes = {
7324
+ animation: PropTypes.bool,
7740
7325
  children: PropTypes.node,
7741
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,
7742
7335
  offset: PropTypes.any,
7743
7336
  onHide: PropTypes.func,
7744
7337
  onShow: PropTypes.func,
@@ -7971,6 +7564,7 @@ exports.CPlaceholder = CPlaceholder;
7971
7564
  exports.CPopover = CPopover;
7972
7565
  exports.CProgress = CProgress;
7973
7566
  exports.CProgressBar = CProgressBar;
7567
+ exports.CProgressStacked = CProgressStacked;
7974
7568
  exports.CRow = CRow;
7975
7569
  exports.CSidebar = CSidebar;
7976
7570
  exports.CSidebarBrand = CSidebarBrand;
@@ -8003,4 +7597,5 @@ exports.CWidgetStatsE = CWidgetStatsE;
8003
7597
  exports.CWidgetStatsF = CWidgetStatsF;
8004
7598
  exports.useColorModes = useColorModes;
8005
7599
  exports.useForkedRef = useForkedRef;
7600
+ exports.usePopper = usePopper;
8006
7601
  //# sourceMappingURL=index.js.map