@instructure/ui-link 8.11.2-snapshot.7 → 8.12.0
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/Link/index.js +8 -7
- package/es/package.json +1 -0
- package/lib/Link/index.js +8 -7
- package/package.json +18 -19
- package/src/Link/index.tsx +11 -9
- package/types/Link/index.d.ts +2 -2
- package/types/Link/index.d.ts.map +1 -1
- package/LICENSE.md +0 -27
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.12.0](https://github.com/instructure/instructure-ui/compare/v8.11.1...v8.12.0) (2021-11-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-link
|
|
9
|
+
|
|
6
10
|
## [8.11.1](https://github.com/instructure/instructure-ui/compare/v8.11.0...v8.11.1) (2021-10-19)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-link
|
package/es/Link/index.js
CHANGED
|
@@ -51,7 +51,6 @@ let Link = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
51
51
|
this.state = {
|
|
52
52
|
hasFocus: false
|
|
53
53
|
};
|
|
54
|
-
this._link = null;
|
|
55
54
|
this.ref = null;
|
|
56
55
|
|
|
57
56
|
this.makeStyleProps = () => {
|
|
@@ -62,9 +61,7 @@ let Link = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
62
61
|
};
|
|
63
62
|
|
|
64
63
|
this.handleElementRef = el => {
|
|
65
|
-
const elementRef = this.props.elementRef;
|
|
66
|
-
|
|
67
|
-
this._link = el;
|
|
64
|
+
const elementRef = this.props.elementRef;
|
|
68
65
|
this.ref = el;
|
|
69
66
|
|
|
70
67
|
if (typeof elementRef === 'function') {
|
|
@@ -105,6 +102,10 @@ let Link = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
105
102
|
};
|
|
106
103
|
}
|
|
107
104
|
|
|
105
|
+
get _link() {
|
|
106
|
+
return this.ref;
|
|
107
|
+
}
|
|
108
|
+
|
|
108
109
|
componentDidMount() {
|
|
109
110
|
this.props.makeStyles(this.makeStyleProps());
|
|
110
111
|
}
|
|
@@ -151,11 +152,11 @@ let Link = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
get focused() {
|
|
154
|
-
return isActiveElement(this.
|
|
155
|
+
return isActiveElement(this.ref);
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
get focusable() {
|
|
158
|
-
return findFocusable(this.
|
|
159
|
+
return findFocusable(this.ref);
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
get hasVisibleChildren() {
|
|
@@ -163,7 +164,7 @@ let Link = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
focus() {
|
|
166
|
-
this.
|
|
167
|
+
this.ref && this.ref.focus();
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
renderIcon() {
|
package/es/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/lib/Link/index.js
CHANGED
|
@@ -58,7 +58,6 @@ let Link = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
58
58
|
this.state = {
|
|
59
59
|
hasFocus: false
|
|
60
60
|
};
|
|
61
|
-
this._link = null;
|
|
62
61
|
this.ref = null;
|
|
63
62
|
|
|
64
63
|
this.makeStyleProps = () => {
|
|
@@ -69,9 +68,7 @@ let Link = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
69
68
|
};
|
|
70
69
|
|
|
71
70
|
this.handleElementRef = el => {
|
|
72
|
-
const elementRef = this.props.elementRef;
|
|
73
|
-
|
|
74
|
-
this._link = el;
|
|
71
|
+
const elementRef = this.props.elementRef;
|
|
75
72
|
this.ref = el;
|
|
76
73
|
|
|
77
74
|
if (typeof elementRef === 'function') {
|
|
@@ -112,6 +109,10 @@ let Link = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
112
109
|
};
|
|
113
110
|
}
|
|
114
111
|
|
|
112
|
+
get _link() {
|
|
113
|
+
return this.ref;
|
|
114
|
+
}
|
|
115
|
+
|
|
115
116
|
componentDidMount() {
|
|
116
117
|
this.props.makeStyles(this.makeStyleProps());
|
|
117
118
|
}
|
|
@@ -160,11 +161,11 @@ let Link = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
get focused() {
|
|
163
|
-
return (0, _isActiveElement.isActiveElement)(this.
|
|
164
|
+
return (0, _isActiveElement.isActiveElement)(this.ref);
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
get focusable() {
|
|
167
|
-
return (0, _findFocusable.findFocusable)(this.
|
|
168
|
+
return (0, _findFocusable.findFocusable)(this.ref);
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
get hasVisibleChildren() {
|
|
@@ -172,7 +173,7 @@ let Link = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
focus() {
|
|
175
|
-
this.
|
|
176
|
+
this.ref && this.ref.focus();
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
renderIcon() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-link",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.12.0",
|
|
4
4
|
"description": "A component for creating links",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,25 +25,25 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.
|
|
29
|
-
"@instructure/emotion": "8.
|
|
30
|
-
"@instructure/shared-types": "8.
|
|
31
|
-
"@instructure/ui-a11y-utils": "8.
|
|
32
|
-
"@instructure/ui-color-utils": "8.
|
|
33
|
-
"@instructure/ui-dom-utils": "8.
|
|
34
|
-
"@instructure/ui-icons": "8.
|
|
35
|
-
"@instructure/ui-prop-types": "8.
|
|
36
|
-
"@instructure/ui-react-utils": "8.
|
|
37
|
-
"@instructure/ui-testable": "8.
|
|
38
|
-
"@instructure/ui-view": "8.
|
|
28
|
+
"@instructure/console": "8.12.0",
|
|
29
|
+
"@instructure/emotion": "8.12.0",
|
|
30
|
+
"@instructure/shared-types": "8.12.0",
|
|
31
|
+
"@instructure/ui-a11y-utils": "8.12.0",
|
|
32
|
+
"@instructure/ui-color-utils": "8.12.0",
|
|
33
|
+
"@instructure/ui-dom-utils": "8.12.0",
|
|
34
|
+
"@instructure/ui-icons": "8.12.0",
|
|
35
|
+
"@instructure/ui-prop-types": "8.12.0",
|
|
36
|
+
"@instructure/ui-react-utils": "8.12.0",
|
|
37
|
+
"@instructure/ui-testable": "8.12.0",
|
|
38
|
+
"@instructure/ui-view": "8.12.0",
|
|
39
39
|
"prop-types": "^15"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@instructure/ui-babel-preset": "8.
|
|
43
|
-
"@instructure/ui-test-locator": "8.
|
|
44
|
-
"@instructure/ui-test-queries": "8.
|
|
45
|
-
"@instructure/ui-test-utils": "8.
|
|
46
|
-
"@instructure/ui-themes": "8.
|
|
42
|
+
"@instructure/ui-babel-preset": "8.12.0",
|
|
43
|
+
"@instructure/ui-test-locator": "8.12.0",
|
|
44
|
+
"@instructure/ui-test-queries": "8.12.0",
|
|
45
|
+
"@instructure/ui-test-utils": "8.12.0",
|
|
46
|
+
"@instructure/ui-themes": "8.12.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": ">=16.8 <=17"
|
|
@@ -51,6 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"sideEffects": false
|
|
55
|
-
"gitHead": "2681e145ad469e1396536d3e9eed75a19995eb8a"
|
|
54
|
+
"sideEffects": false
|
|
56
55
|
}
|
package/src/Link/index.tsx
CHANGED
|
@@ -67,8 +67,14 @@ class Link extends Component<LinkProps> {
|
|
|
67
67
|
|
|
68
68
|
state = { hasFocus: false }
|
|
69
69
|
|
|
70
|
-
_link
|
|
71
|
-
|
|
70
|
+
get _link() {
|
|
71
|
+
console.warn(
|
|
72
|
+
'_link property is deprecated and will be removed in v9, please use ref instead'
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
return this.ref
|
|
76
|
+
}
|
|
77
|
+
ref: HTMLElement | null = null
|
|
72
78
|
|
|
73
79
|
componentDidMount() {
|
|
74
80
|
// @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
|
|
@@ -92,8 +98,6 @@ class Link extends Component<LinkProps> {
|
|
|
92
98
|
handleElementRef = (el) => {
|
|
93
99
|
const { elementRef } = this.props
|
|
94
100
|
|
|
95
|
-
// TODO: deprecate _link? ref should be enough
|
|
96
|
-
this._link = el
|
|
97
101
|
this.ref = el
|
|
98
102
|
|
|
99
103
|
if (typeof elementRef === 'function') {
|
|
@@ -171,11 +175,11 @@ class Link extends Component<LinkProps> {
|
|
|
171
175
|
}
|
|
172
176
|
|
|
173
177
|
get focused() {
|
|
174
|
-
return isActiveElement(this.
|
|
178
|
+
return isActiveElement(this.ref)
|
|
175
179
|
}
|
|
176
180
|
|
|
177
181
|
get focusable() {
|
|
178
|
-
return findFocusable(this.
|
|
182
|
+
return findFocusable(this.ref)
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
get hasVisibleChildren() {
|
|
@@ -183,8 +187,7 @@ class Link extends Component<LinkProps> {
|
|
|
183
187
|
}
|
|
184
188
|
|
|
185
189
|
focus() {
|
|
186
|
-
|
|
187
|
-
this._link && this._link.focus()
|
|
190
|
+
this.ref && this.ref.focus()
|
|
188
191
|
}
|
|
189
192
|
|
|
190
193
|
renderIcon() {
|
|
@@ -212,7 +215,6 @@ class Link extends Component<LinkProps> {
|
|
|
212
215
|
isWithinText,
|
|
213
216
|
...props
|
|
214
217
|
} = this.props
|
|
215
|
-
|
|
216
218
|
const { interaction } = this
|
|
217
219
|
|
|
218
220
|
const isDisabled = interaction === 'disabled'
|
package/types/Link/index.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ declare class Link extends Component<LinkProps> {
|
|
|
50
50
|
state: {
|
|
51
51
|
hasFocus: boolean;
|
|
52
52
|
};
|
|
53
|
-
_link:
|
|
54
|
-
ref:
|
|
53
|
+
get _link(): HTMLElement | null;
|
|
54
|
+
ref: HTMLElement | null;
|
|
55
55
|
componentDidMount(): void;
|
|
56
56
|
componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
|
|
57
57
|
makeStyleProps: () => LinkStyleProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Link/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAexC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExD;;;;GAIG;AACH,cAEM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;MAMT;IAEV,KAAK;;MAAsB;IAE3B,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Link/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAexC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExD;;;;GAIG;AACH,cAEM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;MAMT;IAEV,KAAK;;MAAsB;IAE3B,IAAI,KAAK,uBAMR;IACD,GAAG,EAAE,WAAW,GAAG,IAAI,CAAO;IAE9B,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAKjD,cAAc,QAAO,cAAc,CAKlC;IAGD,gBAAgB,oBAQf;IAGD,WAAW,uBAUV;IAGD,WAAW,uBAKV;IAGD,UAAU,uBAKT;IAED,IAAI,oBAAoB,YAgBvB;IAED,IAAI,OAAO,+DAYV;IAED,IAAI,WAAW,0DAEd;IAED,IAAI,OAAO,wEAEV;IAED,IAAI,OAAO,YAEV;IAED,IAAI,SAAS,cAEZ;IAED,IAAI,kBAAkB,YAErB;IAED,KAAK;IAIL,UAAU;IAaV,MAAM;CA8CP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
package/LICENSE.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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.
|