@coreui/react-pro 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
 
44
44
  Several quick start options are available:
45
45
 
46
- - [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.1.0.zip)
46
+ - [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.1.1.zip)
47
47
  - Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
48
48
  - Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
49
49
  - Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
@@ -5,7 +5,7 @@ export interface CPopoverProps {
5
5
  /**
6
6
  * Content node for your component.
7
7
  */
8
- content: ReactNode;
8
+ content: ReactNode | string;
9
9
  /**
10
10
  * Offset of the popover relative to its target.
11
11
  */
@@ -21,7 +21,7 @@ export interface CPopoverProps {
21
21
  /**
22
22
  * Title node for your component.
23
23
  */
24
- title?: ReactNode;
24
+ title?: ReactNode | string;
25
25
  /**
26
26
  * Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.
27
27
  *
@@ -1,13 +1,13 @@
1
1
  import React, { MouseEvent, ReactNode } from 'react';
2
2
  import { CTableBodyProps } from '../table/CTableBody';
3
- import { Item, ScopedColumns } from './CSmartTableInterface';
3
+ import { ItemInternal, ScopedColumns } from './CSmartTableInterface';
4
4
  export interface CSmartTableBodyProps extends CTableBodyProps {
5
5
  clickableRows?: boolean;
6
- currentItems: Item[];
6
+ currentItems: ItemInternal[];
7
7
  firstItemOnActivePageIndex: number;
8
8
  noItemsLabel?: string | ReactNode;
9
9
  onRowChecked?: (id: number, value: boolean) => void;
10
- onRowClick?: (item: Item, index: number, columnName: string, event: MouseEvent | boolean) => void;
10
+ onRowClick?: (item: ItemInternal, index: number, columnName: string, event: MouseEvent | boolean) => void;
11
11
  rawColumnNames: string[];
12
12
  scopedColumns?: ScopedColumns;
13
13
  selectable?: boolean;
@@ -7,10 +7,10 @@ import { CTableHeaderCellProps } from '../table/CTableHeaderCell';
7
7
  import { CTableRowProps } from '../table/CTableRow';
8
8
  import { CTableHeadProps } from '../table/CTableHead';
9
9
  export interface Column {
10
- sorter?: boolean;
11
- key: string;
12
- label?: string;
13
10
  filter?: boolean;
11
+ label?: string;
12
+ key: string;
13
+ sorter?: boolean;
14
14
  _style?: any;
15
15
  _props?: CTableHeaderCellProps;
16
16
  }
@@ -23,9 +23,11 @@ export interface ColumnFilterValue {
23
23
  }
24
24
  export interface Item {
25
25
  [key: string]: number | string | any;
26
+ _props?: CTableRowProps;
27
+ _selected?: boolean;
28
+ }
29
+ export interface ItemInternal extends Item {
26
30
  _id: number;
27
- _props: CTableRowProps;
28
- _selected: boolean;
29
31
  }
30
32
  export interface ItemsPerPageSelect {
31
33
  external?: boolean;
@@ -37,6 +39,7 @@ export interface Sorter {
37
39
  external?: boolean;
38
40
  }
39
41
  export interface ScopedColumns {
42
+ [key: string]: any;
40
43
  details?: (a: Item, b: number) => ReactNode;
41
44
  }
42
45
  export interface SorterValue {
@@ -104,7 +107,7 @@ export interface CSmartTableProps extends HTMLAttributes<HTMLDivElement> {
104
107
  * - sorter (Boolean) - disables sorting of the column when set to false
105
108
  * - filter (Boolean) - removes filter from column when set to false.
106
109
  */
107
- columns?: Column[] | string[];
110
+ columns?: (string | Column)[];
108
111
  /**
109
112
  * Enables table sorting by column value. Sorting will be performed corectly only if values in column are of one type: string (case insensitive) or number.
110
113
  *
@@ -5,7 +5,7 @@ export interface CTooltipProps {
5
5
  /**
6
6
  * Content node for your component.
7
7
  */
8
- content: ReactNode;
8
+ content: ReactNode | string;
9
9
  /**
10
10
  * Callback fired when the component requests to be hidden.
11
11
  */
package/dist/index.es.js CHANGED
@@ -358,6 +358,8 @@ var ReactPropTypesSecret$7 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
358
358
 
359
359
  var ReactPropTypesSecret_1$1 = ReactPropTypesSecret$7;
360
360
 
361
+ var has$4 = Function.call.bind(Object.prototype.hasOwnProperty);
362
+
361
363
  /**
362
364
  * Copyright (c) 2013-present, Facebook, Inc.
363
365
  *
@@ -370,7 +372,7 @@ var printWarning$4 = function() {};
370
372
  if (process.env.NODE_ENV !== 'production') {
371
373
  var ReactPropTypesSecret$6 = ReactPropTypesSecret_1$1;
372
374
  var loggedTypeFailures$1 = {};
373
- var has$3 = Function.call.bind(Object.prototype.hasOwnProperty);
375
+ var has$3 = has$4;
374
376
 
375
377
  printWarning$4 = function(text) {
376
378
  var message = 'Warning: ' + text;
@@ -382,7 +384,7 @@ if (process.env.NODE_ENV !== 'production') {
382
384
  // This error was thrown as a convenience so that you can use this stack
383
385
  // to find the callsite that caused this warning to fire.
384
386
  throw new Error(message);
385
- } catch (x) {}
387
+ } catch (x) { /**/ }
386
388
  };
