@instructure/ui-top-nav-bar 11.7.2-snapshot-49 → 11.7.2-snapshot-50
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 +12 -2
- package/es/TopNavBar/v1/TopNavBarActionItems/index.js +13 -4
- package/es/TopNavBar/v1/TopNavBarLayout/SmallViewportLayout/styles.js +0 -1
- package/es/TopNavBar/v1/TopNavBarMenuItems/index.js +7 -2
- package/es/TopNavBar/v2/TopNavBarActionItems/index.js +206 -0
- package/es/TopNavBar/v2/TopNavBarActionItems/props.js +26 -0
- package/es/TopNavBar/v2/TopNavBarActionItems/styles.js +75 -0
- package/es/TopNavBar/v2/TopNavBarBrand/index.js +117 -0
- package/es/TopNavBar/v2/TopNavBarBrand/props.js +26 -0
- package/es/TopNavBar/v2/TopNavBarBrand/styles.js +79 -0
- package/es/TopNavBar/v2/TopNavBarBreadcrumb/index.js +121 -0
- package/es/TopNavBar/v2/TopNavBarBreadcrumb/props.js +26 -0
- package/es/TopNavBar/v2/TopNavBarBreadcrumb/styles.js +66 -0
- package/es/TopNavBar/v2/TopNavBarContext.js +37 -0
- package/es/TopNavBar/v2/TopNavBarItem/index.js +578 -0
- package/es/TopNavBar/v2/TopNavBarItem/props.js +26 -0
- package/es/TopNavBar/v2/TopNavBarItem/styles.js +136 -0
- package/es/TopNavBar/v2/TopNavBarLayout/DesktopLayout/index.js +123 -0
- package/es/TopNavBar/v2/TopNavBarLayout/DesktopLayout/props.js +28 -0
- package/es/TopNavBar/v2/TopNavBarLayout/DesktopLayout/styles.js +123 -0
- package/es/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/index.js +457 -0
- package/es/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/props.js +28 -0
- package/es/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/styles.js +156 -0
- package/es/TopNavBar/v2/TopNavBarLayout/index.js +109 -0
- package/es/TopNavBar/v2/TopNavBarLayout/props.js +29 -0
- package/es/TopNavBar/v2/TopNavBarMenuItems/index.js +197 -0
- package/es/TopNavBar/v2/TopNavBarMenuItems/props.js +26 -0
- package/es/TopNavBar/v2/TopNavBarMenuItems/styles.js +64 -0
- package/es/TopNavBar/v2/TopNavBarUser/index.js +94 -0
- package/es/TopNavBar/v2/TopNavBarUser/props.js +26 -0
- package/es/TopNavBar/v2/TopNavBarUser/styles.js +44 -0
- package/es/TopNavBar/v2/index.js +116 -0
- package/es/TopNavBar/v2/props.js +26 -0
- package/es/TopNavBar/v2/utils/exampleHelpers.js +225 -0
- package/es/TopNavBar/v2/utils/exampleSvgFiles.js +87 -0
- package/es/TopNavBar/v2/utils/mapItemsForDrilldown.js +145 -0
- package/es/exports/b.js +31 -0
- package/lib/TopNavBar/v1/TopNavBarActionItems/index.js +13 -4
- package/lib/TopNavBar/v1/TopNavBarLayout/SmallViewportLayout/styles.js +0 -1
- package/lib/TopNavBar/v1/TopNavBarMenuItems/index.js +7 -2
- package/lib/TopNavBar/v2/TopNavBarActionItems/index.js +214 -0
- package/lib/TopNavBar/v2/TopNavBarActionItems/props.js +31 -0
- package/lib/TopNavBar/v2/TopNavBarActionItems/styles.js +81 -0
- package/lib/TopNavBar/v2/TopNavBarBrand/index.js +123 -0
- package/lib/TopNavBar/v2/TopNavBarBrand/props.js +31 -0
- package/lib/TopNavBar/v2/TopNavBarBrand/styles.js +85 -0
- package/lib/TopNavBar/v2/TopNavBarBreadcrumb/index.js +125 -0
- package/lib/TopNavBar/v2/TopNavBarBreadcrumb/props.js +31 -0
- package/lib/TopNavBar/v2/TopNavBarBreadcrumb/styles.js +72 -0
- package/lib/TopNavBar/v2/TopNavBarContext.js +42 -0
- package/lib/TopNavBar/v2/TopNavBarItem/index.js +588 -0
- package/lib/TopNavBar/v2/TopNavBarItem/props.js +31 -0
- package/lib/TopNavBar/v2/TopNavBarItem/styles.js +142 -0
- package/lib/TopNavBar/v2/TopNavBarLayout/DesktopLayout/index.js +128 -0
- package/lib/TopNavBar/v2/TopNavBarLayout/DesktopLayout/props.js +34 -0
- package/lib/TopNavBar/v2/TopNavBarLayout/DesktopLayout/styles.js +129 -0
- package/lib/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/index.js +465 -0
- package/lib/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/props.js +34 -0
- package/lib/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/styles.js +162 -0
- package/lib/TopNavBar/v2/TopNavBarLayout/index.js +114 -0
- package/lib/TopNavBar/v2/TopNavBarLayout/props.js +34 -0
- package/lib/TopNavBar/v2/TopNavBarMenuItems/index.js +204 -0
- package/lib/TopNavBar/v2/TopNavBarMenuItems/props.js +31 -0
- package/lib/TopNavBar/v2/TopNavBarMenuItems/styles.js +70 -0
- package/lib/TopNavBar/v2/TopNavBarUser/index.js +99 -0
- package/lib/TopNavBar/v2/TopNavBarUser/props.js +31 -0
- package/lib/TopNavBar/v2/TopNavBarUser/styles.js +50 -0
- package/lib/TopNavBar/v2/index.js +122 -0
- package/lib/TopNavBar/v2/props.js +31 -0
- package/lib/TopNavBar/v2/utils/exampleHelpers.js +239 -0
- package/lib/TopNavBar/v2/utils/exampleSvgFiles.js +92 -0
- package/lib/TopNavBar/v2/utils/mapItemsForDrilldown.js +153 -0
- package/lib/exports/b.js +61 -0
- package/package.json +36 -36
- package/src/TopNavBar/v1/README.md +1 -1
- package/src/TopNavBar/v1/TopNavBarActionItems/index.tsx +16 -4
- package/src/TopNavBar/v1/TopNavBarLayout/SmallViewportLayout/styles.ts +0 -1
- package/src/TopNavBar/v1/TopNavBarMenuItems/index.tsx +8 -2
- package/src/TopNavBar/v2/README.md +2373 -0
- package/src/TopNavBar/v2/TopNavBarActionItems/index.tsx +304 -0
- package/src/TopNavBar/v2/TopNavBarActionItems/props.ts +134 -0
- package/src/TopNavBar/v2/TopNavBarActionItems/styles.ts +93 -0
- package/src/TopNavBar/v2/TopNavBarBrand/index.tsx +141 -0
- package/src/TopNavBar/v2/TopNavBarBrand/props.ts +111 -0
- package/src/TopNavBar/v2/TopNavBarBrand/styles.ts +93 -0
- package/src/TopNavBar/v2/TopNavBarBreadcrumb/index.tsx +146 -0
- package/src/TopNavBar/v2/TopNavBarBreadcrumb/props.ts +90 -0
- package/src/TopNavBar/v2/TopNavBarBreadcrumb/styles.ts +79 -0
- package/src/TopNavBar/v2/TopNavBarContext.ts +47 -0
- package/src/TopNavBar/v2/TopNavBarItem/index.tsx +754 -0
- package/src/TopNavBar/v2/TopNavBarItem/props.ts +320 -0
- package/src/TopNavBar/v2/TopNavBarItem/styles.ts +155 -0
- package/src/TopNavBar/v2/TopNavBarLayout/DesktopLayout/index.tsx +165 -0
- package/src/TopNavBar/v2/TopNavBarLayout/DesktopLayout/props.ts +86 -0
- package/src/TopNavBar/v2/TopNavBarLayout/DesktopLayout/styles.ts +145 -0
- package/src/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/index.tsx +652 -0
- package/src/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/props.ts +175 -0
- package/src/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/styles.ts +184 -0
- package/src/TopNavBar/v2/TopNavBarLayout/index.tsx +147 -0
- package/src/TopNavBar/v2/TopNavBarLayout/props.ts +156 -0
- package/src/TopNavBar/v2/TopNavBarMenuItems/index.tsx +293 -0
- package/src/TopNavBar/v2/TopNavBarMenuItems/props.ts +128 -0
- package/src/TopNavBar/v2/TopNavBarMenuItems/styles.ts +72 -0
- package/src/TopNavBar/v2/TopNavBarUser/index.tsx +129 -0
- package/src/TopNavBar/v2/TopNavBarUser/props.ts +70 -0
- package/src/TopNavBar/v2/TopNavBarUser/styles.ts +47 -0
- package/src/TopNavBar/v2/index.tsx +141 -0
- package/src/TopNavBar/v2/props.ts +93 -0
- package/src/TopNavBar/v2/utils/exampleHelpers.tsx +348 -0
- package/src/TopNavBar/v2/utils/exampleSvgFiles.tsx +74 -0
- package/src/TopNavBar/v2/utils/mapItemsForDrilldown.tsx +233 -0
- package/src/exports/b.ts +69 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/TopNavBar/v1/TopNavBarActionItems/index.d.ts.map +1 -1
- package/types/TopNavBar/v1/TopNavBarLayout/SmallViewportLayout/styles.d.ts.map +1 -1
- package/types/TopNavBar/v1/TopNavBarMenuItems/index.d.ts.map +1 -1
- package/types/TopNavBar/v2/TopNavBarActionItems/index.d.ts +36 -0
- package/types/TopNavBar/v2/TopNavBarActionItems/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarActionItems/props.d.ts +59 -0
- package/types/TopNavBar/v2/TopNavBarActionItems/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarActionItems/styles.d.ts +15 -0
- package/types/TopNavBar/v2/TopNavBarActionItems/styles.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarBrand/index.d.ts +26 -0
- package/types/TopNavBar/v2/TopNavBarBrand/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarBrand/props.d.ts +51 -0
- package/types/TopNavBar/v2/TopNavBarBrand/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarBrand/styles.d.ts +15 -0
- package/types/TopNavBar/v2/TopNavBarBrand/styles.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarBreadcrumb/index.d.ts +29 -0
- package/types/TopNavBar/v2/TopNavBarBreadcrumb/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarBreadcrumb/props.d.ts +37 -0
- package/types/TopNavBar/v2/TopNavBarBreadcrumb/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarBreadcrumb/styles.d.ts +5 -0
- package/types/TopNavBar/v2/TopNavBarBreadcrumb/styles.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarContext.d.ts +16 -0
- package/types/TopNavBar/v2/TopNavBarContext.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarItem/index.d.ts +62 -0
- package/types/TopNavBar/v2/TopNavBarItem/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarItem/props.d.ts +201 -0
- package/types/TopNavBar/v2/TopNavBarItem/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarItem/styles.d.ts +15 -0
- package/types/TopNavBar/v2/TopNavBarItem/styles.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarLayout/DesktopLayout/index.d.ts +29 -0
- package/types/TopNavBar/v2/TopNavBarLayout/DesktopLayout/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarLayout/DesktopLayout/props.d.ts +24 -0
- package/types/TopNavBar/v2/TopNavBarLayout/DesktopLayout/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarLayout/DesktopLayout/styles.d.ts +15 -0
- package/types/TopNavBar/v2/TopNavBarLayout/DesktopLayout/styles.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/index.d.ts +57 -0
- package/types/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/props.d.ts +93 -0
- package/types/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/styles.d.ts +15 -0
- package/types/TopNavBar/v2/TopNavBarLayout/SmallViewportLayout/styles.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarLayout/index.d.ts +30 -0
- package/types/TopNavBar/v2/TopNavBarLayout/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarLayout/props.d.ts +86 -0
- package/types/TopNavBar/v2/TopNavBarLayout/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarMenuItems/index.d.ts +34 -0
- package/types/TopNavBar/v2/TopNavBarMenuItems/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarMenuItems/props.d.ts +60 -0
- package/types/TopNavBar/v2/TopNavBarMenuItems/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarMenuItems/styles.d.ts +15 -0
- package/types/TopNavBar/v2/TopNavBarMenuItems/styles.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarUser/index.d.ts +27 -0
- package/types/TopNavBar/v2/TopNavBarUser/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarUser/props.d.ts +28 -0
- package/types/TopNavBar/v2/TopNavBarUser/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/TopNavBarUser/styles.d.ts +14 -0
- package/types/TopNavBar/v2/TopNavBarUser/styles.d.ts.map +1 -0
- package/types/TopNavBar/v2/index.d.ts +38 -0
- package/types/TopNavBar/v2/index.d.ts.map +1 -0
- package/types/TopNavBar/v2/props.d.ts +42 -0
- package/types/TopNavBar/v2/props.d.ts.map +1 -0
- package/types/TopNavBar/v2/utils/exampleHelpers.d.ts +69 -0
- package/types/TopNavBar/v2/utils/exampleHelpers.d.ts.map +1 -0
- package/types/TopNavBar/v2/utils/exampleSvgFiles.d.ts +6 -0
- package/types/TopNavBar/v2/utils/exampleSvgFiles.d.ts.map +1 -0
- package/types/TopNavBar/v2/utils/mapItemsForDrilldown.d.ts +18 -0
- package/types/TopNavBar/v2/utils/mapItemsForDrilldown.d.ts.map +1 -0
- package/types/exports/b.d.ts +18 -0
- package/types/exports/b.d.ts.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +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.2-snapshot-
|
|
6
|
+
## [11.7.2-snapshot-50](https://github.com/instructure/instructure-ui/compare/v11.7.1...v11.7.2-snapshot-50) (2026-04-21)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **many:** rework TopNavBar ([bf40e4f](https://github.com/instructure/instructure-ui/commit/bf40e4f380dce5edc45a0f0bc83d5a5070d3be2b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* **many:** contains breaking changes due to component using the new theming system
|
|
17
|
+
|
|
18
|
+
INSTUI-4967
|
|
9
19
|
|
|
10
20
|
|
|
11
21
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
const _excluded = ["listLabel", "styles", "renderHiddenItemsMenuTriggerLabel", "renderHiddenItemsMenuTriggerTooltip"],
|
|
3
|
+
_excluded2 = ["listLabel", "styles", "renderHiddenItemsMenuTriggerLabel", "renderHiddenItemsMenuTriggerTooltip"];
|
|
1
4
|
var _dec, _dec2, _class, _TopNavBarActionItems;
|
|
2
5
|
/*
|
|
3
6
|
* The MIT License (MIT)
|
|
@@ -152,9 +155,12 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
152
155
|
renderTruncatedActionItemList() {
|
|
153
156
|
const _this$props4 = this.props,
|
|
154
157
|
listLabel = _this$props4.listLabel,
|
|
155
|
-
styles = _this$props4.styles
|
|
158
|
+
styles = _this$props4.styles,
|
|
159
|
+
renderHiddenItemsMenuTriggerLabel = _this$props4.renderHiddenItemsMenuTriggerLabel,
|
|
160
|
+
renderHiddenItemsMenuTriggerTooltip = _this$props4.renderHiddenItemsMenuTriggerTooltip,
|
|
161
|
+
restProps = _objectWithoutProperties(_this$props4, _excluded);
|
|
156
162
|
return _createElement(TruncateList, {
|
|
157
|
-
...passthroughProps(omitProps(
|
|
163
|
+
...passthroughProps(omitProps(restProps, allowedProps)),
|
|
158
164
|
key: this.state.key // rerender if child count changes
|
|
159
165
|
,
|
|
160
166
|
elementRef: this.handleRef,
|
|
@@ -174,7 +180,10 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
174
180
|
render() {
|
|
175
181
|
const _this$props5 = this.props,
|
|
176
182
|
listLabel = _this$props5.listLabel,
|
|
177
|
-
styles = _this$props5.styles
|
|
183
|
+
styles = _this$props5.styles,
|
|
184
|
+
renderHiddenItemsMenuTriggerLabel = _this$props5.renderHiddenItemsMenuTriggerLabel,
|
|
185
|
+
renderHiddenItemsMenuTriggerTooltip = _this$props5.renderHiddenItemsMenuTriggerTooltip,
|
|
186
|
+
restProps = _objectWithoutProperties(_this$props5, _excluded2);
|
|
178
187
|
if (!this.childrenArray.length) {
|
|
179
188
|
return null;
|
|
180
189
|
}
|
|
@@ -182,7 +191,7 @@ let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(gene
|
|
|
182
191
|
return this.renderTruncatedActionItemList();
|
|
183
192
|
}
|
|
184
193
|
return _jsx("ul", {
|
|
185
|
-
...omitProps(
|
|
194
|
+
...omitProps(restProps, allowedProps),
|
|
186
195
|
ref: this.handleRef,
|
|
187
196
|
css: styles === null || styles === void 0 ? void 0 : styles.topNavBarActionItems,
|
|
188
197
|
"aria-label": listLabel,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
const _excluded = ["listLabel", "styles", "renderHiddenItemsMenuTriggerLabel", "renderHiddenItemsMenuTriggerAriaLabel"];
|
|
1
3
|
var _dec, _dec2, _class, _TopNavBarMenuItems, _span;
|
|
2
4
|
/*
|
|
3
5
|
* The MIT License (MIT)
|
|
@@ -158,7 +160,10 @@ let TopNavBarMenuItems = (_dec = withDeterministicId(), _dec2 = withStyle(genera
|
|
|
158
160
|
render() {
|
|
159
161
|
const _this$props4 = this.props,
|
|
160
162
|
listLabel = _this$props4.listLabel,
|
|
161
|
-
styles = _this$props4.styles
|
|
163
|
+
styles = _this$props4.styles,
|
|
164
|
+
renderHiddenItemsMenuTriggerLabel = _this$props4.renderHiddenItemsMenuTriggerLabel,
|
|
165
|
+
renderHiddenItemsMenuTriggerAriaLabel = _this$props4.renderHiddenItemsMenuTriggerAriaLabel,
|
|
166
|
+
restProps = _objectWithoutProperties(_this$props4, _excluded);
|
|
162
167
|
if (!this.childrenArray.length) {
|
|
163
168
|
return null;
|
|
164
169
|
}
|
|
@@ -167,7 +172,7 @@ let TopNavBarMenuItems = (_dec = withDeterministicId(), _dec2 = withStyle(genera
|
|
|
167
172
|
return null;
|
|
168
173
|
}
|
|
169
174
|
return _createElement(TruncateList, {
|
|
170
|
-
...omitProps(
|
|
175
|
+
...omitProps(restProps, allowedProps),
|
|
171
176
|
key: this.state.key // rerender if child count changes
|
|
172
177
|
,
|
|
173
178
|
elementRef: this.handleRef,
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
const _excluded = ["listLabel", "styles", "renderHiddenItemsMenuTriggerLabel", "renderHiddenItemsMenuTriggerTooltip"],
|
|
3
|
+
_excluded2 = ["listLabel", "styles", "renderHiddenItemsMenuTriggerLabel", "renderHiddenItemsMenuTriggerTooltip"];
|
|
4
|
+
var _dec, _dec2, _class, _TopNavBarActionItems;
|
|
5
|
+
/*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
9
|
+
*
|
|
10
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
* in the Software without restriction, including without limitation the rights
|
|
13
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
* furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
* copies or substantial portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
* SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { Children, Component } from 'react';
|
|
30
|
+
import { omitProps, passthroughProps, safeCloneElement, withDeterministicId } from '@instructure/ui-react-utils';
|
|
31
|
+
import { warn, error } from '@instructure/console';
|
|
32
|
+
import { withStyle } from '@instructure/emotion';
|
|
33
|
+
import { Drilldown } from '@instructure/ui-drilldown/latest';
|
|
34
|
+
import { MoreVerticalInstUIIcon } from '@instructure/ui-icons';
|
|
35
|
+
import { TruncateList } from '@instructure/ui-truncate-list';
|
|
36
|
+
import { TopNavBarItem } from "../TopNavBarItem/index.js";
|
|
37
|
+
import { mapItemsForDrilldown, renderMappedItemDrilldownSubpages, renderMappedItemsAsDrilldownOptions } from "../utils/mapItemsForDrilldown.js";
|
|
38
|
+
import { TopNavBarContext } from "../TopNavBarContext.js";
|
|
39
|
+
import generateStyle from "./styles.js";
|
|
40
|
+
import { allowedProps } from "./props.js";
|
|
41
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
42
|
+
import { createElement as _createElement } from "@emotion/react";
|
|
43
|
+
/**
|
|
44
|
+
---
|
|
45
|
+
parent: TopNavBar
|
|
46
|
+
id: TopNavBar.ActionItems
|
|
47
|
+
---
|
|
48
|
+
@module TopNavBarActionItems
|
|
49
|
+
**/
|
|
50
|
+
let TopNavBarActionItems = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, 'TopNavBarActionItems'), _dec(_class = _dec2(_class = (_TopNavBarActionItems = class TopNavBarActionItems extends Component {
|
|
51
|
+
constructor(props) {
|
|
52
|
+
super(props);
|
|
53
|
+
this.ref = null;
|
|
54
|
+
this._hiddenActionItemsMenuId = void 0;
|
|
55
|
+
this._hiddenActionItemsMenuTriggerId = void 0;
|
|
56
|
+
this.handleRef = el => {
|
|
57
|
+
const elementRef = this.props.elementRef;
|
|
58
|
+
this.ref = el;
|
|
59
|
+
if (typeof elementRef === 'function') {
|
|
60
|
+
elementRef(el);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
this.renderOptionContent = (children, itemProps) => {
|
|
64
|
+
const styles = this.props.styles;
|
|
65
|
+
const status = itemProps.status;
|
|
66
|
+
return _jsx("span", {
|
|
67
|
+
css: status === 'active' ? styles === null || styles === void 0 ? void 0 : styles.dropdownMenuOptionActive : styles === null || styles === void 0 ? void 0 : styles.dropdownMenuOption,
|
|
68
|
+
children: children
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
this._hiddenActionItemsMenuId = props.deterministicId('TopNavBarActionItems-hiddenActionItemsMenu');
|
|
72
|
+
this._hiddenActionItemsMenuTriggerId = props.deterministicId('TopNavBarActionItems-hiddenActionItemsMenuTrigger');
|
|
73
|
+
this.state = {
|
|
74
|
+
key: 0,
|
|
75
|
+
visibleActionItemsCount: void 0
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
componentDidMount() {
|
|
79
|
+
var _this$props$makeStyle, _this$props;
|
|
80
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
|
|
81
|
+
}
|
|
82
|
+
componentDidUpdate(prevProps) {
|
|
83
|
+
var _this$props$makeStyle2, _this$props2;
|
|
84
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
|
|
85
|
+
if (this.context.layout === 'smallViewport' && Children.count(prevProps.children) !== Children.count(this.props.children)) {
|
|
86
|
+
this.setState({
|
|
87
|
+
key: this.state.key + 1
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
get makeStylesVariables() {
|
|
92
|
+
return {
|
|
93
|
+
layout: this.context.layout
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
get childrenArray() {
|
|
97
|
+
const children = Children.toArray(this.props.children);
|
|
98
|
+
return children.map(child => {
|
|
99
|
+
if (!(child !== null && child !== void 0 && child.props)) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const _child$props = child.props,
|
|
103
|
+
id = _child$props.id,
|
|
104
|
+
renderAvatar = _child$props.renderAvatar,
|
|
105
|
+
renderIcon = _child$props.renderIcon,
|
|
106
|
+
variant = _child$props.variant;
|
|
107
|
+
if (renderAvatar) {
|
|
108
|
+
warn(false, `Items in <TopNavBar.ActionItems> are not allowed to have avatars, please remove it from item with the id "${id}".`);
|
|
109
|
+
return safeCloneElement(child, {
|
|
110
|
+
renderAvatar: void 0,
|
|
111
|
+
variant: 'default'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (this.context.layout === 'smallViewport' && variant !== 'icon') {
|
|
115
|
+
if (!renderIcon) {
|
|
116
|
+
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}".`);
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
return safeCloneElement(child, {
|
|
120
|
+
variant: variant === 'forceIconWithLabel' ? 'default' : 'icon'
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return child;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
renderHiddenActionItemsMenu(hiddenItems) {
|
|
127
|
+
const _this$props3 = this.props,
|
|
128
|
+
renderHiddenItemsMenuTriggerLabel = _this$props3.renderHiddenItemsMenuTriggerLabel,
|
|
129
|
+
renderHiddenItemsMenuTriggerTooltip = _this$props3.renderHiddenItemsMenuTriggerTooltip;
|
|
130
|
+
const mappedItems = mapItemsForDrilldown(hiddenItems, {
|
|
131
|
+
renderOptionContent: this.renderOptionContent
|
|
132
|
+
});
|
|
133
|
+
const subPages = renderMappedItemDrilldownSubpages(mappedItems);
|
|
134
|
+
const options = renderMappedItemsAsDrilldownOptions(mappedItems);
|
|
135
|
+
const label = typeof renderHiddenItemsMenuTriggerLabel === 'function' ? renderHiddenItemsMenuTriggerLabel(hiddenItems.length) : renderHiddenItemsMenuTriggerLabel;
|
|
136
|
+
const tooltip = typeof renderHiddenItemsMenuTriggerTooltip === 'function' ? renderHiddenItemsMenuTriggerTooltip(hiddenItems.length) : renderHiddenItemsMenuTriggerTooltip;
|
|
137
|
+
return _jsx(TopNavBarItem, {
|
|
138
|
+
id: this._hiddenActionItemsMenuTriggerId,
|
|
139
|
+
renderIcon: MoreVerticalInstUIIcon,
|
|
140
|
+
variant: "icon",
|
|
141
|
+
tooltip: tooltip,
|
|
142
|
+
showSubmenuChevron: false,
|
|
143
|
+
renderSubmenu: _jsx(Drilldown, {
|
|
144
|
+
shouldSetAriaExpanded: false,
|
|
145
|
+
rootPageId: this._hiddenActionItemsMenuId,
|
|
146
|
+
children: [_jsx(Drilldown.Page, {
|
|
147
|
+
id: this._hiddenActionItemsMenuId,
|
|
148
|
+
children: options
|
|
149
|
+
}, this._hiddenActionItemsMenuId), ...subPages]
|
|
150
|
+
}),
|
|
151
|
+
children: label
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
renderTruncatedActionItemList() {
|
|
155
|
+
const _this$props4 = this.props,
|
|
156
|
+
listLabel = _this$props4.listLabel,
|
|
157
|
+
styles = _this$props4.styles,
|
|
158
|
+
renderHiddenItemsMenuTriggerLabel = _this$props4.renderHiddenItemsMenuTriggerLabel,
|
|
159
|
+
renderHiddenItemsMenuTriggerTooltip = _this$props4.renderHiddenItemsMenuTriggerTooltip,
|
|
160
|
+
restProps = _objectWithoutProperties(_this$props4, _excluded);
|
|
161
|
+
return _createElement(TruncateList, {
|
|
162
|
+
...passthroughProps(omitProps(restProps, allowedProps)),
|
|
163
|
+
key: this.state.key // rerender if child count changes
|
|
164
|
+
,
|
|
165
|
+
elementRef: this.handleRef,
|
|
166
|
+
css: styles === null || styles === void 0 ? void 0 : styles.topNavBarActionItems,
|
|
167
|
+
visibleItemsCount: this.state.visibleActionItemsCount,
|
|
168
|
+
onUpdate: ({
|
|
169
|
+
visibleItemsCount
|
|
170
|
+
}) => {
|
|
171
|
+
this.setState({
|
|
172
|
+
visibleActionItemsCount: visibleItemsCount
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
renderHiddenItemMenu: hiddenChildren => this.renderHiddenActionItemsMenu(hiddenChildren),
|
|
176
|
+
"aria-label": listLabel
|
|
177
|
+
}, this.childrenArray);
|
|
178
|
+
}
|
|
179
|
+
render() {
|
|
180
|
+
const _this$props5 = this.props,
|
|
181
|
+
listLabel = _this$props5.listLabel,
|
|
182
|
+
styles = _this$props5.styles,
|
|
183
|
+
renderHiddenItemsMenuTriggerLabel = _this$props5.renderHiddenItemsMenuTriggerLabel,
|
|
184
|
+
renderHiddenItemsMenuTriggerTooltip = _this$props5.renderHiddenItemsMenuTriggerTooltip,
|
|
185
|
+
restProps = _objectWithoutProperties(_this$props5, _excluded2);
|
|
186
|
+
if (!this.childrenArray.length) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
if (this.context.layout === 'smallViewport') {
|
|
190
|
+
return this.renderTruncatedActionItemList();
|
|
191
|
+
}
|
|
192
|
+
return _jsx("ul", {
|
|
193
|
+
...omitProps(restProps, allowedProps),
|
|
194
|
+
ref: this.handleRef,
|
|
195
|
+
css: styles === null || styles === void 0 ? void 0 : styles.topNavBarActionItems,
|
|
196
|
+
"aria-label": listLabel,
|
|
197
|
+
"data-cid": "TopNavBarActionItems",
|
|
198
|
+
children: this.childrenArray.map(item => _jsx("li", {
|
|
199
|
+
css: styles === null || styles === void 0 ? void 0 : styles.listItem,
|
|
200
|
+
children: item
|
|
201
|
+
}, item.props.id))
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}, _TopNavBarActionItems.displayName = "TopNavBarActionItems", _TopNavBarActionItems.componentId = 'TopNavBar.ActionItems', _TopNavBarActionItems.allowedProps = allowedProps, _TopNavBarActionItems.defaultProps = {}, _TopNavBarActionItems.contextType = TopNavBarContext, _TopNavBarActionItems)) || _class) || _class);
|
|
205
|
+
export { TopNavBarActionItems };
|
|
206
|
+
export default TopNavBarActionItems;
|
|
@@ -0,0 +1,26 @@
|
|
|
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', 'listLabel', 'renderHiddenItemsMenuTriggerLabel', 'renderHiddenItemsMenuTriggerTooltip', 'elementRef'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,75 @@
|
|
|
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, _sharedTokens, state) => {
|
|
36
|
+
const dropdownMenuOptionStyle = {
|
|
37
|
+
display: 'inline-block',
|
|
38
|
+
padding: `0 ${componentTheme.smallViewportDropdownMenuActiveOptionIndicatorSpacing}`
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
topNavBarActionItems: {
|
|
42
|
+
label: 'topNavBarActionItems',
|
|
43
|
+
boxSizing: 'border-box',
|
|
44
|
+
listStyleType: 'none',
|
|
45
|
+
margin: '0',
|
|
46
|
+
padding: '0',
|
|
47
|
+
flex: '0 0',
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
alignItems: 'stretch',
|
|
51
|
+
justifyContent: 'flex-end',
|
|
52
|
+
...(state.layout === 'smallViewport' && {
|
|
53
|
+
flex: '1 1',
|
|
54
|
+
marginInlineStart: componentTheme.smallViewportActionItemContainerMargin,
|
|
55
|
+
maxWidth: componentTheme.smallViewportActionItemContainerMaxWidth
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
listItem: {
|
|
59
|
+
label: 'topNavBarActionItems__listItem',
|
|
60
|
+
flex: '0 0'
|
|
61
|
+
},
|
|
62
|
+
dropdownMenuOption: {
|
|
63
|
+
label: 'topNavBarActionItems__dropdownMenuOption',
|
|
64
|
+
...dropdownMenuOptionStyle
|
|
65
|
+
},
|
|
66
|
+
dropdownMenuOptionActive: {
|
|
67
|
+
label: 'topNavBarActionItems__dropdownMenuOptionActive',
|
|
68
|
+
...dropdownMenuOptionStyle,
|
|
69
|
+
fontWeight: componentTheme.smallViewportDropdownMenuActiveOptionFontWeight,
|
|
70
|
+
paddingBlockEnd: componentTheme.smallViewportDropdownMenuActiveOptionIndicatorSpacing,
|
|
71
|
+
borderBottom: `${componentTheme.smallViewportDropdownMenuActiveOptionIndicatorWidth} solid ${componentTheme.smallViewportDropdownMenuActiveOptionIndicatorColor}`
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export default generateStyle;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
var _dec, _class, _TopNavBarBrand;
|
|
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
|
+
|
|
26
|
+
import { Component } from 'react';
|
|
27
|
+
import { getElementType, omitProps } from '@instructure/ui-react-utils';
|
|
28
|
+
import { withStyle, InstUISettingsProvider } from '@instructure/emotion';
|
|
29
|
+
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
30
|
+
import { View } from '@instructure/ui-view/latest';
|
|
31
|
+
import { TopNavBarContext } from "../TopNavBarContext.js";
|
|
32
|
+
import generateStyle from "./styles.js";
|
|
33
|
+
import { allowedProps } from "./props.js";
|
|
34
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
35
|
+
/**
|
|
36
|
+
---
|
|
37
|
+
parent: TopNavBar
|
|
38
|
+
id: TopNavBar.Brand
|
|
39
|
+
---
|
|
40
|
+
@module TopNavBarBrand
|
|
41
|
+
**/
|
|
42
|
+
let TopNavBarBrand = (_dec = withStyle(generateStyle, 'TopNavBarBrand'), _dec(_class = (_TopNavBarBrand = class TopNavBarBrand extends Component {
|
|
43
|
+
constructor(...args) {
|
|
44
|
+
super(...args);
|
|
45
|
+
this.ref = null;
|
|
46
|
+
this.handleRef = el => {
|
|
47
|
+
const elementRef = this.props.elementRef;
|
|
48
|
+
this.ref = el;
|
|
49
|
+
if (typeof elementRef === 'function') {
|
|
50
|
+
elementRef(el);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
componentDidMount() {
|
|
55
|
+
var _this$props$makeStyle, _this$props;
|
|
56
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
|
|
57
|
+
}
|
|
58
|
+
componentDidUpdate() {
|
|
59
|
+
var _this$props$makeStyle2, _this$props2;
|
|
60
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
|
|
61
|
+
}
|
|
62
|
+
get makeStylesVariables() {
|
|
63
|
+
return {
|
|
64
|
+
layout: this.context.layout
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
const _this$props3 = this.props,
|
|
69
|
+
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
70
|
+
renderIcon = _this$props3.renderIcon,
|
|
71
|
+
href = _this$props3.href,
|
|
72
|
+
onClick = _this$props3.onClick,
|
|
73
|
+
styles = _this$props3.styles;
|
|
74
|
+
const ElementType = getElementType(TopNavBarBrand, this.props);
|
|
75
|
+
return _jsx("div", {
|
|
76
|
+
ref: this.handleRef,
|
|
77
|
+
css: styles === null || styles === void 0 ? void 0 : styles.topNavBarBrand,
|
|
78
|
+
"data-cid": "TopNavBarBrand",
|
|
79
|
+
children: renderIcon && _jsx(InstUISettingsProvider, {
|
|
80
|
+
theme: currentTheme => {
|
|
81
|
+
var _currentTheme$newThem, _currentTheme$newThem2;
|
|
82
|
+
return {
|
|
83
|
+
newTheme: {
|
|
84
|
+
sharedTokens: {
|
|
85
|
+
focusOutline: {
|
|
86
|
+
...(currentTheme === null || currentTheme === void 0 ? void 0 : (_currentTheme$newThem = currentTheme.newTheme) === null || _currentTheme$newThem === void 0 ? void 0 : (_currentTheme$newThem2 = _currentTheme$newThem.sharedTokens) === null || _currentTheme$newThem2 === void 0 ? void 0 : _currentTheme$newThem2.focusOutline),
|
|
87
|
+
inset: styles === null || styles === void 0 ? void 0 : styles.focusOutlineInset
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
children: _jsxs(View, {
|
|
94
|
+
...omitProps(this.props, allowedProps),
|
|
95
|
+
css: styles === null || styles === void 0 ? void 0 : styles.container,
|
|
96
|
+
as: ElementType,
|
|
97
|
+
href: href,
|
|
98
|
+
onClick: onClick,
|
|
99
|
+
position: "relative",
|
|
100
|
+
focusColor: this.context.inverseColor ? 'info' : 'inverse',
|
|
101
|
+
focusPosition: "inset",
|
|
102
|
+
borderRadius: "medium",
|
|
103
|
+
children: [_jsx(ScreenReaderContent, {
|
|
104
|
+
children: screenReaderLabel
|
|
105
|
+
}), renderIcon && this.context.layout !== 'smallViewport' && _jsx("div", {
|
|
106
|
+
css: styles === null || styles === void 0 ? void 0 : styles.iconContainer,
|
|
107
|
+
role: "presentation",
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
children: renderIcon
|
|
110
|
+
})]
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, _TopNavBarBrand.displayName = "TopNavBarBrand", _TopNavBarBrand.componentId = 'TopNavBar.Brand', _TopNavBarBrand.allowedProps = allowedProps, _TopNavBarBrand.defaultProps = {}, _TopNavBarBrand.contextType = TopNavBarContext, _TopNavBarBrand)) || _class);
|
|
116
|
+
export { TopNavBarBrand };
|
|
117
|
+
export default TopNavBarBrand;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 = ['screenReaderLabel', 'renderIcon', 'iconBackground', 'href', 'onClick', 'as', 'elementRef'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,79 @@
|
|
|
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, _sharedTokens, state) => {
|
|
36
|
+
const iconBackground = props.iconBackground;
|
|
37
|
+
const isDesktop = state.layout === 'desktop';
|
|
38
|
+
return {
|
|
39
|
+
topNavBarBrand: {
|
|
40
|
+
label: 'topNavBarBrand',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'stretch'
|
|
43
|
+
},
|
|
44
|
+
container: {
|
|
45
|
+
label: 'topNavBarBrand__container',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
justifyContent: 'flex-start',
|
|
48
|
+
alignItems: 'stretch',
|
|
49
|
+
border: 0,
|
|
50
|
+
padding: 0,
|
|
51
|
+
margin: 0,
|
|
52
|
+
appearance: 'none',
|
|
53
|
+
textDecoration: 'none'
|
|
54
|
+
},
|
|
55
|
+
name: {
|
|
56
|
+
label: 'topNavBarBrand__name',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
height: componentTheme.logoHeight
|
|
60
|
+
},
|
|
61
|
+
iconContainer: {
|
|
62
|
+
label: 'topNavBarBrand__iconContainer',
|
|
63
|
+
display: 'flex',
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
pointerEvents: 'none',
|
|
67
|
+
padding: componentTheme.iconPadding,
|
|
68
|
+
background: isDesktop ? iconBackground : void 0
|
|
69
|
+
},
|
|
70
|
+
icon: {
|
|
71
|
+
label: 'topNavBarBrand__icon',
|
|
72
|
+
display: 'flex',
|
|
73
|
+
justifyContent: 'center',
|
|
74
|
+
alignItems: 'center'
|
|
75
|
+
},
|
|
76
|
+
focusOutlineInset: componentTheme.focusOutlineInset
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export default generateStyle;
|