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