@laerdal/life-react-components 1.8.0-dev.9 → 1.9.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/Button/Button.cjs +4 -4
- package/dist/Button/Button.cjs.map +1 -1
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.js +4 -4
- package/dist/Button/Button.js.map +1 -1
- package/dist/Button/DualFunctionButton.cjs +1 -1
- package/dist/Button/DualFunctionButton.cjs.map +1 -1
- package/dist/Button/DualFunctionButton.js +1 -1
- package/dist/Button/DualFunctionButton.js.map +1 -1
- package/dist/Button/Iconbutton.cjs +8 -2
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.d.ts +3 -0
- package/dist/Button/Iconbutton.js +8 -2
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/Chips/ChipStyles.cjs +1 -1
- package/dist/Chips/ChipStyles.cjs.map +1 -1
- package/dist/Chips/ChipStyles.js +1 -1
- package/dist/Chips/ChipStyles.js.map +1 -1
- package/dist/Chips/ChipTypes.d.ts +3 -3
- package/dist/Chips/ChoiceChips.cjs +1 -1
- package/dist/Chips/ChoiceChips.cjs.map +1 -1
- package/dist/Chips/ChoiceChips.js +1 -1
- package/dist/Chips/ChoiceChips.js.map +1 -1
- package/dist/Chips/FilterChip.cjs +2 -2
- package/dist/Chips/FilterChip.cjs.map +1 -1
- package/dist/Chips/FilterChip.js +2 -2
- package/dist/Chips/FilterChip.js.map +1 -1
- package/dist/Chips/InputChip.cjs.map +1 -1
- package/dist/Chips/InputChip.js +1 -1
- package/dist/Chips/InputChip.js.map +1 -1
- package/dist/ChipsInput/ChipDropdownInput.cjs +1 -3
- package/dist/ChipsInput/ChipDropdownInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipDropdownInput.js +2 -4
- package/dist/ChipsInput/ChipDropdownInput.js.map +1 -1
- package/dist/ChipsInput/ChipInput.cjs +0 -2
- package/dist/ChipsInput/ChipInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipInput.js +0 -2
- package/dist/ChipsInput/ChipInput.js.map +1 -1
- package/dist/ChipsInput/ChipInputField.cjs +6 -16
- package/dist/ChipsInput/ChipInputField.cjs.map +1 -1
- package/dist/ChipsInput/ChipInputField.d.ts +0 -1
- package/dist/ChipsInput/ChipInputField.js +8 -18
- package/dist/ChipsInput/ChipInputField.js.map +1 -1
- package/dist/ChipsInput/ChipInputTypes.d.ts +0 -1
- package/dist/Dropdown/BasicDropdown.cjs +9 -11
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.d.ts +2 -2
- package/dist/Dropdown/BasicDropdown.js +10 -12
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/CommonStyling.cjs +4 -4
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.d.ts +3 -6
- package/dist/Dropdown/CommonStyling.js +4 -4
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +23 -21
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.d.ts +3 -3
- package/dist/Dropdown/DropdownFilter.js +24 -22
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +107 -176
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.d.ts +13 -27
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js +106 -176
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
- package/dist/GlobalNavigationBar/Logo.cjs +3 -5
- package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
- package/dist/GlobalNavigationBar/Logo.js +1 -1
- package/dist/GlobalNavigationBar/Logo.js.map +1 -1
- package/dist/GlobalNavigationBar/NavigationHelper.cjs +38 -0
- package/dist/GlobalNavigationBar/NavigationHelper.cjs.map +1 -0
- package/dist/GlobalNavigationBar/NavigationHelper.d.ts +4 -0
- package/dist/GlobalNavigationBar/NavigationHelper.js +27 -0
- package/dist/GlobalNavigationBar/NavigationHelper.js.map +1 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +129 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.d.ts +15 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js +99 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js.map +1 -0
- package/dist/GlobalNavigationBar/{ExtendedMainMenu.cjs → desktop/ExtendedMainMenu.cjs} +7 -9
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/{ExtendedMainMenu.d.ts → desktop/ExtendedMainMenu.d.ts} +2 -2
- package/dist/GlobalNavigationBar/{ExtendedMainMenu.js → desktop/ExtendedMainMenu.js} +6 -6
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/{MainMenu.cjs → desktop/MainMenu.cjs} +17 -21
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +8 -0
- package/dist/GlobalNavigationBar/{MainMenu.js → desktop/MainMenu.js} +17 -21
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/{RightSideNav.cjs → desktop/RightSideNav.cjs} +22 -26
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/RightSideNav.d.ts +8 -0
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js +59 -0
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +1 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +204 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.d.ts +7 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.js +163 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/index.cjs +15 -18
- package/dist/GlobalNavigationBar/index.cjs.map +1 -1
- package/dist/GlobalNavigationBar/index.d.ts +2 -2
- package/dist/GlobalNavigationBar/index.js +2 -2
- package/dist/GlobalNavigationBar/index.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs +15 -21
- package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/CommonStyles.d.ts +3 -6
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js +14 -15
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs +117 -221
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.d.ts +6 -25
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js +116 -216
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs +221 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.d.ts +11 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js +184 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs +160 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.d.ts +12 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js +139 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js.map +1 -0
- package/dist/GlobalNavigationBar/types.cjs +6 -0
- package/dist/GlobalNavigationBar/types.cjs.map +1 -0
- package/dist/GlobalNavigationBar/types.d.ts +120 -0
- package/dist/GlobalNavigationBar/types.js +2 -0
- package/dist/GlobalNavigationBar/types.js.map +1 -0
- package/dist/InputFields/Checkbox.cjs +10 -10
- package/dist/InputFields/Checkbox.cjs.map +1 -1
- package/dist/InputFields/Checkbox.d.ts +3 -3
- package/dist/InputFields/Checkbox.js +10 -10
- package/dist/InputFields/Checkbox.js.map +1 -1
- package/dist/InputFields/DatepickerField.cjs +15 -17
- package/dist/InputFields/DatepickerField.cjs.map +1 -1
- package/dist/InputFields/DatepickerField.d.ts +3 -3
- package/dist/InputFields/DatepickerField.js +15 -21
- package/dist/InputFields/DatepickerField.js.map +1 -1
- package/dist/InputFields/Label.cjs +24 -14
- package/dist/InputFields/Label.cjs.map +1 -1
- package/dist/InputFields/Label.js +24 -16
- package/dist/InputFields/Label.js.map +1 -1
- package/dist/InputFields/NumberField.cjs +20 -8
- package/dist/InputFields/NumberField.cjs.map +1 -1
- package/dist/InputFields/NumberField.js +21 -9
- package/dist/InputFields/NumberField.js.map +1 -1
- package/dist/InputFields/PasswordField.cjs +23 -18
- package/dist/InputFields/PasswordField.cjs.map +1 -1
- package/dist/InputFields/PasswordField.d.ts +2 -3
- package/dist/InputFields/PasswordField.js +21 -16
- package/dist/InputFields/PasswordField.js.map +1 -1
- package/dist/InputFields/QuickSearch.cjs +2 -3
- package/dist/InputFields/QuickSearch.cjs.map +1 -1
- package/dist/InputFields/QuickSearch.js +2 -3
- package/dist/InputFields/QuickSearch.js.map +1 -1
- package/dist/InputFields/RadioButton.cjs +5 -7
- package/dist/InputFields/RadioButton.cjs.map +1 -1
- package/dist/InputFields/RadioButton.d.ts +1 -1
- package/dist/InputFields/RadioButton.js +5 -5
- package/dist/InputFields/RadioButton.js.map +1 -1
- package/dist/InputFields/SearchBar.cjs +2 -2
- package/dist/InputFields/SearchBar.cjs.map +1 -1
- package/dist/InputFields/SearchBar.js +3 -3
- package/dist/InputFields/SearchBar.js.map +1 -1
- package/dist/InputFields/TextField.cjs +35 -40
- package/dist/InputFields/TextField.cjs.map +1 -1
- package/dist/InputFields/TextField.d.ts +6 -6
- package/dist/InputFields/TextField.js +35 -41
- package/dist/InputFields/TextField.js.map +1 -1
- package/dist/InputFields/Textarea.cjs +26 -31
- package/dist/InputFields/Textarea.cjs.map +1 -1
- package/dist/InputFields/Textarea.d.ts +1 -12
- package/dist/InputFields/Textarea.js +31 -33
- package/dist/InputFields/Textarea.js.map +1 -1
- package/dist/InputFields/components/SearchBarInput.cjs +1 -1
- package/dist/InputFields/components/SearchBarInput.cjs.map +1 -1
- package/dist/InputFields/components/SearchBarInput.js +1 -1
- package/dist/InputFields/components/SearchBarInput.js.map +1 -1
- package/dist/InputFields/components/SearchField.cjs +1 -3
- package/dist/InputFields/components/SearchField.cjs.map +1 -1
- package/dist/InputFields/components/SearchField.js +1 -2
- package/dist/InputFields/components/SearchField.js.map +1 -1
- package/dist/InputFields/styling.cjs +22 -28
- package/dist/InputFields/styling.cjs.map +1 -1
- package/dist/InputFields/styling.d.ts +7 -7
- package/dist/InputFields/styling.js +19 -23
- package/dist/InputFields/styling.js.map +1 -1
- package/dist/InputFields/types.cjs +6 -0
- package/dist/InputFields/types.cjs.map +1 -0
- package/dist/InputFields/types.d.ts +38 -0
- package/dist/InputFields/types.js +2 -0
- package/dist/InputFields/types.js.map +1 -0
- package/dist/MenuItem/MenuItem.cjs +26 -11
- package/dist/MenuItem/MenuItem.cjs.map +1 -1
- package/dist/MenuItem/MenuItem.d.ts +6 -4
- package/dist/MenuItem/MenuItem.js +26 -11
- package/dist/MenuItem/MenuItem.js.map +1 -1
- package/dist/MenuItem/index.cjs.map +1 -1
- package/dist/MenuItem/index.js.map +1 -1
- package/dist/Modals/ModalNote.cjs +1 -1
- package/dist/Modals/ModalNote.cjs.map +1 -1
- package/dist/Modals/ModalNote.js +2 -2
- package/dist/Modals/ModalNote.js.map +1 -1
- package/dist/Popover/Popover.cjs +49 -31
- package/dist/Popover/Popover.cjs.map +1 -1
- package/dist/Popover/Popover.d.ts +2 -2
- package/dist/Popover/Popover.js +49 -32
- package/dist/Popover/Popover.js.map +1 -1
- package/dist/ProfileButton/ProfileButton.cjs +105 -0
- package/dist/ProfileButton/ProfileButton.cjs.map +1 -0
- package/dist/ProfileButton/ProfileButton.d.ts +14 -0
- package/dist/ProfileButton/ProfileButton.js +79 -0
- package/dist/ProfileButton/ProfileButton.js.map +1 -0
- package/dist/ProfileButton/index.cjs +16 -0
- package/dist/ProfileButton/index.cjs.map +1 -0
- package/dist/ProfileButton/index.d.ts +1 -0
- package/dist/ProfileButton/index.js +2 -0
- package/dist/ProfileButton/index.js.map +1 -0
- package/dist/QuizButton/QuizButton.cjs +1 -1
- package/dist/QuizButton/QuizButton.cjs.map +1 -1
- package/dist/QuizButton/QuizButton.js +1 -1
- package/dist/QuizButton/QuizButton.js.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.cjs +24 -78
- package/dist/Switcher/MobileSwitcherMenu.cjs.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.d.ts +6 -5
- package/dist/Switcher/MobileSwitcherMenu.js +26 -70
- package/dist/Switcher/MobileSwitcherMenu.js.map +1 -1
- package/dist/Table/Table.cjs +22 -22
- package/dist/Table/Table.cjs.map +1 -1
- package/dist/Table/Table.js +22 -22
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.cjs +1 -1
- package/dist/Table/TableBody.cjs.map +1 -1
- package/dist/Table/TableBody.js +1 -1
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Tabs/TabLink.cjs +2 -3
- package/dist/Tabs/TabLink.cjs.map +1 -1
- package/dist/Tabs/TabLink.d.ts +1 -2
- package/dist/Tabs/TabLink.js +2 -3
- package/dist/Tabs/TabLink.js.map +1 -1
- package/dist/Tile/TileBody.cjs +1 -1
- package/dist/Tile/TileBody.cjs.map +1 -1
- package/dist/Tile/TileBody.js +1 -1
- package/dist/Tile/TileBody.js.map +1 -1
- package/dist/Tile/TileCommonItems.cjs +1 -1
- package/dist/Tile/TileCommonItems.cjs.map +1 -1
- package/dist/Tile/TileCommonItems.js +1 -1
- package/dist/Tile/TileCommonItems.js.map +1 -1
- package/dist/Tile/TileFooter.cjs +1 -1
- package/dist/Tile/TileFooter.cjs.map +1 -1
- package/dist/Tile/TileFooter.js +1 -1
- package/dist/Tile/TileFooter.js.map +1 -1
- package/dist/Tile/TileHeader.cjs +1 -1
- package/dist/Tile/TileHeader.cjs.map +1 -1
- package/dist/Tile/TileHeader.js +2 -2
- package/dist/Tile/TileHeader.js.map +1 -1
- package/dist/common/StackState.cjs +47 -0
- package/dist/common/StackState.cjs.map +1 -0
- package/dist/common/StackState.d.ts +7 -0
- package/dist/common/StackState.js +30 -0
- package/dist/common/StackState.js.map +1 -0
- package/dist/hooks/useClickOutside.cjs +6 -2
- package/dist/hooks/useClickOutside.cjs.map +1 -1
- package/dist/hooks/useClickOutside.d.ts +1 -1
- package/dist/hooks/useClickOutside.js +6 -2
- package/dist/hooks/useClickOutside.js.map +1 -1
- package/dist/icons/contenticons/ContentIcons.cjs +3214 -3182
- package/dist/icons/contenticons/ContentIcons.cjs.map +1 -1
- package/dist/icons/contenticons/ContentIcons.d.ts +17 -0
- package/dist/icons/contenticons/ContentIcons.js +3341 -3365
- package/dist/icons/contenticons/ContentIcons.js.map +1 -1
- package/dist/icons/index.cjs +22 -69
- package/dist/icons/index.cjs.map +1 -1
- package/dist/icons/index.d.ts +1 -4
- package/dist/icons/index.js +19 -64
- package/dist/icons/index.js.map +1 -1
- package/dist/icons/systemicons/SystemIcons.cjs +3216 -2433
- package/dist/icons/systemicons/SystemIcons.cjs.map +1 -1
- package/dist/icons/systemicons/SystemIcons.d.ts +12 -2
- package/dist/icons/systemicons/SystemIcons.js +3016 -2267
- package/dist/icons/systemicons/SystemIcons.js.map +1 -1
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/colors.cjs +1 -0
- package/dist/styles/colors.cjs.map +1 -1
- package/dist/styles/colors.d.ts +1 -0
- package/dist/styles/colors.js +1 -0
- package/dist/styles/colors.js.map +1 -1
- package/dist/types.cjs +20 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +10 -31
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -1
- package/package.json +13 -9
- package/dist/GlobalNavigationBar/Actions.cjs +0 -185
- package/dist/GlobalNavigationBar/Actions.cjs.map +0 -1
- package/dist/GlobalNavigationBar/Actions.d.ts +0 -13
- package/dist/GlobalNavigationBar/Actions.js +0 -160
- package/dist/GlobalNavigationBar/Actions.js.map +0 -1
- package/dist/GlobalNavigationBar/Avatar.cjs +0 -104
- package/dist/GlobalNavigationBar/Avatar.cjs.map +0 -1
- package/dist/GlobalNavigationBar/Avatar.d.ts +0 -15
- package/dist/GlobalNavigationBar/Avatar.js +0 -77
- package/dist/GlobalNavigationBar/Avatar.js.map +0 -1
- package/dist/GlobalNavigationBar/ExtendedMainMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/ExtendedMainMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/MainMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/MainMenu.d.ts +0 -8
- package/dist/GlobalNavigationBar/MainMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/RightSideNav.cjs.map +0 -1
- package/dist/GlobalNavigationBar/RightSideNav.d.ts +0 -8
- package/dist/GlobalNavigationBar/RightSideNav.js +0 -61
- package/dist/GlobalNavigationBar/RightSideNav.js.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs +0 -112
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.d.ts +0 -11
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.js +0 -86
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.js.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs +0 -178
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.d.ts +0 -16
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js +0 -146
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs +0 -168
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.d.ts +0 -15
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.js +0 -135
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs +0 -49
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs.map +0 -1
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.d.ts +0 -6
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js +0 -27
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs +0 -91
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.d.ts +0 -13
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js +0 -70
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useNavigationHelper = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactRouterDom = require("react-router-dom");
|
|
9
|
+
|
|
10
|
+
var _reactRouter = require("react-router");
|
|
11
|
+
|
|
12
|
+
var useNavigationHelper = function useNavigationHelper() {
|
|
13
|
+
var history = (0, _reactRouter.useHistory)();
|
|
14
|
+
var location = (0, _reactRouterDom.useLocation)();
|
|
15
|
+
|
|
16
|
+
var navigate = function navigate(url, isExternal) {
|
|
17
|
+
if (isExternal) {
|
|
18
|
+
window.location.href = url;
|
|
19
|
+
} else {
|
|
20
|
+
history.push(url);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var isActiveRoute = function isActiveRoute(url, exact) {
|
|
25
|
+
return !!(0, _reactRouterDom.matchPath)(location.pathname, {
|
|
26
|
+
exact: exact,
|
|
27
|
+
path: url
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
navigate: navigate,
|
|
33
|
+
isActiveRoute: isActiveRoute
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.useNavigationHelper = useNavigationHelper;
|
|
38
|
+
//# sourceMappingURL=NavigationHelper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/GlobalNavigationBar/NavigationHelper.ts"],"names":["useNavigationHelper","history","location","navigate","url","isExternal","window","href","push","isActiveRoute","exact","pathname","path"],"mappings":";;;;;;;AAAA;;AACA;;AAGO,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAsB,GAAM;AACvC,MAAMC,OAAO,GAAG,8BAAhB;AACA,MAAMC,QAAQ,GAAG,kCAAjB;;AAEA,MAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,GAAD,EAAcC,UAAd,EAAsC;AACrD,QAAIA,UAAJ,EAAgB;AACdC,MAAAA,MAAM,CAACJ,QAAP,CAAgBK,IAAhB,GAAuBH,GAAvB;AACD,KAFD,MAEO;AACLH,MAAAA,OAAO,CAACO,IAAR,CAAaJ,GAAb;AACD;AACF,GAND;;AAQA,MAAMK,aAAa,GAAG,SAAhBA,aAAgB,CAACL,GAAD,EAAcM,KAAd;AAAA,WACpB,CAAC,CAAC,+BAAUR,QAAQ,CAACS,QAAnB,EAA6B;AAC7BD,MAAAA,KAAK,EAAEA,KADsB;AAE7BE,MAAAA,IAAI,EAAER;AAFuB,KAA7B,CADkB;AAAA,GAAtB;;AAMA,SAAO;AAACD,IAAAA,QAAQ,EAARA,QAAD;AAAWM,IAAAA,aAAa,EAAbA;AAAX,GAAP;AACD,CAnBM","sourcesContent":["import {matchPath, useLocation} from 'react-router-dom';\nimport {useHistory} from 'react-router';\n\n\nexport const useNavigationHelper = () => {\n const history = useHistory();\n const location = useLocation();\n\n const navigate = (url: string, isExternal: boolean) => {\n if (isExternal) {\n window.location.href = url;\n } else {\n history.push(url);\n }\n };\n\n const isActiveRoute = (url: string, exact: boolean): boolean =>\n !!matchPath(location.pathname, {\n exact: exact,\n path: url\n });\n\n return {navigate, isActiveRoute};\n}\n"],"file":"NavigationHelper.cjs"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { matchPath, useLocation } from 'react-router-dom';
|
|
2
|
+
import { useHistory } from 'react-router';
|
|
3
|
+
export var useNavigationHelper = function useNavigationHelper() {
|
|
4
|
+
var history = useHistory();
|
|
5
|
+
var location = useLocation();
|
|
6
|
+
|
|
7
|
+
var navigate = function navigate(url, isExternal) {
|
|
8
|
+
if (isExternal) {
|
|
9
|
+
window.location.href = url;
|
|
10
|
+
} else {
|
|
11
|
+
history.push(url);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var isActiveRoute = function isActiveRoute(url, exact) {
|
|
16
|
+
return !!matchPath(location.pathname, {
|
|
17
|
+
exact: exact,
|
|
18
|
+
path: url
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
navigate: navigate,
|
|
24
|
+
isActiveRoute: isActiveRoute
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=NavigationHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/GlobalNavigationBar/NavigationHelper.ts"],"names":["matchPath","useLocation","useHistory","useNavigationHelper","history","location","navigate","url","isExternal","window","href","push","isActiveRoute","exact","pathname","path"],"mappings":"AAAA,SAAQA,SAAR,EAAmBC,WAAnB,QAAqC,kBAArC;AACA,SAAQC,UAAR,QAAyB,cAAzB;AAGA,OAAO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,GAAM;AACvC,MAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,MAAMG,QAAQ,GAAGJ,WAAW,EAA5B;;AAEA,MAAMK,QAAQ,GAAG,SAAXA,QAAW,CAACC,GAAD,EAAcC,UAAd,EAAsC;AACrD,QAAIA,UAAJ,EAAgB;AACdC,MAAAA,MAAM,CAACJ,QAAP,CAAgBK,IAAhB,GAAuBH,GAAvB;AACD,KAFD,MAEO;AACLH,MAAAA,OAAO,CAACO,IAAR,CAAaJ,GAAb;AACD;AACF,GAND;;AAQA,MAAMK,aAAa,GAAG,SAAhBA,aAAgB,CAACL,GAAD,EAAcM,KAAd;AAAA,WACpB,CAAC,CAACb,SAAS,CAACK,QAAQ,CAACS,QAAV,EAAoB;AAC7BD,MAAAA,KAAK,EAAEA,KADsB;AAE7BE,MAAAA,IAAI,EAAER;AAFuB,KAApB,CADS;AAAA,GAAtB;;AAMA,SAAO;AAACD,IAAAA,QAAQ,EAARA,QAAD;AAAWM,IAAAA,aAAa,EAAbA;AAAX,GAAP;AACD,CAnBM","sourcesContent":["import {matchPath, useLocation} from 'react-router-dom';\nimport {useHistory} from 'react-router';\n\n\nexport const useNavigationHelper = () => {\n const history = useHistory();\n const location = useLocation();\n\n const navigate = (url: string, isExternal: boolean) => {\n if (isExternal) {\n window.location.href = url;\n } else {\n history.push(url);\n }\n };\n\n const isActiveRoute = (url: string, exact: boolean): boolean =>\n !!matchPath(location.pathname, {\n exact: exact,\n path: url\n });\n\n return {navigate, isActiveRoute};\n}\n"],"file":"NavigationHelper.js"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
|
+
|
|
22
|
+
var _Button = require("../../Button");
|
|
23
|
+
|
|
24
|
+
var _SystemIcons = require("../../icons/systemicons/SystemIcons");
|
|
25
|
+
|
|
26
|
+
var _ProfileButton = require("../../ProfileButton");
|
|
27
|
+
|
|
28
|
+
var _icons = require("../../icons");
|
|
29
|
+
|
|
30
|
+
var _styles = require("../../styles");
|
|
31
|
+
|
|
32
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
+
|
|
34
|
+
var _templateObject;
|
|
35
|
+
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
+
|
|
38
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
+
|
|
40
|
+
var Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n \n display: none;\n ", "{\n display: flex;\n }\n"])), _styles.BREAKPOINTS.MEDIUM);
|
|
41
|
+
|
|
42
|
+
var DesktopActions = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
43
|
+
var buttons = _ref.buttons,
|
|
44
|
+
user = _ref.user,
|
|
45
|
+
onShowUserMenu = _ref.onShowUserMenu;
|
|
46
|
+
|
|
47
|
+
var _React$useState = _react.default.useState([]),
|
|
48
|
+
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
49
|
+
elRefs = _React$useState2[0],
|
|
50
|
+
setElRefs = _React$useState2[1];
|
|
51
|
+
|
|
52
|
+
var length = (buttons === null || buttons === void 0 ? void 0 : buttons.length) || 0;
|
|
53
|
+
|
|
54
|
+
_react.default.useEffect(function () {
|
|
55
|
+
setElRefs(Array(length || 0).fill(null).map(function () {
|
|
56
|
+
return /*#__PURE__*/_react.default.createRef();
|
|
57
|
+
}));
|
|
58
|
+
}, [length]);
|
|
59
|
+
|
|
60
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
61
|
+
return {
|
|
62
|
+
buttons: elRefs.map(function (r, index) {
|
|
63
|
+
return {
|
|
64
|
+
ref: r,
|
|
65
|
+
type: buttons === null || buttons === void 0 ? void 0 : buttons[index].type
|
|
66
|
+
};
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
}, [elRefs, buttons]);
|
|
70
|
+
|
|
71
|
+
var renderItem = function renderItem(item, index) {
|
|
72
|
+
var _user$firstName$charA, _user$firstName, _user$lastName$charAt, _user$lastName;
|
|
73
|
+
|
|
74
|
+
switch (item.type) {
|
|
75
|
+
case 'profile':
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileButton.ProfileButton, {
|
|
77
|
+
ref: elRefs[index],
|
|
78
|
+
hideOnLowWidth: true,
|
|
79
|
+
onClick: function onClick(e) {
|
|
80
|
+
item.action ? item.action(e === null || e === void 0 ? void 0 : e.target) : onShowUserMenu();
|
|
81
|
+
},
|
|
82
|
+
icon: !user && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SystemIcons.User, {}),
|
|
83
|
+
initials: ((_user$firstName$charA = user === null || user === void 0 ? void 0 : (_user$firstName = user.firstName) === null || _user$firstName === void 0 ? void 0 : _user$firstName.charAt(0)) !== null && _user$firstName$charA !== void 0 ? _user$firstName$charA : '') + ((_user$lastName$charAt = user === null || user === void 0 ? void 0 : (_user$lastName = user.lastName) === null || _user$lastName === void 0 ? void 0 : _user$lastName.charAt(0)) !== null && _user$lastName$charAt !== void 0 ? _user$lastName$charAt : '')
|
|
84
|
+
}, index);
|
|
85
|
+
|
|
86
|
+
case 'action':
|
|
87
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
88
|
+
ref: elRefs[index],
|
|
89
|
+
variant: 'secondary',
|
|
90
|
+
shape: 'circular',
|
|
91
|
+
disabled: item.disabled,
|
|
92
|
+
hideOnLowWidth: true,
|
|
93
|
+
action: function action(e) {
|
|
94
|
+
item.action && item.action(e === null || e === void 0 ? void 0 : e.target);
|
|
95
|
+
},
|
|
96
|
+
children: item.icon
|
|
97
|
+
}, index);
|
|
98
|
+
|
|
99
|
+
case 'switcher':
|
|
100
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
101
|
+
ref: elRefs[index],
|
|
102
|
+
variant: 'secondary',
|
|
103
|
+
shape: 'circular',
|
|
104
|
+
hideOnLowWidth: true,
|
|
105
|
+
id: "globalNavAppsButton",
|
|
106
|
+
action: function action(e) {
|
|
107
|
+
return item.action && item.action(e === null || e === void 0 ? void 0 : e.target);
|
|
108
|
+
},
|
|
109
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.SwitchApp, {
|
|
110
|
+
size: "24px"
|
|
111
|
+
})
|
|
112
|
+
}, index);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
|
|
117
|
+
children: buttons === null || buttons === void 0 ? void 0 : buttons.map(function (item, index) {
|
|
118
|
+
return renderItem(item, index);
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
DesktopActions.propTypes = {
|
|
124
|
+
buttons: _propTypes.default.array,
|
|
125
|
+
onShowUserMenu: _propTypes.default.func.isRequired
|
|
126
|
+
};
|
|
127
|
+
var _default = DesktopActions;
|
|
128
|
+
exports.default = _default;
|
|
129
|
+
//# sourceMappingURL=DesktopActions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GlobalNavigationBar/desktop/DesktopActions.tsx"],"names":["Wrapper","styled","div","BREAKPOINTS","MEDIUM","DesktopActions","React","forwardRef","ref","buttons","user","onShowUserMenu","useState","elRefs","setElRefs","length","useEffect","Array","fill","map","createRef","r","index","type","renderItem","item","e","action","target","firstName","charAt","lastName","disabled","icon"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,OAAO,GAAGC,0BAAOC,G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Y,UAAA,EAAE,EAAC,qBALf;AAMY,UAAA,MAAM,EAAE,gBAAAI,CAAC;AAAA,mBAAID,IAAI,CAACE,MAAL,IAAeF,IAAI,CAACE,MAAL,CAAYD,CAAZ,aAAYA,CAAZ,uBAAYA,CAAC,CAAEE,MAAf,CAAnB;AAAA,WANrB;AAAA,iCAOL,qBAAC,sBAAD;AAAW,YAAA,IAAI,EAAC;AAAhB;AAPK,WAAiBN,KAAjB,CAAP;AAvBJ;AAiCD,GAlCD;;AAoCA,sBACE,qBAAC,OAAD;AAAA,cACGb,OADH,aACGA,OADH,uBACGA,OAAO,CAAEU,GAAT,CAAa,UAACM,IAAD,EAAOH,KAAP;AAAA,aAAiBE,UAAU,CAACC,IAAD,EAAOH,KAAP,CAA3B;AAAA,KAAb;AADH,IADF;AAKD,CA9DsB,CAAvB;;;AATEb,EAAAA,O;AAEAE,EAAAA,c;;eAwEaN,c","sourcesContent":["import React, {useImperativeHandle} from 'react';\nimport styled from 'styled-components';\nimport {MenuAccountInfo, MobileMenuButtonTypes, MenuIconButton, DesktopMenuButtonTypes} from '../types';\nimport {IconButton} from '../../Button';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {ProfileButton} from '../../ProfileButton';\nimport {SystemIcons} from '../../icons';\nimport {BREAKPOINTS} from '../../styles';\n\nconst Wrapper = styled.div`\n align-items: center;\n \n display: none;\n ${BREAKPOINTS.MEDIUM}{\n display: flex;\n }\n`;\n\n\ninterface DesktopActionsProps {\n buttons?: DesktopMenuButtonTypes[];\n user?: MenuAccountInfo;\n onShowUserMenu: () => void;\n}\n\nexport interface DesktopActionsRef {\n buttons?: { ref: React.MutableRefObject<HTMLButtonElement | null>, type: 'profile' | 'action' | 'switcher' | undefined }[]\n}\n\nconst DesktopActions = React.forwardRef(({\n buttons,\n user,\n onShowUserMenu\n }: DesktopActionsProps, ref: React.Ref<DesktopActionsRef>) => {\n\n const [elRefs, setElRefs] = React.useState<React.RefObject<HTMLButtonElement>[]>([]);\n\n const length = buttons?.length || 0;\n\n React.useEffect(() => {\n setElRefs(Array(length || 0).fill(null).map(() => React.createRef<HTMLButtonElement>()));\n }, [length]);\n\n useImperativeHandle(ref, () => ({\n buttons: elRefs.map((r, index) => ({\n ref: r,\n type: buttons?.[index].type\n }))\n }), [elRefs, buttons]);\n\n const renderItem = (item: MobileMenuButtonTypes, index: number) => {\n switch (item.type) {\n case 'profile':\n return <ProfileButton key={index}\n ref={elRefs[index]}\n hideOnLowWidth={true}\n onClick={e => {\n item.action ? item.action(e?.target) : onShowUserMenu()\n }}\n icon={!user && <SystemIcons.User/>}\n initials={(user?.firstName?.charAt(0) ?? '') + (user?.lastName?.charAt(0) ?? '')}/>\n case 'action':\n return <IconButton key={index}\n ref={elRefs[index]}\n variant={'secondary'}\n shape={'circular'}\n disabled={item.disabled}\n hideOnLowWidth={true}\n action={e => {\n item.action && item.action(e?.target);\n }}>\n {item.icon}\n </IconButton>\n case 'switcher':\n return <IconButton key={index}\n ref={elRefs[index]}\n variant={'secondary'}\n shape={'circular'}\n hideOnLowWidth={true}\n id=\"globalNavAppsButton\"\n action={e => item.action && item.action(e?.target)}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n }\n }\n\n return (\n <Wrapper>\n {buttons?.map((item, index) => renderItem(item, index))}\n </Wrapper>\n )\n});\n\n\nexport default DesktopActions;\n"],"file":"DesktopActions.cjs"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuAccountInfo, DesktopMenuButtonTypes } from '../types';
|
|
3
|
+
interface DesktopActionsProps {
|
|
4
|
+
buttons?: DesktopMenuButtonTypes[];
|
|
5
|
+
user?: MenuAccountInfo;
|
|
6
|
+
onShowUserMenu: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface DesktopActionsRef {
|
|
9
|
+
buttons?: {
|
|
10
|
+
ref: React.MutableRefObject<HTMLButtonElement | null>;
|
|
11
|
+
type: 'profile' | 'action' | 'switcher' | undefined;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
declare const DesktopActions: React.ForwardRefExoticComponent<DesktopActionsProps & React.RefAttributes<DesktopActionsRef>>;
|
|
15
|
+
export default DesktopActions;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
3
|
+
import _pt from "prop-types";
|
|
4
|
+
|
|
5
|
+
var _templateObject;
|
|
6
|
+
|
|
7
|
+
import React, { useImperativeHandle } from 'react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { IconButton } from '../../Button';
|
|
10
|
+
import { SwitchApp } from '../../icons/systemicons/SystemIcons';
|
|
11
|
+
import { ProfileButton } from '../../ProfileButton';
|
|
12
|
+
import { SystemIcons } from '../../icons';
|
|
13
|
+
import { BREAKPOINTS } from '../../styles';
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n \n display: none;\n ", "{\n display: flex;\n }\n"])), BREAKPOINTS.MEDIUM);
|
|
16
|
+
var DesktopActions = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
17
|
+
var buttons = _ref.buttons,
|
|
18
|
+
user = _ref.user,
|
|
19
|
+
onShowUserMenu = _ref.onShowUserMenu;
|
|
20
|
+
|
|
21
|
+
var _React$useState = React.useState([]),
|
|
22
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23
|
+
elRefs = _React$useState2[0],
|
|
24
|
+
setElRefs = _React$useState2[1];
|
|
25
|
+
|
|
26
|
+
var length = (buttons === null || buttons === void 0 ? void 0 : buttons.length) || 0;
|
|
27
|
+
React.useEffect(function () {
|
|
28
|
+
setElRefs(Array(length || 0).fill(null).map(function () {
|
|
29
|
+
return /*#__PURE__*/React.createRef();
|
|
30
|
+
}));
|
|
31
|
+
}, [length]);
|
|
32
|
+
useImperativeHandle(ref, function () {
|
|
33
|
+
return {
|
|
34
|
+
buttons: elRefs.map(function (r, index) {
|
|
35
|
+
return {
|
|
36
|
+
ref: r,
|
|
37
|
+
type: buttons === null || buttons === void 0 ? void 0 : buttons[index].type
|
|
38
|
+
};
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
}, [elRefs, buttons]);
|
|
42
|
+
|
|
43
|
+
var renderItem = function renderItem(item, index) {
|
|
44
|
+
var _user$firstName$charA, _user$firstName, _user$lastName$charAt, _user$lastName;
|
|
45
|
+
|
|
46
|
+
switch (item.type) {
|
|
47
|
+
case 'profile':
|
|
48
|
+
return /*#__PURE__*/_jsx(ProfileButton, {
|
|
49
|
+
ref: elRefs[index],
|
|
50
|
+
hideOnLowWidth: true,
|
|
51
|
+
onClick: function onClick(e) {
|
|
52
|
+
item.action ? item.action(e === null || e === void 0 ? void 0 : e.target) : onShowUserMenu();
|
|
53
|
+
},
|
|
54
|
+
icon: !user && /*#__PURE__*/_jsx(SystemIcons.User, {}),
|
|
55
|
+
initials: ((_user$firstName$charA = user === null || user === void 0 ? void 0 : (_user$firstName = user.firstName) === null || _user$firstName === void 0 ? void 0 : _user$firstName.charAt(0)) !== null && _user$firstName$charA !== void 0 ? _user$firstName$charA : '') + ((_user$lastName$charAt = user === null || user === void 0 ? void 0 : (_user$lastName = user.lastName) === null || _user$lastName === void 0 ? void 0 : _user$lastName.charAt(0)) !== null && _user$lastName$charAt !== void 0 ? _user$lastName$charAt : '')
|
|
56
|
+
}, index);
|
|
57
|
+
|
|
58
|
+
case 'action':
|
|
59
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
60
|
+
ref: elRefs[index],
|
|
61
|
+
variant: 'secondary',
|
|
62
|
+
shape: 'circular',
|
|
63
|
+
disabled: item.disabled,
|
|
64
|
+
hideOnLowWidth: true,
|
|
65
|
+
action: function action(e) {
|
|
66
|
+
item.action && item.action(e === null || e === void 0 ? void 0 : e.target);
|
|
67
|
+
},
|
|
68
|
+
children: item.icon
|
|
69
|
+
}, index);
|
|
70
|
+
|
|
71
|
+
case 'switcher':
|
|
72
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
73
|
+
ref: elRefs[index],
|
|
74
|
+
variant: 'secondary',
|
|
75
|
+
shape: 'circular',
|
|
76
|
+
hideOnLowWidth: true,
|
|
77
|
+
id: "globalNavAppsButton",
|
|
78
|
+
action: function action(e) {
|
|
79
|
+
return item.action && item.action(e === null || e === void 0 ? void 0 : e.target);
|
|
80
|
+
},
|
|
81
|
+
children: /*#__PURE__*/_jsx(SwitchApp, {
|
|
82
|
+
size: "24px"
|
|
83
|
+
})
|
|
84
|
+
}, index);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return /*#__PURE__*/_jsx(Wrapper, {
|
|
89
|
+
children: buttons === null || buttons === void 0 ? void 0 : buttons.map(function (item, index) {
|
|
90
|
+
return renderItem(item, index);
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
DesktopActions.propTypes = {
|
|
95
|
+
buttons: _pt.array,
|
|
96
|
+
onShowUserMenu: _pt.func.isRequired
|
|
97
|
+
};
|
|
98
|
+
export default DesktopActions;
|
|
99
|
+
//# sourceMappingURL=DesktopActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GlobalNavigationBar/desktop/DesktopActions.tsx"],"names":["React","useImperativeHandle","styled","IconButton","SwitchApp","ProfileButton","SystemIcons","BREAKPOINTS","Wrapper","div","MEDIUM","DesktopActions","forwardRef","ref","buttons","user","onShowUserMenu","useState","elRefs","setElRefs","length","useEffect","Array","fill","map","createRef","r","index","type","renderItem","item","e","action","target","firstName","charAt","lastName","disabled","icon"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAeC,mBAAf,QAAyC,OAAzC;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AAEA,SAAQC,UA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H,IAAI,CAACQ;AATD,WAAiBX,KAAjB,CAAP;;AAWF,WAAK,UAAL;AACE,4BAAO,KAAC,UAAD;AACY,UAAA,GAAG,EAAET,MAAM,CAACS,KAAD,CADvB;AAEY,UAAA,OAAO,EAAE,WAFrB;AAGY,UAAA,KAAK,EAAE,UAHnB;AAIY,UAAA,cAAc,EAAE,IAJ5B;AAKY,UAAA,EAAE,EAAC,qBALf;AAMY,UAAA,MAAM,EAAE,gBAAAI,CAAC;AAAA,mBAAID,IAAI,CAACE,MAAL,IAAeF,IAAI,CAACE,MAAL,CAAYD,CAAZ,aAAYA,CAAZ,uBAAYA,CAAC,CAAEE,MAAf,CAAnB;AAAA,WANrB;AAAA,iCAOL,KAAC,SAAD;AAAW,YAAA,IAAI,EAAC;AAAhB;AAPK,WAAiBN,KAAjB,CAAP;AAvBJ;AAiCD,GAlCD;;AAoCA,sBACE,KAAC,OAAD;AAAA,cACGb,OADH,aACGA,OADH,uBACGA,OAAO,CAAEU,GAAT,CAAa,UAACM,IAAD,EAAOH,KAAP;AAAA,aAAiBE,UAAU,CAACC,IAAD,EAAOH,KAAP,CAA3B;AAAA,KAAb;AADH,IADF;AAKD,CA9DsB,CAAvB;;AATEb,EAAAA,O;AAEAE,EAAAA,c;;AAwEF,eAAeL,cAAf","sourcesContent":["import React, {useImperativeHandle} from 'react';\nimport styled from 'styled-components';\nimport {MenuAccountInfo, MobileMenuButtonTypes, MenuIconButton, DesktopMenuButtonTypes} from '../types';\nimport {IconButton} from '../../Button';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {ProfileButton} from '../../ProfileButton';\nimport {SystemIcons} from '../../icons';\nimport {BREAKPOINTS} from '../../styles';\n\nconst Wrapper = styled.div`\n align-items: center;\n \n display: none;\n ${BREAKPOINTS.MEDIUM}{\n display: flex;\n }\n`;\n\n\ninterface DesktopActionsProps {\n buttons?: DesktopMenuButtonTypes[];\n user?: MenuAccountInfo;\n onShowUserMenu: () => void;\n}\n\nexport interface DesktopActionsRef {\n buttons?: { ref: React.MutableRefObject<HTMLButtonElement | null>, type: 'profile' | 'action' | 'switcher' | undefined }[]\n}\n\nconst DesktopActions = React.forwardRef(({\n buttons,\n user,\n onShowUserMenu\n }: DesktopActionsProps, ref: React.Ref<DesktopActionsRef>) => {\n\n const [elRefs, setElRefs] = React.useState<React.RefObject<HTMLButtonElement>[]>([]);\n\n const length = buttons?.length || 0;\n\n React.useEffect(() => {\n setElRefs(Array(length || 0).fill(null).map(() => React.createRef<HTMLButtonElement>()));\n }, [length]);\n\n useImperativeHandle(ref, () => ({\n buttons: elRefs.map((r, index) => ({\n ref: r,\n type: buttons?.[index].type\n }))\n }), [elRefs, buttons]);\n\n const renderItem = (item: MobileMenuButtonTypes, index: number) => {\n switch (item.type) {\n case 'profile':\n return <ProfileButton key={index}\n ref={elRefs[index]}\n hideOnLowWidth={true}\n onClick={e => {\n item.action ? item.action(e?.target) : onShowUserMenu()\n }}\n icon={!user && <SystemIcons.User/>}\n initials={(user?.firstName?.charAt(0) ?? '') + (user?.lastName?.charAt(0) ?? '')}/>\n case 'action':\n return <IconButton key={index}\n ref={elRefs[index]}\n variant={'secondary'}\n shape={'circular'}\n disabled={item.disabled}\n hideOnLowWidth={true}\n action={e => {\n item.action && item.action(e?.target);\n }}>\n {item.icon}\n </IconButton>\n case 'switcher':\n return <IconButton key={index}\n ref={elRefs[index]}\n variant={'secondary'}\n shape={'circular'}\n hideOnLowWidth={true}\n id=\"globalNavAppsButton\"\n action={e => item.action && item.action(e?.target)}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n }\n }\n\n return (\n <Wrapper>\n {buttons?.map((item, index) => renderItem(item, index))}\n </Wrapper>\n )\n});\n\n\nexport default DesktopActions;\n"],"file":"DesktopActions.js"}
|
|
@@ -19,13 +19,11 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _styles = require("
|
|
22
|
+
var _styles = require("../../styles");
|
|
23
23
|
|
|
24
|
-
var _Tabs = require("
|
|
24
|
+
var _Tabs = require("../../Tabs");
|
|
25
25
|
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
var _zIndexes = require("../styles/z-indexes");
|
|
26
|
+
var _index = require("../../index");
|
|
29
27
|
|
|
30
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
29
|
|
|
@@ -37,9 +35,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
37
35
|
|
|
38
36
|
var flowDown = (0, _styledComponents.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n 0% {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
|
|
39
37
|
|
|
40
|
-
var Menu = _styledComponents.default.ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0;\n padding: 0;\n background-color: ", ";\n box-sizing: border-box;\n display: none;\n right: -8px;\n min-width: 300px;\n -webkit-animation: ", " 0.2s ease-in-out;\n animation: ", " 0.2s ease-in-out;\n position: absolute;\n box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);\n border-radius: 4px;\n z-index: ", ";\n\n top: 12px;\n ", " {\n top: 18px;\n }\n ", " {\n top: 24px;\n }\n\n .open & {\n display: block;\n }\n"])), _styles.COLORS.white, flowDown, flowDown,
|
|
38
|
+
var Menu = _styledComponents.default.ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0;\n padding: 0;\n background-color: ", ";\n box-sizing: border-box;\n display: none;\n right: -8px;\n min-width: 300px;\n -webkit-animation: ", " 0.2s ease-in-out;\n animation: ", " 0.2s ease-in-out;\n position: absolute;\n box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);\n border-radius: 4px;\n z-index: ", ";\n\n top: 12px;\n ", " {\n top: 18px;\n }\n ", " {\n top: 24px;\n }\n\n .open & {\n display: block;\n }\n"])), _styles.COLORS.white, flowDown, flowDown, _styles.Z_INDEXES.dropdown, _styles.BREAKPOINTS.SMALL, _styles.BREAKPOINTS.MEDIUM);
|
|
41
39
|
|
|
42
|
-
var MenuSection = _styledComponents.default.li(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n padding: 8px 0;\n position: relative;\n\n &:not(:first-of-type)::before {\n content: '';\n position: absolute;\n background: ", ";\n height: 1px;\n top: 0;\n left: 16px;\n right: 16px;\n }\n
|
|
40
|
+
var MenuSection = _styledComponents.default.li(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n padding: 8px 0;\n position: relative;\n\n &:not(:first-of-type)::before {\n content: '';\n position: absolute;\n background: ", ";\n height: 1px;\n top: 0;\n left: 16px;\n right: 16px;\n }\n"])), _styles.COLORS.neutral_100);
|
|
43
41
|
|
|
44
42
|
var MenuSectionList = _styledComponents.default.ul(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0;\n padding: 0 2px;\n"])));
|
|
45
43
|
|
|
@@ -70,7 +68,7 @@ var ExtendedMainMenu = function ExtendedMainMenu(_ref) {
|
|
|
70
68
|
requiredLine: n.label,
|
|
71
69
|
to: n.to,
|
|
72
70
|
disabled: n.disabled,
|
|
73
|
-
onClick: n.
|
|
71
|
+
onClick: n.action,
|
|
74
72
|
exact: n.exact
|
|
75
73
|
};
|
|
76
74
|
});
|
|
@@ -84,7 +82,7 @@ var ExtendedMainMenu = function ExtendedMainMenu(_ref) {
|
|
|
84
82
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(MenuSectionList, {
|
|
85
83
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tabs.VerticalTabs, {
|
|
86
84
|
entries: entries,
|
|
87
|
-
size:
|
|
85
|
+
size: _index.Size.Medium
|
|
88
86
|
}, "ExtendedMenu")
|
|
89
87
|
})
|
|
90
88
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GlobalNavigationBar/desktop/ExtendedMainMenu.tsx"],"names":["flowDown","keyframes","Menu","styled","ul","COLORS","white","Z_INDEXES","dropdown","BREAKPOINTS","SMALL","MEDIUM","MenuSection","li","neutral_100","MenuSectionList","ExtendedMainMenu","clickMenuAction","navigationOptions","React","useState","entries","setEntries","useEffect","handleKeyPress","e","keyCode","document","addEventListener","removeEventListener","list","map","n","requiredLine","label","to","disabled","onClick","action","exact","Size","Medium"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;;;;;;;;;AAGA,IAAMA,QAAQ,OAAGC,2BAAH,oNAAd;;AAWA,IAAMC,IAAI,GAAGC,0BAAOC,EAAV,gjBAIYC,eAAOC,KAJnB,EASaN,QATb,EAUKA,QAVL,EAcGO,kBAAUC,QAdb,EAiBNC,oBAAYC,KAjBN,EAoBND,oBAAYE,MApBN,CAAV;;AA6BA,IAAMC,WAAW,GAAGT,0BAAOU,EAAV,gTAOCR,eAAOS,WAPR,CAAjB;;AAeA,IAAMC,eAAe,GAAGZ,0BAAOC,EAAV,6IAArB;;AAWA,IAAMY,gBAAgB,GAAG,SAAnBA,gBAAmB,OAAmD;AAAA,MAAhDC,eAAgD,QAAhDA,eAAgD;AAAA,MAA/BC,iBAA+B,QAA/BA,iBAA+B;;AAC1E,wBAA8BC,KAAK,CAACC,QAAN,CAAmC,EAAnC,CAA9B;AAAA;AAAA,MAAOC,OAAP;AAAA,MAAgBC,UAAhB;;AACAH,EAAAA,KAAK,CAACI,SAAN,CAAgB,YAAM;AACpB,aAASC,cAAT,CAAwBC,CAAxB,EAAgC;AAC9B,UAAIA,CAAC,CAACC,OAAF,KAAc,EAAlB,EAAsB;AACpBT,QAAAA,eAAe;AAChB;AACF;;AAEDU,IAAAA,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,EAAqCJ,cAArC,EAAqD,KAArD;AACA,WAAO,YAAM;AACXG,MAAAA,QAAQ,CAACE,mBAAT,CAA6B,SAA7B,EAAwCL,cAAxC,EAAwD,KAAxD;AACD,KAFD;AAGD,GAXD,EAWG,CAACP,eAAD,CAXH;AAaAE,EAAAA,KAAK,CAACI,SAAN,CAAgB,YAAM;AACpB,QAAMO,IAAI,GAAGZ,iBAAH,aAAGA,iBAAH,uBAAGA,iBAAiB,CAAEa,GAAnB,CAAuB,UAAAC,CAAC,EAAI;AACvC,aAAO;AAAEC,QAAAA,YAAY,EAAED,CAAC,CAACE,KAAlB;AAAyBC,QAAAA,EAAE,EAAEH,CAAC,CAACG,EAA/B;AAAmCC,QAAAA,QAAQ,EAAEJ,CAAC,CAACI,QAA/C;AAAyDC,QAAAA,OAAO,EAAEL,CAAC,CAACM,MAApE;AAA4EC,QAAAA,KAAK,EAAEP,CAAC,CAACO;AAArF,OAAP;AACD,KAFY,CAAb;AAGAjB,IAAAA,UAAU,CAACQ,IAAD,CAAV;AACD,GALD,EAKG,CAACZ,iBAAD,CALH;AAOA,sBACE,qBAAC,IAAD;AAAM,IAAA,OAAO,EAAED,eAAf;AAAgC,IAAA,IAAI,EAAC,MAArC;AAA4C,uBAAgB,gBAA5D;AAAA,2BACE,qBAAC,WAAD;AAAA,6BACE,qBAAC,eAAD;AAAA,+BACE,qBAAC,kBAAD;AAAiC,UAAA,OAAO,EAAEI,OAA1C;AAAmD,UAAA,IAAI,EAAEmB,YAAKC;AAA9D,WAAkB,cAAlB;AADF;AADF;AADF,IADF;AASD,CA/BD;;;AAJExB,EAAAA,e;AACAC,EAAAA,iB;;eAoCaF,gB","sourcesContent":["import * as React from 'react';\nimport styled, { keyframes } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS } from '../../styles';\nimport { VerticalTabs } from '../../Tabs';\nimport { VerticalTabEntry } from '../../Tabs';\nimport {MenuNavigationItemTypeItem, Size} from '../../index';\nimport {Z_INDEXES} from '../../styles';\n\nconst flowDown = keyframes`\n 0% {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n`;\n\nconst Menu = styled.ul`\n list-style: none;\n margin: 0;\n padding: 0;\n background-color: ${COLORS.white};\n box-sizing: border-box;\n display: none;\n right: -8px;\n min-width: 300px;\n -webkit-animation: ${flowDown} 0.2s ease-in-out;\n animation: ${flowDown} 0.2s ease-in-out;\n position: absolute;\n box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);\n border-radius: 4px;\n z-index: ${Z_INDEXES.dropdown};\n\n top: 12px;\n ${BREAKPOINTS.SMALL} {\n top: 18px;\n }\n ${BREAKPOINTS.MEDIUM} {\n top: 24px;\n }\n\n .open & {\n display: block;\n }\n`;\n\nconst MenuSection = styled.li`\n padding: 8px 0;\n position: relative;\n\n &:not(:first-of-type)::before {\n content: '';\n position: absolute;\n background: ${COLORS.neutral_100};\n height: 1px;\n top: 0;\n left: 16px;\n right: 16px;\n }\n`;\n\nconst MenuSectionList = styled.ul`\n list-style: none;\n margin: 0;\n padding: 0 2px;\n`;\n\ntype Props = {\n clickMenuAction: () => void;\n navigationOptions: MenuNavigationItemTypeItem[];\n};\n\nconst ExtendedMainMenu = ({ clickMenuAction, navigationOptions }: Props) => {\n const [entries, setEntries] = React.useState<VerticalTabEntry[]>([]);\n React.useEffect(() => {\n function handleKeyPress(e: any) {\n if (e.keyCode === 27) {\n clickMenuAction();\n }\n }\n\n document.addEventListener('keydown', handleKeyPress, false);\n return () => {\n document.removeEventListener('keydown', handleKeyPress, false);\n };\n }, [clickMenuAction]);\n\n React.useEffect(() => {\n const list = navigationOptions?.map(n => {\n return { requiredLine: n.label, to: n.to, disabled: n.disabled, onClick: n.action, exact: n.exact };\n }) as VerticalTabEntry[];\n setEntries(list);\n }, [navigationOptions]);\n\n return (\n <Menu onClick={clickMenuAction} role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MenuSection>\n <MenuSectionList>\n <VerticalTabs key=\"ExtendedMenu\" entries={entries} size={Size.Medium} />\n </MenuSectionList>\n </MenuSection>\n </Menu>\n );\n};\n\nexport default ExtendedMainMenu;\n"],"file":"ExtendedMainMenu.cjs"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MenuNavigationItemTypeItem } from '../../index';
|
|
2
2
|
declare type Props = {
|
|
3
3
|
clickMenuAction: () => void;
|
|
4
|
-
navigationOptions:
|
|
4
|
+
navigationOptions: MenuNavigationItemTypeItem[];
|
|
5
5
|
};
|
|
6
6
|
declare const ExtendedMainMenu: ({ clickMenuAction, navigationOptions }: Props) => JSX.Element;
|
|
7
7
|
export default ExtendedMainMenu;
|
|
@@ -6,14 +6,14 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
|
6
6
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import styled, { keyframes } from 'styled-components';
|
|
9
|
-
import { BREAKPOINTS, COLORS } from '
|
|
10
|
-
import { VerticalTabs } from '
|
|
11
|
-
import { Size } from '
|
|
12
|
-
import { Z_INDEXES } from '
|
|
9
|
+
import { BREAKPOINTS, COLORS } from '../../styles';
|
|
10
|
+
import { VerticalTabs } from '../../Tabs';
|
|
11
|
+
import { Size } from '../../index';
|
|
12
|
+
import { Z_INDEXES } from '../../styles';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
var flowDown = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
|
|
15
15
|
var Menu = styled.ul(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n list-style: none;\n margin: 0;\n padding: 0;\n background-color: ", ";\n box-sizing: border-box;\n display: none;\n right: -8px;\n min-width: 300px;\n -webkit-animation: ", " 0.2s ease-in-out;\n animation: ", " 0.2s ease-in-out;\n position: absolute;\n box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);\n border-radius: 4px;\n z-index: ", ";\n\n top: 12px;\n ", " {\n top: 18px;\n }\n ", " {\n top: 24px;\n }\n\n .open & {\n display: block;\n }\n"])), COLORS.white, flowDown, flowDown, Z_INDEXES.dropdown, BREAKPOINTS.SMALL, BREAKPOINTS.MEDIUM);
|
|
16
|
-
var MenuSection = styled.li(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 8px 0;\n position: relative;\n\n &:not(:first-of-type)::before {\n content: '';\n position: absolute;\n background: ", ";\n height: 1px;\n top: 0;\n left: 16px;\n right: 16px;\n }\n
|
|
16
|
+
var MenuSection = styled.li(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 8px 0;\n position: relative;\n\n &:not(:first-of-type)::before {\n content: '';\n position: absolute;\n background: ", ";\n height: 1px;\n top: 0;\n left: 16px;\n right: 16px;\n }\n"])), COLORS.neutral_100);
|
|
17
17
|
var MenuSectionList = styled.ul(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n list-style: none;\n margin: 0;\n padding: 0 2px;\n"])));
|
|
18
18
|
|
|
19
19
|
var ExtendedMainMenu = function ExtendedMainMenu(_ref) {
|
|
@@ -43,7 +43,7 @@ var ExtendedMainMenu = function ExtendedMainMenu(_ref) {
|
|
|
43
43
|
requiredLine: n.label,
|
|
44
44
|
to: n.to,
|
|
45
45
|
disabled: n.disabled,
|
|
46
|
-
onClick: n.
|
|
46
|
+
onClick: n.action,
|
|
47
47
|
exact: n.exact
|
|
48
48
|
};
|
|
49
49
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GlobalNavigationBar/desktop/ExtendedMainMenu.tsx"],"names":["React","styled","keyframes","BREAKPOINTS","COLORS","VerticalTabs","Size","Z_INDEXES","flowDown","Menu","ul","white","dropdown","SMALL","MEDIUM","MenuSection","li","neutral_100","MenuSectionList","ExtendedMainMenu","clickMenuAction","navigationOptions","useState","entries","setEntries","useEffect","handleKeyPress","e","keyCode","document","addEventListener","removeEventListener","list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AACD,KAFD;AAGD,GAXD,EAWG,CAACN,eAAD,CAXH;AAaApB,EAAAA,KAAK,CAACyB,SAAN,CAAgB,YAAM;AACpB,QAAMO,IAAI,GAAGX,iBAAH,aAAGA,iBAAH,uBAAGA,iBAAiB,CAAEY,GAAnB,CAAuB,UAAAC,CAAC,EAAI;AACvC,aAAO;AAAEC,QAAAA,YAAY,EAAED,CAAC,CAACE,KAAlB;AAAyBC,QAAAA,EAAE,EAAEH,CAAC,CAACG,EAA/B;AAAmCC,QAAAA,QAAQ,EAAEJ,CAAC,CAACI,QAA/C;AAAyDC,QAAAA,OAAO,EAAEL,CAAC,CAACM,MAApE;AAA4EC,QAAAA,KAAK,EAAEP,CAAC,CAACO;AAArF,OAAP;AACD,KAFY,CAAb;AAGAjB,IAAAA,UAAU,CAACQ,IAAD,CAAV;AACD,GALD,EAKG,CAACX,iBAAD,CALH;AAOA,sBACE,KAAC,IAAD;AAAM,IAAA,OAAO,EAAED,eAAf;AAAgC,IAAA,IAAI,EAAC,MAArC;AAA4C,uBAAgB,gBAA5D;AAAA,2BACE,KAAC,WAAD;AAAA,6BACE,KAAC,eAAD;AAAA,+BACE,KAAC,YAAD;AAAiC,UAAA,OAAO,EAAEG,OAA1C;AAAmD,UAAA,IAAI,EAAEjB,IAAI,CAACoC;AAA9D,WAAkB,cAAlB;AADF;AADF;AADF,IADF;AASD,CA/BD;;;AAJEtB,EAAAA,e;AACAC,EAAAA,iB;;AAoCF,eAAeF,gBAAf","sourcesContent":["import * as React from 'react';\nimport styled, { keyframes } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS } from '../../styles';\nimport { VerticalTabs } from '../../Tabs';\nimport { VerticalTabEntry } from '../../Tabs';\nimport {MenuNavigationItemTypeItem, Size} from '../../index';\nimport {Z_INDEXES} from '../../styles';\n\nconst flowDown = keyframes`\n 0% {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n`;\n\nconst Menu = styled.ul`\n list-style: none;\n margin: 0;\n padding: 0;\n background-color: ${COLORS.white};\n box-sizing: border-box;\n display: none;\n right: -8px;\n min-width: 300px;\n -webkit-animation: ${flowDown} 0.2s ease-in-out;\n animation: ${flowDown} 0.2s ease-in-out;\n position: absolute;\n box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);\n border-radius: 4px;\n z-index: ${Z_INDEXES.dropdown};\n\n top: 12px;\n ${BREAKPOINTS.SMALL} {\n top: 18px;\n }\n ${BREAKPOINTS.MEDIUM} {\n top: 24px;\n }\n\n .open & {\n display: block;\n }\n`;\n\nconst MenuSection = styled.li`\n padding: 8px 0;\n position: relative;\n\n &:not(:first-of-type)::before {\n content: '';\n position: absolute;\n background: ${COLORS.neutral_100};\n height: 1px;\n top: 0;\n left: 16px;\n right: 16px;\n }\n`;\n\nconst MenuSectionList = styled.ul`\n list-style: none;\n margin: 0;\n padding: 0 2px;\n`;\n\ntype Props = {\n clickMenuAction: () => void;\n navigationOptions: MenuNavigationItemTypeItem[];\n};\n\nconst ExtendedMainMenu = ({ clickMenuAction, navigationOptions }: Props) => {\n const [entries, setEntries] = React.useState<VerticalTabEntry[]>([]);\n React.useEffect(() => {\n function handleKeyPress(e: any) {\n if (e.keyCode === 27) {\n clickMenuAction();\n }\n }\n\n document.addEventListener('keydown', handleKeyPress, false);\n return () => {\n document.removeEventListener('keydown', handleKeyPress, false);\n };\n }, [clickMenuAction]);\n\n React.useEffect(() => {\n const list = navigationOptions?.map(n => {\n return { requiredLine: n.label, to: n.to, disabled: n.disabled, onClick: n.action, exact: n.exact };\n }) as VerticalTabEntry[];\n setEntries(list);\n }, [navigationOptions]);\n\n return (\n <Menu onClick={clickMenuAction} role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MenuSection>\n <MenuSectionList>\n <VerticalTabs key=\"ExtendedMenu\" entries={entries} size={Size.Medium} />\n </MenuSectionList>\n </MenuSection>\n </Menu>\n );\n};\n\nexport default ExtendedMainMenu;\n"],"file":"ExtendedMainMenu.js"}
|
|
@@ -21,17 +21,17 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
21
21
|
|
|
22
22
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
23
23
|
|
|
24
|
-
var _NavItem = require("
|
|
24
|
+
var _NavItem = require("../../NavItem");
|
|
25
25
|
|
|
26
|
-
var _SystemIcons = require("
|
|
26
|
+
var _SystemIcons = require("../../icons/systemicons/SystemIcons");
|
|
27
27
|
|
|
28
|
-
var _styles = require("
|
|
28
|
+
var _styles = require("../../styles");
|
|
29
29
|
|
|
30
30
|
var _ExtendedMainMenu = _interopRequireDefault(require("./ExtendedMainMenu"));
|
|
31
31
|
|
|
32
|
-
var _Button = require("
|
|
32
|
+
var _Button = require("../../Button");
|
|
33
33
|
|
|
34
|
-
var _common = require("
|
|
34
|
+
var _common = require("../../common");
|
|
35
35
|
|
|
36
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
37
37
|
|
|
@@ -52,7 +52,7 @@ var ExtendedMenuWrapper = _styledComponents.default.div(_templateObject3 || (_te
|
|
|
52
52
|
var ExtendedSection = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n"])));
|
|
53
53
|
|
|
54
54
|
var MainMenu = function MainMenu(_ref) {
|
|
55
|
-
var
|
|
55
|
+
var items = _ref.items,
|
|
56
56
|
rightSideRef = _ref.rightSideRef;
|
|
57
57
|
|
|
58
58
|
var _React$useState = React.useState(false),
|
|
@@ -110,31 +110,27 @@ var MainMenu = function MainMenu(_ref) {
|
|
|
110
110
|
className: "GlobalNavigationMainMenu",
|
|
111
111
|
ref: mainMenuRef,
|
|
112
112
|
open: showExtendedMenu,
|
|
113
|
-
children: [
|
|
113
|
+
children: [items === null || items === void 0 ? void 0 : items.map(function (no, index) {
|
|
114
114
|
return index > numberOfItemsAllowed - 2 ? null : no !== null && no !== void 0 && no.disabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_NavItem.NavItem, {
|
|
115
115
|
as: NavButton,
|
|
116
|
-
exact: no
|
|
116
|
+
exact: no.exact,
|
|
117
117
|
className: "disabled",
|
|
118
118
|
onMouseDown: _common.defaultOnMouseDownHandler,
|
|
119
119
|
onClick: function onClick() {
|
|
120
|
-
|
|
121
|
-
no === null || no === void 0 ? void 0 : no.onClick();
|
|
122
|
-
}
|
|
120
|
+
return no.action && no.action();
|
|
123
121
|
},
|
|
124
122
|
children: no === null || no === void 0 ? void 0 : no.label
|
|
125
|
-
}, no
|
|
123
|
+
}, no.label) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_NavItem.NavItem, {
|
|
126
124
|
as: _reactRouterDom.NavLink,
|
|
127
|
-
exact: no
|
|
128
|
-
to:
|
|
125
|
+
exact: no.exact,
|
|
126
|
+
to: no.to || '',
|
|
129
127
|
onMouseDown: _common.defaultOnMouseDownHandler,
|
|
130
128
|
onClick: function onClick() {
|
|
131
|
-
|
|
132
|
-
no === null || no === void 0 ? void 0 : no.onClick();
|
|
133
|
-
}
|
|
129
|
+
return no.action && no.action();
|
|
134
130
|
},
|
|
135
131
|
children: no === null || no === void 0 ? void 0 : no.label
|
|
136
|
-
}, no
|
|
137
|
-
}),
|
|
132
|
+
}, no.label);
|
|
133
|
+
}), items.length + 1 > numberOfItemsAllowed && /*#__PURE__*/(0, _jsxRuntime.jsxs)(ExtendedSection, {
|
|
138
134
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
139
135
|
ref: menuButtonRef,
|
|
140
136
|
variant: 'secondary',
|
|
@@ -151,7 +147,7 @@ var MainMenu = function MainMenu(_ref) {
|
|
|
151
147
|
floatRight: false,
|
|
152
148
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExtendedMainMenu.default, {
|
|
153
149
|
clickMenuAction: handleClickExtendedMenuAction,
|
|
154
|
-
navigationOptions:
|
|
150
|
+
navigationOptions: items.slice(numberOfItemsAllowed - 1)
|
|
155
151
|
})
|
|
156
152
|
})]
|
|
157
153
|
})]
|
|
@@ -159,7 +155,7 @@ var MainMenu = function MainMenu(_ref) {
|
|
|
159
155
|
};
|
|
160
156
|
|
|
161
157
|
MainMenu.propTypes = {
|
|
162
|
-
|
|
158
|
+
items: _propTypes.default.array.isRequired
|
|
163
159
|
};
|
|
164
160
|
var _default = MainMenu;
|
|
165
161
|
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GlobalNavigationBar/desktop/MainMenu.tsx"],"names":["NavContainer","styled","div","BREAKPOINTS","MEDIUM","NavButton","button","COLORS","white","ExtendedMenuWrapper","props","floatRight","ExtendedSection","MainMenu","items","rightSideRef","React","useState","showExtendedMenu","setShowExtendedMenu","extendedMenuRef","useRef","menuButtonRef","mainMenuRef","numberOfItemsAllowed","setNumberOfItemsAllowed","widthOfItem","recalculateNumberOfItemsAllowed","current","number","Math","floor","offsetLeft","handleClickExtendedMenuAction","handleClickOutside","e","contains","target","useEffect","document","addEventListener","window","removeEventListener","map","no","index","disabled","exact","defaultOnMouseDownHandler","action","label","NavLink","to","length","slice"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAGA,IAAMA,YAAY,GAAGC,0BAAOC,GAAV,2OAKdC,oBAAYC,MALE,CAAlB;;AAcA,IAAMC,SAAS,GAAGJ,0BAAOK,MAAV,2HACCC,eAAOC,KADR,CAAf;;AASA,IAAMC,mBAAmB,GAAGR,0BAAOC,GAAV,wTAER,UAAAQ,KAAK;AAAA,SAAKA,KAAK,CAACC,UAAN,GAAmB,MAAnB,GAA4B,OAAjC;AAAA,CAFG,EAePJ,eAAOC,KAfA,CAAzB;;AAmBA,IAAMI,eAAe,GAAGX,0BAAOC,GAAV,8GAArB;;AASA,IAAMW,QAAQ,GAAG,SAAXA,QAAW,OAA6D;AAAA,MAA3DC,KAA2D,QAA3DA,KAA2D;AAAA,MAApDC,YAAoD,QAApDA,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uFaD,Q","sourcesContent":["import * as React from 'react';\nimport {NavLink} 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 from './ExtendedMainMenu';\nimport {IconButton} from '../../Button';\nimport {defaultOnMouseDownHandler} from '../../common';\nimport {MenuNavigationItemTypeItem} from '../types';\n\nconst NavContainer = styled.div<{ open: boolean }>`\n display: none;\n justify-content: center;\n align-items: center;\n\n ${BREAKPOINTS.MEDIUM} {\n display: flex;\n }\n\n a {\n text-decoration: none;\n }\n`;\n\nconst NavButton = styled.button`\n background: ${COLORS.white};\n border: 0;\n`;\n\ninterface ExtendedMenuWrapperProps {\n floatRight: boolean;\n}\n\nconst ExtendedMenuWrapper = styled.div<ExtendedMenuWrapperProps>`\n display: flex;\n margin-left: ${props => (props.floatRight ? 'auto' : 'unset')};\n\n position: absolute;\n flex-direction: column;\n left: 290px;\n top: 22px;\n\n height: 0;\n width: 0;\n\n &:focus-within,\n &:hover,\n &.open {\n background: ${COLORS.white};\n }\n`;\n\nconst ExtendedSection = styled.div`\n position: relative;\n`;\n\ntype Props = {\n items: MenuNavigationItemTypeItem[];\n rightSideRef?: React.RefObject<HTMLDivElement> | null | undefined;\n};\n\nconst MainMenu = ({items, rightSideRef}: Props): React.ReactElement<Props> => {\n const [showExtendedMenu, setShowExtendedMenu] = React.useState(false);\n const extendedMenuRef = React.useRef<any>(null);\n const menuButtonRef = React.useRef<HTMLButtonElement>(null);\n const mainMenuRef: React.RefObject<HTMLDivElement> | null | undefined = React.useRef(null);\n const [numberOfItemsAllowed, setNumberOfItemsAllowed] = React.useState<number>(1);\n\n const widthOfItem = 150;\n const recalculateNumberOfItemsAllowed = () => {\n if (rightSideRef?.current && mainMenuRef?.current) {\n const number = Math.floor((rightSideRef?.current?.offsetLeft - mainMenuRef?.current?.offsetLeft) / widthOfItem);\n if (number !== numberOfItemsAllowed) {\n setNumberOfItemsAllowed(number);\n }\n }\n };\n\n const handleClickExtendedMenuAction = () => {\n setShowExtendedMenu(false);\n };\n\n const handleClickOutside = (e: any) => {\n if (!extendedMenuRef?.current?.contains(e.target) && !menuButtonRef?.current?.contains(e.target)) {\n setShowExtendedMenu(false);\n }\n };\n\n React.useEffect(() => {\n recalculateNumberOfItemsAllowed();\n // Bind the event listener\n document.addEventListener('click', handleClickOutside);\n window.addEventListener('resize', recalculateNumberOfItemsAllowed);\n return () => {\n // Unbind the event listener on clean up\n document.removeEventListener('click', handleClickOutside);\n window.removeEventListener('resize', recalculateNumberOfItemsAllowed);\n };\n });\n\n return (\n <NavContainer className=\"GlobalNavigationMainMenu\" ref={mainMenuRef} open={showExtendedMenu}>\n {items?.map((no: MenuNavigationItemTypeItem, index: number) =>\n index > numberOfItemsAllowed - 2 ? null : no?.disabled ? (\n <NavItem as={NavButton}\n exact={no.exact}\n className=\"disabled\"\n key={no.label}\n onMouseDown={defaultOnMouseDownHandler}\n onClick={() => no.action && no.action()}>\n {no?.label}\n </NavItem>\n ) : (\n <NavItem as={NavLink}\n exact={no.exact}\n to={no.to || ''}\n key={no.label}\n onMouseDown={defaultOnMouseDownHandler}\n onClick={() => no.action && no.action()}>\n {no?.label}\n </NavItem>\n ),\n )}\n {items.length + 1 > numberOfItemsAllowed && (\n <ExtendedSection>\n <IconButton\n ref={menuButtonRef}\n variant={'secondary'}\n shape={'circular'}\n action={() => {\n setShowExtendedMenu(!showExtendedMenu)\n }}>\n <MoreHorizontal size=\"24px\"/>\n </IconButton>\n <ExtendedMenuWrapper ref={extendedMenuRef} className={showExtendedMenu ? 'open' : ''} floatRight={false}>\n <ExtendedMainMenu clickMenuAction={handleClickExtendedMenuAction}\n navigationOptions={items.slice(numberOfItemsAllowed - 1)}/>\n </ExtendedMenuWrapper>\n </ExtendedSection>\n )}\n </NavContainer>\n );\n};\n\nexport default MainMenu;\n"],"file":"MainMenu.cjs"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MenuNavigationItemTypeItem } from '../types';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
items: MenuNavigationItemTypeItem[];
|
|
5
|
+
rightSideRef?: React.RefObject<HTMLDivElement> | null | undefined;
|
|
6
|
+
};
|
|
7
|
+
declare const MainMenu: ({ items, rightSideRef }: Props) => React.ReactElement<Props>;
|
|
8
|
+
export default MainMenu;
|