@instructure/ui-link 11.7.7 → 11.7.8-snapshot-3
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 +7 -0
- package/es/Link/v2/index.js +2 -22
- package/es/Link/v2/styles.js +8 -9
- package/lib/Link/v2/index.js +2 -22
- package/lib/Link/v2/styles.js +8 -9
- package/package.json +14 -14
- package/src/Link/v2/index.tsx +3 -28
- package/src/Link/v2/props.ts +0 -5
- package/src/Link/v2/styles.ts +12 -15
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Link/v2/index.d.ts +1 -6
- package/types/Link/v2/index.d.ts.map +1 -1
- package/types/Link/v2/props.d.ts +0 -4
- package/types/Link/v2/props.d.ts.map +1 -1
- package/types/Link/v2/styles.d.ts +2 -6
- package/types/Link/v2/styles.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.8-snapshot-3](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8-snapshot-3) (2026-09-28)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ui-link,ui-breadcrumb,ui-table:** avoid layout shifts on SSR hydration ([d90cd09](https://github.com/instructure/instructure-ui/commit/d90cd09fcf63775879830a1809cd5169acf91b5f))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
## [11.7.7](https://github.com/instructure/instructure-ui/compare/v11.7.6...v11.7.7) (2026-09-23)
|
|
7
14
|
|
|
8
15
|
**Note:** Version bump only for package @instructure/ui-link
|
package/es/Link/v2/index.js
CHANGED
|
@@ -25,7 +25,6 @@ var _dec, _class;
|
|
|
25
25
|
|
|
26
26
|
import { Children, Component } from 'react';
|
|
27
27
|
import { View } from '@instructure/ui-view/latest';
|
|
28
|
-
import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
29
28
|
import { isActiveElement, findFocusable } from '@instructure/ui-dom-utils';
|
|
30
29
|
import { getElementType, getInteraction, matchComponentTypes, passthroughProps } from '@instructure/ui-react-utils';
|
|
31
30
|
import { combineDataCid, safeLinkProps } from '@instructure/ui-utils';
|
|
@@ -56,27 +55,11 @@ let Link = (_dec = withStyleNew(generateStyle), _dec(_class = class Link extends
|
|
|
56
55
|
};
|
|
57
56
|
ref = null;
|
|
58
57
|
componentDidMount() {
|
|
59
|
-
this.props.makeStyles?.(
|
|
58
|
+
this.props.makeStyles?.();
|
|
60
59
|
}
|
|
61
60
|
componentDidUpdate() {
|
|
62
|
-
this.props.makeStyles?.(
|
|
61
|
+
this.props.makeStyles?.();
|
|
63
62
|
}
|
|
64
|
-
makeStyleProps = () => {
|
|
65
|
-
const {
|
|
66
|
-
variant,
|
|
67
|
-
size: sizeProp
|
|
68
|
-
} = this.props;
|
|
69
|
-
let size = sizeProp;
|
|
70
|
-
if ((variant === 'inline' || variant === 'standalone') && !sizeProp) {
|
|
71
|
-
size = 'medium';
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
containsTruncateText: this.containsTruncateText,
|
|
75
|
-
hasVisibleChildren: this.hasVisibleChildren,
|
|
76
|
-
variant,
|
|
77
|
-
size
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
63
|
handleElementRef = el => {
|
|
81
64
|
const {
|
|
82
65
|
elementRef
|
|
@@ -156,9 +139,6 @@ let Link = (_dec = withStyleNew(generateStyle), _dec(_class = class Link extends
|
|
|
156
139
|
get focusable() {
|
|
157
140
|
return findFocusable(this.ref);
|
|
158
141
|
}
|
|
159
|
-
get hasVisibleChildren() {
|
|
160
|
-
return hasVisibleChildren(this.props.children);
|
|
161
|
-
}
|
|
162
142
|
get role() {
|
|
163
143
|
const {
|
|
164
144
|
role,
|
package/es/Link/v2/styles.js
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
25
26
|
import { calcFocusOutlineStyles, calcSpacingFromShorthand } from '@instructure/emotion';
|
|
26
27
|
/**
|
|
27
28
|
* ---
|
|
@@ -31,22 +32,20 @@ import { calcFocusOutlineStyles, calcSpacingFromShorthand } from '@instructure/e
|
|
|
31
32
|
* @param {Object} componentTheme The theme variable object.
|
|
32
33
|
* @param {Object} props the props of the component, the style is applied to
|
|
33
34
|
* @param {Object} sharedTokens Shared token object that stores common values for the theme.
|
|
34
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
35
35
|
* @return {Object} The final style object, which will be used in the component
|
|
36
36
|
*/
|
|
37
|
-
const generateStyle = (componentTheme, props, sharedTokens
|
|
37
|
+
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
38
38
|
const {
|
|
39
39
|
renderIcon,
|
|
40
40
|
iconPlacement = 'start',
|
|
41
41
|
// TODO workaround needed for react 19 where defaultprops doesn't apply for some reasong
|
|
42
42
|
color,
|
|
43
|
-
margin
|
|
43
|
+
margin,
|
|
44
|
+
variant,
|
|
45
|
+
children
|
|
44
46
|
} = props;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const size = state.size ?? props.size;
|
|
48
|
-
const variant = state.variant ?? props.variant;
|
|
49
|
-
const hasVisibleChildren = state.hasVisibleChildren ?? false;
|
|
47
|
+
const size = !props.size && (variant === 'inline' || variant === 'standalone') ? 'medium' : props.size;
|
|
48
|
+
const hasVisibleContent = hasVisibleChildren(children);
|
|
50
49
|
const isInverseStyle = color === 'link-inverse';
|
|
51
50
|
const inlineLinkSizeStyles = {
|
|
52
51
|
small: {
|
|
@@ -133,7 +132,7 @@ const generateStyle = (componentTheme, props, sharedTokens, state = {}) => {
|
|
|
133
132
|
borderRadius: '0.125rem',
|
|
134
133
|
// If icon is present, use flex to align icon with text
|
|
135
134
|
// Use 'flex' for standalone variant (block-level), 'inline-flex' for inline variant
|
|
136
|
-
...(renderIcon &&
|
|
135
|
+
...(renderIcon && hasVisibleContent && {
|
|
137
136
|
display: variant === 'standalone' ? 'flex' : 'inline-flex',
|
|
138
137
|
alignItems: 'baseline'
|
|
139
138
|
}),
|
package/lib/Link/v2/index.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Link = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _latest = require("@instructure/ui-view/latest");
|
|
10
|
-
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
11
10
|
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
12
11
|
var _findFocusable = require("@instructure/ui-dom-utils/lib/findFocusable.js");
|
|
13
12
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
@@ -67,27 +66,11 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyleNew)(_styles.default), _
|
|
|
67
66
|
};
|
|
68
67
|
ref = null;
|
|
69
68
|
componentDidMount() {
|
|
70
|
-
this.props.makeStyles?.(
|
|
69
|
+
this.props.makeStyles?.();
|
|
71
70
|
}
|
|
72
71
|
componentDidUpdate() {
|
|
73
|
-
this.props.makeStyles?.(
|
|
72
|
+
this.props.makeStyles?.();
|
|
74
73
|
}
|
|
75
|
-
makeStyleProps = () => {
|
|
76
|
-
const {
|
|
77
|
-
variant,
|
|
78
|
-
size: sizeProp
|
|
79
|
-
} = this.props;
|
|
80
|
-
let size = sizeProp;
|
|
81
|
-
if ((variant === 'inline' || variant === 'standalone') && !sizeProp) {
|
|
82
|
-
size = 'medium';
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
containsTruncateText: this.containsTruncateText,
|
|
86
|
-
hasVisibleChildren: this.hasVisibleChildren,
|
|
87
|
-
variant,
|
|
88
|
-
size
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
74
|
handleElementRef = el => {
|
|
92
75
|
const {
|
|
93
76
|
elementRef
|
|
@@ -167,9 +150,6 @@ let Link = exports.Link = (_dec = (0, _emotion.withStyleNew)(_styles.default), _
|
|
|
167
150
|
get focusable() {
|
|
168
151
|
return (0, _findFocusable.findFocusable)(this.ref);
|
|
169
152
|
}
|
|
170
|
-
get hasVisibleChildren() {
|
|
171
|
-
return (0, _hasVisibleChildren.hasVisibleChildren)(this.props.children);
|
|
172
|
-
}
|
|
173
153
|
get role() {
|
|
174
154
|
const {
|
|
175
155
|
role,
|
package/lib/Link/v2/styles.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
7
8
|
var _emotion = require("@instructure/emotion");
|
|
8
9
|
/*
|
|
9
10
|
* The MIT License (MIT)
|
|
@@ -37,22 +38,20 @@ var _emotion = require("@instructure/emotion");
|
|
|
37
38
|
* @param {Object} componentTheme The theme variable object.
|
|
38
39
|
* @param {Object} props the props of the component, the style is applied to
|
|
39
40
|
* @param {Object} sharedTokens Shared token object that stores common values for the theme.
|
|
40
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
41
41
|
* @return {Object} The final style object, which will be used in the component
|
|
42
42
|
*/
|
|
43
|
-
const generateStyle = (componentTheme, props, sharedTokens
|
|
43
|
+
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
44
44
|
const {
|
|
45
45
|
renderIcon,
|
|
46
46
|
iconPlacement = 'start',
|
|
47
47
|
// TODO workaround needed for react 19 where defaultprops doesn't apply for some reasong
|
|
48
48
|
color,
|
|
49
|
-
margin
|
|
49
|
+
margin,
|
|
50
|
+
variant,
|
|
51
|
+
children
|
|
50
52
|
} = props;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const size = state.size ?? props.size;
|
|
54
|
-
const variant = state.variant ?? props.variant;
|
|
55
|
-
const hasVisibleChildren = state.hasVisibleChildren ?? false;
|
|
53
|
+
const size = !props.size && (variant === 'inline' || variant === 'standalone') ? 'medium' : props.size;
|
|
54
|
+
const hasVisibleContent = (0, _hasVisibleChildren.hasVisibleChildren)(children);
|
|
56
55
|
const isInverseStyle = color === 'link-inverse';
|
|
57
56
|
const inlineLinkSizeStyles = {
|
|
58
57
|
small: {
|
|
@@ -139,7 +138,7 @@ const generateStyle = (componentTheme, props, sharedTokens, state = {}) => {
|
|
|
139
138
|
borderRadius: '0.125rem',
|
|
140
139
|
// If icon is present, use flex to align icon with text
|
|
141
140
|
// Use 'flex' for standalone variant (block-level), 'inline-flex' for inline variant
|
|
142
|
-
...(renderIcon &&
|
|
141
|
+
...(renderIcon && hasVisibleContent && {
|
|
143
142
|
display: variant === 'standalone' ? 'flex' : 'inline-flex',
|
|
144
143
|
alignItems: 'baseline'
|
|
145
144
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-link",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.8-snapshot-3",
|
|
4
4
|
"description": "A component for creating links",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/ui-
|
|
22
|
-
"@instructure/ui-
|
|
23
|
-
"@instructure/ui-dom-utils": "11.7.
|
|
24
|
-
"@instructure/ui-icons": "11.7.
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-themes": "11.7.
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/console": "11.7.8-snapshot-3",
|
|
19
|
+
"@instructure/emotion": "11.7.8-snapshot-3",
|
|
20
|
+
"@instructure/shared-types": "11.7.8-snapshot-3",
|
|
21
|
+
"@instructure/ui-a11y-utils": "11.7.8-snapshot-3",
|
|
22
|
+
"@instructure/ui-color-utils": "11.7.8-snapshot-3",
|
|
23
|
+
"@instructure/ui-dom-utils": "11.7.8-snapshot-3",
|
|
24
|
+
"@instructure/ui-icons": "11.7.8-snapshot-3",
|
|
25
|
+
"@instructure/ui-utils": "11.7.8-snapshot-3",
|
|
26
|
+
"@instructure/ui-themes": "11.7.8-snapshot-3",
|
|
27
|
+
"@instructure/ui-view": "11.7.8-snapshot-3",
|
|
28
|
+
"@instructure/ui-react-utils": "11.7.8-snapshot-3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"vitest": "^5.0.0",
|
|
32
|
-
"@instructure/ui-axe-check": "11.7.
|
|
33
|
-
"@instructure/ui-babel-preset": "11.7.
|
|
32
|
+
"@instructure/ui-axe-check": "11.7.8-snapshot-3",
|
|
33
|
+
"@instructure/ui-babel-preset": "11.7.8-snapshot-3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=18 <=19"
|
package/src/Link/v2/index.tsx
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import { Children, Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { View } from '@instructure/ui-view/latest'
|
|
28
|
-
import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
|
|
29
28
|
import { isActiveElement, findFocusable } from '@instructure/ui-dom-utils'
|
|
30
29
|
import {
|
|
31
30
|
getElementType,
|
|
@@ -41,7 +40,7 @@ import { withStyleNew } from '@instructure/emotion'
|
|
|
41
40
|
import generateStyle from './styles.js'
|
|
42
41
|
|
|
43
42
|
import { allowedProps } from './props.js'
|
|
44
|
-
import type { LinkProps, LinkState
|
|
43
|
+
import type { LinkProps, LinkState } from './props'
|
|
45
44
|
|
|
46
45
|
import type { ViewOwnProps } from '@instructure/ui-view/latest'
|
|
47
46
|
|
|
@@ -69,31 +68,11 @@ class Link extends Component<LinkProps, LinkState> {
|
|
|
69
68
|
ref: Element | null = null
|
|
70
69
|
|
|
71
70
|
componentDidMount() {
|
|
72
|
-
this.props.makeStyles?.(
|
|
71
|
+
this.props.makeStyles?.()
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
componentDidUpdate() {
|
|
76
|
-
this.props.makeStyles?.(
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
makeStyleProps = (): LinkStyleProps & {
|
|
80
|
-
variant?: LinkProps['variant']
|
|
81
|
-
size?: LinkProps['size']
|
|
82
|
-
} => {
|
|
83
|
-
const { variant, size: sizeProp } = this.props
|
|
84
|
-
|
|
85
|
-
let size = sizeProp
|
|
86
|
-
|
|
87
|
-
if ((variant === 'inline' || variant === 'standalone') && !sizeProp) {
|
|
88
|
-
size = 'medium'
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
containsTruncateText: this.containsTruncateText,
|
|
93
|
-
hasVisibleChildren: this.hasVisibleChildren,
|
|
94
|
-
variant,
|
|
95
|
-
size
|
|
96
|
-
}
|
|
75
|
+
this.props.makeStyles?.()
|
|
97
76
|
}
|
|
98
77
|
|
|
99
78
|
handleElementRef = (el: Element | null) => {
|
|
@@ -180,10 +159,6 @@ class Link extends Component<LinkProps, LinkState> {
|
|
|
180
159
|
return findFocusable(this.ref)
|
|
181
160
|
}
|
|
182
161
|
|
|
183
|
-
get hasVisibleChildren() {
|
|
184
|
-
return hasVisibleChildren(this.props.children)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
162
|
get role() {
|
|
188
163
|
const { role, forceButtonRole, onClick } = this.props
|
|
189
164
|
|
package/src/Link/v2/props.ts
CHANGED
|
@@ -136,11 +136,6 @@ type LinkOwnProps = {
|
|
|
136
136
|
size?: 'small' | 'medium' | 'large'
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
export type LinkStyleProps = {
|
|
140
|
-
containsTruncateText: boolean
|
|
141
|
-
hasVisibleChildren: boolean
|
|
142
|
-
}
|
|
143
|
-
|
|
144
139
|
type PropKeys = keyof LinkOwnProps
|
|
145
140
|
|
|
146
141
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
package/src/Link/v2/styles.ts
CHANGED
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
|
|
26
|
-
import
|
|
26
|
+
import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
|
|
27
|
+
import type { LinkProps, LinkStyle } from './props'
|
|
27
28
|
import {
|
|
28
29
|
calcFocusOutlineStyles,
|
|
29
30
|
calcSpacingFromShorthand
|
|
@@ -36,31 +37,27 @@ import {
|
|
|
36
37
|
* @param {Object} componentTheme The theme variable object.
|
|
37
38
|
* @param {Object} props the props of the component, the style is applied to
|
|
38
39
|
* @param {Object} sharedTokens Shared token object that stores common values for the theme.
|
|
39
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
40
40
|
* @return {Object} The final style object, which will be used in the component
|
|
41
41
|
*/
|
|
42
42
|
const generateStyle = (
|
|
43
43
|
componentTheme: ReturnType<NewComponentTypes['Link']>,
|
|
44
44
|
props: LinkProps,
|
|
45
|
-
sharedTokens: SharedTokens
|
|
46
|
-
state: Partial<
|
|
47
|
-
LinkStyleProps & {
|
|
48
|
-
variant?: 'inline' | 'standalone'
|
|
49
|
-
size?: 'small' | 'medium' | 'large'
|
|
50
|
-
}
|
|
51
|
-
> = {}
|
|
45
|
+
sharedTokens: SharedTokens
|
|
52
46
|
): LinkStyle => {
|
|
53
47
|
const {
|
|
54
48
|
renderIcon,
|
|
55
49
|
iconPlacement = 'start', // TODO workaround needed for react 19 where defaultprops doesn't apply for some reasong
|
|
56
50
|
color,
|
|
57
|
-
margin
|
|
51
|
+
margin,
|
|
52
|
+
variant,
|
|
53
|
+
children
|
|
58
54
|
} = props
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
const size =
|
|
57
|
+
!props.size && (variant === 'inline' || variant === 'standalone')
|
|
58
|
+
? 'medium'
|
|
59
|
+
: props.size
|
|
60
|
+
const hasVisibleContent = hasVisibleChildren(children)
|
|
64
61
|
const isInverseStyle = color === 'link-inverse'
|
|
65
62
|
|
|
66
63
|
const inlineLinkSizeStyles = {
|
|
@@ -152,7 +149,7 @@ const generateStyle = (
|
|
|
152
149
|
// If icon is present, use flex to align icon with text
|
|
153
150
|
// Use 'flex' for standalone variant (block-level), 'inline-flex' for inline variant
|
|
154
151
|
...(renderIcon &&
|
|
155
|
-
|
|
152
|
+
hasVisibleContent && {
|
|
156
153
|
display: variant === 'standalone' ? 'flex' : 'inline-flex',
|
|
157
154
|
alignItems: 'baseline'
|
|
158
155
|
}),
|