@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,650 @@
|
|
|
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.TopNavBarItem = void 0;
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
15
|
+
|
|
16
|
+
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
17
|
+
|
|
18
|
+
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
19
|
+
|
|
20
|
+
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
21
|
+
|
|
22
|
+
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
23
|
+
|
|
24
|
+
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
25
|
+
|
|
26
|
+
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
27
|
+
|
|
28
|
+
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
29
|
+
|
|
30
|
+
var _console = require("@instructure/console");
|
|
31
|
+
|
|
32
|
+
var _emotion = require("@instructure/emotion");
|
|
33
|
+
|
|
34
|
+
var _IconArrowOpenDownSolid = require("@instructure/ui-icons/lib/IconArrowOpenDownSolid.js");
|
|
35
|
+
|
|
36
|
+
var _IconArrowOpenUpSolid2 = require("@instructure/ui-icons/lib/IconArrowOpenUpSolid.js");
|
|
37
|
+
|
|
38
|
+
var _Avatar = require("@instructure/ui-avatar/lib/Avatar");
|
|
39
|
+
|
|
40
|
+
var _BaseButton = require("@instructure/ui-buttons/lib/BaseButton");
|
|
41
|
+
|
|
42
|
+
var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
|
|
43
|
+
|
|
44
|
+
var _Popover = require("@instructure/ui-popover/lib/Popover");
|
|
45
|
+
|
|
46
|
+
var _Drilldown = require("@instructure/ui-drilldown/lib/Drilldown");
|
|
47
|
+
|
|
48
|
+
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
49
|
+
|
|
50
|
+
var _TopNavBarContext = require("../TopNavBarContext");
|
|
51
|
+
|
|
52
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
53
|
+
|
|
54
|
+
var _theme = _interopRequireDefault(require("./theme"));
|
|
55
|
+
|
|
56
|
+
var _props = require("./props");
|
|
57
|
+
|
|
58
|
+
var _dec, _dec2, _dec3, _class, _class2, _IconArrowOpenUpSolid, _IconArrowOpenDownSol;
|
|
59
|
+
|
|
60
|
+
const navbarStackingDefault = 10000;
|
|
61
|
+
const submenuStacking = navbarStackingDefault + 1;
|
|
62
|
+
const tooltipStacking = navbarStackingDefault + 2;
|
|
63
|
+
/**
|
|
64
|
+
---
|
|
65
|
+
parent: TopNavBar
|
|
66
|
+
id: TopNavBar.Item
|
|
67
|
+
---
|
|
68
|
+
@module TopNavBarItem
|
|
69
|
+
@tsProps
|
|
70
|
+
**/
|
|
71
|
+
|
|
72
|
+
let TopNavBarItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarItem extends _react.Component {
|
|
73
|
+
constructor(props) {
|
|
74
|
+
super(props);
|
|
75
|
+
this.ref = null;
|
|
76
|
+
this._itemRef = null;
|
|
77
|
+
this._tooltipContentId = void 0;
|
|
78
|
+
|
|
79
|
+
this.handleRef = el => {
|
|
80
|
+
const elementRef = this.props.elementRef;
|
|
81
|
+
this.ref = el;
|
|
82
|
+
|
|
83
|
+
if (typeof elementRef === 'function') {
|
|
84
|
+
elementRef(el);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
this.handleItemRef = el => {
|
|
89
|
+
const itemRef = this.props.itemRef;
|
|
90
|
+
this._itemRef = el;
|
|
91
|
+
|
|
92
|
+
if (typeof itemRef === 'function') {
|
|
93
|
+
itemRef(el);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
this.handleKeyDown = e => {
|
|
98
|
+
if (e.key === 'ArrowDown') {
|
|
99
|
+
if (this.shouldRenderSubmenu && !this.state.isSubmenuOpen || this.shouldRenderPopover && !this.state.isPopoverOpen) {
|
|
100
|
+
var _this$_itemRef;
|
|
101
|
+
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
(_this$_itemRef = this._itemRef) === null || _this$_itemRef === void 0 ? void 0 : _this$_itemRef.click();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (e.key === 'Tab') {
|
|
108
|
+
if (this.state.isPopoverOpen && !this.isCustomPopoverControlled) {
|
|
109
|
+
this.setState({
|
|
110
|
+
isPopoverOpen: false
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
this.handleMenuToggle = (event, args) => {
|
|
117
|
+
this.setState({
|
|
118
|
+
isSubmenuOpen: args.shown
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (typeof this.props.onSubmenuToggle === 'function') {
|
|
122
|
+
this.props.onSubmenuToggle(event, args);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
this._tooltipContentId = props.deterministicId('TopNavBarItem-tooltip');
|
|
127
|
+
this.state = {
|
|
128
|
+
isSubmenuOpen: false,
|
|
129
|
+
isPopoverOpen: false
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
componentDidMount() {
|
|
134
|
+
const _this$props = this.props,
|
|
135
|
+
makeStyles = _this$props.makeStyles,
|
|
136
|
+
customPopoverConfig = _this$props.customPopoverConfig;
|
|
137
|
+
makeStyles === null || makeStyles === void 0 ? void 0 : makeStyles(this.makeStylesVariables);
|
|
138
|
+
|
|
139
|
+
if (customPopoverConfig && this.isCustomPopoverControlled) {
|
|
140
|
+
this.setState({
|
|
141
|
+
isPopoverOpen: !!customPopoverConfig.isShowingContent
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
componentDidUpdate() {
|
|
147
|
+
const _this$props2 = this.props,
|
|
148
|
+
makeStyles = _this$props2.makeStyles,
|
|
149
|
+
customPopoverConfig = _this$props2.customPopoverConfig;
|
|
150
|
+
makeStyles === null || makeStyles === void 0 ? void 0 : makeStyles(this.makeStylesVariables);
|
|
151
|
+
|
|
152
|
+
if (customPopoverConfig && this.isCustomPopoverControlled && customPopoverConfig.isShowingContent !== this.state.isPopoverOpen) {
|
|
153
|
+
this.setState({
|
|
154
|
+
isPopoverOpen: !!customPopoverConfig.isShowingContent
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
get makeStylesVariables() {
|
|
160
|
+
const _this$context = this.context,
|
|
161
|
+
layout = _this$context.layout,
|
|
162
|
+
inverseColor = _this$context.inverseColor;
|
|
163
|
+
return {
|
|
164
|
+
layout,
|
|
165
|
+
inverseColor
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
get shouldRenderSubmenu() {
|
|
170
|
+
const renderSubmenu = this.props.renderSubmenu;
|
|
171
|
+
return !!renderSubmenu && (0, _matchComponentTypes.matchComponentTypes)(renderSubmenu, [_Drilldown.Drilldown]);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
get shouldRenderPopover() {
|
|
175
|
+
const _this$props3 = this.props,
|
|
176
|
+
id = _this$props3.id,
|
|
177
|
+
renderSubmenu = _this$props3.renderSubmenu,
|
|
178
|
+
customPopoverConfig = _this$props3.customPopoverConfig;
|
|
179
|
+
|
|
180
|
+
if (!customPopoverConfig) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (!customPopoverConfig.children) {
|
|
185
|
+
(0, _console.warn)(false, `Pass the content of the custom Popover as "customPopoverConfig.children" for the item with id: "${id}".`);
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (customPopoverConfig && renderSubmenu) {
|
|
190
|
+
(0, _console.warn)(false, `TopNavBar.Items are not allowed to have both the "renderSubmenu" and "customPopoverConfig" props. For submenus, pass a Drilldown component via the "renderSubmenu" prop, and only use "customPopoverConfig" for custom features. Item with id: "${id}" will ignore the "customPopoverConfig" prop.`);
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
get isCustomPopoverControlled() {
|
|
198
|
+
const customPopoverConfig = this.props.customPopoverConfig;
|
|
199
|
+
return customPopoverConfig && typeof customPopoverConfig.isShowingContent !== 'undefined';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
get hasOpenPopover() {
|
|
203
|
+
return this.state.isSubmenuOpen || this.state.isPopoverOpen;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
get isDefaultVariant() {
|
|
207
|
+
return this.props.variant === 'default';
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
get isButtonVariant() {
|
|
211
|
+
return this.props.variant === 'button';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
get isIconVariant() {
|
|
215
|
+
return this.props.variant === 'icon';
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
get isAvatarOnlyVariant() {
|
|
219
|
+
return this.props.variant === 'avatar';
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
get hasAvatar() {
|
|
223
|
+
const _this$props4 = this.props,
|
|
224
|
+
id = _this$props4.id,
|
|
225
|
+
renderIcon = _this$props4.renderIcon,
|
|
226
|
+
renderAvatar = _this$props4.renderAvatar,
|
|
227
|
+
variant = _this$props4.variant;
|
|
228
|
+
const hasAvatar = !!renderAvatar;
|
|
229
|
+
|
|
230
|
+
if (this.isAvatarOnlyVariant && !hasAvatar) {
|
|
231
|
+
(0, _console.warn)(false, `The "renderAvatar" config is required for the 'variant="avatar"' type <TopNavBar.Item> components, but received none for the item with id "${id}".`);
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (hasAvatar && (renderIcon || variant === 'icon')) {
|
|
236
|
+
(0, _console.warn)(false, `<TopNavBar.Item> components with icons cannot display avatars, so the "renderAvatar" config prop will be ignored for item with id "${id}".`);
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return hasAvatar;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
get submenuIcon() {
|
|
244
|
+
var _this$props$styles;
|
|
245
|
+
|
|
246
|
+
if (!(this.shouldRenderSubmenu || this.shouldRenderPopover) || !this.props.showSubmenuChevron) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return (0, _emotion.jsx)("span", {
|
|
251
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.submenuIcon
|
|
252
|
+
}, this.shouldRenderSubmenu && this.state.isSubmenuOpen || this.shouldRenderPopover && this.state.isPopoverOpen ? _IconArrowOpenUpSolid || (_IconArrowOpenUpSolid = (0, _emotion.jsx)(_IconArrowOpenUpSolid2.IconArrowOpenUpSolid, null)) : _IconArrowOpenDownSol || (_IconArrowOpenDownSol = (0, _emotion.jsx)(_IconArrowOpenDownSolid.IconArrowOpenDownSolid, null)));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
get buttonThemeOverride() {
|
|
256
|
+
const styles = this.props.styles;
|
|
257
|
+
const themeOverride = {};
|
|
258
|
+
|
|
259
|
+
if (this.isDefaultVariant || this.hasAvatar) {
|
|
260
|
+
themeOverride.mediumPaddingHorizontal = styles === null || styles === void 0 ? void 0 : styles.itemInlinePadding;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (this.hasAvatar) {
|
|
264
|
+
themeOverride.mediumPaddingTop = '0.125rem';
|
|
265
|
+
themeOverride.mediumPaddingBottom = '0.125rem';
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (this.isAvatarOnlyVariant && !this.submenuIcon) {
|
|
269
|
+
themeOverride.mediumPaddingHorizontal = '0';
|
|
270
|
+
themeOverride.mediumPaddingTop = '0';
|
|
271
|
+
themeOverride.mediumPaddingBottom = '0';
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (this.size === 'large') {
|
|
275
|
+
// we need a custom 42x42 px icon here,
|
|
276
|
+
// so that the focus ring won't be cut off
|
|
277
|
+
themeOverride.largeHeight = '2.625rem';
|
|
278
|
+
themeOverride.iconSizeLarge = '1.5rem';
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return Object.keys(themeOverride).length > 0 ? themeOverride : void 0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
get colorProps() {
|
|
285
|
+
let color = 'primary-inverse';
|
|
286
|
+
let focusColor = 'inverse';
|
|
287
|
+
|
|
288
|
+
if (this.context.inverseColor) {
|
|
289
|
+
color = 'secondary';
|
|
290
|
+
focusColor = 'info';
|
|
291
|
+
|
|
292
|
+
if (this.isButtonVariant) {
|
|
293
|
+
color = 'primary';
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return {
|
|
298
|
+
color,
|
|
299
|
+
focusColor
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
get size() {
|
|
304
|
+
return this.isIconVariant && this.context.layout === 'smallViewport' ? 'large' : 'medium';
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
get ariaProps() {
|
|
308
|
+
let hasPopup;
|
|
309
|
+
let expanded;
|
|
310
|
+
|
|
311
|
+
if (this.shouldRenderSubmenu) {
|
|
312
|
+
hasPopup = 'menu';
|
|
313
|
+
expanded = this.state.isSubmenuOpen;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (this.shouldRenderPopover) {
|
|
317
|
+
hasPopup = 'true';
|
|
318
|
+
expanded = this.state.isPopoverOpen;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return {
|
|
322
|
+
'aria-haspopup': hasPopup,
|
|
323
|
+
'aria-expanded': expanded
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
get itemProps() {
|
|
328
|
+
const _this$props5 = this.props,
|
|
329
|
+
id = _this$props5.id,
|
|
330
|
+
variant = _this$props5.variant,
|
|
331
|
+
hrefOriginal = _this$props5.href,
|
|
332
|
+
onClickOriginal = _this$props5.onClick,
|
|
333
|
+
onMouseOver = _this$props5.onMouseOver,
|
|
334
|
+
onMouseOut = _this$props5.onMouseOut,
|
|
335
|
+
onFocus = _this$props5.onFocus,
|
|
336
|
+
onBlur = _this$props5.onBlur,
|
|
337
|
+
onKeyDown = _this$props5.onKeyDown,
|
|
338
|
+
onKeyUp = _this$props5.onKeyUp,
|
|
339
|
+
renderSubmenu = _this$props5.renderSubmenu,
|
|
340
|
+
statusOriginal = _this$props5.status,
|
|
341
|
+
renderAvatar = _this$props5.renderAvatar,
|
|
342
|
+
renderIcon = _this$props5.renderIcon;
|
|
343
|
+
let href = hrefOriginal;
|
|
344
|
+
let onClick = onClickOriginal;
|
|
345
|
+
let status = statusOriginal;
|
|
346
|
+
|
|
347
|
+
if (renderSubmenu) {
|
|
348
|
+
if (href) {
|
|
349
|
+
(0, _console.warn)(false, `TopNavBar.Items with submenus are not allowed to have 'href' property, but received href "${href}" for item with the id: "${id}".`);
|
|
350
|
+
href = void 0;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (onClick) {
|
|
354
|
+
(0, _console.warn)(false, `TopNavBar.Items with submenus are not allowed to have 'onClick' property, but received onClick for item with the id: "${id}".Use the \`onSubmenuToggle\` prop instead. OnClick: ${onClick}`);
|
|
355
|
+
onClick = void 0;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (status === 'active' && !this.isDefaultVariant) {
|
|
360
|
+
(0, _console.warn)(false, `Only \`variant="default"\` <TopNavBar.Item> components can be set to active, but item with id "${id}" has variant: "${variant}".`);
|
|
361
|
+
status = 'default';
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (this.hasAvatar) {
|
|
365
|
+
if (!(renderAvatar !== null && renderAvatar !== void 0 && renderAvatar.avatarName)) {
|
|
366
|
+
(0, _console.error)(false, `The "avatarName" prop is required for for <TopNavBar.Item> components with avatar, but the item with id "${id}" is missing it.`);
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (status === 'active') {
|
|
371
|
+
(0, _console.warn)(false, `<TopNavBar.Item> components with avatar cannot have "active" status, so the "active" status on the item with id "${id}" will be ignored.`);
|
|
372
|
+
status = 'default';
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (this.isIconVariant) {
|
|
377
|
+
if (!renderIcon) {
|
|
378
|
+
(0, _console.error)(false, `The "renderIcon" prop is required for the \`variant="icon"\` type <TopNavBar.Item> components, but the item with id "${id}" is missing it.`);
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return {
|
|
384
|
+
id,
|
|
385
|
+
...this.colorProps,
|
|
386
|
+
...this.ariaProps,
|
|
387
|
+
size: this.size,
|
|
388
|
+
withBorder: this.isButtonVariant,
|
|
389
|
+
withBackground: this.isButtonVariant,
|
|
390
|
+
interaction: status === 'disabled' ? 'disabled' : void 0,
|
|
391
|
+
'aria-disabled': status === 'disabled' ? 'true' : void 0,
|
|
392
|
+
shape: this.isAvatarOnlyVariant && !this.submenuIcon ? 'circle' : 'rectangle',
|
|
393
|
+
href,
|
|
394
|
+
onClick,
|
|
395
|
+
onMouseOver,
|
|
396
|
+
onMouseOut,
|
|
397
|
+
onFocus,
|
|
398
|
+
onBlur,
|
|
399
|
+
onKeyDown: (0, _createChainedFunction.createChainedFunction)(onKeyDown, this.handleKeyDown),
|
|
400
|
+
onKeyUp,
|
|
401
|
+
renderIcon,
|
|
402
|
+
themeOverride: this.buttonThemeOverride,
|
|
403
|
+
elementRef: e => {
|
|
404
|
+
this.handleItemRef(e);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
renderContent() {
|
|
410
|
+
var _this$props$styles2;
|
|
411
|
+
|
|
412
|
+
const _this$props6 = this.props,
|
|
413
|
+
children = _this$props6.children,
|
|
414
|
+
styles = _this$props6.styles;
|
|
415
|
+
const itemProps = this.itemProps;
|
|
416
|
+
|
|
417
|
+
if (!itemProps) {
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
let content = children;
|
|
422
|
+
|
|
423
|
+
if (this.isAvatarOnlyVariant) {
|
|
424
|
+
content = this.renderAvatar();
|
|
425
|
+
} else if (this.isIconVariant) {
|
|
426
|
+
content = (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, content);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const button = (0, _emotion.jsx)(_BaseButton.BaseButton, Object.assign({}, itemProps, (0, _passthroughProps.passthroughProps)((0, _omitProps.omitProps)(this.props, _props.allowedProps))), this.isIconVariant && !this.submenuIcon ? content : (0, _emotion.jsx)("div", {
|
|
430
|
+
css: styles === null || styles === void 0 ? void 0 : styles.content
|
|
431
|
+
}, this.hasAvatar && !this.isAvatarOnlyVariant && (0, _emotion.jsx)("span", {
|
|
432
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.avatarContainer
|
|
433
|
+
}, this.renderAvatar()), content, this.submenuIcon));
|
|
434
|
+
return (0, _emotion.jsx)("div", {
|
|
435
|
+
css: styles === null || styles === void 0 ? void 0 : styles.container
|
|
436
|
+
}, this.props.tooltip ? this.wrapButtonInTooltip(button, children) : button);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
wrapButtonInTooltip(button, content) {
|
|
440
|
+
const _this$props7 = this.props,
|
|
441
|
+
tooltip = _this$props7.tooltip,
|
|
442
|
+
styles = _this$props7.styles;
|
|
443
|
+
|
|
444
|
+
if (!tooltip) {
|
|
445
|
+
return button;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
let tooltipProps = {
|
|
449
|
+
placement: 'bottom',
|
|
450
|
+
color: this.context.inverseColor ? 'primary' : 'primary-inverse'
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
if (typeof tooltip === 'string') {
|
|
454
|
+
tooltipProps.renderTip = tooltip;
|
|
455
|
+
} else {
|
|
456
|
+
tooltipProps = { ...tooltipProps,
|
|
457
|
+
...tooltip
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
const tipContent = (0, _callRenderProp.callRenderProp)(tooltipProps.renderTip);
|
|
462
|
+
|
|
463
|
+
if (!tipContent) {
|
|
464
|
+
return button;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const contentAndTooltipIdentical = tipContent === content;
|
|
468
|
+
return (0, _emotion.jsx)(_emotion.InstUISettingsProvider, {
|
|
469
|
+
theme: {
|
|
470
|
+
componentOverrides: {
|
|
471
|
+
View: {
|
|
472
|
+
// moves tooltips above submenus/popovers
|
|
473
|
+
stackingTopmost: tooltipStacking
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}, (0, _emotion.jsx)(_Tooltip.Tooltip, Object.assign({}, tooltipProps, {
|
|
478
|
+
renderTip: contentAndTooltipIdentical ? tipContent : (0, _emotion.jsx)("div", {
|
|
479
|
+
id: this._tooltipContentId
|
|
480
|
+
}, tipContent),
|
|
481
|
+
positionContainerDisplay: "block"
|
|
482
|
+
}), (0, _emotion.jsx)("div", {
|
|
483
|
+
css: styles === null || styles === void 0 ? void 0 : styles.submenuTriggerContainer
|
|
484
|
+
}, contentAndTooltipIdentical ? button : (0, _safeCloneElement.safeCloneElement)(button, {
|
|
485
|
+
'aria-describedby': this._tooltipContentId
|
|
486
|
+
}))));
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
renderAvatar() {
|
|
490
|
+
if (!this.hasAvatar) {
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const _this$props8 = this.props,
|
|
495
|
+
id = _this$props8.id,
|
|
496
|
+
children = _this$props8.children,
|
|
497
|
+
renderAvatar = _this$props8.renderAvatar;
|
|
498
|
+
const _ref = renderAvatar,
|
|
499
|
+
avatarName = _ref.avatarName,
|
|
500
|
+
avatarSrc = _ref.avatarSrc,
|
|
501
|
+
avatarAlt = _ref.avatarAlt;
|
|
502
|
+
const label = avatarAlt || (typeof children === 'string' ? children : void 0);
|
|
503
|
+
|
|
504
|
+
if (!label) {
|
|
505
|
+
(0, _console.warn)(false, `Please supply a label for the avatar with either the "renderAvatar.avatarAlt" or the "children" (as string) prop. It is needed for screen reader support, but missing on the item with the id: "${id}".`);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
return avatarName ? (0, _emotion.jsx)(_Avatar.Avatar, {
|
|
509
|
+
name: avatarName,
|
|
510
|
+
src: avatarSrc,
|
|
511
|
+
alt: label,
|
|
512
|
+
size: "small"
|
|
513
|
+
}) : null;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
renderDropdownMenu() {
|
|
517
|
+
var _renderSubmenu$props, _renderSubmenu$props2, _renderSubmenu$props3;
|
|
518
|
+
|
|
519
|
+
const _this$props9 = this.props,
|
|
520
|
+
id = _this$props9.id,
|
|
521
|
+
renderSubmenu = _this$props9.renderSubmenu,
|
|
522
|
+
status = _this$props9.status,
|
|
523
|
+
styles = _this$props9.styles;
|
|
524
|
+
|
|
525
|
+
if (!renderSubmenu || !this.shouldRenderSubmenu) {
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (typeof renderSubmenu.props.show !== 'undefined') {
|
|
530
|
+
(0, _console.warn)(false, `TopNavBar.Item Drilldown submenus are controlled by the component. The "show" prop will be ignored on the submenu of the item with id: "${id}".`);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (renderSubmenu.props.trigger) {
|
|
534
|
+
(0, _console.warn)(false, `TopNavBar.Item submenus have the item itself as their trigger. The "trigger" prop will be ignored on the Drilldown submenu of item with id: "${id}".`);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return (0, _safeCloneElement.safeCloneElement)(renderSubmenu, {
|
|
538
|
+
trigger: (0, _emotion.jsx)("div", {
|
|
539
|
+
css: styles === null || styles === void 0 ? void 0 : styles.submenuTriggerContainer
|
|
540
|
+
}, this.renderContent()),
|
|
541
|
+
show: this.state.isSubmenuOpen,
|
|
542
|
+
onToggle: (0, _createChainedFunction.createChainedFunction)((_renderSubmenu$props = renderSubmenu.props) === null || _renderSubmenu$props === void 0 ? void 0 : _renderSubmenu$props.onToggle, this.handleMenuToggle),
|
|
543
|
+
positionContainerDisplay: 'block',
|
|
544
|
+
placement: 'bottom start',
|
|
545
|
+
withArrow: false,
|
|
546
|
+
minWidth: ((_renderSubmenu$props2 = renderSubmenu.props) === null || _renderSubmenu$props2 === void 0 ? void 0 : _renderSubmenu$props2.minWidth) || '18.5rem',
|
|
547
|
+
maxHeight: ((_renderSubmenu$props3 = renderSubmenu.props) === null || _renderSubmenu$props3 === void 0 ? void 0 : _renderSubmenu$props3.maxHeight) || `calc(100vh - 10rem)`,
|
|
548
|
+
...(status === 'disabled' && {
|
|
549
|
+
disabled: true,
|
|
550
|
+
show: false,
|
|
551
|
+
onToggle: void 0
|
|
552
|
+
})
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
renderPopover() {
|
|
557
|
+
const _this$props10 = this.props,
|
|
558
|
+
id = _this$props10.id,
|
|
559
|
+
customPopoverConfig = _this$props10.customPopoverConfig,
|
|
560
|
+
styles = _this$props10.styles;
|
|
561
|
+
|
|
562
|
+
if (!customPopoverConfig || !this.shouldRenderPopover) {
|
|
563
|
+
return null;
|
|
564
|
+
} // @ts-expect-error throw a warning just in case they pass trigger
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
if (customPopoverConfig.renderTrigger) {
|
|
568
|
+
(0, _console.warn)(false, `TopNavBar.Item popovers have the item itself as their trigger. The "renderTrigger" prop will be ignored on the popover of item with id: "${id}".`);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
const popoverProps = {
|
|
572
|
+
// defaults:
|
|
573
|
+
placement: 'bottom start',
|
|
574
|
+
withArrow: true,
|
|
575
|
+
shouldReturnFocus: true,
|
|
576
|
+
shouldContainFocus: false,
|
|
577
|
+
// user input:
|
|
578
|
+
...customPopoverConfig,
|
|
579
|
+
// fix overrides:
|
|
580
|
+
positionContainerDisplay: 'block',
|
|
581
|
+
renderTrigger: (0, _emotion.jsx)("div", {
|
|
582
|
+
css: styles === null || styles === void 0 ? void 0 : styles.submenuTriggerContainer
|
|
583
|
+
}, this.renderContent()),
|
|
584
|
+
onShowContent: (0, _createChainedFunction.createChainedFunction)(customPopoverConfig.onShowContent, () => {
|
|
585
|
+
if (!this.isCustomPopoverControlled) {
|
|
586
|
+
this.setState({
|
|
587
|
+
isPopoverOpen: true
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}),
|
|
591
|
+
onHideContent: (0, _createChainedFunction.createChainedFunction)(customPopoverConfig.onHideContent, () => {
|
|
592
|
+
if (!this.isCustomPopoverControlled) {
|
|
593
|
+
this.setState({
|
|
594
|
+
isPopoverOpen: false
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
}),
|
|
598
|
+
isShowingContent: this.state.isPopoverOpen,
|
|
599
|
+
// @ts-expect-error This is a force override for Popover, because it puts
|
|
600
|
+
// aria-expanded on the trigger when shouldContainFocus="true",
|
|
601
|
+
// even when it should be on the item's <button>
|
|
602
|
+
'aria-expanded': void 0
|
|
603
|
+
};
|
|
604
|
+
return (0, _emotion.jsx)(_Popover.Popover, popoverProps, customPopoverConfig.children);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
render() {
|
|
608
|
+
const styles = this.props.styles;
|
|
609
|
+
let content;
|
|
610
|
+
|
|
611
|
+
if (this.shouldRenderPopover) {
|
|
612
|
+
content = (0, _emotion.jsx)(_emotion.InstUISettingsProvider, {
|
|
613
|
+
theme: {
|
|
614
|
+
componentOverrides: {
|
|
615
|
+
View: {
|
|
616
|
+
// moves popovers above navbar, below tooltips
|
|
617
|
+
stackingTopmost: submenuStacking
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}, this.renderPopover());
|
|
622
|
+
} else if (this.shouldRenderSubmenu) {
|
|
623
|
+
content = (0, _emotion.jsx)(_emotion.InstUISettingsProvider, {
|
|
624
|
+
theme: {
|
|
625
|
+
componentOverrides: {
|
|
626
|
+
View: {
|
|
627
|
+
// moves submenus above navbar, below tooltips
|
|
628
|
+
stackingTopmost: submenuStacking
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}, this.renderDropdownMenu());
|
|
633
|
+
} else {
|
|
634
|
+
content = this.renderContent();
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
return (0, _emotion.jsx)("div", {
|
|
638
|
+
ref: this.handleRef,
|
|
639
|
+
css: styles === null || styles === void 0 ? void 0 : styles.topNavBarItem
|
|
640
|
+
}, content);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
}, _class2.displayName = "TopNavBarItem", _class2.componentId = 'TopNavBar.Item', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
644
|
+
status: 'default',
|
|
645
|
+
variant: 'default',
|
|
646
|
+
showSubmenuChevron: true
|
|
647
|
+
}, _class2.contextType = _TopNavBarContext.TopNavBarContext, _class2)) || _class) || _class) || _class);
|
|
648
|
+
exports.TopNavBarItem = TopNavBarItem;
|
|
649
|
+
var _default = TopNavBarItem;
|
|
650
|
+
exports.default = _default;
|