@laerdal/life-react-components 2.2.1-dev.2.full → 2.2.1-dev.21
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/Accordion/AccordionItem.cjs +17 -8
- package/dist/Accordion/AccordionItem.cjs.map +1 -1
- package/dist/Accordion/AccordionItem.d.ts +0 -2
- package/dist/Accordion/AccordionItem.js +18 -9
- package/dist/Accordion/AccordionItem.js.map +1 -1
- package/dist/Accordion/AccordionMenu.cjs +2 -6
- package/dist/Accordion/AccordionMenu.cjs.map +1 -1
- package/dist/Accordion/AccordionMenu.d.ts +0 -3
- package/dist/Accordion/AccordionMenu.js +2 -6
- package/dist/Accordion/AccordionMenu.js.map +1 -1
- package/dist/Accordion/styles.cjs +11 -7
- package/dist/Accordion/styles.cjs.map +1 -1
- package/dist/Accordion/styles.d.ts +4 -1
- package/dist/Accordion/styles.js +9 -6
- package/dist/Accordion/styles.js.map +1 -1
- package/dist/AuthPage/AuthPage.js +1 -1
- package/dist/Banners/Banner.cjs.map +1 -1
- package/dist/Banners/Banner.js.map +1 -1
- package/dist/Button/Button.js +1 -1
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.d.ts +1 -1
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.cjs +9 -12
- package/dist/Card/HorizontalCard/HorizontalCard.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.d.ts +0 -2
- package/dist/Card/HorizontalCard/HorizontalCard.js +8 -9
- package/dist/Card/HorizontalCard/HorizontalCard.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardBody.cjs +9 -13
- package/dist/Card/HorizontalCard/HorizontalCardBody.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardBody.d.ts +0 -4
- package/dist/Card/HorizontalCard/HorizontalCardBody.js +8 -8
- package/dist/Card/HorizontalCard/HorizontalCardBody.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs +5 -7
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.d.ts +0 -2
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js +5 -5
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js.map +1 -1
- package/dist/Card/HorizontalCard/index.cjs +12 -33
- package/dist/Card/HorizontalCard/index.cjs.map +1 -1
- package/dist/Card/HorizontalCard/index.d.ts +1 -3
- package/dist/Card/HorizontalCard/index.js +1 -3
- package/dist/Card/HorizontalCard/index.js.map +1 -1
- package/dist/Card/HorizontalCard/types.cjs.map +1 -1
- package/dist/Card/HorizontalCard/types.d.ts +1 -1
- package/dist/Card/HorizontalCard/types.js.map +1 -1
- package/dist/Dropdown/BasicDropdown.cjs +16 -5
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.d.ts +1 -0
- package/dist/Dropdown/BasicDropdown.js +17 -6
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/CommonStyling.cjs +6 -3
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.d.ts +3 -1
- package/dist/Dropdown/CommonStyling.js +6 -3
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +1 -1
- package/dist/Dropdown/DropdownContent.js +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +10 -1
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js +10 -1
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs.map +1 -1
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.js.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +3 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js +4 -2
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
- package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
- package/dist/GlobalNavigationBar/Logo.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs +6 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.d.ts +4 -0
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js +5 -4
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs +147 -56
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +2 -2
- package/dist/GlobalNavigationBar/desktop/MainMenu.js +147 -56
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs +176 -0
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/SubMenu.d.ts +18 -0
- package/dist/GlobalNavigationBar/desktop/SubMenu.js +166 -0
- package/dist/GlobalNavigationBar/desktop/SubMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/types.cjs.map +1 -1
- package/dist/GlobalNavigationBar/types.d.ts +12 -2
- package/dist/GlobalNavigationBar/types.js.map +1 -1
- package/dist/GlobalNavigationBar/utils.cjs +17 -0
- package/dist/GlobalNavigationBar/utils.cjs.map +1 -0
- package/dist/GlobalNavigationBar/utils.d.ts +2 -0
- package/dist/GlobalNavigationBar/utils.js +10 -0
- package/dist/GlobalNavigationBar/utils.js.map +1 -0
- package/dist/Image/ImageWithFallbacks.js +1 -1
- package/dist/InputFields/DatepickerField.cjs +18 -6
- package/dist/InputFields/DatepickerField.cjs.map +1 -1
- package/dist/InputFields/DatepickerField.js +19 -7
- package/dist/InputFields/DatepickerField.js.map +1 -1
- package/dist/InputFields/DatepickerFieldHeader.cjs.map +1 -1
- package/dist/InputFields/DatepickerFieldHeader.js +1 -1
- package/dist/InputFields/DatepickerFieldHeader.js.map +1 -1
- package/dist/InputFields/NumberField.cjs +13 -4
- package/dist/InputFields/NumberField.cjs.map +1 -1
- package/dist/InputFields/NumberField.js +14 -5
- package/dist/InputFields/NumberField.js.map +1 -1
- package/dist/InputFields/PasswordField.js +1 -1
- package/dist/InputFields/SearchBar.js +1 -1
- package/dist/InputFields/TextField.cjs +10 -1
- package/dist/InputFields/TextField.cjs.map +1 -1
- package/dist/InputFields/TextField.js +11 -2
- package/dist/InputFields/TextField.js.map +1 -1
- package/dist/InputFields/styling.cjs +7 -3
- package/dist/InputFields/styling.cjs.map +1 -1
- package/dist/InputFields/styling.d.ts +1 -0
- package/dist/InputFields/styling.js +7 -3
- package/dist/InputFields/styling.js.map +1 -1
- package/dist/LinearProgress/LinearProgress.js +1 -1
- package/dist/NavItem/NavItem.cjs +2 -1
- package/dist/NavItem/NavItem.cjs.map +1 -1
- package/dist/NavItem/NavItem.d.ts +1 -0
- package/dist/NavItem/NavItem.js +1 -1
- package/dist/NavItem/NavItem.js.map +1 -1
- package/dist/NavItem/NestedNavItem.cjs +38 -0
- package/dist/NavItem/NestedNavItem.cjs.map +1 -0
- package/dist/NavItem/NestedNavItem.d.ts +13 -0
- package/dist/NavItem/NestedNavItem.js +28 -0
- package/dist/NavItem/NestedNavItem.js.map +1 -0
- package/dist/Paginator/Paginator.cjs.map +1 -1
- package/dist/Paginator/Paginator.js.map +1 -1
- package/dist/Table/Table.cjs +1 -1
- package/dist/Table/Table.js +1 -1
- package/dist/Table/TableFooter.cjs.map +1 -1
- package/dist/Table/TableFooter.js +1 -1
- package/dist/Table/TableFooter.js.map +1 -1
- package/dist/Tabs/TabLink.cjs +39 -14
- package/dist/Tabs/TabLink.cjs.map +1 -1
- package/dist/Tabs/TabLink.d.ts +6 -1
- package/dist/Tabs/TabLink.js +39 -14
- package/dist/Tabs/TabLink.js.map +1 -1
- package/dist/Tabs/VerticalTabs.cjs +2 -0
- package/dist/Tabs/VerticalTabs.cjs.map +1 -1
- package/dist/Tabs/VerticalTabs.d.ts +1 -0
- package/dist/Tabs/VerticalTabs.js +2 -0
- package/dist/Tabs/VerticalTabs.js.map +1 -1
- package/dist/Tooltips/TooltipOverflow.cjs +112 -0
- package/dist/Tooltips/TooltipOverflow.cjs.map +1 -0
- package/dist/Tooltips/TooltipOverflow.d.ts +10 -0
- package/dist/Tooltips/TooltipOverflow.js +102 -0
- package/dist/Tooltips/TooltipOverflow.js.map +1 -0
- package/dist/Tooltips/TooltipStyles.cjs +8 -5
- package/dist/Tooltips/TooltipStyles.cjs.map +1 -1
- package/dist/Tooltips/TooltipStyles.d.ts +3 -1
- package/dist/Tooltips/TooltipStyles.js +8 -5
- package/dist/Tooltips/TooltipStyles.js.map +1 -1
- package/dist/Tooltips/TooltipWrapper.cjs +2 -1
- package/dist/Tooltips/TooltipWrapper.cjs.map +1 -1
- package/dist/Tooltips/TooltipWrapper.js +2 -1
- package/dist/Tooltips/TooltipWrapper.js.map +1 -1
- package/dist/assets/index.cjs.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/common/ActionWithin.cjs +1 -1
- package/dist/common/ActionWithin.js +1 -1
- package/dist/common/FocusVisible.cjs +1 -1
- package/dist/common/FocusVisible.js +1 -1
- package/dist/icons/index.cjs +1 -1
- package/dist/icons/index.cjs.map +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/icons/systemicons/SystemIcons.cjs.map +1 -1
- package/dist/icons/systemicons/SystemIcons.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
+
import _pt from "prop-types";
|
|
5
|
+
var _templateObject;
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { Menu, MenuSection, MenuSectionList } from './ExtendedMainMenu';
|
|
9
|
+
import { Size } from '../../types';
|
|
10
|
+
import { SystemIcons } from '../../icons';
|
|
11
|
+
import { checkIfContainsItem } from '../utils';
|
|
12
|
+
import Tabs from '../../Tabs/Tabs';
|
|
13
|
+
import TabLink from '../../Tabs/TabLink';
|
|
14
|
+
import { MenuItem } from '../../MenuItem';
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
export var SubMenuWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " {\n top: ", ";\n left: ", ";\n }\n\n ", "\n\n button {\n padding-left: 0px;\n }\n"])), Menu, function (props) {
|
|
19
|
+
return props.topLevel ? '100%' : '0px';
|
|
20
|
+
}, function (props) {
|
|
21
|
+
return props.topLevel ? '0px' : 'calc(100% - 12px)';
|
|
22
|
+
}, function (props) {
|
|
23
|
+
return !props.visible ? 'display: none;' : '';
|
|
24
|
+
});
|
|
25
|
+
export var SubMenu = function SubMenu(_ref) {
|
|
26
|
+
var item = _ref.item,
|
|
27
|
+
index = _ref.index,
|
|
28
|
+
topLevel = _ref.topLevel,
|
|
29
|
+
dropdownMenusOpenedArray = _ref.dropdownMenusOpenedArray,
|
|
30
|
+
onSubMenuHidden = _ref.onSubMenuHidden,
|
|
31
|
+
onSubMenuOpened = _ref.onSubMenuOpened,
|
|
32
|
+
onItemStateChanged = _ref.onItemStateChanged,
|
|
33
|
+
activeItemId = _ref.activeItemId,
|
|
34
|
+
nestPath = _ref.nestPath;
|
|
35
|
+
var _React$useState = React.useState({}),
|
|
36
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
|
+
forceUpdate = _React$useState2[1];
|
|
38
|
+
var existingRef = dropdownMenusOpenedArray.current.find(function (x) {
|
|
39
|
+
return x == item.id;
|
|
40
|
+
});
|
|
41
|
+
var _onMouseLeave = function onMouseLeave(event, id) {
|
|
42
|
+
dropdownMenusOpenedArray.current = _toConsumableArray(dropdownMenusOpenedArray.current.filter(function (x) {
|
|
43
|
+
return x != id;
|
|
44
|
+
}));
|
|
45
|
+
//just trigger rerendering
|
|
46
|
+
onSubMenuHidden && onSubMenuHidden(id);
|
|
47
|
+
forceUpdate({});
|
|
48
|
+
};
|
|
49
|
+
var containActiveItem = false;
|
|
50
|
+
if (item.type == 'desktopgroup' && activeItemId) containActiveItem = checkIfContainsItem(item, activeItemId);
|
|
51
|
+
var _onMouseEnter = function onMouseEnter(event, id) {
|
|
52
|
+
var existingRefForId = dropdownMenusOpenedArray.current.find(function (x) {
|
|
53
|
+
return x == id;
|
|
54
|
+
});
|
|
55
|
+
if (existingRefForId == null) {
|
|
56
|
+
dropdownMenusOpenedArray.current = [].concat(_toConsumableArray(dropdownMenusOpenedArray.current), [id]);
|
|
57
|
+
//just trigger rerendering
|
|
58
|
+
onSubMenuOpened && onSubMenuOpened(id);
|
|
59
|
+
forceUpdate({});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var _onKeyDown = function onKeyDown(event, entryId) {
|
|
63
|
+
if (event.key == 'Enter' || event.code == 'Space') {
|
|
64
|
+
dropdownMenusOpenedArray.current = [].concat(_toConsumableArray(dropdownMenusOpenedArray.current), [entryId]);
|
|
65
|
+
//just trigger rerendering
|
|
66
|
+
forceUpdate({});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var onFocus = function onFocus(event) {
|
|
70
|
+
dropdownMenusOpenedArray.current = _toConsumableArray(nestPath !== null && nestPath !== void 0 ? nestPath : []);
|
|
71
|
+
forceUpdate({});
|
|
72
|
+
};
|
|
73
|
+
return /*#__PURE__*/_jsx(SubMenuWrapper, {
|
|
74
|
+
id: item.id,
|
|
75
|
+
className: existingRef ? 'open' : '',
|
|
76
|
+
topLevel: topLevel,
|
|
77
|
+
visible: Boolean(existingRef),
|
|
78
|
+
children: /*#__PURE__*/_jsx(Menu, {
|
|
79
|
+
role: "menu",
|
|
80
|
+
"aria-labelledby": "UserMenuButton",
|
|
81
|
+
children: /*#__PURE__*/_jsx(MenuSection, {
|
|
82
|
+
children: /*#__PURE__*/_jsx(MenuSectionList, {
|
|
83
|
+
children: /*#__PURE__*/_jsx(Tabs, {
|
|
84
|
+
size: Size.Medium,
|
|
85
|
+
children: item.items.map(function (entry) {
|
|
86
|
+
var _entry$label2;
|
|
87
|
+
var isGroup = entry.type == 'desktopgroup';
|
|
88
|
+
var key = isGroup ? entry.id : entry.type == 'item' ? entry.to : '';
|
|
89
|
+
var SubItemOpened = Boolean(dropdownMenusOpenedArray.current.find(function (x) {
|
|
90
|
+
return x == entry.id;
|
|
91
|
+
}));
|
|
92
|
+
if (isGroup) {
|
|
93
|
+
var _entry$label;
|
|
94
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
95
|
+
style: {
|
|
96
|
+
position: 'relative'
|
|
97
|
+
},
|
|
98
|
+
onMouseEnter: function onMouseEnter(event) {
|
|
99
|
+
return _onMouseEnter(event, entry.id);
|
|
100
|
+
},
|
|
101
|
+
onMouseLeave: function onMouseLeave(event) {
|
|
102
|
+
return _onMouseLeave(event, entry.id);
|
|
103
|
+
},
|
|
104
|
+
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
105
|
+
tabIndex: 0,
|
|
106
|
+
onFocus: onFocus,
|
|
107
|
+
onKeyDown: function onKeyDown(event) {
|
|
108
|
+
return _onKeyDown(event, entry.id);
|
|
109
|
+
},
|
|
110
|
+
id: entry.id,
|
|
111
|
+
item: {
|
|
112
|
+
value: (_entry$label = entry.label) !== null && _entry$label !== void 0 ? _entry$label : ''
|
|
113
|
+
},
|
|
114
|
+
iconRight: /*#__PURE__*/_jsx(SystemIcons.ArrowDropRight, {
|
|
115
|
+
size: "24px"
|
|
116
|
+
}),
|
|
117
|
+
active: SubItemOpened || Boolean(activeItemId) && activeItemId != '' && checkIfContainsItem(entry, activeItemId),
|
|
118
|
+
onClickHandler: function onClickHandler() {}
|
|
119
|
+
}), /*#__PURE__*/_jsx(SubMenu, {
|
|
120
|
+
nestPath: [].concat(_toConsumableArray(nestPath !== null && nestPath !== void 0 ? nestPath : []), [entry.id]),
|
|
121
|
+
onItemStateChanged: onItemStateChanged,
|
|
122
|
+
activeItemId: activeItemId,
|
|
123
|
+
dropdownMenusOpenedArray: dropdownMenusOpenedArray,
|
|
124
|
+
item: entry,
|
|
125
|
+
index: index + 1,
|
|
126
|
+
topLevel: false
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
131
|
+
children: /*#__PURE__*/_jsx(TabLink, {
|
|
132
|
+
to: isGroup ? '' : key,
|
|
133
|
+
onFocus: onFocus,
|
|
134
|
+
onActiveStateChanged: function onActiveStateChanged(state) {
|
|
135
|
+
return onItemStateChanged && entry.type == 'item' && onItemStateChanged(entry.to, state);
|
|
136
|
+
},
|
|
137
|
+
forceDeactivate: isGroup,
|
|
138
|
+
requiredLine: (_entry$label2 = entry.label) !== null && _entry$label2 !== void 0 ? _entry$label2 : '',
|
|
139
|
+
optionalLine: '',
|
|
140
|
+
endLineIcon: isGroup ? /*#__PURE__*/_jsx(SystemIcons.ArrowDropRight, {
|
|
141
|
+
size: "24px"
|
|
142
|
+
}) : null,
|
|
143
|
+
OptionalLineIcon: '',
|
|
144
|
+
disabled: entry.disabled,
|
|
145
|
+
showNotificationDot: false,
|
|
146
|
+
size: Size.Medium,
|
|
147
|
+
variant: "positive"
|
|
148
|
+
}, key)
|
|
149
|
+
});
|
|
150
|
+
})
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
SubMenu.propTypes = {
|
|
158
|
+
index: _pt.number.isRequired,
|
|
159
|
+
topLevel: _pt.bool.isRequired,
|
|
160
|
+
onSubMenuOpened: _pt.func,
|
|
161
|
+
onSubMenuHidden: _pt.func,
|
|
162
|
+
onItemStateChanged: _pt.func,
|
|
163
|
+
activeItemId: _pt.string,
|
|
164
|
+
nestPath: _pt.arrayOf(_pt.string)
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=SubMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubMenu.js","names":["React","styled","Menu","MenuSection","MenuSectionList","Size","SystemIcons","checkIfContainsItem","Tabs","TabLink","MenuItem","SubMenuWrapper","div","props","topLevel","visible","SubMenu","item","index","dropdownMenusOpenedArray","onSubMenuHidden","onSubMenuOpened","onItemStateChanged","activeItemId","nestPath","useState","forceUpdate","existingRef","current","find","x","id","onMouseLeave","event","filter","containActiveItem","type","onMouseEnter","existingRefForId","onKeyDown","entryId","key","code","onFocus","Boolean","Medium","items","map","entry","isGroup","to","SubItemOpened","position","value","label","state","disabled"],"sources":["../../../src/GlobalNavigationBar/desktop/SubMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { NavLink, useLocation } from 'react-router-dom';\nimport styled from 'styled-components';\n\nimport { NavItem } from '../../NavItem';\nimport { MoreHorizontal } from '../../icons/systemicons/SystemIcons';\nimport { COLORS, BREAKPOINTS } from '../../styles';\nimport ExtendedMainMenu, { Menu, MenuSection, MenuSectionList } from './ExtendedMainMenu';\nimport { IconButton } from '../../Button';\nimport { defaultOnMouseDownHandler } from '../../common';\nimport { MenuNavigationItemTypeDesktopGroup, MenuNavigationItemTypeItem } from '../types';\nimport { DropdownContent } from '../../Dropdown';\nimport { VerticalTabEntry, VerticalTabs } from '../../Tabs';\nimport { Size } from '../../types';\nimport { SystemIcons } from '../../icons';\nimport { checkIfContainsItem } from '../utils';\nimport Tabs from '../../Tabs/Tabs';\nimport TabLink from '../../Tabs/TabLink';\nimport { MenuItem } from '../../MenuItem';\nimport { NavItemDiv } from '../../NavItem/NavItem';\n\nexport type SubMenuProps = {\n item: MenuNavigationItemTypeDesktopGroup;\n index: number;\n topLevel: boolean;\n dropdownMenusOpenedArray: React.MutableRefObject<string[]>;\n onSubMenuOpened?: (item: string) => void;\n onSubMenuHidden?: (item: string) => void;\n onItemStateChanged?: (item: string, state: boolean) => void;\n activeItemId?: string;\n nestPath?: string[];\n};\n\nexport const SubMenuWrapper = styled.div<{ topLevel: boolean, visible: boolean }>`\n ${Menu} {\n top: ${(props) => (props.topLevel ? '100%' : '0px')};\n left: ${(props) => (props.topLevel ? '0px' : 'calc(100% - 12px)')};\n }\n\n ${props => !props.visible ? 'display: none;' : ''}\n\n button {\n padding-left: 0px;\n }\n`;\n\nexport const SubMenu = ({ item, index, topLevel, dropdownMenusOpenedArray, onSubMenuHidden, onSubMenuOpened, onItemStateChanged, activeItemId, nestPath }: SubMenuProps): React.ReactElement<SubMenuProps> => {\n const [, forceUpdate] = React.useState({});\n\n const existingRef = dropdownMenusOpenedArray.current.find((x) => x == item.id);\n const onMouseLeave = (event: any, id: string) => {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current.filter((x) => x != id)];\n //just trigger rerendering\n onSubMenuHidden && onSubMenuHidden(id);\n forceUpdate({});\n };\n let containActiveItem = false;\n if(item.type == 'desktopgroup' && activeItemId)\n containActiveItem = checkIfContainsItem(item, activeItemId);\n\n const onMouseEnter = (event: any, id: string) => {\n const existingRefForId = dropdownMenusOpenedArray.current.find((x) => x == id);\n if (existingRefForId == null) {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current, id];\n //just trigger rerendering\n onSubMenuOpened && onSubMenuOpened(id);\n forceUpdate({});\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, entryId: string) => {\n if(event.key == 'Enter' || event.code == 'Space')\n {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current, entryId];\n //just trigger rerendering\n forceUpdate({});\n }\n };\n\n const onFocus = (event: React.FocusEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n dropdownMenusOpenedArray.current = [...(nestPath ?? [])];\n forceUpdate({});\n }\n\n return <SubMenuWrapper id={item.id} className={existingRef ? 'open' : ''} topLevel={topLevel} visible={Boolean(existingRef)}>\n <Menu role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MenuSection>\n <MenuSectionList>\n <Tabs size={Size.Medium}>\n {item.items.map((entry) => {\n const isGroup = entry.type == 'desktopgroup';\n const key = isGroup ? entry.id : entry.type == 'item' ? entry.to : '';\n const SubItemOpened = Boolean(dropdownMenusOpenedArray.current.find((x) => x == entry.id));\n if (isGroup) {\n return (\n <div style={{ position: 'relative' }} onMouseEnter={(event) => onMouseEnter(event, entry.id)} onMouseLeave={(event) => onMouseLeave(event, entry.id)}>\n <MenuItem\n tabIndex={0}\n onFocus={onFocus}\n onKeyDown={(event) => onKeyDown(event, entry.id)}\n id={entry.id}\n item={{\n value: entry.label ?? '',\n }}\n iconRight={<SystemIcons.ArrowDropRight size=\"24px\" />}\n active={SubItemOpened || (Boolean(activeItemId) && activeItemId != '' && checkIfContainsItem(entry, activeItemId!))}\n onClickHandler={() => {}}\n />\n <SubMenu nestPath={[...(nestPath ?? []), entry.id]} onItemStateChanged={onItemStateChanged} activeItemId={activeItemId} dropdownMenusOpenedArray={dropdownMenusOpenedArray} item={entry as MenuNavigationItemTypeDesktopGroup} index={index + 1} topLevel={false} />\n </div>\n );\n }\n return (\n <>\n <TabLink\n key={key}\n to={isGroup ? '' : key}\n onFocus={onFocus}\n onActiveStateChanged={(state) => onItemStateChanged && entry.type == 'item' && onItemStateChanged(entry.to, state)}\n forceDeactivate={isGroup}\n requiredLine={entry.label ?? ''}\n optionalLine={''}\n endLineIcon={isGroup ? <SystemIcons.ArrowDropRight size=\"24px\" /> : null}\n OptionalLineIcon={''}\n disabled={entry.disabled}\n showNotificationDot={false}\n size={Size.Medium}\n variant=\"positive\"\n />\n </>\n );\n })}\n </Tabs>\n </MenuSectionList>\n </MenuSection>\n </Menu>\n </SubMenuWrapper>;\n};\n"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,MAAM,MAAM,mBAAmB;AAKtC,SAA2BC,IAAI,EAAEC,WAAW,EAAEC,eAAe,QAAQ,oBAAoB;AAMzF,SAASC,IAAI,QAAQ,aAAa;AAClC,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,OAAO,MAAM,oBAAoB;AACxC,SAASC,QAAQ,QAAQ,gBAAgB;AAAC;AAAA;AAAA;AAe1C,OAAO,IAAMC,cAAc,GAAGV,MAAM,CAACW,GAAG,6KACpCV,IAAI,EACG,UAACW,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAG,MAAM,GAAG,KAAK;AAAA,CAAC,EAC3C,UAACD,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAG,KAAK,GAAG,mBAAmB;AAAA,CAAC,EAGjE,UAAAD,KAAK;EAAA,OAAI,CAACA,KAAK,CAACE,OAAO,GAAG,gBAAgB,GAAG,EAAE;AAAA,EAKlD;AAED,OAAO,IAAMC,OAAO,GAAG,SAAVA,OAAO,OAA0L;EAAA,IAApLC,IAAI,QAAJA,IAAI;IAAEC,KAAK,QAALA,KAAK;IAAEJ,QAAQ,QAARA,QAAQ;IAAEK,wBAAwB,QAAxBA,wBAAwB;IAAEC,eAAe,QAAfA,eAAe;IAAEC,eAAe,QAAfA,eAAe;IAAEC,kBAAkB,QAAlBA,kBAAkB;IAAEC,YAAY,QAAZA,YAAY;IAAEC,QA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+B,OAAO,GAAG,EAAE,GAAGR,GAAI;kBACvB,OAAO,EAAEE,OAAQ;kBACjB,oBAAoB,EAAE,8BAACY,KAAK;oBAAA,OAAKjC,kBAAkB,IAAI0B,KAAK,CAACZ,IAAI,IAAI,MAAM,IAAId,kBAAkB,CAAC0B,KAAK,CAACE,EAAE,EAAEK,KAAK,CAAC;kBAAA,CAAC;kBACnH,eAAe,EAAEN,OAAQ;kBACzB,YAAY,mBAAED,KAAK,CAACM,KAAK,yDAAI,EAAG;kBAChC,YAAY,EAAE,EAAG;kBACjB,WAAW,EAAEL,OAAO,gBAAG,KAAC,WAAW,CAAC,cAAc;oBAAC,IAAI,EAAC;kBAAM,EAAG,GAAG,IAAK;kBACzE,gBAAgB,EAAE,EAAG;kBACrB,QAAQ,EAAED,KAAK,CAACQ,QAAS;kBACzB,mBAAmB,EAAE,KAAM;kBAC3B,IAAI,EAAEnD,IAAI,CAACwC,MAAO;kBAClB,OAAO,EAAC;gBAAU,GAZbJ,GAAG;cAaR,EACD;YAEP,CAAC;UAAC;QACG;MACS;IACN;EACT,EACQ;AACrB,CAAC;AAAC;EAlHAvB,KAAK;EACLJ,QAAQ;EAERO,eAAe;EACfD,eAAe;EACfE,kBAAkB;EAClBC,YAAY;EACZC,QAAQ;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileMenu.cjs","names":["Wrapper","styled","div","Z_INDEXES","off_canvas","BREAKPOINTS","SMALL","SwitcherLabel","MobileFooter","COLORS","neutral_200","ComponentXSStyling","ComponentTextStyle","Bold","neutral_600","ComponentSStyling","CustomContent","MobileMenu","show","profile","buttons","label","header","items","footer","action","onClose","useStackState","reset","length","push","pop","peek","isMediumScreen","useMediaMatch","LARGE","replace","location","useLocation","onSubMenuOpen","menu","type","content","customContent","custom","React","useEffect","setTimeout","current","switcher","find","a","undefined"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling, Z_INDEXES} from '../../styles';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {useLocation} from 'react-router-dom';\nimport {IconButton} from '../../Button';\nimport {LaerdalLogo} from '../../assets';\nimport {\n MenuAccountInfo,\n MenuButton,\n MenuNavigationItemTypeGroup,\n MenuGroupFooter,\n MenuGroupHeader,\n MenuIconButton,\n MenuNavigationItemTypeItem,\n MobileNavigationMenuProps,\n ProfileMenu,\n MenuNavigationItemTypeSection,\n MobileMenuButtonTypes,\n MenuSwitcherButton,\n MenuNavigationCustomSubMenu\n} from '../types';\nimport MobileMenuHeader from './MobileMenuHeader';\nimport MobileMenuContent from './MobileMenuContent';\nimport {useStackState} from '../../common/StackState';\nimport {useMediaMatch} from \"rooks\";\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\nconst SwitcherLabel = styled.div`\n margin-left: auto;\n`;\n\nconst MobileFooter = styled.div`\n display: flex;\n align-items: center;\n box-sizing: border-box;\n height: 48px;\n\n padding: 0 4px 0 16px;\n border-top: 1px solid ${COLORS.neutral_200};\n\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n padding: 4px 8px 4px 16px;\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst CustomContent = styled.div`\n width: 100%;\n box-sizing: border-box;\n flex-flow: column;\n display: flex;\n flex: 1;\n overflow: hidden;\n`;\n\ntype Props = MobileNavigationMenuProps & {\n profile?: ProfileMenu;\n show?: boolean;\n onClose: () => void;\n};\n\ninterface MenuState {\n header: {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n }\n content?: {\n header?: MenuGroupHeader;\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection)[];\n footer?: MenuGroupFooter;\n action?: MenuButton;\n },\n customContent?: () => React.ReactNode;\n footer?: boolean;\n}\n\nconst MobileMenu = ({\n show,\n profile,\n buttons,\n label,\n header,\n items,\n footer,\n action,\n onClose,\n }: Props) => {\n\n const {reset, length, push, pop, peek} = useStackState<MenuState>();\n\n const isMediumScreen = useMediaMatch(BREAKPOINTS.LARGE.replace('@media ', ''));\n\n const location = useLocation();\n\n const onSubMenuOpen = (menu?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => {\n\n switch (menu?.type) {\n case 'group':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n content: {\n header: menu.header,\n items: menu.items,\n footer: menu.footer,\n action: menu.action\n },\n footer: false\n });\n break;\n case 'custom':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n customContent: menu.custom,\n footer: false\n });\n break;\n default:\n break;\n }\n\n };\n\n React.useEffect(() => {\n onClose();\n }, [location]);\n\n React.useEffect(() => {\n isMediumScreen && onClose()\n }, [isMediumScreen]);\n\n React.useEffect(() => {\n setTimeout(() => {\n reset({\n footer: true,\n header: {\n label: label,\n buttons: buttons,\n },\n content: {\n header: header,\n items: items,\n footer: footer,\n action: action\n }\n })\n }, 300)\n }, [show])\n\n\n const current = peek();\n\n const switcher = current?.header?.buttons?.find(a => a.type === 'switcher') as MenuSwitcherButton;\n\n return (\n <Wrapper>\n <MobileMenuHeader buttons={current?.header.buttons}\n onGoBack={length > 1 ? pop : undefined}\n onSubMenuOpen={onSubMenuOpen}\n profile={profile}\n label={current?.header.label}\n onClose={onClose}/>\n {current?.customContent && <CustomContent>{current?.customContent()}</CustomContent>}\n {current?.content && <MobileMenuContent header={current?.content.header}\n items={current?.content.items}\n footer={current?.content.footer}\n action={current?.content.action}\n onSubMenuOpen={onSubMenuOpen}/>}\n\n {\n current?.footer &&\n <MobileFooter>\n <LaerdalLogo height={'36px'} width={'66px'}/>\n {switcher &&\n <>\n <SwitcherLabel className={'globalNav-toggler'} onClick={() => switcher.action && switcher.action() && onClose()}>Switch site</SwitcherLabel>\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n id=\"globalNavAppsButton\"\n action={() => switcher.action && switcher.action() && onClose()}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n </>\n }\n\n </MobileFooter>\n }\n </Wrapper>\n );\n};\n\nexport default MobileMenu;\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AAAoC;AAAA;AAAA;AAAA;AAEpC,IAAMA,OAAO,GAAGC,yBAAM,CAACC,GAAG,qQAEbC,iBAAS,CAACC,UAAU,EAQ7BC,mBAAW,CAACC,KAAK,CAGpB;AAED,IAAMC,aAAa,GAAGN,yBAAM,CAACC,GAAG,6GAE/B;AAED,IAAMM,YAAY,GAAGP,yBAAM,CAACC,GAAG,+TAOLO,cAAM,CAACC,WAAW,EAExC,IAAAC,0BAAkB,EAACC,0BAAkB,CAACC,IAAI,EAAEJ,cAAM,CAACK,WAAW,CAAC,EAC/DT,mBAAW,CAACC,KAAK,EAGf,IAAAS,yBAAiB,EAACH,0BAAkB,CAACC,IAAI,EAAEJ,cAAM,CAACK,WAAW,CAAC,CAEnE;AAED,IAAME,aAAa,GAAGf,yBAAM,CAACC,GAAG,2MAO/B;AAuBD,IAAMe,UAAU,GAAG,SAAbA,UAAU,OAUiB;EAAA;EAAA,IATXC,IAAI,QAAJA,IAAI;IACJC,OAAO,QAAPA,OAAO;IACPC,OAAO,QAAPA,OAAO;IACPC,KAAK,QAALA,KAAK;IACLC,MAAM,QAANA,MAAM;IACNC,KAAK,QAALA,KAAK;IACLC,MAAM,QAANA,MAAM;IACNC,MAAM,QAANA,MAAM;IACNC,OAAO,QAAPA,OAAO;EAG3B,qBAAyC,IAAAC,yBAAa,GAAa;IAA5DC,KAAK,kBAALA,K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el","MobileFooter","COLORS","neutral_200","ComponentXSStyling","ComponentTextStyle","Bold","neutral_600","ComponentSStyling","CustomContent","MobileMenu","show","profile","buttons","label","header","items","footer","action","onClose","useStackState","reset","length","push","pop","peek","isMediumScreen","useMediaMatch","LARGE","replace","location","useLocation","onSubMenuOpen","menu","type","content","customContent","custom","React","useEffect","setTimeout","current","switcher","find","a","undefined"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling, Z_INDEXES} from '../../styles';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {useLocation} from 'react-router-dom';\nimport {IconButton} from '../../Button';\nimport {LaerdalLogo} from '../../assets';\nimport {\n MenuAccountInfo,\n MenuButton,\n MenuNavigationItemTypeGroup,\n MenuGroupFooter,\n MenuGroupHeader,\n MenuIconButton,\n MenuNavigationItemTypeItem,\n MobileNavigationMenuProps,\n ProfileMenu,\n MenuNavigationItemTypeSection,\n MobileMenuButtonTypes,\n MenuSwitcherButton,\n MenuNavigationCustomSubMenu\n} from '../types';\nimport MobileMenuHeader from './MobileMenuHeader';\nimport MobileMenuContent from './MobileMenuContent';\nimport {useStackState} from '../../common/StackState';\nimport {useMediaMatch} from \"rooks\";\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\nconst SwitcherLabel = styled.div`\n margin-left: auto;\n`;\n\nconst MobileFooter = styled.div`\n display: flex;\n align-items: center;\n box-sizing: border-box;\n height: 48px;\n\n padding: 0 4px 0 16px;\n border-top: 1px solid ${COLORS.neutral_200};\n\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n padding: 4px 8px 4px 16px;\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst CustomContent = styled.div`\n width: 100%;\n box-sizing: border-box;\n flex-flow: column;\n display: flex;\n flex: 1;\n overflow: hidden;\n`;\n\ntype Props = MobileNavigationMenuProps & {\n profile?: ProfileMenu;\n show?: boolean;\n onClose: () => void;\n};\n\ninterface MenuState {\n header: {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n }\n content?: {\n header?: MenuGroupHeader;\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection)[];\n footer?: MenuGroupFooter;\n action?: MenuButton;\n },\n customContent?: () => React.ReactNode;\n footer?: boolean;\n}\n\nconst MobileMenu = ({\n show,\n profile,\n buttons,\n label,\n header,\n items,\n footer,\n action,\n onClose,\n }: Props) => {\n\n const {reset, length, push, pop, peek} = useStackState<MenuState>();\n\n const isMediumScreen = useMediaMatch(BREAKPOINTS.LARGE.replace('@media ', ''));\n\n const location = useLocation();\n\n const onSubMenuOpen = (menu?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => {\n\n switch (menu?.type) {\n case 'group':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n content: {\n header: menu.header,\n items: menu.items,\n footer: menu.footer,\n action: menu.action\n },\n footer: false\n });\n break;\n case 'custom':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n customContent: menu.custom,\n footer: false\n });\n break;\n default:\n break;\n }\n\n };\n\n React.useEffect(() => {\n onClose();\n }, [location]);\n\n React.useEffect(() => {\n isMediumScreen && onClose()\n }, [isMediumScreen]);\n\n React.useEffect(() => {\n setTimeout(() => {\n reset({\n footer: true,\n header: {\n label: label,\n buttons: buttons,\n },\n content: {\n header: header,\n items: items,\n footer: footer,\n action: action\n }\n })\n }, 300)\n }, [show])\n\n\n const current = peek();\n\n const switcher = current?.header?.buttons?.find(a => a.type === 'switcher') as MenuSwitcherButton;\n\n return (\n <Wrapper>\n <MobileMenuHeader buttons={current?.header.buttons}\n onGoBack={length > 1 ? pop : undefined}\n onSubMenuOpen={onSubMenuOpen}\n profile={profile}\n label={current?.header.label}\n onClose={onClose}/>\n {current?.customContent && <CustomContent>{current?.customContent()}</CustomContent>}\n {current?.content && <MobileMenuContent header={current?.content.header}\n items={current?.content.items}\n footer={current?.content.footer}\n action={current?.content.action}\n onSubMenuOpen={onSubMenuOpen}/>}\n\n {\n current?.footer &&\n <MobileFooter>\n <LaerdalLogo height={'36px'} width={'66px'}/>\n {switcher &&\n <>\n <SwitcherLabel className={'globalNav-toggler'} onClick={() => switcher.action && switcher.action() && onClose()}>Switch site</SwitcherLabel>\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n id=\"globalNavAppsButton\"\n action={() => switcher.action && switcher.action() && onClose()}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n </>\n }\n\n </MobileFooter>\n }\n </Wrapper>\n );\n};\n\nexport default MobileMenu;\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AAAoC;AAAA;AAAA;AAAA;AAEpC,IAAMA,OAAO,GAAGC,yBAAM,CAACC,GAAG,qQAEbC,iBAAS,CAACC,UAAU,EAQ7BC,mBAAW,CAACC,KAAK,CAGpB;AAED,IAAMC,aAAa,GAAGN,yBAAM,CAACC,GAAG,6GAE/B;AAED,IAAMM,YAAY,GAAGP,yBAAM,CAACC,GAAG,+TAOLO,cAAM,CAACC,WAAW,EAExC,IAAAC,0BAAkB,EAACC,0BAAkB,CAACC,IAAI,EAAEJ,cAAM,CAACK,WAAW,CAAC,EAC/DT,mBAAW,CAACC,KAAK,EAGf,IAAAS,yBAAiB,EAACH,0BAAkB,CAACC,IAAI,EAAEJ,cAAM,CAACK,WAAW,CAAC,CAEnE;AAED,IAAME,aAAa,GAAGf,yBAAM,CAACC,GAAG,2MAO/B;AAuBD,IAAMe,UAAU,GA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,IAAIC,OAAO,EAAE;UAAA,CAAC;UAAA,uBAChE,qBAAC,sBAAS;YAAC,IAAI,EAAC;UAAM;QAAE,EACb;MAAA,EACZ;IAAA,EAGQ;EAAA,EAET;AAEd,CAAC;AAAC;EA1IAR,IAAI;EACJQ,OAAO;AAAA;AAAA,eA2IMT,UAAU;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileMenu.js","names":["React","styled","BREAKPOINTS","COLORS","ComponentSStyling","ComponentTextStyle","ComponentXSStyling","Z_INDEXES","SwitchApp","useLocation","IconButton","LaerdalLogo","MobileMenuHeader","MobileMenuContent","useStackState","useMediaMatch","Wrapper","div","off_canvas","SMALL","SwitcherLabel","MobileFooter","neutral_200","Bold","neutral_600","CustomContent","MobileMenu","show","profile","buttons","label","header","items","footer","action","onClose","reset","length","push","pop","peek","isMediumScreen","LARGE","replace","location","onSubMenuOpen","menu","type","content","customContent","custom","useEffect","setTimeout","current","switcher","find","a","undefined"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling, Z_INDEXES} from '../../styles';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {useLocation} from 'react-router-dom';\nimport {IconButton} from '../../Button';\nimport {LaerdalLogo} from '../../assets';\nimport {\n MenuAccountInfo,\n MenuButton,\n MenuNavigationItemTypeGroup,\n MenuGroupFooter,\n MenuGroupHeader,\n MenuIconButton,\n MenuNavigationItemTypeItem,\n MobileNavigationMenuProps,\n ProfileMenu,\n MenuNavigationItemTypeSection,\n MobileMenuButtonTypes,\n MenuSwitcherButton,\n MenuNavigationCustomSubMenu\n} from '../types';\nimport MobileMenuHeader from './MobileMenuHeader';\nimport MobileMenuContent from './MobileMenuContent';\nimport {useStackState} from '../../common/StackState';\nimport {useMediaMatch} from \"rooks\";\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\nconst SwitcherLabel = styled.div`\n margin-left: auto;\n`;\n\nconst MobileFooter = styled.div`\n display: flex;\n align-items: center;\n box-sizing: border-box;\n height: 48px;\n\n padding: 0 4px 0 16px;\n border-top: 1px solid ${COLORS.neutral_200};\n\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n padding: 4px 8px 4px 16px;\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst CustomContent = styled.div`\n width: 100%;\n box-sizing: border-box;\n flex-flow: column;\n display: flex;\n flex: 1;\n overflow: hidden;\n`;\n\ntype Props = MobileNavigationMenuProps & {\n profile?: ProfileMenu;\n show?: boolean;\n onClose: () => void;\n};\n\ninterface MenuState {\n header: {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n }\n content?: {\n header?: MenuGroupHeader;\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection)[];\n footer?: MenuGroupFooter;\n action?: MenuButton;\n },\n customContent?: () => React.ReactNode;\n footer?: boolean;\n}\n\nconst MobileMenu = ({\n show,\n profile,\n buttons,\n label,\n header,\n items,\n footer,\n action,\n onClose,\n }: Props) => {\n\n const {reset, length, push, pop, peek} = useStackState<MenuState>();\n\n const isMediumScreen = useMediaMatch(BREAKPOINTS.LARGE.replace('@media ', ''));\n\n const location = useLocation();\n\n const onSubMenuOpen = (menu?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => {\n\n switch (menu?.type) {\n case 'group':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n content: {\n header: menu.header,\n items: menu.items,\n footer: menu.footer,\n action: menu.action\n },\n footer: false\n });\n break;\n case 'custom':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n customContent: menu.custom,\n footer: false\n });\n break;\n default:\n break;\n }\n\n };\n\n React.useEffect(() => {\n onClose();\n }, [location]);\n\n React.useEffect(() => {\n isMediumScreen && onClose()\n }, [isMediumScreen]);\n\n React.useEffect(() => {\n setTimeout(() => {\n reset({\n footer: true,\n header: {\n label: label,\n buttons: buttons,\n },\n content: {\n header: header,\n items: items,\n footer: footer,\n action: action\n }\n })\n }, 300)\n }, [show])\n\n\n const current = peek();\n\n const switcher = current?.header?.buttons?.find(a => a.type === 'switcher') as MenuSwitcherButton;\n\n return (\n <Wrapper>\n <MobileMenuHeader buttons={current?.header.buttons}\n onGoBack={length > 1 ? pop : undefined}\n onSubMenuOpen={onSubMenuOpen}\n profile={profile}\n label={current?.header.label}\n onClose={onClose}/>\n {current?.customContent && <CustomContent>{current?.customContent()}</CustomContent>}\n {current?.content && <MobileMenuContent header={current?.content.header}\n items={current?.content.items}\n footer={current?.content.footer}\n action={current?.content.action}\n onSubMenuOpen={onSubMenuOpen}/>}\n\n {\n current?.footer &&\n <MobileFooter>\n <LaerdalLogo height={'36px'} width={'66px'}/>\n {switcher &&\n <>\n <SwitcherLabel className={'globalNav-toggler'} onClick={() => switcher.action && switcher.action() && onClose()}>Switch site</SwitcherLabel>\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n id=\"globalNavAppsButton\"\n action={() => switcher.action && switcher.action() && onClose()}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n </>\n }\n\n </MobileFooter>\n }\n </Wrapper>\n );\n};\n\nexport default MobileMenu;\n"],"mappings":";;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAAQC,WAAW,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAEC,kBAAkB,EAAEC,SAAS,QAAO,cAAc;AACtH,SAAQC,SAAS,QAAO,qCAAqC;AAC7D,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B,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEL,OAAO,CAACf,MAAO;MAChC,MAAM,EAAEoB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEL,OAAO,CAACd,MAAO;MAChC,aAAa,EAAEW;IAAc,EAAE,EAGrE,CAAAQ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEpB,MAAM,kBACf,MAAC,YAAY;MAAA,wBACX,KAAC,WAAW;QAAC,MAAM,EAAE,MAAO;QAAC,KAAK,EAAE;MAAO,EAAE,EAC5CqB,QAAQ,iBACP;QAAA,wBACE,KAAC,aAAa;UAAC,SAAS,EAAE,mBAAoB;UAAC,OAAO,EAAE;YAAA,OAAMA,QAAQ,CAACpB,MAAM,IAAIoB,QAAQ,CAACpB,MAAM,EAAE,IAAIC,OAAO,EAAE;UAAA,CAAC;UAAA,UAAC;QAAW,EAAgB,eAC5I,KAAC,UAAU;UACT,OAAO,EAAE,WAAY;UACrB,KAAK,EAAE,UAAW;UAClB,EAAE,EAAC,qBAAqB;UACxB,MAAM,EAAE;YAAA,OAAMmB,QAAQ,CAACpB,MAAM,IAAIoB,QAAQ,CAACpB,MAAM,EAAE,IAAIC,OAAO,EAAE;UAAA,CAAC;UAAA,uBAChE,KAAC,SAAS;YAAC,IAAI,EAAC;UAAM;QAAE,EACb;MAAA,EACZ;IAAA,EAGQ;EAAA,EAET;AAEd,CAAC;AAAC;EA1IAR,IAAI;EACJQ,OAAO;AAAA;AA2IT,eAAeT,UAAU"}
|
|
1
|
+
{"version":3,"file":"MobileMenu.js","names":["React","styled","BREAKPOINTS","COLORS","ComponentSStyling","ComponentTextStyle","ComponentXSStyling","Z_INDEXES","SwitchApp","useLocation","IconButton","LaerdalLogo","MobileMenuHeader","MobileMenuContent","useStackState","useMediaMatch","Wrapper","div","off_canvas","SMALL","SwitcherLabel","MobileFooter","neutral_200","Bold","neutral_600","CustomContent","MobileMenu","show","profile","buttons","label","header","items","footer","action","onClose","reset","length","push","pop","peek","isMediumScreen","LARGE","replace","location","onSubMenuOpen","menu","type","content","customContent","custom","useEffect","setTimeout","current","switcher","find","a","undefined"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling, Z_INDEXES} from '../../styles';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {useLocation} from 'react-router-dom';\nimport {IconButton} from '../../Button';\nimport {LaerdalLogo} from '../../assets';\nimport {\n MenuAccountInfo,\n MenuButton,\n MenuNavigationItemTypeGroup,\n MenuGroupFooter,\n MenuGroupHeader,\n MenuIconButton,\n MenuNavigationItemTypeItem,\n MobileNavigationMenuProps,\n ProfileMenu,\n MenuNavigationItemTypeSection,\n MobileMenuButtonTypes,\n MenuSwitcherButton,\n MenuNavigationCustomSubMenu\n} from '../types';\nimport MobileMenuHeader from './MobileMenuHeader';\nimport MobileMenuContent from './MobileMenuContent';\nimport {useStackState} from '../../common/StackState';\nimport {useMediaMatch} from \"rooks\";\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\nconst SwitcherLabel = styled.div`\n margin-left: auto;\n`;\n\nconst MobileFooter = styled.div`\n display: flex;\n align-items: center;\n box-sizing: border-box;\n height: 48px;\n\n padding: 0 4px 0 16px;\n border-top: 1px solid ${COLORS.neutral_200};\n\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n padding: 4px 8px 4px 16px;\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst CustomContent = styled.div`\n width: 100%;\n box-sizing: border-box;\n flex-flow: column;\n display: flex;\n flex: 1;\n overflow: hidden;\n`;\n\ntype Props = MobileNavigationMenuProps & {\n profile?: ProfileMenu;\n show?: boolean;\n onClose: () => void;\n};\n\ninterface MenuState {\n header: {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n }\n content?: {\n header?: MenuGroupHeader;\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection)[];\n footer?: MenuGroupFooter;\n action?: MenuButton;\n },\n customContent?: () => React.ReactNode;\n footer?: boolean;\n}\n\nconst MobileMenu = ({\n show,\n profile,\n buttons,\n label,\n header,\n items,\n footer,\n action,\n onClose,\n }: Props) => {\n\n const {reset, length, push, pop, peek} = useStackState<MenuState>();\n\n const isMediumScreen = useMediaMatch(BREAKPOINTS.LARGE.replace('@media ', ''));\n\n const location = useLocation();\n\n const onSubMenuOpen = (menu?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => {\n\n switch (menu?.type) {\n case 'group':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n content: {\n header: menu.header,\n items: menu.items,\n footer: menu.footer,\n action: menu.action\n },\n footer: false\n });\n break;\n case 'custom':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n customContent: menu.custom,\n footer: false\n });\n break;\n default:\n break;\n }\n\n };\n\n React.useEffect(() => {\n onClose();\n }, [location]);\n\n React.useEffect(() => {\n isMediumScreen && onClose()\n }, [isMediumScreen]);\n\n React.useEffect(() => {\n setTimeout(() => {\n reset({\n footer: true,\n header: {\n label: label,\n buttons: buttons,\n },\n content: {\n header: header,\n items: items,\n footer: footer,\n action: action\n }\n })\n }, 300)\n }, [show])\n\n\n const current = peek();\n\n const switcher = current?.header?.buttons?.find(a => a.type === 'switcher') as MenuSwitcherButton;\n\n return (\n <Wrapper>\n <MobileMenuHeader buttons={current?.header.buttons}\n onGoBack={length > 1 ? pop : undefined}\n onSubMenuOpen={onSubMenuOpen}\n profile={profile}\n label={current?.header.label}\n onClose={onClose}/>\n {current?.customContent && <CustomContent>{current?.customContent()}</CustomContent>}\n {current?.content && <MobileMenuContent header={current?.content.header}\n items={current?.content.items}\n footer={current?.content.footer}\n action={current?.content.action}\n onSubMenuOpen={onSubMenuOpen}/>}\n\n {\n current?.footer &&\n <MobileFooter>\n <LaerdalLogo height={'36px'} width={'66px'}/>\n {switcher &&\n <>\n <SwitcherLabel className={'globalNav-toggler'} onClick={() => switcher.action && switcher.action() && onClose()}>Switch site</SwitcherLabel>\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n id=\"globalNavAppsButton\"\n action={() => switcher.action && switcher.action() && onClose()}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n </>\n }\n\n </MobileFooter>\n }\n </Wrapper>\n );\n};\n\nexport default MobileMenu;\n"],"mappings":";;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAAQC,WAAW,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAEC,kBAAkB,EAAEC,SAAS,QAAO,cAAc;AACtH,SAAQC,SAAS,QAAO,qCAAqC;AAC7D,SAAQC,WAAW,QAAO,kBAAkB;AAC5C,SAAQC,UAAU,QAAO,cAAc;AACvC,SAAQC,WAAW,QAAO,cAAc;AAgBxC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAAQC,aAAa,QAAO,yBAAyB;AACrD,SAAQC,aAAa,QAAO,OAAO;AAAC;AAAA;AAAA;AAEpC,IAAMC,OAAO,GAAGf,MAAM,CAACgB,GAAG,uPAEbV,SAAS,CAACW,UAAU,EAQ7BhB,WAAW,CAACiB,KAAK,CAGpB;AAED,IAAMC,aAAa,GAAGnB,MAAM,CAACgB,GAAG,+FAE/B;AAED,IAAMI,YAAY,GAAGpB,MAAM,CAACgB,GAAG,iTAOLd,MAAM,CAACmB,WAAW,EAExChB,kBAAkB,CAACD,kBAAkB,CAACkB,IAAI,EAA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,EAA4B,eAC5I,KAAC,UAAU;UACT,OAAO,EAAE,WAAY;UACrB,KAAK,EAAE,UAAW;UAClB,EAAE,EAAC,qBAAqB;UACxB,MAAM,EAAE;YAAA,OAAMmB,QAAQ,CAACpB,MAAM,IAAIoB,QAAQ,CAACpB,MAAM,EAAE,IAAIC,OAAO,EAAE;UAAA,CAAC;UAAA,uBAChE,KAAC,SAAS;YAAC,IAAI,EAAC;UAAM;QAAE,EACb;MAAA,EACZ;IAAA,EAGQ;EAAA,EAET;AAEd,CAAC;AAAC;EA1IAR,IAAI;EACJQ,OAAO;AAAA;AA2IT,eAAeT,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":[],"sources":["../../src/GlobalNavigationBar/types.tsx"],"sourcesContent":["import React from 'react';\nimport { HyperlinkProps } from '../HyperLink/HyperLink';\nimport { IconButtonProps } from '../Button/Iconbutton';\nimport { ProfileButtonProps } from '../ProfileButton/ProfileButton';\nimport { NavLinkProps } from 'react-router-dom';\nimport {ButtonProps} from \"../Button/Button\";\nimport {TooltipProps} from \"../Tooltips/TooltipTypes\";\n\nexport interface MenuHyperLinkProps extends Pick<HyperlinkProps, 'id' | 'href' | 'onClick' | 'target'> {\n label: string;\n icon?: React.ReactElement;\n}\n\nexport interface MenuButton extends Omit<ButtonProps, 'onClick' | 'children' | 'size'> {\n label: string;\n action: () => void;\n\n tooltip?: TooltipProps;\n}\n\nexport interface MenuGroupFooter {\n header: string;\n note?: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface MenuGroupHeader {\n header: string;\n note?: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface MenuAccountInfo {\n firstName: string;\n lastName: string;\n email: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface ProfileMenu {\n label?: string;\n\n user: MenuAccountInfo;\n\n sections: MenuNavigationSection[];\n\n signOut?: MenuButton;\n}\n\nexport interface MenuIconSubMenuButton\n extends Omit<\n IconButtonProps,\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'submenu';\n icon: React.ReactNode;\n menu: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuIconButton\n extends Omit<\n IconButtonProps,\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'action';\n icon: React.ReactNode;\n action: (button?: EventTarget) => boolean | void;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuProfileButton extends Omit<ProfileButtonProps, 'type' | 'onClick' | 'initials' | 'hideOnLowWidth' | 'icon' | 'portraitSrc'> {\n type: 'profile';\n action?: (button?: EventTarget) => boolean | void;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuSwitcherButton\n extends Omit<\n IconButtonProps,\n | 'id'\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'switcher';\n placement?: 'left' | 'right';\n action?: (button?: EventTarget) => boolean | void;\n}\n\nexport type DesktopMenuButtonTypes = MenuIconButton | MenuProfileButton | MenuSwitcherButton;\nexport type MobileMenuButtonTypes = MenuIconSubMenuButton | MenuIconButton | MenuProfileButton | MenuSwitcherButton;\n\nexport interface MobileNavigationMenuProps {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n\n header?: MenuGroupHeader;\n\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup)[];\n\n footer?: MenuGroupFooter;\n action?: MenuButton;\n}\n\nexport interface DesktopNavigationMenuProps {\n buttons?: DesktopMenuButtonTypes[];\n items: MenuNavigationItemTypeItem[];\n action?: MenuButton;\n reverseRightSideOrder?: boolean;\n}\n\n// @ts-ignore\nexport interface MenuNavigationGroup<T = MenuNavigationItem | MenuNavigationSection | MenuNavigationGroup> {\n label: string;\n note?: string;\n\n buttons?: MobileMenuButtonTypes[];\n header?: MenuGroupHeader;\n\n items: T[];\n\n footer?: MenuGroupFooter;\n action?: MenuButton;\n}\n\nexport type MenuNavigationItem = {\n icon?: React.ReactNode;\n to: string;\n exact?: boolean;\n disabled?: boolean;\n external?: boolean;\n action?: (e: React.MouseEvent) => void;\n label: string;\n note?: string;\n pinned?: boolean;\n} & Omit<NavLinkProps, 'onClick' | 'to' | 'exact' | 'onMouseDown'>;\n\nexport interface MenuNavigationSection<T = MenuNavigationItem> {\n divider?: boolean;\n pinned?: boolean;\n label?: string;\n items: T[];\n}\n\nexport type MenuNavigationItemTypeItem = MenuNavigationItem & {\n type?: 'item';\n};\n\nexport type MenuNavigationItemTypeGroup = MenuNavigationGroup<MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection> & {\n type: 'group';\n icon?: React.ReactNode;\n pinned?: boolean;\n disabled?: boolean;\n};\n\nexport type MenuNavigationItemTypeSection = MenuNavigationSection<MenuNavigationItemTypeItem> & {\n type: 'section';\n};\n\nexport type MenuNavigationCustomSubMenu = {\n type: 'custom';\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n custom: () => React.ReactNode;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.cjs","names":[],"sources":["../../src/GlobalNavigationBar/types.tsx"],"sourcesContent":["import React from 'react';\nimport { HyperlinkProps } from '../HyperLink/HyperLink';\nimport { IconButtonProps } from '../Button/Iconbutton';\nimport { ProfileButtonProps } from '../ProfileButton/ProfileButton';\nimport { NavLinkProps } from 'react-router-dom';\nimport {ButtonProps} from \"../Button/Button\";\nimport {TooltipProps} from \"../Tooltips/TooltipTypes\";\n\nexport interface MenuHyperLinkProps extends Pick<HyperlinkProps, 'id' | 'href' | 'onClick' | 'target'> {\n label: string;\n icon?: React.ReactElement;\n}\n\nexport interface MenuButton extends Omit<ButtonProps, 'onClick' | 'children' | 'size'> {\n label: string;\n action: () => void;\n\n tooltip?: TooltipProps;\n}\n\nexport interface MenuGroupFooter {\n header: string;\n note?: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface MenuGroupHeader {\n header: string;\n note?: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface MenuAccountInfo {\n firstName: string;\n lastName: string;\n email: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface ProfileMenu {\n label?: string;\n\n user: MenuAccountInfo;\n\n sections: MenuNavigationSection[];\n\n signOut?: MenuButton;\n}\n\nexport interface MenuIconSubMenuButton\n extends Omit<\n IconButtonProps,\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'submenu';\n icon: React.ReactNode;\n menu: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuIconButton\n extends Omit<\n IconButtonProps,\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'action';\n icon: React.ReactNode;\n action: (button?: EventTarget) => boolean | void;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuProfileButton extends Omit<ProfileButtonProps, 'type' | 'onClick' | 'initials' | 'hideOnLowWidth' | 'icon' | 'portraitSrc'> {\n type: 'profile';\n action?: (button?: EventTarget) => boolean | void;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuSwitcherButton\n extends Omit<\n IconButtonProps,\n | 'id'\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'switcher';\n placement?: 'left' | 'right';\n action?: (button?: EventTarget) => boolean | void;\n}\n\nexport type DesktopMenuButtonTypes = MenuIconButton | MenuProfileButton | MenuSwitcherButton;\nexport type MobileMenuButtonTypes = MenuIconSubMenuButton | MenuIconButton | MenuProfileButton | MenuSwitcherButton;\n\nexport interface MobileNavigationMenuProps {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n\n header?: MenuGroupHeader;\n\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup)[];\n\n footer?: MenuGroupFooter;\n action?: MenuButton;\n}\n\nexport interface DesktopNavigationMenuProps {\n buttons?: DesktopMenuButtonTypes[];\n items: (MenuNavigationItemTypeItem | MenuNavigationItemTypeDesktopGroup)[];\n action?: MenuButton;\n reverseRightSideOrder?: boolean;\n}\n\n// @ts-ignore\nexport interface MenuNavigationGroup<T = MenuNavigationItemTypeDesktopGroup | MenuNavigationItem | MenuNavigationSection | MenuNavigationGroup> {\n label: string;\n note?: string;\n\n buttons?: MobileMenuButtonTypes[];\n header?: MenuGroupHeader;\n\n items: T[];\n\n footer?: MenuGroupFooter;\n action?: MenuButton;\n}\n\nexport type MenuNavigationItem = {\n icon?: React.ReactNode;\n to: string;\n exact?: boolean;\n disabled?: boolean;\n external?: boolean;\n action?: (e: React.MouseEvent) => void;\n label: string;\n note?: string;\n pinned?: boolean;\n subItems?: MenuNavigationItem[];\n} & Omit<NavLinkProps, 'onClick' | 'to' | 'exact' | 'onMouseDown'>;\n\nexport interface MenuNavigationSection<T = MenuNavigationItem> {\n divider?: boolean;\n pinned?: boolean;\n label?: string;\n items: T[];\n}\n\nexport type MenuNavigationItemTypeItem = MenuNavigationItem & {\n type?: 'item';\n};\n\nexport type MenuNavigationItemTypeDesktopGroup = {\n id: string;\n label?: string;\n disabled?: boolean;\n pinned?: boolean;\n type?: 'desktopgroup';\n expanded?: boolean;\n items: (MenuNavigationItemTypeItem | MenuNavigationItemTypeDesktopGroup)[];\n}\n\nexport type MenuNavigationItemTypeGroup = MenuNavigationGroup<MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection> & {\n type: 'group';\n icon?: React.ReactNode;\n pinned?: boolean;\n disabled?: boolean;\n};\n\nexport type MenuNavigationItemTypeSection = MenuNavigationSection<MenuNavigationItemTypeItem> & {\n type: 'section';\n};\n\nexport type MenuNavigationCustomSubMenu = {\n type: 'custom';\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n custom: () => React.ReactNode;\n};\n"],"mappings":""}
|
|
@@ -70,11 +70,11 @@ export interface MobileNavigationMenuProps {
|
|
|
70
70
|
}
|
|
71
71
|
export interface DesktopNavigationMenuProps {
|
|
72
72
|
buttons?: DesktopMenuButtonTypes[];
|
|
73
|
-
items: MenuNavigationItemTypeItem[];
|
|
73
|
+
items: (MenuNavigationItemTypeItem | MenuNavigationItemTypeDesktopGroup)[];
|
|
74
74
|
action?: MenuButton;
|
|
75
75
|
reverseRightSideOrder?: boolean;
|
|
76
76
|
}
|
|
77
|
-
export interface MenuNavigationGroup<T = MenuNavigationItem | MenuNavigationSection | MenuNavigationGroup> {
|
|
77
|
+
export interface MenuNavigationGroup<T = MenuNavigationItemTypeDesktopGroup | MenuNavigationItem | MenuNavigationSection | MenuNavigationGroup> {
|
|
78
78
|
label: string;
|
|
79
79
|
note?: string;
|
|
80
80
|
buttons?: MobileMenuButtonTypes[];
|
|
@@ -93,6 +93,7 @@ export type MenuNavigationItem = {
|
|
|
93
93
|
label: string;
|
|
94
94
|
note?: string;
|
|
95
95
|
pinned?: boolean;
|
|
96
|
+
subItems?: MenuNavigationItem[];
|
|
96
97
|
} & Omit<NavLinkProps, 'onClick' | 'to' | 'exact' | 'onMouseDown'>;
|
|
97
98
|
export interface MenuNavigationSection<T = MenuNavigationItem> {
|
|
98
99
|
divider?: boolean;
|
|
@@ -103,6 +104,15 @@ export interface MenuNavigationSection<T = MenuNavigationItem> {
|
|
|
103
104
|
export type MenuNavigationItemTypeItem = MenuNavigationItem & {
|
|
104
105
|
type?: 'item';
|
|
105
106
|
};
|
|
107
|
+
export type MenuNavigationItemTypeDesktopGroup = {
|
|
108
|
+
id: string;
|
|
109
|
+
label?: string;
|
|
110
|
+
disabled?: boolean;
|
|
111
|
+
pinned?: boolean;
|
|
112
|
+
type?: 'desktopgroup';
|
|
113
|
+
expanded?: boolean;
|
|
114
|
+
items: (MenuNavigationItemTypeItem | MenuNavigationItemTypeDesktopGroup)[];
|
|
115
|
+
};
|
|
106
116
|
export type MenuNavigationItemTypeGroup = MenuNavigationGroup<MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection> & {
|
|
107
117
|
type: 'group';
|
|
108
118
|
icon?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/GlobalNavigationBar/types.tsx"],"sourcesContent":["import React from 'react';\nimport { HyperlinkProps } from '../HyperLink/HyperLink';\nimport { IconButtonProps } from '../Button/Iconbutton';\nimport { ProfileButtonProps } from '../ProfileButton/ProfileButton';\nimport { NavLinkProps } from 'react-router-dom';\nimport {ButtonProps} from \"../Button/Button\";\nimport {TooltipProps} from \"../Tooltips/TooltipTypes\";\n\nexport interface MenuHyperLinkProps extends Pick<HyperlinkProps, 'id' | 'href' | 'onClick' | 'target'> {\n label: string;\n icon?: React.ReactElement;\n}\n\nexport interface MenuButton extends Omit<ButtonProps, 'onClick' | 'children' | 'size'> {\n label: string;\n action: () => void;\n\n tooltip?: TooltipProps;\n}\n\nexport interface MenuGroupFooter {\n header: string;\n note?: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface MenuGroupHeader {\n header: string;\n note?: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface MenuAccountInfo {\n firstName: string;\n lastName: string;\n email: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface ProfileMenu {\n label?: string;\n\n user: MenuAccountInfo;\n\n sections: MenuNavigationSection[];\n\n signOut?: MenuButton;\n}\n\nexport interface MenuIconSubMenuButton\n extends Omit<\n IconButtonProps,\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'submenu';\n icon: React.ReactNode;\n menu: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuIconButton\n extends Omit<\n IconButtonProps,\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'action';\n icon: React.ReactNode;\n action: (button?: EventTarget) => boolean | void;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuProfileButton extends Omit<ProfileButtonProps, 'type' | 'onClick' | 'initials' | 'hideOnLowWidth' | 'icon' | 'portraitSrc'> {\n type: 'profile';\n action?: (button?: EventTarget) => boolean | void;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuSwitcherButton\n extends Omit<\n IconButtonProps,\n | 'id'\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'switcher';\n placement?: 'left' | 'right';\n action?: (button?: EventTarget) => boolean | void;\n}\n\nexport type DesktopMenuButtonTypes = MenuIconButton | MenuProfileButton | MenuSwitcherButton;\nexport type MobileMenuButtonTypes = MenuIconSubMenuButton | MenuIconButton | MenuProfileButton | MenuSwitcherButton;\n\nexport interface MobileNavigationMenuProps {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n\n header?: MenuGroupHeader;\n\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup)[];\n\n footer?: MenuGroupFooter;\n action?: MenuButton;\n}\n\nexport interface DesktopNavigationMenuProps {\n buttons?: DesktopMenuButtonTypes[];\n items: MenuNavigationItemTypeItem[];\n action?: MenuButton;\n reverseRightSideOrder?: boolean;\n}\n\n// @ts-ignore\nexport interface MenuNavigationGroup<T = MenuNavigationItem | MenuNavigationSection | MenuNavigationGroup> {\n label: string;\n note?: string;\n\n buttons?: MobileMenuButtonTypes[];\n header?: MenuGroupHeader;\n\n items: T[];\n\n footer?: MenuGroupFooter;\n action?: MenuButton;\n}\n\nexport type MenuNavigationItem = {\n icon?: React.ReactNode;\n to: string;\n exact?: boolean;\n disabled?: boolean;\n external?: boolean;\n action?: (e: React.MouseEvent) => void;\n label: string;\n note?: string;\n pinned?: boolean;\n} & Omit<NavLinkProps, 'onClick' | 'to' | 'exact' | 'onMouseDown'>;\n\nexport interface MenuNavigationSection<T = MenuNavigationItem> {\n divider?: boolean;\n pinned?: boolean;\n label?: string;\n items: T[];\n}\n\nexport type MenuNavigationItemTypeItem = MenuNavigationItem & {\n type?: 'item';\n};\n\nexport type MenuNavigationItemTypeGroup = MenuNavigationGroup<MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection> & {\n type: 'group';\n icon?: React.ReactNode;\n pinned?: boolean;\n disabled?: boolean;\n};\n\nexport type MenuNavigationItemTypeSection = MenuNavigationSection<MenuNavigationItemTypeItem> & {\n type: 'section';\n};\n\nexport type MenuNavigationCustomSubMenu = {\n type: 'custom';\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n custom: () => React.ReactNode;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/GlobalNavigationBar/types.tsx"],"sourcesContent":["import React from 'react';\nimport { HyperlinkProps } from '../HyperLink/HyperLink';\nimport { IconButtonProps } from '../Button/Iconbutton';\nimport { ProfileButtonProps } from '../ProfileButton/ProfileButton';\nimport { NavLinkProps } from 'react-router-dom';\nimport {ButtonProps} from \"../Button/Button\";\nimport {TooltipProps} from \"../Tooltips/TooltipTypes\";\n\nexport interface MenuHyperLinkProps extends Pick<HyperlinkProps, 'id' | 'href' | 'onClick' | 'target'> {\n label: string;\n icon?: React.ReactElement;\n}\n\nexport interface MenuButton extends Omit<ButtonProps, 'onClick' | 'children' | 'size'> {\n label: string;\n action: () => void;\n\n tooltip?: TooltipProps;\n}\n\nexport interface MenuGroupFooter {\n header: string;\n note?: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface MenuGroupHeader {\n header: string;\n note?: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface MenuAccountInfo {\n firstName: string;\n lastName: string;\n email: string;\n link?: MenuHyperLinkProps;\n}\n\nexport interface ProfileMenu {\n label?: string;\n\n user: MenuAccountInfo;\n\n sections: MenuNavigationSection[];\n\n signOut?: MenuButton;\n}\n\nexport interface MenuIconSubMenuButton\n extends Omit<\n IconButtonProps,\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'submenu';\n icon: React.ReactNode;\n menu: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuIconButton\n extends Omit<\n IconButtonProps,\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'action';\n icon: React.ReactNode;\n action: (button?: EventTarget) => boolean | void;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuProfileButton extends Omit<ProfileButtonProps, 'type' | 'onClick' | 'initials' | 'hideOnLowWidth' | 'icon' | 'portraitSrc'> {\n type: 'profile';\n action?: (button?: EventTarget) => boolean | void;\n placement?: 'left' | 'right';\n}\n\nexport interface MenuSwitcherButton\n extends Omit<\n IconButtonProps,\n | 'id'\n | 'type'\n | 'action'\n | 'shape'\n | 'variant'\n | 'hideOnLowWidth'\n | 'flatEdge'\n | 'isInMobileMenu'\n | 'useTransparentBackground'\n | 'shouldNotInteract'\n | 'iconColor'\n | 'unsetIconSize'\n | 'borderRadius'\n | 'focusBackgroundColor'\n | 'children'\n | 'invertFocus'\n > {\n type: 'switcher';\n placement?: 'left' | 'right';\n action?: (button?: EventTarget) => boolean | void;\n}\n\nexport type DesktopMenuButtonTypes = MenuIconButton | MenuProfileButton | MenuSwitcherButton;\nexport type MobileMenuButtonTypes = MenuIconSubMenuButton | MenuIconButton | MenuProfileButton | MenuSwitcherButton;\n\nexport interface MobileNavigationMenuProps {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n\n header?: MenuGroupHeader;\n\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup)[];\n\n footer?: MenuGroupFooter;\n action?: MenuButton;\n}\n\nexport interface DesktopNavigationMenuProps {\n buttons?: DesktopMenuButtonTypes[];\n items: (MenuNavigationItemTypeItem | MenuNavigationItemTypeDesktopGroup)[];\n action?: MenuButton;\n reverseRightSideOrder?: boolean;\n}\n\n// @ts-ignore\nexport interface MenuNavigationGroup<T = MenuNavigationItemTypeDesktopGroup | MenuNavigationItem | MenuNavigationSection | MenuNavigationGroup> {\n label: string;\n note?: string;\n\n buttons?: MobileMenuButtonTypes[];\n header?: MenuGroupHeader;\n\n items: T[];\n\n footer?: MenuGroupFooter;\n action?: MenuButton;\n}\n\nexport type MenuNavigationItem = {\n icon?: React.ReactNode;\n to: string;\n exact?: boolean;\n disabled?: boolean;\n external?: boolean;\n action?: (e: React.MouseEvent) => void;\n label: string;\n note?: string;\n pinned?: boolean;\n subItems?: MenuNavigationItem[];\n} & Omit<NavLinkProps, 'onClick' | 'to' | 'exact' | 'onMouseDown'>;\n\nexport interface MenuNavigationSection<T = MenuNavigationItem> {\n divider?: boolean;\n pinned?: boolean;\n label?: string;\n items: T[];\n}\n\nexport type MenuNavigationItemTypeItem = MenuNavigationItem & {\n type?: 'item';\n};\n\nexport type MenuNavigationItemTypeDesktopGroup = {\n id: string;\n label?: string;\n disabled?: boolean;\n pinned?: boolean;\n type?: 'desktopgroup';\n expanded?: boolean;\n items: (MenuNavigationItemTypeItem | MenuNavigationItemTypeDesktopGroup)[];\n}\n\nexport type MenuNavigationItemTypeGroup = MenuNavigationGroup<MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection> & {\n type: 'group';\n icon?: React.ReactNode;\n pinned?: boolean;\n disabled?: boolean;\n};\n\nexport type MenuNavigationItemTypeSection = MenuNavigationSection<MenuNavigationItemTypeItem> & {\n type: 'section';\n};\n\nexport type MenuNavigationCustomSubMenu = {\n type: 'custom';\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n custom: () => React.ReactNode;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkIfContainsItem = void 0;
|
|
7
|
+
var checkIfContainsItem = function checkIfContainsItem(item, activeId) {
|
|
8
|
+
if (item.id == activeId) return true;
|
|
9
|
+
if (item.items.findIndex(function (x) {
|
|
10
|
+
return x.type == 'item' && x.to == activeId;
|
|
11
|
+
}) >= 0) return true;
|
|
12
|
+
return item.items.some(function (x) {
|
|
13
|
+
return x.type == 'desktopgroup' && checkIfContainsItem(x, activeId);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
exports.checkIfContainsItem = checkIfContainsItem;
|
|
17
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["checkIfContainsItem","item","activeId","id","items","findIndex","x","type","to","some"],"sources":["../../src/GlobalNavigationBar/utils.tsx"],"sourcesContent":["import { MenuNavigationItemTypeDesktopGroup } from './types';\n\nexport const checkIfContainsItem = (item: MenuNavigationItemTypeDesktopGroup, activeId: string) : boolean => {\n if(item.id == activeId)\n return true;\n if(item.items.findIndex(x => x.type == 'item' && x.to == activeId) >= 0)\n return true;\n return item.items.some(x => x.type == 'desktopgroup' && checkIfContainsItem(x, activeId));\n}"],"mappings":";;;;;;AAEO,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmB,CAAIC,IAAwC,EAAEC,QAAgB,EAAe;EACzG,IAAGD,IAAI,CAACE,EAAE,IAAID,QAAQ,EAClB,OAAO,IAAI;EACf,IAAGD,IAAI,CAACG,KAAK,CAACC,SAAS,CAAC,UAAAC,CAAC;IAAA,OAAIA,CAAC,CAACC,IAAI,IAAI,MAAM,IAAID,CAAC,CAACE,EAAE,IAAIN,QAAQ;EAAA,EAAC,IAAI,CAAC,EACnE,OAAO,IAAI;EACf,OAAOD,IAAI,CAACG,KAAK,CAACK,IAAI,CAAC,UAAAH,CAAC;IAAA,OAAIA,CAAC,CAACC,IAAI,IAAI,cAAc,IAAIP,mBAAmB,CAACM,CAAC,EAAEJ,QAAQ,CAAC;EAAA,EAAC;AAC7F,CAAC;AAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var checkIfContainsItem = function checkIfContainsItem(item, activeId) {
|
|
2
|
+
if (item.id == activeId) return true;
|
|
3
|
+
if (item.items.findIndex(function (x) {
|
|
4
|
+
return x.type == 'item' && x.to == activeId;
|
|
5
|
+
}) >= 0) return true;
|
|
6
|
+
return item.items.some(function (x) {
|
|
7
|
+
return x.type == 'desktopgroup' && checkIfContainsItem(x, activeId);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["checkIfContainsItem","item","activeId","id","items","findIndex","x","type","to","some"],"sources":["../../src/GlobalNavigationBar/utils.tsx"],"sourcesContent":["import { MenuNavigationItemTypeDesktopGroup } from './types';\n\nexport const checkIfContainsItem = (item: MenuNavigationItemTypeDesktopGroup, activeId: string) : boolean => {\n if(item.id == activeId)\n return true;\n if(item.items.findIndex(x => x.type == 'item' && x.to == activeId) >= 0)\n return true;\n return item.items.some(x => x.type == 'desktopgroup' && checkIfContainsItem(x, activeId));\n}"],"mappings":"AAEA,OAAO,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmB,CAAIC,IAAwC,EAAEC,QAAgB,EAAe;EACzG,IAAGD,IAAI,CAACE,EAAE,IAAID,QAAQ,EAClB,OAAO,IAAI;EACf,IAAGD,IAAI,CAACG,KAAK,CAACC,SAAS,CAAC,UAAAC,CAAC;IAAA,OAAIA,CAAC,CAACC,IAAI,IAAI,MAAM,IAAID,CAAC,CAACE,EAAE,IAAIN,QAAQ;EAAA,EAAC,IAAI,CAAC,EACnE,OAAO,IAAI;EACf,OAAOD,IAAI,CAACG,KAAK,CAACK,IAAI,CAAC,UAAAH,CAAC;IAAA,OAAIA,CAAC,CAACC,IAAI,IAAI,cAAc,IAAIP,mBAAmB,CAACM,CAAC,EAAEJ,QAAQ,CAAC;EAAA,EAAC;AAC7F,CAAC"}
|
|
@@ -13,8 +13,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
13
13
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
14
|
import { LoadingIndicator } from '..';
|
|
15
15
|
import React from 'react';
|
|
16
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
19
|
var ImageWithFallbacks = /*#__PURE__*/function (_React$Component) {
|
|
20
20
|
_inherits(ImageWithFallbacks, _React$Component);
|
|
@@ -20,6 +20,7 @@ var _colors = _interopRequireDefault(require("../styles/colors"));
|
|
|
20
20
|
var _SystemIcons = require("../icons/systemicons/SystemIcons");
|
|
21
21
|
var _DatepickerFieldHeader = require("./DatepickerFieldHeader");
|
|
22
22
|
var _styles = require("../styles");
|
|
23
|
+
var _TooltipOverflow = _interopRequireDefault(require("../Tooltips/TooltipOverflow"));
|
|
23
24
|
var _styling = require("./styling");
|
|
24
25
|
require("react-datepicker/dist/react-datepicker.css");
|
|
25
26
|
var _common = require("../common");
|
|
@@ -86,12 +87,14 @@ var DatepickerField = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
|
86
87
|
_React$useState8 = (0, _slicedToArray2.default)(_React$useState7, 2),
|
|
87
88
|
open = _React$useState8[0],
|
|
88
89
|
setOpen = _React$useState8[1];
|
|
89
|
-
|
|
90
|
+
var getFormattedValue = function getFormattedValue() {
|
|
91
|
+
return (0, _dayjs.default)(value).format(dateFormat ? dateFormat : 'MMMM Do, YYYY');
|
|
92
|
+
};
|
|
90
93
|
/**
|
|
91
94
|
* Format the date in a specific way.
|
|
92
95
|
*/
|
|
93
96
|
_react.default.useEffect(function () {
|
|
94
|
-
if (value) inputRef.current.value = (
|
|
97
|
+
if (value) inputRef.current.value = getFormattedValue();
|
|
95
98
|
}, [value]);
|
|
96
99
|
_react.default.useEffect(function () {
|
|
97
100
|
if (yearPickerMode) {
|
|
@@ -140,6 +143,7 @@ var DatepickerField = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
|
140
143
|
onBlur && onBlur(e);
|
|
141
144
|
}
|
|
142
145
|
};
|
|
146
|
+
var iconSize = 24;
|
|
143
147
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
144
148
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DatePickerContainer, {
|
|
145
149
|
"data-testId": dataTestId,
|
|
@@ -185,10 +189,10 @@ var DatepickerField = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
|
185
189
|
setYearPickerMode: setYearPickerMode
|
|
186
190
|
}), null);
|
|
187
191
|
} : undefined,
|
|
188
|
-
customInput: /*#__PURE__*/(0, _jsxRuntime.
|
|
192
|
+
customInput: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styling.InputWrapper, {
|
|
189
193
|
disabled: disabled,
|
|
190
194
|
readOnly: readOnly,
|
|
191
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
195
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
192
196
|
style: {
|
|
193
197
|
display: 'block',
|
|
194
198
|
margin: '4px 0px'
|
|
@@ -209,17 +213,25 @@ var DatepickerField = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
|
209
213
|
},
|
|
210
214
|
autoComplete: autoComplete,
|
|
211
215
|
placeholder: placeholder,
|
|
216
|
+
extraRightPadding: iconSize,
|
|
212
217
|
disabled: disabled,
|
|
213
218
|
readOnly: true,
|
|
214
219
|
suppressReadOnlyStyles: !readOnly,
|
|
215
220
|
required: required
|
|
216
221
|
}, rest)), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconWrapper, {
|
|
217
222
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Calendar, {
|
|
218
|
-
size: "
|
|
223
|
+
size: "".concat(iconSize, "px")
|
|
219
224
|
})
|
|
220
225
|
})]
|
|
221
226
|
})
|
|
222
|
-
})
|
|
227
|
+
}), !open && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TooltipOverflow.default, {
|
|
228
|
+
input: inputRef,
|
|
229
|
+
withArrow: true,
|
|
230
|
+
maxWidth: "100%",
|
|
231
|
+
size: _types.Size.Small,
|
|
232
|
+
align: "end",
|
|
233
|
+
children: getFormattedValue()
|
|
234
|
+
})]
|
|
223
235
|
})
|
|
224
236
|
})
|
|
225
237
|
}), validationMessage && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styling.ErrorMessage, {
|