@laerdal/life-react-components 1.8.0-dev.19.full → 1.8.0-dev.20

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.
Files changed (147) hide show
  1. package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +107 -176
  2. package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
  3. package/dist/GlobalNavigationBar/GlobalNavigationBar.d.ts +13 -27
  4. package/dist/GlobalNavigationBar/GlobalNavigationBar.js +106 -176
  5. package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
  6. package/dist/GlobalNavigationBar/Logo.cjs +3 -5
  7. package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
  8. package/dist/GlobalNavigationBar/Logo.js +1 -1
  9. package/dist/GlobalNavigationBar/Logo.js.map +1 -1
  10. package/dist/GlobalNavigationBar/NavigationHelper.cjs +38 -0
  11. package/dist/GlobalNavigationBar/NavigationHelper.cjs.map +1 -0
  12. package/dist/GlobalNavigationBar/NavigationHelper.d.ts +4 -0
  13. package/dist/GlobalNavigationBar/NavigationHelper.js +27 -0
  14. package/dist/GlobalNavigationBar/NavigationHelper.js.map +1 -0
  15. package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +127 -0
  16. package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs.map +1 -0
  17. package/dist/GlobalNavigationBar/desktop/DesktopActions.d.ts +15 -0
  18. package/dist/GlobalNavigationBar/desktop/DesktopActions.js +98 -0
  19. package/dist/GlobalNavigationBar/desktop/DesktopActions.js.map +1 -0
  20. package/dist/GlobalNavigationBar/{ExtendedMainMenu.cjs → desktop/ExtendedMainMenu.cjs} +7 -9
  21. package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +1 -0
  22. package/dist/GlobalNavigationBar/{ExtendedMainMenu.d.ts → desktop/ExtendedMainMenu.d.ts} +2 -2
  23. package/dist/GlobalNavigationBar/{ExtendedMainMenu.js → desktop/ExtendedMainMenu.js} +6 -6
  24. package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -0
  25. package/dist/GlobalNavigationBar/{MainMenu.cjs → desktop/MainMenu.cjs} +17 -21
  26. package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -0
  27. package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +8 -0
  28. package/dist/GlobalNavigationBar/{MainMenu.js → desktop/MainMenu.js} +17 -21
  29. package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -0
  30. package/dist/GlobalNavigationBar/{RightSideNav.cjs → desktop/RightSideNav.cjs} +22 -26
  31. package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +1 -0
  32. package/dist/GlobalNavigationBar/desktop/RightSideNav.d.ts +8 -0
  33. package/dist/GlobalNavigationBar/desktop/RightSideNav.js +59 -0
  34. package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +1 -0
  35. package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +204 -0
  36. package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +1 -0
  37. package/dist/GlobalNavigationBar/desktop/UserMenu.d.ts +7 -0
  38. package/dist/GlobalNavigationBar/desktop/UserMenu.js +163 -0
  39. package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +1 -0
  40. package/dist/GlobalNavigationBar/index.cjs +15 -18
  41. package/dist/GlobalNavigationBar/index.cjs.map +1 -1
  42. package/dist/GlobalNavigationBar/index.d.ts +2 -2
  43. package/dist/GlobalNavigationBar/index.js +2 -2
  44. package/dist/GlobalNavigationBar/index.js.map +1 -1
  45. package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs +15 -21
  46. package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
  47. package/dist/GlobalNavigationBar/mobile/CommonStyles.d.ts +3 -6
  48. package/dist/GlobalNavigationBar/mobile/CommonStyles.js +14 -15
  49. package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
  50. package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs +114 -221
  51. package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
  52. package/dist/GlobalNavigationBar/mobile/MobileMenu.d.ts +6 -25
  53. package/dist/GlobalNavigationBar/mobile/MobileMenu.js +113 -216
  54. package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
  55. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs +221 -0
  56. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs.map +1 -0
  57. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.d.ts +11 -0
  58. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js +184 -0
  59. package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js.map +1 -0
  60. package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs +160 -0
  61. package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs.map +1 -0
  62. package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.d.ts +12 -0
  63. package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js +139 -0
  64. package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js.map +1 -0
  65. package/dist/GlobalNavigationBar/types.cjs +6 -0
  66. package/dist/GlobalNavigationBar/types.cjs.map +1 -0
  67. package/dist/GlobalNavigationBar/types.d.ts +120 -0
  68. package/dist/GlobalNavigationBar/types.js +2 -0
  69. package/dist/GlobalNavigationBar/types.js.map +1 -0
  70. package/dist/MenuItem/MenuItem.cjs +16 -10
  71. package/dist/MenuItem/MenuItem.cjs.map +1 -1
  72. package/dist/MenuItem/MenuItem.d.ts +3 -3
  73. package/dist/MenuItem/MenuItem.js +14 -8
  74. package/dist/MenuItem/MenuItem.js.map +1 -1
  75. package/dist/ProfileButton/ProfileButton.cjs +20 -11
  76. package/dist/ProfileButton/ProfileButton.cjs.map +1 -1
  77. package/dist/ProfileButton/ProfileButton.d.ts +3 -1
  78. package/dist/ProfileButton/ProfileButton.js +18 -10
  79. package/dist/ProfileButton/ProfileButton.js.map +1 -1
  80. package/dist/Switcher/MobileSwitcherMenu.cjs +24 -78
  81. package/dist/Switcher/MobileSwitcherMenu.cjs.map +1 -1
  82. package/dist/Switcher/MobileSwitcherMenu.d.ts +6 -5
  83. package/dist/Switcher/MobileSwitcherMenu.js +26 -70
  84. package/dist/Switcher/MobileSwitcherMenu.js.map +1 -1
  85. package/dist/common/StackState.cjs +47 -0
  86. package/dist/common/StackState.cjs.map +1 -0
  87. package/dist/common/StackState.d.ts +7 -0
  88. package/dist/common/StackState.js +30 -0
  89. package/dist/common/StackState.js.map +1 -0
  90. package/dist/hooks/useClickOutside.cjs +6 -2
  91. package/dist/hooks/useClickOutside.cjs.map +1 -1
  92. package/dist/hooks/useClickOutside.d.ts +1 -1
  93. package/dist/hooks/useClickOutside.js +6 -2
  94. package/dist/hooks/useClickOutside.js.map +1 -1
  95. package/dist/index.cjs +8 -8
  96. package/dist/index.cjs.map +1 -1
  97. package/dist/index.d.ts +1 -1
  98. package/dist/index.js +1 -1
  99. package/dist/index.js.map +1 -1
  100. package/dist/types.cjs.map +1 -1
  101. package/dist/types.d.ts +0 -32
  102. package/dist/types.js.map +1 -1
  103. package/package.json +10 -8
  104. package/dist/GlobalNavigationBar/Actions.cjs +0 -185
  105. package/dist/GlobalNavigationBar/Actions.cjs.map +0 -1
  106. package/dist/GlobalNavigationBar/Actions.d.ts +0 -13
  107. package/dist/GlobalNavigationBar/Actions.js +0 -160
  108. package/dist/GlobalNavigationBar/Actions.js.map +0 -1
  109. package/dist/GlobalNavigationBar/Avatar.cjs +0 -104
  110. package/dist/GlobalNavigationBar/Avatar.cjs.map +0 -1
  111. package/dist/GlobalNavigationBar/Avatar.d.ts +0 -15
  112. package/dist/GlobalNavigationBar/Avatar.js +0 -77
  113. package/dist/GlobalNavigationBar/Avatar.js.map +0 -1
  114. package/dist/GlobalNavigationBar/ExtendedMainMenu.cjs.map +0 -1
  115. package/dist/GlobalNavigationBar/ExtendedMainMenu.js.map +0 -1
  116. package/dist/GlobalNavigationBar/MainMenu.cjs.map +0 -1
  117. package/dist/GlobalNavigationBar/MainMenu.d.ts +0 -8
  118. package/dist/GlobalNavigationBar/MainMenu.js.map +0 -1
  119. package/dist/GlobalNavigationBar/RightSideNav.cjs.map +0 -1
  120. package/dist/GlobalNavigationBar/RightSideNav.d.ts +0 -8
  121. package/dist/GlobalNavigationBar/RightSideNav.js +0 -61
  122. package/dist/GlobalNavigationBar/RightSideNav.js.map +0 -1
  123. package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs +0 -112
  124. package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs.map +0 -1
  125. package/dist/GlobalNavigationBar/UserMenu/MenuLink.d.ts +0 -11
  126. package/dist/GlobalNavigationBar/UserMenu/MenuLink.js +0 -86
  127. package/dist/GlobalNavigationBar/UserMenu/MenuLink.js.map +0 -1
  128. package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs +0 -178
  129. package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs.map +0 -1
  130. package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.d.ts +0 -16
  131. package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js +0 -146
  132. package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js.map +0 -1
  133. package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs +0 -168
  134. package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs.map +0 -1
  135. package/dist/GlobalNavigationBar/UserMenu/UserMenu.d.ts +0 -15
  136. package/dist/GlobalNavigationBar/UserMenu/UserMenu.js +0 -135
  137. package/dist/GlobalNavigationBar/UserMenu/UserMenu.js.map +0 -1
  138. package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs +0 -49
  139. package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs.map +0 -1
  140. package/dist/GlobalNavigationBar/mobile/ExitMenuButton.d.ts +0 -6
  141. package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js +0 -27
  142. package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js.map +0 -1
  143. package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs +0 -91
  144. package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs.map +0 -1
  145. package/dist/GlobalNavigationBar/mobile/MobileActionMenu.d.ts +0 -13
  146. package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js +0 -70
  147. package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js.map +0 -1
