@coreui/react 4.3.1 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/dist/components/Types.d.ts +6 -6
  3. package/dist/components/button/CButton.d.ts +4 -3
  4. package/dist/components/dropdown/CDropdown.d.ts +4 -6
  5. package/dist/components/dropdown/CDropdownItem.d.ts +1 -1
  6. package/dist/components/form/CFormCheck.d.ts +1 -1
  7. package/dist/components/form/CFormLabel.d.ts +2 -2
  8. package/dist/components/form/CFormRange.d.ts +1 -1
  9. package/dist/components/form/CFormSelect.d.ts +1 -1
  10. package/dist/components/form/CInputGroupText.d.ts +2 -2
  11. package/dist/components/form/index.d.ts +3 -1
  12. package/dist/components/grid/CCol.d.ts +3 -3
  13. package/dist/components/grid/CRow.d.ts +1 -1
  14. package/dist/components/header/CHeaderBrand.d.ts +2 -2
  15. package/dist/components/link/CLink.d.ts +2 -2
  16. package/dist/components/list-group/CListGroupItem.d.ts +3 -3
  17. package/dist/components/nav/CNavLink.d.ts +1 -1
  18. package/dist/components/toast/CToastClose.d.ts +4 -1
  19. package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
  20. package/dist/index.es.js +107 -70
  21. package/dist/index.es.js.map +1 -1
  22. package/dist/index.js +404 -372
  23. package/dist/index.js.map +1 -1
  24. package/dist/utils/hooks/useForkedRef.d.ts +1 -1
  25. package/package.json +12 -13
  26. package/src/components/button/CButton.tsx +3 -3
  27. package/src/components/carousel/CCarousel.tsx +1 -1
  28. package/src/components/dropdown/CDropdown.tsx +7 -5
  29. package/src/components/dropdown/CDropdownMenu.tsx +8 -0
  30. package/src/components/dropdown/CDropdownToggle.tsx +1 -1
  31. package/src/components/form/CFormLabel.tsx +2 -2
  32. package/src/components/form/CFormRange.tsx +1 -1
  33. package/src/components/form/CInputGroupText.tsx +3 -2
  34. package/src/components/form/__tests__/CFormRange.spec.tsx +2 -2
  35. package/src/components/form/__tests__/CInputGroupText.spec.tsx +9 -0
  36. package/src/components/form/__tests__/__snapshots__/CInputGroupText.spec.tsx.snap +11 -0
  37. package/src/components/form/index.ts +4 -0
  38. package/src/components/header/CHeaderBrand.tsx +3 -2
  39. package/src/components/link/CLink.tsx +2 -2
  40. package/src/components/list-group/CListGroupItem.tsx +2 -2
  41. package/src/components/modal/CModal.tsx +18 -1
  42. package/src/components/nav/CNavGroup.tsx +4 -1
  43. package/src/components/sidebar/CSidebarNav.tsx +4 -1
  44. package/src/components/toast/CToastClose.tsx +4 -1
  45. package/src/components/toast/__tests__/__snapshots__/CToast.spec.tsx.snap +13 -0
package/README.md CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  Several quick start options are available:
48
48
 
49
- - [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.3.1.zip)
49
+ - [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.4.1.zip)
50
50
  - Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
51
51
  - Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
52
52
  - Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
@@ -1,12 +1,12 @@
1
1
  import PropTypes from 'prop-types';
2
- export declare type Breakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
3
- export declare type Colors = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string;
2
+ export type Breakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
3
+ export type Colors = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string;
4
4
  export declare const colorPropType: PropTypes.Requireable<string>;
5
- export declare type Placements = 'auto' | 'auto-start' | 'auto-end' | 'top-end' | 'top' | 'top-start' | 'bottom-end' | 'bottom' | 'bottom-start' | 'right-start' | 'right' | 'right-end' | 'left-start' | 'left' | 'left-end' | undefined;
5
+ export type Placements = 'auto' | 'auto-start' | 'auto-end' | 'top-end' | 'top' | 'top-start' | 'bottom-end' | 'bottom' | 'bottom-start' | 'right-start' | 'right' | 'right-end' | 'left-start' | 'left' | 'left-end' | undefined;
6
6
  export declare const placementPropType: PropTypes.Requireable<Placements>;
