@instructure/ui-breadcrumb 8.13.1-snapshot.9 → 8.14.1-snapshot.15
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 +4 -0
- package/es/Breadcrumb/BreadcrumbLink/BreadcrumbLinkLocator.js +2 -1
- package/es/Breadcrumb/BreadcrumbLink/index.js +2 -3
- package/es/Breadcrumb/BreadcrumbLink/props.js +0 -23
- package/es/Breadcrumb/BreadcrumbLocator.js +2 -1
- package/es/Breadcrumb/index.js +13 -8
- package/es/Breadcrumb/props.js +0 -17
- package/lib/Breadcrumb/BreadcrumbLink/BreadcrumbLinkLocator.js +1 -0
- package/lib/Breadcrumb/BreadcrumbLink/index.js +2 -3
- package/lib/Breadcrumb/BreadcrumbLink/props.js +0 -23
- package/lib/Breadcrumb/BreadcrumbLocator.js +1 -0
- package/lib/Breadcrumb/index.js +16 -9
- package/lib/Breadcrumb/props.js +0 -17
- package/package.json +16 -16
- package/src/Breadcrumb/BreadcrumbLink/index.tsx +1 -2
- package/src/Breadcrumb/BreadcrumbLink/props.ts +25 -21
- package/src/Breadcrumb/index.tsx +6 -10
- package/src/Breadcrumb/props.ts +14 -14
- package/tsconfig.build.json +20 -2
- package/tsconfig.build.tsbuildinfo +1 -0
- package/types/Breadcrumb/BreadcrumbLink/BreadcrumbLinkLocator.d.ts +52 -52
- package/types/Breadcrumb/BreadcrumbLink/index.d.ts +5 -4
- package/types/Breadcrumb/BreadcrumbLink/index.d.ts.map +1 -1
- package/types/Breadcrumb/BreadcrumbLink/props.d.ts +24 -3
- package/types/Breadcrumb/BreadcrumbLink/props.d.ts.map +1 -1
- package/types/Breadcrumb/BreadcrumbLocator.d.ts +182 -182
- package/types/Breadcrumb/index.d.ts +2 -1
- package/types/Breadcrumb/index.d.ts.map +1 -1
- package/types/Breadcrumb/props.d.ts +14 -0
- package/types/Breadcrumb/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.14.0](https://github.com/instructure/instructure-ui/compare/v8.13.0...v8.14.0) (2021-12-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-breadcrumb
|
|
9
|
+
|
|
6
10
|
# [8.13.0](https://github.com/instructure/instructure-ui/compare/v8.12.0...v8.13.0) (2021-12-01)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-breadcrumb
|
|
@@ -22,5 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { BreadcrumbLink } from './index';
|
|
25
|
+
import { BreadcrumbLink } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
26
|
+
|
|
26
27
|
export const BreadcrumbLinkLocator = locator(BreadcrumbLink.selector);
|
|
@@ -35,6 +35,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
35
35
|
parent: Breadcrumb
|
|
36
36
|
id: Breadcrumb.Link
|
|
37
37
|
---
|
|
38
|
+
@tsProps
|
|
38
39
|
**/
|
|
39
40
|
let BreadcrumbLink = (_dec = testable(), _dec(_class = (_temp = _class2 = class BreadcrumbLink extends Component {
|
|
40
41
|
constructor() {
|
|
@@ -54,9 +55,7 @@ let BreadcrumbLink = (_dec = testable(), _dec(_class = (_temp = _class2 = class
|
|
|
54
55
|
iconPlacement = _this$props.iconPlacement,
|
|
55
56
|
onClick = _this$props.onClick;
|
|
56
57
|
const props = omitProps(this.props, BreadcrumbLink.allowedProps);
|
|
57
|
-
return /*#__PURE__*/React.createElement(Link, Object.assign({
|
|
58
|
-
as: this.element
|
|
59
|
-
}, props, {
|
|
58
|
+
return /*#__PURE__*/React.createElement(Link, Object.assign({}, props, {
|
|
60
59
|
href: href,
|
|
61
60
|
renderIcon: renderIcon,
|
|
62
61
|
iconPlacement: iconPlacement,
|
|
@@ -23,34 +23,11 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
const propTypes = {
|
|
26
|
-
/**
|
|
27
|
-
* Content to render as the crumb, generally should be text.
|
|
28
|
-
*/
|
|
29
26
|
children: PropTypes.node.isRequired,
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Link the crumb should direct to; if an href is provided, the crumb will render as a link
|
|
33
|
-
*/
|
|
34
27
|
href: PropTypes.string,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* If the Breadcrumb.Link has an onClick prop (and no href), it will render as a button
|
|
38
|
-
*/
|
|
39
28
|
onClick: PropTypes.func,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Sets the font-size of the breadcrumb text
|
|
43
|
-
*/
|
|
44
29
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Add an icon to the Breadcrumb.Link
|
|
48
|
-
*/
|
|
49
30
|
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Place the icon before or after the text in the Breadcrumb.Link
|
|
53
|
-
*/
|
|
54
31
|
iconPlacement: PropTypes.oneOf(['start', 'end'])
|
|
55
32
|
};
|
|
56
33
|
const allowedProps = ['children', 'href', 'iconPlacement', 'onClick', 'renderIcon', 'size'];
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
25
|
import { Breadcrumb } from './index';
|
|
26
26
|
import { BreadcrumbLinkLocator } from './BreadcrumbLink/BreadcrumbLinkLocator';
|
|
27
|
-
export { BreadcrumbLinkLocator };
|
|
27
|
+
export { BreadcrumbLinkLocator }; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
28
|
+
|
|
28
29
|
export const BreadcrumbLocator = locator(Breadcrumb.selector, {
|
|
29
30
|
findAllLinks: function () {
|
|
30
31
|
return BreadcrumbLinkLocator.findAll(...arguments);
|
package/es/Breadcrumb/index.js
CHANGED
|
@@ -27,9 +27,9 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import React, { Component } from 'react';
|
|
29
29
|
import { View } from '@instructure/ui-view';
|
|
30
|
-
import { IconArrowOpenEndSolid } from '@instructure/ui-icons';
|
|
31
30
|
import { testable } from '@instructure/ui-testable';
|
|
32
31
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
32
|
+
import { IconArrowOpenEndSolid } from '@instructure/ui-icons';
|
|
33
33
|
import { BreadcrumbLink } from './BreadcrumbLink';
|
|
34
34
|
import generateStyle from './styles';
|
|
35
35
|
import generateComponentTheme from './theme';
|
|
@@ -39,6 +39,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
39
39
|
---
|
|
40
40
|
category: components
|
|
41
41
|
---
|
|
42
|
+
@tsProps
|
|
42
43
|
**/
|
|
43
44
|
let Breadcrumb = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Breadcrumb extends Component {
|
|
44
45
|
constructor() {
|
|
@@ -51,18 +52,22 @@ let Breadcrumb = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
componentDidMount() {
|
|
54
|
-
|
|
55
|
+
var _this$props$makeStyle, _this$props;
|
|
56
|
+
|
|
57
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
componentDidUpdate(
|
|
58
|
-
|
|
60
|
+
componentDidUpdate() {
|
|
61
|
+
var _this$props$makeStyle2, _this$props2;
|
|
62
|
+
|
|
63
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
renderChildren() {
|
|
62
|
-
const _this$
|
|
63
|
-
styles = _this$
|
|
64
|
-
children = _this$
|
|
65
|
-
const numChildren = children
|
|
67
|
+
const _this$props3 = this.props,
|
|
68
|
+
styles = _this$props3.styles,
|
|
69
|
+
children = _this$props3.children;
|
|
70
|
+
const numChildren = React.Children.count(children);
|
|
66
71
|
const inlineStyle = {
|
|
67
72
|
maxWidth: `${Math.floor(100 / numChildren)}%`
|
|
68
73
|
};
|
package/es/Breadcrumb/props.js
CHANGED
|
@@ -26,26 +26,9 @@ import { Children } from '@instructure/ui-prop-types';
|
|
|
26
26
|
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
27
27
|
import { BreadcrumbLink } from './BreadcrumbLink';
|
|
28
28
|
const propTypes = {
|
|
29
|
-
/**
|
|
30
|
-
* children of type Breadcrumb.Link
|
|
31
|
-
*/
|
|
32
29
|
children: Children.oneOf([BreadcrumbLink]),
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* An accessible label for the navigation
|
|
36
|
-
*/
|
|
37
30
|
label: PropTypes.string.isRequired,
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Sets the font-size of the breadcrumb text
|
|
41
|
-
*/
|
|
42
31
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
46
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
47
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
48
|
-
*/
|
|
49
32
|
margin: ThemeablePropTypes.spacing
|
|
50
33
|
};
|
|
51
34
|
const allowedProps = ['children', 'label', 'margin', 'size'];
|
|
@@ -32,5 +32,6 @@ var _index = require("./index");
|
|
|
32
32
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
33
|
* SOFTWARE.
|
|
34
34
|
*/
|
|
35
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
35
36
|
const BreadcrumbLinkLocator = (0, _locator.locator)(_index.BreadcrumbLink.selector);
|
|
36
37
|
exports.BreadcrumbLinkLocator = BreadcrumbLinkLocator;
|
|
@@ -26,6 +26,7 @@ var _dec, _class, _class2, _temp;
|
|
|
26
26
|
parent: Breadcrumb
|
|
27
27
|
id: Breadcrumb.Link
|
|
28
28
|
---
|
|
29
|
+
@tsProps
|
|
29
30
|
**/
|
|
30
31
|
let BreadcrumbLink = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _class2 = class BreadcrumbLink extends _react.Component {
|
|
31
32
|
constructor() {
|
|
@@ -45,9 +46,7 @@ let BreadcrumbLink = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _
|
|
|
45
46
|
iconPlacement = _this$props.iconPlacement,
|
|
46
47
|
onClick = _this$props.onClick;
|
|
47
48
|
const props = (0, _omitProps.omitProps)(this.props, BreadcrumbLink.allowedProps);
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(_Link.Link, Object.assign({
|
|
49
|
-
as: this.element
|
|
50
|
-
}, props, {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_Link.Link, Object.assign({}, props, {
|
|
51
50
|
href: href,
|
|
52
51
|
renderIcon: renderIcon,
|
|
53
52
|
iconPlacement: iconPlacement,
|
|
@@ -33,34 +33,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
33
33
|
* SOFTWARE.
|
|
34
34
|
*/
|
|
35
35
|
const propTypes = {
|
|
36
|
-
/**
|
|
37
|
-
* Content to render as the crumb, generally should be text.
|
|
38
|
-
*/
|
|
39
36
|
children: _propTypes.default.node.isRequired,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Link the crumb should direct to; if an href is provided, the crumb will render as a link
|
|
43
|
-
*/
|
|
44
37
|
href: _propTypes.default.string,
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* If the Breadcrumb.Link has an onClick prop (and no href), it will render as a button
|
|
48
|
-
*/
|
|
49
38
|
onClick: _propTypes.default.func,
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Sets the font-size of the breadcrumb text
|
|
53
|
-
*/
|
|
54
39
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Add an icon to the Breadcrumb.Link
|
|
58
|
-
*/
|
|
59
40
|
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Place the icon before or after the text in the Breadcrumb.Link
|
|
63
|
-
*/
|
|
64
41
|
iconPlacement: _propTypes.default.oneOf(['start', 'end'])
|
|
65
42
|
};
|
|
66
43
|
exports.propTypes = propTypes;
|
|
@@ -40,6 +40,7 @@ var _BreadcrumbLinkLocator = require("./BreadcrumbLink/BreadcrumbLinkLocator");
|
|
|
40
40
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
41
41
|
* SOFTWARE.
|
|
42
42
|
*/
|
|
43
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
43
44
|
const BreadcrumbLocator = (0, _locator.locator)(_index.Breadcrumb.selector, {
|
|
44
45
|
findAllLinks: function () {
|
|
45
46
|
return _BreadcrumbLinkLocator.BreadcrumbLinkLocator.findAll(...arguments);
|
package/lib/Breadcrumb/index.js
CHANGED
|
@@ -20,12 +20,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
20
20
|
|
|
21
21
|
var _View = require("@instructure/ui-view/lib/View");
|
|
22
22
|
|
|
23
|
-
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
24
|
-
|
|
25
23
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
26
24
|
|
|
27
25
|
var _emotion = require("@instructure/emotion");
|
|
28
26
|
|
|
27
|
+
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
28
|
+
|
|
29
29
|
var _BreadcrumbLink = require("./BreadcrumbLink");
|
|
30
30
|
|
|
31
31
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
@@ -40,6 +40,7 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
40
40
|
---
|
|
41
41
|
category: components
|
|
42
42
|
---
|
|
43
|
+
@tsProps
|
|
43
44
|
**/
|
|
44
45
|
let Breadcrumb = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class Breadcrumb extends _react.Component {
|
|
45
46
|
constructor() {
|
|
@@ -52,18 +53,24 @@ let Breadcrumb = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
componentDidMount() {
|
|
55
|
-
|
|
56
|
+
var _this$props$makeStyle, _this$props;
|
|
57
|
+
|
|
58
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
componentDidUpdate(
|
|
59
|
-
|
|
61
|
+
componentDidUpdate() {
|
|
62
|
+
var _this$props$makeStyle2, _this$props2;
|
|
63
|
+
|
|
64
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
renderChildren() {
|
|
63
|
-
const _this$
|
|
64
|
-
styles = _this$
|
|
65
|
-
children = _this$
|
|
66
|
-
|
|
68
|
+
const _this$props3 = this.props,
|
|
69
|
+
styles = _this$props3.styles,
|
|
70
|
+
children = _this$props3.children;
|
|
71
|
+
|
|
72
|
+
const numChildren = _react.default.Children.count(children);
|
|
73
|
+
|
|
67
74
|
const inlineStyle = {
|
|
68
75
|
maxWidth: `${Math.floor(100 / numChildren)}%`
|
|
69
76
|
};
|
package/lib/Breadcrumb/props.js
CHANGED
|
@@ -39,26 +39,9 @@ var _BreadcrumbLink = require("./BreadcrumbLink");
|
|
|
39
39
|
* SOFTWARE.
|
|
40
40
|
*/
|
|
41
41
|
const propTypes = {
|
|
42
|
-
/**
|
|
43
|
-
* children of type Breadcrumb.Link
|
|
44
|
-
*/
|
|
45
42
|
children: _Children.Children.oneOf([_BreadcrumbLink.BreadcrumbLink]),
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* An accessible label for the navigation
|
|
49
|
-
*/
|
|
50
43
|
label: _propTypes.default.string.isRequired,
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Sets the font-size of the breadcrumb text
|
|
54
|
-
*/
|
|
55
44
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
59
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
60
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
61
|
-
*/
|
|
62
45
|
margin: _emotion.ThemeablePropTypes.spacing
|
|
63
46
|
};
|
|
64
47
|
exports.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-breadcrumb",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.1-snapshot.15+b1ff4615e",
|
|
4
4
|
"description": "A breadcrumb component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,23 +24,23 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/ui-babel-preset": "8.
|
|
28
|
-
"@instructure/ui-test-locator": "8.
|
|
29
|
-
"@instructure/ui-test-utils": "8.
|
|
30
|
-
"@instructure/ui-themes": "8.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.14.1-snapshot.15+b1ff4615e",
|
|
28
|
+
"@instructure/ui-test-locator": "8.14.1-snapshot.15+b1ff4615e",
|
|
29
|
+
"@instructure/ui-test-utils": "8.14.1-snapshot.15+b1ff4615e",
|
|
30
|
+
"@instructure/ui-themes": "8.14.1-snapshot.15+b1ff4615e"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.
|
|
35
|
-
"@instructure/shared-types": "8.
|
|
36
|
-
"@instructure/ui-icons": "8.
|
|
37
|
-
"@instructure/ui-link": "8.
|
|
38
|
-
"@instructure/ui-prop-types": "8.
|
|
39
|
-
"@instructure/ui-react-utils": "8.
|
|
40
|
-
"@instructure/ui-testable": "8.
|
|
41
|
-
"@instructure/ui-truncate-text": "8.
|
|
42
|
-
"@instructure/ui-utils": "8.
|
|
43
|
-
"@instructure/ui-view": "8.
|
|
34
|
+
"@instructure/emotion": "8.14.1-snapshot.15+b1ff4615e",
|
|
35
|
+
"@instructure/shared-types": "8.14.1-snapshot.15+b1ff4615e",
|
|
36
|
+
"@instructure/ui-icons": "8.14.1-snapshot.15+b1ff4615e",
|
|
37
|
+
"@instructure/ui-link": "8.14.1-snapshot.15+b1ff4615e",
|
|
38
|
+
"@instructure/ui-prop-types": "8.14.1-snapshot.15+b1ff4615e",
|
|
39
|
+
"@instructure/ui-react-utils": "8.14.1-snapshot.15+b1ff4615e",
|
|
40
|
+
"@instructure/ui-testable": "8.14.1-snapshot.15+b1ff4615e",
|
|
41
|
+
"@instructure/ui-truncate-text": "8.14.1-snapshot.15+b1ff4615e",
|
|
42
|
+
"@instructure/ui-utils": "8.14.1-snapshot.15+b1ff4615e",
|
|
43
|
+
"@instructure/ui-view": "8.14.1-snapshot.15+b1ff4615e",
|
|
44
44
|
"prop-types": "^15"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"sideEffects": false,
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "b1ff4615e6f67e7e53a3dc497bcfabe81bc47667"
|
|
54
54
|
}
|
|
@@ -37,6 +37,7 @@ import type { BreadcrumbLinkProps } from './props'
|
|
|
37
37
|
parent: Breadcrumb
|
|
38
38
|
id: Breadcrumb.Link
|
|
39
39
|
---
|
|
40
|
+
@tsProps
|
|
40
41
|
**/
|
|
41
42
|
|
|
42
43
|
@testable()
|
|
@@ -60,8 +61,6 @@ class BreadcrumbLink extends Component<BreadcrumbLinkProps> {
|
|
|
60
61
|
|
|
61
62
|
return (
|
|
62
63
|
<Link
|
|
63
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'element' does not exist on type 'Breadcr... Remove this comment to see the full error message
|
|
64
|
-
as={this.element}
|
|
65
64
|
{...props}
|
|
66
65
|
href={href}
|
|
67
66
|
renderIcon={renderIcon}
|
|
@@ -29,47 +29,51 @@ import type {
|
|
|
29
29
|
OtherHTMLAttributes,
|
|
30
30
|
PropValidators
|
|
31
31
|
} from '@instructure/shared-types'
|
|
32
|
+
import type { ViewOwnProps } from '@instructure/ui-view'
|
|
32
33
|
|
|
33
34
|
type BreadcrumbLinkOwnProps = {
|
|
34
|
-
children: React.ReactNode
|
|
35
|
-
href?: string
|
|
36
|
-
onClick?: (...args: any[]) => any
|
|
37
|
-
size?: 'small' | 'medium' | 'large'
|
|
38
|
-
renderIcon?: React.ReactNode | ((...args: any[]) => any)
|
|
39
|
-
iconPlacement?: 'start' | 'end'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type PropKeys = keyof BreadcrumbLinkOwnProps
|
|
43
|
-
|
|
44
|
-
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
45
|
-
|
|
46
|
-
type BreadcrumbLinkProps = BreadcrumbLinkOwnProps &
|
|
47
|
-
OtherHTMLAttributes<BreadcrumbLinkOwnProps>
|
|
48
|
-
|
|
49
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
50
35
|
/**
|
|
51
36
|
* Content to render as the crumb, generally should be text.
|
|
52
37
|
*/
|
|
53
|
-
children:
|
|
38
|
+
children: React.ReactNode
|
|
54
39
|
/**
|
|
55
40
|
* Link the crumb should direct to; if an href is provided, the crumb will render as a link
|
|
56
41
|
*/
|
|
57
|
-
href
|
|
42
|
+
href?: string
|
|
58
43
|
/**
|
|
59
44
|
* If the Breadcrumb.Link has an onClick prop (and no href), it will render as a button
|
|
60
45
|
*/
|
|
61
|
-
onClick:
|
|
46
|
+
onClick?: (event: React.MouseEvent<ViewOwnProps, MouseEvent>) => void
|
|
62
47
|
/**
|
|
63
48
|
* Sets the font-size of the breadcrumb text
|
|
64
49
|
*/
|
|
65
|
-
size
|
|
50
|
+
size?: 'small' | 'medium' | 'large'
|
|
66
51
|
/**
|
|
67
52
|
* Add an icon to the Breadcrumb.Link
|
|
68
53
|
*/
|
|
69
|
-
renderIcon
|
|
54
|
+
renderIcon?: React.ReactNode | (() => React.ReactNode)
|
|
70
55
|
/**
|
|
71
56
|
* Place the icon before or after the text in the Breadcrumb.Link
|
|
72
57
|
*/
|
|
58
|
+
iconPlacement?: 'start' | 'end'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type PropKeys = keyof BreadcrumbLinkOwnProps
|
|
62
|
+
|
|
63
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
64
|
+
|
|
65
|
+
type BreadcrumbLinkProps = BreadcrumbLinkOwnProps &
|
|
66
|
+
OtherHTMLAttributes<BreadcrumbLinkOwnProps> & {
|
|
67
|
+
// React Router might add a `to` prop
|
|
68
|
+
to?: string
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
72
|
+
children: PropTypes.node.isRequired,
|
|
73
|
+
href: PropTypes.string,
|
|
74
|
+
onClick: PropTypes.func,
|
|
75
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
76
|
+
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
73
77
|
iconPlacement: PropTypes.oneOf(['start', 'end'])
|
|
74
78
|
}
|
|
75
79
|
|
package/src/Breadcrumb/index.tsx
CHANGED
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
import React, { Component } from 'react'
|
|
27
27
|
|
|
28
28
|
import { View } from '@instructure/ui-view'
|
|
29
|
-
import { IconArrowOpenEndSolid } from '@instructure/ui-icons'
|
|
30
29
|
import { testable } from '@instructure/ui-testable'
|
|
31
30
|
|
|
32
31
|
import { withStyle, jsx } from '@instructure/emotion'
|
|
32
|
+
import { IconArrowOpenEndSolid } from '@instructure/ui-icons'
|
|
33
33
|
import { BreadcrumbLink } from './BreadcrumbLink'
|
|
34
34
|
|
|
35
35
|
import generateStyle from './styles'
|
|
@@ -42,6 +42,7 @@ import type { BreadcrumbProps } from './props'
|
|
|
42
42
|
---
|
|
43
43
|
category: components
|
|
44
44
|
---
|
|
45
|
+
@tsProps
|
|
45
46
|
**/
|
|
46
47
|
|
|
47
48
|
@withStyle(generateStyle, generateComponentTheme)
|
|
@@ -63,22 +64,17 @@ class Breadcrumb extends Component<BreadcrumbProps> {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
componentDidMount() {
|
|
66
|
-
|
|
67
|
-
this.props.makeStyles()
|
|
67
|
+
this.props.makeStyles?.()
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
72
|
-
// @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
|
|
73
|
-
this.props.makeStyles()
|
|
69
|
+
componentDidUpdate() {
|
|
70
|
+
this.props.makeStyles?.()
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
static Link = BreadcrumbLink
|
|
77
74
|
|
|
78
75
|
renderChildren() {
|
|
79
76
|
const { styles, children } = this.props
|
|
80
|
-
|
|
81
|
-
const numChildren = children ? children.length : 0
|
|
77
|
+
const numChildren = React.Children.count(children)
|
|
82
78
|
const inlineStyle = {
|
|
83
79
|
maxWidth: `${Math.floor(100 / numChildren)}%`
|
|
84
80
|
}
|
package/src/Breadcrumb/props.ts
CHANGED
|
@@ -37,9 +37,23 @@ import type {
|
|
|
37
37
|
import type { BreadcrumbTheme, PropValidators } from '@instructure/shared-types'
|
|
38
38
|
|
|
39
39
|
type BreadcrumbOwnProps = {
|
|
40
|
+
/**
|
|
41
|
+
* children of type Breadcrumb.Link
|
|
42
|
+
*/
|
|
40
43
|
children?: React.ReactNode // TODO: oneOf([BreadcrumbLink])
|
|
44
|
+
/**
|
|
45
|
+
* An accessible label for the navigation
|
|
46
|
+
*/
|
|
41
47
|
label: string
|
|
48
|
+
/**
|
|
49
|
+
* Sets the font-size of the breadcrumb text
|
|
50
|
+
*/
|
|
42
51
|
size?: 'small' | 'medium' | 'large'
|
|
52
|
+
/**
|
|
53
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
54
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
55
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
56
|
+
*/
|
|
43
57
|
margin?: Spacing
|
|
44
58
|
}
|
|
45
59
|
|
|
@@ -53,23 +67,9 @@ type BreadcrumbProps = BreadcrumbOwnProps &
|
|
|
53
67
|
type BreadcrumbStyle = ComponentStyle<'breadcrumb' | 'crumb' | 'separator'>
|
|
54
68
|
|
|
55
69
|
const propTypes: PropValidators<PropKeys> = {
|
|
56
|
-
/**
|
|
57
|
-
* children of type Breadcrumb.Link
|
|
58
|
-
*/
|
|
59
70
|
children: Children.oneOf([BreadcrumbLink]),
|
|
60
|
-
/**
|
|
61
|
-
* An accessible label for the navigation
|
|
62
|
-
*/
|
|
63
71
|
label: PropTypes.string.isRequired,
|
|
64
|
-
/**
|
|
65
|
-
* Sets the font-size of the breadcrumb text
|
|
66
|
-
*/
|
|
67
72
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
68
|
-
/**
|
|
69
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
70
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
71
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
72
|
-
*/
|
|
73
73
|
margin: ThemeablePropTypes.spacing
|
|
74
74
|
}
|
|
75
75
|
|
package/tsconfig.build.json
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig.build.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"outDir": "./types"
|
|
4
|
+
"outDir": "./types",
|
|
5
|
+
"composite": true,
|
|
6
|
+
"rootDir": "./src"
|
|
5
7
|
},
|
|
6
|
-
"include": ["src
|
|
8
|
+
"include": ["src"],
|
|
9
|
+
"references": [
|
|
10
|
+
{ "path": "../ui-babel-preset/tsconfig.build.json" },
|
|
11
|
+
{ "path": "../ui-test-locator/tsconfig.build.json" },
|
|
12
|
+
{ "path": "../ui-test-utils/tsconfig.build.json" },
|
|
13
|
+
{ "path": "../ui-themes/tsconfig.build.json" },
|
|
14
|
+
{ "path": "../emotion/tsconfig.build.json" },
|
|
15
|
+
{ "path": "../shared-types/tsconfig.build.json" },
|
|
16
|
+
{ "path": "../ui-icons/tsconfig.build.json" },
|
|
17
|
+
{ "path": "../ui-link/tsconfig.build.json" },
|
|
18
|
+
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
19
|
+
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
20
|
+
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
21
|
+
{ "path": "../ui-truncate-text/tsconfig.build.json" },
|
|
22
|
+
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
23
|
+
{ "path": "../ui-view/tsconfig.build.json" }
|
|
24
|
+
]
|
|
7
25
|
}
|