@@ -3,20 +3,20 @@ import { Size } from '../types';
3
3
  import { DropdownItem } from '../Dropdown/DropdownContent';
4
4
  export interface MenuItemProps {
5
5
  item: DropdownItem;
6
- onClickHandler: (e: any) => void;
6
+ onClickHandler: (e: React.MouseEvent) => void;
7
7
  active: boolean;
8
8
  id: string;
9
- key: string;
10
9
  size?: Size;
11
10
  className?: string;
12
11
  tabIndex?: number;
12
+ iconRight?: React.ReactElement;
13
13
  }
14
14
  export declare const DropdownButton: import("styled-components").StyledComponent<"button", any, {
15
15
  size?: Size | undefined;
16
16
  }, never>;
17
17
  export declare const ItemLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
18
18
  export declare const ItemIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
19
- export declare const LockedIconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
19
+ export declare const ItemIconRight: import("styled-components").StyledComponent<"div", any, {}, never>;
20
20
  export declare const ItemContent: import("styled-components").StyledComponent<"div", any, {}, never>;
21
21
  export declare const DropdownButtonCSS: (size?: Size | undefined) => import("styled-components").FlattenSimpleInterpolation;
22
22
  declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLButtonElement>>;
@@ -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 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);
20
+ export var ItemIconRight = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\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, ItemIconRight);
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,10 +28,11 @@ 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
- key = _ref.key,
32
- size = _ref.size,
31
+ _ref$size = _ref.size,
32
+ size = _ref$size === void 0 ? Size.Medium : _ref$size,
33
33
  className = _ref.className,
