@commercetools-frontend/application-shell 22.31.0 → 22.32.1
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/dist/commercetools-frontend-application-shell.cjs.dev.js +2 -2
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +2 -2
- package/dist/commercetools-frontend-application-shell.esm.js +2 -2
- package/dist/{custom-view-dev-host-9469b02c.cjs.prod.js → custom-view-dev-host-acd1662c.cjs.prod.js} +2 -2
- package/dist/{custom-view-dev-host-1ef244b8.cjs.dev.js → custom-view-dev-host-ea966172.cjs.dev.js} +2 -2
- package/dist/{custom-view-dev-host-83d6228b.esm.js → custom-view-dev-host-ee7241d0.esm.js} +2 -2
- package/dist/declarations/src/components/navbar/menu-items.d.ts +1 -0
- package/dist/declarations/src/components/navbar/menu-items.styles.d.ts +5 -1
- package/dist/declarations/src/components/navbar/navbar.d.ts +4 -0
- package/dist/declarations/src/components/navbar/use-navbar-state-manager.d.ts +6 -0
- package/dist/{index-ff4b1f1e.cjs.prod.js → index-069f1ca4.cjs.prod.js} +24 -27
- package/dist/{index-bd1c5108.cjs.dev.js → index-712041ce.cjs.dev.js} +28 -37
- package/dist/{index-9475648a.esm.js → index-c6d39d9a.esm.js} +28 -37
- package/dist/navbar-18309167.esm.js +1402 -0
- package/dist/{navbar-32ad8010.cjs.prod.js → navbar-277d8bab.cjs.prod.js} +102 -15
- package/dist/navbar-70e6ff37.cjs.dev.js +1434 -0
- package/dist/{oidc-callback-a622f3a5.esm.js → oidc-callback-426543bd.esm.js} +2 -2
- package/dist/{oidc-callback-910e1e1c.cjs.dev.js → oidc-callback-6d8661a7.cjs.dev.js} +2 -2
- package/dist/{oidc-callback-365669c2.cjs.prod.js → oidc-callback-a7b3088f.cjs.prod.js} +2 -2
- package/dist/{project-container-4cc1a369.cjs.prod.js → project-container-17d221c0.cjs.prod.js} +6 -6
- package/dist/{project-container-ba49f3db.cjs.dev.js → project-container-350e7ff0.cjs.dev.js} +6 -6
- package/dist/{project-container-edb85c22.esm.js → project-container-3efce01d.esm.js} +6 -6
- package/dist/{project-expired-59d50031.cjs.prod.js → project-expired-10425dda.cjs.prod.js} +3 -3
- package/dist/{project-expired-378bcfb0.cjs.dev.js → project-expired-11f69d71.cjs.dev.js} +3 -3
- package/dist/{project-expired-ef791516.esm.js → project-expired-584cf7b2.esm.js} +3 -3
- package/dist/{project-not-found-543b8e4f.cjs.dev.js → project-not-found-a21b79d8.cjs.dev.js} +3 -3
- package/dist/{project-not-found-bc7cea0c.esm.js → project-not-found-bd29336b.esm.js} +3 -3
- package/dist/{project-not-found-a7faf93c.cjs.prod.js → project-not-found-d2e7c7b7.cjs.prod.js} +3 -3
- package/dist/{project-not-initialized-88376a4a.esm.js → project-not-initialized-47ce67ef.esm.js} +3 -3
- package/dist/{project-not-initialized-a9c3afa0.cjs.dev.js → project-not-initialized-64525c0d.cjs.dev.js} +3 -3
- package/dist/{project-not-initialized-e9560ddb.cjs.prod.js → project-not-initialized-dc109aaf.cjs.prod.js} +3 -3
- package/dist/{project-suspended-5cc4bc59.cjs.dev.js → project-suspended-1094409f.cjs.dev.js} +3 -3
- package/dist/{project-suspended-8fa0b06e.esm.js → project-suspended-1bc73aee.esm.js} +3 -3
- package/dist/{project-suspended-0686fc53.cjs.prod.js → project-suspended-ec497457.cjs.prod.js} +3 -3
- package/dist/{quick-access-3479fec8.cjs.dev.js → quick-access-4efe155a.cjs.dev.js} +2 -2
- package/dist/{quick-access-96ea968d.cjs.prod.js → quick-access-9a9a5dc5.cjs.prod.js} +2 -2
- package/dist/{quick-access-72e35fc8.esm.js → quick-access-cd490552.esm.js} +2 -2
- package/dist/{redirect-to-logout-edf8d35c.cjs.dev.js → redirect-to-logout-429e0321.cjs.dev.js} +2 -2
- package/dist/{redirect-to-logout-d017b04b.cjs.prod.js → redirect-to-logout-8c803d30.cjs.prod.js} +2 -2
- package/dist/{redirect-to-logout-4ee944fa.esm.js → redirect-to-logout-d97b55de.esm.js} +2 -2
- package/dist/{requests-in-flight-loader-efda7302.esm.js → requests-in-flight-loader-15a3f959.esm.js} +2 -2
- package/dist/{requests-in-flight-loader-61257a90.cjs.prod.js → requests-in-flight-loader-59a59e53.cjs.prod.js} +2 -2
- package/dist/{requests-in-flight-loader-0a78e347.cjs.dev.js → requests-in-flight-loader-77d94ee8.cjs.dev.js} +2 -2
- package/dist/{service-page-project-switcher-9310d282.cjs.prod.js → service-page-project-switcher-74e66255.cjs.prod.js} +1 -1
- package/dist/{service-page-project-switcher-fb693a35.esm.js → service-page-project-switcher-c40bb72c.esm.js} +1 -1
- package/dist/{service-page-project-switcher-ae1cd6fa.cjs.dev.js → service-page-project-switcher-da3ffe4f.cjs.dev.js} +1 -1
- package/dist/{version-tracker-935e29c6.esm.js → version-tracker-5fe096be.esm.js} +2 -2
- package/dist/{version-tracker-5aea360a.cjs.prod.js → version-tracker-9c16fe1e.cjs.prod.js} +2 -2
- package/dist/{version-tracker-54afa816.cjs.dev.js → version-tracker-dbe46be6.cjs.dev.js} +2 -2
- package/package.json +16 -16
- package/dist/navbar-18ab9da8.esm.js +0 -1308
- package/dist/navbar-4068efee.cjs.dev.js +0 -1340
|
@@ -106,27 +106,31 @@ var _ref5 = {
|
|
|
106
106
|
styles: "bottom:0"
|
|
107
107
|
} ;
|
|
108
108
|
const getContainerPositionBasedOnMenuItemPosition = (isSubmenuAboveMenuItem, isSublistActiveWhileIsMenuExpanded, isSublistActiveWhileIsMenuCollapsed) => [isSublistActiveWhileIsMenuCollapsed && /*#__PURE__*/react.css(isSubmenuAboveMenuItem ? 'bottom' : 'top', ":-", oidc.NAVBAR.itemSize, ";" + ("" ), "" ), isSublistActiveWhileIsMenuExpanded && isSubmenuAboveMenuItem && _ref5, isSublistActiveWhileIsMenuExpanded && !isSubmenuAboveMenuItem && _ref4];
|
|
109
|
+
const fadeIn = react.keyframes`
|
|
110
|
+
from {opacity: 0;}
|
|
111
|
+
to { opacity: 1;}
|
|
112
|
+
`;
|
|
109
113
|
var _ref3 = {
|
|
110
114
|
name: "eivff4",
|
|
111
115
|
styles: "display:none"
|
|
112
116
|
} ;
|
|
113
117
|
const Expander = /*#__PURE__*/_styled__default["default"]("li", {
|
|
114
|
-
target: "
|
|
118
|
+
target: "e1i568cv8"
|
|
115
119
|
} )("display:flex;align-items:center;justify-content:center;background:", designSystem.designTokens.colorPrimary10, ";padding:", designSystem.designTokens.spacing30, " ", designSystem.designTokens.spacing25, ";", props => !props.isVisible && _ref3, "::before{content:'';position:absolute;top:", oidc.NAVBAR.itemHeight, ";height:1px;background:rgba(255, 255, 255, 0.5);width:calc(100% - 2 * ", designSystem.designTokens.spacing30, ");}" + ("" ));
|
|
116
120
|
const ExpanderIcon = /*#__PURE__*/_styled__default["default"]("div", {
|
|
117
|
-
target: "
|
|
121
|
+
target: "e1i568cv7"
|
|
118
122
|
} )("height:", oidc.NAVBAR.expanderSize, ";width:", oidc.NAVBAR.expanderSize, ";border-radius:", designSystem.designTokens.borderRadius4, ";padding:", designSystem.designTokens.spacing20, ";background:rgba(255, 255, 255, 0.2);display:flex;justify-content:center;align-items:center;:hover,:focus{background:rgba(255, 255, 255, 0.3);cursor:pointer;}" + ("" ));
|
|
119
123
|
const LeftNavigation = /*#__PURE__*/_styled__default["default"]("nav", {
|
|
120
|
-
target: "
|
|
124
|
+
target: "e1i568cv6"
|
|
121
125
|
} )("display:grid;width:", oidc.NAVBAR.widthLeftNavigation, ";background:", applicationComponents.designTokens.backgroundColorForNavbar, ";height:100%;grid-template-rows:56px 1fr;transition:", oidc.NAVBAR.leftNavigationTransition, ";" + ("" ));
|
|
122
126
|
const TextLinkSublistWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
123
|
-
target: "
|
|
127
|
+
target: "e1i568cv5"
|
|
124
128
|
} )({
|
|
125
129
|
name: "khglpi",
|
|
126
130
|
styles: "display:flex;flex-direction:column;position:relative;min-height:0"
|
|
127
131
|
} );
|
|
128
132
|
const NavlinkClickableContent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
129
|
-
target: "
|
|
133
|
+
target: "e1i568cv4"
|
|
130
134
|
} )({
|
|
131
135
|
name: "1kzq5ms",
|
|
132
136
|
styles: "height:100%;width:100%"
|
|
@@ -141,20 +145,23 @@ var _ref2 = {
|
|
|
141
145
|
styles: "visibility:hidden"
|
|
142
146
|
} ;
|
|
143
147
|
const MenuList = /*#__PURE__*/_styled__default["default"]("ul", {
|
|
144
|
-
target: "
|
|
148
|
+
target: "e1i568cv3"
|
|
145
149
|
} )(props => [props.level === 1 && listStyles, getSubmenuPositionBasedOnMenuItemPosition(props.isSubmenuAboveMenuItem, props.submenuVerticalPosition), props.level === 2 && sublistStyles,
|
|
146
150
|
// prevent glitchy behavior during the initial render when the submenu's vertical position is evaluated as 0
|
|
147
|
-
props.submenuVerticalPosition === 0 && _ref2, (props.isSublistActiveWhileIsMenuExpanded || props.isSublistCollapsedAndActive || props.isSublistCollapsedAndActiveAndAbove) && /*#__PURE__*/react.css("opacity:
|
|
151
|
+
props.submenuVerticalPosition === 0 && _ref2, (props.isSublistActiveWhileIsMenuExpanded || props.isSublistCollapsedAndActive || props.isSublistCollapsedAndActiveAndAbove) && /*#__PURE__*/react.css("opacity:0;display:none;text-align:left;background-color:", designSystem.designTokens.colorAccent20, ";::before{content:'';position:absolute;display:block;width:calc(", oidc.NAVBAR.sublistWidth, " + ", designSystem.designTokens.spacing20, ");height:", oidc.NAVBAR.itemSize, ";left:calc(-1 * ", designSystem.designTokens.spacing20, ");", getContainerPositionBasedOnMenuItemPosition(props.isSubmenuAboveMenuItem, props.isSublistActiveWhileIsMenuExpanded, props.isSublistActiveWhileIsMenuCollapsed), ";}" + ("" ), "" )], " & .highlighted,& .highlighted ", Title, "{color:", designSystem.designTokens.colorSurface, "!important;font-weight:", designSystem.designTokens.fontWeight600, ";}" + ("" ));
|
|
148
152
|
const SublistItem = /*#__PURE__*/_styled__default["default"]("li", {
|
|
149
|
-
target: "
|
|
153
|
+
target: "e1i568cv2"
|
|
150
154
|
} )("display:flex;align-items:center;align-self:stretch;", props => [props.isActive && /*#__PURE__*/react.css("border-radius:", designSystem.designTokens.borderRadius4, ";background:", designSystem.designTokens.colorPrimary40, ";" + ("" ), "" ), !props.isActive && /*#__PURE__*/react.css(":hover,:focus-within{color:", designSystem.designTokens.colorSurface, ";font-weight:", designSystem.designTokens.fontWeight600, ";border-radius:", designSystem.designTokens.borderRadius4, ";background:", designSystem.designTokens.colorPrimary95, ";[data-link-level='text-link-sublist']{padding:", designSystem.designTokens.spacing25, " ", designSystem.designTokens.spacing25, " ", designSystem.designTokens.spacing25, " calc(\n ", designSystem.designTokens.spacing30, " + ", designSystem.designTokens.spacing20, "\n );}}" + ("" ), "" )], ";" + ("" ));
|
|
151
155
|
var _ref = {
|
|
152
156
|
name: "1azakc",
|
|
153
157
|
styles: "text-align:center"
|
|
154
158
|
} ;
|
|
155
159
|
const MenuListItem = /*#__PURE__*/_styled__default["default"]("li", {
|
|
160
|
+
target: "e1i568cv1"
|
|
161
|
+
} )("height:", oidc.NAVBAR.itemSize, ";width:", oidc.NAVBAR.itemSize, ";margin:0;background:", applicationComponents.designTokens.backgroundColorForNavbar, ";list-style:none;cursor:pointer;", IconWrapper, "{width:auto;display:flex;justify-content:center;}", props => [props.isRouteActive && /*#__PURE__*/react.css("background:", designSystem.designTokens.colorPrimary25, ";border-radius:", designSystem.designTokens.borderRadius8, ";" + ("" ), "" ), !props.isRouteActive && /*#__PURE__*/react.css(":hover,:focus-within{background-color:", designSystem.designTokens.colorPrimary20, ";border-radius:", designSystem.designTokens.borderRadius8, ";}" + ("" ), "" ), props.isActive && /*#__PURE__*/react.css(ItemIconText, "{justify-content:flex-start;}" + ("" ), "" ), !props.isActive && /*#__PURE__*/react.css(":hover ", Icon, ">svg *:not([fill='none']),:focus-within ", Icon, ">svg *:not([fill='none']){fill:", designSystem.designTokens.colorSurface, ";}:hover .", Title, ",:focus-within ", Title, "{color:", designSystem.designTokens.colorSurface, ";}" + ("" ), "" ), props.isCollapsed && _ref], " :hover ", Title, ",:focus-within ", Title, "{margin-left:calc(", designSystem.designTokens.spacing25, " + 2px);}:hover ", Icon, ",:focus-within ", Icon, "{transform:scale(1.2);}:hover ", MenuList, ".sublist-collapsed__active,:hover ", MenuList, ".sublist-collapsed__active__above,:hover ", MenuList, ".sublist-expanded__active,:focus-within ", MenuList, ".sublist-collapsed__active,:focus-within ", MenuList, ".sublist-collapsed__active__above,:focus-within ", MenuList, ".sublist-expanded__active{animation-name:", fadeIn, ";animation-duration:16ms;animation-delay:100ms;animation-fill-mode:forwards;display:flex;flex-direction:column;align-items:flex-start;background-color:", designSystem.designTokens.colorSurface, ";min-height:", oidc.NAVBAR.sublistItemMinHeight, ";width:", oidc.NAVBAR.sublistWidth, ";border-radius:", designSystem.designTokens.borderRadius8, ";z-index:20001;box-shadow:-2px 4px 25px 0 rgba(89, 89, 89, 0.5);}:hover ", MenuList, ".sublist-collapsed__active.sublist-collapsed__empty,:hover ", MenuList, ".sublist-collapsed__active__above.sublist-collapsed__empty,:focus-within ", MenuList, ".sublist-collapsed__active.sublist-collapsed__empty,:focus-within ", MenuList, ".sublist-collapsed__active__above.sublist-collapsed__empty{visibility:hidden;}:hover ", MenuList, ".sublist-expanded__active,:focus-within ", MenuList, ".sublist-expanded__active{left:", oidc.NAVBAR.sublistIndentationWhenExpanded, ";}" + ("" ));
|
|
162
|
+
const SafeArea = /*#__PURE__*/_styled__default["default"]("span", {
|
|
156
163
|
target: "e1i568cv0"
|
|
157
|
-
} )("
|
|
164
|
+
} )("position:absolute;top:0;bottom:0;right:100%;width:calc(100% - ", designSystem.designTokens.spacing30, ");clip-path:polygon(var(--safe-start), 100% 100%, 100% 0);" + ("" ));
|
|
158
165
|
|
|
159
166
|
const visible = react.keyframes`
|
|
160
167
|
from {
|
|
@@ -351,6 +358,7 @@ const MenuItem$1 = props => {
|
|
|
351
358
|
isActive: props.isActive,
|
|
352
359
|
isRouteActive: Boolean(props.isMainMenuRouteActive),
|
|
353
360
|
isCollapsed: !props.isMenuOpen,
|
|
361
|
+
onMouseMove: props.onMouseMove,
|
|
354
362
|
children: jsxRuntime.jsx(ItemContent, {
|
|
355
363
|
children: props.children
|
|
356
364
|
})
|
|
@@ -602,7 +610,11 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
602
610
|
var FetchProjectExtensionsNavbar = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProjectExtensionsNavbar" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "projectExtension" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "installedApplications" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "application" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "entryPointUriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "mainMenuLink" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "submenuLinks" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 537, source: { body: "query FetchProjectExtensionsNavbar {\n projectExtension {\n id\n installedApplications {\n application {\n id\n entryPointUriPath\n icon\n mainMenuLink {\n id\n permissions\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n }\n submenuLinks {\n id\n uriPath\n permissions\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
603
611
|
const getInitialState = isForcedMenuOpen => ({
|
|
604
612
|
isExpanderVisible: true,
|
|
605
|
-
isMenuOpen: isNil__default["default"](isForcedMenuOpen) ? false : isForcedMenuOpen
|
|
613
|
+
isMenuOpen: isNil__default["default"](isForcedMenuOpen) ? false : isForcedMenuOpen,
|
|
614
|
+
mousePosition: {
|
|
615
|
+
clientX: 0,
|
|
616
|
+
clientY: 0
|
|
617
|
+
}
|
|
606
618
|
});
|
|
607
619
|
const isForcedMenuOpenDefaultValue = false;
|
|
608
620
|
const reducer = (state, action) => {
|
|
@@ -628,10 +640,18 @@ const reducer = (state, action) => {
|
|
|
628
640
|
isExpanderVisible: true,
|
|
629
641
|
isMenuOpen: action.payload
|
|
630
642
|
});
|
|
643
|
+
case 'getMousePosition':
|
|
644
|
+
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
645
|
+
mousePosition: action.payload
|
|
646
|
+
});
|
|
631
647
|
case 'reset':
|
|
632
648
|
return {
|
|
633
649
|
isExpanderVisible: false,
|
|
634
|
-
isMenuOpen: false
|
|
650
|
+
isMenuOpen: false,
|
|
651
|
+
mousePosition: {
|
|
652
|
+
clientX: 0,
|
|
653
|
+
clientY: 0
|
|
654
|
+
}
|
|
635
655
|
};
|
|
636
656
|
default:
|
|
637
657
|
return state;
|
|
@@ -782,6 +802,17 @@ const useNavbarStateManager = props => {
|
|
|
782
802
|
payload: nextActiveItemIndex
|
|
783
803
|
});
|
|
784
804
|
}, [state.activeItemIndex]);
|
|
805
|
+
const getMousePosition = react$1.useCallback((e, itemIndex) => {
|
|
806
|
+
if (state.activeItemIndex === itemIndex) {
|
|
807
|
+
dispatch({
|
|
808
|
+
type: 'getMousePosition',
|
|
809
|
+
payload: {
|
|
810
|
+
clientX: e.clientX,
|
|
811
|
+
clientY: e.clientY
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
}, [state.activeItemIndex]);
|
|
785
816
|
const handleToggleMenu = react$1.useCallback(() => {
|
|
786
817
|
if (state.isMenuOpen && state.activeItemIndex) {
|
|
787
818
|
dispatch({
|
|
@@ -803,6 +834,7 @@ const useNavbarStateManager = props => {
|
|
|
803
834
|
handleToggleItem,
|
|
804
835
|
handleToggleMenu,
|
|
805
836
|
shouldCloseMenuFly,
|
|
837
|
+
getMousePosition,
|
|
806
838
|
allApplicationsNavbarMenuGroups
|
|
807
839
|
});
|
|
808
840
|
};
|
|
@@ -833,8 +865,48 @@ const ApplicationMenu = props => {
|
|
|
833
865
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
834
866
|
isSubmenuFocused = _useState6[0],
|
|
835
867
|
setIsSubmenuFocused = _useState6[1];
|
|
868
|
+
const _useState7 = react$1.useState(0),
|
|
869
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
870
|
+
percentageX = _useState8[0],
|
|
871
|
+
setPercentageX = _useState8[1];
|
|
872
|
+
const _useState9 = react$1.useState(0),
|
|
873
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
874
|
+
percentageY = _useState10[0],
|
|
875
|
+
setPercentageY = _useState10[1];
|
|
836
876
|
const observerRef = react$1.useRef(null);
|
|
837
877
|
const submenuRef = react$1.useRef(null);
|
|
878
|
+
const submenuSafeAreaRef = react$1.useRef(null);
|
|
879
|
+
|
|
880
|
+
/* Getting the width and height of the menu*/
|
|
881
|
+
const subRefBoundingClientRect = submenuRef.current?.getBoundingClientRect();
|
|
882
|
+
const _ref = subRefBoundingClientRect ?? {},
|
|
883
|
+
menuItemWidth = _ref.width,
|
|
884
|
+
menuItemHeight = _ref.height;
|
|
885
|
+
|
|
886
|
+
// /* We want to track the left, top, width, and height of the safe area */
|
|
887
|
+
const submenuSafeAreaRefBoundingClientRect = submenuSafeAreaRef.current?.getBoundingClientRect();
|
|
888
|
+
const safeAreaLeftPos = submenuSafeAreaRefBoundingClientRect?.left || 0;
|
|
889
|
+
const safeAreaTopPos = submenuSafeAreaRefBoundingClientRect?.top || 0;
|
|
890
|
+
const safeAreaWidth = submenuSafeAreaRefBoundingClientRect?.width || 0;
|
|
891
|
+
const safeAreaHeight = submenuSafeAreaRefBoundingClientRect?.height || 0;
|
|
892
|
+
const calculateSafeAreaStartPositon = react$1.useCallback(e => {
|
|
893
|
+
const localX = e.clientX - safeAreaLeftPos;
|
|
894
|
+
const localY = e.clientY - safeAreaTopPos;
|
|
895
|
+
setPercentageX(localX / safeAreaWidth * 100);
|
|
896
|
+
setPercentageY(localY / safeAreaHeight * 100);
|
|
897
|
+
}, [safeAreaHeight, safeAreaLeftPos, safeAreaTopPos, safeAreaWidth]);
|
|
898
|
+
react$1.useEffect(() => {
|
|
899
|
+
calculateSafeAreaStartPositon(e => e);
|
|
900
|
+
window.addEventListener('mousemove', calculateSafeAreaStartPositon);
|
|
901
|
+
return () => {
|
|
902
|
+
window.removeEventListener('mousemove', calculateSafeAreaStartPositon);
|
|
903
|
+
};
|
|
904
|
+
}, [calculateSafeAreaStartPositon, menuItemHeight, menuItemWidth, safeAreaHeight, safeAreaLeftPos, safeAreaTopPos, safeAreaWidth]);
|
|
905
|
+
react$1.useLayoutEffect(() => {
|
|
906
|
+
submenuRef.current?.style.setProperty('--safe-start',
|
|
907
|
+
// Adding the +1 to slightly keep the cursor inside the safe area while moving
|
|
908
|
+
`${percentageX}% ${percentageY + 1}%`);
|
|
909
|
+
}, [calculateSafeAreaStartPositon, percentageX, percentageY]);
|
|
838
910
|
const hasSubmenu = _Array$isArray__default["default"](props.menu.submenu) && props.menu.submenu.length > 0;
|
|
839
911
|
const menuItemIdentifier = snakeCase__default["default"](props.menu.key);
|
|
840
912
|
const callbackFn = react$1.useCallback(entries => {
|
|
@@ -843,7 +915,15 @@ const ApplicationMenu = props => {
|
|
|
843
915
|
const menuItemBottom = menuItemBoundingClientRect?.bottom || 0;
|
|
844
916
|
const _entries = _slicedToArray(entries, 1),
|
|
845
917
|
entry = _entries[0];
|
|
846
|
-
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Adding a 12 pixel buffer to the height calculation when determining if the submenu fits within the viewport below the menu item.
|
|
921
|
+
* This buffer accounts for the padding added during link hover, accommodating one additional line height.
|
|
922
|
+
* We need this to account for the additional card height when a hovered submenu text link wraps to the next line,
|
|
923
|
+
* as otherwise the submenu would extend beyond the viewport's bottom edge and flip above the menu item.
|
|
924
|
+
*/
|
|
925
|
+
const SINGLE_LINE_HEIGHT_BUFFER = 12;
|
|
926
|
+
const doesSubmenuFitWithinViewportBelowMenuItem = entry.boundingClientRect.height + (props.isMenuOpen ? menuItemTop : menuItemBottom) + SINGLE_LINE_HEIGHT_BUFFER > window.innerHeight;
|
|
847
927
|
// if the submenu does not fit at the bottom of the viewport (below the menu item)
|
|
848
928
|
if (doesSubmenuFitWithinViewportBelowMenuItem) {
|
|
849
929
|
setIsSubmenuAboveMenuItem(true);
|
|
@@ -912,6 +992,7 @@ const ApplicationMenu = props => {
|
|
|
912
992
|
onKeyDown: handleKeyDown,
|
|
913
993
|
onMouseEnter: props.handleToggleItem,
|
|
914
994
|
onMouseLeave: props.shouldCloseMenuFly,
|
|
995
|
+
onMouseMove: props.onMouseMove,
|
|
915
996
|
identifier: menuItemIdentifier,
|
|
916
997
|
children: [jsxRuntime.jsx(MenuItemLink, {
|
|
917
998
|
linkTo: `/${props.projectKey}/${props.menu.uriPath}`,
|
|
@@ -974,7 +1055,9 @@ const ApplicationMenu = props => {
|
|
|
974
1055
|
})
|
|
975
1056
|
})
|
|
976
1057
|
})
|
|
977
|
-
}, `${props.menu.key}-submenu-${submenu.key}`)) : null
|
|
1058
|
+
}, `${props.menu.key}-submenu-${submenu.key}`)) : null, jsxRuntime.jsx(SafeArea, {
|
|
1059
|
+
ref: submenuSafeAreaRef
|
|
1060
|
+
})]
|
|
978
1061
|
})]
|
|
979
1062
|
})
|
|
980
1063
|
}, props.menu.key);
|
|
@@ -990,10 +1073,12 @@ const NavBar = props => {
|
|
|
990
1073
|
isMenuOpen = _useNavbarStateManage.isMenuOpen,
|
|
991
1074
|
isExpanderVisible = _useNavbarStateManage.isExpanderVisible,
|
|
992
1075
|
activeItemIndex = _useNavbarStateManage.activeItemIndex,
|
|
1076
|
+
mousePosition = _useNavbarStateManage.mousePosition,
|
|
993
1077
|
handleToggleItem = _useNavbarStateManage.handleToggleItem,
|
|
994
1078
|
handleToggleMenu = _useNavbarStateManage.handleToggleMenu,
|
|
995
1079
|
shouldCloseMenuFly = _useNavbarStateManage.shouldCloseMenuFly,
|
|
996
|
-
allApplicationsNavbarMenuGroups = _useNavbarStateManage.allApplicationsNavbarMenuGroups
|
|
1080
|
+
allApplicationsNavbarMenuGroups = _useNavbarStateManage.allApplicationsNavbarMenuGroups,
|
|
1081
|
+
getMousePosition = _useNavbarStateManage.getMousePosition;
|
|
997
1082
|
const useFullRedirectsForLinks = Boolean(props.environment.useFullRedirectsForLinks);
|
|
998
1083
|
const location = reactRouterDom.useLocation();
|
|
999
1084
|
const projectPermissions = react$1.useMemo(() => ({
|
|
@@ -1049,7 +1134,9 @@ const NavBar = props => {
|
|
|
1049
1134
|
applicationLocale: applicationLocale,
|
|
1050
1135
|
projectKey: props.projectKey,
|
|
1051
1136
|
useFullRedirectsForLinks: useFullRedirectsForLinks,
|
|
1052
|
-
onMenuItemClick: props.onMenuItemClick
|
|
1137
|
+
onMenuItemClick: props.onMenuItemClick,
|
|
1138
|
+
onMouseMove: e => getMousePosition(e, itemIndex),
|
|
1139
|
+
mousePosition: mousePosition
|
|
1053
1140
|
}, menu.key);
|
|
1054
1141
|
})
|
|
1055
1142
|
}, navbarMenuGroup.key);
|