@instructure/ui-top-nav-bar 8.30.1-snapshot-15
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 +57 -0
- package/README.md +30 -0
- package/es/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +47 -0
- package/es/TopNavBar/TopNavBarActionItems/index.js +215 -0
- package/es/TopNavBar/TopNavBarActionItems/props.js +36 -0
- package/es/TopNavBar/TopNavBarActionItems/styles.js +76 -0
- package/es/TopNavBar/TopNavBarActionItems/theme.js +46 -0
- package/es/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +57 -0
- package/es/TopNavBar/TopNavBarBrand/index.js +117 -0
- package/es/TopNavBar/TopNavBarBrand/props.js +37 -0
- package/es/TopNavBar/TopNavBarBrand/styles.js +91 -0
- package/es/TopNavBar/TopNavBarBrand/theme.js +42 -0
- package/es/TopNavBar/TopNavBarContext.js +37 -0
- package/es/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +114 -0
- package/es/TopNavBar/TopNavBarItem/index.js +634 -0
- package/es/TopNavBar/TopNavBarItem/props.js +64 -0
- package/es/TopNavBar/TopNavBarItem/styles.js +124 -0
- package/es/TopNavBar/TopNavBarItem/theme.js +54 -0
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +86 -0
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +119 -0
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +31 -0
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +115 -0
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +61 -0
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +126 -0
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +454 -0
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +31 -0
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +158 -0
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +61 -0
- package/es/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +36 -0
- package/es/TopNavBar/TopNavBarLayout/index.js +118 -0
- package/es/TopNavBar/TopNavBarLayout/props.js +69 -0
- package/es/TopNavBar/TopNavBarLayout/theme.js +40 -0
- package/es/TopNavBar/TopNavBarLocator.js +29 -0
- package/es/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +54 -0
- package/es/TopNavBar/TopNavBarMenuItems/index.js +210 -0
- package/es/TopNavBar/TopNavBarMenuItems/props.js +35 -0
- package/es/TopNavBar/TopNavBarMenuItems/styles.js +65 -0
- package/es/TopNavBar/TopNavBarMenuItems/theme.js +45 -0
- package/es/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +29 -0
- package/es/TopNavBar/TopNavBarUser/index.js +109 -0
- package/es/TopNavBar/TopNavBarUser/props.js +32 -0
- package/es/TopNavBar/TopNavBarUser/styles.js +45 -0
- package/es/TopNavBar/index.js +110 -0
- package/es/TopNavBar/props.js +33 -0
- package/es/TopNavBar/utils/exampleHelpers.js +211 -0
- package/es/TopNavBar/utils/exampleSvgFiles.js +86 -0
- package/es/TopNavBar/utils/mapItemsForDrilldown.js +142 -0
- package/es/index.js +24 -0
- package/lib/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +59 -0
- package/lib/TopNavBar/TopNavBarActionItems/index.js +222 -0
- package/lib/TopNavBar/TopNavBarActionItems/props.js +50 -0
- package/lib/TopNavBar/TopNavBarActionItems/styles.js +84 -0
- package/lib/TopNavBar/TopNavBarActionItems/theme.js +54 -0
- package/lib/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +68 -0
- package/lib/TopNavBar/TopNavBarBrand/index.js +115 -0
- package/lib/TopNavBar/TopNavBarBrand/props.js +48 -0
- package/lib/TopNavBar/TopNavBarBrand/styles.js +99 -0
- package/lib/TopNavBar/TopNavBarBrand/theme.js +50 -0
- package/lib/TopNavBar/TopNavBarContext.js +46 -0
- package/lib/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +131 -0
- package/lib/TopNavBar/TopNavBarItem/index.js +650 -0
- package/lib/TopNavBar/TopNavBarItem/props.js +79 -0
- package/lib/TopNavBar/TopNavBarItem/styles.js +132 -0
- package/lib/TopNavBar/TopNavBarItem/theme.js +62 -0
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +102 -0
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +113 -0
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +40 -0
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +123 -0
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +69 -0
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +143 -0
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +472 -0
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +40 -0
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +166 -0
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +69 -0
- package/lib/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +48 -0
- package/lib/TopNavBar/TopNavBarLayout/index.js +113 -0
- package/lib/TopNavBar/TopNavBarLayout/props.js +94 -0
- package/lib/TopNavBar/TopNavBarLayout/theme.js +52 -0
- package/lib/TopNavBar/TopNavBarLocator.js +39 -0
- package/lib/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +66 -0
- package/lib/TopNavBar/TopNavBarMenuItems/index.js +213 -0
- package/lib/TopNavBar/TopNavBarMenuItems/props.js +48 -0
- package/lib/TopNavBar/TopNavBarMenuItems/styles.js +73 -0
- package/lib/TopNavBar/TopNavBarMenuItems/theme.js +53 -0
- package/lib/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +39 -0
- package/lib/TopNavBar/TopNavBarUser/index.js +104 -0
- package/lib/TopNavBar/TopNavBarUser/props.js +45 -0
- package/lib/TopNavBar/TopNavBarUser/styles.js +53 -0
- package/lib/TopNavBar/index.js +110 -0
- package/lib/TopNavBar/props.js +44 -0
- package/lib/TopNavBar/utils/exampleHelpers.js +255 -0
- package/lib/TopNavBar/utils/exampleSvgFiles.js +75 -0
- package/lib/TopNavBar/utils/mapItemsForDrilldown.js +165 -0
- package/lib/index.js +13 -0
- package/lib/package.json +1 -0
- package/package.json +64 -0
- package/src/TopNavBar/README.md +2329 -0
- package/src/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.ts +53 -0
- package/src/TopNavBar/TopNavBarActionItems/index.tsx +299 -0
- package/src/TopNavBar/TopNavBarActionItems/props.ts +152 -0
- package/src/TopNavBar/TopNavBarActionItems/styles.ts +92 -0
- package/src/TopNavBar/TopNavBarActionItems/theme.ts +51 -0
- package/src/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.ts +44 -0
- package/src/TopNavBar/TopNavBarBrand/index.tsx +139 -0
- package/src/TopNavBar/TopNavBarBrand/props.ts +146 -0
- package/src/TopNavBar/TopNavBarBrand/styles.ts +102 -0
- package/src/TopNavBar/TopNavBarBrand/theme.ts +48 -0
- package/src/TopNavBar/TopNavBarContext.ts +47 -0
- package/src/TopNavBar/TopNavBarItem/TopNavBarItemLocator.ts +111 -0
- package/src/TopNavBar/TopNavBarItem/index.tsx +752 -0
- package/src/TopNavBar/TopNavBarItem/props.ts +331 -0
- package/src/TopNavBar/TopNavBarItem/styles.ts +142 -0
- package/src/TopNavBar/TopNavBarItem/theme.ts +60 -0
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.ts +84 -0
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/index.tsx +148 -0
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/props.ts +104 -0
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/styles.ts +136 -0
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/theme.ts +66 -0
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.ts +125 -0
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.tsx +600 -0
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.ts +187 -0
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.ts +184 -0
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.ts +69 -0
- package/src/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.ts +46 -0
- package/src/TopNavBar/TopNavBarLayout/index.tsx +149 -0
- package/src/TopNavBar/TopNavBarLayout/props.ts +209 -0
- package/src/TopNavBar/TopNavBarLayout/theme.ts +47 -0
- package/src/TopNavBar/TopNavBarLocator.ts +31 -0
- package/src/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.ts +56 -0
- package/src/TopNavBar/TopNavBarMenuItems/index.tsx +275 -0
- package/src/TopNavBar/TopNavBarMenuItems/props.ts +133 -0
- package/src/TopNavBar/TopNavBarMenuItems/styles.ts +72 -0
- package/src/TopNavBar/TopNavBarMenuItems/theme.ts +51 -0
- package/src/TopNavBar/TopNavBarUser/TopNavBarUserLocator.ts +32 -0
- package/src/TopNavBar/TopNavBarUser/index.tsx +133 -0
- package/src/TopNavBar/TopNavBarUser/props.ts +83 -0
- package/src/TopNavBar/TopNavBarUser/styles.ts +47 -0
- package/src/TopNavBar/index.tsx +142 -0
- package/src/TopNavBar/props.ts +108 -0
- package/src/TopNavBar/utils/exampleHelpers.tsx +342 -0
- package/src/TopNavBar/utils/exampleSvgFiles.tsx +76 -0
- package/src/TopNavBar/utils/mapItemsForDrilldown.tsx +228 -0
- package/src/index.ts +62 -0
- package/tsconfig.build.json +37 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +4 -0
- package/types/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.d.ts +2116 -0
- package/types/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarActionItems/index.d.ts +40 -0
- package/types/TopNavBar/TopNavBarActionItems/index.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarActionItems/props.d.ts +59 -0
- package/types/TopNavBar/TopNavBarActionItems/props.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarActionItems/styles.d.ts +15 -0
- package/types/TopNavBar/TopNavBarActionItems/styles.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarActionItems/theme.d.ts +10 -0
- package/types/TopNavBar/TopNavBarActionItems/theme.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.d.ts +592 -0
- package/types/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarBrand/index.d.ts +30 -0
- package/types/TopNavBar/TopNavBarBrand/index.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarBrand/props.d.ts +60 -0
- package/types/TopNavBar/TopNavBarBrand/props.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarBrand/styles.d.ts +15 -0
- package/types/TopNavBar/TopNavBarBrand/styles.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarBrand/theme.d.ts +10 -0
- package/types/TopNavBar/TopNavBarBrand/theme.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarContext.d.ts +17 -0
- package/types/TopNavBar/TopNavBarContext.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarItem/TopNavBarItemLocator.d.ts +642 -0
- package/types/TopNavBar/TopNavBarItem/TopNavBarItemLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarItem/index.d.ts +64 -0
- package/types/TopNavBar/TopNavBarItem/index.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarItem/props.d.ts +188 -0
- package/types/TopNavBar/TopNavBarItem/props.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarItem/styles.d.ts +15 -0
- package/types/TopNavBar/TopNavBarItem/styles.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarItem/theme.d.ts +10 -0
- package/types/TopNavBar/TopNavBarItem/theme.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.d.ts +5737 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts +31 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/props.d.ts +29 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/props.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts +15 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/theme.d.ts +10 -0
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/theme.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.d.ts +4357 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts +58 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.d.ts +89 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.d.ts +15 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.d.ts +10 -0
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.d.ts +7 -0
- package/types/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/index.d.ts +34 -0
- package/types/TopNavBar/TopNavBarLayout/index.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/props.d.ts +83 -0
- package/types/TopNavBar/TopNavBarLayout/props.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLayout/theme.d.ts +10 -0
- package/types/TopNavBar/TopNavBarLayout/theme.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarLocator.d.ts +566 -0
- package/types/TopNavBar/TopNavBarLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.d.ts +1351 -0
- package/types/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarMenuItems/index.d.ts +38 -0
- package/types/TopNavBar/TopNavBarMenuItems/index.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarMenuItems/props.d.ts +53 -0
- package/types/TopNavBar/TopNavBarMenuItems/props.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarMenuItems/styles.d.ts +15 -0
- package/types/TopNavBar/TopNavBarMenuItems/styles.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarMenuItems/theme.d.ts +10 -0
- package/types/TopNavBar/TopNavBarMenuItems/theme.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarUser/TopNavBarUserLocator.d.ts +566 -0
- package/types/TopNavBar/TopNavBarUser/TopNavBarUserLocator.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarUser/index.d.ts +31 -0
- package/types/TopNavBar/TopNavBarUser/index.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarUser/props.d.ts +29 -0
- package/types/TopNavBar/TopNavBarUser/props.d.ts.map +1 -0
- package/types/TopNavBar/TopNavBarUser/styles.d.ts +14 -0
- package/types/TopNavBar/TopNavBarUser/styles.d.ts.map +1 -0
- package/types/TopNavBar/index.d.ts +38 -0
- package/types/TopNavBar/index.d.ts.map +1 -0
- package/types/TopNavBar/props.d.ts +43 -0
- package/types/TopNavBar/props.d.ts.map +1 -0
- package/types/TopNavBar/utils/exampleHelpers.d.ts +70 -0
- package/types/TopNavBar/utils/exampleHelpers.d.ts.map +1 -0
- package/types/TopNavBar/utils/exampleSvgFiles.d.ts +7 -0
- package/types/TopNavBar/utils/exampleSvgFiles.d.ts.map +1 -0
- package/types/TopNavBar/utils/mapItemsForDrilldown.d.ts +19 -0
- package/types/TopNavBar/utils/mapItemsForDrilldown.d.ts.map +1 -0
- package/types/index.d.ts +11 -0
- package/types/index.d.ts.map +1 -0
package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
+
import { find } from '@instructure/ui-test-utils';
|
|
26
|
+
/* eslint-disable no-restricted-imports */
|
|
27
|
+
// @ts-expect-error bypass no type definition found error
|
|
28
|
+
|
|
29
|
+
import { DrilldownLocator } from '@instructure/ui-drilldown/es/Drilldown/DrilldownLocator'; // @ts-expect-error bypass no type definition found error
|
|
30
|
+
|
|
31
|
+
import { TrayLocator } from '@instructure/ui-tray/es/Tray/TrayLocator'; // @ts-expect-error bypass no type definition found error
|
|
32
|
+
|
|
33
|
+
import { TruncateListLocator } from '@instructure/ui-truncate-list/es/TruncateList/TruncateListLocator';
|
|
34
|
+
/* eslint-enable no-restricted-imports */
|
|
35
|
+
|
|
36
|
+
import { TopNavBarItemLocator } from '../../TopNavBarItem/TopNavBarItemLocator';
|
|
37
|
+
import { TopNavBarBrandLocator } from '../../TopNavBarBrand/TopNavBarBrandLocator';
|
|
38
|
+
import { TopNavBarActionItemsLocator } from '../../TopNavBarActionItems/TopNavBarActionItemsLocator';
|
|
39
|
+
import { TopNavBarSmallViewportLayout } from './index';
|
|
40
|
+
export const TopNavBarSmallViewportLayoutLocator = locator( // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
41
|
+
TopNavBarSmallViewportLayout.selector, {
|
|
42
|
+
findNavBar: function () {
|
|
43
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
|
+
args[_key] = arguments[_key];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return find('[class$=-topNavBarSmallViewportLayout__navbar]', ...args);
|
|
48
|
+
},
|
|
49
|
+
findDropdownMenuTriggerWrapper: function () {
|
|
50
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
51
|
+
args[_key2] = arguments[_key2];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return find('[class*=-topNavBarSmallViewportLayout__menuTrigger]', ...args);
|
|
55
|
+
},
|
|
56
|
+
findAlternativeTitleContainer: function () {
|
|
57
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
58
|
+
args[_key3] = arguments[_key3];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return find('[class*=-topNavBarSmallViewportLayout__alternativeTitleContainer]', ...args);
|
|
62
|
+
},
|
|
63
|
+
findDropdownMenuTriggerItem: async function () {
|
|
64
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
65
|
+
args[_key4] = arguments[_key4];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const triggerExists = await find('[id^=TopNavBarSmallViewportLayout-menuTrigger_]', ...args);
|
|
69
|
+
|
|
70
|
+
if (triggerExists) {
|
|
71
|
+
return TopNavBarItemLocator.find('[id^=TopNavBarSmallViewportLayout-menuTrigger_]');
|
|
72
|
+
} else {
|
|
73
|
+
return triggerExists;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
findDropdownMenuTriggerButton: async function () {
|
|
77
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
78
|
+
args[_key5] = arguments[_key5];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const triggerExists = await find('[id^=TopNavBarSmallViewportLayout-menuTrigger_]', ...args);
|
|
82
|
+
|
|
83
|
+
if (triggerExists) {
|
|
84
|
+
const menuItem = await TopNavBarItemLocator.find('[id^=TopNavBarSmallViewportLayout-menuTrigger_]');
|
|
85
|
+
return menuItem.findButton();
|
|
86
|
+
} else {
|
|
87
|
+
return triggerExists;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
findBrandContainer: function () {
|
|
91
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
92
|
+
args[_key6] = arguments[_key6];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return find('[class$=-topNavBarSmallViewportLayout__brandContainer]', ...args);
|
|
96
|
+
},
|
|
97
|
+
findBrand: function () {
|
|
98
|
+
return TopNavBarBrandLocator.find(...arguments);
|
|
99
|
+
},
|
|
100
|
+
findActionItems: function () {
|
|
101
|
+
return TopNavBarActionItemsLocator.find(...arguments);
|
|
102
|
+
},
|
|
103
|
+
findTruncateList: function () {
|
|
104
|
+
return TruncateListLocator.find(...arguments);
|
|
105
|
+
},
|
|
106
|
+
findDropdownMenuTray: function () {
|
|
107
|
+
return TrayLocator.find(...arguments);
|
|
108
|
+
},
|
|
109
|
+
findDropdownMenu: function () {
|
|
110
|
+
return DrilldownLocator.find(...arguments);
|
|
111
|
+
},
|
|
112
|
+
findInPlaceDialog: function () {
|
|
113
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
114
|
+
args[_key7] = arguments[_key7];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return find('[class$=-topNavBarSmallViewportLayout__inPlaceDialogContainer]', ...args);
|
|
118
|
+
},
|
|
119
|
+
findInPlaceDialogCloseButton: function () {
|
|
120
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
121
|
+
args[_key8] = arguments[_key8];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return find('[id^=TopNavBarSmallViewportLayout-inPlaceDialogCloseButton_]', ...args);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _class2, _IconXLine, _IconHamburgerLine;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* The MIT License (MIT)
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** @jsx jsx */
|
|
28
|
+
import React, { Component } from 'react';
|
|
29
|
+
import { omitProps, withDeterministicId, callRenderProp } from '@instructure/ui-react-utils';
|
|
30
|
+
import { px } from '@instructure/ui-utils';
|
|
31
|
+
import { warn } from '@instructure/console';
|
|
32
|
+
import { testable } from '@instructure/ui-testable';
|
|
33
|
+
import { getBoundingClientRect, requestAnimationFrame } from '@instructure/ui-dom-utils';
|
|
34
|
+
import { withStyle, jsx, Global } from '@instructure/emotion';
|
|
35
|
+
import { Tray } from '@instructure/ui-tray';
|
|
36
|
+
import { IconXLine, IconHamburgerLine, IconArrowOpenDownSolid, IconArrowOpenUpSolid } from '@instructure/ui-icons';
|
|
37
|
+
import { Avatar } from '@instructure/ui-avatar';
|
|
38
|
+
import { Dialog } from '@instructure/ui-dialog';
|
|
39
|
+
import { Drilldown } from '@instructure/ui-drilldown';
|
|
40
|
+
import { TopNavBarItem } from '../../TopNavBarItem';
|
|
41
|
+
import { mapItemsForDrilldown, renderMappedItemDrilldownSubpages, renderMappedItemsAsDrilldownOptions } from '../../utils/mapItemsForDrilldown';
|
|
42
|
+
import { TopNavBarContext } from '../../TopNavBarContext';
|
|
43
|
+
import generateStyle from './styles';
|
|
44
|
+
import generateComponentTheme from './theme';
|
|
45
|
+
import { propTypes, allowedProps } from './props';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
---
|
|
49
|
+
private: true
|
|
50
|
+
---
|
|
51
|
+
@tsProps
|
|
52
|
+
**/
|
|
53
|
+
let TopNavBarSmallViewportLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarSmallViewportLayout extends Component {
|
|
54
|
+
constructor(props) {
|
|
55
|
+
var _props$styles;
|
|
56
|
+
|
|
57
|
+
super(props);
|
|
58
|
+
this.ref = null;
|
|
59
|
+
this._trayContainerId = void 0;
|
|
60
|
+
this._trayId = void 0;
|
|
61
|
+
this._drilldownId = void 0;
|
|
62
|
+
this._menuTriggerId = void 0;
|
|
63
|
+
this._menuId = void 0;
|
|
64
|
+
this._inPlaceDialogId = void 0;
|
|
65
|
+
this._inPlaceDialogCloseButtonId = void 0;
|
|
66
|
+
this._separatorId = void 0;
|
|
67
|
+
this._raf = [];
|
|
68
|
+
|
|
69
|
+
this.handleRef = el => {
|
|
70
|
+
const elementRef = this.props.elementRef;
|
|
71
|
+
this.ref = el;
|
|
72
|
+
|
|
73
|
+
if (typeof elementRef === 'function') {
|
|
74
|
+
elementRef(el);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
this.renderOptionContent = (children, itemProps) => {
|
|
79
|
+
const styles = this.props.styles;
|
|
80
|
+
const status = itemProps.status,
|
|
81
|
+
renderAvatar = itemProps.renderAvatar;
|
|
82
|
+
let content = children;
|
|
83
|
+
let optionStyle = status === 'active' ? styles === null || styles === void 0 ? void 0 : styles.dropdownMenuOptionActive : styles === null || styles === void 0 ? void 0 : styles.dropdownMenuOption;
|
|
84
|
+
|
|
85
|
+
if (renderAvatar) {
|
|
86
|
+
const avatarName = renderAvatar.avatarName,
|
|
87
|
+
avatarSrc = renderAvatar.avatarSrc,
|
|
88
|
+
avatarAlt = renderAvatar.avatarAlt;
|
|
89
|
+
const label = avatarAlt || (typeof children === 'string' ? children : void 0);
|
|
90
|
+
optionStyle = styles === null || styles === void 0 ? void 0 : styles.dropdownMenuOptionWithAvatar;
|
|
91
|
+
content = jsx(React.Fragment, null, jsx(Avatar, {
|
|
92
|
+
name: avatarName,
|
|
93
|
+
src: avatarSrc,
|
|
94
|
+
alt: label,
|
|
95
|
+
size: "small",
|
|
96
|
+
margin: "0 small 0 0",
|
|
97
|
+
role: "presentation",
|
|
98
|
+
"aria-hidden": "true"
|
|
99
|
+
}), children);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return jsx("span", {
|
|
103
|
+
css: optionStyle
|
|
104
|
+
}, content);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
this._trayContainerId = props.deterministicId('TopNavBarSmallViewportLayout-trayContainer');
|
|
108
|
+
this._trayId = props.deterministicId('TopNavBarSmallViewportLayout-tray');
|
|
109
|
+
this._menuId = props.deterministicId('TopNavBarSmallViewportLayout-menu');
|
|
110
|
+
this._menuTriggerId = props.deterministicId('TopNavBarSmallViewportLayout-menuTrigger');
|
|
111
|
+
this._drilldownId = props.deterministicId('TopNavBarSmallViewportLayout-drilldown');
|
|
112
|
+
this._inPlaceDialogId = props.deterministicId('TopNavBarSmallViewportLayout-inPlaceDialog');
|
|
113
|
+
this._inPlaceDialogCloseButtonId = props.deterministicId('TopNavBarSmallViewportLayout-inPlaceDialogCloseButton');
|
|
114
|
+
this._separatorId = props.deterministicId('TopNavBarSmallViewportLayout-separator');
|
|
115
|
+
this.state = {
|
|
116
|
+
isDropdownMenuOpen: false,
|
|
117
|
+
isDropdownMenuVisible: false,
|
|
118
|
+
menuBottomPosition: px(((_props$styles = props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.navbarHeight) || 0)
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
componentDidMount() {
|
|
123
|
+
var _this$props$makeStyle, _this$props;
|
|
124
|
+
|
|
125
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
|
|
126
|
+
this.updateMenuBottomPosition();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
componentDidUpdate() {
|
|
130
|
+
var _this$props$makeStyle2, _this$props2;
|
|
131
|
+
|
|
132
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
componentWillUnmount() {
|
|
136
|
+
this._raf.forEach(request => request.cancel());
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get makeStylesVariables() {
|
|
140
|
+
return {
|
|
141
|
+
isDropdownMenuVisible: this.state.isDropdownMenuVisible,
|
|
142
|
+
drilldownId: this._drilldownId,
|
|
143
|
+
trayId: this._trayId,
|
|
144
|
+
menuBottomPosition: this.state.menuBottomPosition,
|
|
145
|
+
inverseColor: this.context.inverseColor
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
hasBrandBlock(renderBrand) {
|
|
150
|
+
return !!renderBrand && (!!renderBrand.props.renderName || !!renderBrand.props.renderIcon);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
hasMenuItemsBlock(renderMenuItems) {
|
|
154
|
+
return !!renderMenuItems && React.Children.count(renderMenuItems.props.children) > 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
hasActionItemsBlock(renderActionItems) {
|
|
158
|
+
return !!renderActionItems && React.Children.count(renderActionItems.props.children) > 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
hasUserBlock(renderUser) {
|
|
162
|
+
return !!renderUser && React.Children.count(renderUser.props.children) > 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
get hasSubmenu() {
|
|
166
|
+
return (this.dropdownMenuContent || []).length > 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
get isInPlaceDialogOpen() {
|
|
170
|
+
var _this$props$renderInP;
|
|
171
|
+
|
|
172
|
+
return (_this$props$renderInP = this.props.renderInPlaceDialogConfig) === null || _this$props$renderInP === void 0 ? void 0 : _this$props$renderInP.open;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
get mappedUserOptions() {
|
|
176
|
+
const renderUser = this.props.renderUser;
|
|
177
|
+
|
|
178
|
+
if (!this.hasUserBlock(renderUser)) {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const userChildren = React.Children.toArray(renderUser.props.children);
|
|
183
|
+
return mapItemsForDrilldown(userChildren, {
|
|
184
|
+
renderOptionContent: this.renderOptionContent
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
get mappedMenuItemsOptions() {
|
|
189
|
+
const renderMenuItems = this.props.renderMenuItems;
|
|
190
|
+
|
|
191
|
+
if (!this.hasMenuItemsBlock(renderMenuItems)) {
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const menuItemsChildren = React.Children.toArray(renderMenuItems.props.children);
|
|
196
|
+
return mapItemsForDrilldown(menuItemsChildren, {
|
|
197
|
+
renderOptionContent: this.renderOptionContent,
|
|
198
|
+
currentPageId: renderMenuItems.props.currentPageId
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
get extractDrilldownSubpages() {
|
|
203
|
+
return renderMappedItemDrilldownSubpages([...this.mappedUserOptions, ...this.mappedMenuItemsOptions]);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
updateMenuBottomPosition() {
|
|
207
|
+
const boundingRect = getBoundingClientRect(this.ref);
|
|
208
|
+
this.setState({
|
|
209
|
+
menuBottomPosition: boundingRect.top + boundingRect.height
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
toggleDropdownMenu() {
|
|
214
|
+
const onDropdownMenuToggle = this.props.onDropdownMenuToggle;
|
|
215
|
+
const isDropdownMenuOpen = this.state.isDropdownMenuOpen;
|
|
216
|
+
|
|
217
|
+
if (!isDropdownMenuOpen) {
|
|
218
|
+
this.updateMenuBottomPosition();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (typeof onDropdownMenuToggle === 'function') {
|
|
222
|
+
onDropdownMenuToggle(!isDropdownMenuOpen);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.setState({
|
|
226
|
+
isDropdownMenuOpen: !isDropdownMenuOpen
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
renderMenuTrigger() {
|
|
231
|
+
const _this$props3 = this.props,
|
|
232
|
+
dropdownMenuToggleButtonLabel = _this$props3.dropdownMenuToggleButtonLabel,
|
|
233
|
+
dropdownMenuToggleButtonTooltip = _this$props3.dropdownMenuToggleButtonTooltip,
|
|
234
|
+
renderBrand = _this$props3.renderBrand,
|
|
235
|
+
alternativeTitle = _this$props3.alternativeTitle,
|
|
236
|
+
styles = _this$props3.styles;
|
|
237
|
+
const isDropdownMenuOpen = this.state.isDropdownMenuOpen;
|
|
238
|
+
let menuTrigger;
|
|
239
|
+
const menuTriggerStyle = [styles === null || styles === void 0 ? void 0 : styles.menuTrigger, ...(alternativeTitle ? [styles === null || styles === void 0 ? void 0 : styles.alternativeTitleContainer] : [])];
|
|
240
|
+
|
|
241
|
+
if (!this.hasSubmenu) {
|
|
242
|
+
menuTrigger = null;
|
|
243
|
+
|
|
244
|
+
if (alternativeTitle) {
|
|
245
|
+
warn(false, 'There are no menu items or user menu to display in the <TopNavBar> dropdown menu! The menu trigger and the alternative title will not display.');
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
const itemProps = {
|
|
249
|
+
id: this._menuTriggerId,
|
|
250
|
+
onClick: () => {
|
|
251
|
+
this.toggleDropdownMenu();
|
|
252
|
+
},
|
|
253
|
+
tooltip: dropdownMenuToggleButtonTooltip,
|
|
254
|
+
themeOverride: {
|
|
255
|
+
itemSpacing: '0.375rem'
|
|
256
|
+
},
|
|
257
|
+
'aria-haspopup': 'menu',
|
|
258
|
+
'aria-expanded': isDropdownMenuOpen
|
|
259
|
+
};
|
|
260
|
+
const alternativeTitleIconProps = {
|
|
261
|
+
size: 'x-small',
|
|
262
|
+
style: {
|
|
263
|
+
marginInlineEnd: '0.5em'
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
menuTrigger = jsx("div", {
|
|
267
|
+
css: menuTriggerStyle
|
|
268
|
+
}, alternativeTitle ? jsx(TopNavBarItem, Object.assign({}, itemProps, {
|
|
269
|
+
"aria-label": dropdownMenuToggleButtonLabel
|
|
270
|
+
}), isDropdownMenuOpen ? jsx(IconArrowOpenUpSolid, alternativeTitleIconProps) : jsx(IconArrowOpenDownSolid, alternativeTitleIconProps), alternativeTitle) : jsx(TopNavBarItem, Object.assign({}, itemProps, {
|
|
271
|
+
variant: "icon",
|
|
272
|
+
renderIcon: isDropdownMenuOpen ? _IconXLine || (_IconXLine = jsx(IconXLine, null)) : _IconHamburgerLine || (_IconHamburgerLine = jsx(IconHamburgerLine, null))
|
|
273
|
+
}), dropdownMenuToggleButtonLabel));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return jsx("div", {
|
|
277
|
+
css: styles === null || styles === void 0 ? void 0 : styles.menuTriggerContainer
|
|
278
|
+
}, menuTrigger, this.hasBrandBlock(renderBrand) && !alternativeTitle && jsx("div", {
|
|
279
|
+
css: styles === null || styles === void 0 ? void 0 : styles.brandContainer
|
|
280
|
+
}, renderBrand));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
get dropdownMenuContent() {
|
|
284
|
+
const _this$props4 = this.props,
|
|
285
|
+
renderUser = _this$props4.renderUser,
|
|
286
|
+
renderMenuItems = _this$props4.renderMenuItems;
|
|
287
|
+
const hasMenuItems = this.hasMenuItemsBlock(renderMenuItems);
|
|
288
|
+
const hasUser = this.hasUserBlock(renderUser);
|
|
289
|
+
let pageChildren = [];
|
|
290
|
+
|
|
291
|
+
if (hasUser) {
|
|
292
|
+
pageChildren = renderMappedItemsAsDrilldownOptions(this.mappedUserOptions);
|
|
293
|
+
|
|
294
|
+
if (hasMenuItems) {
|
|
295
|
+
pageChildren.push(jsx(Drilldown.Separator, {
|
|
296
|
+
id: this._separatorId,
|
|
297
|
+
key: this._separatorId
|
|
298
|
+
}));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (hasMenuItems) {
|
|
303
|
+
pageChildren = [...pageChildren, ...renderMappedItemsAsDrilldownOptions(this.mappedMenuItemsOptions)];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return pageChildren.length ? pageChildren : void 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
renderDropdownMenu() {
|
|
310
|
+
const _this$props5 = this.props,
|
|
311
|
+
dropdownMenuLabel = _this$props5.dropdownMenuLabel,
|
|
312
|
+
onDropdownMenuSelect = _this$props5.onDropdownMenuSelect;
|
|
313
|
+
return jsx(Drilldown, {
|
|
314
|
+
id: this._drilldownId,
|
|
315
|
+
rootPageId: this._menuId,
|
|
316
|
+
label: dropdownMenuLabel,
|
|
317
|
+
height: "100%",
|
|
318
|
+
width: "100%",
|
|
319
|
+
onSelect: (e, args) => {
|
|
320
|
+
if (typeof onDropdownMenuSelect === 'function') {
|
|
321
|
+
onDropdownMenuSelect(e, args);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (args.selectedOption.props.href) {
|
|
325
|
+
this.toggleDropdownMenu();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}, [jsx(Drilldown.Page, {
|
|
329
|
+
id: this._menuId,
|
|
330
|
+
key: this._menuId
|
|
331
|
+
}, this.dropdownMenuContent), ...this.extractDrilldownSubpages]);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
renderDropdownMenuTray() {
|
|
335
|
+
const trayMountNode = this.props.trayMountNode;
|
|
336
|
+
|
|
337
|
+
if (!this.hasSubmenu) {
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return jsx(Tray, {
|
|
342
|
+
id: this._trayId,
|
|
343
|
+
label: '',
|
|
344
|
+
role: "none",
|
|
345
|
+
open: this.state.isDropdownMenuOpen,
|
|
346
|
+
transitionExit: false,
|
|
347
|
+
onDismiss: () => {
|
|
348
|
+
this.toggleDropdownMenu();
|
|
349
|
+
},
|
|
350
|
+
onKeyUp: e => {
|
|
351
|
+
if (e.key === 'Escape') {
|
|
352
|
+
this.toggleDropdownMenu();
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
onEnter: () => {
|
|
356
|
+
this.setState({
|
|
357
|
+
isDropdownMenuVisible: true
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
onExited: () => {
|
|
361
|
+
this.setState({
|
|
362
|
+
isDropdownMenuVisible: false
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
shouldCloseOnDocumentClick: true,
|
|
366
|
+
placement: "top",
|
|
367
|
+
shadow: false,
|
|
368
|
+
mountNode: trayMountNode || document.getElementById(this._trayContainerId),
|
|
369
|
+
defaultFocusElement: () => document.getElementById(this._drilldownId),
|
|
370
|
+
themeOverride: {
|
|
371
|
+
position: 'absolute'
|
|
372
|
+
}
|
|
373
|
+
}, this.renderDropdownMenu());
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
renderInPlaceDialog() {
|
|
377
|
+
const _this$props6 = this.props,
|
|
378
|
+
renderInPlaceDialogConfig = _this$props6.renderInPlaceDialogConfig,
|
|
379
|
+
styles = _this$props6.styles;
|
|
380
|
+
|
|
381
|
+
if (!renderInPlaceDialogConfig) {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const content = renderInPlaceDialogConfig.content,
|
|
386
|
+
open = renderInPlaceDialogConfig.open,
|
|
387
|
+
onClose = renderInPlaceDialogConfig.onClose,
|
|
388
|
+
closeButtonLabel = renderInPlaceDialogConfig.closeButtonLabel,
|
|
389
|
+
shouldContainFocus = renderInPlaceDialogConfig.shouldContainFocus,
|
|
390
|
+
shouldCloseOnEscape = renderInPlaceDialogConfig.shouldCloseOnEscape,
|
|
391
|
+
shouldCloseOnDocumentClick = renderInPlaceDialogConfig.shouldCloseOnDocumentClick,
|
|
392
|
+
returnFocusElement = renderInPlaceDialogConfig.returnFocusElement;
|
|
393
|
+
|
|
394
|
+
const handleClose = () => {
|
|
395
|
+
if (typeof onClose === 'function') {
|
|
396
|
+
onClose();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (returnFocusElement) {
|
|
400
|
+
this._raf.push(requestAnimationFrame(() => {
|
|
401
|
+
var _returnFocusElement;
|
|
402
|
+
|
|
403
|
+
(_returnFocusElement = returnFocusElement()) === null || _returnFocusElement === void 0 ? void 0 : _returnFocusElement.focus();
|
|
404
|
+
}));
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const dialog = jsx(Dialog, {
|
|
409
|
+
display: "block",
|
|
410
|
+
open: open,
|
|
411
|
+
shouldContainFocus: shouldContainFocus,
|
|
412
|
+
shouldCloseOnEscape: shouldCloseOnEscape,
|
|
413
|
+
shouldCloseOnDocumentClick: shouldCloseOnDocumentClick,
|
|
414
|
+
onDismiss: handleClose
|
|
415
|
+
}, jsx("div", {
|
|
416
|
+
id: this._inPlaceDialogId,
|
|
417
|
+
css: styles === null || styles === void 0 ? void 0 : styles.inPlaceDialogContainer
|
|
418
|
+
}, jsx("div", {
|
|
419
|
+
css: styles === null || styles === void 0 ? void 0 : styles.inPlaceDialogContainerContent
|
|
420
|
+
}, callRenderProp(content, {
|
|
421
|
+
closeInPlaceDialog: handleClose
|
|
422
|
+
})), jsx("div", {
|
|
423
|
+
css: styles === null || styles === void 0 ? void 0 : styles.inPlaceDialogContainerButton
|
|
424
|
+
}, jsx(TopNavBarItem, {
|
|
425
|
+
id: this._inPlaceDialogCloseButtonId,
|
|
426
|
+
renderIcon: IconXLine,
|
|
427
|
+
variant: "icon",
|
|
428
|
+
onClick: handleClose
|
|
429
|
+
}, closeButtonLabel))));
|
|
430
|
+
return dialog;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
render() {
|
|
434
|
+
const _this$props7 = this.props,
|
|
435
|
+
trayMountNode = _this$props7.trayMountNode,
|
|
436
|
+
navLabel = _this$props7.navLabel,
|
|
437
|
+
renderActionItems = _this$props7.renderActionItems,
|
|
438
|
+
styles = _this$props7.styles;
|
|
439
|
+
return jsx("nav", Object.assign({}, omitProps(this.props, allowedProps), {
|
|
440
|
+
ref: this.handleRef,
|
|
441
|
+
"aria-label": navLabel
|
|
442
|
+
}), jsx(Global, {
|
|
443
|
+
styles: styles === null || styles === void 0 ? void 0 : styles.globalStyles
|
|
444
|
+
}), !this.isInPlaceDialogOpen && jsx("div", {
|
|
445
|
+
css: styles === null || styles === void 0 ? void 0 : styles.navbar
|
|
446
|
+
}, this.renderMenuTrigger(), this.hasActionItemsBlock(renderActionItems) && renderActionItems), this.renderInPlaceDialog(), !trayMountNode && jsx("div", {
|
|
447
|
+
css: styles === null || styles === void 0 ? void 0 : styles.trayContainer,
|
|
448
|
+
id: this._trayContainerId
|
|
449
|
+
}), this.renderDropdownMenuTray());
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
}, _class2.displayName = "TopNavBarSmallViewportLayout", _class2.componentId = 'TopNavBar.SmallViewportLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
|
|
453
|
+
export { TopNavBarSmallViewportLayout };
|
|
454
|
+
export default TopNavBarSmallViewportLayout;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { commonAllowedProps, commonPropTypes, smallViewportPropTypes, smallViewportAllowedProps } from '../props';
|
|
25
|
+
const propTypes = { // Edit PropTypes in TopNabBarLayout/props.ts
|
|
26
|
+
...commonPropTypes,
|
|
27
|
+
...smallViewportPropTypes
|
|
28
|
+
};
|
|
29
|
+
const allowedProps = [// Edit allowed props in TopNabBarLayout/props.ts
|
|
30
|
+
...commonAllowedProps, ...smallViewportAllowedProps];
|
|
31
|
+
export { propTypes, allowedProps };
|