@instructure/ui-breadcrumb 10.14.1-snapshot-1 → 10.14.1-snapshot-4
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/index.js +25 -5
- package/lib/Breadcrumb/BreadcrumbLink/index.js +25 -5
- package/package.json +15 -15
- package/src/Breadcrumb/BreadcrumbLink/index.tsx +38 -15
- package/src/Breadcrumb/BreadcrumbLink/props.ts +5 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Breadcrumb/BreadcrumbLink/index.d.ts +4 -2
- package/types/Breadcrumb/BreadcrumbLink/index.d.ts.map +1 -1
- package/types/Breadcrumb/BreadcrumbLink/props.d.ts +4 -1
- 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
|
-
## [10.14.1-snapshot-
|
|
6
|
+
## [10.14.1-snapshot-4](https://github.com/instructure/instructure-ui/compare/v10.14.0...v10.14.1-snapshot-4) (2025-03-27)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ui-breadcrumb,ui-tooltip:** add tooltips for truncated breadcrumbs ([1c22bfc](https://github.com/instructure/instructure-ui/commit/1c22bfcb01238b2af8b03db5391013175f487805))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -28,6 +28,7 @@ import { TruncateText } from '@instructure/ui-truncate-text';
|
|
|
28
28
|
import { Link } from '@instructure/ui-link';
|
|
29
29
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
30
30
|
import { testable } from '@instructure/ui-testable';
|
|
31
|
+
import { Tooltip } from '@instructure/ui-tooltip';
|
|
31
32
|
import { propTypes, allowedProps } from './props';
|
|
32
33
|
/**
|
|
33
34
|
---
|
|
@@ -36,12 +37,22 @@ id: Breadcrumb.Link
|
|
|
36
37
|
---
|
|
37
38
|
**/
|
|
38
39
|
let BreadcrumbLink = (_dec = testable(), _dec(_class = (_BreadcrumbLink = class BreadcrumbLink extends Component {
|
|
39
|
-
constructor(
|
|
40
|
-
super(
|
|
40
|
+
constructor(props) {
|
|
41
|
+
super(props);
|
|
41
42
|
this.ref = null;
|
|
42
43
|
this.handleRef = el => {
|
|
43
44
|
this.ref = el;
|
|
44
45
|
};
|
|
46
|
+
this.state = {
|
|
47
|
+
isTruncated: false
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
handleTruncation(isTruncated) {
|
|
51
|
+
if (isTruncated !== this.state.isTruncated) {
|
|
52
|
+
this.setState({
|
|
53
|
+
isTruncated
|
|
54
|
+
});
|
|
55
|
+
}
|
|
45
56
|
}
|
|
46
57
|
render() {
|
|
47
58
|
const _this$props = this.props,
|
|
@@ -52,18 +63,27 @@ let BreadcrumbLink = (_dec = testable(), _dec(_class = (_BreadcrumbLink = class
|
|
|
52
63
|
onClick = _this$props.onClick,
|
|
53
64
|
onMouseEnter = _this$props.onMouseEnter,
|
|
54
65
|
isCurrentPage = _this$props.isCurrentPage;
|
|
66
|
+
const isTruncated = this.state.isTruncated;
|
|
55
67
|
const props = omitProps(this.props, BreadcrumbLink.allowedProps);
|
|
56
|
-
return /*#__PURE__*/React.createElement(
|
|
68
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
69
|
+
renderTip: children,
|
|
70
|
+
preventTooltip: !isTruncated
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Link, Object.assign({}, props, {
|
|
57
72
|
href: href,
|
|
58
73
|
renderIcon: renderIcon,
|
|
59
74
|
iconPlacement: iconPlacement,
|
|
60
75
|
onClick: onClick,
|
|
61
76
|
onMouseEnter: onMouseEnter,
|
|
62
77
|
isWithinText: false,
|
|
63
|
-
elementRef: this.handleRef
|
|
78
|
+
elementRef: this.handleRef,
|
|
79
|
+
forceButtonRole: false
|
|
64
80
|
}, isCurrentPage && {
|
|
65
81
|
'aria-current': 'page'
|
|
66
|
-
}), /*#__PURE__*/React.createElement(TruncateText,
|
|
82
|
+
}), /*#__PURE__*/React.createElement(TruncateText, {
|
|
83
|
+
onUpdate: isTruncated => this.handleTruncation(isTruncated)
|
|
84
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
85
|
+
"aria-hidden": isTruncated
|
|
86
|
+
}, children))));
|
|
67
87
|
}
|
|
68
88
|
}, _BreadcrumbLink.displayName = "BreadcrumbLink", _BreadcrumbLink.componentId = 'Breadcrumb.Link', _BreadcrumbLink.propTypes = propTypes, _BreadcrumbLink.allowedProps = allowedProps, _BreadcrumbLink.defaultProps = {}, _BreadcrumbLink)) || _class);
|
|
69
89
|
export default BreadcrumbLink;
|
|
@@ -10,6 +10,7 @@ var _TruncateText = require("@instructure/ui-truncate-text/lib/TruncateText");
|
|
|
10
10
|
var _Link = require("@instructure/ui-link/lib/Link");
|
|
11
11
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
12
12
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
13
|
+
var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
|
|
13
14
|
var _props = require("./props");
|
|
14
15
|
var _dec, _class, _BreadcrumbLink;
|
|
15
16
|
/*
|
|
@@ -42,12 +43,22 @@ id: Breadcrumb.Link
|
|
|
42
43
|
---
|
|
43
44
|
**/
|
|
44
45
|
let BreadcrumbLink = exports.BreadcrumbLink = (_dec = (0, _testable.testable)(), _dec(_class = (_BreadcrumbLink = class BreadcrumbLink extends _react.Component {
|
|
45
|
-
constructor(
|
|
46
|
-
super(
|
|
46
|
+
constructor(props) {
|
|
47
|
+
super(props);
|
|
47
48
|
this.ref = null;
|
|
48
49
|
this.handleRef = el => {
|
|
49
50
|
this.ref = el;
|
|
50
51
|
};
|
|
52
|
+
this.state = {
|
|
53
|
+
isTruncated: false
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
handleTruncation(isTruncated) {
|
|
57
|
+
if (isTruncated !== this.state.isTruncated) {
|
|
58
|
+
this.setState({
|
|
59
|
+
isTruncated
|
|
60
|
+
});
|
|
61
|
+
}
|
|
51
62
|
}
|
|
52
63
|
render() {
|
|
53
64
|
const _this$props = this.props,
|
|
@@ -58,18 +69,27 @@ let BreadcrumbLink = exports.BreadcrumbLink = (_dec = (0, _testable.testable)(),
|
|
|
58
69
|
onClick = _this$props.onClick,
|
|
59
70
|
onMouseEnter = _this$props.onMouseEnter,
|
|
60
71
|
isCurrentPage = _this$props.isCurrentPage;
|
|
72
|
+
const isTruncated = this.state.isTruncated;
|
|
61
73
|
const props = (0, _omitProps.omitProps)(this.props, BreadcrumbLink.allowedProps);
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
75
|
+
renderTip: children,
|
|
76
|
+
preventTooltip: !isTruncated
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement(_Link.Link, Object.assign({}, props, {
|
|
63
78
|
href: href,
|
|
64
79
|
renderIcon: renderIcon,
|
|
65
80
|
iconPlacement: iconPlacement,
|
|
66
81
|
onClick: onClick,
|
|
67
82
|
onMouseEnter: onMouseEnter,
|
|
68
83
|
isWithinText: false,
|
|
69
|
-
elementRef: this.handleRef
|
|
84
|
+
elementRef: this.handleRef,
|
|
85
|
+
forceButtonRole: false
|
|
70
86
|
}, isCurrentPage && {
|
|
71
87
|
'aria-current': 'page'
|
|
72
|
-
}), /*#__PURE__*/_react.default.createElement(_TruncateText.TruncateText,
|
|
88
|
+
}), /*#__PURE__*/_react.default.createElement(_TruncateText.TruncateText, {
|
|
89
|
+
onUpdate: isTruncated => this.handleTruncation(isTruncated)
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
91
|
+
"aria-hidden": isTruncated
|
|
92
|
+
}, children))));
|
|
73
93
|
}
|
|
74
94
|
}, _BreadcrumbLink.displayName = "BreadcrumbLink", _BreadcrumbLink.componentId = 'Breadcrumb.Link', _BreadcrumbLink.propTypes = _props.propTypes, _BreadcrumbLink.allowedProps = _props.allowedProps, _BreadcrumbLink.defaultProps = {}, _BreadcrumbLink)) || _class);
|
|
75
95
|
var _default = exports.default = BreadcrumbLink;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-breadcrumb",
|
|
3
|
-
"version": "10.14.1-snapshot-
|
|
3
|
+
"version": "10.14.1-snapshot-4",
|
|
4
4
|
"description": "A breadcrumb component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "10.14.1-snapshot-
|
|
27
|
-
"@instructure/ui-babel-preset": "10.14.1-snapshot-
|
|
28
|
-
"@instructure/ui-scripts": "10.14.1-snapshot-
|
|
29
|
-
"@instructure/ui-themes": "10.14.1-snapshot-
|
|
26
|
+
"@instructure/ui-axe-check": "10.14.1-snapshot-4",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.14.1-snapshot-4",
|
|
28
|
+
"@instructure/ui-scripts": "10.14.1-snapshot-4",
|
|
29
|
+
"@instructure/ui-themes": "10.14.1-snapshot-4",
|
|
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.14.1-snapshot-
|
|
37
|
-
"@instructure/shared-types": "10.14.1-snapshot-
|
|
38
|
-
"@instructure/ui-icons": "10.14.1-snapshot-
|
|
39
|
-
"@instructure/ui-link": "10.14.1-snapshot-
|
|
40
|
-
"@instructure/ui-prop-types": "10.14.1-snapshot-
|
|
41
|
-
"@instructure/ui-react-utils": "10.14.1-snapshot-
|
|
42
|
-
"@instructure/ui-testable": "10.14.1-snapshot-
|
|
43
|
-
"@instructure/ui-truncate-text": "10.14.1-snapshot-
|
|
44
|
-
"@instructure/ui-utils": "10.14.1-snapshot-
|
|
45
|
-
"@instructure/ui-view": "10.14.1-snapshot-
|
|
36
|
+
"@instructure/emotion": "10.14.1-snapshot-4",
|
|
37
|
+
"@instructure/shared-types": "10.14.1-snapshot-4",
|
|
38
|
+
"@instructure/ui-icons": "10.14.1-snapshot-4",
|
|
39
|
+
"@instructure/ui-link": "10.14.1-snapshot-4",
|
|
40
|
+
"@instructure/ui-prop-types": "10.14.1-snapshot-4",
|
|
41
|
+
"@instructure/ui-react-utils": "10.14.1-snapshot-4",
|
|
42
|
+
"@instructure/ui-testable": "10.14.1-snapshot-4",
|
|
43
|
+
"@instructure/ui-truncate-text": "10.14.1-snapshot-4",
|
|
44
|
+
"@instructure/ui-utils": "10.14.1-snapshot-4",
|
|
45
|
+
"@instructure/ui-view": "10.14.1-snapshot-4",
|
|
46
46
|
"prop-types": "^15.8.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -28,9 +28,10 @@ import { TruncateText } from '@instructure/ui-truncate-text'
|
|
|
28
28
|
import { Link } from '@instructure/ui-link'
|
|
29
29
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
30
30
|
import { testable } from '@instructure/ui-testable'
|
|
31
|
+
import { Tooltip } from '@instructure/ui-tooltip'
|
|
31
32
|
|
|
32
33
|
import { propTypes, allowedProps } from './props'
|
|
33
|
-
import type { BreadcrumbLinkProps } from './props'
|
|
34
|
+
import type { BreadcrumbLinkProps, BreadcrumbLinkState } from './props'
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
---
|
|
@@ -40,7 +41,10 @@ id: Breadcrumb.Link
|
|
|
40
41
|
**/
|
|
41
42
|
|
|
42
43
|
@testable()
|
|
43
|
-
class BreadcrumbLink extends Component<
|
|
44
|
+
class BreadcrumbLink extends Component<
|
|
45
|
+
BreadcrumbLinkProps,
|
|
46
|
+
BreadcrumbLinkState
|
|
47
|
+
> {
|
|
44
48
|
static readonly componentId = 'Breadcrumb.Link'
|
|
45
49
|
|
|
46
50
|
static propTypes = propTypes
|
|
@@ -52,7 +56,18 @@ class BreadcrumbLink extends Component<BreadcrumbLinkProps> {
|
|
|
52
56
|
handleRef = (el: Element | null) => {
|
|
53
57
|
this.ref = el
|
|
54
58
|
}
|
|
59
|
+
constructor(props: BreadcrumbLinkProps) {
|
|
60
|
+
super(props)
|
|
55
61
|
|
|
62
|
+
this.state = {
|
|
63
|
+
isTruncated: false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
handleTruncation(isTruncated: boolean) {
|
|
67
|
+
if (isTruncated !== this.state.isTruncated) {
|
|
68
|
+
this.setState({ isTruncated })
|
|
69
|
+
}
|
|
70
|
+
}
|
|
56
71
|
render() {
|
|
57
72
|
const {
|
|
58
73
|
children,
|
|
@@ -64,22 +79,30 @@ class BreadcrumbLink extends Component<BreadcrumbLinkProps> {
|
|
|
64
79
|
isCurrentPage
|
|
65
80
|
} = this.props
|
|
66
81
|
|
|
82
|
+
const { isTruncated } = this.state
|
|
67
83
|
const props = omitProps(this.props, BreadcrumbLink.allowedProps)
|
|
68
84
|
|
|
69
85
|
return (
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
<Tooltip renderTip={children} preventTooltip={!isTruncated}>
|
|
87
|
+
<Link
|
|
88
|
+
{...props}
|
|
89
|
+
href={href}
|
|
90
|
+
renderIcon={renderIcon}
|
|
91
|
+
iconPlacement={iconPlacement}
|
|
92
|
+
onClick={onClick}
|
|
93
|
+
onMouseEnter={onMouseEnter}
|
|
94
|
+
isWithinText={false}
|
|
95
|
+
elementRef={this.handleRef}
|
|
96
|
+
forceButtonRole={false}
|
|
97
|
+
{...(isCurrentPage && { 'aria-current': 'page' })}
|
|
98
|
+
>
|
|
99
|
+
<TruncateText
|
|
100
|
+
onUpdate={(isTruncated) => this.handleTruncation(isTruncated)}
|
|
101
|
+
>
|
|
102
|
+
<span aria-hidden={isTruncated}>{children}</span>
|
|
103
|
+
</TruncateText>
|
|
104
|
+
</Link>
|
|
105
|
+
</Tooltip>
|
|
83
106
|
)
|
|
84
107
|
}
|
|
85
108
|
}
|
|
@@ -109,5 +109,9 @@ const allowedProps: AllowedPropKeys = [
|
|
|
109
109
|
'isCurrentPage'
|
|
110
110
|
]
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
type BreadcrumbLinkState = {
|
|
113
|
+
isTruncated: boolean
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type { BreadcrumbLinkProps, BreadcrumbLinkState }
|
|
113
117
|
export { propTypes, allowedProps }
|