34
34
  tabIndex = _ref.tabIndex,
35
+ iconRight = _ref.iconRight,
35
36
  id = _ref.id;
36
37
  return /*#__PURE__*/_jsxs(DropdownButton, {
37
38
  type: "button",
@@ -59,24 +60,29 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
59
60
  },
60
61
  children: item.noteLabel
61
62
  })]
62
- }), item.locked && /*#__PURE__*/_jsx(LockedIconContainer, {
63
+ }), item.locked && /*#__PURE__*/_jsx(ItemIconRight, {
63
64
  children: /*#__PURE__*/_jsx(LockedOn, {
64
65
  color: COLORS.neutral_400,
65
66
  className: "extraMargin",
66
67
  size: "24px"
67
68
  })
69
+ }), !item.locked && !!iconRight && /*#__PURE__*/_jsx(ItemIconRight, {
70
+ children: /*#__PURE__*/React.cloneElement(iconRight, {
71
+ className: 'extraMargin',
72
+ size: '24px'
73
+ })
68
74
  })]
69
75
  })]
70
76
  })]
71
- }, key);
77
+ });
72
78
  });
73
79
  MenuItem.propTypes = {
74
80
  onClickHandler: _pt.func.isRequired,
75
81
  active: _pt.bool.isRequired,
76
82
  id: _pt.string.isRequired,
77
- key: _pt.string.isRequired,
78
83
  className: _pt.string,
79
- tabIndex: _pt.number
84
+ tabIndex: _pt.number,
85
+ iconRight: _pt.element
80
86
  };
81
87
  export default MenuItem;
82
88
  //# 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","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,QAAsD,WAAtD;AACA,SAAsBC,QAAtB,QAAqC,kCAArC;AACA,SAAiBC,IAAjB,QAA4B,UAA5B;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA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UI,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"}
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","ItemIconRight","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","className","tabIndex","iconRight","id","disabled","locked","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize","lineHeight","neutral_400","cloneElement"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,MAAP,IAAiBC,GAAjB,QAA4B,mBAA5B;AACA,SAAqBC,MAArB,EAA6BC,kBAA7B,QAAsD,WAAtD;AACA,SAAsBC,QAAtB,QAAqC,kCAArC;AACA,SAAiBC,IAAjB,QAA4B,UAA5B;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,QAAsE,sBAAtE;AAEA,SAAQC,wBAAR,EAAkCC,yBAAlC,QAAkE,WAAlE;;;AAaA,OAAO,IAAMC,cAAc,GAAGX,MAAM,CAACY,MAAV,gFACvB,UAACC,KAAD;AAAA,SAAWC,iBAAiB,CAACD,KAAK,CAACE,IAAP,CAA5B;AAAA,CADuB,CAApB;AAIP,OAAO,IAAMC,SAAS,GAAGhB,MAAM,CAACiB,GAAV,uEAAf;AACP,OAAO,IAAMC,QAAQ,GAAGlB,MAAM,CAACiB,GAAV,uEAAd;AACP,OAAO,IAAME,aAAa,GAAGnB,MAAM,CAACiB,GAAV,mHAAnB;AAKP,OAAO,IAAMG,WAAW,GAAGpB,MAAM,CAACiB,GAAV,0hBAMlBD,SANkB,EAalBE,QAbkB,EAqBlBC,aArBkB,CAAjB;AA+BP,OAAO,IAAML,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,IAAD,EAAiB;AAChD,SAAOd,GAAP,8+CACIc,IAAI,IAAIV,IAAI,CAACgB,KAAb,IAAsBb,iBAAiB,CAACL,kBAAkB,CAACmB,OAApB,EAA6BpB,MAAM,CAACqB,WAApC,CAD3C,EAEIR,IAAI,IAAIV,IAAI,CAACmB,MAAb,IAAuBjB,iBAAiB,C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,CAACH,SAAlB,iBACA,KAAC,aAAD;AAAA,iCACG5C,KAAK,CAACwD,YAAN,CAAmBZ,SAAnB,EAA8B;AAACF,YAAAA,SAAS,EAAE,aAAZ;AAA2B1B,YAAAA,IAAI,EAAE;AAAjC,WAA9B;AADH,UAbJ;AAAA,QAFF;AAAA,MAXJ;AAAA,IADF;AAoCD,CA7CgB,CAAjB;;AAzIGyB,EAAAA,c;AACAF,EAAAA,M;AACAM,EAAAA,E;AAEAH,EAAAA,S;AACAC,EAAAA,Q;AACAC,EAAAA,S;;AAkLH,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: React.MouseEvent) => void;\n active: boolean;\n id: string;\n size?: Size;\n className?: string;\n tabIndex?: number;\n iconRight?: React.ReactElement;\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``;\nexport const ItemIconRight = styled.div`\n align-items: center;\n display: flex;\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 ${ItemIconRight} {\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 size = Size.Medium,\n className,\n tabIndex,\n iconRight,\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 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 {\n item.locked &&\n <ItemIconRight>\n <LockedOn color={COLORS.neutral_400} className=\"extraMargin\" size=\"24px\"/>\n </ItemIconRight>\n }\n {\n !item.locked && !!iconRight &&\n <ItemIconRight>\n {React.cloneElement(iconRight, {className: 'extraMargin', size: '24px',})}\n </ItemIconRight>\n }\n\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 _typography = require("../styles/typography");
26
+ var _styles = require("../styles");
27
27
 
