@coreui/react 2.5.7 → 2.5.8

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 (56) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/es/Aside.js +29 -37
  3. package/es/AsideToggler.js +36 -44
  4. package/es/Breadcrumb.js +51 -58
  5. package/es/Breadcrumb2.js +52 -60
  6. package/es/Footer.js +24 -32
  7. package/es/Header.js +23 -35
  8. package/es/HeaderDropdown.js +23 -27
  9. package/es/NavbarBrand.js +32 -39
  10. package/es/Shared/classes.js +0 -3
  11. package/es/Shared/element-closest.js +2 -0
  12. package/es/Shared/index.js +0 -1
  13. package/es/Shared/layout/layout.js +24 -16
  14. package/es/Shared/toggle-classes.js +2 -0
  15. package/es/Sidebar.js +43 -53
  16. package/es/SidebarFooter.js +19 -29
  17. package/es/SidebarForm.js +19 -29
  18. package/es/SidebarHeader.js +19 -29
  19. package/es/SidebarMinimizer.js +30 -35
  20. package/es/SidebarNav.js +128 -162
  21. package/es/SidebarNav2.js +178 -202
  22. package/es/SidebarToggler.js +35 -36
  23. package/es/Switch.js +59 -62
  24. package/lib/Aside.js +51 -60
  25. package/lib/AsideToggler.js +58 -67
  26. package/lib/Breadcrumb.js +71 -77
  27. package/lib/Breadcrumb2.js +72 -79
  28. package/lib/Footer.js +40 -47
  29. package/lib/Header.js +39 -50
  30. package/lib/HeaderDropdown.js +36 -37
  31. package/lib/NavbarBrand.js +50 -56
  32. package/lib/Shared/classes.js +8 -6
  33. package/lib/Shared/element-closest.js +3 -1
  34. package/lib/Shared/index.js +2 -3
  35. package/lib/Shared/layout/layout.js +31 -19
  36. package/lib/Shared/toggle-classes.js +6 -2
  37. package/lib/Sidebar.js +69 -81
  38. package/lib/SidebarFooter.js +33 -42
  39. package/lib/SidebarForm.js +33 -42
  40. package/lib/SidebarHeader.js +33 -42
  41. package/lib/SidebarMinimizer.js +51 -55
  42. package/lib/SidebarNav.js +154 -187
  43. package/lib/SidebarNav2.js +211 -236
  44. package/lib/SidebarToggler.js +56 -58
  45. package/lib/Switch.js +90 -92
  46. package/lib/index.js +36 -55
  47. package/package.json +14 -14
  48. package/umd/main.d0f057e5.css +5 -0
  49. package/umd/main.d0f057e5.css.map +1 -0
  50. package/umd/{@coreui/react.js → react.js} +918 -1076
  51. package/umd/react.min.js +38 -0
  52. package/umd/react.min.js.map +1 -0
  53. package/umd/@coreui/react.min.js +0 -44
  54. package/umd/@coreui/react.min.js.map +0 -1
  55. package/umd/main.a93373b7.css +0 -148
  56. package/umd/main.a93373b7.css.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  ### [@coreui/react](https://coreui.io/) changelog
2
2
 
3
+ ##### `v2.5.8`
4
+ - chore(demo/polyfill): update to core-js v3
5
+
6
+ ###### dependencies update
7
+ - update: `core-js` to `^3.6.5`
8
+ - update: `react` to `^16.13.1`
9
+ - update: `react-dom` to `^16.13.1`
10
+ - update: `react-router-dom` to `^5.2.0`
11
+ - update: `mutationobserver-shim` to `^0.3.5`
12
+ - update: `eslint` to `^7.0.0`
13
+ - update: `eslint-plugin-import` to `^2.20.2`
14
+ - update: `eslint-plugin-react` to `^7.20.0`
15
+ - update: `nwb` to `^0.24.7`
16
+ - update: `react` to `^16.13.1`
17
+ - update: `react-dom` to `^16.13.1`
18
+ - update: `react-router-dom` to `^5.2.0`
19
+ - update: `sinon` to `^9.0.2`
20
+
3
21
  ##### `v2.5.7`
4
22
  - fix(SidebarNav): add missing alternative icon config object
5
23
 
package/es/Aside.js CHANGED
@@ -1,20 +1,17 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
4
 
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
6
6
 
7
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
7
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
10
8
 
11
9
  import React, { Component } from 'react';
12
10
  import PropTypes from 'prop-types';
13
11
  import classNames from 'classnames';
