@instructure/ui-link 8.11.2-snapshot.7 → 8.11.2-snapshot.70
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/es/Link/index.js +8 -7
- package/es/package.json +1 -0
- package/lib/Link/index.js +8 -7
- package/package.json +18 -18
- 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/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.11.2-snapshot.
|
|
3
|
+
"version": "8.11.2-snapshot.70+9653a896e",
|
|
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.11.2-snapshot.
|
|
29
|
-
"@instructure/emotion": "8.11.2-snapshot.
|
|
30
|
-
"@instructure/shared-types": "8.11.2-snapshot.
|
|
31
|
-
"@instructure/ui-a11y-utils": "8.11.2-snapshot.
|
|
32
|
-
"@instructure/ui-color-utils": "8.11.2-snapshot.
|
|
33
|
-
"@instructure/ui-dom-utils": "8.11.2-snapshot.
|
|
34
|
-
"@instructure/ui-icons": "8.11.2-snapshot.
|
|
35
|
-
"@instructure/ui-prop-types": "8.11.2-snapshot.
|
|
36
|
-
"@instructure/ui-react-utils": "8.11.2-snapshot.
|
|
37
|
-
"@instructure/ui-testable": "8.11.2-snapshot.
|
|
38
|
-
"@instructure/ui-view": "8.11.2-snapshot.
|
|
28
|
+
"@instructure/console": "8.11.2-snapshot.70+9653a896e",
|
|
29
|
+
"@instructure/emotion": "8.11.2-snapshot.70+9653a896e",
|
|
30
|
+
"@instructure/shared-types": "8.11.2-snapshot.70+9653a896e",
|
|
31
|
+
"@instructure/ui-a11y-utils": "8.11.2-snapshot.70+9653a896e",
|
|
32
|
+
"@instructure/ui-color-utils": "8.11.2-snapshot.70+9653a896e",
|
|
33
|
+
"@instructure/ui-dom-utils": "8.11.2-snapshot.70+9653a896e",
|
|
34
|
+
"@instructure/ui-icons": "8.11.2-snapshot.70+9653a896e",
|
|
35
|
+
"@instructure/ui-prop-types": "8.11.2-snapshot.70+9653a896e",
|
|
36
|
+
"@instructure/ui-react-utils": "8.11.2-snapshot.70+9653a896e",
|
|
37
|
+
"@instructure/ui-testable": "8.11.2-snapshot.70+9653a896e",
|
|
38
|
+
"@instructure/ui-view": "8.11.2-snapshot.70+9653a896e",
|
|
39
39
|
"prop-types": "^15"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@instructure/ui-babel-preset": "8.11.2-snapshot.
|
|
43
|
-
"@instructure/ui-test-locator": "8.11.2-snapshot.
|
|
44
|
-
"@instructure/ui-test-queries": "8.11.2-snapshot.
|
|
45
|
-
"@instructure/ui-test-utils": "8.11.2-snapshot.
|
|
46
|
-
"@instructure/ui-themes": "8.11.2-snapshot.
|
|
42
|
+
"@instructure/ui-babel-preset": "8.11.2-snapshot.70+9653a896e",
|
|
43
|
+
"@instructure/ui-test-locator": "8.11.2-snapshot.70+9653a896e",
|
|
44
|
+
"@instructure/ui-test-queries": "8.11.2-snapshot.70+9653a896e",
|
|
45
|
+
"@instructure/ui-test-utils": "8.11.2-snapshot.70+9653a896e",
|
|
46
|
+
"@instructure/ui-themes": "8.11.2-snapshot.70+9653a896e"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": ">=16.8 <=17"
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": false,
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "9653a896e80ba4d73335225e80807746a232d96d"
|
|
56
56
|
}
|
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;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