@instructure/ui-navigation 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
  **Note:** Version bump only for package @instructure/ui-navigation
@@ -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 { Component } from 'react';
27
4
  import { logError as error } from '@instructure/console';
28
5
  import { callRenderProp, getElementType, matchComponentTypes, passthroughProps } from '@instructure/ui-react-utils';
@@ -33,99 +10,92 @@ import { withStyle } from '@instructure/emotion';
33
10
  import generateStyle from './styles.js';
34
11
  import generateComponentTheme from './theme.js';
35
12
  import { allowedProps } from './props.js';
36
-
37
- /**
38
- ---
39
- parent: AppNav
40
- id: AppNav.Item
41
- ---
42
- @module Item
43
- **/
44
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
45
- let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Item extends Component {
46
- static displayName = 'Item';
47
- static componentId = 'AppNav.Item';
48
- static allowedProps = allowedProps;
49
- static defaultProps = {
50
- children: null,
51
- isSelected: false,
52
- cursor: 'pointer',
53
- isDisabled: false
54
- };
55
- ref = null;
56
- componentDidMount() {
57
- this.props.makeStyles?.();
58
- }
59
- componentDidUpdate() {
60
- this.props.makeStyles?.();
61
- }
62
- handleRef = el => {
63
- const {
64
- elementRef
65
- } = this.props;
66
- this.ref = el;
67
- if (typeof elementRef === 'function') {
68
- elementRef(el);
13
+ class Item extends Component {
14
+ static{
15
+ this.displayName = 'Item';
16
+ }
17
+ static{
18
+ this.componentId = 'AppNav.Item';
19
+ }
20
+ static{
21
+ this.allowedProps = allowedProps;
22
+ }
23
+ static{
24
+ this.defaultProps = {
25
+ children: null,
26
+ isSelected: false,
27
+ cursor: 'pointer',
28
+ isDisabled: false
29
+ };
30
+ }
31
+ componentDidMount() {
32
+ this.props.makeStyles?.();
33
+ }
34
+ componentDidUpdate() {
35
+ this.props.makeStyles?.();
69
36
  }
70
- };
71
- handleClick = e => {
72
- const {
73
- isDisabled,
74
- onClick
75
- } = this.props;
76
- if (isDisabled) {
77
- e.preventDefault();
78
- e.stopPropagation();
79
- } else if (typeof onClick === 'function') {
80
- onClick(e);
37
+ render() {
38
+ const ElementType = getElementType(Item, this.props);
39
+ const { renderIcon, renderLabel, href: rawHref, renderAfter, cursor, isDisabled } = this.props;
40
+ const { href, rel } = safeLinkProps({
41
+ attr: 'href',
42
+ tag: typeof ElementType === 'string' ? ElementType : 'a',
43
+ href: rawHref,
44
+ target: this.props.target,
45
+ rel: this.props.rel
46
+ });
47
+ const icon = callRenderProp(renderIcon);
48
+ const label = callRenderProp(renderLabel);
49
+ const labelIsForScreenReaders = matchComponentTypes(label, [
50
+ ScreenReaderContent
51
+ ]);
52
+ if (icon) {
53
+ error(labelIsForScreenReaders, '[AppNav] If an icon is used, the label text should be wrapped in <ScreenReaderContent />.');
54
+ }
55
+ return /*#__PURE__*/ _jsxs(View, {
56
+ ...passthroughProps(this.props),
57
+ as: ElementType,
58
+ href: href,
59
+ rel: rel,
60
+ onClick: this.handleClick,
61
+ disabled: isDisabled,
62
+ elementRef: this.handleRef,
63
+ display: "flex",
64
+ position: "relative",
65
+ borderRadius: "medium",
66
+ cursor: isDisabled ? 'not-allowed' : cursor,
67
+ css: this.props.styles?.item,
68
+ "data-cid": "AppNav.Item",
69
+ children: [
70
+ icon,
71
+ labelIsForScreenReaders ? label : /*#__PURE__*/ _jsx("span", {
72
+ css: this.props.styles?.label,
73
+ children: label
74
+ }),
75
+ renderAfter && callRenderProp(renderAfter)
76
+ ]
77
+ });
81
78
  }
82
- };
83
- render() {
84
- const ElementType = getElementType(Item, this.props);
85
- const {
86
- renderIcon,
87
- renderLabel,
88
- href: rawHref,
89
- renderAfter,
90
- cursor,
91
- isDisabled
92
- } = this.props;
93
- const {
94
- href,
95
- rel
96
- } = safeLinkProps({
97
- attr: 'href',
98
- tag: typeof ElementType === 'string' ? ElementType : 'a',
99
- href: rawHref,
100
- target: this.props.target,
101
- rel: this.props.rel
102
- });
103
- const icon = callRenderProp(renderIcon);
104
- const label = callRenderProp(renderLabel);
105
- const labelIsForScreenReaders = matchComponentTypes(label, [ScreenReaderContent]);
106
- if (icon) {
107
- error(labelIsForScreenReaders, '[AppNav] If an icon is used, the label text should be wrapped in <ScreenReaderContent />.');
79
+ constructor(...args){
80
+ super(...args), this.ref = null, this.handleRef = (el)=>{
81
+ const { elementRef } = this.props;
82
+ this.ref = el;
83
+ if (typeof elementRef === 'function') {
84
+ elementRef(el);
85
+ }
86
+ }, this.handleClick = (e)=>{
87
+ const { isDisabled, onClick } = this.props;
88
+ if (isDisabled) {
89
+ e.preventDefault();
90
+ e.stopPropagation();
91
+ } else if (typeof onClick === 'function') {
92
+ onClick(e);
93
+ }
94
+ };
108
95
  }
109
- return _jsxs(View, {
110
- ...passthroughProps(this.props),
111
- as: ElementType,
112
- href: href,
113
- rel: rel,
114
- onClick: this.handleClick,
115
- disabled: isDisabled,
116
- elementRef: this.handleRef,
117
- display: "flex",
118
- position: "relative",
119
- borderRadius: "medium",
120
- cursor: isDisabled ? 'not-allowed' : cursor,
121
- css: this.props.styles?.item,
122
- "data-cid": "AppNav.Item",
123
- children: [icon, labelIsForScreenReaders ? label : _jsx("span", {
124
- css: this.props.styles?.label,
125
- children: label
126
- }), renderAfter && callRenderProp(renderAfter)]
127
- });
128
- }
129
- }) || _class);
96
+ }
97
+ Item = _ts_decorate([
98
+ withStyle(generateStyle, generateComponentTheme)
99
+ ], Item);
130
100
  export default Item;
131
- export { Item };
101
+ export { Item };
@@ -1,26 +1,13 @@
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 = ['renderLabel', 'renderAfter', 'renderIcon', 'href', 'onClick', 'isSelected', 'elementRef', 'as', 'cursor', 'isDisabled'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'renderLabel',
3
+ 'renderAfter',
4
+ 'renderIcon',
5
+ 'href',
6
+ 'onClick',
7
+ 'isSelected',
8
+ 'elementRef',
9
+ 'as',
10
+ 'cursor',
11
+ 'isDisabled'
12
+ ];
13
+ export { allowedProps };
@@ -1,87 +1,49 @@
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
- /**
26
- * ---
27
- * private: true
28
- * ---
29
- * Generates the style object from the theme and provided additional information
30
- * @param {Object} componentTheme The theme variable object.
31
- * @param {Object} props the props of the component, the style is applied to
32
- * @param {Object} state the state of the component, the style is applied to
33
- * @return {Object} The final style object, which will be used in the component
34
- */
35
- const generateStyle = (componentTheme, props) => {
36
- const {
37
- isSelected,
38
- isDisabled
39
- } = props;
40
- const itemStyles = {
41
- appearance: 'none',
42
- overflow: 'visible',
43
- direction: 'inherit',
44
- margin: '0',
45
- textDecoration: 'none',
46
- userSelect: 'none',
47
- touchAction: 'manipulation',
48
- background: 'transparent',
49
- border: 'none',
50
- outline: 'none',
51
- lineHeight: componentTheme.height,
52
- padding: `0 ${componentTheme.padding}`,
53
- alignItems: 'flex-start',
54
- '&:hover': {
55
- textDecoration: 'underline',
56
- textDecorationColor: componentTheme.textColor
57
- },
58
- ...(isDisabled && {
59
- pointerEvents: 'none',
60
- opacity: 0.5
61
- })
62
- };
63
- return {
64
- item: {
65
- label: 'item',
66
- ...itemStyles,
67
- // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
68
- '&:is(a), &:is(button)': itemStyles,
69
- '&:-webkit-any(a), &:-webkit-any(button)': itemStyles
70
- },
71
- label: {
72
- label: 'item__label',
73
- whiteSpace: 'nowrap',
74
- overflow: 'hidden',
75
- textOverflow: 'ellipsis',
76
- fontFamily: componentTheme.fontFamily,
77
- fontSize: componentTheme.fontSize,
78
- fontWeight: componentTheme.fontWeight,
79
- color: componentTheme.textColor,
80
- ...(isSelected && {
81
- color: componentTheme.textColorSelected,
82
- textDecoration: 'underline'
83
- })
84
- }
85
- };
1
+ const generateStyle = (componentTheme, props)=>{
2
+ const { isSelected, isDisabled } = props;
3
+ const itemStyles = {
4
+ appearance: 'none',
5
+ overflow: 'visible',
6
+ direction: 'inherit',
7
+ margin: '0',
8
+ textDecoration: 'none',
9
+ userSelect: 'none',
10
+ touchAction: 'manipulation',
11
+ background: 'transparent',
12
+ border: 'none',
13
+ outline: 'none',
14
+ lineHeight: componentTheme.height,
15
+ padding: `0 ${componentTheme.padding}`,
16
+ alignItems: 'flex-start',
17
+ '&:hover': {
18
+ textDecoration: 'underline',
19
+ textDecorationColor: componentTheme.textColor
20
+ },
21
+ ...isDisabled && {
22
+ pointerEvents: 'none',
23
+ opacity: 0.5
24
+ }
25
+ };
26
+ return {
27
+ item: {
28
+ label: 'item',
29
+ ...itemStyles,
30
+ '&:is(a), &:is(button)': itemStyles,
31
+ '&:-webkit-any(a), &:-webkit-any(button)': itemStyles
32
+ },
33
+ label: {
34
+ label: 'item__label',
35
+ whiteSpace: 'nowrap',
36
+ overflow: 'hidden',
37
+ textOverflow: 'ellipsis',
38
+ fontFamily: componentTheme.fontFamily,
39
+ fontSize: componentTheme.fontSize,
40
+ fontWeight: componentTheme.fontWeight,
41
+ color: componentTheme.textColor,
42
+ ...isSelected && {
43
+ color: componentTheme.textColorSelected,
44
+ textDecoration: 'underline'
45
+ }
46
+ }
47
+ };
86
48
  };
87
- export default generateStyle;
49
+ export default generateStyle;
@@ -1,50 +1,17 @@
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
- /**
26
- * Generates the theme object for the component from the theme and provided additional information
27
- * @param {Object} theme The actual theme object.
28
- * @return {Object} The final theme object with the overrides and component variables
29
- */
30
- const generateComponentTheme = theme => {
31
- const {
32
- colors,
33
- spacing,
34
- typography
35
- } = theme;
36
- const componentVariables = {
37
- fontFamily: typography?.fontFamily,
38
- fontSize: '1.125rem',
39
- fontWeight: typography?.fontWeightBold,
40
- textColor: colors?.contrasts?.blue4570,
41
- textColorSelected: colors?.contrasts?.grey125125,
42
- height: '2.25rem',
43
- padding: spacing?.small,
44
- backgroundColor: colors?.contrasts?.white1010
45
- };
46
- return {
47
- ...componentVariables
48
- };
1
+ const generateComponentTheme = (theme)=>{
2
+ const { colors, spacing, typography } = theme;
3
+ const componentVariables = {
4
+ fontFamily: typography?.fontFamily,
5
+ fontSize: '1.125rem',
6
+ fontWeight: typography?.fontWeightBold,
7
+ textColor: colors?.contrasts?.blue4570,
8
+ textColorSelected: colors?.contrasts?.grey125125,
9
+ height: '2.25rem',
10
+ padding: spacing?.small,
11
+ backgroundColor: colors?.contrasts?.white1010
12
+ };
13
+ return {
14
+ ...componentVariables
15
+ };
49
16
  };
50
- export default generateComponentTheme;
17
+ export default generateComponentTheme;