28
28
  var _jsxRuntime = require("react/jsx-runtime");
29
29
 
@@ -33,31 +33,35 @@ 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: 18px;\n background-color: ", ";\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n"])), _.COLORS.black);
36
+ var PortraitOverlay = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: 100%;\n border-radius: 50%;\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\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);
38
+ var Container = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ", " {\n display: ", ";\n\n ", " {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ", " {\n background-color: ", ";\n\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, function (props) {
39
+ return props.hideOnLowWidth ? 'none' : 'inline';
40
+ }, _styles.BREAKPOINTS.MEDIUM, _Iconbutton.IconButtonContent, _.COLORS.neutral_100, _.COLORS.neutral_300, PortraitOverlay, PortraitOverlay);
39
41
 
40
42
  var NotificationContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n left: 30px;\n bottom: 30px;\n"])));
41
43
 
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"])));
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: 50%;\n object-fit: cover;\n }\n"])));
43
45
 
44
- var ProfileButton = function ProfileButton(_ref) {
46
+ var ProfileButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
45
47
  var portraitSrc = _ref.portraitSrc,
46
48
  icon = _ref.icon,
47
49
  initials = _ref.initials,
48
50
  onClick = _ref.onClick,
51
+ hideOnLowWidth = _ref.hideOnLowWidth,
49
52
  disabled = _ref.disabled,
50
53
  notificationVariant = _ref.notificationVariant,
51
- className = _ref.className;
54
+ className = _ref.className,
55
+ tabIndex = _ref.tabIndex;
52
56
 
53
57
  var renderIcon = function renderIcon() {
54
58
  return portraitSrc && /*#__PURE__*/(0, _jsxRuntime.jsxs)(ImageWrapper, {
55
59
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
56
60
  src: portraitSrc
57
61
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PortraitOverlay, {})]
58
- }) || initials && /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.ComponentM, {
62
+ }) || initials && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ComponentM, {
59
63
  className: "initials",
60
- textStyle: _typography.ComponentTextStyle.Bold,
64
+ textStyle: _styles.ComponentTextStyle.Bold,
61
65
  color: disabled ? _.COLORS.neutral_300 : _.COLORS.white,
62
66
  children: initials
63
67
  }) || /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
@@ -66,12 +70,16 @@ var ProfileButton = function ProfileButton(_ref) {
66
70
  };
67
71
 
68
72
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
73
+ hideOnLowWidth: hideOnLowWidth,
69
74
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.IconButton, {
75
+ ref: ref,
70
76
  className: className,
71
77
  disabled: disabled,
72
78
  action: onClick,
73
79
  variant: "primary",
80
+ tabIndex: tabIndex,
74
81
  shape: "circular",
82
+ hideOnLowWidth: hideOnLowWidth,
75
83
  children: [renderIcon(), notificationVariant && /*#__PURE__*/(0, _jsxRuntime.jsx)(NotificationContainer, {
76
84
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_NotificationDot.NotificationDot, {
77
85
  size: _.Size.Small,
@@ -80,8 +88,7 @@ var ProfileButton = function ProfileButton(_ref) {
80
88
  })]
81
89
  })
82
90
  });
