@instructure/ui-link 11.7.8 → 11.7.9-pr-snapshot-1792147648392

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 CHANGED
@@ -3,6 +3,19 @@
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
+ ## [11.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
7
+
8
+ ### Build System
9
+
10
+ * **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * **many:** `@instructure/ui-babel-preset` and
15
+ `@instructure/browserslist-config-instui` are removed and will no longer be
16
+ published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
17
+
18
+
6
19
  ## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
7
20
 
8
21
  ### Bug Fixes
@@ -1,28 +1,5 @@
1
- var _dec, _class;
2
- /*
3
- * The MIT License (MIT)
4
- *
5
- * Copyright (c) 2015 - present Instructure, Inc.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- */
25
-
1
+ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
26
3
  import { Children, Component } from 'react';
27
4
  import { View } from '@instructure/ui-view/v11_6';
28
5
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
@@ -34,198 +11,175 @@ import { withStyle } from '@instructure/emotion';
34
11
  import generateStyle from './styles.js';
35
12
  import generateComponentTheme from './theme.js';
36
13
  import { allowedProps } from './props.js';
37
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
38
- /**
39
- ---
40
- category: components
41
- ---
42
- **/
43
- let Link = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Link extends Component {
44
- static displayName = 'Link';
45
- static componentId = 'Link';
46
- static allowedProps = allowedProps;
47
- static defaultProps = {
48
- // Leave interaction default undefined so that `disabled` can also be supplied
49
- interaction: undefined,
50
- color: 'link',
51
- iconPlacement: 'start',
52
- isWithinText: true,
53
- forceButtonRole: true
54
- };
55
- state = {
56
- hasFocus: false
57
- };
58
- get _link() {
59
- return this.ref;
60
- }
61
- ref = null;
62
- componentDidMount() {
63
- this.props.makeStyles?.(this.makeStyleProps());
64
- }
65
- componentDidUpdate() {
66
- this.props.makeStyles?.(this.makeStyleProps());
67
- }
68
- makeStyleProps = () => {
69
- return {
70
- containsTruncateText: this.containsTruncateText,
71
- hasVisibleChildren: this.hasVisibleChildren
72
- };
73
- };
74
- handleElementRef = el => {
75
- const {
76
- elementRef
77
- } = this.props;
78
- this.ref = el;
79
- if (typeof elementRef === 'function') {
80
- elementRef(el);
81
- }
82
- };
83
- handleClick = event => {
84
- const {
85
- onClick
86
- } = this.props;
87
- const {
88
- interaction
89
- } = this;
90
- if (interaction === 'disabled') {
91
- event.preventDefault();
92
- event.stopPropagation();
93
- } else if (typeof onClick === 'function') {
94
- onClick(event);
95
- }
96
- };
97
- handleFocus = event => {
98
- this.setState({
99
- hasFocus: true
100
- });
101
- if (typeof this.props.onFocus === 'function') {
102
- this.props.onFocus(event);
103
- }
104
- };
105
- handleBlur = event => {
106
- this.setState({
107
- hasFocus: false
108
- });
109
- if (typeof this.props.onBlur === 'function') {
110
- this.props.onBlur(event);
111
- }
112
- };
113
- get containsTruncateText() {
114
- let truncateText = false;
115
- Children.forEach(this.props.children, child => {
116
- if (child && matchComponentTypes(child, ['TruncateText'])) {
117
- truncateText = true;
118
- }
119
- });
120
- warn(
121
- // if display prop is used, warn about icon or TruncateText
122
- !truncateText || this.props.display === undefined, '[Link] Using the display property with TruncateText may cause layout issues.');
123
- return truncateText;
124
- }
125
- get display() {
126
- if (this.props.display) {
127
- return this.props.display; // user-entered display property
128
- }
129
- const {
130
- containsTruncateText
131
- } = this;
132
- if (this.props.renderIcon) {
133
- return containsTruncateText ? 'inline-flex' : 'inline-block';
134
- } else {
135
- return containsTruncateText ? 'block' : 'auto';
136
- }
137
- }
138
- get interaction() {
139
- return getInteraction({
140
- props: this.props,
141
- interactionTypes: ['disabled']
142
- });
143
- }
144
- get element() {
145
- return getElementType(Link, this.props);
146
- }
147
- get focused() {
148
- return isActiveElement(this.ref);
149
- }
150
- get focusable() {
151
- return findFocusable(this.ref);
152
- }
153
- get hasVisibleChildren() {
154
- return hasVisibleChildren(this.props.children);
155
- }
156
- get role() {
157
- const {
158
- role,
159
- forceButtonRole,
160
- onClick
161
- } = this.props;
162
- if (forceButtonRole) {
163
- return onClick && this.element !== 'button' ? 'button' : role;
164
- }
165
- return role;
166
- }
167
- focus() {
168
- this.ref && this.ref.focus();
169
- }
170
- renderIcon() {
171
- warn(
172
- // if display prop is used, warn about icon or TruncateText
173
- this.props.display === undefined, '[Link] Using the display property with an icon may cause layout issues.');
174
- return _jsx("span", {
175
- css: this.props.styles?.icon,
176
- children: callRenderProp(this.props.renderIcon)
177
- });
178
- }
179
- render() {
180
- const {
181
- children,
182
- onClick,
183
- onMouseEnter,
184
- color,
185
- href: rawHref,
186
- margin,
187
- renderIcon,
188
- iconPlacement,
189
- isWithinText,
190
- ...props
191
- } = this.props;
192
- const {
193
- href,
194
- rel
195
- } = safeLinkProps({
196
- attr: 'href',
197
- tag: typeof this.element === 'string' ? this.element : 'a',
198
- href: rawHref,
199
- target: props.target,
200
- rel: props.rel
201
- });
202
- const {
203
- interaction
204
- } = this;
205
- const isDisabled = interaction === 'disabled';
206
- const type = this.element === 'button' || this.element === 'input' ? 'button' : undefined;
207
- const tabIndex = this.role === 'button' && !isDisabled ? 0 : undefined;
208
- return _jsxs(View, {
209
- ...passthroughProps(props),
210
- elementRef: this.handleElementRef,
211
- as: this.element,
212
- display: this.display,
213
- margin: margin,
214
- href: href,
215
- rel: rel,
216
- onMouseEnter: onMouseEnter,
217
- onClick: this.handleClick,
218
- onFocus: this.handleFocus,
219
- onBlur: this.handleBlur,
220
- "aria-disabled": isDisabled ? 'true' : undefined,
221
- role: this.role,
222
- type: type,
223
- tabIndex: tabIndex,
224
- css: this.props.styles?.link,
225
- "data-cid": combineDataCid('Link', this.props),
226
- children: [renderIcon && iconPlacement === 'start' ? this.renderIcon() : null, children, renderIcon && iconPlacement === 'end' ? this.renderIcon() : null]
227
- });
228
- }
229
- }) || _class);
14
+ class Link extends Component {
15
+ static{
16
+ this.displayName = 'Link';
17
+ }
18
+ static{
19
+ this.componentId = 'Link';
20
+ }
21
+ static{
22
+ this.allowedProps = allowedProps;
23
+ }
24
+ static{
25
+ this.defaultProps = {
26
+ interaction: undefined,
27
+ color: 'link',
28
+ iconPlacement: 'start',
29
+ isWithinText: true,
30
+ forceButtonRole: true
31
+ };
32
+ }
33
+ get _link() {
34
+ void 0;
35
+ return this.ref;
36
+ }
37
+ componentDidMount() {
38
+ this.props.makeStyles?.(this.makeStyleProps());
39
+ }
40
+ componentDidUpdate() {
41
+ this.props.makeStyles?.(this.makeStyleProps());
42
+ }
43
+ get containsTruncateText() {
44
+ let truncateText = false;
45
+ Children.forEach(this.props.children, (child)=>{
46
+ if (child && matchComponentTypes(child, [
47
+ 'TruncateText'
48
+ ])) {
49
+ truncateText = true;
50
+ }
51
+ });
52
+ warn(!truncateText || this.props.display === undefined, '[Link] Using the display property with TruncateText may cause layout issues.');
53
+ return truncateText;
54
+ }
55
+ get display() {
56
+ if (this.props.display) {
57
+ return this.props.display;
58
+ }
59
+ const { containsTruncateText } = this;
60
+ if (this.props.renderIcon) {
61
+ return containsTruncateText ? 'inline-flex' : 'inline-block';
62
+ } else {
63
+ return containsTruncateText ? 'block' : 'auto';
64
+ }
65
+ }
66
+ get interaction() {
67
+ return getInteraction({
68
+ props: this.props,
69
+ interactionTypes: [
70
+ 'disabled'
71
+ ]
72
+ });
73
+ }
74
+ get element() {
75
+ return getElementType(Link, this.props);
76
+ }
77
+ get focused() {
78
+ return isActiveElement(this.ref);
79
+ }
80
+ get focusable() {
81
+ return findFocusable(this.ref);
82
+ }
83
+ get hasVisibleChildren() {
84
+ return hasVisibleChildren(this.props.children);
85
+ }
86
+ get role() {
87
+ const { role, forceButtonRole, onClick } = this.props;
88
+ if (forceButtonRole) {
89
+ return onClick && this.element !== 'button' ? 'button' : role;
90
+ }
91
+ return role;
92
+ }
93
+ focus() {
94
+ this.ref && this.ref.focus();
95
+ }
96
+ renderIcon() {
97
+ warn(this.props.display === undefined, '[Link] Using the display property with an icon may cause layout issues.');
98
+ return /*#__PURE__*/ _jsx("span", {
99
+ css: this.props.styles?.icon,
100
+ children: callRenderProp(this.props.renderIcon)
101
+ });
102
+ }
103
+ render() {
104
+ const { children, onClick, onMouseEnter, color, href: rawHref, margin, renderIcon, iconPlacement, isWithinText, ...props } = this.props;
105
+ const { href, rel } = safeLinkProps({
106
+ attr: 'href',
107
+ tag: typeof this.element === 'string' ? this.element : 'a',
108
+ href: rawHref,
109
+ target: props.target,
110
+ rel: props.rel
111
+ });
112
+ const { interaction } = this;
113
+ const isDisabled = interaction === 'disabled';
114
+ const type = this.element === 'button' || this.element === 'input' ? 'button' : undefined;
115
+ const tabIndex = this.role === 'button' && !isDisabled ? 0 : undefined;
116
+ return /*#__PURE__*/ _jsxs(View, {
117
+ ...passthroughProps(props),
118
+ elementRef: this.handleElementRef,
119
+ as: this.element,
120
+ display: this.display,
121
+ margin: margin,
122
+ href: href,
123
+ rel: rel,
124
+ onMouseEnter: onMouseEnter,
125
+ onClick: this.handleClick,
126
+ onFocus: this.handleFocus,
127
+ onBlur: this.handleBlur,
128
+ "aria-disabled": isDisabled ? 'true' : undefined,
129
+ role: this.role,
130
+ type: type,
131
+ tabIndex: tabIndex,
132
+ css: this.props.styles?.link,
133
+ "data-cid": combineDataCid('Link', this.props),
134
+ children: [
135
+ renderIcon && iconPlacement === 'start' ? this.renderIcon() : null,
136
+ children,
137
+ renderIcon && iconPlacement === 'end' ? this.renderIcon() : null
138
+ ]
139
+ });
140
+ }
141
+ constructor(...args){
142
+ super(...args), this.state = {
143
+ hasFocus: false
144
+ }, this.ref = null, this.makeStyleProps = ()=>{
145
+ return {
146
+ containsTruncateText: this.containsTruncateText,
147
+ hasVisibleChildren: this.hasVisibleChildren
148
+ };
149
+ }, this.handleElementRef = (el)=>{
150
+ const { elementRef } = this.props;
151
+ this.ref = el;
152
+ if (typeof elementRef === 'function') {
153
+ elementRef(el);
154
+ }
155
+ }, this.handleClick = (event)=>{
156
+ const { onClick } = this.props;
157
+ const { interaction } = this;
158
+ if (interaction === 'disabled') {
159
+ event.preventDefault();
160
+ event.stopPropagation();
161
+ } else if (typeof onClick === 'function') {
162
+ onClick(event);
163
+ }
164
+ }, this.handleFocus = (event)=>{
165
+ this.setState({
166
+ hasFocus: true
167
+ });
168
+ if (typeof this.props.onFocus === 'function') {
169
+ this.props.onFocus(event);
170
+ }
171
+ }, this.handleBlur = (event)=>{
172
+ this.setState({
173
+ hasFocus: false
174
+ });
175
+ if (typeof this.props.onBlur === 'function') {
176
+ this.props.onBlur(event);
177
+ }
178
+ };
179
+ }
180
+ }
181
+ Link = _ts_decorate([
182
+ withStyle(generateStyle, generateComponentTheme)
183
+ ], Link);
230
184
  export default Link;
231
- export { Link };
185
+ export { Link };
@@ -1,26 +1,21 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- const allowedProps = ['children', 'href', 'color', 'elementRef', 'as', 'role', 'forceButtonRole', 'interaction', 'margin', 'renderIcon', 'iconPlacement', 'display', 'isWithinText', 'onBlur', 'onClick', 'onFocus', 'onMouseEnter', 'variant'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'children',
3
+ 'href',
4
+ 'color',
5
+ 'elementRef',
6
+ 'as',
7
+ 'role',
8
+ 'forceButtonRole',
9
+ 'interaction',
10
+ 'margin',
11
+ 'renderIcon',
12
+ 'iconPlacement',
13
+ 'display',
14
+ 'isWithinText',
15
+ 'onBlur',
16
+ 'onClick',
17
+ 'onFocus',
18
+ 'onMouseEnter',
19
+ 'variant'
20
+ ];
21
+ export { allowedProps };