@instructure/ui-breadcrumb 10.16.1-snapshot-0 → 10.16.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/CHANGELOG.md +1 -1
- package/es/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.js +30 -19
- package/es/Breadcrumb/BreadcrumbLink/index.js +26 -19
- package/es/Breadcrumb/__new-tests__/Breadcrumb.test.js +66 -41
- package/es/Breadcrumb/index.js +21 -18
- package/lib/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.js +36 -26
- package/lib/Breadcrumb/BreadcrumbLink/index.js +26 -20
- package/lib/Breadcrumb/__new-tests__/Breadcrumb.test.js +69 -44
- package/lib/Breadcrumb/index.js +20 -18
- package/package.json +16 -16
- package/src/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.tsx +0 -1
- package/src/Breadcrumb/BreadcrumbLink/index.tsx +1 -1
- package/src/Breadcrumb/__new-tests__/Breadcrumb.test.tsx +1 -2
- package/src/Breadcrumb/index.tsx +6 -7
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.d.ts.map +1 -1
- package/types/Breadcrumb/BreadcrumbLink/index.d.ts +2 -2
- package/types/Breadcrumb/BreadcrumbLink/index.d.ts.map +1 -1
- package/types/Breadcrumb/__new-tests__/Breadcrumb.test.d.ts.map +1 -1
- package/types/Breadcrumb/index.d.ts +5 -7
- package/types/Breadcrumb/index.d.ts.map +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _react =
|
|
5
|
-
var _react2 = require("@testing-library/react");
|
|
4
|
+
var _react = require("@testing-library/react");
|
|
6
5
|
var _vitest = require("vitest");
|
|
7
6
|
require("@testing-library/jest-dom");
|
|
8
7
|
var _generateA11yTests = require("@instructure/ui-scripts/lib/test/generateA11yTests");
|
|
9
8
|
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
|
10
9
|
var _index = require("../index");
|
|
11
10
|
var _Breadcrumb8 = _interopRequireDefault(require("../__examples__/Breadcrumb.examples"));
|
|
11
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
12
12
|
var _Breadcrumb, _Breadcrumb2, _Breadcrumb3, _Breadcrumb4, _Breadcrumb5, _Breadcrumb6, _Breadcrumb7;
|
|
13
13
|
/*
|
|
14
14
|
* The MIT License (MIT)
|
|
@@ -51,11 +51,15 @@ describe('<Breadcrumb />', () => {
|
|
|
51
51
|
consoleErrorMock.mockRestore();
|
|
52
52
|
});
|
|
53
53
|
it('should be accessible', async () => {
|
|
54
|
-
const _render = (0,
|
|
55
|
-
label: TEST_LABEL
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
const _render = (0, _react.render)(_Breadcrumb || (_Breadcrumb = (0, _jsxRuntime.jsxs)(_index.Breadcrumb, {
|
|
55
|
+
label: TEST_LABEL,
|
|
56
|
+
children: [(0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
57
|
+
href: TEST_LINK,
|
|
58
|
+
children: TEST_TEXT_01
|
|
59
|
+
}), (0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
60
|
+
children: TEST_TEXT_02
|
|
61
|
+
})]
|
|
62
|
+
}))),
|
|
59
63
|
container = _render.container;
|
|
60
64
|
const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
|
|
61
65
|
expect(axeCheck).toBe(true);
|
|
@@ -65,37 +69,48 @@ describe('<Breadcrumb />', () => {
|
|
|
65
69
|
it.each(generatedComponents)('should be accessible with example: $description', async ({
|
|
66
70
|
content
|
|
67
71
|
}) => {
|
|
68
|
-
const _render2 = (0,
|
|
72
|
+
const _render2 = (0, _react.render)(content),
|
|
69
73
|
container = _render2.container;
|
|
70
74
|
const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
|
|
71
75
|
expect(axeCheck).toBe(true);
|
|
72
76
|
});
|
|
73
77
|
});
|
|
74
78
|
it('should render the label as an aria-label attribute', () => {
|
|
75
|
-
(0,
|
|
76
|
-
label: TEST_LABEL
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
(0, _react.render)(_Breadcrumb2 || (_Breadcrumb2 = (0, _jsxRuntime.jsx)(_index.Breadcrumb, {
|
|
80
|
+
label: TEST_LABEL,
|
|
81
|
+
children: (0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
82
|
+
children: TEST_TEXT_01
|
|
83
|
+
})
|
|
84
|
+
})));
|
|
85
|
+
const label = _react.screen.getByLabelText(TEST_LABEL);
|
|
79
86
|
expect(label).toBeInTheDocument();
|
|
80
87
|
expect(label).toHaveAttribute('aria-label', TEST_LABEL);
|
|
81
88
|
});
|
|
82
89
|
it('should render an icon as a separator', () => {
|
|
83
|
-
const _render3 = (0,
|
|
84
|
-
label: TEST_LABEL
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
const _render3 = (0, _react.render)(_Breadcrumb3 || (_Breadcrumb3 = (0, _jsxRuntime.jsxs)(_index.Breadcrumb, {
|
|
91
|
+
label: TEST_LABEL,
|
|
92
|
+
children: [(0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
93
|
+
href: TEST_LINK,
|
|
94
|
+
children: TEST_TEXT_01
|
|
95
|
+
}), (0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
96
|
+
children: TEST_TEXT_02
|
|
97
|
+
})]
|
|
98
|
+
}))),
|
|
88
99
|
container = _render3.container;
|
|
89
100
|
const icon = container.querySelector('svg');
|
|
90
101
|
expect(icon).toBeInTheDocument();
|
|
91
102
|
expect(icon).toHaveAttribute('aria-hidden', 'true');
|
|
92
103
|
});
|
|
93
104
|
it('should add aria-current="page" to the last element by default', () => {
|
|
94
|
-
const _render4 = (0,
|
|
95
|
-
label: TEST_LABEL
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
const _render4 = (0, _react.render)(_Breadcrumb4 || (_Breadcrumb4 = (0, _jsxRuntime.jsxs)(_index.Breadcrumb, {
|
|
106
|
+
label: TEST_LABEL,
|
|
107
|
+
children: [(0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
108
|
+
href: TEST_LINK,
|
|
109
|
+
children: TEST_TEXT_01
|
|
110
|
+
}), (0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
111
|
+
children: TEST_TEXT_02
|
|
112
|
+
})]
|
|
113
|
+
}))),
|
|
99
114
|
container = _render4.container;
|
|
100
115
|
const links = container.querySelectorAll('[class$="--block-link"]');
|
|
101
116
|
const firstLink = links[0];
|
|
@@ -104,12 +119,16 @@ describe('<Breadcrumb />', () => {
|
|
|
104
119
|
expect(lastLink).toHaveAttribute('aria-current', 'page');
|
|
105
120
|
});
|
|
106
121
|
it('should add aria-current="page" to the element if isCurrent is true', () => {
|
|
107
|
-
const _render5 = (0,
|
|
108
|
-
label: TEST_LABEL
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
const _render5 = (0, _react.render)(_Breadcrumb5 || (_Breadcrumb5 = (0, _jsxRuntime.jsxs)(_index.Breadcrumb, {
|
|
123
|
+
label: TEST_LABEL,
|
|
124
|
+
children: [(0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
125
|
+
isCurrentPage: true,
|
|
126
|
+
href: TEST_LINK,
|
|
127
|
+
children: TEST_TEXT_01
|
|
128
|
+
}), (0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
129
|
+
children: TEST_TEXT_02
|
|
130
|
+
})]
|
|
131
|
+
}))),
|
|
113
132
|
container = _render5.container;
|
|
114
133
|
const links = container.querySelectorAll('[class$="--block-link"]');
|
|
115
134
|
const firstLink = links[0];
|
|
@@ -117,25 +136,31 @@ describe('<Breadcrumb />', () => {
|
|
|
117
136
|
expect(firstLink).toHaveAttribute('aria-current', 'page');
|
|
118
137
|
expect(lastLink).not.toHaveAttribute('aria-current', 'page');
|
|
119
138
|
});
|
|
120
|
-
it('should throw a warning when multiple elements have isCurrent set to true
|
|
121
|
-
(0,
|
|
122
|
-
label: TEST_LABEL
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
it('should throw a warning when multiple elements have isCurrent set to true', () => {
|
|
140
|
+
(0, _react.render)(_Breadcrumb6 || (_Breadcrumb6 = (0, _jsxRuntime.jsxs)(_index.Breadcrumb, {
|
|
141
|
+
label: TEST_LABEL,
|
|
142
|
+
children: [(0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
143
|
+
isCurrentPage: true,
|
|
144
|
+
href: TEST_LINK,
|
|
145
|
+
children: TEST_TEXT_01
|
|
146
|
+
}), (0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
147
|
+
isCurrentPage: true,
|
|
148
|
+
children: TEST_TEXT_02
|
|
149
|
+
})]
|
|
150
|
+
})));
|
|
129
151
|
expect(consoleWarningMock).toHaveBeenCalledWith(expect.stringContaining('Warning: Multiple elements with isCurrentPage=true found. Only one element should be set to current.'));
|
|
130
152
|
});
|
|
131
153
|
it('should not add aria-current="page" to the last element if it set to false', () => {
|
|
132
|
-
const _render6 = (0,
|
|
133
|
-
label: TEST_LABEL
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
154
|
+
const _render6 = (0, _react.render)(_Breadcrumb7 || (_Breadcrumb7 = (0, _jsxRuntime.jsxs)(_index.Breadcrumb, {
|
|
155
|
+
label: TEST_LABEL,
|
|
156
|
+
children: [(0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
157
|
+
href: TEST_LINK,
|
|
158
|
+
children: TEST_TEXT_01
|
|
159
|
+
}), (0, _jsxRuntime.jsx)(_index.Breadcrumb.Link, {
|
|
160
|
+
isCurrentPage: false,
|
|
161
|
+
children: TEST_TEXT_02
|
|
162
|
+
})]
|
|
163
|
+
}))),
|
|
139
164
|
container = _render6.container;
|
|
140
165
|
const links = container.querySelectorAll('[class$="--block-link"]');
|
|
141
166
|
const firstLink = links[0];
|
package/lib/Breadcrumb/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
@@ -13,7 +12,7 @@ Object.defineProperty(exports, "BreadcrumbLink", {
|
|
|
13
12
|
}
|
|
14
13
|
});
|
|
15
14
|
exports.default = void 0;
|
|
16
|
-
var _react =
|
|
15
|
+
var _react = require("react");
|
|
17
16
|
var _View = require("@instructure/ui-view/lib/View");
|
|
18
17
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
19
18
|
var _emotion = require("@instructure/emotion");
|
|
@@ -22,6 +21,7 @@ var _BreadcrumbLink = require("./BreadcrumbLink");
|
|
|
22
21
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
23
22
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
24
23
|
var _props = require("./props");
|
|
24
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
25
25
|
var _dec, _dec2, _class, _Breadcrumb;
|
|
26
26
|
/*
|
|
27
27
|
* The MIT License (MIT)
|
|
@@ -46,7 +46,6 @@ var _dec, _dec2, _class, _Breadcrumb;
|
|
|
46
46
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
47
47
|
* SOFTWARE.
|
|
48
48
|
*/
|
|
49
|
-
/** @jsx jsx */
|
|
50
49
|
/**
|
|
51
50
|
---
|
|
52
51
|
category: components
|
|
@@ -60,7 +59,7 @@ let Breadcrumb = exports.Breadcrumb = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
60
59
|
this.ref = el;
|
|
61
60
|
};
|
|
62
61
|
this.addAriaCurrent = child => {
|
|
63
|
-
const updatedChild = /*#__PURE__*/_react.
|
|
62
|
+
const updatedChild = /*#__PURE__*/(0, _react.cloneElement)(child, {
|
|
64
63
|
'aria-current': 'page'
|
|
65
64
|
});
|
|
66
65
|
return updatedChild;
|
|
@@ -78,40 +77,43 @@ let Breadcrumb = exports.Breadcrumb = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
78
77
|
const _this$props3 = this.props,
|
|
79
78
|
styles = _this$props3.styles,
|
|
80
79
|
children = _this$props3.children;
|
|
81
|
-
const numChildren = _react.
|
|
80
|
+
const numChildren = _react.Children.count(children);
|
|
82
81
|
const inlineStyle = {
|
|
83
82
|
maxWidth: `${Math.floor(100 / numChildren)}%`
|
|
84
83
|
};
|
|
85
84
|
let isAriaCurrentSet = false;
|
|
86
|
-
return _react.
|
|
85
|
+
return _react.Children.map(children, (child, index) => {
|
|
87
86
|
const isLastElement = index === numChildren - 1;
|
|
88
|
-
if (/*#__PURE__*/_react.
|
|
87
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
89
88
|
const isCurrentPage = child.props.isCurrentPage || false;
|
|
90
89
|
if (isAriaCurrentSet && isCurrentPage) {}
|
|
91
90
|
if (isCurrentPage) {
|
|
92
91
|
isAriaCurrentSet = true;
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
|
-
return (0,
|
|
94
|
+
return (0, _jsxRuntime.jsxs)("li", {
|
|
96
95
|
css: styles === null || styles === void 0 ? void 0 : styles.crumb,
|
|
97
|
-
style: inlineStyle
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
style: inlineStyle,
|
|
97
|
+
children: [!isAriaCurrentSet && isLastElement && child.props.isCurrentPage !== false ? this.addAriaCurrent(child) : child, index < numChildren - 1 && (0, _jsxRuntime.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {
|
|
98
|
+
color: "auto",
|
|
99
|
+
css: styles === null || styles === void 0 ? void 0 : styles.separator
|
|
100
|
+
})]
|
|
101
|
+
});
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
render() {
|
|
105
105
|
const styles = this.props.styles;
|
|
106
|
-
return (0,
|
|
106
|
+
return (0, _jsxRuntime.jsx)(_View.View, {
|
|
107
107
|
role: "navigation",
|
|
108
108
|
as: "div",
|
|
109
109
|
margin: this.props.margin,
|
|
110
110
|
"aria-label": this.props.label,
|
|
111
|
-
elementRef: this.handleRef
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
elementRef: this.handleRef,
|
|
112
|
+
children: (0, _jsxRuntime.jsx)("ol", {
|
|
113
|
+
css: styles === null || styles === void 0 ? void 0 : styles.breadcrumb,
|
|
114
|
+
children: this.renderChildren()
|
|
115
|
+
})
|
|
116
|
+
});
|
|
115
117
|
}
|
|
116
118
|
}, _Breadcrumb.displayName = "Breadcrumb", _Breadcrumb.componentId = 'Breadcrumb', _Breadcrumb.propTypes = _props.propTypes, _Breadcrumb.allowedProps = _props.allowedProps, _Breadcrumb.defaultProps = {
|
|
117
119
|
size: 'medium',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-breadcrumb",
|
|
3
|
-
"version": "10.16.1
|
|
3
|
+
"version": "10.16.1",
|
|
4
4
|
"description": "A breadcrumb component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,27 +23,27 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "10.16.1
|
|
27
|
-
"@instructure/ui-babel-preset": "10.16.1
|
|
28
|
-
"@instructure/ui-scripts": "10.16.1
|
|
29
|
-
"@instructure/ui-themes": "10.16.1
|
|
26
|
+
"@instructure/ui-axe-check": "10.16.1",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.16.1",
|
|
28
|
+
"@instructure/ui-scripts": "10.16.1",
|
|
29
|
+
"@instructure/ui-themes": "10.16.1",
|
|
30
30
|
"@testing-library/jest-dom": "^6.6.3",
|
|
31
31
|
"@testing-library/react": "^16.0.1",
|
|
32
32
|
"vitest": "^2.1.8"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.26.0",
|
|
36
|
-
"@instructure/emotion": "10.16.1
|
|
37
|
-
"@instructure/shared-types": "10.16.1
|
|
38
|
-
"@instructure/ui-icons": "10.16.1
|
|
39
|
-
"@instructure/ui-link": "10.16.1
|
|
40
|
-
"@instructure/ui-prop-types": "10.16.1
|
|
41
|
-
"@instructure/ui-react-utils": "10.16.1
|
|
42
|
-
"@instructure/ui-testable": "10.16.1
|
|
43
|
-
"@instructure/ui-tooltip": "10.16.1
|
|
44
|
-
"@instructure/ui-truncate-text": "10.16.1
|
|
45
|
-
"@instructure/ui-utils": "10.16.1
|
|
46
|
-
"@instructure/ui-view": "10.16.1
|
|
36
|
+
"@instructure/emotion": "10.16.1",
|
|
37
|
+
"@instructure/shared-types": "10.16.1",
|
|
38
|
+
"@instructure/ui-icons": "10.16.1",
|
|
39
|
+
"@instructure/ui-link": "10.16.1",
|
|
40
|
+
"@instructure/ui-prop-types": "10.16.1",
|
|
41
|
+
"@instructure/ui-react-utils": "10.16.1",
|
|
42
|
+
"@instructure/ui-testable": "10.16.1",
|
|
43
|
+
"@instructure/ui-tooltip": "10.16.1",
|
|
44
|
+
"@instructure/ui-truncate-text": "10.16.1",
|
|
45
|
+
"@instructure/ui-utils": "10.16.1",
|
|
46
|
+
"@instructure/ui-view": "10.16.1",
|
|
47
47
|
"prop-types": "^15.8.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import React from 'react'
|
|
26
25
|
import { render, screen } from '@testing-library/react'
|
|
27
26
|
import { vi } from 'vitest'
|
|
28
27
|
import type { MockInstance } from 'vitest'
|
|
@@ -144,7 +143,7 @@ describe('<Breadcrumb />', () => {
|
|
|
144
143
|
expect(lastLink).not.toHaveAttribute('aria-current', 'page')
|
|
145
144
|
})
|
|
146
145
|
|
|
147
|
-
it('should throw a warning when multiple elements have isCurrent set to true
|
|
146
|
+
it('should throw a warning when multiple elements have isCurrent set to true', () => {
|
|
148
147
|
render(
|
|
149
148
|
<Breadcrumb label={TEST_LABEL}>
|
|
150
149
|
<Breadcrumb.Link isCurrentPage href={TEST_LINK}>
|
package/src/Breadcrumb/index.tsx
CHANGED
|
@@ -22,13 +22,12 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
import React, { Component } from 'react'
|
|
25
|
+
import { isValidElement, cloneElement, Children, Component } from 'react'
|
|
27
26
|
|
|
28
27
|
import { View } from '@instructure/ui-view'
|
|
29
28
|
import { testable } from '@instructure/ui-testable'
|
|
30
29
|
|
|
31
|
-
import { withStyle
|
|
30
|
+
import { withStyle } from '@instructure/emotion'
|
|
32
31
|
import { IconArrowOpenEndSolid } from '@instructure/ui-icons'
|
|
33
32
|
import { BreadcrumbLink } from './BreadcrumbLink'
|
|
34
33
|
|
|
@@ -63,7 +62,7 @@ class Breadcrumb extends Component<BreadcrumbProps> {
|
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
addAriaCurrent = (child: React.ReactNode) => {
|
|
66
|
-
const updatedChild =
|
|
65
|
+
const updatedChild = cloneElement(
|
|
67
66
|
child as React.ReactElement<{ 'aria-current'?: string }>,
|
|
68
67
|
{
|
|
69
68
|
'aria-current': 'page'
|
|
@@ -83,15 +82,15 @@ class Breadcrumb extends Component<BreadcrumbProps> {
|
|
|
83
82
|
|
|
84
83
|
renderChildren() {
|
|
85
84
|
const { styles, children } = this.props
|
|
86
|
-
const numChildren =
|
|
85
|
+
const numChildren = Children.count(children)
|
|
87
86
|
const inlineStyle = {
|
|
88
87
|
maxWidth: `${Math.floor(100 / numChildren)}%`
|
|
89
88
|
}
|
|
90
89
|
let isAriaCurrentSet = false
|
|
91
90
|
|
|
92
|
-
return
|
|
91
|
+
return Children.map(children, (child, index) => {
|
|
93
92
|
const isLastElement = index === numChildren - 1
|
|
94
|
-
if (
|
|
93
|
+
if (isValidElement(child)) {
|
|
95
94
|
const isCurrentPage = child.props.isCurrentPage || false
|
|
96
95
|
if (isAriaCurrentSet && isCurrentPage) {
|
|
97
96
|
console.warn(
|