7
- export declare type Shapes = 'rounded' | 'rounded-top' | 'rounded-end' | 'rounded-bottom' | 'rounded-start' | 'rounded-circle' | 'rounded-pill' | 'rounded-0' | 'rounded-1' | 'rounded-2' | 'rounded-3' | string;
7
+ export type Shapes = 'rounded' | 'rounded-top' | 'rounded-end' | 'rounded-bottom' | 'rounded-start' | 'rounded-circle' | 'rounded-pill' | 'rounded-0' | 'rounded-1' | 'rounded-2' | 'rounded-3' | string;
8
8
  export declare const shapePropType: PropTypes.Requireable<string>;
9
- export declare type TextColors = Colors | 'white' | 'muted' | 'high-emphasis' | 'medium-emphasis' | 'disabled' | 'high-emphasis-inverse' | 'medium-emphasis-inverse' | 'disabled-inverse' | string;
9
+ export type TextColors = Colors | 'white' | 'muted' | 'high-emphasis' | 'medium-emphasis' | 'disabled' | 'high-emphasis-inverse' | 'medium-emphasis-inverse' | 'disabled-inverse' | string;
10
10
  export declare const textColorsPropType: PropTypes.Requireable<string>;
11
- export declare type Triggers = 'hover' | 'focus' | 'click';
11
+ export type Triggers = 'hover' | 'focus' | 'click';
12
12
  export declare const triggerPropType: PropTypes.Requireable<Triggers>;
@@ -1,6 +1,7 @@
1
- import React, { ButtonHTMLAttributes, ElementType } from 'react';
1
+ import React, { ElementType } from 'react';
2
2
  import { Colors, Shapes } from '../Types';
3
- export interface CButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
+ import { CLinkProps } from '../link/CLink';
4
+ export interface CButtonProps extends Omit<CLinkProps, 'size'> {
4
5
  /**
5
6
  * Toggle the active state for the component.
6
7
  */
@@ -51,4 +52,4 @@ export interface CButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
51
52
  */
52
53
  variant?: 'outline' | 'ghost';
53
54
  }
54
- export declare const CButton: React.ForwardRefExoticComponent<CButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
55
+ export declare const CButton: React.ForwardRefExoticComponent<CButtonProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
@@ -1,7 +1,7 @@
1
1
  import React, { ElementType, HTMLAttributes, RefObject } from 'react';
2
2
  import { Placements } from '../Types';
