@commercetools-frontend/application-shell 22.31.0 → 22.32.0
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 +1 -1
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-application-shell.esm.js +1 -1
- package/dist/{custom-view-dev-host-9469b02c.cjs.prod.js → custom-view-dev-host-50d585ab.cjs.prod.js} +1 -1
- package/dist/{custom-view-dev-host-83d6228b.esm.js → custom-view-dev-host-8c058d60.esm.js} +1 -1
- package/dist/{custom-view-dev-host-1ef244b8.cjs.dev.js → custom-view-dev-host-d7d6a676.cjs.dev.js} +1 -1
- 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-9475648a.esm.js → index-30d34b7f.esm.js} +9 -9
- package/dist/{index-ff4b1f1e.cjs.prod.js → index-312ee159.cjs.prod.js} +9 -9
- package/dist/{index-bd1c5108.cjs.dev.js → index-89389085.cjs.dev.js} +9 -9
- package/dist/navbar-3b9c6b6b.esm.js +1394 -0
- package/dist/{navbar-32ad8010.cjs.prod.js → navbar-9da45ea7.cjs.prod.js} +93 -14
- package/dist/navbar-b18bb556.cjs.dev.js +1426 -0
- package/dist/{oidc-callback-365669c2.cjs.prod.js → oidc-callback-0e597d85.cjs.prod.js} +1 -1
- package/dist/{oidc-callback-a622f3a5.esm.js → oidc-callback-427bb1fe.esm.js} +1 -1
- package/dist/{oidc-callback-910e1e1c.cjs.dev.js → oidc-callback-cb22ccb9.cjs.dev.js} +1 -1
- package/dist/{project-container-4cc1a369.cjs.prod.js → project-container-8ea3157d.cjs.prod.js} +5 -5
- package/dist/{project-container-ba49f3db.cjs.dev.js → project-container-a3583d97.cjs.dev.js} +5 -5
- package/dist/{project-container-edb85c22.esm.js → project-container-e40ef9d5.esm.js} +5 -5
- package/dist/{project-expired-378bcfb0.cjs.dev.js → project-expired-5fcc5f07.cjs.dev.js} +2 -2
- package/dist/{project-expired-ef791516.esm.js → project-expired-d577ae18.esm.js} +2 -2
- package/dist/{project-expired-59d50031.cjs.prod.js → project-expired-dfccc21f.cjs.prod.js} +2 -2
- package/dist/{project-not-found-a7faf93c.cjs.prod.js → project-not-found-2278758f.cjs.prod.js} +2 -2
- package/dist/{project-not-found-543b8e4f.cjs.dev.js → project-not-found-4604d59d.cjs.dev.js} +2 -2
- package/dist/{project-not-found-bc7cea0c.esm.js → project-not-found-fd3a1f58.esm.js} +2 -2
- package/dist/{project-not-initialized-88376a4a.esm.js → project-not-initialized-b34c95c9.esm.js} +2 -2
- package/dist/{project-not-initialized-e9560ddb.cjs.prod.js → project-not-initialized-cb1d4d19.cjs.prod.js} +2 -2
- package/dist/{project-not-initialized-a9c3afa0.cjs.dev.js → project-not-initialized-d85c316d.cjs.dev.js} +2 -2
- package/dist/{project-suspended-8fa0b06e.esm.js → project-suspended-56e0ee3b.esm.js} +2 -2
- package/dist/{project-suspended-5cc4bc59.cjs.dev.js → project-suspended-5e490e56.cjs.dev.js} +2 -2
- package/dist/{project-suspended-0686fc53.cjs.prod.js → project-suspended-ec44d7fc.cjs.prod.js} +2 -2
- package/dist/{quick-access-3479fec8.cjs.dev.js → quick-access-809ff4ff.cjs.dev.js} +1 -1
- package/dist/{quick-access-72e35fc8.esm.js → quick-access-a19e4dc0.esm.js} +1 -1
- package/dist/{quick-access-96ea968d.cjs.prod.js → quick-access-cbb7a118.cjs.prod.js} +1 -1
- package/dist/{redirect-to-logout-d017b04b.cjs.prod.js → redirect-to-logout-1ffebbfe.cjs.prod.js} +1 -1
- package/dist/{redirect-to-logout-edf8d35c.cjs.dev.js → redirect-to-logout-371cc9b1.cjs.dev.js} +1 -1
- package/dist/{redirect-to-logout-4ee944fa.esm.js → redirect-to-logout-7b502bb5.esm.js} +1 -1
- package/dist/{requests-in-flight-loader-61257a90.cjs.prod.js → requests-in-flight-loader-49463178.cjs.prod.js} +1 -1
- package/dist/{requests-in-flight-loader-0a78e347.cjs.dev.js → requests-in-flight-loader-7d5f946c.cjs.dev.js} +1 -1
- package/dist/{requests-in-flight-loader-efda7302.esm.js → requests-in-flight-loader-e45b9001.esm.js} +1 -1
- package/dist/{service-page-project-switcher-ae1cd6fa.cjs.dev.js → service-page-project-switcher-679fa3be.cjs.dev.js} +1 -1
- package/dist/{service-page-project-switcher-fb693a35.esm.js → service-page-project-switcher-9bebaaa0.esm.js} +1 -1
- package/dist/{service-page-project-switcher-9310d282.cjs.prod.js → service-page-project-switcher-d3bc9ef6.cjs.prod.js} +1 -1
- package/dist/{version-tracker-935e29c6.esm.js → version-tracker-58df65c0.esm.js} +1 -1
- package/dist/{version-tracker-54afa816.cjs.dev.js → version-tracker-66d5d210.cjs.dev.js} +1 -1
- package/dist/{version-tracker-5aea360a.cjs.prod.js → version-tracker-a984dbbe.cjs.prod.js} +1 -1
- 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 => {
|
|
@@ -912,6 +984,7 @@ const ApplicationMenu = props => {
|
|
|
912
984
|
onKeyDown: handleKeyDown,
|
|
913
985
|
onMouseEnter: props.handleToggleItem,
|
|
914
986
|
onMouseLeave: props.shouldCloseMenuFly,
|
|
987
|
+
onMouseMove: props.onMouseMove,
|
|
915
988
|
identifier: menuItemIdentifier,
|
|
916
989
|
children: [jsxRuntime.jsx(MenuItemLink, {
|
|
917
990
|
linkTo: `/${props.projectKey}/${props.menu.uriPath}`,
|
|
@@ -974,7 +1047,9 @@ const ApplicationMenu = props => {
|
|
|
974
1047
|
})
|
|
975
1048
|
})
|
|
976
1049
|
})
|
|
977
|
-
}, `${props.menu.key}-submenu-${submenu.key}`)) : null
|
|
1050
|
+
}, `${props.menu.key}-submenu-${submenu.key}`)) : null, jsxRuntime.jsx(SafeArea, {
|
|
1051
|
+
ref: submenuSafeAreaRef
|
|
1052
|
+
})]
|
|
978
1053
|
})]
|
|
979
1054
|
})
|
|
980
1055
|
}, props.menu.key);
|
|
@@ -990,10 +1065,12 @@ const NavBar = props => {
|
|
|
990
1065
|
isMenuOpen = _useNavbarStateManage.isMenuOpen,
|
|
991
1066
|
isExpanderVisible = _useNavbarStateManage.isExpanderVisible,
|
|
992
1067
|
activeItemIndex = _useNavbarStateManage.activeItemIndex,
|
|
1068
|
+
mousePosition = _useNavbarStateManage.mousePosition,
|
|
993
1069
|
handleToggleItem = _useNavbarStateManage.handleToggleItem,
|
|
994
1070
|
handleToggleMenu = _useNavbarStateManage.handleToggleMenu,
|
|
995
1071
|
shouldCloseMenuFly = _useNavbarStateManage.shouldCloseMenuFly,
|
|
996
|
-
allApplicationsNavbarMenuGroups = _useNavbarStateManage.allApplicationsNavbarMenuGroups
|
|
1072
|
+
allApplicationsNavbarMenuGroups = _useNavbarStateManage.allApplicationsNavbarMenuGroups,
|
|
1073
|
+
getMousePosition = _useNavbarStateManage.getMousePosition;
|
|
997
1074
|
const useFullRedirectsForLinks = Boolean(props.environment.useFullRedirectsForLinks);
|
|
998
1075
|
const location = reactRouterDom.useLocation();
|
|
999
1076
|
const projectPermissions = react$1.useMemo(() => ({
|
|
@@ -1049,7 +1126,9 @@ const NavBar = props => {
|
|
|
1049
1126
|
applicationLocale: applicationLocale,
|
|
1050
1127
|
projectKey: props.projectKey,
|
|
1051
1128
|
useFullRedirectsForLinks: useFullRedirectsForLinks,
|
|
1052
|
-
onMenuItemClick: props.onMenuItemClick
|
|
1129
|
+
onMenuItemClick: props.onMenuItemClick,
|
|
1130
|
+
onMouseMove: e => getMousePosition(e, itemIndex),
|
|
1131
|
+
mousePosition: mousePosition
|
|
1053
1132
|
}, menu.key);
|
|
1054
1133
|
})
|
|
1055
1134
|
}, navbarMenuGroup.key);
|