@instructure/ui-link 11.6.0 → 11.6.1-pr-snapshot-1779894247159

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,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
+ ## [11.6.1-pr-snapshot-1779894247159](https://github.com/instructure/instructure-ui/compare/v11.6.0...v11.6.1-pr-snapshot-1779894247159) (2026-05-27)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-link
9
+
10
+
11
+
12
+
13
+
6
14
  # [11.6.0](https://github.com/instructure/instructure-ui/compare/v11.5.0...v11.6.0) (2026-02-18)
7
15
 
8
16
  **Note:** Version bump only for package @instructure/ui-link
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
1
  /*
8
2
  * The MIT License (MIT)
9
3
  *
@@ -28,4 +22,16 @@ exports.allowedProps = void 0;
28
22
  * SOFTWARE.
29
23
  */
30
24
 
31
- const allowedProps = exports.allowedProps = ['children', 'href', 'color', 'elementRef', 'as', 'role', 'forceButtonRole', 'interaction', 'margin', 'renderIcon', 'iconPlacement', 'display', 'isWithinText', 'onBlur', 'onClick', 'onFocus', 'onMouseEnter', 'variant'];
25
+ module.exports = {
26
+ presets: [
27
+ [
28
+ require('@instructure/ui-babel-preset'),
29
+ {
30
+ coverage: Boolean(process.env.COVERAGE),
31
+ esModules: Boolean(process.env.ES_MODULES),
32
+ removeConsole: process.env.NODE_ENV === 'production',
33
+ transformImports: Boolean(process.env.TRANSFORM_IMPORTS)
34
+ }
35
+ ]
36
+ ]
37
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/ui-link",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-pr-snapshot-1779894247159",
4
+ "type": "module",
4
5
  "description": "A component for creating links",
5
6
  "author": "Instructure, Inc. Engineering and Product Design",
6
7
  "module": "./es/index.js",
7
- "main": "./lib/index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
@@ -15,25 +15,25 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/emotion": "11.6.0",
19
- "@instructure/shared-types": "11.6.0",
20
- "@instructure/ui-a11y-utils": "11.6.0",
21
- "@instructure/ui-color-utils": "11.6.0",
22
- "@instructure/ui-dom-utils": "11.6.0",
23
- "@instructure/console": "11.6.0",
24
- "@instructure/ui-react-utils": "11.6.0",
25
- "@instructure/ui-icons": "11.6.0",
26
- "@instructure/ui-utils": "11.6.0",
27
- "@instructure/ui-view": "11.6.0"
18
+ "@instructure/console": "11.6.1-pr-snapshot-1779894247159",
19
+ "@instructure/emotion": "11.6.1-pr-snapshot-1779894247159",
20
+ "@instructure/ui-a11y-utils": "11.6.1-pr-snapshot-1779894247159",
21
+ "@instructure/shared-types": "11.6.1-pr-snapshot-1779894247159",
22
+ "@instructure/ui-color-utils": "11.6.1-pr-snapshot-1779894247159",
23
+ "@instructure/ui-dom-utils": "11.6.1-pr-snapshot-1779894247159",
24
+ "@instructure/ui-icons": "11.6.1-pr-snapshot-1779894247159",
25
+ "@instructure/ui-utils": "11.6.1-pr-snapshot-1779894247159",
26
+ "@instructure/ui-view": "11.6.1-pr-snapshot-1779894247159",
27
+ "@instructure/ui-react-utils": "11.6.1-pr-snapshot-1779894247159"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@testing-library/jest-dom": "^6.6.3",
31
31
  "@testing-library/react": "15.0.7",
32
32
  "@testing-library/user-event": "^14.6.1",
33
33
  "vitest": "^3.2.2",
34
- "@instructure/ui-axe-check": "11.6.0",
35
- "@instructure/ui-themes": "11.6.0",
36
- "@instructure/ui-babel-preset": "11.6.0"
34
+ "@instructure/ui-axe-check": "11.6.1-pr-snapshot-1779894247159",
35
+ "@instructure/ui-babel-preset": "11.6.1-pr-snapshot-1779894247159",
36
+ "@instructure/ui-themes": "11.6.1-pr-snapshot-1779894247159"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "react": ">=18 <=19"
@@ -46,10 +46,8 @@
46
46
  ".": {
47
47
  "types": "./types/index.d.ts",
48
48
  "import": "./es/index.js",
49
- "require": "./lib/index.js",
50
49
  "default": "./es/index.js"
51
50
  },
52
- "./lib/*": "./lib/*",
53
51
  "./es/*": "./es/*",
54
52
  "./types/*": "./types/*",
55
53
  "./package.json": "./package.json",
@@ -59,7 +57,7 @@
59
57
  "lint": "ui-scripts lint",
60
58
  "lint:fix": "ui-scripts lint --fix",
61
59
  "clean": "ui-scripts clean",
62
- "build": "ui-scripts build --modules es,cjs",
60
+ "build": "ui-scripts build",
63
61
  "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
64
62
  "build:types": "tsc -p tsconfig.build.json",
65
63
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
package/lib/Link/index.js DELETED
@@ -1,223 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Link = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _react = require("react");
10
- var _View = require("@instructure/ui-view/lib/View");
11
- var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
12
- var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
13
- var _findFocusable = require("@instructure/ui-dom-utils/lib/findFocusable.js");
14
- var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
15
- var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
16
- var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
17
- var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
18
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
19
- var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
20
- var _console = require("@instructure/console");
21
- var _emotion = require("@instructure/emotion");
22
- var _styles = _interopRequireDefault(require("./styles"));
23
- var _theme = _interopRequireDefault(require("./theme"));
24
- var _props = require("./props");
25
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
26
- const _excluded = ["children", "onClick", "onMouseEnter", "color", "href", "margin", "renderIcon", "iconPlacement", "isWithinText"];
27
- var _dec, _class, _Link;
28
- /*
29
- * The MIT License (MIT)
30
- *
31
- * Copyright (c) 2015 - present Instructure, Inc.
32
- *
33
- * Permission is hereby granted, free of charge, to any person obtaining a copy
34
- * of this software and associated documentation files (the "Software"), to deal
35
- * in the Software without restriction, including without limitation the rights
36
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
- * copies of the Software, and to permit persons to whom the Software is
38
- * furnished to do so, subject to the following conditions:
39
- *
40
- * The above copyright notice and this permission notice shall be included in all
41
- * copies or substantial portions of the Software.
42
- *
43
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49
- * SOFTWARE.
50
- */
51
- /**
52
- ---
53
- category: components
54
- ---
55
- **/
56
- let Link = exports.Link = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Link = class Link extends _react.Component {
57
- constructor(...args) {
58
- super(...args);
59
- this.state = {
60
- hasFocus: false
61
- };
62
- this.ref = null;
63
- this.makeStyleProps = () => {
64
- return {
65
- containsTruncateText: this.containsTruncateText,
66
- hasVisibleChildren: this.hasVisibleChildren
67
- };
68
- };
69
- this.handleElementRef = el => {
70
- const elementRef = this.props.elementRef;
71
- this.ref = el;
72
- if (typeof elementRef === 'function') {
73
- elementRef(el);
74
- }
75
- };
76
- this.handleClick = event => {
77
- const onClick = this.props.onClick;
78
- const interaction = this.interaction;
79
- if (interaction === 'disabled') {
80
- event.preventDefault();
81
- event.stopPropagation();
82
- } else if (typeof onClick === 'function') {
83
- onClick(event);
84
- }
85
- };
86
- this.handleFocus = event => {
87
- this.setState({
88
- hasFocus: true
89
- });
90
- if (typeof this.props.onFocus === 'function') {
91
- this.props.onFocus(event);
92
- }
93
- };
94
- this.handleBlur = event => {
95
- this.setState({
96
- hasFocus: false
97
- });
98
- if (typeof this.props.onBlur === 'function') {
99
- this.props.onBlur(event);
100
- }
101
- };
102
- }
103
- get _link() {
104
- return this.ref;
105
- }
106
- componentDidMount() {
107
- var _this$props$makeStyle, _this$props;
108
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
109
- }
110
- componentDidUpdate() {
111
- var _this$props$makeStyle2, _this$props2;
112
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
113
- }
114
- get containsTruncateText() {
115
- let truncateText = false;
116
- _react.Children.forEach(this.props.children, child => {
117
- if (child && (0, _matchComponentTypes.matchComponentTypes)(child, ['TruncateText'])) {
118
- truncateText = true;
119
- }
120
- });
121
- (0, _console.logWarn)(
122
- // if display prop is used, warn about icon or TruncateText
123
- !truncateText || this.props.display === void 0, '[Link] Using the display property with TruncateText may cause layout issues.');
124
- return truncateText;
125
- }
126
- get display() {
127
- if (this.props.display) {
128
- return this.props.display; // user-entered display property
129
- }
130
- const containsTruncateText = this.containsTruncateText;
131
- if (this.props.renderIcon) {
132
- return containsTruncateText ? 'inline-flex' : 'inline-block';
133
- } else {
134
- return containsTruncateText ? 'block' : 'auto';
135
- }
136
- }
137
- get interaction() {
138
- return (0, _getInteraction.getInteraction)({
139
- props: this.props,
140
- interactionTypes: ['disabled']
141
- });
142
- }
143
- get element() {
144
- return (0, _getElementType.getElementType)(Link, this.props);
145
- }
146
- get focused() {
147
- return (0, _isActiveElement.isActiveElement)(this.ref);
148
- }
149
- get focusable() {
150
- return (0, _findFocusable.findFocusable)(this.ref);
151
- }
152
- get hasVisibleChildren() {
153
- return (0, _hasVisibleChildren.hasVisibleChildren)(this.props.children);
154
- }
155
- get role() {
156
- const _this$props3 = this.props,
157
- role = _this$props3.role,
158
- forceButtonRole = _this$props3.forceButtonRole,
159
- onClick = _this$props3.onClick;
160
- if (forceButtonRole) {
161
- return onClick && this.element !== 'button' ? 'button' : role;
162
- }
163
- return role;
164
- }
165
- focus() {
166
- this.ref && this.ref.focus();
167
- }
168
- renderIcon() {
169
- var _this$props$styles;
170
- (0, _console.logWarn)(
171
- // if display prop is used, warn about icon or TruncateText
172
- this.props.display === void 0, '[Link] Using the display property with an icon may cause layout issues.');
173
- return (0, _jsxRuntime.jsx)("span", {
174
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon,
175
- children: (0, _callRenderProp.callRenderProp)(this.props.renderIcon)
176
- });
177
- }
178
- render() {
179
- var _this$props$styles2;
180
- const _this$props4 = this.props,
181
- children = _this$props4.children,
182
- onClick = _this$props4.onClick,
183
- onMouseEnter = _this$props4.onMouseEnter,
184
- color = _this$props4.color,
185
- href = _this$props4.href,
186
- margin = _this$props4.margin,
187
- renderIcon = _this$props4.renderIcon,
188
- iconPlacement = _this$props4.iconPlacement,
189
- isWithinText = _this$props4.isWithinText,
190
- props = (0, _objectWithoutProperties2.default)(_this$props4, _excluded);
191
- const interaction = this.interaction;
192
- const isDisabled = interaction === 'disabled';
193
- const type = this.element === 'button' || this.element === 'input' ? 'button' : void 0;
194
- const tabIndex = this.role === 'button' && !isDisabled ? 0 : void 0;
195
- return (0, _jsxRuntime.jsxs)(_View.View, {
196
- ...(0, _passthroughProps.passthroughProps)(props),
197
- elementRef: this.handleElementRef,
198
- as: this.element,
199
- display: this.display,
200
- margin: margin,
201
- href: href,
202
- onMouseEnter: onMouseEnter,
203
- onClick: this.handleClick,
204
- onFocus: this.handleFocus,
205
- onBlur: this.handleBlur,
206
- "aria-disabled": isDisabled ? 'true' : void 0,
207
- role: this.role,
208
- type: type,
209
- tabIndex: tabIndex,
210
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.link,
211
- "data-cid": (0, _combineDataCid.combineDataCid)('Link', this.props),
212
- children: [renderIcon && iconPlacement === 'start' ? this.renderIcon() : null, children, renderIcon && iconPlacement === 'end' ? this.renderIcon() : null]
213
- });
214
- }
215
- }, _Link.displayName = "Link", _Link.componentId = 'Link', _Link.allowedProps = _props.allowedProps, _Link.defaultProps = {
216
- // Leave interaction default undefined so that `disabled` can also be supplied
217
- interaction: void 0,
218
- color: 'link',
219
- iconPlacement: 'start',
220
- isWithinText: true,
221
- forceButtonRole: true
222
- }, _Link)) || _class);
223
- var _default = exports.default = Link;
@@ -1,194 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * ---
33
- * private: true
34
- * ---
35
- * Generates the style object from the theme and provided additional information
36
- * @param {Object} componentTheme The theme variable object.
37
- * @param {Object} props the props of the component, the style is applied to
38
- * @param {Object} state the state of the component, the style is applied to
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = (componentTheme, props, state) => {
42
- const isWithinText = props.isWithinText,
43
- renderIcon = props.renderIcon,
44
- _props$iconPlacement = props.iconPlacement,
45
- iconPlacement = _props$iconPlacement === void 0 ? 'start' : _props$iconPlacement,
46
- color = props.color,
47
- variant = props.variant;
48
- const containsTruncateText = state.containsTruncateText,
49
- hasVisibleChildren = state.hasVisibleChildren;
50
- const inverseStyle = color === 'link-inverse';
51
- const variantStyles = {
52
- inline: {
53
- fontSize: componentTheme.fontSize,
54
- lineHeight: componentTheme.lineHeight,
55
- textDecoration: 'underline'
56
- },
57
- 'inline-small': {
58
- fontSize: componentTheme.fontSizeSmall,
59
- lineHeight: '1.3125rem',
60
- textDecoration: 'underline'
61
- },
62
- standalone: {
63
- fontSize: componentTheme.fontSize,
64
- lineHeight: componentTheme.lineHeight,
65
- textDecoration: 'none'
66
- },
67
- 'standalone-small': {
68
- fontSize: componentTheme.fontSizeSmall,
69
- lineHeight: componentTheme.lineHeight,
70
- textDecoration: 'none'
71
- }
72
- };
73
- const baseStyles = {
74
- boxSizing: 'border-box',
75
- fontFamily: componentTheme.fontFamily,
76
- fontWeight: componentTheme.fontWeight,
77
- transition: 'outline-color 0.2s',
78
- verticalAlign: 'baseline',
79
- // set up focus styles
80
- outlineColor: 'transparent',
81
- outlineOffset: '0.25rem',
82
- textUnderlineOffset: componentTheme.textUnderlineOffset,
83
- // If TruncateText is used in Link with icon, align the icon and the text vertically
84
- ...(renderIcon && containsTruncateText && hasVisibleChildren && {
85
- alignItems: 'center'
86
- }),
87
- '&&&&&&:focus': {
88
- outlineWidth: componentTheme.focusOutlineWidth,
89
- outlineStyle: componentTheme.focusOutlineStyle,
90
- borderRadius: componentTheme.focusOutlineBorderRadius,
91
- outlineColor: componentTheme.focusOutlineColor
92
- },
93
- '&[aria-disabled]': {
94
- cursor: 'not-allowed',
95
- pointerEvents: 'none',
96
- opacity: '0.5'
97
- },
98
- '&::-moz-focus-inner': {
99
- border: 0 // removes default dotted focus outline in Firefox
100
- }
101
- };
102
-
103
- // If Link is a button or link, it should look clickable
104
- const isClickableStyles = {
105
- ...baseStyles,
106
- cursor: 'pointer',
107
- color: componentTheme.color,
108
- // This needs stronger specificity than `View`
109
- '&&&&&:focus': {
110
- color: componentTheme.color,
111
- outlineColor: componentTheme.focusOutlineColor
112
- },
113
- '&:hover, &:active': {
114
- color: componentTheme.hoverColor,
115
- textDecoration: isWithinText ? componentTheme.hoverTextDecorationWithinText : componentTheme.hoverTextDecorationOutsideText
116
- },
117
- ...(variant ? variantStyles[variant] : {
118
- textDecoration: isWithinText ? componentTheme.textDecorationWithinText : componentTheme.textDecorationOutsideText
119
- })
120
- };
121
- const buttonStyle = {
122
- appearance: 'none',
123
- userSelect: 'text',
124
- background: 'none',
125
- border: 'none',
126
- cursor: 'pointer',
127
- margin: 0,
128
- padding: 0,
129
- textAlign: 'inherit',
130
- ...(variant ? variantStyles[variant] : {
131
- fontSize: '1em'
132
- })
133
- };
134
- const inverseStyles = {
135
- color: componentTheme.colorInverse,
136
- '&&&&&:focus': {
137
- outlineColor: componentTheme.focusInverseOutlineColor
138
- },
139
- ...(renderIcon && {
140
- '&&&&&:focus': {
141
- outlineColor: componentTheme.focusInverseIconOutlineColor
142
- }
143
- }),
144
- '&:hover, &&&&&:focus, &:active': {
145
- color: componentTheme.colorInverse
146
- }
147
- };
148
- const variantIconStyles = {
149
- inline: {
150
- paddingInlineStart: iconPlacement === 'start' ? 0 : componentTheme.iconPlusTextMargin,
151
- paddingInlineEnd: iconPlacement === 'start' ? componentTheme.iconPlusTextMargin : 0
152
- },
153
- 'inline-small': {
154
- paddingInlineStart: iconPlacement === 'start' ? 0 : componentTheme.iconPlusTextMarginSmall,
155
- paddingInlineEnd: iconPlacement === 'start' ? componentTheme.iconPlusTextMarginSmall : 0
156
- },
157
- standalone: {
158
- paddingInlineStart: iconPlacement === 'start' ? 0 : componentTheme.iconPlusTextMargin,
159
- paddingInlineEnd: iconPlacement === 'start' ? componentTheme.iconPlusTextMargin : 0
160
- },
161
- 'standalone-small': {
162
- paddingInlineStart: iconPlacement === 'start' ? 0 : componentTheme.iconPlusTextMarginSmall,
163
- paddingInlineEnd: iconPlacement === 'start' ? componentTheme.iconPlusTextMarginSmall : 0
164
- }
165
- };
166
- return {
167
- link: {
168
- label: 'link',
169
- ...baseStyles,
170
- // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
171
- '&:is(a), &:is(button)': isClickableStyles,
172
- '&:-webkit-any(a), &:-webkit-any(button)': isClickableStyles,
173
- '&:is(button)': buttonStyle,
174
- '&:-webkit-any(button)': buttonStyle,
175
- ...(inverseStyle && {
176
- ...inverseStyles,
177
- '&:is(a):link, &:is(a):visited, &:is(button)': inverseStyles,
178
- '&:-webkit-any(a):link, &:-webkit-any(a):visited, &:-webkit-any(button)': inverseStyles
179
- })
180
- },
181
- icon: {
182
- label: 'icon',
183
- ...(renderIcon && {
184
- fontSize: componentTheme.iconSize,
185
- boxSizing: 'border-box',
186
- ...(variant ? variantIconStyles[variant] : {
187
- paddingInlineStart: iconPlacement === 'start' ? 0 : componentTheme.iconPlusTextMargin,
188
- paddingInlineEnd: iconPlacement === 'start' ? componentTheme.iconPlusTextMargin : 0
189
- })
190
- })
191
- }
192
- };
193
- };
194
- var _default = exports.default = generateStyle;
package/lib/Link/theme.js DELETED
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _darken = require("@instructure/ui-color-utils/lib/darken.js");
8
- /*
9
- * The MIT License (MIT)
10
- *
11
- * Copyright (c) 2015 - present Instructure, Inc.
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- * copies of the Software, and to permit persons to whom the Software is
18
- * furnished to do so, subject to the following conditions:
19
- *
20
- * The above copyright notice and this permission notice shall be included in all
21
- * copies or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
- * SOFTWARE.
30
- */
31
-
32
- /**
33
- * Generates the theme object for the component from the theme and provided additional information
34
- * @param {Object} theme The actual theme object.
35
- * @return {Object} The final theme object with the overrides and component variables
36
- */
37
- const generateComponentTheme = theme => {
38
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6;
39
- const colors = theme.colors,
40
- borders = theme.borders,
41
- typography = theme.typography,
42
- spacing = theme.spacing,
43
- themeName = theme.key;
44
-
45
- // if any styling should depend on the theme itself,
46
- // this object should specify it
47
- const themeSpecificStyle = {
48
- canvas: {
49
- color: theme['ic-link-color'],
50
- focusOutlineColor: theme['ic-brand-primary'],
51
- hoverColor: (0, _darken.darken)(theme['ic-link-color'], 10)
52
- },
53
- 'canvas-high-contrast': {
54
- textDecorationOutsideText: 'underline',
55
- hoverTextDecorationOutsideText: 'none'
56
- }
57
- };
58
-
59
- // maps the theme variables to component specific style variables
60
- const componentVariables = {
61
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
62
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
63
- fontSize: typography === null || typography === void 0 ? void 0 : typography.content,
64
- lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeight150,
65
- fontSizeSmall: typography === null || typography === void 0 ? void 0 : typography.contentSmall,
66
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.blue5782,
67
- textDecorationWithinText: 'underline',
68
- hoverTextDecorationWithinText: 'none',
69
- textDecorationOutsideText: 'none',
70
- hoverTextDecorationOutsideText: 'underline',
71
- focusOutlineWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
72
- focusOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.blue4570,
73
- focusOutlineStyle: borders === null || borders === void 0 ? void 0 : borders.style,
74
- focusOutlineBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusSmall,
75
- hoverColor: (0, _darken.darken)(colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.blue5782, 10),
76
- colorInverse: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.grey1111,
77
- focusInverseOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.white1010,
78
- focusInverseIconOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.white1010,
79
- iconSize: '1.125em',
80
- // make icon slightly larger than inherited font-size,
81
- iconPlusTextMargin: spacing.space4,
82
- iconPlusTextMarginSmall: spacing.space2,
83
- textUnderlineOffset: 'auto'
84
- };
85
- return {
86
- ...componentVariables,
87
- ...themeSpecificStyle[themeName]
88
- };
89
- };
90
- var _default = exports.default = generateComponentTheme;
package/lib/index.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Link", {
7
- enumerable: true,
8
- get: function () {
9
- return _Link.Link;
10
- }
11
- });
12
- var _Link = require("./Link");
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}