3
- export declare type Directions = 'start' | 'end';
4
- export declare type Breakpoints = {
3
+ export type Directions = 'start' | 'end';
4
+ export type Breakpoints = {
5
5
  xs: Directions;
6
6
  } | {
7
7
  sm: Directions;
@@ -14,7 +14,7 @@ export declare type Breakpoints = {
14
14
  } | {
15
15
  xxl: Directions;
16
16
  };
17
- export declare type Alignments = Directions | Breakpoints;
17
+ export type Alignments = Directions | Breakpoints;
18
18
  export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIElement> {
19
19
  /**
20
20
  * Set aligment of dropdown menu.
@@ -44,10 +44,8 @@ export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIEl
44
44
  dark?: boolean;
45
45
  /**
46
46
  * Sets a specified direction and location of the dropdown menu.
47
- *
48
- * @type 'dropup' | 'dropend' | 'dropstart'
49
47
  */
50
- direction?: 'dropup' | 'dropend' | 'dropstart';
48
+ direction?: 'center' | 'dropup' | 'dropup-center' | 'dropend' | 'dropstart';
51
49
  /**
52
50
  * Callback fired when the component requests to be hidden.
53
51
  */
@@ -10,4 +10,4 @@ export interface CDropdownItemProps extends CLinkProps {
10
10
  */
11
11
  component?: string | ElementType;
12
12
  }
13
- export declare const CDropdownItem: React.ForwardRefExoticComponent<CDropdownItemProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
13
+ export declare const CDropdownItem: React.ForwardRefExoticComponent<CDropdownItemProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
@@ -1,7 +1,7 @@
1
1
  import React, { InputHTMLAttributes, ReactNode } from 'react';
2
2
  import { Colors, Shapes } from '../Types';
3
3
  import { CFormControlValidationProps } from './CFormControlValidation';
4
- export declare type ButtonObject = {
4
+ export type ButtonObject = {
5
5
  /**
6
6
  * Sets the color context of the component to one of CoreUI’s themed colors.
7
7
  *
@@ -1,5 +1,5 @@
1
- import React, { AllHTMLAttributes } from 'react';
2
- export interface CFormLabelProps extends AllHTMLAttributes<HTMLLabelElement> {
1
+ import React, { LabelHTMLAttributes } from 'react';
2
+ export interface CFormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
3
3
  /**
4
4
  * A string of all className you want applied to the component.
5
5
  */
@@ -33,7 +33,7 @@ export interface CFormRangeProps extends InputHTMLAttributes<HTMLInputElement> {
33
33
  /**
34
34
  * Specifies the interval between legal numbers in the component.
35
35
  */
36
- steps: number;
36
+ step?: number;
37
37
  /**
38
38
  * The `value` attribute of component.
39
39
  *
@@ -1,6 +1,6 @@
1
1
  import React, { ChangeEventHandler, InputHTMLAttributes } from 'react';
2
2
  import { CFormControlWrapperProps } from './CFormControlWrapper';
3
- declare type Option = {
3
+ type Option = {
4
4
  disabled?: boolean;
5
5
  label?: string;
6
6
  value?: string;
@@ -1,5 +1,5 @@
1
- import React, { ElementType, HTMLAttributes } from 'react';
2
- export interface CInputGroupTextProps extends HTMLAttributes<HTMLLabelElement | HTMLSpanElement> {
1
+ import React, { ElementType, LabelHTMLAttributes } from 'react';
2
+ export interface CInputGroupTextProps extends LabelHTMLAttributes<HTMLLabelElement | HTMLSpanElement> {
3
3
  /**
4
4
  * A string of all className you want applied to the component.
5
5
  */
@@ -1,5 +1,7 @@
1
1
  import { CForm } from './CForm';
2
2
  import { CFormCheck } from './CFormCheck';
3
+ import { CFormControlValidation } from './CFormControlValidation';
4
+ import { CFormControlWrapper } from './CFormControlWrapper';
3
5
  import { CFormFeedback } from './CFormFeedback';
4
6
  import { CFormFloating } from './CFormFloating';
5
7
  import { CFormInput } from './CFormInput';
@@ -11,4 +13,4 @@ import { CFormText } from './CFormText';
11
13
  import { CFormTextarea } from './CFormTextarea';
12
14
  import { CInputGroup } from './CInputGroup';
13
15
  import { CInputGroupText } from './CInputGroupText';
14
- export { CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CInputGroup, CInputGroupText, };
16
+ export { CForm, CFormCheck, CFormControlValidation, CFormControlWrapper, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CInputGroup, CInputGroupText, };
@@ -1,11 +1,11 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- declare type Span = 'auto' | number | string | boolean | null;
3
- declare type BPObject = {
2
+ type Span = 'auto' | number | string | boolean | null;
3
+ type BPObject = {
4
4
  span?: Span;
5
5
  offset?: number | string | null;
6
6
  order?: 'first' | 'last' | number | string | null;
7
7
  };
8
- declare type Col = Span | BPObject;
8
+ type Col = Span | BPObject;
9
9
  export interface CColProps extends HTMLAttributes<HTMLDivElement> {
10
10
  /**
11
11
  * A string of all className you want applied to the base component.
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- export declare type BPObject = {
2
+ export type BPObject = {
3
3
  cols?: 'auto' | number | string | null;
4
4
  gutter?: number | string | null;
5
5
  gutterX?: number | string | null;
@@ -1,5 +1,5 @@
1
- import React, { ElementType, HTMLAttributes } from 'react';
2
- export interface CHeaderBrandProps extends HTMLAttributes<HTMLAnchorElement | HTMLSpanElement> {
1
+ import React, { ElementType, AnchorHTMLAttributes } from 'react';
2
+ export interface CHeaderBrandProps extends AnchorHTMLAttributes<HTMLAnchorElement | HTMLSpanElement> {
3
3
  /**
4
4
  * A string of all className you want applied to the component.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import React, { AllHTMLAttributes, ElementType } from 'react';
2
- export interface CLinkProps extends AllHTMLAttributes<HTMLElement> {
2
+ export interface CLinkProps extends AllHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> {
3
3
  /**
4
4
  * Toggle the active state for the component.
5
5
  */
@@ -21,4 +21,4 @@ export interface CLinkProps extends AllHTMLAttributes<HTMLElement> {
21
21
  */
22
22
  href?: string;
23
23
  }
24
- export declare const CLink: React.ForwardRefExoticComponent<CLinkProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
24
+ export declare const CLink: React.ForwardRefExoticComponent<CLinkProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
@@ -1,6 +1,6 @@
1
- import React, { ElementType, HTMLAttributes } from 'react';
1
+ import React, { ElementType, AnchorHTMLAttributes } from 'react';
2
2
  import { Colors } from '../Types';
3
- export interface CListGroupItemProps extends HTMLAttributes<HTMLLIElement | HTMLAnchorElement | HTMLButtonElement> {
3
+ export interface CListGroupItemProps extends AnchorHTMLAttributes<HTMLLIElement | HTMLAnchorElement | HTMLButtonElement> {
4
4
  /**
5
5
  * Toggle the active state for the component.
6
6
  */
@@ -24,4 +24,4 @@ export interface CListGroupItemProps extends HTMLAttributes<HTMLLIElement | HTML
24
24
  */
25
25
  component?: string | ElementType;
26
26
  }
27
- export declare const CListGroupItem: React.ForwardRefExoticComponent<CListGroupItemProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement | HTMLLIElement>>;
27
+ export declare const CListGroupItem: React.ForwardRefExoticComponent<CListGroupItemProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement | HTMLLIElement>>;
@@ -26,4 +26,4 @@ export interface CNavLinkProps extends Omit<CLinkProps, 'idx'> {
26
26
  */
27
27
  to?: string;
28
28
  }
29
- export declare const CNavLink: React.ForwardRefExoticComponent<CNavLinkProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement | HTMLLIElement>>;
29
+ export declare const CNavLink: React.ForwardRefExoticComponent<CNavLinkProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement | HTMLLIElement>>;
@@ -1,9 +1,12 @@
1
1
  import React, { ElementType } from 'react';
2
2
  import { CCloseButtonProps } from '../close-button/CCloseButton';
3
- export interface CToastCloseProps extends CCloseButtonProps {
3
+ import type { CButtonProps } from '../button/CButton';
4
+ type CombineButtonProps = CCloseButtonProps & CButtonProps;
5
+ export interface CToastCloseProps extends CombineButtonProps {
4
6
  /**
5
7
  * Component used for the root node. Either a string to use a HTML element or a component.
6
8
  */
7
9
  component?: string | ElementType;
8
10
  }
9
11
  export declare const CToastClose: React.ForwardRefExoticComponent<CToastCloseProps & React.RefAttributes<HTMLButtonElement>>;
12
+ export {};
@@ -1,6 +1,6 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
2
  import { Colors } from '../Types';
3
- declare type Value = {
3
+ type Value = {
4
4
  title?: string | ReactNode;
5
5
  value?: number | string | ReactNode;
6
6
  };
package/dist/index.es.js CHANGED
@@ -1236,9 +1236,9 @@ if (process.env.NODE_ENV !== 'production') {
1236
1236
  var classnames = {exports: {}};
1237
1237
 
1238
1238
  /*!
1239
- Copyright (c) 2018 Jed Watson.
1240
- Licensed under the MIT License (MIT), see
1241
- http://jedwatson.github.io/classnames
1239
+ Copyright (c) 2018 Jed Watson.
1240
+ Licensed under the MIT License (MIT), see
1241
+ http://jedwatson.github.io/classnames
1242
1242
  */
1243
1243
 
1244
1244
  (function (module) {
@@ -1267,14 +1267,15 @@ var classnames = {exports: {}};
1267
1267
  }
1268
1268
  }
1269
1269
  } else if (argType === 'object') {
1270
- if (arg.toString === Object.prototype.toString) {
1271
- for (var key in arg) {
1272
- if (hasOwn.call(arg, key) && arg[key]) {
1273
- classes.push(key);
1274
- }
1275
- }
1276
- } else {
1270
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
1277
1271
  classes.push(arg.toString());
1272
+ continue;
1273
+ }
1274
+
1275
+ for (var key in arg) {
1276
+ if (hasOwn.call(arg, key) && arg[key]) {
1277
+ classes.push(key);
1278
+ }
1278
1279
  }
1279
1280
  }
1280
1281
  }
@@ -1337,14 +1338,12 @@ function _extends() {
1337
1338
  _extends = Object.assign ? Object.assign.bind() : function (target) {
1338
1339
  for (var i = 1; i < arguments.length; i++) {
1339
1340
  var source = arguments[i];
1340
-
1341
1341
  for (var key in source) {
1342
1342
  if (Object.prototype.hasOwnProperty.call(source, key)) {
1343
1343
  target[key] = source[key];
1344
1344
  }
1345
1345
  }
1346
1346
  }
1347
-
1348
1347
  return target;
1349
1348
  };
1350
1349
  return _extends.apply(this, arguments);
@@ -1355,13 +1354,11 @@ function _objectWithoutPropertiesLoose(source, excluded) {
1355
1354
  var target = {};
1356
1355
  var sourceKeys = Object.keys(source);
1357
1356
  var key, i;
1358
-
1359
1357
  for (i = 0; i < sourceKeys.length; i++) {
1360
1358
  key = sourceKeys[i];
1361
1359
  if (excluded.indexOf(key) >= 0) continue;
1362
1360
  target[key] = source[key];
1363
1361
  }
1364
-
1365
1362
  return target;
1366
1363
  }
1367
1364
 
@@ -2471,7 +2468,6 @@ function _assertThisInitialized(self) {
2471
2468
  if (self === void 0) {
2472
2469
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2473
2470
  }
2474
-
2475
2471
  return self;
2476
2472
  }
2477
2473
 
@@ -4228,38 +4224,57 @@ var max = Math.max;
4228
4224
  var min = Math.min;
4229
4225
  var round = Math.round;
4230
4226
 
4231
- function getBoundingClientRect(element, includeScale) {
4227
+ function getUAString() {
4228
+ var uaData = navigator.userAgentData;
4229
+
4230
+ if (uaData != null && uaData.brands) {
4231
+ return uaData.brands.map(function (item) {
4232
+ return item.brand + "/" + item.version;
4233
+ }).join(' ');
4234
+ }
4235
+
4236
+ return navigator.userAgent;
4237
+ }
4238
+
4239
+ function isLayoutViewport() {
4240
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
4241
+ }
4242
+
4243
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
4232
4244
  if (includeScale === void 0) {
4233
4245
  includeScale = false;
4234
4246
  }
4235
4247
 
4236
- var rect = element.getBoundingClientRect();
4248
+ if (isFixedStrategy === void 0) {
4249
+ isFixedStrategy = false;
4250
+ }
4251
+
4252
+ var clientRect = element.getBoundingClientRect();
4237
4253
  var scaleX = 1;
4238
4254
  var scaleY = 1;
4239
4255
 
4240
- if (isHTMLElement(element) && includeScale) {
4241
- var offsetHeight = element.offsetHeight;
4242
- var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
4243
- // Fallback to 1 in case both values are `0`
4244
-
4245
- if (offsetWidth > 0) {
4246
- scaleX = round(rect.width) / offsetWidth || 1;
4247
- }
4248
-
4249
- if (offsetHeight > 0) {
4250
- scaleY = round(rect.height) / offsetHeight || 1;
4251
- }
4256
+ if (includeScale && isHTMLElement(element)) {
4257
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
4258
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
4252
4259
  }
4253
4260
 
4261
+ var _ref = isElement(element) ? getWindow(element) : window,
4262
+ visualViewport = _ref.visualViewport;
4263
+
4264
+ var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
4265
+ var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
4266
+ var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
4267
+ var width = clientRect.width / scaleX;
4268
+ var height = clientRect.height / scaleY;
4254
4269
  return {
4255
- width: rect.width / scaleX,
4256
- height: rect.height / scaleY,
4257
- top: rect.top / scaleY,
4258
- right: rect.right / scaleX,
4259
- bottom: rect.bottom / scaleY,
4260
- left: rect.left / scaleX,
4261
- x: rect.left / scaleX,
4262
- y: rect.top / scaleY
4270
+ width: width,
4271
+ height: height,
4272
+ top: y,
4273
+ right: x + width,
4274
+ bottom: y + height,
4275
+ left: x,
4276
+ x: x,
4277
+ y: y
4263
4278
  };
4264
4279
  }
4265
4280
 
@@ -4354,8 +4369,8 @@ function getTrueOffsetParent(element) {
4354
4369
 
4355
4370
 
4356
4371
  function getContainingBlock(element) {
4357
- var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
4358
- var isIE = navigator.userAgent.indexOf('Trident') !== -1;
4372
+ var isFirefox = /firefox/i.test(getUAString());
4373
+ var isIE = /Trident/i.test(getUAString());
4359
4374
 
4360
4375
  if (isIE && isHTMLElement(element)) {
4361
4376
  // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
@@ -4795,31 +4810,21 @@ function getWindowScrollBarX(element) {
4795
4810
  return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
4796
4811
  }
4797
4812
 
4798
- function getViewportRect(element) {
4813
+ function getViewportRect(element, strategy) {
4799
4814
  var win = getWindow(element);
4800
4815
  var html = getDocumentElement(element);
4801
4816
  var visualViewport = win.visualViewport;
4802
4817
  var width = html.clientWidth;
4803
4818
  var height = html.clientHeight;
4804
4819
  var x = 0;
4805
- var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
4806
- // can be obscured underneath it.
4807
- // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
4808
- // if it isn't open, so if this isn't available, the popper will be detected
4809
- // to overflow the bottom of the screen too early.
4820
+ var y = 0;
4810
4821
 
4811
4822
  if (visualViewport) {
4812
4823
  width = visualViewport.width;
4813
- height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
4814
- // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
4815
- // errors due to floating point numbers, so we need to check precision.
4816
- // Safari returns a number <= 0, usually < -1 when pinch-zoomed
4817
- // Feature detection fails in mobile emulation mode in Chrome.
4818
- // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
4819
- // 0.001
4820
- // Fallback here: "Not Safari" userAgent
4821
-
4822
- if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
4824
+ height = visualViewport.height;
4825
+ var layoutViewport = isLayoutViewport();
4826
+
4827
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
4823
4828
  x = visualViewport.offsetLeft;
4824
4829
  y = visualViewport.offsetTop;
4825
4830
  }
@@ -4913,8 +4918,8 @@ function rectToClientRect(rect) {
4913
4918
  });
4914
4919
  }
4915
4920
 
4916
- function getInnerBoundingClientRect(element) {
4917
- var rect = getBoundingClientRect(element);
4921
+ function getInnerBoundingClientRect(element, strategy) {
4922
+ var rect = getBoundingClientRect(element, false, strategy === 'fixed');
4918
4923
  rect.top = rect.top + element.clientTop;
4919
4924
  rect.left = rect.left + element.clientLeft;
4920
4925
  rect.bottom = rect.top + element.clientHeight;
@@ -4926,8 +4931,8 @@ function getInnerBoundingClientRect(element) {
4926
4931
  return rect;
4927
4932
  }
4928
4933
 
4929
- function getClientRectFromMixedType(element, clippingParent) {
4930
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
4934
+ function getClientRectFromMixedType(element, clippingParent, strategy) {
4935
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
4931
4936
  } // A "clipping parent" is an overflowable container with the characteristic of
4932
4937
  // clipping (or hiding) overflowing elements with a position different from
4933
4938
  // `initial`
@@ -4950,18 +4955,18 @@ function getClippingParents(element) {
4950
4955
  // clipping parents
4951
4956
 
4952
4957
 
4953
- function getClippingRect(element, boundary, rootBoundary) {
4958
+ function getClippingRect(element, boundary, rootBoundary, strategy) {
4954
4959
  var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
4955
4960
  var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
4956
4961
  var firstClippingParent = clippingParents[0];
4957
4962
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
4958
- var rect = getClientRectFromMixedType(element, clippingParent);
4963
+ var rect = getClientRectFromMixedType(element, clippingParent, strategy);
4959
4964
  accRect.top = max(rect.top, accRect.top);
4960
4965
  accRect.right = min(rect.right, accRect.right);
4961
4966
  accRect.bottom = min(rect.bottom, accRect.bottom);
4962
4967
  accRect.left = max(rect.left, accRect.left);
4963
4968
  return accRect;
4964
- }, getClientRectFromMixedType(element, firstClippingParent));
4969
+ }, getClientRectFromMixedType(element, firstClippingParent, strategy));
4965
4970
  clippingRect.width = clippingRect.right - clippingRect.left;
4966
4971
  clippingRect.height = clippingRect.bottom - clippingRect.top;
4967
4972
  clippingRect.x = clippingRect.left;
@@ -5042,6 +5047,8 @@ function detectOverflow(state, options) {
5042
5047
  var _options = options,
5043
5048
  _options$placement = _options.placement,
5044
5049
  placement = _options$placement === void 0 ? state.placement : _options$placement,
5050
+ _options$strategy = _options.strategy,
5051
+ strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
5045
5052
  _options$boundary = _options.boundary,
5046
5053
  boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
5047
5054
  _options$rootBoundary = _options.rootBoundary,
@@ -5056,7 +5063,7 @@ function detectOverflow(state, options) {
5056
5063
  var altContext = elementContext === popper ? reference : popper;
5057
5064
  var popperRect = state.rects.popper;
5058
5065
  var element = state.elements[altBoundary ? altContext : elementContext];
5059
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
5066
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
5060
5067
  var referenceClientRect = getBoundingClientRect(state.elements.reference);
5061
5068
  var popperOffsets = computeOffsets({
5062
5069
  reference: referenceClientRect,
@@ -5574,7 +5581,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
5574
5581
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
5575
5582
  var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
5576
5583
  var documentElement = getDocumentElement(offsetParent);
5577
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
5584
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
5578
5585
  var scroll = {
5579
5586
  scrollLeft: 0,
5580
5587
  scrollTop: 0
@@ -6446,7 +6453,11 @@ var CDropdown = forwardRef(function (_a, ref) {
6446
6453
  };
6447
6454
  var _className = classNames(variant === 'nav-item' ? 'nav-item dropdown' : variant, {
6448
6455
  show: _visible,
6449
- }, direction, className);
6456
+ }, direction === 'center'
6457
+ ? 'dropdown-center'
6458
+ : direction === 'dropup-center'
6459
+ ? 'dropup dropup-center'
6460
+ : direction, className);
6450
6461
  useEffect(function () {
6451
6462
  setVisible(visible);
6452
6463
  }, [visible]);
@@ -6480,7 +6491,7 @@ CDropdown.propTypes = {
6480
6491
  className: propTypes.exports.string,
6481
6492
  component: propTypes.exports.elementType,
6482
6493
  dark: propTypes.exports.bool,
6483
- direction: propTypes.exports.oneOf(['dropup', 'dropend', 'dropstart']),
6494
+ direction: propTypes.exports.oneOf(['center', 'dropup', 'dropup-center', 'dropend', 'dropstart']),
6484
6495
  onHide: propTypes.exports.func,
6485
6496
  onShow: propTypes.exports.func,
6486
6497
  placement: placementPropType,
@@ -6569,9 +6580,15 @@ var CDropdownMenu = function (_a) {
6569
6580
  }
6570
6581
  };
6571
6582
  var _placement = placement;
6583
+ if (direction === 'center') {
6584
+ _placement = 'bottom';
6585
+ }
6572
6586
  if (direction === 'dropup') {
6573
6587
  _placement = 'top-start';
6574
6588
  }
6589
+ if (direction === 'dropup-center') {
6590
+ _placement = 'top';
6591
+ }
6575
6592
  if (direction === 'dropend') {
6576
6593
  _placement = 'right-start';
6577
6594
  }
@@ -7332,6 +7349,10 @@ var CModal = forwardRef(function (_a, ref) {
7332
7349
  useLayoutEffect(function () {
7333
7350
  if (_visible) {
7334
7351
  document.body.classList.add('modal-open');
7352
+ if (backdrop) {
7353
+ document.body.style.overflow = 'hidden';
7354
+ document.body.style.paddingRight = '0px';
7355
+ }
7335
7356
  setTimeout(function () {
7336
7357
  var _a;
7337
7358
  (_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -7339,8 +7360,18 @@ var CModal = forwardRef(function (_a, ref) {
7339
7360
  }
7340
7361
  else {
7341
7362
  document.body.classList.remove('modal-open');
7363
+ if (backdrop) {
7364
+ document.body.style.removeProperty('overflow');
7365
+ document.body.style.removeProperty('padding-right');
7366
+ }
7342
7367
  }
7343
- return function () { return document.body.classList.remove('modal-open'); };
7368
+ return function () {
7369
+ document.body.classList.remove('modal-open');
7370
+ if (backdrop) {
7371
+ document.body.style.removeProperty('overflow');
7372
+ document.body.style.removeProperty('padding-right');
7373
+ }
7374
+ };
7344
7375
  }, [_visible]);
7345
7376
  var handleClickOutside = function (event) {
7346
7377
  if (modalContentRef.current &&
@@ -7483,7 +7514,10 @@ var CSidebarNav = forwardRef(function (_a, ref) {
7483
7514
  return (React__default.createElement("ul", __assign({ className: classes, ref: ref }, rest),
7484
7515
  React__default.createElement(CNavContext.Provider, { value: CNavContextValues }, React__default.Children.map(children, function (child, index) {
7485
7516
  if (React__default.isValidElement(child)) {
7486
- return React__default.cloneElement(child, { key: index, idx: "".concat(index) });
7517
+ return React__default.cloneElement(child, {
7518
+ key: index,
7519
+ idx: "".concat(index),
7520
+ });
7487
7521
  }
7488
7522
  return;
7489
7523
  }))));
@@ -7543,7 +7577,10 @@ var CNavGroup = forwardRef(function (_a, ref) {
7543
7577
  compact: compact,
7544
7578
  }), style: __assign(__assign({}, style), transitionStyles[state]), ref: navItemsRef }, React__default.Children.map(children, function (child, index) {
7545
7579
  if (React__default.isValidElement(child)) {
7546
- return React__default.cloneElement(child, { key: index, idx: "".concat(idx, ".").concat(index) });
7580
+ return React__default.cloneElement(child, {
7581
+ key: index,
7582
+ idx: "".concat(idx, ".").concat(index),
7583
+ });
7547
7584
  }
7548
7585
  return;
7549
7586
  }))); })));
@@ -8725,5 +8762,5 @@ CWidgetStatsF.propTypes = {
8725
8762
  };
8726
8763
  CWidgetStatsF.displayName = 'CWidgetStatsF';
8727
8764
 
8728
- export { CAccordion, CAccordionBody, CAccordionButton, CAccordionCollapse, CAccordionHeader, CAccordionItem, CAlert, CAlertHeading, CAlertLink, CAvatar, CBackdrop, CBadge, CBreadcrumb, CBreadcrumbItem, CButton, CButtonGroup, CButtonToolbar, CCallout, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCloseButton, CCol, CCollapse, CContainer, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownItemPlain, CDropdownMenu, CDropdownToggle, CFooter, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderText, CHeaderToggler, CImage, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CPagination, CPaginationItem, CPlaceholder, CPopover, CProgress, CProgressBar, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarToggler, CSpinner, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF };
8765
+ export { CAccordion, CAccordionBody, CAccordionButton, CAccordionCollapse, CAccordionHeader, CAccordionItem, CAlert, CAlertHeading, CAlertLink, CAvatar, CBackdrop, CBadge, CBreadcrumb, CBreadcrumbItem, CButton, CButtonGroup, CButtonToolbar, CCallout, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCloseButton, CCol, CCollapse, CContainer, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownItemPlain, CDropdownMenu, CDropdownToggle, CFooter, CForm, CFormCheck, CFormControlValidation, CFormControlWrapper, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderText, CHeaderToggler, CImage, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CPagination, CPaginationItem, CPlaceholder, CPopover, CProgress, CProgressBar, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarToggler, CSpinner, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF };
8729
8766
  //# sourceMappingURL=index.es.js.map