@instructure/ui-top-nav-bar 8.33.1 → 8.33.2
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 +4 -0
- package/es/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +4 -2
- package/es/TopNavBar/TopNavBarActionItems/index.js +10 -35
- package/es/TopNavBar/TopNavBarActionItems/props.js +1 -0
- package/es/TopNavBar/TopNavBarActionItems/styles.js +0 -1
- package/es/TopNavBar/TopNavBarActionItems/theme.js +4 -4
- package/es/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +3 -5
- package/es/TopNavBar/TopNavBarBrand/index.js +6 -17
- package/es/TopNavBar/TopNavBarBrand/props.js +1 -0
- package/es/TopNavBar/TopNavBarBrand/styles.js +1 -2
- package/es/TopNavBar/TopNavBarBrand/theme.js +2 -2
- package/es/TopNavBar/TopNavBarContext.js +1 -1
- package/es/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +12 -15
- package/es/TopNavBar/TopNavBarItem/index.js +49 -136
- package/es/TopNavBar/TopNavBarItem/props.js +1 -0
- package/es/TopNavBar/TopNavBarItem/styles.js +5 -6
- package/es/TopNavBar/TopNavBarItem/theme.js +5 -5
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +3 -6
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +6 -20
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +5 -2
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -4
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +6 -6
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +8 -16
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +25 -83
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +5 -2
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +4 -5
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +6 -6
- package/es/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +3 -1
- package/es/TopNavBar/TopNavBarLayout/index.js +8 -19
- package/es/TopNavBar/TopNavBarLayout/props.js +3 -1
- package/es/TopNavBar/TopNavBarLayout/theme.js +6 -4
- package/es/TopNavBar/TopNavBarLocator.js +2 -1
- package/es/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +4 -4
- package/es/TopNavBar/TopNavBarMenuItems/index.js +9 -35
- package/es/TopNavBar/TopNavBarMenuItems/props.js +1 -0
- package/es/TopNavBar/TopNavBarMenuItems/styles.js +0 -1
- package/es/TopNavBar/TopNavBarMenuItems/theme.js +3 -3
- package/es/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +3 -1
- package/es/TopNavBar/TopNavBarUser/index.js +2 -18
- package/es/TopNavBar/TopNavBarUser/props.js +1 -0
- package/es/TopNavBar/TopNavBarUser/styles.js +0 -1
- package/es/TopNavBar/index.js +4 -12
- package/es/TopNavBar/props.js +1 -0
- package/es/TopNavBar/utils/exampleHelpers.js +9 -17
- package/es/TopNavBar/utils/exampleSvgFiles.js +1 -4
- package/es/TopNavBar/utils/mapItemsForDrilldown.js +16 -25
- package/es/index.js +1 -0
- package/lib/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +3 -6
- package/lib/TopNavBar/TopNavBarActionItems/index.js +10 -55
- package/lib/TopNavBar/TopNavBarActionItems/props.js +1 -6
- package/lib/TopNavBar/TopNavBarActionItems/styles.js +0 -2
- package/lib/TopNavBar/TopNavBarActionItems/theme.js +4 -5
- package/lib/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +1 -8
- package/lib/TopNavBar/TopNavBarBrand/index.js +6 -30
- package/lib/TopNavBar/TopNavBarBrand/props.js +1 -3
- package/lib/TopNavBar/TopNavBarBrand/styles.js +1 -3
- package/lib/TopNavBar/TopNavBarBrand/theme.js +2 -3
- package/lib/TopNavBar/TopNavBarContext.js +0 -2
- package/lib/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +5 -15
- package/lib/TopNavBar/TopNavBarItem/index.js +49 -162
- package/lib/TopNavBar/TopNavBarItem/props.js +1 -6
- package/lib/TopNavBar/TopNavBarItem/styles.js +5 -7
- package/lib/TopNavBar/TopNavBarItem/theme.js +5 -6
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +3 -15
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +6 -30
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +5 -4
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -5
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +6 -7
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +5 -21
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +25 -111
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +5 -4
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +4 -6
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +6 -7
- package/lib/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +1 -5
- package/lib/TopNavBar/TopNavBarLayout/index.js +8 -30
- package/lib/TopNavBar/TopNavBarLayout/props.js +3 -11
- package/lib/TopNavBar/TopNavBarLayout/theme.js +4 -7
- package/lib/TopNavBar/TopNavBarLocator.js +1 -3
- package/lib/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +1 -7
- package/lib/TopNavBar/TopNavBarMenuItems/index.js +9 -52
- package/lib/TopNavBar/TopNavBarMenuItems/props.js +1 -5
- package/lib/TopNavBar/TopNavBarMenuItems/styles.js +0 -2
- package/lib/TopNavBar/TopNavBarMenuItems/theme.js +3 -4
- package/lib/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +1 -3
- package/lib/TopNavBar/TopNavBarUser/index.js +2 -29
- package/lib/TopNavBar/TopNavBarUser/props.js +1 -5
- package/lib/TopNavBar/TopNavBarUser/styles.js +0 -2
- package/lib/TopNavBar/index.js +3 -27
- package/lib/TopNavBar/props.js +1 -3
- package/lib/TopNavBar/utils/exampleHelpers.js +9 -39
- package/lib/TopNavBar/utils/exampleSvgFiles.js +0 -6
- package/lib/TopNavBar/utils/mapItemsForDrilldown.js +16 -37
- package/lib/index.js +0 -1
- package/package.json +27 -27
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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
|
+
## [8.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-top-nav-bar
|
|
9
|
+
|
|
6
10
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
|
@@ -21,16 +21,18 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { locator } from '@instructure/ui-test-locator';
|
|
26
|
+
|
|
25
27
|
/* eslint-disable no-restricted-imports */
|
|
26
28
|
// @ts-expect-error bypass no type definition found error
|
|
27
|
-
|
|
28
29
|
import { TruncateListLocator } from '@instructure/ui-truncate-list/es/TruncateList/TruncateListLocator';
|
|
29
30
|
/* eslint-enable no-restricted-imports */
|
|
30
31
|
|
|
31
32
|
import { TopNavBarItemLocator } from '../TopNavBarItem/TopNavBarItemLocator';
|
|
32
33
|
import { TopNavBarActionItems } from './index';
|
|
33
|
-
export const TopNavBarActionItemsLocator = locator(
|
|
34
|
+
export const TopNavBarActionItemsLocator = locator(
|
|
35
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
34
36
|
TopNavBarActionItems.selector, {
|
|
35
37
|
findAllActionItems: function () {
|
|
36
38
|
return TopNavBarItemLocator.findAll(...arguments);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _dec3, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -39,7 +38,6 @@ import { TopNavBarContext } from '../TopNavBarContext';
|
|
|
39
38
|
import generateStyle from './styles';
|
|
40
39
|
import generateComponentTheme from './theme';
|
|
41
40
|
import { propTypes, allowedProps } from './props';
|
|
42
|
-
|
|
43
41
|
/**
|
|
44
42
|
---
|
|
45
43
|
parent: TopNavBar
|
|
@@ -54,16 +52,13 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
54
52
|
this.ref = null;
|
|
55
53
|
this._hiddenActionItemsMenuId = void 0;
|
|
56
54
|
this._hiddenActionItemsMenuTriggerId = void 0;
|
|
57
|
-
|
|
58
55
|
this.handleRef = el => {
|
|
59
56
|
const elementRef = this.props.elementRef;
|
|
60
57
|
this.ref = el;
|
|
61
|
-
|
|
62
58
|
if (typeof elementRef === 'function') {
|
|
63
59
|
elementRef(el);
|
|
64
60
|
}
|
|
65
61
|
};
|
|
66
|
-
|
|
67
62
|
this.renderOptionContent = (children, itemProps) => {
|
|
68
63
|
const styles = this.props.styles;
|
|
69
64
|
const status = itemProps.status;
|
|
@@ -71,7 +66,6 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
71
66
|
css: status === 'active' ? styles === null || styles === void 0 ? void 0 : styles.dropdownMenuOptionActive : styles === null || styles === void 0 ? void 0 : styles.dropdownMenuOption
|
|
72
67
|
}, children);
|
|
73
68
|
};
|
|
74
|
-
|
|
75
69
|
this._hiddenActionItemsMenuId = props.deterministicId('TopNavBarActionItems-hiddenActionItemsMenu');
|
|
76
70
|
this._hiddenActionItemsMenuTriggerId = props.deterministicId('TopNavBarActionItems-hiddenActionItemsMenuTrigger');
|
|
77
71
|
this.state = {
|
|
@@ -79,44 +73,35 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
79
73
|
visibleActionItemsCount: void 0
|
|
80
74
|
};
|
|
81
75
|
}
|
|
82
|
-
|
|
83
76
|
componentDidMount() {
|
|
84
77
|
var _this$props$makeStyle, _this$props;
|
|
85
|
-
|
|
86
78
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
|
|
87
79
|
}
|
|
88
|
-
|
|
89
80
|
componentDidUpdate(prevProps) {
|
|
90
81
|
var _this$props$makeStyle2, _this$props2;
|
|
91
|
-
|
|
92
82
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
|
|
93
|
-
|
|
94
83
|
if (this.context.layout === 'smallViewport' && React.Children.count(prevProps.children) !== React.Children.count(this.props.children)) {
|
|
95
84
|
this.setState({
|
|
96
85
|
key: this.state.key + 1
|
|
97
86
|
});
|
|
98
87
|
}
|
|
99
88
|
}
|
|
100
|
-
|
|
101
89
|
get makeStylesVariables() {
|
|
102
90
|
return {
|
|
103
91
|
layout: this.context.layout
|
|
104
92
|
};
|
|
105
93
|
}
|
|
106
|
-
|
|
107
94
|
get childrenArray() {
|
|
108
95
|
const children = React.Children.toArray(this.props.children);
|
|
109
96
|
return children.map(child => {
|
|
110
97
|
if (!(child !== null && child !== void 0 && child.props)) {
|
|
111
98
|
return null;
|
|
112
99
|
}
|
|
113
|
-
|
|
114
100
|
const _child$props = child.props,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
101
|
+
id = _child$props.id,
|
|
102
|
+
renderAvatar = _child$props.renderAvatar,
|
|
103
|
+
renderIcon = _child$props.renderIcon,
|
|
104
|
+
variant = _child$props.variant;
|
|
120
105
|
if (renderAvatar) {
|
|
121
106
|
warn(false, `Items in <TopNavBar.ActionItems> are not allowed to have avatars, please remove it from item with the id "${id}".`);
|
|
122
107
|
return safeCloneElement(child, {
|
|
@@ -124,26 +109,22 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
124
109
|
variant: 'default'
|
|
125
110
|
});
|
|
126
111
|
}
|
|
127
|
-
|
|
128
112
|
if (this.context.layout === 'smallViewport' && variant !== 'icon') {
|
|
129
113
|
if (!renderIcon) {
|
|
130
114
|
error(false, `Items in <TopNavBar.ActionItems> are required to have the \`renderIcon\` prop, because only the icons are displayed due to the lack of space. Please add an icon to the item with the id "${id}".`);
|
|
131
115
|
return null;
|
|
132
116
|
}
|
|
133
|
-
|
|
134
117
|
return safeCloneElement(child, {
|
|
135
118
|
variant: 'icon'
|
|
136
119
|
});
|
|
137
120
|
}
|
|
138
|
-
|
|
139
121
|
return child;
|
|
140
122
|
});
|
|
141
123
|
}
|
|
142
|
-
|
|
143
124
|
renderHiddenActionItemsMenu(hiddenItems) {
|
|
144
125
|
const _this$props3 = this.props,
|
|
145
|
-
|
|
146
|
-
|
|
126
|
+
renderHiddenItemsMenuTriggerLabel = _this$props3.renderHiddenItemsMenuTriggerLabel,
|
|
127
|
+
renderHiddenItemsMenuTriggerTooltip = _this$props3.renderHiddenItemsMenuTriggerTooltip;
|
|
147
128
|
const mappedItems = mapItemsForDrilldown(hiddenItems, {
|
|
148
129
|
renderOptionContent: this.renderOptionContent
|
|
149
130
|
});
|
|
@@ -165,11 +146,10 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
165
146
|
}, options), ...subPages])
|
|
166
147
|
}, label);
|
|
167
148
|
}
|
|
168
|
-
|
|
169
149
|
renderTruncatedActionItemList() {
|
|
170
150
|
const _this$props4 = this.props,
|
|
171
|
-
|
|
172
|
-
|
|
151
|
+
listLabel = _this$props4.listLabel,
|
|
152
|
+
styles = _this$props4.styles;
|
|
173
153
|
return jsx(TruncateList, Object.assign({}, passthroughProps(omitProps(this.props, allowedProps)), {
|
|
174
154
|
key: this.state.key // rerender if child count changes
|
|
175
155
|
,
|
|
@@ -186,20 +166,16 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
186
166
|
"aria-label": listLabel
|
|
187
167
|
}), this.childrenArray);
|
|
188
168
|
}
|
|
189
|
-
|
|
190
169
|
render() {
|
|
191
170
|
const _this$props5 = this.props,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
171
|
+
listLabel = _this$props5.listLabel,
|
|
172
|
+
styles = _this$props5.styles;
|
|
195
173
|
if (!this.childrenArray.length) {
|
|
196
174
|
return null;
|
|
197
175
|
}
|
|
198
|
-
|
|
199
176
|
if (this.context.layout === 'smallViewport') {
|
|
200
177
|
return this.renderTruncatedActionItemList();
|
|
201
178
|
}
|
|
202
|
-
|
|
203
179
|
return jsx("ul", Object.assign({}, omitProps(this.props, allowedProps), {
|
|
204
180
|
ref: this.handleRef,
|
|
205
181
|
css: styles === null || styles === void 0 ? void 0 : styles.topNavBarActionItems,
|
|
@@ -209,7 +185,6 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
209
185
|
key: item.props.id
|
|
210
186
|
}, item)));
|
|
211
187
|
}
|
|
212
|
-
|
|
213
188
|
}, _class2.displayName = "TopNavBarActionItems", _class2.componentId = 'TopNavBar.ActionItems', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
|
|
214
189
|
export { TopNavBarActionItems };
|
|
215
190
|
export default TopNavBarActionItems;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
26
27
|
import { TopNavBarItem } from '../TopNavBarItem';
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const typography = theme.typography,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
spacing = theme.spacing,
|
|
33
|
+
borders = theme.borders;
|
|
34
34
|
const componentVariables = {
|
|
35
35
|
smallViewportActionItemContainerMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxLarge,
|
|
36
36
|
smallViewportActionItemContainerMaxWidth: '50%',
|
|
@@ -39,8 +39,8 @@ const generateComponentTheme = theme => {
|
|
|
39
39
|
smallViewportDropdownMenuActiveOptionIndicatorWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
|
|
40
40
|
smallViewportDropdownMenuActiveOptionIndicatorColor: 'currentColor'
|
|
41
41
|
};
|
|
42
|
-
return {
|
|
42
|
+
return {
|
|
43
|
+
...componentVariables
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
|
-
|
|
46
46
|
export default generateComponentTheme;
|
|
@@ -21,37 +21,35 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
26
|
import { find } from '@instructure/ui-test-utils';
|
|
26
|
-
import { TopNavBarBrand } from './index';
|
|
27
|
+
import { TopNavBarBrand } from './index';
|
|
27
28
|
|
|
29
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
28
30
|
export const TopNavBarBrandLocator = locator(TopNavBarBrand.selector, {
|
|
29
31
|
findContainer: function () {
|
|
30
32
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
33
|
args[_key] = arguments[_key];
|
|
32
34
|
}
|
|
33
|
-
|
|
34
35
|
return find('[class$="-topNavBarBrand__container"]', ...args);
|
|
35
36
|
},
|
|
36
37
|
findBrandNameContainer: function () {
|
|
37
38
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
38
39
|
args[_key2] = arguments[_key2];
|
|
39
40
|
}
|
|
40
|
-
|
|
41
41
|
return find('[class$="-topNavBarBrand__nameContainer"]', ...args);
|
|
42
42
|
},
|
|
43
43
|
findBrandIconContainer: function () {
|
|
44
44
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
45
45
|
args[_key3] = arguments[_key3];
|
|
46
46
|
}
|
|
47
|
-
|
|
48
47
|
return find('[class$="-topNavBarBrand__iconContainer"]', ...args);
|
|
49
48
|
},
|
|
50
49
|
findScreenReaderLabel: function () {
|
|
51
50
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
52
51
|
args[_key4] = arguments[_key4];
|
|
53
52
|
}
|
|
54
|
-
|
|
55
53
|
return find('[class$="-screenReaderContent"]', ...args);
|
|
56
54
|
}
|
|
57
55
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -35,7 +34,6 @@ import { TopNavBarContext } from '../TopNavBarContext';
|
|
|
35
34
|
import generateStyle from './styles';
|
|
36
35
|
import generateComponentTheme from './theme';
|
|
37
36
|
import { propTypes, allowedProps } from './props';
|
|
38
|
-
|
|
39
37
|
/**
|
|
40
38
|
---
|
|
41
39
|
parent: TopNavBar
|
|
@@ -48,43 +46,35 @@ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
48
46
|
constructor() {
|
|
49
47
|
super(...arguments);
|
|
50
48
|
this.ref = null;
|
|
51
|
-
|
|
52
49
|
this.handleRef = el => {
|
|
53
50
|
const elementRef = this.props.elementRef;
|
|
54
51
|
this.ref = el;
|
|
55
|
-
|
|
56
52
|
if (typeof elementRef === 'function') {
|
|
57
53
|
elementRef(el);
|
|
58
54
|
}
|
|
59
55
|
};
|
|
60
56
|
}
|
|
61
|
-
|
|
62
57
|
componentDidMount() {
|
|
63
58
|
var _this$props$makeStyle, _this$props;
|
|
64
|
-
|
|
65
59
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
|
|
66
60
|
}
|
|
67
|
-
|
|
68
61
|
componentDidUpdate() {
|
|
69
62
|
var _this$props$makeStyle2, _this$props2;
|
|
70
|
-
|
|
71
63
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
|
|
72
64
|
}
|
|
73
|
-
|
|
74
65
|
get makeStylesVariables() {
|
|
75
66
|
return {
|
|
76
67
|
layout: this.context.layout
|
|
77
68
|
};
|
|
78
69
|
}
|
|
79
|
-
|
|
80
70
|
render() {
|
|
81
71
|
const _this$props3 = this.props,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
73
|
+
renderName = _this$props3.renderName,
|
|
74
|
+
renderIcon = _this$props3.renderIcon,
|
|
75
|
+
href = _this$props3.href,
|
|
76
|
+
onClick = _this$props3.onClick,
|
|
77
|
+
styles = _this$props3.styles;
|
|
88
78
|
const ElementType = getElementType(TopNavBarBrand, this.props);
|
|
89
79
|
return jsx("div", {
|
|
90
80
|
ref: this.handleRef,
|
|
@@ -111,7 +101,6 @@ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
111
101
|
"aria-hidden": "true"
|
|
112
102
|
}, renderName)));
|
|
113
103
|
}
|
|
114
|
-
|
|
115
104
|
}, _class2.displayName = "TopNavBarBrand", _class2.componentId = 'TopNavBar.Brand', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class);
|
|
116
105
|
export { TopNavBarBrand };
|
|
117
106
|
export default TopNavBarBrand;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props, state) => {
|
|
36
36
|
const nameBackground = props.nameBackground,
|
|
37
|
-
|
|
37
|
+
iconBackground = props.iconBackground;
|
|
38
38
|
const isDesktop = state.layout === 'desktop';
|
|
39
39
|
return {
|
|
40
40
|
topNavBarBrand: {
|
|
@@ -87,5 +87,4 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
87
87
|
focusOutlineInset: componentTheme.focusOutlineInset
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
-
|
|
91
90
|
export default generateStyle;
|
|
@@ -21,25 +21,27 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
26
|
import { find } from '@instructure/ui-test-utils';
|
|
26
27
|
import { getComputedStyle } from '@instructure/ui-dom-utils';
|
|
28
|
+
|
|
27
29
|
/* eslint-disable no-restricted-imports */
|
|
28
30
|
// @ts-expect-error bypass no type definition found error
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
import { BaseButtonLocator } from '@instructure/ui-buttons/es/BaseButton/BaseButtonLocator';
|
|
32
|
+
// @ts-expect-error bypass no type definition found error
|
|
33
|
+
import { TooltipLocator } from '@instructure/ui-tooltip/es/Tooltip/TooltipLocator';
|
|
34
|
+
// @ts-expect-error bypass no type definition found error
|
|
35
|
+
import { AvatarLocator } from '@instructure/ui-avatar/es/Avatar/AvatarLocator';
|
|
36
|
+
// @ts-expect-error bypass no type definition found error
|
|
37
|
+
import { DrilldownLocator } from '@instructure/ui-drilldown/es/Drilldown/DrilldownLocator';
|
|
38
|
+
// @ts-expect-error bypass no type definition found error
|
|
38
39
|
import { PopoverLocator } from '@instructure/ui-popover/es/Popover/PopoverLocator';
|
|
39
40
|
/* eslint-enable no-restricted-imports */
|
|
40
41
|
|
|
41
|
-
import { TopNavBarItem } from './index';
|
|
42
|
+
import { TopNavBarItem } from './index';
|
|
42
43
|
|
|
44
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
43
45
|
export const TopNavBarItemLocator = locator(TopNavBarItem.selector, {
|
|
44
46
|
findButton: function () {
|
|
45
47
|
return BaseButtonLocator.find(...arguments);
|
|
@@ -68,7 +70,6 @@ export const TopNavBarItemLocator = locator(TopNavBarItem.selector, {
|
|
|
68
70
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
69
71
|
args[_key] = arguments[_key];
|
|
70
72
|
}
|
|
71
|
-
|
|
72
73
|
return find('[class$="-topNavBarItem__content"]', ...args);
|
|
73
74
|
},
|
|
74
75
|
findSubmenu: function () {
|
|
@@ -76,7 +77,6 @@ export const TopNavBarItemLocator = locator(TopNavBarItem.selector, {
|
|
|
76
77
|
},
|
|
77
78
|
findCustomPopover: async function () {
|
|
78
79
|
const popover = await PopoverLocator.find(...arguments);
|
|
79
|
-
|
|
80
80
|
if (popover) {
|
|
81
81
|
const isDrilldown = popover.getAttribute('data-cid').includes('Drilldown');
|
|
82
82
|
return isDrilldown ? null : popover;
|
|
@@ -91,14 +91,12 @@ export const TopNavBarItemLocator = locator(TopNavBarItem.selector, {
|
|
|
91
91
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
92
92
|
args[_key2] = arguments[_key2];
|
|
93
93
|
}
|
|
94
|
-
|
|
95
94
|
return find('[class*="-baseButton__icon"] [class$="-svgIcon"]', ...args);
|
|
96
95
|
},
|
|
97
96
|
findSubmenuChevron: function () {
|
|
98
97
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
99
98
|
args[_key3] = arguments[_key3];
|
|
100
99
|
}
|
|
101
|
-
|
|
102
100
|
return find('[class$="-topNavBarItem__submenuIcon"] [class$="-svgIcon"]', ...args);
|
|
103
101
|
},
|
|
104
102
|
findAvatar: function () {
|
|
@@ -108,7 +106,6 @@ export const TopNavBarItemLocator = locator(TopNavBarItem.selector, {
|
|
|
108
106
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
109
107
|
args[_key4] = arguments[_key4];
|
|
110
108
|
}
|
|
111
|
-
|
|
112
109
|
return find('[class$="-screenReaderContent"]', ...args);
|
|
113
110
|
}
|
|
114
111
|
});
|