@laerdal/life-react-components 2.1.0-dev.3 → 2.1.1-dev.2
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/AuthPage/AuthPage.d.ts +1 -1
- package/dist/Banners/Banner.d.ts +1 -1
- package/dist/Banners/OverviewBanner.d.ts +1 -1
- package/dist/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/Button/Iconbutton.cjs +6 -4
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.d.ts +1 -0
- package/dist/Button/Iconbutton.js +6 -4
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardActions.d.ts +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardBody.d.ts +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.d.ts +1 -1
- package/dist/Card/HorizontalCard/types.d.ts +4 -4
- package/dist/Chips/ChipTypes.d.ts +2 -2
- package/dist/ChipsInput/ChipDropdownInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipDropdownInput.d.ts +1 -1
- package/dist/ChipsInput/ChipDropdownInput.js.map +1 -1
- package/dist/ChipsInput/ChipInput.cjs +13 -2
- package/dist/ChipsInput/ChipInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipInput.js +14 -3
- package/dist/ChipsInput/ChipInput.js.map +1 -1
- package/dist/ChipsInput/ChipInputField.cjs +1 -0
- package/dist/ChipsInput/ChipInputField.cjs.map +1 -1
- package/dist/ChipsInput/ChipInputField.js +1 -0
- package/dist/ChipsInput/ChipInputField.js.map +1 -1
- package/dist/ChipsInput/ChipInputTypes.cjs.map +1 -1
- package/dist/ChipsInput/ChipInputTypes.d.ts +2 -1
- package/dist/ChipsInput/ChipInputTypes.js.map +1 -1
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.d.ts +3 -3
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- 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/DropdownButtonTypes.d.ts +3 -3
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +13 -7
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.d.ts +3 -2
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js +13 -7
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
- package/dist/GlobalNavigationBar/Logo.d.ts +1 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +3 -12
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.d.ts +1 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js +3 -12
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.d.ts +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.d.ts +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +4 -2
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.js +4 -2
- package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs +3 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.d.ts +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js +3 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs +2 -2
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js +3 -2
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js.map +1 -1
- package/dist/GlobalNavigationBar/types.d.ts +7 -7
- package/dist/Image/ImageWithFallbacks.d.ts +1 -1
- package/dist/InputFields/Label.d.ts +1 -1
- package/dist/InputFields/QuickSearch.d.ts +1 -1
- package/dist/InputFields/ResponsiveComponentWrapper.d.ts +1 -1
- package/dist/InputFields/SearchBar.d.ts +1 -1
- package/dist/InputFields/components/SearchBarInput.d.ts +1 -1
- package/dist/InputFields/types.d.ts +3 -3
- package/dist/List/ListRow.d.ts +1 -1
- package/dist/LoadingIndicator/LoadingIndicator.d.ts +1 -1
- package/dist/MiniProductCard/MiniProductCard.d.ts +1 -1
- package/dist/Modals/Modal.d.ts +1 -1
- package/dist/Modals/ModalContainer.d.ts +2 -2
- package/dist/Modals/ModalTypes.d.ts +1 -1
- package/dist/NavItem/NavItem.d.ts +1 -1
- package/dist/Paginator/Paginator.d.ts +1 -1
- package/dist/Popover/Popover.d.ts +4 -4
- package/dist/ProfileButton/ProfileButton.d.ts +1 -1
- package/dist/QuizButton/QuizButton.d.ts +1 -1
- package/dist/SideMenu/types.d.ts +3 -3
- package/dist/SkipToContent/SkipToContent.d.ts +1 -1
- package/dist/Table/TableTypes.d.ts +4 -4
- package/dist/Tabs/TabLink.d.ts +1 -1
- package/dist/Tabs/Tabs.d.ts +1 -1
- package/dist/Tag/Tag.cjs +1 -1
- package/dist/Tag/Tag.cjs.map +1 -1
- package/dist/Tag/Tag.d.ts +2 -2
- package/dist/Tag/Tag.js +1 -1
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Tile/TileTypes.d.ts +8 -8
- package/dist/Toasters/Toast.d.ts +2 -2
- package/dist/Toasters/ToastContext.d.ts +2 -2
- package/dist/assets/index.d.ts +1 -1
- package/dist/icons/index.d.ts +2 -2
- package/dist/styles/typography.d.ts +2 -2
- package/package.json +10 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileMenu.js","names":["React","styled","BREAKPOINTS","COLORS","ComponentSStyling","ComponentTextStyle","ComponentXSStyling","Z_INDEXES","SwitchApp","useLocation","IconButton","LaerdalLogo","MobileMenuHeader","MobileMenuContent","useStackState","useMediaMatch","Wrapper","div","off_canvas","SMALL","SwitcherLabel","MobileFooter","neutral_200","Bold","neutral_600","CustomContent","MobileMenu","show","profile","buttons","label","header","items","footer","action","onClose","reset","length","push","pop","peek","isMediumScreen","LARGE","replace","location","onSubMenuOpen","menu","type","content","customContent","custom","useEffect","setTimeout","current","switcher","find","a","undefined"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling, Z_INDEXES} from '../../styles';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {useLocation} from 'react-router-dom';\nimport {IconButton} from '../../Button';\nimport {LaerdalLogo} from '../../assets';\nimport {\n MenuAccountInfo,\n MenuButton,\n MenuNavigationItemTypeGroup,\n MenuGroupFooter,\n MenuGroupHeader,\n MenuIconButton,\n MenuNavigationItemTypeItem,\n MobileNavigationMenuProps,\n ProfileMenu,\n MenuNavigationItemTypeSection,\n MobileMenuButtonTypes,\n MenuSwitcherButton,\n MenuNavigationCustomSubMenu\n} from '../types';\nimport MobileMenuHeader from './MobileMenuHeader';\nimport MobileMenuContent from './MobileMenuContent';\nimport {useStackState} from '../../common/StackState';\nimport {useMediaMatch} from \"rooks\";\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\nconst SwitcherLabel = styled.div`\n margin-left: auto;\n`;\n\nconst MobileFooter = styled.div`\n display: flex;\n align-items: center;\n box-sizing: border-box;\n height: 48px;\n\n padding: 0 4px 0 16px;\n border-top: 1px solid ${COLORS.neutral_200};\n\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n padding: 4px 8px 4px 16px;\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst CustomContent = styled.div`\n width: 100%;\n box-sizing: border-box;\n flex-flow: column;\n display: flex;\n flex: 1;\n overflow: hidden;\n`;\n\ntype Props = MobileNavigationMenuProps & {\n profile?: ProfileMenu;\n show?: boolean;\n onClose: () => void;\n};\n\ninterface MenuState {\n header: {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n }\n content?: {\n header?: MenuGroupHeader;\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection)[];\n footer?: MenuGroupFooter;\n action?: MenuButton;\n },\n customContent?: () => React.ReactNode;\n footer?: boolean;\n}\n\nconst MobileMenu = ({\n show,\n profile,\n buttons,\n label,\n header,\n items,\n footer,\n action,\n onClose,\n }: Props) => {\n\n const {reset, length, push, pop, peek} = useStackState<MenuState>();\n\n const isMediumScreen = useMediaMatch(BREAKPOINTS.LARGE.replace('@media ', ''));\n\n const location = useLocation();\n\n const onSubMenuOpen = (menu?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => {\n\n switch (menu?.type) {\n case 'group':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n content: {\n header: menu.header,\n items: menu.items,\n footer: menu.footer,\n action: menu.action\n },\n footer: false\n });\n break;\n case 'custom':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n customContent: menu.custom,\n footer: false\n });\n break;\n default:\n break;\n }\n\n };\n\n React.useEffect(() => {\n onClose();\n }, [location]);\n\n React.useEffect(() => {\n isMediumScreen && onClose()\n }, [isMediumScreen]);\n\n React.useEffect(() => {\n setTimeout(() => {\n reset({\n footer: true,\n header: {\n label: label,\n buttons: buttons,\n },\n content: {\n header: header,\n items: items,\n footer: footer,\n action: action\n }\n })\n }, 300)\n }, [show])\n\n\n const current = peek();\n\n const switcher = current?.header?.buttons?.find(a => a.type === 'switcher') as MenuSwitcherButton;\n\n return (\n <Wrapper>\n <MobileMenuHeader buttons={current?.header.buttons}\n onGoBack={length > 1 ? pop : undefined}\n onSubMenuOpen={onSubMenuOpen}\n profile={profile}\n label={current?.header.label}\n onClose={onClose}/>\n {current?.customContent && <CustomContent>{current?.customContent()}</CustomContent>}\n {current?.content && <MobileMenuContent header={current?.content.header}\n items={current?.content.items}\n footer={current?.content.footer}\n action={current?.content.action}\n onSubMenuOpen={onSubMenuOpen}/>}\n\n {\n current?.footer &&\n <MobileFooter>\n <LaerdalLogo height={'36px'} width={'66px'}/>\n {switcher &&\n <>\n <SwitcherLabel className={'globalNav-toggler'}>Switch site</SwitcherLabel>\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n id=\"globalNavAppsButton\"\n action={() => switcher.action && switcher.action() && onClose()}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n </>\n }\n\n </MobileFooter>\n }\n </Wrapper>\n );\n};\n\nexport default MobileMenu;\n"],"mappings":";;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAAQC,WAAW,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAEC,kBAAkB,EAAEC,SAAS,QAAO,cAAc;AACtH,SAAQC,SAAS,QAAO,qCAAqC;AAC7D,SAAQC,WAAW,QAAO,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O,uBAAPA,OAAO,CAAEL,OAAO,CAACf,MAAO;MAChC,MAAM,EAAEoB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEL,OAAO,CAACd,MAAO;MAChC,aAAa,EAAEW;IAAc,EAAE,EAGrE,CAAAQ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEpB,MAAM,kBACf,MAAC,YAAY;MAAA,wBACX,KAAC,WAAW;QAAC,MAAM,EAAE,MAAO;QAAC,KAAK,EAAE;MAAO,EAAE,EAC5CqB,QAAQ,iBACP;QAAA,wBACE,KAAC,aAAa;UAAC,SAAS,EAAE,mBAAoB;UAAA;QAAA,EAA4B,eAC1E,KAAC,UAAU;UACT,OAAO,EAAE,WAAY;UACrB,KAAK,EAAE,UAAW;UAClB,EAAE,EAAC,qBAAqB;UACxB,MAAM,EAAE;YAAA,OAAMA,QAAQ,CAACpB,MAAM,IAAIoB,QAAQ,CAACpB,MAAM,EAAE,IAAIC,OAAO,EAAE;UAAA,CAAC;UAAA,uBAChE,KAAC,SAAS;YAAC,IAAI,EAAC;UAAM;QAAE,EACb;MAAA,EACZ;IAAA,EAGQ;EAAA,EAET;AAEd,CAAC;AAAC;EA1IAR,IAAI;EACJQ,OAAO;AAAA;AA2IT,eAAeT,UAAU"}
|
|
1
|
+
{"version":3,"file":"MobileMenu.js","names":["React","styled","BREAKPOINTS","COLORS","ComponentSStyling","ComponentTextStyle","ComponentXSStyling","Z_INDEXES","SwitchApp","useLocation","IconButton","LaerdalLogo","MobileMenuHeader","MobileMenuContent","useStackState","useMediaMatch","Wrapper","div","off_canvas","SMALL","SwitcherLabel","MobileFooter","neutral_200","Bold","neutral_600","CustomContent","MobileMenu","show","profile","buttons","label","header","items","footer","action","onClose","reset","length","push","pop","peek","isMediumScreen","LARGE","replace","location","onSubMenuOpen","menu","type","content","customContent","custom","useEffect","setTimeout","current","switcher","find","a","undefined"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling, Z_INDEXES} from '../../styles';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {useLocation} from 'react-router-dom';\nimport {IconButton} from '../../Button';\nimport {LaerdalLogo} from '../../assets';\nimport {\n MenuAccountInfo,\n MenuButton,\n MenuNavigationItemTypeGroup,\n MenuGroupFooter,\n MenuGroupHeader,\n MenuIconButton,\n MenuNavigationItemTypeItem,\n MobileNavigationMenuProps,\n ProfileMenu,\n MenuNavigationItemTypeSection,\n MobileMenuButtonTypes,\n MenuSwitcherButton,\n MenuNavigationCustomSubMenu\n} from '../types';\nimport MobileMenuHeader from './MobileMenuHeader';\nimport MobileMenuContent from './MobileMenuContent';\nimport {useStackState} from '../../common/StackState';\nimport {useMediaMatch} from \"rooks\";\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\nconst SwitcherLabel = styled.div`\n margin-left: auto;\n`;\n\nconst MobileFooter = styled.div`\n display: flex;\n align-items: center;\n box-sizing: border-box;\n height: 48px;\n\n padding: 0 4px 0 16px;\n border-top: 1px solid ${COLORS.neutral_200};\n\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n padding: 4px 8px 4px 16px;\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst CustomContent = styled.div`\n width: 100%;\n box-sizing: border-box;\n flex-flow: column;\n display: flex;\n flex: 1;\n overflow: hidden;\n`;\n\ntype Props = MobileNavigationMenuProps & {\n profile?: ProfileMenu;\n show?: boolean;\n onClose: () => void;\n};\n\ninterface MenuState {\n header: {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n }\n content?: {\n header?: MenuGroupHeader;\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection)[];\n footer?: MenuGroupFooter;\n action?: MenuButton;\n },\n customContent?: () => React.ReactNode;\n footer?: boolean;\n}\n\nconst MobileMenu = ({\n show,\n profile,\n buttons,\n label,\n header,\n items,\n footer,\n action,\n onClose,\n }: Props) => {\n\n const {reset, length, push, pop, peek} = useStackState<MenuState>();\n\n const isMediumScreen = useMediaMatch(BREAKPOINTS.LARGE.replace('@media ', ''));\n\n const location = useLocation();\n\n const onSubMenuOpen = (menu?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => {\n\n switch (menu?.type) {\n case 'group':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n content: {\n header: menu.header,\n items: menu.items,\n footer: menu.footer,\n action: menu.action\n },\n footer: false\n });\n break;\n case 'custom':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n customContent: menu.custom,\n footer: false\n });\n break;\n default:\n break;\n }\n\n };\n\n React.useEffect(() => {\n onClose();\n }, [location]);\n\n React.useEffect(() => {\n isMediumScreen && onClose()\n }, [isMediumScreen]);\n\n React.useEffect(() => {\n setTimeout(() => {\n reset({\n footer: true,\n header: {\n label: label,\n buttons: buttons,\n },\n content: {\n header: header,\n items: items,\n footer: footer,\n action: action\n }\n })\n }, 300)\n }, [show])\n\n\n const current = peek();\n\n const switcher = current?.header?.buttons?.find(a => a.type === 'switcher') as MenuSwitcherButton;\n\n return (\n <Wrapper>\n <MobileMenuHeader buttons={current?.header.buttons}\n onGoBack={length > 1 ? pop : undefined}\n onSubMenuOpen={onSubMenuOpen}\n profile={profile}\n label={current?.header.label}\n onClose={onClose}/>\n {current?.customContent && <CustomContent>{current?.customContent()}</CustomContent>}\n {current?.content && <MobileMenuContent header={current?.content.header}\n items={current?.content.items}\n footer={current?.content.footer}\n action={current?.content.action}\n onSubMenuOpen={onSubMenuOpen}/>}\n\n {\n current?.footer &&\n <MobileFooter>\n <LaerdalLogo height={'36px'} width={'66px'}/>\n {switcher &&\n <>\n <SwitcherLabel className={'globalNav-toggler'} onClick={() => switcher.action && switcher.action() && onClose()}>Switch site</SwitcherLabel>\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n id=\"globalNavAppsButton\"\n action={() => switcher.action && switcher.action() && onClose()}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n </>\n }\n\n </MobileFooter>\n }\n </Wrapper>\n );\n};\n\nexport default MobileMenu;\n"],"mappings":";;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAAQC,WAAW,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAEC,kBAAkB,EAAEC,SAAS,QAAO,cAAc;AACtH,SAAQC,SAAS,QAAO,qCAAqC;AAC7D,SAAQC,WAAW,QAAO,kBAAkB;AAC5C,SAAQC,UAAU,QAAO,cAAc;AACvC,SAAQC,WAAW,QAAO,cAAc;AAgBxC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAAQC,aAAa,QAAO,yBAAyB;AACrD,SAAQC,aAAa,QAAO,OAAO;AAAC;AAAA;AAAA;AAEpC,IAAMC,OAAO,GAAGf,MAAM,CAACgB,GAAG,uPAEbV,SAAS,CAACW,UAAU,EAQ7BhB,WAAW,CAACiB,KAAK,CAGpB;AAED,IAAMC,aAAa,GAAGnB,MAAM,CAACgB,GAAG,+FAE/B;AAED,IAAMI,YAAY,GAAGpB,MAAM,CAACgB,GAAG,iTAOLd,MAAM,CAACmB,WAAW,EAExChB,kBAAkB,CAACD,kBAAkB,CAACkB,IAAI,EAAEpB,MAAM,CAACqB,WAAW,CAAC,EAC/DtB,WAAW,CAACiB,KAAK,EAGff,iBAAiB,CAACC,kBAAkB,CAACkB,IAAI,EAAEpB,MAAM,CAACqB,WAAW,CAAC,CAEnE;AA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pB,MAAM,IAAIoB,QAAQ,CAACpB,MAAM,EAAE,IAAIC,OAAO,EAAE;UAAA,CAAC;UAAA,uBAChE,KAAC,SAAS;YAAC,IAAI,EAAC;UAAM;QAAE,EACb;MAAA,EACZ;IAAA,EAGQ;EAAA,EAET;AAEd,CAAC;AAAC;EA1IAR,IAAI;EACJQ,OAAO;AAAA;AA2IT,eAAeT,UAAU"}
|
|
@@ -67,14 +67,14 @@ var MobileMenuHeader = function MobileMenuHeader(_ref) {
|
|
|
67
67
|
type = item.type,
|
|
68
68
|
action = item.action,
|
|
69
69
|
rest = (0, _objectWithoutProperties2.default)(item, _excluded);
|
|
70
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileButton.ProfileButton, _objectSpread({
|
|
70
|
+
if (!!profile) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileButton.ProfileButton, _objectSpread({
|
|
71
71
|
onClick: function onClick(e) {
|
|
72
72
|
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
73
73
|
item.action ? item.action(e === null || e === void 0 ? void 0 : e.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu());
|
|
74
74
|
},
|
|
75
75
|
icon: !profile && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SystemIcons.User, {}),
|
|
76
76
|
initials: ((_profile$user$firstNa = profile === null || profile === void 0 ? void 0 : (_profile$user = profile.user) === null || _profile$user === void 0 ? void 0 : (_profile$user$firstNa2 = _profile$user.firstName) === null || _profile$user$firstNa2 === void 0 ? void 0 : _profile$user$firstNa2.charAt(0)) !== null && _profile$user$firstNa !== void 0 ? _profile$user$firstNa : '') + ((_profile$user$lastNam = profile === null || profile === void 0 ? void 0 : (_profile$user2 = profile.user) === null || _profile$user2 === void 0 ? void 0 : (_profile$user2$lastNa = _profile$user2.lastName) === null || _profile$user2$lastNa === void 0 ? void 0 : _profile$user2$lastNa.charAt(0)) !== null && _profile$user$lastNam !== void 0 ? _profile$user$lastNam : '')
|
|
77
|
-
}, rest), index);
|
|
77
|
+
}, rest), index);else return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
78
78
|
}
|
|
79
79
|
case 'submenu':
|
|
80
80
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileMenuHeader.cjs","names":["MobileMenuHeaderActions","styled","div","MobileMenuHeaderLabel","ComponentXSStyling","ComponentTextStyle","Bold","COLORS","neutral_600","BREAKPOINTS","SMALL","ComponentSStyling","MobileMenuHeaderWrapper","Breakpoints","LARGE","MobileMenuHeader","onGoBack","onClose","label","profile","buttons","onSubMenuOpen","buildProfileSubMenu","type","header","user","firstName","lastName","note","email","link","action","signOut","icon","disabled","items","sections","map","a","undefined","renderItem","item","index","placement","rest","e","nativeEvent","stopImmediatePropagation","target","charAt","menu","filter","marginLeft"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenuHeader.tsx"],"sourcesContent":["import React from 'react';\nimport {\n MobileMenuButtonTypes,\n MenuNavigationItemTypeGroup,\n ProfileMenu, MenuNavigationCustomSubMenu\n} from '../types';\nimport styled from 'styled-components';\nimport Breakpoints from '../../styles/breakpoints';\nimport {IconButton} from '../../Button';\nimport {SystemIcons} from '../../icons';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling} from '../../styles';\nimport {ProfileButton} from '../../ProfileButton';\n\nexport const MobileMenuHeaderActions = styled.div`\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n`;\nconst MobileMenuHeaderLabel = styled.div`\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nexport const MobileMenuHeaderWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 4px;\n\n ${Breakpoints.SMALL} {\n padding: 4px 8px;\n }\n\n ${Breakpoints.LARGE} {\n display: none;\n }\n`\n\ninterface MobileMenuHeaderProps {\n onGoBack?: () => void;\n onClose: () => void;\n label?: string;\n\n profile?: ProfileMenu\n buttons?: MobileMenuButtonTypes[];\n\n onSubMenuOpen?: (item?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => void;\n}\n\n\nconst MobileMenuHeader: React.FunctionComponent<MobileMenuHeaderProps> = ({\n onGoBack,\n onClose,\n label,\n profile,\n buttons,\n onSubMenuOpen\n }) => {\n\n const buildProfileSubMenu = () => !!profile ? {\n type: 'group',\n label: profile.label,\n header: {\n header: profile.user.firstName + ' ' + profile.user.lastName,\n note: profile.user.email,\n link: profile.user.link\n },\n action: {\n label: profile.signOut?.label,\n action: profile.signOut?.action,\n icon: profile.signOut?.icon,\n disabled: profile.signOut?.disabled\n },\n items: profile.sections.map(a => ({...a, type: 'section'}))\n } as MenuNavigationItemTypeGroup : undefined\n\n const renderItem = (item: MobileMenuButtonTypes, index: number) => {\n switch (item.type) {\n case 'profile': {\n const {placement, type, action, ...rest} = item;\n return <ProfileButton key={index}\n onClick={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action ? item.action(e?.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu())\n }}\n icon={!profile && <SystemIcons.User/>}\n initials={(profile?.user?.firstName?.charAt(0) ?? '') + (profile?.user?.lastName?.charAt(0) ?? '')}\n {...rest}/>\n }\n case 'submenu': {\n const {placement, type, icon, menu, ...rest} = item;\n\n return <IconButton key={index}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onSubMenuOpen && onSubMenuOpen(item.menu)\n }}\n {...rest}>\n {item.icon}\n </IconButton>\n }\n case 'action': {\n const {placement, type, icon, action, ...rest} = item;\n return <IconButton key={index}\n disabled={item.disabled}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action && item.action(e?.target) && onClose();\n }}\n {...rest}>\n {item.icon}\n </IconButton>\n }\n }\n }\n\n return (\n <MobileMenuHeaderWrapper>\n {\n onGoBack &&\n <IconButton action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onGoBack();\n }}\n variant={'secondary'}\n shape={'circular'}>\n <SystemIcons.ArrowLineLeft/>\n </IconButton>\n }\n {\n buttons?.filter(a => a.placement === 'left').map(renderItem)\n }\n {\n label &&\n <MobileMenuHeaderLabel>{label}</MobileMenuHeaderLabel>\n }\n <MobileMenuHeaderActions>\n {\n buttons?.filter(a => a.placement !== 'left').map(renderItem)\n }\n\n {\n onClose &&\n <div style={{marginLeft: '8px'}}>\n <IconButton variant={'secondary'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onClose();\n }}\n shape={'circular'}>\n <SystemIcons.Close/>\n </IconButton>\n </div>\n }\n </MobileMenuHeaderActions>\n\n </MobileMenuHeaderWrapper>\n )\n};\n\n\nexport default MobileMenuHeader;\n"],"mappings":";;;;;;;;;;;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AAAkD;AAAA;EAAA;EAAA;AAAA;AAAA;AAAA;AAE3C,IAAMA,uBAAuB,GAAGC,yBAAM,CAACC,GAAG,yKAKhD;AAAC;AACF,IAAMC,qBAAqB,GAAGF,yBAAM,CAACC,GAAG,yHACpC,IAAAE,0BAAkB,EAACC,0BAAkB,CAACC,IAAI,EAAEC,cAAM,CAACC,WAAW,CAAC,EAC/DC,mBAAW,CAACC,KAAK,EACf,IAAAC,yBAAiB,EAACN,0BAAkB,CAACC,IAAI,EAAEC,cAAM,CAACC,WAAW,CAAC,CAEnE;AAEM,IAAMI,uBAAuB,GAAGX,yBAAM,CAACC,GAAG,0PAM7CW,oBAAW,CAACH,KAAK,EAIjBG,oBAAW,CAACC,KAAK,CAGpB;AAAA;AAcD,IAAMC,gBAAgE,GAAG,SAAnEA,gBAAgE,OAOU;EAAA,IANJC,QAAQ,QAARA,QAAQ;IACRC,OAAO,QAAPA,OAAO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,UAAEA;IAAK,EAAyB,eAExD,sBAAC,uBAAuB;MAAA,WAEpBE,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE+B,MAAM,CAAC,UAAAb,CAAC;QAAA,OAAIA,CAAC,CAACK,SAAS,KAAK,MAAM;MAAA,EAAC,CAACN,GAAG,CAACG,UAAU,CAAC,EAI5DvB,OAAO,iBACP;QAAK,KAAK,EAAE;UAACmC,UAAU,EAAE;QAAK,CAAE;QAAA,uBAC9B,qBAAC,kBAAU;UAAC,OAAO,EAAE,WAAY;UACrB,MAAM,EAAE,gBAAAP,CAAC,EAAI;YACXA,CAAC,aAADA,CAAC,uBAADA,CAAC,CAAEC,WAAW,CAACC,wBAAwB,EAAE;YACzC9B,OAAO,EAAE;UACX,CAAE;UACF,KAAK,EAAE,UAAW;UAAA,uBAC5B,qBAAC,kBAAW,CAAC,KAAK;QAAE;MACT,EACT;IAAA,EAEgB;EAAA,EAEF;AAE9B,CAAC;AAAC;EA3HAD,QAAQ;EACRC,OAAO;EACPC,KAAK;EAGLE,OAAO;EAEPC,aAAa;AAAA;AAAA,eAuHAN,gBAAgB;AAAA"}
|
|
1
|
+
{"version":3,"file":"MobileMenuHeader.cjs","names":["MobileMenuHeaderActions","styled","div","MobileMenuHeaderLabel","ComponentXSStyling","ComponentTextStyle","Bold","COLORS","neutral_600","BREAKPOINTS","SMALL","ComponentSStyling","MobileMenuHeaderWrapper","Breakpoints","LARGE","MobileMenuHeader","onGoBack","onClose","label","profile","buttons","onSubMenuOpen","buildProfileSubMenu","type","header","user","firstName","lastName","note","email","link","action","signOut","icon","disabled","items","sections","map","a","undefined","renderItem","item","index","placement","rest","e","nativeEvent","stopImmediatePropagation","target","charAt","menu","filter","marginLeft"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenuHeader.tsx"],"sourcesContent":["import React from 'react';\nimport {\n MobileMenuButtonTypes,\n MenuNavigationItemTypeGroup,\n ProfileMenu, MenuNavigationCustomSubMenu\n} from '../types';\nimport styled from 'styled-components';\nimport Breakpoints from '../../styles/breakpoints';\nimport {IconButton} from '../../Button';\nimport {SystemIcons} from '../../icons';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling} from '../../styles';\nimport {ProfileButton} from '../../ProfileButton';\n\nexport const MobileMenuHeaderActions = styled.div`\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n`;\nconst MobileMenuHeaderLabel = styled.div`\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nexport const MobileMenuHeaderWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 4px;\n\n ${Breakpoints.SMALL} {\n padding: 4px 8px;\n }\n\n ${Breakpoints.LARGE} {\n display: none;\n }\n`\n\ninterface MobileMenuHeaderProps {\n onGoBack?: () => void;\n onClose: () => void;\n label?: string;\n\n profile?: ProfileMenu\n buttons?: MobileMenuButtonTypes[];\n\n onSubMenuOpen?: (item?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => void;\n}\n\n\nconst MobileMenuHeader: React.FunctionComponent<MobileMenuHeaderProps> = ({\n onGoBack,\n onClose,\n label,\n profile,\n buttons,\n onSubMenuOpen\n }) => {\n\n const buildProfileSubMenu = () => !!profile ? {\n type: 'group',\n label: profile.label,\n header: {\n header: profile.user.firstName + ' ' + profile.user.lastName,\n note: profile.user.email,\n link: profile.user.link\n },\n action: {\n label: profile.signOut?.label,\n action: profile.signOut?.action,\n icon: profile.signOut?.icon,\n disabled: profile.signOut?.disabled\n },\n items: profile.sections.map(a => ({...a, type: 'section'}))\n } as MenuNavigationItemTypeGroup : undefined\n\n const renderItem = (item: MobileMenuButtonTypes, index: number) => {\n switch (item.type) {\n case 'profile': {\n const {placement, type, action, ...rest} = item;\n if(!!profile)\n return <ProfileButton key={index}\n onClick={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action ? item.action(e?.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu())\n }}\n icon={!profile && <SystemIcons.User/>}\n initials={(profile?.user?.firstName?.charAt(0) ?? '') + (profile?.user?.lastName?.charAt(0) ?? '')}\n {...rest}/>\n else return <></>\n \n }\n case 'submenu': {\n const {placement, type, icon, menu, ...rest} = item;\n\n return <IconButton key={index}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onSubMenuOpen && onSubMenuOpen(item.menu)\n }}\n {...rest}>\n {item.icon}\n </IconButton>\n }\n case 'action': {\n const {placement, type, icon, action, ...rest} = item;\n return <IconButton key={index}\n disabled={item.disabled}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action && item.action(e?.target) && onClose();\n }}\n {...rest}>\n {item.icon}\n </IconButton>\n }\n }\n }\n\n return (\n <MobileMenuHeaderWrapper>\n {\n onGoBack &&\n <IconButton action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onGoBack();\n }}\n variant={'secondary'}\n shape={'circular'}>\n <SystemIcons.ArrowLineLeft/>\n </IconButton>\n }\n {\n buttons?.filter(a => a.placement === 'left').map(renderItem)\n }\n {\n label &&\n <MobileMenuHeaderLabel>{label}</MobileMenuHeaderLabel>\n }\n <MobileMenuHeaderActions>\n {\n buttons?.filter(a => a.placement !== 'left').map(renderItem)\n }\n\n {\n onClose &&\n <div style={{marginLeft: '8px'}}>\n <IconButton variant={'secondary'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onClose();\n }}\n shape={'circular'}>\n <SystemIcons.Close/>\n </IconButton>\n </div>\n }\n </MobileMenuHeaderActions>\n\n </MobileMenuHeaderWrapper>\n )\n};\n\n\nexport default MobileMenuHeader;\n"],"mappings":";;;;;;;;;;;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AAAkD;AAAA;EAAA;EAAA;AAAA;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AK;EAGLE,OAAO;EAEPC,aAAa;AAAA;AAAA,eA0HAN,gBAAgB;AAAA"}
|
|
@@ -16,6 +16,7 @@ import { SystemIcons } from '../../icons';
|
|
|
16
16
|
import { BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling } from '../../styles';
|
|
17
17
|
import { ProfileButton } from '../../ProfileButton';
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
export var MobileMenuHeaderActions = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n"])));
|
|
21
22
|
var MobileMenuHeaderLabel = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n ", " {\n ", "\n }\n"])), ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600), BREAKPOINTS.SMALL, ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600));
|
|
@@ -59,14 +60,14 @@ var MobileMenuHeader = function MobileMenuHeader(_ref) {
|
|
|
59
60
|
type = item.type,
|
|
60
61
|
action = item.action,
|
|
61
62
|
rest = _objectWithoutProperties(item, _excluded);
|
|
62
|
-
return /*#__PURE__*/_jsx(ProfileButton, _objectSpread({
|
|
63
|
+
if (!!profile) return /*#__PURE__*/_jsx(ProfileButton, _objectSpread({
|
|
63
64
|
onClick: function onClick(e) {
|
|
64
65
|
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
65
66
|
item.action ? item.action(e === null || e === void 0 ? void 0 : e.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu());
|
|
66
67
|
},
|
|
67
68
|
icon: !profile && /*#__PURE__*/_jsx(SystemIcons.User, {}),
|
|
68
69
|
initials: ((_profile$user$firstNa = profile === null || profile === void 0 ? void 0 : (_profile$user = profile.user) === null || _profile$user === void 0 ? void 0 : (_profile$user$firstNa2 = _profile$user.firstName) === null || _profile$user$firstNa2 === void 0 ? void 0 : _profile$user$firstNa2.charAt(0)) !== null && _profile$user$firstNa !== void 0 ? _profile$user$firstNa : '') + ((_profile$user$lastNam = profile === null || profile === void 0 ? void 0 : (_profile$user2 = profile.user) === null || _profile$user2 === void 0 ? void 0 : (_profile$user2$lastNa = _profile$user2.lastName) === null || _profile$user2$lastNa === void 0 ? void 0 : _profile$user2$lastNa.charAt(0)) !== null && _profile$user$lastNam !== void 0 ? _profile$user$lastNam : '')
|
|
69
|
-
}, rest), index);
|
|
70
|
+
}, rest), index);else return /*#__PURE__*/_jsx(_Fragment, {});
|
|
70
71
|
}
|
|
71
72
|
case 'submenu':
|
|
72
73
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileMenuHeader.js","names":["React","styled","Breakpoints","IconButton","SystemIcons","BREAKPOINTS","COLORS","ComponentSStyling","ComponentTextStyle","ComponentXSStyling","ProfileButton","MobileMenuHeaderActions","div","MobileMenuHeaderLabel","Bold","neutral_600","SMALL","MobileMenuHeaderWrapper","LARGE","MobileMenuHeader","onGoBack","onClose","label","profile","buttons","onSubMenuOpen","buildProfileSubMenu","type","header","user","firstName","lastName","note","email","link","action","signOut","icon","disabled","items","sections","map","a","undefined","renderItem","item","index","placement","rest","e","nativeEvent","stopImmediatePropagation","target","charAt","menu","filter","marginLeft"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenuHeader.tsx"],"sourcesContent":["import React from 'react';\nimport {\n MobileMenuButtonTypes,\n MenuNavigationItemTypeGroup,\n ProfileMenu, MenuNavigationCustomSubMenu\n} from '../types';\nimport styled from 'styled-components';\nimport Breakpoints from '../../styles/breakpoints';\nimport {IconButton} from '../../Button';\nimport {SystemIcons} from '../../icons';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling} from '../../styles';\nimport {ProfileButton} from '../../ProfileButton';\n\nexport const MobileMenuHeaderActions = styled.div`\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n`;\nconst MobileMenuHeaderLabel = styled.div`\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nexport const MobileMenuHeaderWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 4px;\n\n ${Breakpoints.SMALL} {\n padding: 4px 8px;\n }\n\n ${Breakpoints.LARGE} {\n display: none;\n }\n`\n\ninterface MobileMenuHeaderProps {\n onGoBack?: () => void;\n onClose: () => void;\n label?: string;\n\n profile?: ProfileMenu\n buttons?: MobileMenuButtonTypes[];\n\n onSubMenuOpen?: (item?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => void;\n}\n\n\nconst MobileMenuHeader: React.FunctionComponent<MobileMenuHeaderProps> = ({\n onGoBack,\n onClose,\n label,\n profile,\n buttons,\n onSubMenuOpen\n }) => {\n\n const buildProfileSubMenu = () => !!profile ? {\n type: 'group',\n label: profile.label,\n header: {\n header: profile.user.firstName + ' ' + profile.user.lastName,\n note: profile.user.email,\n link: profile.user.link\n },\n action: {\n label: profile.signOut?.label,\n action: profile.signOut?.action,\n icon: profile.signOut?.icon,\n disabled: profile.signOut?.disabled\n },\n items: profile.sections.map(a => ({...a, type: 'section'}))\n } as MenuNavigationItemTypeGroup : undefined\n\n const renderItem = (item: MobileMenuButtonTypes, index: number) => {\n switch (item.type) {\n case 'profile': {\n const {placement, type, action, ...rest} = item;\n return <ProfileButton key={index}\n onClick={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action ? item.action(e?.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu())\n }}\n icon={!profile && <SystemIcons.User/>}\n initials={(profile?.user?.firstName?.charAt(0) ?? '') + (profile?.user?.lastName?.charAt(0) ?? '')}\n {...rest}/>\n }\n case 'submenu': {\n const {placement, type, icon, menu, ...rest} = item;\n\n return <IconButton key={index}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onSubMenuOpen && onSubMenuOpen(item.menu)\n }}\n {...rest}>\n {item.icon}\n </IconButton>\n }\n case 'action': {\n const {placement, type, icon, action, ...rest} = item;\n return <IconButton key={index}\n disabled={item.disabled}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action && item.action(e?.target) && onClose();\n }}\n {...rest}>\n {item.icon}\n </IconButton>\n }\n }\n }\n\n return (\n <MobileMenuHeaderWrapper>\n {\n onGoBack &&\n <IconButton action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onGoBack();\n }}\n variant={'secondary'}\n shape={'circular'}>\n <SystemIcons.ArrowLineLeft/>\n </IconButton>\n }\n {\n buttons?.filter(a => a.placement === 'left').map(renderItem)\n }\n {\n label &&\n <MobileMenuHeaderLabel>{label}</MobileMenuHeaderLabel>\n }\n <MobileMenuHeaderActions>\n {\n buttons?.filter(a => a.placement !== 'left').map(renderItem)\n }\n\n {\n onClose &&\n <div style={{marginLeft: '8px'}}>\n <IconButton variant={'secondary'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onClose();\n }}\n shape={'circular'}>\n <SystemIcons.Close/>\n </IconButton>\n </div>\n }\n </MobileMenuHeaderActions>\n\n </MobileMenuHeaderWrapper>\n )\n};\n\n\nexport default MobileMenuHeader;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAMzB,OAAOC,MAAM,MAAM,mBAAmB;AACtC,OAAOC,WAAW,MAAM,0BAA0B;AAClD,SAAQC,UAAU,QAAO,cAAc;AACvC,SAAQC,WAAW,QAAO,aAAa;AACvC,SAAQC,WAAW,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAEC,kBAAkB,QAAO,cAAc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|
1
|
+
{"version":3,"file":"MobileMenuHeader.js","names":["React","styled","Breakpoints","IconButton","SystemIcons","BREAKPOINTS","COLORS","ComponentSStyling","ComponentTextStyle","ComponentXSStyling","ProfileButton","MobileMenuHeaderActions","div","MobileMenuHeaderLabel","Bold","neutral_600","SMALL","MobileMenuHeaderWrapper","LARGE","MobileMenuHeader","onGoBack","onClose","label","profile","buttons","onSubMenuOpen","buildProfileSubMenu","type","header","user","firstName","lastName","note","email","link","action","signOut","icon","disabled","items","sections","map","a","undefined","renderItem","item","index","placement","rest","e","nativeEvent","stopImmediatePropagation","target","charAt","menu","filter","marginLeft"],"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenuHeader.tsx"],"sourcesContent":["import React from 'react';\nimport {\n MobileMenuButtonTypes,\n MenuNavigationItemTypeGroup,\n ProfileMenu, MenuNavigationCustomSubMenu\n} from '../types';\nimport styled from 'styled-components';\nimport Breakpoints from '../../styles/breakpoints';\nimport {IconButton} from '../../Button';\nimport {SystemIcons} from '../../icons';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling} from '../../styles';\nimport {ProfileButton} from '../../ProfileButton';\n\nexport const MobileMenuHeaderActions = styled.div`\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n`;\nconst MobileMenuHeaderLabel = styled.div`\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nexport const MobileMenuHeaderWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 4px;\n\n ${Breakpoints.SMALL} {\n padding: 4px 8px;\n }\n\n ${Breakpoints.LARGE} {\n display: none;\n }\n`\n\ninterface MobileMenuHeaderProps {\n onGoBack?: () => void;\n onClose: () => void;\n label?: string;\n\n profile?: ProfileMenu\n buttons?: MobileMenuButtonTypes[];\n\n onSubMenuOpen?: (item?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => void;\n}\n\n\nconst MobileMenuHeader: React.FunctionComponent<MobileMenuHeaderProps> = ({\n onGoBack,\n onClose,\n label,\n profile,\n buttons,\n onSubMenuOpen\n }) => {\n\n const buildProfileSubMenu = () => !!profile ? {\n type: 'group',\n label: profile.label,\n header: {\n header: profile.user.firstName + ' ' + profile.user.lastName,\n note: profile.user.email,\n link: profile.user.link\n },\n action: {\n label: profile.signOut?.label,\n action: profile.signOut?.action,\n icon: profile.signOut?.icon,\n disabled: profile.signOut?.disabled\n },\n items: profile.sections.map(a => ({...a, type: 'section'}))\n } as MenuNavigationItemTypeGroup : undefined\n\n const renderItem = (item: MobileMenuButtonTypes, index: number) => {\n switch (item.type) {\n case 'profile': {\n const {placement, type, action, ...rest} = item;\n if(!!profile)\n return <ProfileButton key={index}\n onClick={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action ? item.action(e?.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu())\n }}\n icon={!profile && <SystemIcons.User/>}\n initials={(profile?.user?.firstName?.charAt(0) ?? '') + (profile?.user?.lastName?.charAt(0) ?? '')}\n {...rest}/>\n else return <></>\n \n }\n case 'submenu': {\n const {placement, type, icon, menu, ...rest} = item;\n\n return <IconButton key={index}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onSubMenuOpen && onSubMenuOpen(item.menu)\n }}\n {...rest}>\n {item.icon}\n </IconButton>\n }\n case 'action': {\n const {placement, type, icon, action, ...rest} = item;\n return <IconButton key={index}\n disabled={item.disabled}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action && item.action(e?.target) && onClose();\n }}\n {...rest}>\n {item.icon}\n </IconButton>\n }\n }\n }\n\n return (\n <MobileMenuHeaderWrapper>\n {\n onGoBack &&\n <IconButton action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onGoBack();\n }}\n variant={'secondary'}\n shape={'circular'}>\n <SystemIcons.ArrowLineLeft/>\n </IconButton>\n }\n {\n buttons?.filter(a => a.placement === 'left').map(renderItem)\n }\n {\n label &&\n <MobileMenuHeaderLabel>{label}</MobileMenuHeaderLabel>\n }\n <MobileMenuHeaderActions>\n {\n buttons?.filter(a => a.placement !== 'left').map(renderItem)\n }\n\n {\n onClose &&\n <div style={{marginLeft: '8px'}}>\n <IconButton variant={'secondary'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onClose();\n }}\n shape={'circular'}>\n <SystemIcons.Close/>\n </IconButton>\n </div>\n }\n </MobileMenuHeaderActions>\n\n </MobileMenuHeaderWrapper>\n )\n};\n\n\nexport default MobileMenuHeader;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAMzB,OAAOC,MAAM,MAAM,mBAAmB;AACtC,OAAOC,WAAW,MAAM,0BAA0B;AAClD,SAAQC,UAAU,QAAO,cAAc;AACvC,SAAQC,WAAW,QAAO,aAAa;AACvC,SAAQC,WAAW,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAEC,kBAAkB,QAAO,cAAc;AAC3G,SAAQC,aAAa,QAAO,qBAAqB;AAAC;AAAA;AAAA;AAElD,OAAO,IAAMC,uBAAuB,GAAGV,MAAM,CAACW,GAAG,2JAKhD;AACD,IAAMC,qBAAqB,GAAGZ,MAAM,CAACW,GAAG,2GACpCH,kBAAkB,CAACD,kBAAkB,CAACM,IAAI,EAAER,MAAM,CAACS,WAAW,CAAC,EAC/DV,WAAW,CAACW,KAAK,EACfT,iBAAiB,CAACC,kBAAkB,CAACM,IAAI,EAAER,MAAM,CAACS,WAAW,CAAC,CAEnE;AAED,OAAO,IAAME,uBAAuB,GAAGhB,MAAM,CAACW,GAAG,4OAM7CV,WAAW,CAACc,KAAK,EAIjBd,WAAW,CAACgB,KAAK,CAGpB;AAcD,IAAMC,gBAAgE,GAAG,SAAnEA,gBAAgE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,SAAS,KAAK,MAAM;IAAA,EAAC,CAACN,GAAG,CAACG,UAAU,CAAC,EAG5DtB,KAAK,iBACL,KAAC,qBAAqB;MAAA,UAAEA;IAAK,EAAyB,eAExD,MAAC,uBAAuB;MAAA,WAEpBE,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE+B,MAAM,CAAC,UAAAb,CAAC;QAAA,OAAIA,CAAC,CAACK,SAAS,KAAK,MAAM;MAAA,EAAC,CAACN,GAAG,CAACG,UAAU,CAAC,EAI5DvB,OAAO,iBACP;QAAK,KAAK,EAAE;UAACmC,UAAU,EAAE;QAAK,CAAE;QAAA,uBAC9B,KAAC,UAAU;UAAC,OAAO,EAAE,WAAY;UACrB,MAAM,EAAE,gBAAAP,CAAC,EAAI;YACXA,CAAC,aAADA,CAAC,uBAADA,CAAC,CAAEC,WAAW,CAACC,wBAAwB,EAAE;YACzC9B,OAAO,EAAE;UACX,CAAE;UACF,KAAK,EAAE,UAAW;UAAA,uBAC5B,KAAC,WAAW,CAAC,KAAK;QAAE;MACT,EACT;IAAA,EAEgB;EAAA,EAEF;AAE9B,CAAC;AAAC;EA9HAD,QAAQ;EACRC,OAAO;EACPC,KAAK;EAGLE,OAAO;EAEPC,aAAa;AAAA;AA0Hf,eAAeN,gBAAgB"}
|
|
@@ -59,8 +59,8 @@ export interface MenuSwitcherButton extends Omit<IconButtonProps, 'id' | 'type'
|
|
|
59
59
|
placement?: 'left' | 'right';
|
|
60
60
|
action?: (button?: EventTarget) => boolean | void;
|
|
61
61
|
}
|
|
62
|
-
export
|
|
63
|
-
export
|
|
62
|
+
export type DesktopMenuButtonTypes = MenuIconButton | MenuProfileButton | MenuSwitcherButton;
|
|
63
|
+
export type MobileMenuButtonTypes = MenuIconSubMenuButton | MenuIconButton | MenuProfileButton | MenuSwitcherButton;
|
|
64
64
|
export interface MobileNavigationMenuProps {
|
|
65
65
|
label?: string;
|
|
66
66
|
buttons?: MobileMenuButtonTypes[];
|
|
@@ -84,7 +84,7 @@ export interface MenuNavigationGroup<T = MenuNavigationItem | MenuNavigationSect
|
|
|
84
84
|
footer?: MenuGroupFooter;
|
|
85
85
|
action?: MenuButton;
|
|
86
86
|
}
|
|
87
|
-
export
|
|
87
|
+
export type MenuNavigationItem = {
|
|
88
88
|
icon?: React.ReactNode;
|
|
89
89
|
to: string;
|
|
90
90
|
exact?: boolean;
|
|
@@ -101,19 +101,19 @@ export interface MenuNavigationSection<T = MenuNavigationItem> {
|
|
|
101
101
|
label?: string;
|
|
102
102
|
items: T[];
|
|
103
103
|
}
|
|
104
|
-
export
|
|
104
|
+
export type MenuNavigationItemTypeItem = MenuNavigationItem & {
|
|
105
105
|
type?: 'item';
|
|
106
106
|
};
|
|
107
|
-
export
|
|
107
|
+
export type MenuNavigationItemTypeGroup = MenuNavigationGroup<MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection> & {
|
|
108
108
|
type: 'group';
|
|
109
109
|
icon?: React.ReactNode;
|
|
110
110
|
pinned?: boolean;
|
|
111
111
|
disabled?: boolean;
|
|
112
112
|
};
|
|
113
|
-
export
|
|
113
|
+
export type MenuNavigationItemTypeSection = MenuNavigationSection<MenuNavigationItemTypeItem> & {
|
|
114
114
|
type: 'section';
|
|
115
115
|
};
|
|
116
|
-
export
|
|
116
|
+
export type MenuNavigationCustomSubMenu = {
|
|
117
117
|
type: 'custom';
|
|
118
118
|
label?: string;
|
|
119
119
|
buttons?: MobileMenuButtonTypes[];
|
|
@@ -3,7 +3,7 @@ import { Size } from '../../types';
|
|
|
3
3
|
export declare const Search: import("styled-components").StyledComponent<"input", any, {
|
|
4
4
|
type: "search";
|
|
5
5
|
}, "type">;
|
|
6
|
-
|
|
6
|
+
type SearchBarInputProps = {
|
|
7
7
|
id: string;
|
|
8
8
|
searchTerm?: string;
|
|
9
9
|
setSearchTerm: (term: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Size } from '../types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type TextFieldProps = {
|
|
4
4
|
id: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
readOnly?: boolean;
|
|
@@ -19,7 +19,7 @@ export declare type TextFieldProps = {
|
|
|
19
19
|
margin?: string;
|
|
20
20
|
note?: TextFieldNote;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type TextareaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'placeholder' | 'disabled' | 'required' | 'onChange'> & {
|
|
23
23
|
id: string;
|
|
24
24
|
placeholder: string;
|
|
25
25
|
value?: string;
|
|
@@ -33,7 +33,7 @@ export declare type TextareaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAr
|
|
|
33
33
|
note?: TextFieldNote;
|
|
34
34
|
required: boolean;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type TextFieldNote = {
|
|
37
37
|
message: string;
|
|
38
38
|
icon: React.ReactNode;
|
|
39
39
|
};
|
package/dist/List/ListRow.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DropdownButtonProps } from '../Dropdown/DropdownButtonTypes';
|
|
3
3
|
import { Size } from '../types';
|
|
4
|
-
|
|
4
|
+
type Props = Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'onMouseDown' | 'onKeyDown'> & {
|
|
5
5
|
size?: Size;
|
|
6
6
|
variant?: 'normal' | 'overlay';
|
|
7
7
|
icon?: React.ReactNode;
|
package/dist/Modals/Modal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
type ModalContainerProps = {
|
|
3
3
|
id?: string;
|
|
4
4
|
showModal: boolean;
|
|
5
5
|
closeModal: () => void;
|
|
@@ -12,7 +12,7 @@ declare type ModalContainerProps = {
|
|
|
12
12
|
maxWidth?: string;
|
|
13
13
|
zIndex?: number;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
type ModalContainerState = {
|
|
16
16
|
scroll: number;
|
|
17
17
|
};
|
|
18
18
|
declare class ModalContainer extends React.Component<ModalContainerProps, ModalContainerState> {
|
|
@@ -20,4 +20,4 @@ export interface LeftFooterHyperlink extends HyperlinkProps, LeftFooterActionBas
|
|
|
20
20
|
export interface LeftFooterButton extends Pick<ButtonProps, 'variant' | 'id' | 'loading' | 'disabled' | 'icon' | 'type'>, LeftFooterActionBase {
|
|
21
21
|
text: string;
|
|
22
22
|
}
|
|
23
|
-
export
|
|
23
|
+
export type LeftFooterAction = LeftFooterButton | LeftFooterHyperlink;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyledComponentProps } from 'styled-components';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type StyledComponentPropsWithAs<C extends string | React.ComponentType<any>, T extends object, O extends object, A extends keyof any, AsC extends string | React.ComponentType<any> = C, FAsC extends string | React.ComponentType<any> = C> = StyledComponentProps<C, T, O, A, FAsC> & {
|
|
4
4
|
as?: AsC | undefined;
|
|
5
5
|
forwardedAs?: FAsC | undefined;
|
|
6
6
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Position, Size } from '../types';
|
|
3
|
-
|
|
3
|
+
type topSectionProps = {
|
|
4
4
|
text: string;
|
|
5
5
|
note?: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type actionButtonProps = {
|
|
8
8
|
icon: React.ReactNode;
|
|
9
9
|
action: () => void;
|
|
10
10
|
label?: string;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type bottomSectionProps = {
|
|
13
13
|
iconButtons?: actionButtonProps[];
|
|
14
14
|
textButton?: actionButtonProps;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
type PopoverProps = {
|
|
17
17
|
size?: Size.Small | Size.Medium | Size.Large;
|
|
18
18
|
topSectionProps?: topSectionProps;
|
|
19
19
|
bottomSectionProps?: bottomSectionProps;
|
package/dist/SideMenu/types.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { ButtonProps } from '../Button/Button';
|
|
|
2
2
|
import { IconButtonProps } from '../Button/Iconbutton';
|
|
3
3
|
import { MenuItemProps } from '../MenuItem/MenuItem';
|
|
4
4
|
import { Size } from '../types';
|
|
5
|
-
export
|
|
5
|
+
export type SideMenuAction = Omit<IconButtonProps, 'variant' | 'shape' | 'isInMobileMenu' | 'borderRadius' | 'flatEdge' | 'focusBackgroundColor' | 'useTransparentBackground' | 'unsetIconSize' | 'shouldNotInteract' | 'invertFocus' | 'hideOnLowWidth' | 'children'> & {
|
|
6
6
|
icon: React.ReactNode;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type SideMenuButton = Omit<ButtonProps, 'size' | 'iconOnly' | 'minWidth' | 'testId' | 'width' | 'invertFocus' | 'colorTheme' | 'flatEdge' | 'children'> & {
|
|
9
9
|
label: string;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type SideMenuItem = Omit<MenuItemProps, 'size'>;
|
|
12
12
|
export interface SideMenuHeader {
|
|
13
13
|
actions?: SideMenuAction[];
|
|
14
14
|
label?: string;
|
|
@@ -51,10 +51,10 @@ export interface TableColumn {
|
|
|
51
51
|
customContent?: (row: any, key: string) => any;
|
|
52
52
|
sortable?: boolean;
|
|
53
53
|
}
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
54
|
+
export type TableColumnTypes = 'text' | 'boolean' | 'number' | 'custom' | 'button' | 'icon' | 'link';
|
|
55
|
+
export type TableJustification = 'right' | 'left' | 'center';
|
|
56
|
+
export type TableSortingDirection = 'asc' | 'desc';
|
|
57
|
+
export type TableLayout = 'auto' | 'fixed';
|
|
58
58
|
export interface TablePagination {
|
|
59
59
|
from: number;
|
|
60
60
|
to: number;
|
package/dist/Tabs/TabLink.d.ts
CHANGED
package/dist/Tabs/Tabs.d.ts
CHANGED
package/dist/Tag/Tag.cjs
CHANGED
|
@@ -20,7 +20,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
20
20
|
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; }
|
|
21
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n height: 24px;\n width: calc(100%);\n
|
|
23
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n height: 24px;\n width: calc(100%);\n max-width: fit-content;\n justify-content: center;\n min-width: ", ";\n border-radius: 2px;\n\n &.neutral {\n background-color: ", ";\n color: ", ";\n }\n &.positive {\n background-color: ", ";\n color: ", ";\n }\n &.warning {\n background-color: ", ";\n color: ", ";\n }\n &.critical {\n background-color: ", ";\n color: ", ";\n }\n &.accent1 {\n background-color: ", ";\n color: ", ";\n }\n &.accent2 {\n background-color: ", ";\n color: ", ";\n }\n\n"])), function (props) {
|
|
24
24
|
return props.isLabelPresent ? '64px' : '';
|
|
25
25
|
}, _.COLORS.neutral_100, _.COLORS.neutral_600, _.COLORS.correct_100, _.COLORS.correct_600, _.COLORS.warning_100, _.COLORS.warning_600, _.COLORS.critical_100, _.COLORS.critical_600, _.COLORS.accent1_100, _.COLORS.accent1_600, _.COLORS.accent2_100, _.COLORS.accent2_600);
|
|
26
26
|
var IconContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 2px;\n margin: 4px;\n svg {\n width: 16px;\n height: 16px;\n }\n"])));
|
package/dist/Tag/Tag.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.cjs","names":["Container","styled","div","props","isLabelPresent","COLORS","neutral_100","neutral_600","correct_100","correct_600","warning_100","warning_600","critical_100","critical_600","accent1_100","accent1_600","accent2_100","accent2_600","IconContainer","TextContainer","icon","ComponentXSStyling","ComponentTextStyle","Bold","Tag","label","variant","className","rest","cls"],"sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentTextStyle, ComponentXSStyling } from '..';\n\nconst Container = styled.div<{variant: TagVariants, isLabelPresent: boolean}>`\n display: flex;\n height: 24px;\n width: calc(100%);\n
|
|
1
|
+
{"version":3,"file":"Tag.cjs","names":["Container","styled","div","props","isLabelPresent","COLORS","neutral_100","neutral_600","correct_100","correct_600","warning_100","warning_600","critical_100","critical_600","accent1_100","accent1_600","accent2_100","accent2_600","IconContainer","TextContainer","icon","ComponentXSStyling","ComponentTextStyle","Bold","Tag","label","variant","className","rest","cls"],"sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentTextStyle, ComponentXSStyling } from '..';\n\nconst Container = styled.div<{variant: TagVariants, isLabelPresent: boolean}>`\n display: flex;\n height: 24px;\n width: calc(100%);\n max-width: fit-content;\n justify-content: center;\n min-width: ${props=>props.isLabelPresent ? '64px' : ''};\n border-radius: 2px;\n\n &.neutral {\n background-color: ${COLORS.neutral_100};\n color: ${COLORS.neutral_600};\n }\n &.positive {\n background-color: ${COLORS.correct_100};\n color: ${COLORS.correct_600};\n }\n &.warning {\n background-color: ${COLORS.warning_100};\n color: ${COLORS.warning_600};\n }\n &.critical {\n background-color: ${COLORS.critical_100};\n color: ${COLORS.critical_600};\n }\n &.accent1 {\n background-color: ${COLORS.accent1_100};\n color: ${COLORS.accent1_600};\n }\n &.accent2 {\n background-color: ${COLORS.accent2_100};\n color: ${COLORS.accent2_600};\n }\n\n`;\n\nconst IconContainer = styled.div<{variant: TagVariants}>`\n border-radius: 2px;\n margin: 4px;\n svg {\n width: 16px;\n height: 16px;\n }\n`;\n\nconst TextContainer = styled.div<{variant: TagVariants, icon: React.ReactNode}>`\n border-radius: 2px;\n margin: ${props=> props.icon ? `4px 8px 4px 0` : `4px 8px`};\n height: 16px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden; \n ${ComponentXSStyling(ComponentTextStyle.Bold, null)}\n`;\n\n\nexport type TagVariants = 'neutral' | 'positive' | 'warning' | 'critical' | 'accent1' | 'accent2';\n\ntype TagProps = React.HTMLAttributes<HTMLDivElement> & {\n label?: string;\n icon?: React.ReactNode;\n variant?: TagVariants;\n}\n\nconst Tag: React.FunctionComponent<TagProps> = ({label, icon, variant='neutral', className, ...rest}) => {\n const cls = `${className ?? ''} ${variant}`;\n return ( \n <Container variant={variant} isLabelPresent={!!label} className={cls} {...rest}>\n {icon && <IconContainer variant={variant} data-testid={'iconContainer'}>\n {icon}\n </IconContainer>\n }\n {label && <TextContainer variant={variant} icon={icon}>\n {label}\n </TextContainer>\n }\n </Container>\n );\n};\n\nexport default Tag;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AAAoE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEpE,IAAMA,SAAS,GAAGC,yBAAM,CAACC,GAAG,yoBAMb,UAAAC,KAAK;EAAA,OAAEA,KAAK,CAACC,cAAc,GAAG,MAAM,GAAG,EAAE;AAAA,GAIhCC,QAAM,CAACC,WAAW,EAC7BD,QAAM,CAACE,WAAW,EAGPF,QAAM,CAACG,WAAW,EAC7BH,QAAM,CAACI,WAAW,EAGPJ,QAAM,CAACK,WAAW,EAC7BL,QAAM,CAACM,WAAW,EAGPN,QAAM,CAACO,YAAY,EAC9BP,QAAM,CAACQ,YAAY,EAGRR,QAAM,CAACS,WAAW,EAC7BT,QAAM,CAACU,WAAW,EAGPV,QAAM,CAACW,WAAW,EAC7BX,QAAM,CAACY,WAAW,CAG9B;AAED,IAAMC,aAAa,GAAGjB,yBAAM,CAACC,GAAG,iLAO/B;AAED,IAAMiB,aAAa,GAAGlB,yBAAM,CAACC,GAAG,oOAEpB,UAAAC,KAAK;EAAA,OAAGA,KAAK,CAACiB,IAAI,8BAA8B;AAAA,GAKxD,IAAAC,oBAAkB,EAACC,oBAAkB,CAACC,IAAI,EAAE,IAAI,CAAC,CACpD;AAWD,IAAMC,GAAsC,GAAG,SAAzCA,GAAsC,OAA6D;EAAA,IAAxDC,KAAK,QAALA,KAAK;IAAEL,IAAI,QAAJA,IAAI;IAAA,oBAAEM,OAAO;IAAPA,OAAO,6BAAC,SAAS;IAAEC,SAAS,QAATA,SAAS;IAAKC,IAAI;EACjG,IAAMC,GAAG,aAAMF,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EAAE,cAAID,OAAO,CAAE;EAC3C,oBACE,sBAAC,SAAS;IAAC,OAAO,EAAEA,OAAQ;IAAC,cAAc,EAAE,CAAC,CAACD,KAAM;IAAC,SAAS,EAAEI;EAAI,GAAKD,IAAI;IAAA,WAC3ER,IAAI,iBAAI,qBAAC,aAAa;MAAC,OAAO,EAAEM,OAAQ;MAAC,eAAa,eAAgB;MAAA,UAClEN;IAAI,EACS,EAEjBK,KAAK,iBAAI,qBAAC,aAAa;MAAC,OAAO,EAAEC,OAAQ;MAAC,IAAI,EAAEN,IAAK;MAAA,UACjDK;IAAK,EACQ;EAAA,GAER;AAEhB,CAAC;AAAC;EAnBAA,KAAK;EACLL,IAAI;EACJM,OAAO,4BALiB,SAAS,EAAG,UAAU,EAAG,SAAS,EAAG,UAAU,EAAG,SAAS,EAAG,SAAS;AAAA;AAAA,eAwBlFF,GAAG;AAAA"}
|
package/dist/Tag/Tag.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export type TagVariants = 'neutral' | 'positive' | 'warning' | 'critical' | 'accent1' | 'accent2';
|
|
3
|
+
type TagProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
4
|
label?: string;
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
6
|
variant?: TagVariants;
|
package/dist/Tag/Tag.js
CHANGED
|
@@ -11,7 +11,7 @@ import styled from 'styled-components';
|
|
|
11
11
|
import { COLORS, ComponentTextStyle, ComponentXSStyling } from '..';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n height: 24px;\n width: calc(100%);\n
|
|
14
|
+
var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n height: 24px;\n width: calc(100%);\n max-width: fit-content;\n justify-content: center;\n min-width: ", ";\n border-radius: 2px;\n\n &.neutral {\n background-color: ", ";\n color: ", ";\n }\n &.positive {\n background-color: ", ";\n color: ", ";\n }\n &.warning {\n background-color: ", ";\n color: ", ";\n }\n &.critical {\n background-color: ", ";\n color: ", ";\n }\n &.accent1 {\n background-color: ", ";\n color: ", ";\n }\n &.accent2 {\n background-color: ", ";\n color: ", ";\n }\n\n"])), function (props) {
|
|
15
15
|
return props.isLabelPresent ? '64px' : '';
|
|
16
16
|
}, COLORS.neutral_100, COLORS.neutral_600, COLORS.correct_100, COLORS.correct_600, COLORS.warning_100, COLORS.warning_600, COLORS.critical_100, COLORS.critical_600, COLORS.accent1_100, COLORS.accent1_600, COLORS.accent2_100, COLORS.accent2_600);
|
|
17
17
|
var IconContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border-radius: 2px;\n margin: 4px;\n svg {\n width: 16px;\n height: 16px;\n }\n"])));
|