@instructure/ui-breadcrumb 8.47.2-snapshot-0 → 8.47.2-snapshot-2
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 +5 -2
- package/es/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.js +10 -0
- package/es/Breadcrumb/BreadcrumbLink/index.js +3 -1
- package/es/Breadcrumb/BreadcrumbLink/props.js +2 -1
- package/lib/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.js +10 -0
- package/lib/Breadcrumb/BreadcrumbLink/index.js +3 -1
- package/lib/Breadcrumb/BreadcrumbLink/props.js +2 -1
- package/package.json +15 -15
- package/src/Breadcrumb/BreadcrumbLink/__new-tests__/BreadcrumbLink.test.tsx +14 -0
- package/src/Breadcrumb/BreadcrumbLink/index.tsx +3 -1
- package/src/Breadcrumb/BreadcrumbLink/props.ts +6 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Breadcrumb/BreadcrumbLink/index.d.ts +2 -0
- package/types/Breadcrumb/BreadcrumbLink/index.d.ts.map +1 -1
- package/types/Breadcrumb/BreadcrumbLink/props.d.ts +4 -0
- package/types/Breadcrumb/BreadcrumbLink/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
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.47.2-snapshot-
|
|
6
|
+
## [8.47.2-snapshot-2](https://github.com/instructure/instructure-ui/compare/v8.47.1...v8.47.2-snapshot-2) (2023-11-09)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ui-breadcrumb,ui-link:** add onMouseEnter prop ([a52f836](https://github.com/instructure/instructure-ui/commit/a52f836b48bfbd99763e9f5381675e8eabaa22c5))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -57,6 +57,16 @@ describe('<BreadcrumbLink />', () => {
|
|
|
57
57
|
fireEvent.click(button);
|
|
58
58
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
59
59
|
});
|
|
60
|
+
it('should respond to mouseEnter event when provided with onMouseEnter prop', () => {
|
|
61
|
+
const onMouseEnter = jest.fn();
|
|
62
|
+
render( /*#__PURE__*/React.createElement(BreadcrumbLink, {
|
|
63
|
+
onMouseEnter: onMouseEnter,
|
|
64
|
+
href: TEST_LINK
|
|
65
|
+
}, TEST_TEXT_01));
|
|
66
|
+
const link = screen.getByRole('link');
|
|
67
|
+
fireEvent.mouseEnter(link);
|
|
68
|
+
expect(onMouseEnter).toHaveBeenCalledTimes(1);
|
|
69
|
+
});
|
|
60
70
|
it('should allow to prop to pass through', () => {
|
|
61
71
|
const _render = render(_BreadcrumbLink2 || (_BreadcrumbLink2 = /*#__PURE__*/React.createElement(BreadcrumbLink, {
|
|
62
72
|
to: TEST_TO
|
|
@@ -49,13 +49,15 @@ let BreadcrumbLink = (_dec = testable(), _dec(_class = (_class2 = class Breadcru
|
|
|
49
49
|
href = _this$props.href,
|
|
50
50
|
renderIcon = _this$props.renderIcon,
|
|
51
51
|
iconPlacement = _this$props.iconPlacement,
|
|
52
|
-
onClick = _this$props.onClick
|
|
52
|
+
onClick = _this$props.onClick,
|
|
53
|
+
onMouseEnter = _this$props.onMouseEnter;
|
|
53
54
|
const props = omitProps(this.props, BreadcrumbLink.allowedProps);
|
|
54
55
|
return /*#__PURE__*/React.createElement(Link, Object.assign({}, props, {
|
|
55
56
|
href: href,
|
|
56
57
|
renderIcon: renderIcon,
|
|
57
58
|
iconPlacement: iconPlacement,
|
|
58
59
|
onClick: onClick,
|
|
60
|
+
onMouseEnter: onMouseEnter,
|
|
59
61
|
isWithinText: false,
|
|
60
62
|
elementRef: this.handleRef
|
|
61
63
|
}), /*#__PURE__*/React.createElement(TruncateText, null, children));
|
|
@@ -27,9 +27,10 @@ const propTypes = {
|
|
|
27
27
|
children: PropTypes.node.isRequired,
|
|
28
28
|
href: PropTypes.string,
|
|
29
29
|
onClick: PropTypes.func,
|
|
30
|
+
onMouseEnter: PropTypes.func,
|
|
30
31
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
31
32
|
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
32
33
|
iconPlacement: PropTypes.oneOf(['start', 'end'])
|
|
33
34
|
};
|
|
34
|
-
const allowedProps = ['children', 'href', 'iconPlacement', 'onClick', 'renderIcon', 'size'];
|
|
35
|
+
const allowedProps = ['children', 'href', 'iconPlacement', 'onClick', 'onMouseEnter', 'renderIcon', 'size'];
|
|
35
36
|
export { propTypes, allowedProps };
|
|
@@ -59,6 +59,16 @@ describe('<BreadcrumbLink />', () => {
|
|
|
59
59
|
_react2.fireEvent.click(button);
|
|
60
60
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
61
61
|
});
|
|
62
|
+
it('should respond to mouseEnter event when provided with onMouseEnter prop', () => {
|
|
63
|
+
const onMouseEnter = jest.fn();
|
|
64
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.BreadcrumbLink, {
|
|
65
|
+
onMouseEnter: onMouseEnter,
|
|
66
|
+
href: TEST_LINK
|
|
67
|
+
}, TEST_TEXT_01));
|
|
68
|
+
const link = _react2.screen.getByRole('link');
|
|
69
|
+
_react2.fireEvent.mouseEnter(link);
|
|
70
|
+
expect(onMouseEnter).toHaveBeenCalledTimes(1);
|
|
71
|
+
});
|
|
62
72
|
it('should allow to prop to pass through', () => {
|
|
63
73
|
const _render = (0, _react2.render)(_BreadcrumbLink2 || (_BreadcrumbLink2 = /*#__PURE__*/_react.default.createElement(_index.BreadcrumbLink, {
|
|
64
74
|
to: TEST_TO
|
|
@@ -55,13 +55,15 @@ let BreadcrumbLink = exports.BreadcrumbLink = (_dec = (0, _testable.testable)(),
|
|
|
55
55
|
href = _this$props.href,
|
|
56
56
|
renderIcon = _this$props.renderIcon,
|
|
57
57
|
iconPlacement = _this$props.iconPlacement,
|
|
58
|
-
onClick = _this$props.onClick
|
|
58
|
+
onClick = _this$props.onClick,
|
|
59
|
+
onMouseEnter = _this$props.onMouseEnter;
|
|
59
60
|
const props = (0, _omitProps.omitProps)(this.props, BreadcrumbLink.allowedProps);
|
|
60
61
|
return /*#__PURE__*/_react.default.createElement(_Link.Link, Object.assign({}, props, {
|
|
61
62
|
href: href,
|
|
62
63
|
renderIcon: renderIcon,
|
|
63
64
|
iconPlacement: iconPlacement,
|
|
64
65
|
onClick: onClick,
|
|
66
|
+
onMouseEnter: onMouseEnter,
|
|
65
67
|
isWithinText: false,
|
|
66
68
|
elementRef: this.handleRef
|
|
67
69
|
}), /*#__PURE__*/_react.default.createElement(_TruncateText.TruncateText, null, children));
|
|
@@ -34,8 +34,9 @@ const propTypes = exports.propTypes = {
|
|
|
34
34
|
children: _propTypes.default.node.isRequired,
|
|
35
35
|
href: _propTypes.default.string,
|
|
36
36
|
onClick: _propTypes.default.func,
|
|
37
|
+
onMouseEnter: _propTypes.default.func,
|
|
37
38
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
38
39
|
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
39
40
|
iconPlacement: _propTypes.default.oneOf(['start', 'end'])
|
|
40
41
|
};
|
|
41
|
-
const allowedProps = exports.allowedProps = ['children', 'href', 'iconPlacement', 'onClick', 'renderIcon', 'size'];
|
|
42
|
+
const allowedProps = exports.allowedProps = ['children', 'href', 'iconPlacement', 'onClick', 'onMouseEnter', 'renderIcon', 'size'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-breadcrumb",
|
|
3
|
-
"version": "8.47.2-snapshot-
|
|
3
|
+
"version": "8.47.2-snapshot-2",
|
|
4
4
|
"description": "A breadcrumb component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,25 +23,25 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "8.47.2-snapshot-
|
|
27
|
-
"@instructure/ui-babel-preset": "8.47.2-snapshot-
|
|
28
|
-
"@instructure/ui-scripts": "8.47.2-snapshot-
|
|
29
|
-
"@instructure/ui-themes": "8.47.2-snapshot-
|
|
26
|
+
"@instructure/ui-axe-check": "8.47.2-snapshot-2",
|
|
27
|
+
"@instructure/ui-babel-preset": "8.47.2-snapshot-2",
|
|
28
|
+
"@instructure/ui-scripts": "8.47.2-snapshot-2",
|
|
29
|
+
"@instructure/ui-themes": "8.47.2-snapshot-2",
|
|
30
30
|
"@testing-library/jest-dom": "^6.1.4",
|
|
31
31
|
"@testing-library/react": "^14.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.23.2",
|
|
35
|
-
"@instructure/emotion": "8.47.2-snapshot-
|
|
36
|
-
"@instructure/shared-types": "8.47.2-snapshot-
|
|
37
|
-
"@instructure/ui-icons": "8.47.2-snapshot-
|
|
38
|
-
"@instructure/ui-link": "8.47.2-snapshot-
|
|
39
|
-
"@instructure/ui-prop-types": "8.47.2-snapshot-
|
|
40
|
-
"@instructure/ui-react-utils": "8.47.2-snapshot-
|
|
41
|
-
"@instructure/ui-testable": "8.47.2-snapshot-
|
|
42
|
-
"@instructure/ui-truncate-text": "8.47.2-snapshot-
|
|
43
|
-
"@instructure/ui-utils": "8.47.2-snapshot-
|
|
44
|
-
"@instructure/ui-view": "8.47.2-snapshot-
|
|
35
|
+
"@instructure/emotion": "8.47.2-snapshot-2",
|
|
36
|
+
"@instructure/shared-types": "8.47.2-snapshot-2",
|
|
37
|
+
"@instructure/ui-icons": "8.47.2-snapshot-2",
|
|
38
|
+
"@instructure/ui-link": "8.47.2-snapshot-2",
|
|
39
|
+
"@instructure/ui-prop-types": "8.47.2-snapshot-2",
|
|
40
|
+
"@instructure/ui-react-utils": "8.47.2-snapshot-2",
|
|
41
|
+
"@instructure/ui-testable": "8.47.2-snapshot-2",
|
|
42
|
+
"@instructure/ui-truncate-text": "8.47.2-snapshot-2",
|
|
43
|
+
"@instructure/ui-utils": "8.47.2-snapshot-2",
|
|
44
|
+
"@instructure/ui-view": "8.47.2-snapshot-2",
|
|
45
45
|
"prop-types": "^15.8.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
@@ -63,6 +63,20 @@ describe('<BreadcrumbLink />', () => {
|
|
|
63
63
|
expect(onClick).toHaveBeenCalledTimes(1)
|
|
64
64
|
})
|
|
65
65
|
|
|
66
|
+
it('should respond to mouseEnter event when provided with onMouseEnter prop', () => {
|
|
67
|
+
const onMouseEnter = jest.fn()
|
|
68
|
+
|
|
69
|
+
render(
|
|
70
|
+
<BreadcrumbLink onMouseEnter={onMouseEnter} href={TEST_LINK}>
|
|
71
|
+
{TEST_TEXT_01}
|
|
72
|
+
</BreadcrumbLink>
|
|
73
|
+
)
|
|
74
|
+
const link = screen.getByRole('link')
|
|
75
|
+
fireEvent.mouseEnter(link)
|
|
76
|
+
|
|
77
|
+
expect(onMouseEnter).toHaveBeenCalledTimes(1)
|
|
78
|
+
})
|
|
79
|
+
|
|
66
80
|
it('should allow to prop to pass through', () => {
|
|
67
81
|
const { container } = render(
|
|
68
82
|
<BreadcrumbLink to={TEST_TO}>{TEST_TEXT_01}</BreadcrumbLink>
|
|
@@ -54,7 +54,8 @@ class BreadcrumbLink extends Component<BreadcrumbLinkProps> {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
render() {
|
|
57
|
-
const { children, href, renderIcon, iconPlacement, onClick } =
|
|
57
|
+
const { children, href, renderIcon, iconPlacement, onClick, onMouseEnter } =
|
|
58
|
+
this.props
|
|
58
59
|
|
|
59
60
|
const props = omitProps(this.props, BreadcrumbLink.allowedProps)
|
|
60
61
|
|
|
@@ -65,6 +66,7 @@ class BreadcrumbLink extends Component<BreadcrumbLinkProps> {
|
|
|
65
66
|
renderIcon={renderIcon}
|
|
66
67
|
iconPlacement={iconPlacement}
|
|
67
68
|
onClick={onClick}
|
|
69
|
+
onMouseEnter={onMouseEnter}
|
|
68
70
|
isWithinText={false}
|
|
69
71
|
elementRef={this.handleRef}
|
|
70
72
|
>
|
|
@@ -47,6 +47,10 @@ type BreadcrumbLinkOwnProps = {
|
|
|
47
47
|
* If the Breadcrumb.Link has an onClick prop (and no href), it will render as a button
|
|
48
48
|
*/
|
|
49
49
|
onClick?: (event: React.MouseEvent<ViewOwnProps, MouseEvent>) => void
|
|
50
|
+
/**
|
|
51
|
+
* Fires when the Link is hovered
|
|
52
|
+
*/
|
|
53
|
+
onMouseEnter?: (event: React.MouseEvent<ViewOwnProps, MouseEvent>) => void
|
|
50
54
|
/**
|
|
51
55
|
* Sets the font-size of the breadcrumb text
|
|
52
56
|
*/
|
|
@@ -82,6 +86,7 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
82
86
|
children: PropTypes.node.isRequired,
|
|
83
87
|
href: PropTypes.string,
|
|
84
88
|
onClick: PropTypes.func,
|
|
89
|
+
onMouseEnter: PropTypes.func,
|
|
85
90
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
86
91
|
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
87
92
|
iconPlacement: PropTypes.oneOf(['start', 'end'])
|
|
@@ -92,6 +97,7 @@ const allowedProps: AllowedPropKeys = [
|
|
|
92
97
|
'href',
|
|
93
98
|
'iconPlacement',
|
|
94
99
|
'onClick',
|
|
100
|
+
'onMouseEnter',
|
|
95
101
|
'renderIcon',
|
|
96
102
|
'size'
|
|
97
103
|
]
|