387
389
  }
388
390
 
@@ -411,7 +413,8 @@ function checkPropTypes$3(typeSpecs, values, location, componentName, getStack)
411
413
  if (typeof typeSpecs[typeSpecName] !== 'function') {
412
414
  var err = Error(
413
415
  (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
414
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
416
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
417
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
415
418
  );
416
419
  err.name = 'Invariant Violation';
417
420
  throw err;
@@ -470,9 +473,9 @@ var ReactIs$3 = reactIs$1.exports;
470
473
  var assign$1 = objectAssign$1;
471
474
 
472
475
  var ReactPropTypesSecret$5 = ReactPropTypesSecret_1$1;
476
+ var has$2 = has$4;
473
477
  var checkPropTypes$2 = checkPropTypes_1$1;
474
478
 
475
- var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
476
479
  var printWarning$3 = function() {};
477
480
 
478
481
  if (process.env.NODE_ENV !== 'production') {
@@ -573,6 +576,7 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
573
576
  // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
574
577
  var ReactPropTypes = {
575
578
  array: createPrimitiveTypeChecker('array'),
579
+ bigint: createPrimitiveTypeChecker('bigint'),
576
580
  bool: createPrimitiveTypeChecker('boolean'),
577
581
  func: createPrimitiveTypeChecker('function'),
578
582
  number: createPrimitiveTypeChecker('number'),
@@ -618,8 +622,9 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
618
622
  * is prohibitively expensive if they are created too often, such as what
619
623
  * happens in oneOfType() for any type before the one that matched.
620
624
  */
621
- function PropTypeError(message) {
625
+ function PropTypeError(message, data) {
622
626
  this.message = message;
627
+ this.data = data && typeof data === 'object' ? data: {};
623
628
  this.stack = '';
624
629
  }
625
630
  // Make `instanceof Error` still work for returned errors.
@@ -654,7 +659,7 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
654
659
  ) {
655
660
  printWarning$3(
656
661
  'You are manually calling a React.PropTypes validation ' +
657
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
662
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
658
663
  'and will throw in the standalone `prop-types` package. ' +
659
664
  'You may be seeing this warning due to a third-party PropTypes ' +
660
665
  'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
@@ -693,7 +698,10 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
693
698
  // 'of type `object`'.
694
699
  var preciseType = getPreciseType(propValue);
695
700
 
696
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
701
+ return new PropTypeError(
702
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
703
+ {expectedType: expectedType}
704
+ );
697
705
  }
698
706
  return null;
699
707
  }
@@ -837,14 +845,19 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
837
845
  }
838
846
 
839
847
  function validate(props, propName, componentName, location, propFullName) {
848
+ var expectedTypes = [];
840
849
  for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
841
850
  var checker = arrayOfTypeCheckers[i];
842
- if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$5) == null) {
851
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$5);
852
+ if (checkerResult == null) {
843
853
  return null;
844
854
  }
855
+ if (checkerResult.data.hasOwnProperty('expectedType')) {
856
+ expectedTypes.push(checkerResult.data.expectedType);
857
+ }
845
858
  }
846
-
847
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
859
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
860
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
848
861
  }
849
862
  return createChainableTypeChecker(validate);
850
863
  }
@@ -859,6 +872,13 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
859
872
  return createChainableTypeChecker(validate);
860
873
  }
861
874
 