83
- };
84
-
91
+ });
85
92
  ProfileButton.propTypes = {
86
93
  portraitSrc: _propTypes.default.string,
87
94
  icon: _propTypes.default.node,
@@ -89,7 +96,9 @@ ProfileButton.propTypes = {
89
96
  onClick: _propTypes.default.func.isRequired,
90
97
  disabled: _propTypes.default.bool,
91
98
  notificationVariant: _propTypes.default.oneOf(['positive', 'critical']),
92
- className: _propTypes.default.string
99
+ className: _propTypes.default.string,
100
+ hideOnLowWidth: _propTypes.default.bool,
101
+ tabIndex: _propTypes.default.number
93
102
  };
94
103
  var _default = ProfileButton;
95
104
  exports.default = _default;
@@ -1 +1 @@
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,mCAZW,EAoBPC,6BApBO,EAqBaJ,SAAOK,WArBpB,EAuBGL,SAAOM,WAvBV,EA8BPT,eA9BO,EAsCPA,eAtCO,CAAf;;AA8CA,IAAMU,qBAAqB,GAAGT,0BAAOC,GAAV,8IAA3B;;AAMA,IAAMS,YAAY,GAAGV,0BAAOC,GAAV,sPAAlB;;AAaA,IAAMU,aAA0D,GAAG,SAA7DA,aAA6D,OAAwF;AAAA,MAArFC,WAAqF,QAArFA,WAAqF;AAAA,MAAxEC,IAAwE,QAAxEA,IAAwE;AAAA,MAAlEC,QAAkE,QAAlEA,QAAkE;AAAA,MAAxDC,OAAwD,QAAxDA,OAAwD;AAAA,MAA/CC,QAA+C,QAA/CA,QAA+C;AAAA,MAArCC,mBAAqC,QAArCA,mBAAqC;AAAA,MAAhBC,SAAgB,QAAhBA,SAAgB;;AACzJ,MAAMC,UAAU,GAAG,SAAbA,UAAa,GAAM;AACvB,WACGP,WAAW,iBACV,sBAAC,YAAD;AAAA,8BACE;AAAK,QAAA,GAAG,EAAEA;AAAV,QADF,eAEE,qBAAC,eAAD,KAFF;AAAA,MADF,IAMCE,QAAQ,iBACP,qBAAC,sBAAD;AAAY,MAAA,SAAS,EAAC,UAAtB;AAAiC,MAAA,SAAS,EAAEM,+BAAmBC,IAA/D;AAAqE,MAAA,KAAK,EAAEL,QAAQ,GAAGd,SAAOM,WAAV,GAAwBN,SAAOoB,KAAnH;AAAA,gBACGR;AADH,MAPF,iBAUM;AAAA,gBAAGD;AAAH,MAXR;AAaD,GAdD;;AAgBA,sBACE,qBAAC,SAAD;AAAA,2BACE,sBAAC,YAAD;AAAY,MAAA,SAAS,EAAEK,SAAvB;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,qBAAC,qBAAD;AAAA,+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"}
1
+ {"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["PortraitOverlay","styled","div","COLORS","black","Container","StyledPrimaryIconButton","props","hideOnLowWidth","BREAKPOINTS","MEDIUM","IconButtonContent","neutral_100","neutral_300","NotificationContainer","ImageWrapper","ProfileButton","React","forwardRef","ref","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","tabIndex","renderIcon","ComponentTextStyle","Bold","white","Size","Small"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAcA,IAAMA,eAAe,GAAGC,0BAAOC,GAAV,0OAICC,SAAOC,KAJR,CAArB;;AAWA,IAAMC,SAAS,GAAGJ,0BAAOC,GAAV,8vBAMXI,mCANW,EAOA,UAAAC,KAAK;AAAA,SAAKA,KAAK,CAACC,cAAN,GAAuB,MAAvB,GAAgC,QAArC;AAAA,CAPL,EASTC,oBAAYC,MATH,EAkBPC,6BAlBO,EAmBaR,SAAOS,WAnBpB,EAsBGT,SAAOU,WAtBV,EA6BPb,eA7BO,EAqCPA,eArCO,CAAf;;AA6CA,IAAMc,qBAAqB,GAAGb,0BAAOC,GAAV,8IAA3B;;AAMA,IAAMa,YAAY,GAAGd,0BAAOC,GAAV,qPAAlB;;AAaA,IAAMc,aAAa,gBAAGC,KAAK,CAACC,UAAN,CAAwD,gBAUIC,GAVJ,EAUY;AAAA,MATTC,WASS,QATTA,WASS;AAAA,MARTC,IAQS,QARTA,IAQS;AAAA,MAPTC,QAOS,QAPTA,QAOS;AAAA,MANTC,OAMS,QANTA,OAMS;AAAA,MALTf,cAKS,QALTA,cAKS;AAAA,MAJTgB,QAIS,QAJTA,QAIS;AAAA,MAHTC,mBAGS,QAHTA,mBAGS;AAAA,MAFTC,SAES,QAFTA,SAES;AAAA,MADTC,QACS,QADTA,QACS;;AACxF,MAAMC,UAAU,GAAG,SAAbA,UAAa,GAAM;AACvB,WACGR,WAAW,iBACV,sBAAC,YAAD;AAAA,8BACE;AAAK,QAAA,GAAG,EAAEA;AAAV,QADF,eAEE,qBAAC,eAAD,KAFF;AAAA,MADF,IAMCE,QAAQ,iBACP,qBAAC,kBAAD;AAAY,MAAA,SAAS,EAAC,UAAtB;AAAiC,MAAA,SAAS,EAAEO,2BAAmBC,IAA/D;AACY,MAAA,KAAK,EAAEN,QAAQ,GAAGrB,SAAOU,WAAV,GAAwBV,SAAO4B,KAD1D;AAAA,gBAEGT;AAFH,MAPF,iBAWM;AAAA,gBAAGD;AAAH,MAZR;AAcD,GAfD;;AAiBA,sBACE,qBAAC,SAAD;AAAW,IAAA,cAAc,EAAEb,cAA3B;AAAA,2BACE,sBAAC,YAAD;AAAY,MAAA,GAAG,EAAEW,GAAjB;AACY,MAAA,SAAS,EAAEO,SADvB;AAEY,MAAA,QAAQ,EAAEF,QAFtB;AAGY,MAAA,MAAM,EAAED,OAHpB;AAIY,MAAA,OAAO,EAAC,SAJpB;AAKY,MAAA,QAAQ,EAAEI,QALtB;AAMY,MAAA,KAAK,EAAC,UANlB;AAOY,MAAA,cAAc,EAAEnB,cAP5B;AAAA,iBAQGoB,UAAU,EARb,EASGH,mBAAmB,iBAClB,qBAAC,qBAAD;AAAA,+BACE,qBAAC,gCAAD;AAAiB,UAAA,IAAI,EAAEO,OAAKC,KAA5B;AAAmC,UAAA,OAAO,EAAER;AAA5C;AADF,QAVJ;AAAA;AADF,IADF;AAmBD,CA/CqB,CAAtB;;AAtFEL,EAAAA,W;AACAC,EAAAA,I;AACAC,EAAAA,Q;AACAC,EAAAA,O;AACAC,EAAAA,Q;AACAC,EAAAA,mB,4BAAsB,U,EAAa,U;AACnCC,EAAAA,S;AACAlB,EAAAA,c;AACAmB,EAAAA,Q;;eA+HaX,a","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {COLORS, IconButton, Size} from '..';\nimport {IconButtonContent, StyledPrimaryIconButton} from '../Button/Iconbutton';\nimport {NotificationDot} from '../NotificationDot';\nimport {BREAKPOINTS, ComponentM, ComponentTextStyle} from '../styles';\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 hideOnLowWidth?: boolean;\n tabIndex?: number;\n};\n\nconst PortraitOverlay = styled.div`\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: ${COLORS.black};\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n`;\n\nconst Container = styled.div<{ hideOnLowWidth?: boolean }>`\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ${StyledPrimaryIconButton} {\n display: ${props => (props.hideOnLowWidth ? 'none' : 'inline')};\n\n ${BREAKPOINTS.MEDIUM} {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_100};\n\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: 50%;\n object-fit: cover;\n }\n`;\n\nconst ProfileButton = React.forwardRef<HTMLButtonElement, ProfileButtonProps>(({\n portraitSrc,\n icon,\n initials,\n onClick,\n hideOnLowWidth,\n disabled,\n notificationVariant,\n className,\n tabIndex\n }, ref) => {\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}\n color={disabled ? COLORS.neutral_300 : COLORS.white}>\n {initials}\n </ComponentM>\n )) || <>{icon}</>\n );\n };\n\n return (\n <Container hideOnLowWidth={hideOnLowWidth}>\n <IconButton ref={ref}\n className={className}\n disabled={disabled}\n action={onClick}\n variant=\"primary\"\n tabIndex={tabIndex}\n shape=\"circular\"\n hideOnLowWidth={hideOnLowWidth}>\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,6 +7,8 @@ declare type ProfileButtonProps = {
7
7
  disabled?: boolean;
8
8
  notificationVariant?: 'positive' | 'critical';
9
9
  className?: string;
10
+ hideOnLowWidth?: boolean;
11
+ tabIndex?: number;
10
12
  };
11
- declare const ProfileButton: React.FunctionComponent<ProfileButtonProps>;
13
+ declare const ProfileButton: React.ForwardRefExoticComponent<ProfileButtonProps & React.RefAttributes<HTMLButtonElement>>;
12
14
  export default ProfileButton;
@@ -8,23 +8,26 @@ 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 { ComponentM, ComponentTextStyle } from '../styles/typography';
11
+ import { BREAKPOINTS, ComponentM, ComponentTextStyle } from '../styles';
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: 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);
15
+ var PortraitOverlay = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n border-radius: 50%;\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 user-select: none;\n \n ", " {\n display: ", ";\n\n ", " {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ", " {\n background-color: ", ";\n\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, function (props) {
17
+ return props.hideOnLowWidth ? 'none' : 'inline';
18
+ }, BREAKPOINTS.MEDIUM, IconButtonContent, COLORS.neutral_100, COLORS.neutral_300, PortraitOverlay, PortraitOverlay);
17
19
  var NotificationContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n left: 30px;\n bottom: 30px;\n"])));
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) {
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: 50%;\n object-fit: cover;\n }\n"])));
21
+ var ProfileButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
21
22
  var portraitSrc = _ref.portraitSrc,
22
23
  icon = _ref.icon,
23
24
  initials = _ref.initials,
24
25
  onClick = _ref.onClick,
26
+ hideOnLowWidth = _ref.hideOnLowWidth,
25
27
  disabled = _ref.disabled,
26
28
  notificationVariant = _ref.notificationVariant,
27
- className = _ref.className;
29
+ className = _ref.className,
30
+ tabIndex = _ref.tabIndex;
28
31
 
29
32
  var renderIcon = function renderIcon() {
30
33
  return portraitSrc && /*#__PURE__*/_jsxs(ImageWrapper, {
@@ -42,12 +45,16 @@ var ProfileButton = function ProfileButton(_ref) {
42
45
  };
43
46
 
44
47
  return /*#__PURE__*/_jsx(Container, {
48
+ hideOnLowWidth: hideOnLowWidth,
45
49
  children: /*#__PURE__*/_jsxs(IconButton, {
50
+ ref: ref,
46
51
  className: className,
47
52
  disabled: disabled,
48
53
  action: onClick,
49
54
  variant: "primary",
55
+ tabIndex: tabIndex,
50
56
  shape: "circular",
57
+ hideOnLowWidth: hideOnLowWidth,
51
58
  children: [renderIcon(), notificationVariant && /*#__PURE__*/_jsx(NotificationContainer, {
52
59
  children: /*#__PURE__*/_jsx(NotificationDot, {
53
60
  size: Size.Small,
@@ -56,8 +63,7 @@ var ProfileButton = function ProfileButton(_ref) {
56
63
  })]
57
64
  })
58
65
  });
59
- };
60
-
66
+ });
61
67
  ProfileButton.propTypes = {
62
68
  portraitSrc: _pt.string,
63
69
  icon: _pt.node,
@@ -65,7 +71,9 @@ ProfileButton.propTypes = {
65
71
  onClick: _pt.func.isRequired,
66
72
  disabled: _pt.bool,
67
73
  notificationVariant: _pt.oneOf(['positive', 'critical']),
68
- className: _pt.string
74
+ className: _pt.string,
75
+ hideOnLowWidth: _pt.bool,
76
+ tabIndex: _pt.number
69
77
  };
70
78
  export default ProfileButton;
71
79
  //# sourceMappingURL=ProfileButton.js.map
@@ -1 +1 @@
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,UAA5B,EAA2DC,kBAA3D,QAAqF,sBAArF;;;;AAYA,IAAMC,eAAe,GAAGT,MAAM,CAACU,GAAV,6NAICT,MAAM,CAACU,KAJR,CAArB;AAWA,IAAMC,SAAS,GAAGZ,MAAM,CAACU,GAAV,gyBAYXL,uBAZW,EAoBPD,iBApBO,EAqBaH,MAAM,CAACY,WArBpB,EAuBGZ,MAAM,CAACa,WAvBV,EA8BPL,eA9BO,EAsCPA,eAtCO,CAAf;AA8CA,IAAMM,qBAAqB,GAAGf,MAAM,CAACU,GAAV,gIAA3B;AAMA,IAAMM,YAAY,GAAGhB,MAAM,CAACU,GAAV,wOAAlB;;AAaA,IAAMO,aAA0D,GAAG,SAA7DA,aAA6D,OAA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B,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"}
1
+ {"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["React","styled","COLORS","IconButton","Size","IconButtonContent","StyledPrimaryIconButton","NotificationDot","BREAKPOINTS","ComponentM","ComponentTextStyle","PortraitOverlay","div","black","Container","props","hideOnLowWidth","MEDIUM","neutral_100","neutral_300","NotificationContainer","ImageWrapper","ProfileButton","forwardRef","ref","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","tabIndex","renderIcon","Bold","white","Small"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,MAAR,EAAgBC,UAAhB,EAA4BC,IAA5B,QAAuC,IAAvC;AACA,SAAQC,iBAAR,EAA2BC,uBAA3B,QAAyD,sBAAzD;AACA,SAAQC,eAAR,QAA8B,oBAA9B;AACA,SAAQC,WAAR,EAAqBC,UAArB,EAAiCC,kBAAjC,QAA0D,WAA1D;;;;AAcA,IAAMC,eAAe,GAAGV,MAAM,CAACW,GAAV,4NAICV,MAAM,CAACW,KAJR,CAArB;AAWA,IAAMC,SAAS,GAAGb,MAAM,CAACW,GAAV,gvBAMXN,uBANW,EAOA,UAAAS,KAAK;AAA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MAAA,SAAS,EAAEO,SADvB;AAEY,MAAA,QAAQ,EAAEF,QAFtB;AAGY,MAAA,MAAM,EAAED,OAHpB;AAIY,MAAA,OAAO,EAAC,SAJpB;AAKY,MAAA,QAAQ,EAAEI,QALtB;AAMY,MAAA,KAAK,EAAC,UANlB;AAOY,MAAA,cAAc,EAAEhB,cAP5B;AAAA,iBAQGiB,UAAU,EARb,EASGH,mBAAmB,iBAClB,KAAC,qBAAD;AAAA,+BACE,KAAC,eAAD;AAAiB,UAAA,IAAI,EAAE1B,IAAI,CAACgC,KAA5B;AAAmC,UAAA,OAAO,EAAEN;AAA5C;AADF,QAVJ;AAAA;AADF,IADF;AAmBD,CA/CqB,CAAtB;;AAtFEL,EAAAA,W;AACAC,EAAAA,I;AACAC,EAAAA,Q;AACAC,EAAAA,O;AACAC,EAAAA,Q;AACAC,EAAAA,mB,aAAsB,U,EAAa,U;AACnCC,EAAAA,S;AACAf,EAAAA,c;AACAgB,EAAAA,Q;;AA+HF,eAAeV,aAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {COLORS, IconButton, Size} from '..';\nimport {IconButtonContent, StyledPrimaryIconButton} from '../Button/Iconbutton';\nimport {NotificationDot} from '../NotificationDot';\nimport {BREAKPOINTS, ComponentM, ComponentTextStyle} from '../styles';\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 hideOnLowWidth?: boolean;\n tabIndex?: number;\n};\n\nconst PortraitOverlay = styled.div`\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: ${COLORS.black};\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n`;\n\nconst Container = styled.div<{ hideOnLowWidth?: boolean }>`\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ${StyledPrimaryIconButton} {\n display: ${props => (props.hideOnLowWidth ? 'none' : 'inline')};\n\n ${BREAKPOINTS.MEDIUM} {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_100};\n\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: 50%;\n object-fit: cover;\n }\n`;\n\nconst ProfileButton = React.forwardRef<HTMLButtonElement, ProfileButtonProps>(({\n portraitSrc,\n icon,\n initials,\n onClick,\n hideOnLowWidth,\n disabled,\n notificationVariant,\n className,\n tabIndex\n }, ref) => {\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}\n color={disabled ? COLORS.neutral_300 : COLORS.white}>\n {initials}\n </ComponentM>\n )) || <>{icon}</>\n );\n };\n\n return (\n <Container hideOnLowWidth={hideOnLowWidth}>\n <IconButton ref={ref}\n className={className}\n disabled={disabled}\n action={onClick}\n variant=\"primary\"\n tabIndex={tabIndex}\n shape=\"circular\"\n hideOnLowWidth={hideOnLowWidth}>\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,103 +19,49 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
19
19
 
20
20
  var _styles = require("../styles");
21
21
 
22
- var _types = require("../types");
22
+ var _MobileMenuHeader = _interopRequireDefault(require("../GlobalNavigationBar/mobile/MobileMenuHeader"));
23
23
 
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");
24
+ var _MobileMenuContent = _interopRequireDefault(require("../GlobalNavigationBar/mobile/MobileMenuContent"));
35
25
 
36
26
  var _jsxRuntime = require("react/jsx-runtime");
37
27
 
38
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
28
+ var _templateObject;
39
29
 
40
30
  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); }
41
31
 
42
32
  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; }
43
33
 
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);
34
+ var Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 320px;\n z-index: ", ";\n height: 100%;\n\n display: flex;\n flex-direction: row;\n gap: 8px;\n\n ", " {\n width: 400px;\n }\n"])), _styles.Z_INDEXES.off_canvas, _styles.BREAKPOINTS.SMALL);
53
35
 
54
36
  var MobileSwitcherMenu = function MobileSwitcherMenu(_ref) {
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() {},
37
+ var label = _ref.label,
38
+ header = _ref.header,
39
+ note = _ref.note,
40
+ onMenuClose = _ref.onMenuClose,
41
+ items = _ref.items;
42
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
73
43
  role: "menu",
74
44
  "aria-labelledby": "UserMenuButton",
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
- })]
45
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_MobileMenuHeader.default, {
46
+ onGoBack: onMenuClose,
47
+ label: label,
48
+ onClose: onMenuClose
49
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MobileMenuContent.default, {
50
+ header: {
51
+ header: header,
52
+ note: note
53
+ },
54
+ items: items
110
55
  })]
