@instructure/ui-link 10.13.0 → 10.13.1-pr-snapshot-1741357986437
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 +8 -0
- package/lib/Link/__examples__/Link.examples.js +2 -2
- package/lib/Link/__new-tests__/Link.test.js +2 -2
- package/lib/Link/index.js +14 -19
- package/lib/Link/theme.js +3 -3
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.13.1-pr-snapshot-1741357986437](https://github.com/instructure/instructure-ui/compare/v10.13.0...v10.13.1-pr-snapshot-1741357986437) (2025-03-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-link
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [10.13.0](https://github.com/instructure/instructure-ui/compare/v10.12.0...v10.13.0) (2025-03-06)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-link
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
8
8
|
/*
|
|
9
9
|
* The MIT License (MIT)
|
|
10
10
|
*
|
|
@@ -36,7 +36,7 @@ var _default = exports.default = {
|
|
|
36
36
|
propValues: {
|
|
37
37
|
children: [shortString, longString],
|
|
38
38
|
iconPlacement: [null, 'start', 'end'],
|
|
39
|
-
renderIcon: [null,
|
|
39
|
+
renderIcon: [null, _uiIcons.IconTrashSolid]
|
|
40
40
|
},
|
|
41
41
|
getComponentProps: () => {
|
|
42
42
|
return {
|
|
@@ -6,7 +6,7 @@ var _userEvent = require("@testing-library/user-event");
|
|
|
6
6
|
var _react2 = require("@testing-library/react");
|
|
7
7
|
require("@testing-library/jest-dom");
|
|
8
8
|
var _vitest = require("vitest");
|
|
9
|
-
var
|
|
9
|
+
var _uiAxeCheck = require("@instructure/ui-axe-check");
|
|
10
10
|
var _index = require("../index");
|
|
11
11
|
var _Link, _Link2, _Link3, _svg, _TruncateText2, _svg2, _Link4, _Link5, _Link6, _Link7, _Link8, _Link9, _Link10, _Link11, _Link12, _Link13, _Link14, _Link15, _Link16, _Link17;
|
|
12
12
|
/*
|
|
@@ -68,7 +68,7 @@ describe('<Link />', () => {
|
|
|
68
68
|
href: "https://instructure.design"
|
|
69
69
|
}, "Hello World"))),
|
|
70
70
|
container = _render.container;
|
|
71
|
-
const axeCheck = await (0,
|
|
71
|
+
const axeCheck = await (0, _uiAxeCheck.runAxeCheck)(container);
|
|
72
72
|
expect(axeCheck).toBe(true);
|
|
73
73
|
});
|
|
74
74
|
it('should focus with the focus helper', async () => {
|
package/lib/Link/index.js
CHANGED
|
@@ -8,17 +8,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.Link = void 0;
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
16
|
-
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
17
|
-
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
18
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
19
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
11
|
+
var _uiView = require("@instructure/ui-view");
|
|
12
|
+
var _uiA11yUtils = require("@instructure/ui-a11y-utils");
|
|
13
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
14
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
20
15
|
var _console = require("@instructure/console");
|
|
21
|
-
var
|
|
16
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
22
17
|
var _emotion = require("@instructure/emotion");
|
|
23
18
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
24
19
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -54,7 +49,7 @@ var _dec, _dec2, _class, _Link;
|
|
|
54
49
|
category: components
|
|
55
50
|
---
|
|
56
51
|
**/
|
|
57
|
-
let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
52
|
+
let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_Link = class Link extends _react.Component {
|
|
58
53
|
constructor(...args) {
|
|
59
54
|
super(...args);
|
|
60
55
|
this.state = {
|
|
@@ -115,7 +110,7 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
115
110
|
get containsTruncateText() {
|
|
116
111
|
let truncateText = false;
|
|
117
112
|
_react.default.Children.forEach(this.props.children, child => {
|
|
118
|
-
if (child && (0,
|
|
113
|
+
if (child && (0, _uiReactUtils.matchComponentTypes)(child, ['TruncateText'])) {
|
|
119
114
|
truncateText = true;
|
|
120
115
|
}
|
|
121
116
|
});
|
|
@@ -136,22 +131,22 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
136
131
|
}
|
|
137
132
|
}
|
|
138
133
|
get interaction() {
|
|
139
|
-
return (0,
|
|
134
|
+
return (0, _uiReactUtils.getInteraction)({
|
|
140
135
|
props: this.props,
|
|
141
136
|
interactionTypes: ['disabled']
|
|
142
137
|
});
|
|
143
138
|
}
|
|
144
139
|
get element() {
|
|
145
|
-
return (0,
|
|
140
|
+
return (0, _uiReactUtils.getElementType)(Link, this.props);
|
|
146
141
|
}
|
|
147
142
|
get focused() {
|
|
148
|
-
return (0,
|
|
143
|
+
return (0, _uiDomUtils.isActiveElement)(this.ref);
|
|
149
144
|
}
|
|
150
145
|
get focusable() {
|
|
151
|
-
return (0,
|
|
146
|
+
return (0, _uiDomUtils.findFocusable)(this.ref);
|
|
152
147
|
}
|
|
153
148
|
get hasVisibleChildren() {
|
|
154
|
-
return (0,
|
|
149
|
+
return (0, _uiA11yUtils.hasVisibleChildren)(this.props.children);
|
|
155
150
|
}
|
|
156
151
|
get role() {
|
|
157
152
|
const _this$props3 = this.props,
|
|
@@ -173,7 +168,7 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
173
168
|
this.props.display === void 0, '[Link] Using the display property with an icon may cause layout issues.');
|
|
174
169
|
return (0, _emotion.jsx)("span", {
|
|
175
170
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon
|
|
176
|
-
}, (0,
|
|
171
|
+
}, (0, _uiReactUtils.callRenderProp)(this.props.renderIcon));
|
|
177
172
|
}
|
|
178
173
|
render() {
|
|
179
174
|
var _this$props$styles2;
|
|
@@ -192,7 +187,7 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
192
187
|
const isDisabled = interaction === 'disabled';
|
|
193
188
|
const type = this.element === 'button' || this.element === 'input' ? 'button' : void 0;
|
|
194
189
|
const tabIndex = this.role === 'button' && !isDisabled ? 0 : void 0;
|
|
195
|
-
return (0, _emotion.jsx)(
|
|
190
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, (0, _uiReactUtils.passthroughProps)(props), {
|
|
196
191
|
elementRef: this.handleElementRef,
|
|
197
192
|
as: this.element,
|
|
198
193
|
display: this.display,
|
package/lib/Link/theme.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiColorUtils = require("@instructure/ui-color-utils");
|
|
8
8
|
/*
|
|
9
9
|
* The MIT License (MIT)
|
|
10
10
|
*
|
|
@@ -48,7 +48,7 @@ const generateComponentTheme = theme => {
|
|
|
48
48
|
canvas: {
|
|
49
49
|
color: theme['ic-link-color'],
|
|
50
50
|
focusOutlineColor: theme['ic-brand-primary'],
|
|
51
|
-
hoverColor: (0,
|
|
51
|
+
hoverColor: (0, _uiColorUtils.darken)(theme['ic-link-color'], 10)
|
|
52
52
|
},
|
|
53
53
|
'canvas-high-contrast': {
|
|
54
54
|
textDecorationOutsideText: 'underline',
|
|
@@ -69,7 +69,7 @@ const generateComponentTheme = theme => {
|
|
|
69
69
|
focusOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.blue4570,
|
|
70
70
|
focusOutlineStyle: borders === null || borders === void 0 ? void 0 : borders.style,
|
|
71
71
|
focusOutlineBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusSmall,
|
|
72
|
-
hoverColor: (0,
|
|
72
|
+
hoverColor: (0, _uiColorUtils.darken)(colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.blue5782, 10),
|
|
73
73
|
colorInverse: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.grey1111,
|
|
74
74
|
focusInverseOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.white1010,
|
|
75
75
|
focusInverseIconOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.white1010,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-link",
|
|
3
|
-
"version": "10.13.
|
|
3
|
+
"version": "10.13.1-pr-snapshot-1741357986437",
|
|
4
4
|
"description": "A component for creating links",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,24 +24,24 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.26.0",
|
|
27
|
-
"@instructure/console": "10.13.
|
|
28
|
-
"@instructure/emotion": "10.13.
|
|
29
|
-
"@instructure/shared-types": "10.13.
|
|
30
|
-
"@instructure/ui-a11y-utils": "10.13.
|
|
31
|
-
"@instructure/ui-color-utils": "10.13.
|
|
32
|
-
"@instructure/ui-dom-utils": "10.13.
|
|
33
|
-
"@instructure/ui-icons": "10.13.
|
|
34
|
-
"@instructure/ui-prop-types": "10.13.
|
|
35
|
-
"@instructure/ui-react-utils": "10.13.
|
|
36
|
-
"@instructure/ui-testable": "10.13.
|
|
37
|
-
"@instructure/ui-view": "10.13.
|
|
27
|
+
"@instructure/console": "10.13.1-pr-snapshot-1741357986437",
|
|
28
|
+
"@instructure/emotion": "10.13.1-pr-snapshot-1741357986437",
|
|
29
|
+
"@instructure/shared-types": "10.13.1-pr-snapshot-1741357986437",
|
|
30
|
+
"@instructure/ui-a11y-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
31
|
+
"@instructure/ui-color-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
32
|
+
"@instructure/ui-dom-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
33
|
+
"@instructure/ui-icons": "10.13.1-pr-snapshot-1741357986437",
|
|
34
|
+
"@instructure/ui-prop-types": "10.13.1-pr-snapshot-1741357986437",
|
|
35
|
+
"@instructure/ui-react-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
36
|
+
"@instructure/ui-testable": "10.13.1-pr-snapshot-1741357986437",
|
|
37
|
+
"@instructure/ui-view": "10.13.1-pr-snapshot-1741357986437",
|
|
38
38
|
"prop-types": "^15.8.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@instructure/ui-axe-check": "10.13.
|
|
42
|
-
"@instructure/ui-babel-preset": "10.13.
|
|
43
|
-
"@instructure/ui-test-utils": "10.13.
|
|
44
|
-
"@instructure/ui-themes": "10.13.
|
|
41
|
+
"@instructure/ui-axe-check": "10.13.1-pr-snapshot-1741357986437",
|
|
42
|
+
"@instructure/ui-babel-preset": "10.13.1-pr-snapshot-1741357986437",
|
|
43
|
+
"@instructure/ui-test-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
44
|
+
"@instructure/ui-themes": "10.13.1-pr-snapshot-1741357986437",
|
|
45
45
|
"@testing-library/jest-dom": "^6.6.3",
|
|
46
46
|
"@testing-library/react": "^16.0.1",
|
|
47
47
|
"@testing-library/user-event": "^14.5.2",
|