@laerdal/life-react-components 1.8.0-dev.16 → 1.8.0-dev.18
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/Dropdown/CommonStyling.cjs +1 -1
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.js +1 -1
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +7 -3
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js +7 -3
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/GlobalNavigationBar/Actions.cjs +185 -0
- package/dist/GlobalNavigationBar/Actions.cjs.map +1 -0
- package/dist/GlobalNavigationBar/Actions.d.ts +13 -0
- package/dist/GlobalNavigationBar/Actions.js +160 -0
- package/dist/GlobalNavigationBar/Actions.js.map +1 -0
- package/dist/GlobalNavigationBar/Avatar.cjs +104 -0
- package/dist/GlobalNavigationBar/Avatar.cjs.map +1 -0
- package/dist/GlobalNavigationBar/Avatar.d.ts +15 -0
- package/dist/GlobalNavigationBar/Avatar.js +77 -0
- package/dist/GlobalNavigationBar/Avatar.js.map +1 -0
- package/dist/GlobalNavigationBar/{desktop/ExtendedMainMenu.cjs → ExtendedMainMenu.cjs} +9 -7
- package/dist/GlobalNavigationBar/ExtendedMainMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/{desktop/ExtendedMainMenu.d.ts → ExtendedMainMenu.d.ts} +2 -2
- package/dist/GlobalNavigationBar/{desktop/ExtendedMainMenu.js → ExtendedMainMenu.js} +6 -6
- package/dist/GlobalNavigationBar/ExtendedMainMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +176 -107
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.d.ts +27 -13
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js +176 -106
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
- package/dist/GlobalNavigationBar/Logo.cjs +5 -3
- 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/{desktop/MainMenu.cjs → MainMenu.cjs} +21 -17
- package/dist/GlobalNavigationBar/MainMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/MainMenu.d.ts +8 -0
- package/dist/GlobalNavigationBar/{desktop/MainMenu.js → MainMenu.js} +21 -17
- package/dist/GlobalNavigationBar/MainMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/{desktop/RightSideNav.cjs → RightSideNav.cjs} +26 -22
- package/dist/GlobalNavigationBar/RightSideNav.cjs.map +1 -0
- package/dist/GlobalNavigationBar/RightSideNav.d.ts +8 -0
- package/dist/GlobalNavigationBar/RightSideNav.js +61 -0
- package/dist/GlobalNavigationBar/RightSideNav.js.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs +112 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.d.ts +11 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.js +86 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.js.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs +178 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.d.ts +16 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js +146 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs +168 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.d.ts +15 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.js +135 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/index.cjs +18 -15
- 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 +21 -15
- package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/CommonStyles.d.ts +6 -3
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js +15 -14
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs +49 -0
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs.map +1 -0
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.d.ts +6 -0
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js +27 -0
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs +91 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.d.ts +13 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js +70 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs +221 -114
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.d.ts +25 -6
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js +216 -113
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
- package/dist/MenuItem/MenuItem.cjs +10 -16
- package/dist/MenuItem/MenuItem.cjs.map +1 -1
- package/dist/MenuItem/MenuItem.d.ts +3 -3
- package/dist/MenuItem/MenuItem.js +8 -14
- package/dist/MenuItem/MenuItem.js.map +1 -1
- package/dist/ProfileButton/ProfileButton.cjs +11 -20
- package/dist/ProfileButton/ProfileButton.cjs.map +1 -1
- package/dist/ProfileButton/ProfileButton.d.ts +1 -3
- package/dist/ProfileButton/ProfileButton.js +10 -18
- package/dist/ProfileButton/ProfileButton.js.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.cjs +78 -24
- package/dist/Switcher/MobileSwitcherMenu.cjs.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.d.ts +5 -6
- package/dist/Switcher/MobileSwitcherMenu.js +70 -26
- package/dist/Switcher/MobileSwitcherMenu.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/hooks/useClickOutside.cjs +2 -6
- package/dist/hooks/useClickOutside.cjs.map +1 -1
- package/dist/hooks/useClickOutside.d.ts +1 -1
- package/dist/hooks/useClickOutside.js +2 -6
- package/dist/hooks/useClickOutside.js.map +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +32 -0
- package/dist/types.js.map +1 -1
- package/package.json +8 -10
- package/dist/GlobalNavigationBar/NavigationHelper.cjs +0 -38
- package/dist/GlobalNavigationBar/NavigationHelper.cjs.map +0 -1
- package/dist/GlobalNavigationBar/NavigationHelper.d.ts +0 -4
- package/dist/GlobalNavigationBar/NavigationHelper.js +0 -27
- package/dist/GlobalNavigationBar/NavigationHelper.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +0 -127
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.d.ts +0 -15
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js +0 -98
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +0 -8
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.d.ts +0 -8
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js +0 -59
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +0 -204
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.d.ts +0 -7
- package/dist/GlobalNavigationBar/desktop/UserMenu.js +0 -163
- package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs +0 -221
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.d.ts +0 -11
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js +0 -184
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs +0 -160
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.d.ts +0 -12
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js +0 -139
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js.map +0 -1
- package/dist/GlobalNavigationBar/types.cjs +0 -6
- package/dist/GlobalNavigationBar/types.cjs.map +0 -1
- package/dist/GlobalNavigationBar/types.d.ts +0 -120
- package/dist/GlobalNavigationBar/types.js +0 -2
- package/dist/GlobalNavigationBar/types.js.map +0 -1
- package/dist/common/StackState.cjs +0 -47
- package/dist/common/StackState.cjs.map +0 -1
- package/dist/common/StackState.d.ts +0 -7
- package/dist/common/StackState.js +0 -30
- package/dist/common/StackState.js.map +0 -1
|
@@ -17,8 +17,8 @@ export var DropdownButton = styled.button(_templateObject || (_templateObject =
|
|
|
17
17
|
});
|
|
18
18
|
export var ItemLabel = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
|
|
19
19
|
export var ItemIcon = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
|
20
|
-
export var
|
|
21
|
-
export var ItemContent = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ", " {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ", " {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n"])), ItemLabel, ItemIcon,
|
|
20
|
+
export var LockedIconContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n\n"])));
|
|
21
|
+
export var ItemContent = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ", " {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ", " {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n"])), ItemLabel, ItemIcon, LockedIconContainer);
|
|
22
22
|
export var DropdownButtonCSS = function DropdownButtonCSS(size) {
|
|
23
23
|
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ", ";\n background-color: ", ";\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ", ";\n\n &.active {\n background: ", ";\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ", ";\n\n border-radius: 4px;\n }\n }\n\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active, &.active-active-state {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent !important;\n cursor: not-allowed;\n color: ", " !important;\n }\n\n &.dropdown-hover:not(:disabled) {\n background-color: ", ";\n color: ", ";\n }\n "])), size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px', COLORS.white, CommonInteractionStyling, COLORS.neutral_20, COLORS.primary_500, COLORS.neutral_500, COLORS.primary_20, COLORS.primary_600, COLORS.primary_500, COLORS.primary_100, COLORS.primary_800, COLORS.primary_500, COLORS.neutral_200, COLORS.primary_20, COLORS.primary_600);
|
|
24
24
|
};
|
|
@@ -28,11 +28,10 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
28
28
|
var active = _ref.active,
|
|
29
29
|
item = _ref.item,
|
|
30
30
|
onClickHandler = _ref.onClickHandler,
|
|
31
|
-
|
|
32
|
-
size = _ref
|
|
31
|
+
key = _ref.key,
|
|
32
|
+
size = _ref.size,
|
|
33
33
|
className = _ref.className,
|
|
34
34
|
tabIndex = _ref.tabIndex,
|
|
35
|
-
iconRight = _ref.iconRight,
|
|
36
35
|
id = _ref.id;
|
|
37
36
|
return /*#__PURE__*/_jsxs(DropdownButton, {
|
|
38
37
|
type: "button",
|
|
@@ -60,29 +59,24 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
60
59
|
},
|
|
61
60
|
children: item.noteLabel
|
|
62
61
|
})]
|
|
63
|
-
}), item.locked && /*#__PURE__*/_jsx(
|
|
62
|
+
}), item.locked && /*#__PURE__*/_jsx(LockedIconContainer, {
|
|
64
63
|
children: /*#__PURE__*/_jsx(LockedOn, {
|
|
65
64
|
color: COLORS.neutral_400,
|
|
66
65
|
className: "extraMargin",
|
|
67
66
|
size: "24px"
|
|
68
67
|
})
|
|
69
|
-
}), !item.locked && !!iconRight && /*#__PURE__*/_jsx(ItemIconRight, {
|
|
70
|
-
children: /*#__PURE__*/React.cloneElement(iconRight, {
|
|
71
|
-
className: 'extraMargin',
|
|
72
|
-
size: '24px'
|
|
73
|
-
})
|
|
74
68
|
})]
|
|
75
69
|
})]
|
|
76
70
|
})]
|
|
77
|
-
});
|
|
71
|
+
}, key);
|
|
78
72
|
});
|
|
79
73
|
MenuItem.propTypes = {
|
|
80
74
|
onClickHandler: _pt.func.isRequired,
|
|
81
75
|
active: _pt.bool.isRequired,
|
|
82
76
|
id: _pt.string.isRequired,
|
|
77
|
+
key: _pt.string.isRequired,
|
|
83
78
|
className: _pt.string,
|
|
84
|
-
tabIndex: _pt.number
|
|
85
|
-
iconRight: _pt.element
|
|
79
|
+
tabIndex: _pt.number
|
|
86
80
|
};
|
|
87
81
|
export default MenuItem;
|
|
88
82
|
//# sourceMappingURL=MenuItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["React","styled","css","COLORS","ComponentTextStyle","LockedOn","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","CommonInteractionStyling","defaultOnMouseDownHandler","DropdownButton","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","
|
|
1
|
+
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["React","styled","css","COLORS","ComponentTextStyle","LockedOn","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","CommonInteractionStyling","defaultOnMouseDownHandler","DropdownButton","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","LockedIconContainer","ItemContent","Small","Regular","neutral_600","Medium","Large","white","neutral_20","primary_500","neutral_500","primary_20","primary_600","primary_100","primary_800","neutral_200","MenuItem","forwardRef","ref","active","item","onClickHandler","key","className","tabIndex","id","disabled","locked","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize","lineHeight","neutral_400"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,MAAP,IAAiBC,GAAjB,QAA4B,mBAA5B;AACA,SAAqBC,MAArB,EAA6BC,kBAA7B,Q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,IAAyDP,IAAI,CAACQ,gBAAL,GAAwB,oBAAxB,GAA+C,EAAxG,IAA8G,GAA9G,IAAqHT,MAAM,GAAG,QAAH,GAAc,EAAzI,CARhB;AAUI,IAAA,EAAE,EAAEM,EAVR;AAAA,eAWKL,IAAI,CAACQ,gBAAL,iBAAyB;AAAK,MAAA,SAAS,EAAC;AAAf,MAX9B,eAYI,MAAC,WAAD;AAAA,iBACGR,IAAI,CAACS,IAAL,iBAAa,KAAC,QAAD;AAAA,kBAAWT,IAAI,CAACS;AAAhB,QADhB,eAEE,MAAC,SAAD;AAAA,gCACI;AAAA,kCACE;AAAA,4CAAMT,IAAI,CAACU,YAAX,mEAA2BV,IAAI,CAACW;AAAhC,YADF,EAEGX,IAAI,CAACY,SAAL,iBAAkB;AAAK,YAAA,KAAK,EAAE;AAAEC,cAAAA,QAAQ,EAAE,MAAZ;AAAoBC,cAAAA,UAAU,EAAE;AAAhC,aAAZ;AAAA,sBAAuDd,IAAI,CAACY;AAA5D,YAFrB;AAAA,UADJ,EAKKZ,IAAI,CAACO,MAAL,iBAAe,KAAC,mBAAD;AAAA,iCACd,KAAC,QAAD;AAAU,YAAA,KAAK,EAAE5C,MAAM,CAACoD,WAAxB;AAAqC,YAAA,SAAS,EAAC,aAA/C;AAA6D,YAAA,IAAI,EAAC;AAAlE;AADc,UALpB;AAAA,QAFF;AAAA,MAZJ;AAAA,KASSb,GATT,CADF;AA2BD,CApCgB,CAAjB;;AAzIGD,EAAAA,c;AACAF,EAAAA,M;AACAM,EAAAA,E;AACAH,EAAAA,G;AAEAC,EAAAA,S;AACAC,EAAAA,Q;;AAyKH,eAAeR,QAAf","sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ChevronRight, LockedOn} from '../icons/systemicons/SystemIcons';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport {CommonInteractionStyling, defaultOnMouseDownHandler} from '../common';\n\nexport interface MenuItemProps {\n item: DropdownItem;\n onClickHandler: (e: any) => void;\n active: boolean;\n id: string;\n key: string;\n size?: Size;\n className?: string;\n tabIndex?: number;\n}\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n ${(props) => DropdownButtonCSS(props.size)}\n`;\n\nexport const ItemLabel = styled.div``;\nexport const ItemIcon = styled.div``;\n\nexport const LockedIconContainer = styled.div`\n\n`;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ${LockedIconContainer} {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n`;\n\n\nexport const DropdownButtonCSS = (size?: Size) => {\n return css`\n ${size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 4px;\n }\n }\n\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_500};\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active, &.active-active-state {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent !important;\n cursor: not-allowed;\n color: ${COLORS.neutral_200} !important;\n }\n\n &.dropdown-hover:not(:disabled) {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_600};\n }\n `;\n};\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n key,\n size,\n className,\n tabIndex,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled || item.locked}\n tabIndex={tabIndex}\n onMouseDown={defaultOnMouseDownHandler}\n ref={ref}\n onClick={onClickHandler}\n className={ className + ' ' + (item.locked ? 'locked' : '') + ' ' + (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : '')}\n key={key}\n id={id}>\n {item.showDividerAbove && <div className=\"divider\" />}\n <ItemContent>\n {item.icon && <ItemIcon>{item.icon}</ItemIcon>}\n <ItemLabel>\n <div>\n <div>{item.displayLabel ?? item.value}</div>\n {item.noteLabel && <div style={{ fontSize: '12px', lineHeight: '16px' }}>{item.noteLabel}</div>}\n </div>\n {item.locked && <LockedIconContainer>\n <LockedOn color={COLORS.neutral_400} className=\"extraMargin\" size=\"24px\" />\n </LockedIconContainer>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.js"}
|
|
@@ -23,7 +23,7 @@ var _Iconbutton = require("../Button/Iconbutton");
|
|
|
23
23
|
|
|
24
24
|
var _NotificationDot = require("../NotificationDot");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _typography = require("../styles/typography");
|
|
27
27
|
|
|
28
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
29
|
|
|
@@ -33,35 +33,31 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
33
33
|
|
|
34
34
|
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; }
|
|
35
35
|
|
|
36
|
-
var PortraitOverlay = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: 100%;\n border-radius:
|
|
36
|
+
var PortraitOverlay = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: 100%;\n border-radius: 18px;\n background-color: ", ";\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n"])), _.COLORS.black);
|
|
37
37
|
|
|
38
|
-
var Container = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: 48px;\n height: 48px;\n display: inline;\n
|
|
39
|
-
return props.hideOnLowWidth ? 'none' : 'inline';
|
|
40
|
-
}, _styles.BREAKPOINTS.MEDIUM, _Iconbutton.IconButtonContent, _.COLORS.neutral_100, _.COLORS.neutral_300, PortraitOverlay, PortraitOverlay);
|
|
38
|
+
var Container = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: 48px;\n height: 48px;\n display: inline;\n\n .initials {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n ", " {\n display: inline;\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ", " {\n background-color: ", ";\n svg, svg path {\n fill: ", ";\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ", " {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ", " {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n"])), _Iconbutton.StyledPrimaryIconButton, _Iconbutton.IconButtonContent, _.COLORS.neutral_100, _.COLORS.neutral_300, PortraitOverlay, PortraitOverlay);
|
|
41
39
|
|
|
42
40
|
var NotificationContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n left: 30px;\n bottom: 30px;\n"])));
|
|
43
41
|
|
|
44
|
-
var ImageWrapper = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius:
|
|
42
|
+
var ImageWrapper = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius: 18px;\n object-fit: cover;\n }\n"])));
|
|
45
43
|
|
|
46
|
-
var ProfileButton =
|
|
44
|
+
var ProfileButton = function ProfileButton(_ref) {
|
|
47
45
|
var portraitSrc = _ref.portraitSrc,
|
|
48
46
|
icon = _ref.icon,
|
|
49
47
|
initials = _ref.initials,
|
|
50
48
|
onClick = _ref.onClick,
|
|
51
|
-
hideOnLowWidth = _ref.hideOnLowWidth,
|
|
52
49
|
disabled = _ref.disabled,
|
|
53
50
|
notificationVariant = _ref.notificationVariant,
|
|
54
|
-
className = _ref.className
|
|
55
|
-
tabIndex = _ref.tabIndex;
|
|
51
|
+
className = _ref.className;
|
|
56
52
|
|
|
57
53
|
var renderIcon = function renderIcon() {
|
|
58
54
|
return portraitSrc && /*#__PURE__*/(0, _jsxRuntime.jsxs)(ImageWrapper, {
|
|
59
55
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
60
56
|
src: portraitSrc
|
|
61
57
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(PortraitOverlay, {})]
|
|
62
|
-
}) || initials && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
58
|
+
}) || initials && /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.ComponentM, {
|
|
63
59
|
className: "initials",
|
|
64
|
-
textStyle:
|
|
60
|
+
textStyle: _typography.ComponentTextStyle.Bold,
|
|
65
61
|
color: disabled ? _.COLORS.neutral_300 : _.COLORS.white,
|
|
66
62
|
children: initials
|
|
67
63
|
}) || /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -70,16 +66,12 @@ var ProfileButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
70
66
|
};
|
|
71
67
|
|
|
72
68
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
73
|
-
hideOnLowWidth: hideOnLowWidth,
|
|
74
69
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.IconButton, {
|
|
75
|
-
ref: ref,
|
|
76
70
|
className: className,
|
|
77
71
|
disabled: disabled,
|
|
78
72
|
action: onClick,
|
|
79
73
|
variant: "primary",
|
|
80
|
-
tabIndex: tabIndex,
|
|
81
74
|
shape: "circular",
|
|
82
|
-
hideOnLowWidth: hideOnLowWidth,
|
|
83
75
|
children: [renderIcon(), notificationVariant && /*#__PURE__*/(0, _jsxRuntime.jsx)(NotificationContainer, {
|
|
84
76
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_NotificationDot.NotificationDot, {
|
|
85
77
|
size: _.Size.Small,
|
|
@@ -88,7 +80,8 @@ var ProfileButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
88
80
|
})]
|
|
89
81
|
})
|
|
90
82
|
});
|
|
91
|
-
}
|
|
83
|
+
};
|
|
84
|
+
|
|
92
85
|
ProfileButton.propTypes = {
|
|
93
86
|
portraitSrc: _propTypes.default.string,
|
|
94
87
|
icon: _propTypes.default.node,
|
|
@@ -96,9 +89,7 @@ ProfileButton.propTypes = {
|
|
|
96
89
|
onClick: _propTypes.default.func.isRequired,
|
|
97
90
|
disabled: _propTypes.default.bool,
|
|
98
91
|
notificationVariant: _propTypes.default.oneOf(['positive', 'critical']),
|
|
99
|
-
className: _propTypes.default.string
|
|
100
|
-
hideOnLowWidth: _propTypes.default.bool,
|
|
101
|
-
tabIndex: _propTypes.default.number
|
|
92
|
+
className: _propTypes.default.string
|
|
102
93
|
};
|
|
103
94
|
var _default = ProfileButton;
|
|
104
95
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["PortraitOverlay","styled","div","COLORS","black","Container","StyledPrimaryIconButton","
|
|
1
|
+
{"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["PortraitOverlay","styled","div","COLORS","black","Container","StyledPrimaryIconButton","IconButtonContent","neutral_100","neutral_300","NotificationContainer","ImageWrapper","ProfileButton","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","renderIcon","ComponentTextStyle","Bold","white","Size","Small"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAYA,IAAMA,eAAe,GAAGC,0BAAOC,GAAV,2OAICC,SAAOC,KAJR,CAArB;;AAWA,IAAMC,SAAS,GAAGJ,0BAAOC,GAAV,8yBAYXI,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+BACE,qBAAC,gCAAD;AAAiB,UAAA,IAAI,EAAEM,OAAKC,KAA5B;AAAmC,UAAA,OAAO,EAAEP;AAA5C;AADF,QAHJ;AAAA;AADF,IADF;AAYD,CA7BD;;;AArFEL,EAAAA,W;AACAC,EAAAA,I;AACAC,EAAAA,Q;AACAC,EAAAA,O;AACAC,EAAAA,Q;AACAC,EAAAA,mB,4BAAsB,U,EAAa,U;AACnCC,EAAAA,S;;eA8GaP,a","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { Checkbox, COLORS, defaultOnMouseDownHandler, focusStyles, IconButton, RadioButton, Size, SystemIcons } from '..';\nimport { IconButtonContent, StyledPrimaryIconButton } from '../Button/Iconbutton';\nimport { NotificationDot } from '../NotificationDot';\nimport { ComponentLStyling, ComponentM, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\ntype ProfileButtonProps = {\n portraitSrc?: string;\n icon?: React.ReactNode;\n initials?: string;\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n disabled?: boolean;\n notificationVariant?: 'positive' | 'critical';\n className?: string;\n};\n\nconst PortraitOverlay = styled.div`\n width: 100%;\n height: 100%;\n border-radius: 18px;\n background-color: ${COLORS.black};\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n`;\n\nconst Container = styled.div`\n width: 48px;\n height: 48px;\n display: inline;\n\n .initials {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n ${StyledPrimaryIconButton} {\n display: inline;\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_100};\n svg, svg path {\n fill: ${COLORS.neutral_300};\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ${PortraitOverlay} {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ${PortraitOverlay} {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n`;\n\nconst NotificationContainer = styled.div`\n position: absolute;\n left: 30px;\n bottom: 30px;\n`;\n\nconst ImageWrapper = styled.div`\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius: 18px;\n object-fit: cover;\n }\n`;\n\nconst ProfileButton: React.FunctionComponent<ProfileButtonProps> = ({ portraitSrc, icon, initials, onClick, disabled, notificationVariant, className }) => {\n const renderIcon = () => {\n return (\n (portraitSrc && (\n <ImageWrapper>\n <img src={portraitSrc} />\n <PortraitOverlay />\n </ImageWrapper>\n )) ||\n (initials && (\n <ComponentM className=\"initials\" textStyle={ComponentTextStyle.Bold} color={disabled ? COLORS.neutral_300 : COLORS.white}>\n {initials}\n </ComponentM>\n )) || <>{icon}</>\n );\n };\n\n return (\n <Container>\n <IconButton className={className} disabled={disabled} action={onClick} variant=\"primary\" shape=\"circular\">\n {renderIcon()}\n {notificationVariant && (\n <NotificationContainer>\n <NotificationDot size={Size.Small} variant={notificationVariant} />\n </NotificationContainer>\n )}\n </IconButton>\n </Container>\n );\n};\n\nexport default ProfileButton;\n"],"file":"ProfileButton.cjs"}
|
|
@@ -7,8 +7,6 @@ declare type ProfileButtonProps = {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
notificationVariant?: 'positive' | 'critical';
|
|
9
9
|
className?: string;
|
|
10
|
-
hideOnLowWidth?: boolean;
|
|
11
|
-
tabIndex?: number;
|
|
12
10
|
};
|
|
13
|
-
declare const ProfileButton: React.
|
|
11
|
+
declare const ProfileButton: React.FunctionComponent<ProfileButtonProps>;
|
|
14
12
|
export default ProfileButton;
|
|
@@ -8,26 +8,23 @@ import styled from 'styled-components';
|
|
|
8
8
|
import { COLORS, IconButton, Size } from '..';
|
|
9
9
|
import { IconButtonContent, StyledPrimaryIconButton } from '../Button/Iconbutton';
|
|
10
10
|
import { NotificationDot } from '../NotificationDot';
|
|
11
|
-
import {
|
|
11
|
+
import { ComponentM, ComponentTextStyle } from '../styles/typography';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
|
-
var PortraitOverlay = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n border-radius:
|
|
16
|
-
var Container = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 48px;\n height: 48px;\n display: inline;\n
|
|
17
|
-
return props.hideOnLowWidth ? 'none' : 'inline';
|
|
18
|
-
}, BREAKPOINTS.MEDIUM, IconButtonContent, COLORS.neutral_100, COLORS.neutral_300, PortraitOverlay, PortraitOverlay);
|
|
15
|
+
var PortraitOverlay = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n border-radius: 18px;\n background-color: ", ";\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n"])), COLORS.black);
|
|
16
|
+
var Container = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 48px;\n height: 48px;\n display: inline;\n\n .initials {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n ", " {\n display: inline;\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ", " {\n background-color: ", ";\n svg, svg path {\n fill: ", ";\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ", " {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ", " {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n"])), StyledPrimaryIconButton, IconButtonContent, COLORS.neutral_100, COLORS.neutral_300, PortraitOverlay, PortraitOverlay);
|
|
19
17
|
var NotificationContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n left: 30px;\n bottom: 30px;\n"])));
|
|
20
|
-
var ImageWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius:
|
|
21
|
-
|
|
18
|
+
var ImageWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius: 18px;\n object-fit: cover;\n }\n"])));
|
|
19
|
+
|
|
20
|
+
var ProfileButton = function ProfileButton(_ref) {
|
|
22
21
|
var portraitSrc = _ref.portraitSrc,
|
|
23
22
|
icon = _ref.icon,
|
|
24
23
|
initials = _ref.initials,
|
|
25
24
|
onClick = _ref.onClick,
|
|
26
|
-
hideOnLowWidth = _ref.hideOnLowWidth,
|
|
27
25
|
disabled = _ref.disabled,
|
|
28
26
|
notificationVariant = _ref.notificationVariant,
|
|
29
|
-
className = _ref.className
|
|
30
|
-
tabIndex = _ref.tabIndex;
|
|
27
|
+
className = _ref.className;
|
|
31
28
|
|
|
32
29
|
var renderIcon = function renderIcon() {
|
|
33
30
|
return portraitSrc && /*#__PURE__*/_jsxs(ImageWrapper, {
|
|
@@ -45,16 +42,12 @@ var ProfileButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
45
42
|
};
|
|
46
43
|
|
|
47
44
|
return /*#__PURE__*/_jsx(Container, {
|
|
48
|
-
hideOnLowWidth: hideOnLowWidth,
|
|
49
45
|
children: /*#__PURE__*/_jsxs(IconButton, {
|
|
50
|
-
ref: ref,
|
|
51
46
|
className: className,
|
|
52
47
|
disabled: disabled,
|
|
53
48
|
action: onClick,
|
|
54
49
|
variant: "primary",
|
|
55
|
-
tabIndex: tabIndex,
|
|
56
50
|
shape: "circular",
|
|
57
|
-
hideOnLowWidth: hideOnLowWidth,
|
|
58
51
|
children: [renderIcon(), notificationVariant && /*#__PURE__*/_jsx(NotificationContainer, {
|
|
59
52
|
children: /*#__PURE__*/_jsx(NotificationDot, {
|
|
60
53
|
size: Size.Small,
|
|
@@ -63,7 +56,8 @@ var ProfileButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
63
56
|
})]
|
|
64
57
|
})
|
|
65
58
|
});
|
|
66
|
-
}
|
|
59
|
+
};
|
|
60
|
+
|
|
67
61
|
ProfileButton.propTypes = {
|
|
68
62
|
portraitSrc: _pt.string,
|
|
69
63
|
icon: _pt.node,
|
|
@@ -71,9 +65,7 @@ ProfileButton.propTypes = {
|
|
|
71
65
|
onClick: _pt.func.isRequired,
|
|
72
66
|
disabled: _pt.bool,
|
|
73
67
|
notificationVariant: _pt.oneOf(['positive', 'critical']),
|
|
74
|
-
className: _pt.string
|
|
75
|
-
hideOnLowWidth: _pt.bool,
|
|
76
|
-
tabIndex: _pt.number
|
|
68
|
+
className: _pt.string
|
|
77
69
|
};
|
|
78
70
|
export default ProfileButton;
|
|
79
71
|
//# sourceMappingURL=ProfileButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["React","styled","COLORS","IconButton","Size","IconButtonContent","StyledPrimaryIconButton","NotificationDot","
|
|
1
|
+
{"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["React","styled","COLORS","IconButton","Size","IconButtonContent","StyledPrimaryIconButton","NotificationDot","ComponentM","ComponentTextStyle","PortraitOverlay","div","black","Container","neutral_100","neutral_300","NotificationContainer","ImageWrapper","ProfileButton","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","renderIcon","Bold","white","Small"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAmBC,MAAnB,EAAmEC,UAAnE,EAA4FC,IAA5F,QAAqH,IAArH;AACA,SAASC,iBAAT,EAA4BC,uBAA5B,QAA2D,sBAA3D;AACA,SAASC,eAAT,QAAgC,oBAAhC;AACA,SAA4BC,UA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AAAkC,MAAA,QAAQ,EAAEF,QAA5C;AAAsD,MAAA,MAAM,EAAED,OAA9D;AAAuE,MAAA,OAAO,EAAC,SAA/E;AAAyF,MAAA,KAAK,EAAC,UAA/F;AAAA,iBACGI,UAAU,EADb,EAEGF,mBAAmB,iBAClB,KAAC,qBAAD;AAAA,+BACE,KAAC,eAAD;AAAiB,UAAA,IAAI,EAAEpB,IAAI,CAACyB,KAA5B;AAAmC,UAAA,OAAO,EAAEL;AAA5C;AADF,QAHJ;AAAA;AADF,IADF;AAYD,CA7BD;;;AArFEL,EAAAA,W;AACAC,EAAAA,I;AACAC,EAAAA,Q;AACAC,EAAAA,O;AACAC,EAAAA,Q;AACAC,EAAAA,mB,aAAsB,U,EAAa,U;AACnCC,EAAAA,S;;AA8GF,eAAeP,aAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { Checkbox, COLORS, defaultOnMouseDownHandler, focusStyles, IconButton, RadioButton, Size, SystemIcons } from '..';\nimport { IconButtonContent, StyledPrimaryIconButton } from '../Button/Iconbutton';\nimport { NotificationDot } from '../NotificationDot';\nimport { ComponentLStyling, ComponentM, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\ntype ProfileButtonProps = {\n portraitSrc?: string;\n icon?: React.ReactNode;\n initials?: string;\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n disabled?: boolean;\n notificationVariant?: 'positive' | 'critical';\n className?: string;\n};\n\nconst PortraitOverlay = styled.div`\n width: 100%;\n height: 100%;\n border-radius: 18px;\n background-color: ${COLORS.black};\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n`;\n\nconst Container = styled.div`\n width: 48px;\n height: 48px;\n display: inline;\n\n .initials {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n ${StyledPrimaryIconButton} {\n display: inline;\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_100};\n svg, svg path {\n fill: ${COLORS.neutral_300};\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ${PortraitOverlay} {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ${PortraitOverlay} {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n`;\n\nconst NotificationContainer = styled.div`\n position: absolute;\n left: 30px;\n bottom: 30px;\n`;\n\nconst ImageWrapper = styled.div`\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius: 18px;\n object-fit: cover;\n }\n`;\n\nconst ProfileButton: React.FunctionComponent<ProfileButtonProps> = ({ portraitSrc, icon, initials, onClick, disabled, notificationVariant, className }) => {\n const renderIcon = () => {\n return (\n (portraitSrc && (\n <ImageWrapper>\n <img src={portraitSrc} />\n <PortraitOverlay />\n </ImageWrapper>\n )) ||\n (initials && (\n <ComponentM className=\"initials\" textStyle={ComponentTextStyle.Bold} color={disabled ? COLORS.neutral_300 : COLORS.white}>\n {initials}\n </ComponentM>\n )) || <>{icon}</>\n );\n };\n\n return (\n <Container>\n <IconButton className={className} disabled={disabled} action={onClick} variant=\"primary\" shape=\"circular\">\n {renderIcon()}\n {notificationVariant && (\n <NotificationContainer>\n <NotificationDot size={Size.Small} variant={notificationVariant} />\n </NotificationContainer>\n )}\n </IconButton>\n </Container>\n );\n};\n\nexport default ProfileButton;\n"],"file":"ProfileButton.js"}
|
|
@@ -19,49 +19,103 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
19
19
|
|
|
20
20
|
var _styles = require("../styles");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _types = require("../types");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _Button = require("../Button");
|
|
25
|
+
|
|
26
|
+
var _SystemIcons = require("../icons/systemicons/SystemIcons");
|
|
27
|
+
|
|
28
|
+
var _CommonStyles = require("../GlobalNavigationBar/mobile/CommonStyles");
|
|
29
|
+
|
|
30
|
+
var _SwitcherMenuItem = _interopRequireDefault(require("./SwitcherMenuItem"));
|
|
31
|
+
|
|
32
|
+
var _typography = require("../styles/typography");
|
|
33
|
+
|
|
34
|
+
var _zIndexes = require("../styles/z-indexes");
|
|
25
35
|
|
|
26
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
37
|
|
|
28
|
-
var _templateObject;
|
|
38
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
29
39
|
|
|
30
40
|
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); }
|
|
31
41
|
|
|
32
42
|
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; }
|
|
33
43
|
|
|
34
|
-
var
|
|
44
|
+
var Menu = _styledComponents.default.ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0;\n background-color: ", ";\n box-sizing: border-box;\n display: none;\n -webkit-animation: ", " 0.2s ease-in-out;\n animation: ", " 0.2s ease-in-out;\n position: absolute;\n border-radius: 4px;\n z-index: ", ";\n height: 100%;\n width: 320px;\n padding-inline-start: 0;\n overflow-y: scroll;\n ", " {\n min-width: 360px;\n }\n\n .open & {\n display: flex;\n flex-direction: column;\n }\n\n ", ";\n"])), _styles.COLORS.white, _CommonStyles.flowDown, _CommonStyles.flowDown, _zIndexes.Z_INDEXES.off_canvas, _styles.BREAKPOINTS.SMALL, (0, _styles.scrollBarStyling)(_types.Size.Small));
|
|
45
|
+
|
|
46
|
+
var MenuSection = _styledComponents.default.li(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n padding: 8px 0;\n position: relative;\n\n .disabled-link {\n color: #21212150;\n pointer-events: none;\n key-events: none;\n }\n"])));
|
|
47
|
+
|
|
48
|
+
var MenuSectionList = _styledComponents.default.ul(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0;\n overflow-y: unset !important;\n padding-inline-start: 0;\n\n ", "\n"])), _CommonStyles.UserMenuSectionListStyling);
|
|
49
|
+
|
|
50
|
+
var Top = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 22px 12px 0 12px;\n color: ", ";\n\n h3 {\n margin-block-start: 0 !important;\n margin-block-end: 0 !important;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n margin-left: 24px;\n\n ", "\n }\n"])), _styles.COLORS.neutral_600, (0, _typography.ComponentSStyling)(_styles.ComponentTextStyle.Regular, 'inherit'));
|
|
51
|
+
|
|
52
|
+
var LabelLine = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n height: 32px;\n background-color: ", ";\n padding-left: 24px;\n display: flex;\n line-height: 32px;\n"])), _styles.COLORS.neutral_20);
|
|
35
53
|
|
|
36
54
|
var MobileSwitcherMenu = function MobileSwitcherMenu(_ref) {
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
var header = _ref.header,
|
|
56
|
+
elementsHeader = _ref.elementsHeader,
|
|
57
|
+
clickMenuAction = _ref.clickMenuAction,
|
|
58
|
+
elements = _ref.elements;
|
|
59
|
+
React.useEffect(function () {
|
|
60
|
+
function handleKeyPress(e) {
|
|
61
|
+
if (e.keyCode === 27) {
|
|
62
|
+
clickMenuAction();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
document.addEventListener('keydown', handleKeyPress, false);
|
|
67
|
+
return function () {
|
|
68
|
+
document.removeEventListener('keydown', handleKeyPress, false);
|
|
69
|
+
};
|
|
70
|
+
}, [clickMenuAction]);
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Menu, {
|
|
72
|
+
onClick: function onClick() {},
|
|
43
73
|
role: "menu",
|
|
44
74
|
"aria-labelledby": "UserMenuButton",
|
|
45
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
75
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Top, {
|
|
76
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
77
|
+
variant: "secondary",
|
|
78
|
+
shape: "circular",
|
|
79
|
+
action: clickMenuAction,
|
|
80
|
+
isInMobileMenu: true,
|
|
81
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.ArrowLineLeft, {
|
|
82
|
+
size: "24px",
|
|
83
|
+
color: _styles.COLORS.neutral_600
|
|
84
|
+
})
|
|
85
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
86
|
+
children: header
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CommonStyles.Right, {
|
|
88
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
89
|
+
variant: "secondary",
|
|
90
|
+
shape: "circular",
|
|
91
|
+
action: clickMenuAction,
|
|
92
|
+
isInMobileMenu: true,
|
|
93
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Close, {
|
|
94
|
+
size: "24px"
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
})]
|
|
98
|
+
}), elements && (elements === null || elements === void 0 ? void 0 : elements.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(MenuSection, {
|
|
99
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(LabelLine, {
|
|
100
|
+
children: elementsHeader
|
|
101
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(MenuSectionList, {
|
|
102
|
+
children: elements === null || elements === void 0 ? void 0 : elements.map(function (element) {
|
|
103
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SwitcherMenuItem.default, {
|
|
104
|
+
url: element === null || element === void 0 ? void 0 : element.to,
|
|
105
|
+
label: element === null || element === void 0 ? void 0 : element.label,
|
|
106
|
+
Icon: element.icon
|
|
107
|
+
});
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
55
110
|
})]
|
|
56
111
|
});
|
|
57
112
|
};
|
|
58
113
|
|
|
59
114
|
MobileSwitcherMenu.propTypes = {
|
|
60
|
-
label: _propTypes.default.string.isRequired,
|
|
61
115
|
header: _propTypes.default.string.isRequired,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
116
|
+
elementsHeader: _propTypes.default.string.isRequired,
|
|
117
|
+
clickMenuAction: _propTypes.default.func.isRequired,
|
|
118
|
+
elements: _propTypes.default.array
|
|
65
119
|
};
|
|
66
120
|
var _default = MobileSwitcherMenu;
|
|
67
121
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Switcher/MobileSwitcherMenu.tsx"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../src/Switcher/MobileSwitcherMenu.tsx"],"names":["Menu","styled","ul","COLORS","white","flowDown","Z_INDEXES","off_canvas","BREAKPOINTS","SMALL","Size","Small","MenuSection","li","MenuSectionList","UserMenuSectionListStyling","Top","div","neutral_600","ComponentTextStyle","Regular","LabelLine","span","neutral_20","MobileSwitcherMenu","header","elementsHeader","clickMenuAction","elements","React","useEffect","handleKeyPress","e","keyCode","document","addEventListener","removeEventListener","length","map","element","to","label","icon"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,IAAI,GAAGC,0BAAOC,EAAV,8hBAGYC,eAAOC,KAHnB,EAMaC,sBANb,EAOKA,sBAPL,EAUGC,oBAAUC,UAVb,EAeNC,oBAAYC,KAfN,EAwBN,8BAAiBC,YAAKC,KAAtB,CAxBM,CAAV;;AA2BA,IAAMC,WAAW,GAAGX,0BAAOY,EAAV,qOAAjB;;AAWA,IAAMC,eAAe,GAAGb,0BAAOC,EAAV,kMAMjBa,wCANiB,CAArB;;AASA,IAAMC,GAAG,GAAGf,0BAAOgB,GAAV,mYAKEd,eAAOe,WALT,EAcH,mCAAkBC,2BAAmBC,OAArC,EAA8C,SAA9C,CAdG,CAAT;;AAkBA,IAAMC,SAAS,GAAGpB,0BAAOqB,IAAV,mMAEOnB,eAAOoB,UAFd,CAAf;;AAeA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,OAAkE;AAAA,MAA/DC,MAA+D,QAA/DA,MAA+D;AAAA,MAAvDC,cAAuD,QAAvDA,cAAuD;AAAA,MAAvCC,eAAuC,QAAvCA,eAAuC;AAAA,MAAtBC,QAAsB,QAAtBA,QAAsB;AAC3FC,EAAAA,KAAK,CAACC,SAAN,CAAgB,YAAM;AACpB,aAASC,cAAT,CAAwBC,CAAxB,EAAgC;AAC9B,UAAIA,CAAC,CAACC,OAAF,KAAc,EAAlB,EAAsB;AACpBN,QAAAA,eAAe;AAChB;AAC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AA,GAAG,EAAEA,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEC,EAAhC;AAAoC,YAAA,KAAK,EAAED,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEE,KAApD;AAA2D,YAAA,IAAI,EAAEF,OAAO,CAACG;AAAzE,YADa;AAAA,SAAd;AADH,QAFF;AAAA,MAbJ;AAAA,IADF;AAyBD,CAvCD;;;AANEjB,EAAAA,M;AACAC,EAAAA,c;AACAC,EAAAA,e;AACAC,EAAAA,Q;;eA4CaJ,kB","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, scrollBarStyling} from '../styles';\n\nimport {Size, UserMenuItem} from '../types';\nimport {IconButton} from '../Button';\nimport {ArrowLineLeft, Close} from '../icons/systemicons/SystemIcons';\nimport {flowDown, Right, UserMenuSectionListStyling} from '../GlobalNavigationBar/mobile/CommonStyles';\nimport SwitcherMenuItem from './SwitcherMenuItem';\nimport {ComponentSStyling} from '../styles/typography';\nimport {Z_INDEXES} from '../styles/z-indexes';\n\nconst Menu = styled.ul`\n list-style: none;\n margin: 0;\n background-color: ${COLORS.white};\n box-sizing: border-box;\n display: none;\n -webkit-animation: ${flowDown} 0.2s ease-in-out;\n animation: ${flowDown} 0.2s ease-in-out;\n position: absolute;\n border-radius: 4px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n width: 320px;\n padding-inline-start: 0;\n overflow-y: scroll;\n ${BREAKPOINTS.SMALL} {\n min-width: 360px;\n }\n\n .open & {\n display: flex;\n flex-direction: column;\n }\n\n ${scrollBarStyling(Size.Small)};\n`;\n\nconst MenuSection = styled.li`\n padding: 8px 0;\n position: relative;\n\n .disabled-link {\n color: #21212150;\n pointer-events: none;\n key-events: none;\n }\n`;\n\nconst MenuSectionList = styled.ul`\n list-style: none;\n margin: 0;\n overflow-y: unset !important;\n padding-inline-start: 0;\n\n ${UserMenuSectionListStyling}\n`;\n\nconst Top = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 22px 12px 0 12px;\n color: ${COLORS.neutral_600};\n\n h3 {\n margin-block-start: 0 !important;\n margin-block-end: 0 !important;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n margin-left: 24px;\n\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n }\n`;\n\nconst LabelLine = styled.span`\n height: 32px;\n background-color: ${COLORS.neutral_20};\n padding-left: 24px;\n display: flex;\n line-height: 32px;\n`;\n\ninterface Props {\n header: string;\n elementsHeader: string;\n clickMenuAction: () => void;\n elements?: UserMenuItem[];\n}\n\nconst MobileSwitcherMenu = ({ header, elementsHeader, clickMenuAction, elements }: Props) => {\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 return (\n <Menu onClick={() => {}} role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <Top>\n <IconButton variant=\"secondary\" shape=\"circular\" action={clickMenuAction} isInMobileMenu={true}>\n <ArrowLineLeft size=\"24px\" color={COLORS.neutral_600} />\n </IconButton>\n <h3>{header}</h3>\n <Right>\n <IconButton variant=\"secondary\" shape=\"circular\" action={clickMenuAction} isInMobileMenu={true}>\n <Close size=\"24px\" />\n </IconButton>\n </Right>\n </Top>\n {elements && elements?.length > 0 && (\n <MenuSection>\n <LabelLine>{elementsHeader}</LabelLine>\n <MenuSectionList>\n {elements?.map((element) => (\n <SwitcherMenuItem url={element?.to} label={element?.label} Icon={element.icon} />\n ))}\n </MenuSectionList>\n </MenuSection>\n )}\n </Menu>\n );\n};\n\nexport default MobileSwitcherMenu;\n"],"file":"MobileSwitcherMenu.cjs"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UserMenuItem } from '../types';
|
|
2
2
|
interface Props {
|
|
3
|
-
label: string;
|
|
4
3
|
header: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
elementsHeader: string;
|
|
5
|
+
clickMenuAction: () => void;
|
|
6
|
+
elements?: UserMenuItem[];
|
|
8
7
|
}
|
|
9
|
-
declare const MobileSwitcherMenu: ({
|
|
8
|
+
declare const MobileSwitcherMenu: ({ header, elementsHeader, clickMenuAction, elements }: Props) => JSX.Element;
|
|
10
9
|
export default MobileSwitcherMenu;
|