111
56
  });
112
57
  };
113
58
 
114
59
  MobileSwitcherMenu.propTypes = {
60
+ label: _propTypes.default.string.isRequired,
115
61
  header: _propTypes.default.string.isRequired,
116
- elementsHeader: _propTypes.default.string.isRequired,
117
- clickMenuAction: _propTypes.default.func.isRequired,
118
- elements: _propTypes.default.array
62
+ note: _propTypes.default.string,
63
+ onMenuClose: _propTypes.default.func.isRequired,
64
+ items: _propTypes.default.array
119
65
  };
120
66
  var _default = MobileSwitcherMenu;
121
67
  exports.default = _default;
@@ -1 +1 @@
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;AACF;;AAEDO,IAAAA,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,EAAqCJ,cAArC,EAAqD,KAArD;AACA,WAAO,YAAM;AACXG,MAAAA,QAAQ,CAACE,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AAEE,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
+ {"version":3,"sources":["../../src/Switcher/MobileSwitcherMenu.tsx"],"names":["Wrapper","styled","div","Z_INDEXES","off_canvas","BREAKPOINTS","SMALL","MobileSwitcherMenu","label","header","note","onMenuClose","items"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;AAEA,IAAMA,OAAO,GAAGC,0BAAOC,GAAV,uOAEAC,kBAAUC,UAFV,EASTC,oBAAYC,KATH,CAAb;;AAuBA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,OAAsD;AAAA,MAApDC,KAAoD,QAApDA,KAAoD;AAAA,MAA7CC,MAA6C,QAA7CA,MAA6C;AAAA,MAArCC,IAAqC,QAArCA,IAAqC;AAAA,MAA/BC,WAA+B,QAA/BA,WAA+B;AAAA,MAAlBC,KAAkB,QAAlBA,KAAkB;AAC/E,sBACE,sBAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,uBAAgB,gBAArC;AAAA,4BACE,qBAAC,yBAAD;AAAkB,MAAA,QAAQ,EAAED,WAA5B;AACkB,MAAA,KAAK,EAAEH,KADzB;AAEkB,MAAA,OAAO,EAAEG;AAF3B,MADF,eAIE,qBAAC,0BAAD;AAAmB,MAAA,MAAM,EAAE;AAACF,QAAAA,MAAM,EAANA,MAAD;AAASC,QAAAA,IAAI,EAAJA;AAAT,OAA3B;AACmB,MAAA,KAAK,EAAEE;AAD1B,MAJF;AAAA,IADF;AASD,CAVD;;;AAPEJ,EAAAA,K;AACAC,EAAAA,M;AACAC,EAAAA,I;AACAC,EAAAA,W;AACAC,EAAAA,K;;eAeaL,kB","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS} from '../styles';\nimport {Z_INDEXES} from '../styles';\nimport {MenuNavigationItemTypeItem} from '../GlobalNavigationBar';\nimport MobileMenuHeader from '../GlobalNavigationBar/mobile/MobileMenuHeader';\nimport MobileMenuContent from '../GlobalNavigationBar/mobile/MobileMenuContent';\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n\n display: flex;\n flex-direction: row;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\n\ninterface Props {\n label: string;\n header: string;\n note?: string;\n onMenuClose: () => void;\n items?: MenuNavigationItemTypeItem[];\n}\n\nconst MobileSwitcherMenu = ({label, header, note, onMenuClose, items}: Props) => {\n return (\n <Wrapper role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MobileMenuHeader onGoBack={onMenuClose}\n label={label}\n onClose={onMenuClose}/>\n <MobileMenuContent header={{header, note}}\n items={items}/>\n </Wrapper>\n );\n};\n\nexport default MobileSwitcherMenu;\n"],"file":"MobileSwitcherMenu.cjs"}
@@ -1,9 +1,10 @@
1
- import { UserMenuItem } from '../types';
1
+ import { MenuNavigationItemTypeItem } from '../GlobalNavigationBar';
2
2
  interface Props {
3
+ label: string;
3
4
  header: string;
4
- elementsHeader: string;
5
- clickMenuAction: () => void;
6
- elements?: UserMenuItem[];
5
+ note?: string;
6
+ onMenuClose: () => void;
7
+ items?: MenuNavigationItemTypeItem[];
7
8
  }
8
- declare const MobileSwitcherMenu: ({ header, elementsHeader, clickMenuAction, elements }: Props) => JSX.Element;
9
+ declare const MobileSwitcherMenu: ({ label, header, note, onMenuClose, items }: Props) => JSX.Element;
9
10
  export default MobileSwitcherMenu;