14
12
  import { asideMenuCssClasses, checkBreakpoint, validBreakpoints } from './Shared';
15
13
  import toggleClasses from './Shared/toggle-classes';
16
-
17
- var propTypes = {
14
+ var propTypes = process.env.NODE_ENV !== "production" ? {
18
15
  children: PropTypes.node,
19
16
  className: PropTypes.string,
20
17
  display: PropTypes.string,
@@ -22,8 +19,7 @@ var propTypes = {
22
19
  isOpen: PropTypes.bool,
23
20
  offCanvas: PropTypes.bool,
24
21
  tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
25
- };
26
-
22
+ } : {};
27
23
  var defaultProps = {
28
24
  tag: 'aside',
29
25
  display: '',
@@ -32,64 +28,61 @@ var defaultProps = {
32
28
  offCanvas: true
33
29
  };
34
30
 
35
- var AppAside = function (_Component) {
36
- _inherits(AppAside, _Component);
31
+ var AppAside = /*#__PURE__*/function (_Component) {
32
+ _inheritsLoose(AppAside, _Component);
37
33
 
38
34
  function AppAside(props) {
39
- _classCallCheck(this, AppAside);
40
-
41
- var _this = _possibleConstructorReturn(this, _Component.call(this, props));
35
+ var _this;
42
36
 
43
- _this.isFixed = _this.isFixed.bind(_this);
44
- _this.isOffCanvas = _this.isOffCanvas.bind(_this);
45
- _this.displayBreakpoint = _this.displayBreakpoint.bind(_this);
37
+ _this = _Component.call(this, props) || this;
38
+ _this.isFixed = _this.isFixed.bind(_assertThisInitialized(_this));
39
+ _this.isOffCanvas = _this.isOffCanvas.bind(_assertThisInitialized(_this));
40
+ _this.displayBreakpoint = _this.displayBreakpoint.bind(_assertThisInitialized(_this));
46
41
  return _this;
47
42
  }
48
43
 
49
- AppAside.prototype.componentDidMount = function componentDidMount() {
44
+ var _proto = AppAside.prototype;
45
+
46
+ _proto.componentDidMount = function componentDidMount() {
50
47
  this.isFixed(this.props.fixed);
51
48
  this.isOffCanvas(this.props.offCanvas);
52
49
  this.displayBreakpoint(this.props.display);
53
50
  };
54
51
 
55
- AppAside.prototype.isFixed = function isFixed(fixed) {
52
+ _proto.isFixed = function isFixed(fixed) {
56
53
  if (fixed) {
57
54
  document.body.classList.add('aside-menu-fixed');
58
55
  }
59
56
  };
60
57
 
61
- AppAside.prototype.isOffCanvas = function isOffCanvas(offCanvas) {
58
+ _proto.isOffCanvas = function isOffCanvas(offCanvas) {
62
59
  if (offCanvas) {
63
60
  document.body.classList.add('aside-menu-off-canvas');
64
61
  }
65
62
  };
66
63
 
67
- AppAside.prototype.displayBreakpoint = function displayBreakpoint(display) {
64
+ _proto.displayBreakpoint = function displayBreakpoint(display) {
68
65
  if (display && checkBreakpoint(display, validBreakpoints)) {
69
- var cssClass = 'aside-menu-' + display + '-show';
66
+ var cssClass = "aside-menu-" + display + "-show";
70
67
  toggleClasses(cssClass, asideMenuCssClasses, true);
71
68
  }
72
69
  };
73
70
 
74
- AppAside.prototype.render = function render() {
75
- var _props = this.props,
76
- className = _props.className,
77
- children = _props.children,
78
- Tag = _props.tag,
79
- attributes = _objectWithoutProperties(_props, ['className', 'children', 'tag']);
71
+ _proto.render = function render() {
72
+ var _this$props = this.props,
73
+ className = _this$props.className,
74
+ children = _this$props.children,
75
+ Tag = _this$props.tag,
76
+ attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "children", "tag"]);
80
77
 
81
78
  delete attributes.display;
82
79
  delete attributes.fixed;
83
80
  delete attributes.offCanvas;
84
81
  delete attributes.isOpen;
85
-
86
82
  var classes = classNames(className, 'aside-menu');
87
-
88
- return React.createElement(
89
- Tag,
90
- _extends({}, attributes, { className: classes }),
91
- children
92
- );
83
+ return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {
84
+ className: classes
85
+ }), children);
93
86
  };
94
87
 
95
88
  return AppAside;
@@ -97,5 +90,4 @@ var AppAside = function (_Component) {
97
90
 
98
91
  AppAside.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
99
92
  AppAside.defaultProps = defaultProps;
100
-
101
93
  export default AppAside;
@@ -1,20 +1,17 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
4
 
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
6
6
 
7
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
7
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
10
8
 
11
9
  import React, { Component } from 'react';
12
10
  import PropTypes from 'prop-types';
13
11
  import classNames from 'classnames';
14
12
  import { asideMenuCssClasses, validBreakpoints, checkBreakpoint } from './Shared/index';
15
13
  import toggleClasses from './Shared/toggle-classes';
16
-
17
- var propTypes = {
14
+ var propTypes = process.env.NODE_ENV !== "production" ? {
18
15
  children: PropTypes.node,
19
16
  className: PropTypes.string,
20
17
  defaultOpen: PropTypes.bool,
@@ -22,8 +19,7 @@ var propTypes = {
22
19
  mobile: PropTypes.bool,
23
20
  tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
24
21
  type: PropTypes.string
25
- };
26
-
22
+ } : {};
27
23
  var defaultProps = {
28
24
  defaultOpen: false,
29
25
  display: 'lg',
@@ -32,69 +28,66 @@ var defaultProps = {
32
28
  type: 'button'
33
29
  };
34
30
 
35
- var AppAsideToggler = function (_Component) {
36
- _inherits(AppAsideToggler, _Component);
31
+ var AppAsideToggler = /*#__PURE__*/function (_Component) {
32
+ _inheritsLoose(AppAsideToggler, _Component);
37
33
 
38
34
  function AppAsideToggler(props) {
39
- _classCallCheck(this, AppAsideToggler);
40
-
41
- var _this = _possibleConstructorReturn(this, _Component.call(this, props));
42
-
43
- _this.asideToggle = _this.asideToggle.bind(_this);
35
+ var _this;
44
36
 
37
+ _this = _Component.call(this, props) || this;
38
+ _this.asideToggle = _this.asideToggle.bind(_assertThisInitialized(_this));
45
39
  _this.state = {};
46
40
  return _this;
47
41
  }
48
42
 
49
- AppAsideToggler.prototype.componentDidMount = function componentDidMount() {
43
+ var _proto = AppAsideToggler.prototype;
44
+
45
+ _proto.componentDidMount = function componentDidMount() {
50
46
  this.toggle(this.props.defaultOpen);
51
47
  };
52
48
 
53
- AppAsideToggler.prototype.toggle = function toggle(force) {
49
+ _proto.toggle = function toggle(force) {
54
50
  var _ref = [this.props.display, this.props.mobile],
55
51
  display = _ref[0],
56
52
  mobile = _ref[1];
57
-
58
53
  var cssClass = asideMenuCssClasses[0];
54
+
59
55
  if (!mobile && display && checkBreakpoint(display, validBreakpoints)) {
60
- cssClass = 'aside-menu-' + display + '-show';
56
+ cssClass = "aside-menu-" + display + "-show";
61
57
  }
58
+
62
59
  toggleClasses(cssClass, asideMenuCssClasses, force);
63
60
  };
64
61
 
65
- AppAsideToggler.prototype.asideToggle = function asideToggle(e) {
62
+ _proto.asideToggle = function asideToggle(e) {
66
63
  e.preventDefault();
67
64
  this.toggle();
68
65
  };
69
66
 
70
- AppAsideToggler.prototype.render = function render() {
67
+ _proto.render = function render() {
71
68
  var _this2 = this;
72
69
 
73
- var _props = this.props,
74
- className = _props.className,
75
- children = _props.children,
76
- type = _props.type,
77
- Tag = _props.tag,
78
- attributes = _objectWithoutProperties(_props, ['className', 'children', 'type', 'tag']);
70
+ var _this$props = this.props,
71
+ className = _this$props.className,
72
+ children = _this$props.children,
73
+ type = _this$props.type,
74
+ Tag = _this$props.tag,
75
+ attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "children", "type", "tag"]);
79
76
 
80
77
  delete attributes.defaultOpen;
81
78
  delete attributes.display;
82
79
  delete attributes.mobile;
83
-
84
80
  var classes = classNames(className, 'navbar-toggler');
85
-
86
- return React.createElement(
87
- Tag,
88
- _extends({
89
- type: type,
90
- className: classes
91
- }, attributes, {
92
- onClick: function onClick(event) {
93
- return _this2.asideToggle(event);
94
- }
95
- }),
96
- children || React.createElement('span', { className: 'navbar-toggler-icon' })
97
- );
81
+ return /*#__PURE__*/React.createElement(Tag, _extends({
82
+ type: type,
83
+ className: classes
84
+ }, attributes, {
85
+ onClick: function onClick(event) {
86
+ return _this2.asideToggle(event);
87
+ }
88
+ }), children || /*#__PURE__*/React.createElement("span", {
89
+ className: "navbar-toggler-icon"
90
+ }));
98
91
  };
99
92
 
100
93
  return AppAsideToggler;
@@ -102,5 +95,4 @@ var AppAsideToggler = function (_Component) {
102
95
 
103
96
  AppAsideToggler.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
104
97
  AppAsideToggler.defaultProps = defaultProps;
105
-
106
98
  export default AppAsideToggler;
package/es/Breadcrumb.js CHANGED
@@ -1,28 +1,21 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
4
 
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
10
6
 
11
7
  import React, { Component } from 'react';
12
8
  import { Route, Link, matchPath } from 'react-router-dom';
13
9
  import { Breadcrumb, BreadcrumbItem } from 'reactstrap';
14
10
  import PropTypes from 'prop-types';
15
11
  import classNames from 'classnames';
16
-
17
- var routes = void 0;
12
+ var routes;
18
13
 
19
14
  var getPaths = function getPaths(pathname) {
20
15
  var paths = ['/'];
21
-
22
16
  if (pathname === '/') return paths;
23
-
24
17
  pathname.split('/').reduce(function (prev, curr) {
25
- var currPath = prev + '/' + curr;
18
+ var currPath = prev + "/" + curr;
26
19
  paths.push(currPath);
27
20
  return currPath;
28
21
  });
@@ -31,33 +24,28 @@ var getPaths = function getPaths(pathname) {
31
24
 
32
25
  var findRouteName = function findRouteName(url) {
33
26
  var aroute = routes.find(function (route) {
34
- return matchPath(url, { path: route.path, exact: route.exact });
27
+ return matchPath(url, {
28
+ path: route.path,
29
+ exact: route.exact
30
+ });
35
31
  });
36
32
  return aroute && aroute.name ? aroute.name : null;
37
33
  };
38
34
 
39
35
  var BreadcrumbsItem = function BreadcrumbsItem(_ref) {
40
36
  var match = _ref.match;
41
-
42
37
  var routeName = findRouteName(match.url);
38
+
43
39
  if (routeName) {
44
- return (
45
- // eslint-disable-next-line react/prop-types
46
- match.isExact ? React.createElement(
47
- BreadcrumbItem,
48
- { active: true },
49
- routeName
50
- ) : React.createElement(
51
- BreadcrumbItem,
52
- null,
53
- React.createElement(
54
- Link,
55
- { to: match.url || '' },
56
- routeName
57
- )
58
- )
40
+ return (// eslint-disable-next-line react/prop-types
41
+ match.isExact ? /*#__PURE__*/React.createElement(BreadcrumbItem, {
42
+ active: true
43
+ }, routeName) : /*#__PURE__*/React.createElement(BreadcrumbItem, null, /*#__PURE__*/React.createElement(Link, {
44
+ to: match.url || ''
45
+ }, routeName))
59
46
  );
60
47
  }
48
+
61
49
  return null;
62
50
  };
63
51
 
@@ -70,57 +58,63 @@ BreadcrumbsItem.propTypes = process.env.NODE_ENV !== "production" ? {
70
58
  var Breadcrumbs = function Breadcrumbs(args) {
71
59
  var paths = getPaths(args.location.pathname);
72
60
  var items = paths.map(function (path, i) {
73
- return React.createElement(Route, { key: i.toString(), path: path, component: BreadcrumbsItem });
61
+ return /*#__PURE__*/React.createElement(Route, {
62
+ key: i.toString(),
63
+ path: path,
64
+ component: BreadcrumbsItem
65
+ });
74
66
  });
75
- return React.createElement(
76
- Breadcrumb,
77
- null,
78
- items
79
- );
67
+ return /*#__PURE__*/React.createElement(Breadcrumb, null, items);
80
68
  };
81
69
 
82
- var propTypes = {
70
+ var propTypes = process.env.NODE_ENV !== "production" ? {
83
71
  children: PropTypes.node,
84
72
  className: PropTypes.string,
85
73
  appRoutes: PropTypes.any,
86
74
  tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
87
- };
88
-
75
+ } : {};
89
76
  var defaultProps = {
90
77
  tag: 'div',
91
78
  className: '',
92
- appRoutes: [{ path: '/', exact: true, name: 'Home', component: null }]
79
+ appRoutes: [{
80
+ path: '/',
81
+ exact: true,
82
+ name: 'Home',
83
+ component: null
84
+ }]
93
85
  };
94
86
 
95
- var AppBreadcrumb = function (_Component) {
96
- _inherits(AppBreadcrumb, _Component);
87
+ var AppBreadcrumb = /*#__PURE__*/function (_Component) {
88
+ _inheritsLoose(AppBreadcrumb, _Component);
97
89
 
98
90
  function AppBreadcrumb(props) {
99
- _classCallCheck(this, AppBreadcrumb);
91
+ var _this;
100
92
 
101
- var _this = _possibleConstructorReturn(this, _Component.call(this, props));
102
-
103
- _this.state = { routes: props.appRoutes };
93
+ _this = _Component.call(this, props) || this;
94
+ _this.state = {
95
+ routes: props.appRoutes
96
+ };
104
97
  routes = _this.state.routes;
105
98
  return _this;
106
99
  }
107
100
 
108
- AppBreadcrumb.prototype.render = function render() {
109
- var _props = this.props,
110
- className = _props.className,
111
- Tag = _props.tag,
112
- attributes = _objectWithoutProperties(_props, ['className', 'tag']);
101
+ var _proto = AppBreadcrumb.prototype;
102
+
103
+ _proto.render = function render() {
104
+ var _this$props = this.props,
105
+ className = _this$props.className,
106
+ Tag = _this$props.tag,
107
+ attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "tag"]);
113
108
 
114
109
  delete attributes.children;
115
110
  delete attributes.appRoutes;
116
-
117
111
  var classes = classNames(className);
118
-
119
- return React.createElement(
120
- Tag,
121
- { className: classes },
122
- React.createElement(Route, _extends({ path: '/:path', component: Breadcrumbs }, attributes))
123
- );
112
+ return /*#__PURE__*/React.createElement(Tag, {
113
+ className: classes
114
+ }, /*#__PURE__*/React.createElement(Route, _extends({
115
+ path: "/:path",
116
+ component: Breadcrumbs
117
+ }, attributes)));
124
118
  };
125
119
 
126
120
  return AppBreadcrumb;
@@ -128,5 +122,4 @@ var AppBreadcrumb = function (_Component) {
128
122
 
129
123
  AppBreadcrumb.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
130
124
  AppBreadcrumb.defaultProps = defaultProps;
131
-
132
125
  export default AppBreadcrumb;
package/es/Breadcrumb2.js CHANGED
@@ -1,28 +1,21 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
4
 
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
10
6
 
11
7
  import React, { Component } from 'react';
12
8
  import { Breadcrumb, BreadcrumbItem } from 'reactstrap';
13
9
  import PropTypes from 'prop-types';
14
10
  import classNames from 'classnames';
15
-
16
- var routes = void 0;
17
- var router = void 0;
11
+ var routes;
12
+ var router;
18
13
 
19
14
  var getPaths = function getPaths(pathname) {
20
15
  var paths = ['/'];
21
-
22
16
  if (pathname === '/') return paths;
23
-
24
17
  pathname.split('/').reduce(function (prev, curr) {
25
- var currPath = prev + '/' + curr;
18
+ var currPath = prev + "/" + curr;
26
19
  paths.push(currPath);
27
20
  return currPath;
28
21
  });
@@ -32,34 +25,29 @@ var getPaths = function getPaths(pathname) {
32
25
  var findRouteName2 = function findRouteName2(url) {
33
26
  var matchPath = router.matchPath;
34
27
  var aroute = routes.find(function (route) {
35
- return matchPath(url, { path: route.path, exact: route.exact });
28
+ return matchPath(url, {
29
+ path: route.path,
30
+ exact: route.exact
31
+ });
36
32
  });
37
33
  return aroute && aroute.name ? aroute.name : null;
38
34
  };
39
35
 
40
36
  var BreadcrumbsItem2 = function BreadcrumbsItem2(_ref) {
41
37
  var match = _ref.match;
42
-
43
38
  var routeName = findRouteName2(match.url);
44
39
  var Link = router.Link;
40
+
45
41
  if (routeName) {
46
- return (
47
- // eslint-disable-next-line react/prop-types
48
- match.isExact ? React.createElement(
49
- BreadcrumbItem,
50
- { active: true },
51
- routeName
52
- ) : React.createElement(
53
- BreadcrumbItem,
54
- null,
55
- React.createElement(
56
- Link,
57
- { to: match.url || '' },
58
- routeName
59
- )
60
- )
42
+ return (// eslint-disable-next-line react/prop-types
43
+ match.isExact ? /*#__PURE__*/React.createElement(BreadcrumbItem, {
44
+ active: true
45
+ }, routeName) : /*#__PURE__*/React.createElement(BreadcrumbItem, null, /*#__PURE__*/React.createElement(Link, {
46
+ to: match.url || ''
47
+ }, routeName))
61
48
  );
62
49
  }
50
+
63
51
  return null;
64
52
  };
65
53
 
@@ -73,62 +61,67 @@ var Breadcrumbs2 = function Breadcrumbs2(args) {
73
61
  var Route = router.Route;
74
62
  var paths = getPaths(args.location.pathname);
75
63
  var items = paths.map(function (path, i) {
76
- return React.createElement(Route, { key: i.toString(), path: path, component: BreadcrumbsItem2 });
64
+ return /*#__PURE__*/React.createElement(Route, {
65
+ key: i.toString(),
66
+ path: path,
67
+ component: BreadcrumbsItem2
68
+ });
77
69
  });
78
- return React.createElement(
79
- Breadcrumb,
80
- null,
81
- items
82
- );
70
+ return /*#__PURE__*/React.createElement(Breadcrumb, null, items);
83
71
  };
84
72
 
85
- var propTypes = {
73
+ var propTypes = process.env.NODE_ENV !== "production" ? {
86
74
  children: PropTypes.node,
87
75
  className: PropTypes.string,
88
76
  appRoutes: PropTypes.any,
89
77
  tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
90
78
  router: PropTypes.any
91
- };
92
-
79
+ } : {};
93
80
  var defaultProps = {
94
81
  tag: 'div',
95
82
  className: '',
96
- appRoutes: [{ path: '/', exact: true, name: 'Home', component: null }]
83
+ appRoutes: [{
84
+ path: '/',
85
+ exact: true,
86
+ name: 'Home',
87
+ component: null
88
+ }]
97
89
  };
98
90
 
99
- var AppBreadcrumb2 = function (_Component) {
100
- _inherits(AppBreadcrumb2, _Component);
91
+ var AppBreadcrumb2 = /*#__PURE__*/function (_Component) {
92
+ _inheritsLoose(AppBreadcrumb2, _Component);
101
93
 
102
94
  function AppBreadcrumb2(props) {
103
- _classCallCheck(this, AppBreadcrumb2);
104
-
105
- var _this = _possibleConstructorReturn(this, _Component.call(this, props));
95
+ var _this;
106
96
 
107
- _this.state = { routes: props.appRoutes };
97
+ _this = _Component.call(this, props) || this;
98
+ _this.state = {
99
+ routes: props.appRoutes
100
+ };
108
101
  routes = _this.state.routes;
109
102
  router = props.router;
110
103
  return _this;
111
104
  }
112
105
 
113
- AppBreadcrumb2.prototype.render = function render() {
114
- var _props = this.props,
115
- className = _props.className,
116
- Tag = _props.tag,
117
- attributes = _objectWithoutProperties(_props, ['className', 'tag']);
106
+ var _proto = AppBreadcrumb2.prototype;
107
+
108
+ _proto.render = function render() {
109
+ var _this$props = this.props,
110
+ className = _this$props.className,
111
+ Tag = _this$props.tag,
112
+ attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "tag"]);
118
113
 
119
114
  delete attributes.children;
120
115
  delete attributes.appRoutes;
121
116
  delete attributes.router;
122
-
123
117
  var classes = classNames(className);
124
-
125
118
  var Route = router.Route;
126
-
127
- return React.createElement(
128
- Tag,
129
- { className: classes },
130
- React.createElement(Route, _extends({ path: '/:path', component: Breadcrumbs2 }, attributes))
131
- );
119
+ return /*#__PURE__*/React.createElement(Tag, {
120
+ className: classes
121
+ }, /*#__PURE__*/React.createElement(Route, _extends({
122
+ path: "/:path",
123
+ component: Breadcrumbs2
124
+ }, attributes)));
132
125
  };
133
126
 
134
127
  return AppBreadcrumb2;
@@ -136,5 +129,4 @@ var AppBreadcrumb2 = function (_Component) {
136
129
 
137
130
  AppBreadcrumb2.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
138
131
  AppBreadcrumb2.defaultProps = defaultProps;
139
-
140
132
  export default AppBreadcrumb2;