875
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
876
+ return new PropTypeError(
877
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
878
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
879
+ );
880
+ }
881
+
862
882
  function createShapeTypeChecker(shapeTypes) {
863
883
  function validate(props, propName, componentName, location, propFullName) {
864
884
  var propValue = props[propName];
@@ -868,8 +888,8 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
868
888
  }
869
889
  for (var key in shapeTypes) {
870
890
  var checker = shapeTypes[key];
871
- if (!checker) {
872
- continue;
891
+ if (typeof checker !== 'function') {
892
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
873
893
  }
874
894
  var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$5);
875
895
  if (error) {
@@ -888,16 +908,18 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
888
908
  if (propType !== 'object') {
889
909
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
890
910
  }
891
- // We need to check all keys in case some are required but missing from
892
- // props.
911
+ // We need to check all keys in case some are required but missing from props.
893
912
  var allKeys = assign$1({}, props[propName], shapeTypes);
894
913
  for (var key in allKeys) {
895
914
  var checker = shapeTypes[key];
915
+ if (has$2(shapeTypes, key) && typeof checker !== 'function') {
916
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
917
+ }
896
918
  if (!checker) {
897
919
  return new PropTypeError(
898
920
  'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
899
921
  '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
900
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
922
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
901
923
  );
902
924
  }
903
925
  var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$5);
@@ -1082,6 +1104,7 @@ var factoryWithThrowingShims$1 = function() {
1082
1104
  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1083
1105
  var ReactPropTypes = {
1084
1106
  array: shim,
1107
+ bigint: shim,
1085
1108
  bool: shim,
1086
1109
  func: shim,
1087
1110
  number: shim,
@@ -2360,6 +2383,7 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, T
2360
2383
  var CSSTransition$1 = CSSTransition;
2361
2384
 
2362
2385
  // code borrowed from https://github.com/reach/reach-ui
2386
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2363
2387
  function useForkedRef() {
2364
2388
  var refs = [];
2365
2389
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -2369,6 +2393,7 @@ function useForkedRef() {
2369
2393
  if (refs.every(function (ref) { return ref == null; })) {
2370
2394
  return null;
2371
2395
  }
2396
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2372
2397
  return function (node) {
2373
2398
  refs.forEach(function (ref) {
2374
2399
  assignRef(ref, node);
@@ -2376,7 +2401,10 @@ function useForkedRef() {
2376
2401
  };
2377
2402
  }, refs);
2378
2403
  }
2379
- function assignRef(ref, value) {
2404
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2405
+ function assignRef(ref,
2406
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2407
+ value) {
2380
2408
  if (ref == null)
2381
2409
  return;
2382
2410
  if (isFunction(ref)) {
@@ -2391,6 +2419,7 @@ function assignRef(ref, value) {
2391
2419
  }
2392
2420
  }
2393
2421
  }
2422
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
2394
2423
  function isFunction(value) {
2395
2424
  return !!(value && {}.toString.call(value) == '[object Function]');
2396
2425
  }
@@ -7334,12 +7363,12 @@ var CPopover = function (_a) {
7334
7363
  };
7335
7364
  CPopover.propTypes = {
7336
7365
  children: PropTypes$1.any,
7337
- content: PropTypes$1.node,
7366
+ content: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.node]),
7338
7367
  placement: PropTypes$1.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
7339
7368
  offset: PropTypes$1.any,
7340
7369
  onHide: PropTypes$1.func,
7341
7370
  onShow: PropTypes$1.func,
7342
- title: PropTypes$1.string,
7371
+ title: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.node]),
7343
7372
  trigger: triggerPropType,
7344
7373
  visible: PropTypes$1.bool,
7345
7374
  };
@@ -9069,7 +9098,7 @@ var CIcon = forwardRef(function (_a, ref) {
9069
9098
  var iconName = useMemo(function () {
9070
9099
  return _icon && typeof _icon === 'string' && _icon.includes('-') ? toCamelCase(_icon) : _icon;
9071
9100
  }, [change]);
9072
- var titleCode = title ? "<title>" + title + "</title>" : '';
9101
+ var titleCode = title ? "<title>".concat(title, "</title>") : '';
9073
9102
  var code = useMemo(function () {
9074
9103
  if (Array.isArray(_icon)) {
9075
9104
  return _icon;
@@ -9085,13 +9114,13 @@ var CIcon = forwardRef(function (_a, ref) {
9085
9114
  return Array.isArray(code) && code.length > 1 ? code[0] : '64 64';
9086
9115
  })();
9087
9116
  var viewBox = (function () {
9088
- return rest['viewBox'] || "0 0 " + scale;
9117
+ return rest['viewBox'] || "0 0 ".concat(scale);
9089
9118
  })();
9090
9119
  // render
9091
9120
  var _className = customClassName
9092
9121
  ? classNames(customClassName)
9093
9122
  : classNames('icon', (_b = {},
9094
- _b["icon-" + size] = size,
9123
+ _b["icon-".concat(size)] = size,
9095
9124
  _b["icon-custom-size"] = height || width,
9096
9125
  _b), className);
9097
9126
  return use ? (React__default.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", className: _className }, (height && { height: height }), (width && { width: width }), { role: "img" }, rest, { ref: ref }),
@@ -9290,7 +9319,7 @@ var CSmartTableHead = forwardRef(function (_a, ref) {
9290
9319
  CSmartTableHead.propTypes = {
9291
9320
  columnFilter: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.object]),
9292
9321
  columnFilterState: PropTypes$1.object,
9293
- columnSorter: PropTypes$1.bool,
9322
+ columnSorter: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.object]),
9294
9323
  component: PropTypes$1.elementType,
9295
9324
  children: PropTypes$1.node,
9296
9325
  columns: PropTypes$1.arrayOf(PropTypes$1.oneOfType([PropTypes$1.any, PropTypes$1.string])).isRequired,
@@ -9882,7 +9911,7 @@ var CTooltip = function (_a) {
9882
9911
  };
9883
9912
  CTooltip.propTypes = {
9884
9913
  children: PropTypes$1.any,
9885
- content: PropTypes$1.node,
9914
+ content: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.node]),
9886
9915
  placement: PropTypes$1.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
9887
9916
  onHide: PropTypes$1.func,
9888
9917
  onShow: PropTypes$1.func,