@instructure/ui-breadcrumb 8.14.0 → 8.14.1-snapshot.17
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/LICENSE.md +27 -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 +17 -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.tsbuildinfo +1 -1
- 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/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/LICENSE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
+
|
|
11
|
+
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions.**
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
@@ -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.14.
|
|
3
|
+
"version": "8.14.1-snapshot.17+737c5b359",
|
|
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.14.
|
|
28
|
-
"@instructure/ui-test-locator": "8.14.
|
|
29
|
-
"@instructure/ui-test-utils": "8.14.
|
|
30
|
-
"@instructure/ui-themes": "8.14.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.14.1-snapshot.17+737c5b359",
|
|
28
|
+
"@instructure/ui-test-locator": "8.14.1-snapshot.17+737c5b359",
|
|
29
|
+
"@instructure/ui-test-utils": "8.14.1-snapshot.17+737c5b359",
|
|
30
|
+
"@instructure/ui-themes": "8.14.1-snapshot.17+737c5b359"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.14.
|
|
35
|
-
"@instructure/shared-types": "8.14.
|
|
36
|
-
"@instructure/ui-icons": "8.14.
|
|
37
|
-
"@instructure/ui-link": "8.14.
|
|
38
|
-
"@instructure/ui-prop-types": "8.14.
|
|
39
|
-
"@instructure/ui-react-utils": "8.14.
|
|
40
|
-
"@instructure/ui-testable": "8.14.
|
|
41
|
-
"@instructure/ui-truncate-text": "8.14.
|
|
42
|
-
"@instructure/ui-utils": "8.14.
|
|
43
|
-
"@instructure/ui-view": "8.14.
|
|
34
|
+
"@instructure/emotion": "8.14.1-snapshot.17+737c5b359",
|
|
35
|
+
"@instructure/shared-types": "8.14.1-snapshot.17+737c5b359",
|
|
36
|
+
"@instructure/ui-icons": "8.14.1-snapshot.17+737c5b359",
|
|
37
|
+
"@instructure/ui-link": "8.14.1-snapshot.17+737c5b359",
|
|
38
|
+
"@instructure/ui-prop-types": "8.14.1-snapshot.17+737c5b359",
|
|
39
|
+
"@instructure/ui-react-utils": "8.14.1-snapshot.17+737c5b359",
|
|
40
|
+
"@instructure/ui-testable": "8.14.1-snapshot.17+737c5b359",
|
|
41
|
+
"@instructure/ui-truncate-text": "8.14.1-snapshot.17+737c5b359",
|
|
42
|
+
"@instructure/ui-utils": "8.14.1-snapshot.17+737c5b359",
|
|
43
|
+
"@instructure/ui-view": "8.14.1-snapshot.17+737c5b359",
|
|
44
44
|
"prop-types": "^15"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -49,5 +49,6 @@
|
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
|
-
"sideEffects": false
|
|
52
|
+
"sideEffects": false,
|
|
53
|
+
"gitHead": "737c5b359b44421c8a6f91c31d55f1579d8c96d9"
|
|
53
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
|
|